Decoding method, encoding method, apparatus, device and storage medium
By using the enhanced time motion vector prediction mode in video encoding technology, the matching encoding unit search error problem caused by inaccurate motion information of surrounding encoding units is solved, and the encoding and decoding performance is improved.
Patent Information
- Application Number
- JP2024082505
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2021-03-19
- Filing Date
- 2024-05-21
- Publication Date
- 2025-04-02
- Estimated Expiration
- 2042-03-14
AI Technical Summary
In the existing video encoding technology, the accuracy of the time motion vector prediction mode depends on the accurate motion information of the surrounding coding units. If the motion information of the surrounding coding units is inaccurate, it will lead to inaccurate searches of the matching coding units, affecting the encoding and decoding performance.
By obtaining the enhanced time motion vector prediction mode flag and index value, the coordinate information of the initial matching encoding unit is determined, the enhanced time candidate list is constructed, and the corresponding motion vector prediction mode number is obtained based on the index value, and the coordinate information and motion information of the target matching encoding unit are determined, thereby improving the accuracy of motion vector prediction.
Improve the encoding and decoding performance, enhance the accuracy of motion vector prediction, and reduce matching encoding unit search errors caused by inaccurate motion information of surrounding encoding units.
Smart Images

Figure 0007655474000020 
Figure 0007655474000021 
Figure 0007655474000022
Abstract
Description
[Technical field]
[0001] The present invention relates to a video encoding / decoding technology, and in particular to a decoding method, an encoding method, an apparatus, a device and a machine-readable storage medium. [Background technology]
[0002] Complete video coding generally includes operations such as prediction, transformation, quantization, entropy coding, filtering, etc. Prediction can be divided into intra prediction and inter prediction, where intra prediction uses surrounding coded units as references to predict the current uncoded unit, effectively eliminating spatial redundancy, and inter prediction uses neighboring coded images to predict the current image, effectively eliminating temporal redundancy.
[0003] The Alternative Temporal Motion Vector Prediction (ATMVP) technology adopted in the Versatile Video Coding (VVC) standard uses motion information of temporal sub-blocks to provide different motion information for each sub-block in the current coding unit. Summary of the Invention [Problem to be solved by the invention]
[0004] In view of this, the present invention provides a decoding method, an encoding method, an apparatus, a device and a machine-readable storage medium. [Means for solving the problem]
[0005] According to a first aspect of an embodiment of the present invention, a decoding method is provided, including the steps of obtaining a value of an enhanced temporal motion vector prediction mode flag and an enhanced temporal motion vector prediction mode index value of a current coding unit; when the value of the enhanced temporal motion vector prediction mode flag is a first numerical value, determining coordinate information of an initial matching coding unit of the current coding unit based on coordinate information of the current coding unit; constructing an enhanced temporal candidate list based on the coordinate information of the initial matching coding unit; obtaining a corresponding enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list based on the enhanced temporal motion vector prediction mode index value, and determining coordinate information of a target matching coding unit corresponding to the enhanced temporal motion vector prediction mode number; determining motion information of a target matching coding unit including motion information of each sub-block in the target matching coding unit based on the coordinate information of the target matching coding unit, and determining motion information of a sub-block at a corresponding position in the current coding unit based on the motion information of each sub-block in the target matching coding unit.
[0006] According to a second aspect of the embodiment of the present invention, the following steps are included: based on the coordinate information of the current coding unit, determining the coordinate information of an initial matching coding unit of the current coding unit; based on the coordinate information of the initial matching coding unit, constructing an enhanced temporal candidate list; traversing each enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list in order, and determining the coordinate information of a target matching coding unit corresponding to each enhanced temporal motion vector prediction mode number; based on the coordinate information of the target matching coding unit, determining the motion information of a target matching coding unit, which includes the motion information of each sub-block in the target matching coding unit, and then calculating the target matching coding unit. In accordance with the present invention, there is provided an encoding method including: determining motion information of a sub-block at a corresponding position in the current coding unit based on the motion information of each sub-block in the current coding unit; performing motion compensation for the corresponding sub-block in the current coding unit based on the motion information of each sub-block in the current coding unit; calculating a rate-distortion cost value corresponding to an enhanced temporal motion vector prediction mode, comparing the rate-distortion cost value with rate-distortion cost values of other prediction modes, selecting a prediction mode corresponding to a minimum rate-distortion cost value, writing a corresponding enhanced temporal motion vector prediction mode flag and an enhanced temporal motion vector prediction mode index value into a bitstream and transmitting to a decoding device.
[0007] According to a third aspect of an embodiment of the present invention, a decoding device is provided, including: an acquisition unit for acquiring a value of an enhanced temporal motion vector prediction mode flag and an enhanced temporal motion vector prediction mode index value of a current coding unit; a first determination unit for determining coordinate information of an initial matching coding unit of the current coding unit based on coordinate information of the current coding unit when the value of the enhanced temporal motion vector prediction mode flag is a first numerical value; a construction unit for constructing an enhanced temporal candidate list based on the coordinate information of the initial matching coding unit; a second determination unit for obtaining a corresponding enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list based on the enhanced temporal motion vector prediction mode index value and determining coordinate information of a target matching coding unit corresponding to the enhanced temporal motion vector prediction mode number; and a third determination unit for determining motion information of a target matching coding unit including motion information of each sub-block in the target matching coding unit based on the coordinate information of the target matching coding unit, and determining motion information of a sub-block at a corresponding position in the current coding unit based on the motion information of each sub-block in the target matching coding unit.
[0008] According to a fourth aspect of the embodiment of the present invention, a first determination unit is provided for determining, based on coordinate information of a current coding unit, coordinate information of an initial matching coding unit of a current coding unit; a construction unit is provided for constructing an enhanced temporal candidate list based on the coordinate information of the initial matching coding unit; a second determination unit is provided for sequentially traversing each enhanced temporal candidate mode in the enhanced temporal candidate list and determining coordinate information of a target matching coding unit corresponding to each mode; and a second determination unit is provided for determining, based on the coordinate information of the target matching coding unit, motion information of a target matching coding unit including motion information of each sub-block in the target matching coding unit, and each sub-block in the target matching coding unit is determined. An encoding device is provided, the encoding device including: a third determination unit for determining, based on the motion information of a block, motion information of a sub-block at a corresponding position in the current encoding unit; a motion compensation unit for performing motion compensation on a corresponding sub-block in the current encoding unit based on the motion information of each sub-block in the current encoding unit; and an encoding unit for calculating a rate-distortion cost value corresponding to an enhanced temporal motion vector prediction mode, comparing the rate-distortion cost value with rate-distortion cost values of other prediction modes, selecting a prediction mode corresponding to the smallest rate-distortion cost value, writing corresponding enhanced temporal motion vector prediction mode flags and enhanced temporal motion vector prediction mode index values into a bitstream, and transmitting to a decoding device.
[0009] According to a fifth aspect of an embodiment of the present invention, there is provided a decoding device including a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being adapted to execute the machine-executable instructions to perform the decoding method of the first aspect.
[0010] According to a sixth aspect of an embodiment of the present invention, there is provided an encoding device including a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being adapted to execute the machine-executable instructions to implement the encoding method of the second aspect.
[0011] According to a seventh aspect of an embodiment of the present invention there is provided a machine-readable storage medium storing machine-executable instructions which, when executed by a processor, perform a method according to the first or second aspect. Effect of the Invention
[0012] A decoding method according to an embodiment of the present invention obtains a value of an enhanced temporal motion vector prediction mode flag and an enhanced temporal motion vector prediction mode index value of a current coding unit; when the value of the enhanced temporal motion vector prediction mode flag is a first value, determines coordinate information of an initial matching coding unit of the current coding unit according to coordinate information of the current coding unit; constructs an enhanced temporal candidate list according to the coordinate information of the initial matching coding unit; obtains a corresponding enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list according to the enhanced temporal motion vector prediction mode index value; determines coordinate information of a target matching coding unit corresponding to the enhanced temporal motion vector prediction mode number; determines motion information of a target matching coding unit including motion information of each sub-block in the target matching coding unit according to the coordinate information of the target matching coding unit; and determines motion information of a sub-block at a corresponding position in the current coding unit according to the motion information of each sub-block in the target matching coding unit, thereby improving encoding and decoding performance. [Brief description of the drawings]
[0013] [Figure 1] 1 is a schematic diagram of an encoding / decoding method according to an exemplary embodiment of the present invention; [Diagram 2]FIG. 2 is a schematic diagram of a Clip operation shown in an exemplary embodiment of the present invention. [Diagram 3] 4 is a flowchart of a decoding method according to an exemplary embodiment of the present invention; [Figure 4] FIG. 2 is a schematic diagram of a reference block when offsetting a matching coding unit as shown in an exemplary embodiment of the present invention; [Diagram 5] FIG. 2 is a schematic diagram of a first peripheral block of a current encoding unit shown in an exemplary embodiment of the present invention; [Figure 6] 4 is a flowchart of another decoding method according to an exemplary embodiment of the present invention. [Figure 7] 2 is a schematic diagram of the structure of a decoding device shown in an exemplary embodiment of the present invention; [Figure 8] 4 is a schematic diagram of the structure of another decoding device shown in an exemplary embodiment of the present invention; [Figure 9] 2 is a schematic diagram of a hardware structure of a decoding device shown in an exemplary embodiment of the present invention; [Figure 10] 2 is a schematic diagram of the structure of an encoding device according to an exemplary embodiment of the present invention; [Figure 11] 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] Exemplary embodiments will now be described in detail, examples of which are shown in the drawings. Where the following description refers to the drawings, the same numerals in different drawings represent the same or similar elements unless otherwise noted. The embodiments described in the following exemplary embodiments are not representative of 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.
[0015] The terms used in the present invention are merely for the purpose of describing specific embodiments, and are not intended to limit the present invention. As used in the present invention and the appended claims, the singular forms "a kind," "the," and "the" are also intended to include the plural forms unless the context clearly indicates otherwise.
[0016] In order to help those skilled in the art to better understand the technical solutions provided in the embodiments of the present invention, some technical terms related to the embodiments of the present invention and a main flow of conventional video encoding and decoding will be briefly described below.
[0017] In order to enable those skilled in the art to better understand the technical solutions provided in the embodiments of the present invention, some technical terms related to the embodiments of the present invention will be briefly described below.
[0018] Technical terms: 1. Prediction Signal: This refers to the pixel value derived from the encoded and decoded pixels. The residual is obtained from the difference between the original pixel and the predicted pixel, and then the residual is transformed and quantized and the coefficient is coded.
[0019] For example, an inter-predicted pixel is a pixel value derived from a reference frame (reconstructed pixel frame) of a current image block, and since the pixel positions are discrete, the final predicted pixel needs to be obtained by an interpolation operation. The closer the predicted pixel is to the original pixel, the smaller the residual energy obtained by subtracting the two will be, and the higher the coding compression performance will be.
[0020] 2. Motion Vector (abbreviated as MV): In inter-coding, MV represents the relative displacement between the current coding unit and the best matching coding unit in its reference image. Each divided block (which may be called sub-block) has a corresponding motion vector that needs to be transmitted to the decoding side. If the MV of each sub-block is coded and transmitted independently, a significant amount of bits will be consumed, especially for sub-blocks that are divided into small sizes. In order to reduce the number of bits for coding the MV, the spatial correlation between adjacent image blocks is utilized in video coding, and the MV of the current block to be coded is predicted based on the MV of the adjacent coded blocks, and the prediction difference is coded. In this way, the number of bits representing the MV can be effectively reduced. Based on this, in the process of coding the MV of the current image block, the MV of the current image block is generally predicted using the MV of the adjacent coded blocks first, and the difference between the predicted value of the MV (abbreviated as Motion Vector Prediction, MVP) and the actual estimated value of the motion vector, i.e., the difference motion vector (abbreviated as Motion Vector Difference, MVD), is coded, thereby effectively reducing the number of bits for coding the MV.
[0021] 3. Motion Information: MV represents the relative displacement between the current coding unit and the best matching coding unit in a reference image, so in order to accurately obtain information for an image block, in addition to MV information, it is necessary to indicate which reference image was used in the reference image index information. In video coding technology, a reference image list is generally created for the current image based on a certain principle, and the reference image index information indicates which reference image in the reference image list was used by the current image block. In addition, since many coding technologies support multiple reference image lists, an index value indicating which reference image list was used is also required, and the index value may be called a reference direction. In video coding, coding information related to motion, such as MV, reference frame index, and reference direction, is collectively called motion information. For example, the motion information is a 5-tuple for inter prediction consisting of a prediction reference mode, an L0 motion vector, an L1 motion vector, an L0 reference index, and an L1 reference index.
[0022] 4. Rate-Distortion Optimized (RDO) Principle: The indexes for evaluating the coding efficiency include bit rate and peak signal to noise ratio (PSNR). The smaller the bit rate, the higher the compression rate, and the higher the PSNR, the better the reconstructed image quality. When selecting a mode, the discriminant is essentially a comprehensive evaluation of both. The cost corresponding to the mode: J(mode)=D+λ*R.
[0023] Here, D stands for distortion, which is generally evaluated using the Sum of Squared Errors (SSE) metric, where SSE is the sum of squared residuals 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 mode, which includes the sum of the number of bits required for coding mode information, motion information, residuals, etc.
[0024] When selecting a mode, using the RDO principle to compare and decide between coding modes usually ensures optimal coding performance.
[0025] 5. Bidirectional Optical Flow (BI-directional Optical flow, abbreviated as BIO): BIO technology uses gradient information of pixel values in forward and backward reference frames to add optical flow compensation value to the current coding unit. Illustratively, the technical details of BIO may be as follows:
[0026] 5.1. Calculate the sums of gradients S1, S2, S3, S5, and S6.
number
number
number
number
number
[0027] Where:
number
number
number
number
number
[0028] Here, I (0) (x,y) and I (1) (x,y) are the forward motion compensation value, the backward motion compensation value and their extension value. The extension method can be copying from the motion compensation value at the block boundary or obtaining from the reference pixel position.
number
number
[0029] 5.2. Next, the improved motion vector v x and v y Calculate.
number
number
[0030] Here, << is the left shift operator, and "x>y?z:a" means that if "x>y" is true, the value is z, and if "x>y" is not true, the value is a. BIO are all thresholds, r is a regularization term to avoid division by zero. S1, S2, S3, S5 and S6 are sums of pixel gradients, and clip3 has a value of -th BIO and BIO This represents a guarantee that the
[0031] 5.3. Obtain the optical flow offset value b based on the improved motion vector.
number
[0032] where (x,y) are the coordinates of each pixel in the current coding unit, and I (0) (x,y) and I (1) (x,y) is the forward motion compensation value, the backward motion compensation value and its extended value.
[0033] 5.4. Finally, the prediction value pred of each pixel in the current coding unit is calculated based on the optical flow offset value. BIO Calculate (x,y).
number
[0034] Here, I (0) (x,y) and I (1) (x,y) are the forward motion compensation value and the backward motion compensation value.
[0035] 6. Decoder-side Motion Vector Refinement (DMVR): Decoder-side motion vector refinement technology DMVR is applied to direct mode or skip mode.
[0036] Illustratively, the technical details of the DMVR are as follows:
[0037] 6.1. The initial MV is used to obtain the prediction block and the necessary reference pixels in the search area.
[0038] 6.2. Obtain the optimal integer pixel position.
[0039] For example, the luminance image block of the current coding unit is divided into non-overlapping sub-blocks adjacent to each other, and the initial MVs of all the sub-blocks are MV0 and MV1. For each sub-block, the position corresponding to the initial MV0 and MV1 is used as the center to search for the position with the smallest template matching distortion within a certain range in the vicinity, and the template matching distortion is calculated by calculating the SAD (Sum of Absolute Differences) value between the block obtained by multiplying the sub-block width from the center position in the forward search area by the sub-block height and the block obtained by multiplying the sub-block width from the center position in the backward search area by the sub-block height.
[0040] 6.3. Obtain the optimal sub-pixel position.
[0041] For example, the sub-pixel position is confirmed by using template matching distortion values at five locations in total, including the optimal integer position, the left side, the right side, the upper side, and the lower side, estimating a quadratic distortion plane near the optimal integer position, and calculating the position on the distortion plane with the smallest distortion as the sub-pixel position. The calculation formula is as follows: Horizontal subpixel position=(sad_left-sad_right)*N / ((sad_right+sad_left-2*sad_mid)*2) Vertical subpixel position=(sad_btm-sad_top)*N / ((sad_top+sad_btm-2*sad_mid)*2)
[0042] Here, sad_mid, sad_left, sad_right, sad_top, and sad_btm are the template matching distortion values at the optimum position of the integer position, its left side, its right side, its upper side, and its lower side, totaling five positions, and N is the precision.
[0043] 6.4. Based on the optimal MV, the final predicted block is calculated.
[0044] Below, we will briefly explain the main flow of conventional video encoding and decoding.
[0045] Taking video coding as an example, as shown in (a) in Figure 1, video coding generally includes processes such as prediction, transformation, quantization, entropy coding, etc., and the coding process can be realized according to the framework in (b) in Figure 1.
[0046] Here, prediction can be divided into intra prediction and inter prediction, where intra prediction uses surrounding coded blocks as references to predict a current uncoded block, effectively removing spatial redundancy, and inter prediction predicts a current image using adjacent coded images, effectively removing temporal redundancy.
[0047] 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 with an appropriate transformation, an image can be transformed from a dispersed distribution in the spatial domain to a relatively concentrated distribution in the transform domain, which can remove the frequency domain correlation between signals, and together with the quantization process, can effectively compress the bitstream.
[0048] Entropy coding is a lossless coding scheme that can convert a series of element symbols into a binary stream for transmission or storage, where the input symbols may include quantized transform coefficients, motion vector information, prediction mode information, syntax related to transform quantization, etc. Entropy coding can effectively remove redundancy in the video element symbols.
[0049] The above takes encoding as an example, and video decoding corresponds to the process of video encoding, that is, video decoding generally includes processes such as entropy decoding, prediction, inverse quantization, inverse transform, filtering, etc., and the realization principle of each process is the same or similar to that of video encoding.
[0050] Below, we briefly explain how ATMVP technology can be realized.
[0051] The realization of conventional ATMVP technology mainly includes the following flow:
[0052] 1) Determination of Temporal Motion Vector Prediction (TMVP): It is determined whether the motion information at the A0 position of the current coding unit satisfies the following condition. a) The A0 position exists and is in the same slice and unit as the current coding unit; b) The prediction mode for the A0 position is inter mode; c) The reference frame index of the A0 position matches the reference frame index of the co-located frame of the current frame (first determine the L0 direction, then determine the L1 direction).
[0053] Here, the A0 position is the position (xCb-1, yCb+CbHeight-1), where (xCb, yCb) are the coordinates of the top-left corner of the current unit, and CbHeight is the height of the current coding unit.
[0054] 2) Calculate the position of the central reference block: The precision of the TMVP obtained in step 1) is 1 / 16, and it needs to be converted to integer pixels by shifting it right by 4 bits. Also, the position of the reference block needs to be clipped to within the range of the co-located LCU in the reference frame of the current LCU (Largest Coding Unit), i.e., if the position of the reference block is not within the range of the co-located LCU in the reference frame of the current LCU, it needs to shift the reference block horizontally and / or vertically so that it is just within the range of the co-located LCU in the reference frame of the current LCU, which is shown in Fig. 2.
[0055] The calculation method of the position of the central reference block is as follows: xColCb=Clip3(xCtb,Min(PicWidth-1,xCtb+(1<<CtbLog2Size)+3),xColCtrCb+(tempMv[0]> >4)) yColCb=Clip3(yCtb,Min(PicHeight-1,yCtb+(1<<CtbLog2Size)-1),yColCtrCb+(tempMv[1]> >4))
[0056] Here, (xColCb, yColCb) are the coordinates of the upper left corner of the central reference block, (xCtb, yCtb) are the coordinates of the upper left corner of the colocated LCU in the reference frame of the current LCU, PicWidth and PicHeight are the width and height of the current frame, respectively, CtbLog2Size is the base 2 logarithm of the size of the current LCU, (xColCtrCb, yColCtrCb) are the coordinates of the center position of the current coding unit, and tempMv[0] and tempMv[1] are the horizontal and vertical motion vectors of the A0 position, respectively.
[0057] 3) Determine the prediction mode of the central reference block. If the prediction mode is a non-inter prediction mode, ctrPredFlagL0 and ctrPredFlagL1 are both 0; otherwise, that is, if the prediction mode is an inter prediction mode, proceed to step 4).
[0058] 4),Adjustment of reference position: Since the size of the sub-block is 8*8, the motion information is in units of 8*8. Therefore, the coordinate of the upper left corner of the central reference block needs to be adjusted to 8 times the coordinate position. The adjustment formula is as follows: xColCb=((xColCb>>3)<<3) yColCb=((yColCb>>3)<<3)
[0059] 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 and L1 directions of the adjusted central reference block exists; if it exists, FlagLXCol=1, and obtain the motion information in the L0 and L1 directions of the adjusted central reference block.
[0060] Exemplarily, 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.
[0061] If the prediction mode of the adjusted central reference block is neither intra prediction 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.
[0062] When FlagLXCol=1, if the long-term reference frame of the current frame and the long-term reference frame of the co-located frame are not equal, it is determined that the motion information of the adjusted central reference block is unavailable, 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 is used as the motion information of the current central reference block position, and ctrPredFlagLX=1.
[0063] 6) If ctrPredFlagLX=1, calculate motion information of each subblock: traverse each subblock in the matching coding unit, and for any subblock, clip the subblock within the range of the LCU in which the matching coding unit is located, 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 position corresponding to the current coding unit; 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 position corresponding to the current coding unit.
[0064] For example, based on the motion information of the adjacent blocks of the current coding unit, a coding unit corresponding to the adjacent coding unit of the current coding unit in a co-located frame may be searched for, and the motion information of each sub-block within the coding unit located at the position corresponding to the current coding unit in the co-located frame may be provided to each sub-block in the current coding unit for use.
[0065] Searching for a coding unit at a position corresponding to the current coding unit in a co-located frame needs to rely on the motion information of the coding units surrounding the current coding unit. If the motion information of the surrounding coding units is not accurate, the motion information of the coding unit at the corresponding position obtained by the search will also be unreliable, which will affect the encoding and decoding performance.
[0066] In order to improve the reliability of the motion information of the matching coding unit and optimize the encoding and decoding performance, an embodiment of the present invention determines the matching coding unit using the motion information of the co-located coding unit in the co-located frame of the current coding unit, and performs a series of offsets, such as up, down, left, right, etc., on the matching coding unit obtained by the search to generate multiple temporal candidate modes, thereby to some extent avoiding the problem that the matching coding unit cannot be accurately found due to the inaccuracy of the motion information of the surrounding coding units.
[0067] The main implementation flow of the embodiment of the present invention may include the following six parts:
[0068] In a first part (which may be denoted as A), an Enhanced Temporal Motion Vector Prediction (ETMVP) mode flag and an Enhanced Temporal Motion Vector Prediction mode index value are coded / analyzed based on the coding / decoding conditions of the current coding unit.
[0069] In a second part (which may be denoted as B), determine coordinate information of an initial matching coding unit of the current coding unit based on the coordinate information of the current coding unit.
[0070] In the third part (which may be denoted as C), an enhanced temporal candidate list is constructed based on the coordinate information of the initial matching coding unit.
[0071] In a fourth part (which may be denoted as D), based on the enhanced temporal motion vector prediction mode index value, obtain a corresponding enhanced temporal motion vector prediction mode in the enhanced temporal candidate mode list, and determine coordinate information of the target matching coding unit corresponding to the enhanced temporal motion vector prediction mode.
[0072] In a fifth part (which may be denoted as E), obtain the motion information of each sub-block in the current coding unit based on the coordinate information of the target matching coding unit.
[0073] In a sixth part (which may be denoted as F), based on the motion information of each sub-block in the current coding unit, perform motion compensation on the corresponding sub-block in the current coding unit.
[0074] Illustratively, the order of the above six parts may be adjusted.
[0075] In order to make the above objectives, features and advantages of the embodiments of the present invention more apparent, the technical solutions in the embodiments of the present invention will be described in more detail below with reference to the drawings.
[0076] As shown in FIG. 3, it is a flowchart of a decoding method provided in an embodiment of the present invention, where the decoding method can be applied to a decoding device, and as shown in FIG. 3, the decoding method may include the following steps:
[0077] In step S300, the value of the enhanced temporal motion vector prediction mode flag and the enhanced temporal motion vector prediction mode index value of the current coding unit are obtained.
[0078] In the embodiment of the present invention, the current coding unit may be any coding unit in the image to be processed. In the implementation, the image to be processed may be divided into different coding units, and each coding unit may be sequentially processed according to a certain order. Here, the size and shape of each coding unit may be set according to a preset division rule.
[0079] Exemplarily, when decoding a current coding unit, a value of the enhanced temporal motion vector prediction mode flag and an enhanced temporal motion vector prediction mode index value of the current coding unit may be obtained.
[0080] Exemplarily, the value of the enhanced temporal motion vector prediction mode flag of the current coding unit may be analyzed from the bitstream, or may be derived if the current coding unit meets a certain condition.
[0081] Exemplarily, the enhanced temporal motion vector prediction mode index value of the current coding unit may be parsed from the bitstream, or may be derived if the current coding unit satisfies a certain condition.
[0082] When the obtained value of the enhanced temporal motion vector prediction mode flag of the current coding unit is the first numerical value, steps S310 to S340 are executed.
[0083] Illustratively, the value of the enhanced temporal motion vector prediction mode flag may include a value (referred to herein as a first numerical value, e.g., 1) indicating enabling the enhanced temporal motion vector prediction mode.
[0084] In step S310, coordinate information of an initial matching coding unit of the current coding unit is determined according to the coordinate information of the current coding unit.
[0085] In an embodiment of the present invention, if the value of the enhanced temporal motion vector prediction mode flag of the acquired current encoding unit is a first value, it may be determined that the current encoding unit enables the enhanced temporal motion vector prediction mode, and in this case, the coordinate information of the initial matching encoding unit may be determined.
[0086] Exemplarily, the coordinate information of an initial matching coding unit of the current coding unit may be determined based on the coordinate information of the current coding unit.
[0087] Exemplarily, the coordinate information of the initial matching coding unit may be coordinate information of the initial matching coding unit in the corresponding reference image, for example, the upper left corner coordinate.
[0088] In step S320, an enhanced temporal candidate list is constructed based on the coordinate information of the initial matching coding unit.
[0089] In an embodiment of the present invention, when the coordinate information of the initial matching coding unit of the current coding unit is determined, the enhanced temporal candidate list may be constructed according to the coordinate information of the initial matching coding unit.
[0090] Exemplarily, the enhanced temporal candidate list includes at least one enhanced temporal motion vector prediction mode number.
[0091] Exemplarily, the coordinate information of the matching coding units corresponding to different enhanced temporal motion vector prediction mode numbers may be different.
[0092] In step S330, according to the enhanced temporal motion vector prediction mode index value, obtain a corresponding enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list, and determine coordinate information of the target matching coding unit corresponding to the enhanced temporal motion vector prediction mode number.
[0093] In an embodiment of the present invention, based on the enhanced temporal motion vector prediction mode index value of the current coding unit obtained in step S300, a corresponding enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list may be obtained, and the coordinate information of the target matching coding unit corresponding to the enhanced temporal motion vector prediction mode number may be determined.
[0094] Exemplarily, the target matching coding unit may include an initial matching coding unit, or a matching coding unit obtained by performing up / down / left / right offset on the initial matching coding unit.
[0095] For example, the coordinate information of the target matching coding unit may be equal to the coordinate information of the initial matching coding unit, or may be obtained by adjusting the coordinate information of the initial matching coding unit according to a preset offset amount.
[0096] In step S340, based on the coordinate information of the target matching coding unit, motion information of the target matching coding unit is determined, which includes motion information of each sub-block in the target matching coding unit, and based on the motion information of each sub-block in the target matching coding unit, motion information of the sub-block at the corresponding position in the current coding unit is determined.
[0097] In an embodiment of the present invention, when the coordinate information of the target matching coding unit is determined, the motion information of the target matching coding unit may be determined according to the coordinate information of the target matching coding unit. Illustratively, the motion information of the target matching coding unit includes the motion information of each sub-block in the target matching coding unit.
[0098] Exemplarily, the motion information of a sub-block at a corresponding position in the current coding unit may be determined based on the motion information of each sub-block in the target matching coding unit, for example, the motion information of a sub-block at the h-th row and l-th column in the target matching coding unit is determined based on the motion information of the sub-block at the h-th row and l-th column in the current coding unit.
[0099] In some embodiments, in step S300, the step of obtaining the value of the enhanced temporal motion vector prediction mode flag of the current encoding unit may include a step of analyzing the value of the enhanced temporal motion vector prediction mode flag from the bitstream if the current encoding unit satisfies a first analysis condition, and otherwise determining that the value of the enhanced temporal motion vector prediction mode flag is a second numerical value, where the value of the enhanced temporal motion vector prediction mode flag being the second numerical value indicates that the current encoding unit does not enable the enhanced temporal motion vector prediction mode.
[0100] For example, it is taken into consideration that the use of the enhanced temporal motion vector prediction mode generally requires certain conditions to be met, and if the conditions are not met, the enhanced temporal motion vector prediction mode may not be applicable, in which case the value of the enhanced temporal motion vector prediction mode flag does not need to be parsed from the bitstream but may be derived.
[0101] For example, it may be decided to analyze the value of the enhanced temporal motion vector prediction mode flag of the current coding unit from the bitstream or to derive the value of the enhanced temporal motion vector prediction mode flag of the current coding unit based on whether the current coding unit satisfies a specified condition (referred to as a first analysis condition in this specification).
[0102] Exemplarily, if the current encoding unit satisfies the first analysis condition, the value of the enhanced temporal motion vector prediction mode flag of the current encoding unit is analyzed from the bitstream; if the current encoding unit does not satisfy the first analysis condition, there is no need to analyze the value of the enhanced temporal motion vector prediction mode flag of the current encoding unit from the bitstream, and it may be determined that the current encoding unit does not enable the enhanced temporal motion vector prediction mode, and the value of the enhanced temporal motion vector prediction mode flag of the current encoding unit is a value (referred to as a second value in this specification) for indicating that the current encoding unit does not enable the enhanced temporal motion vector prediction mode.
[0103] In one example, the above-mentioned current encoding unit satisfying the first analysis condition may include one or more of: the prediction mode of the current encoding unit is skip mode or direct mode; the size of the current encoding unit meets a preset size restriction; and in the sequence level high-level syntax, the current encoding unit is allowed to enable enhanced temporal motion vector prediction technique; and the current encoding unit meets the usage conditions of angle weighted prediction or meets the usage conditions of Ultimate Motion Vector Expression (UMVE).
[0104] For example, considering that the use of a temporal motion vector prediction mode imposes certain requirements on the prediction mode and size of the encoding unit, etc., it may be determined whether or not the encoding unit is applicable based on whether the prediction mode and / or size, etc. of the encoding unit satisfy the requirements.
[0105] Also, considering that the high level syntax does not allow the current encoding unit to enable enhanced temporal motion vector prediction techniques, it may be determined that the current encoding unit does not enable enhanced temporal motion vector prediction techniques.
[0106] Exemplarily, if one or more of the following conditions are met, such as: the prediction mode of the current coding unit is skip mode or direct mode, the size of the current coding unit meets a preset size restriction, the high-level syntax at the sequence level allows the current coding unit to enable enhanced temporal motion vector prediction technology, the current coding unit meets the usage conditions of Angle Weight Prediction (abbreviated as AWP) or the current coding unit meets the usage conditions of Ultimate Motion Vector Expression (abbreviated as UMVE), the current coding unit is determined to meet the first analysis condition.
[0107] For example, if the prediction mode of the current coding unit is skip mode or direct mode, or if the size of the current coding unit meets a preset size restriction, or if the high-level syntax at the sequence level allows the current coding unit to enable enhanced temporal motion vector prediction technique, or if the current coding unit meets the usage conditions of angle weighted prediction or the usage conditions of ultimate motion vector representation, it is determined that the current coding unit meets the first analysis condition.
[0108] For example, if the prediction mode of the current coding unit is a skip mode or a direct mode, it is determined that the current coding unit satisfies the first analysis condition.
[0109] For example, if the size of the current coding unit meets a preset size limit, it is determined that the current coding unit meets the first analysis condition.
[0110] For example, the high level syntax at the sequence level may determine that if the current coding unit is allowed to enable an enhanced temporal motion vector prediction technique, then the current coding unit satisfies the first analysis condition.
[0111] For example, if the current coding unit satisfies the usage condition of angle weighted prediction or satisfies the usage condition of ultimate motion vector representation, it is determined that the current coding unit satisfies the first analysis condition.
[0112] In addition, for example, if the prediction mode of the current coding unit is skip mode or direct mode, the size of the current coding unit meets a predetermined size restriction, and the high-level syntax at the sequence level allows the current coding unit to enable enhanced temporal motion vector prediction technology, i.e., if all of the above conditions are met, it may be determined that the current coding unit meets the first analysis condition.
[0113] In addition, for example, if the prediction mode of the current coding unit is skip mode or direct mode, the size of the current coding unit meets a preset size restriction, the high-level syntax at the sequence level allows the current coding unit to enable enhanced temporal motion vector prediction technology, and the current coding unit meets the usage conditions of angle weighted prediction or the usage conditions of ultimate motion vector representation, i.e., all of the above conditions are met, it may be determined that the current coding unit meets the first analysis condition.
[0114] Exemplarily, the size of the current coding unit satisfying the preset size constraint may include that the width and height of the current coding unit are both greater than or equal to N0. Exemplarily, N0=8.
[0115] It should be noted that the above statement that the size of the current coding unit meets the preset size limit is merely a specific example of a relevant implementation in an embodiment of the present invention, and does not limit the scope of protection of the present invention. In an embodiment of the present invention, the size of the current coding unit meeting the preset size limit may also include other situations, such as the width of the current coding unit being greater than or equal to N0 and the height of the current coding unit being greater than or equal to N0, or the height and width of the current coding unit are both greater than or equal to N0, but the width and height are not equal to N0 at the same time.
[0116] For example, the current encoding unit satisfying the conditions for using angle weighted prediction may include in the sequence level high level syntax: the current encoding unit is allowed to enable angle weighted prediction technique; the width and height of the current encoding unit are both greater than or equal to N1, and the width and height of the current encoding unit are both less than or equal to N2; and the current image frame type is a B picture.
[0117] For example, the current coding unit satisfying the conditions for using the ultimate motion vector representation may include that the high-level syntax at the sequence level is permitted for the current coding unit to enable the ultimate motion vector representation technique.
[0118] In one example, the current coding unit satisfying the first analysis condition includes: a prediction mode of the current coding unit is skip mode or direct mode; a size of the current coding unit satisfies a size restriction that both the width and height of the current coding unit are greater than or equal to N0; and the sequence level high level syntax includes: the current coding unit is allowed to enable enhanced temporal motion vector prediction technique; and the current coding unit satisfies the usage condition of angle weighted prediction or satisfies the usage condition of ultimate motion vector representation.
[0119] In one example, the enhanced temporal motion vector prediction mode flag may use Context-based Adaptive Binary Arithmetic Coding (CABAC) and one context model.
[0120] In another example, the enhanced temporal motion vector prediction mode flag may use context-adaptive binary arithmetic coding and may use multiple context models. Exemplarily, the multiple context models may be determined based on a size of a current coding unit. Exemplarily, the size of the current coding unit may include, but is not limited to, a width and / or a height of the current coding unit, a maximum or minimum value of the width and height of the current coding unit, or a product of the width and height of the current coding unit, etc.
[0121] In some embodiments, in step S300, obtaining the enhanced temporal motion vector prediction mode index value of the current encoding unit may include: analyzing the enhanced temporal motion vector prediction mode index value from the bitstream if the current encoding unit satisfies a second analysis condition; and otherwise determining that the enhanced temporal motion vector prediction mode index value is a third numerical value.
[0122] Illustratively, the enhanced temporal motion vector prediction mode index value being a third numerical value indicates that the current encoding unit does not enable the enhanced temporal motion vector prediction mode.
[0123] For example, it may be taken into consideration that the use of the enhanced temporal motion vector prediction mode requires certain conditions to be met, and if the conditions are not met, the enhanced temporal motion vector prediction mode is not applied, in which case the enhanced temporal motion vector prediction mode index value does not need to be parsed from the bitstream but may be derived.
[0124] For example, if the current encoding unit satisfies a specified condition (referred to as a second analysis condition in this specification), an enhanced temporal motion vector prediction mode index value may be analyzed from the bitstream; otherwise, the enhanced temporal motion vector prediction mode index value may be determined to be a third numerical value, where the enhanced temporal motion vector prediction mode index value being the third numerical value indicates that the current encoding unit does not enable the enhanced temporal motion vector prediction mode.
[0125] Illustratively, the third numerical value may be the same as the first numerical value or the second numerical value above, or the third numerical value may be different from either the first numerical value or the second numerical value above.
[0126] In one example, the current encoding unit satisfying the second analysis condition may include one or more of: the prediction mode of the current encoding unit being skip mode or direct mode; and the current encoding unit enabling an enhanced temporal motion vector prediction mode.
[0127] In one example, de-binarization of the enhanced temporal motion vector prediction mode index value is achieved based on a truncated unary with a maximum value of 4, where the truncated unary uses up to four binary strings, each binary string using a single context model, for a total of four context models.
[0128] Illustratively, in order to save coding bit overhead and improve encoding and decoding performance, the de-binarization of the enhanced temporal motion vector prediction mode index value is realized based on a truncated unary with a maximum value of 4, where the truncated unary uses up to four binary strings, each binary string uses a single context model, and a total of four context models are used.
[0129] For example, the implementation of de-binarization of the enhanced temporal motion vector prediction mode index value may refer to Table 1. [Table 1]
[0130] where cu_etmvp_cand_index is the enhanced temporal motion vector prediction mode index value.
[0131] In some embodiments, in step S310, the step of determining coordinate information of an initial matching coding unit of a current coding unit based on coordinate information of the current coding unit includes: determining a temporal reference image in which the matching coding unit is located based on a current image frame type; and determining coordinate information of the initial matching coding unit in the temporal reference image based on the coordinate information of the current coding unit.
[0132] Exemplarily, to determine the coordinate information of the initial matching coding unit of the current coding unit, the frame type (i.e., the current image frame type) of the image in which the current coding unit is located (referred to as the current image in this specification) may be determined, and the temporal reference image in which the matching coding unit is located may be determined based on the current image frame type.
[0133] For example, if the current image frame type is a P-picture, the temporal reference picture is the reference picture in reference picture list 0 (i.e., List0) with a reference frame index value of 0, and if the current image frame type is a B-picture, the temporal reference picture is the reference picture in reference picture list 1 (i.e., List1) with a reference frame index value of 0.
[0134] For example, when determining the temporal reference image in which the matching coding unit is located, the coordinate information of the initial matching coding unit in the temporal reference image may be determined based on the coordinate information of the current coding unit.
[0135] In one example, the coordinate information of the current coding unit is the top left corner coordinate of the current coding unit in the current image, and the coordinate information of the matching coding unit is the top left corner coordinate of the matching coding unit in the temporal reference image.
[0136] Exemplarily, the matching encoding unit may include an initial matching encoding unit or a target matching encoding unit, that is, unless otherwise specified below, the coordinate information of the initial matching encoding unit referred to may refer to the upper left corner coordinate of the initial matching encoding unit, and the coordinate information of the target matching encoding unit may refer to the upper left corner coordinate of the target matching encoding unit.
[0137] In one example, the step of determining coordinate information in a temporal reference image of the initial matching coding unit based on coordinate information of the current coding unit may include a step of determining coordinate information of the initial matching coding unit based on the top left corner coordinate in the image of the current largest coding unit, the size of the largest coding unit, the size of the current image, the size of the current coding unit, and the top left corner coordinate in the image of the current coding unit.
[0138] Illustratively, one maximum coding unit may include one or more coding units.
[0139] For example, the coordinate information of the matching coding unit of the current coding unit may be determined based on the top left corner coordinate in the image of the current largest coding unit, the size of the largest coding unit, the size of the current coding unit, the size of the current image, and the top left corner coordinate in the image of the current coding unit.
[0140] In one example, the step of determining coordinate information of the initial matching coding unit based on the top left corner coordinate in the image of the current largest coding unit, the size of the largest coding unit, the size of the current image, the size of the current coding unit, and the top left corner coordinate in the image of the current coding unit may include the step of determining the abscissa of the initial matching coding unit based on the top left corner abscissa in the image of the current largest coding unit, the size of the largest coding unit, the width of the current coding unit, the width of the current image, and the top left corner abscissa in the image of the current coding unit, and the step of determining the ordinate of the initial matching coding unit based on the top left corner ordinate in the image of the current largest coding unit, the size of the largest coding unit, the height of the current coding unit, the height of the current image, and the top left corner ordinate in the image of the current coding unit.
[0141] For example, the coordinate information of the current coding unit is the upper left corner coordinate of the current image of the current coding unit, and the coordinate information of the matching coding unit is the upper left corner coordinate of the matching coding unit in the temporal reference image.
[0142] For example, the right direction in the image plane is the positive direction of the horizontal axis of the coordinate system, and the downward direction is the positive direction of the vertical axis of the coordinate system (the same applies below).
[0143] For example, (Xpos, Ypos) is the coordinate of the top left corner in the image of the current coding unit, (x_ctb_pos, y_ctb_pos) is the coordinate of the top left corner in the image of the current largest coding unit, cu_width and cu_height are the width and height of the current coding unit, horizontal_size and vertical_size are the width and height of the current image, and lcu_size is the size of the largest coding unit. Then, the coordinates (Mx, My) of the matching coding unit are derived as follows: Mx=Clip3(x_ctb_pos,min(x_ctb_pos+lcu_size-cu_width,horizontal_size-cu_width),((Xpos+4)>>3)<<3) My=Clip3(y_ctb_pos,min(y_ctb_pos+lcu_size-cu_height,vertical_size-cu_height),((Ypos+4)>>3)<<3)
[0144] Also, for example, (Xpos, Ypos) are the coordinates of the top left corner in the image of the current coding unit, (x_ctb_pos, y_ctb_pos) are the coordinates of the top left corner in the image of the current largest coding unit, cu_width and cu_height are the width and height, respectively, of the current coding unit, horizontal_size and vertical_size are the width and height, respectively, of the current image, and lcu_size is the size of the largest coding unit, then the coordinates (Mx, My) of the matching coding unit are derived by the following method. Mx=min(((Xpos+4)>>3)<<3,min(x_ctb_pos+lcu_size-cu_width,horizontal_size-cu_width)) My=min(((Ypos+4)>>3)<<3,min(y_ctb_pos+lcu_size-cu_height,vertical_size-cu_height))
[0145] In some embodiments, in step S320, the step of constructing an enhanced temporal candidate list based on coordinate information of the initial matching coding unit may include a step of determining at least one enhanced temporal motion vector prediction mode number based on the coordinate information of the initial matching coding unit, and a step of constructing an enhanced temporal candidate list based on the at least one enhanced temporal motion vector prediction mode number.
[0146] For example, the at least one enhanced temporal motion vector prediction mode number may include an enhanced temporal motion vector prediction mode number corresponding to coordinate information of the initial matching coding unit, and one or more enhanced temporal motion vector prediction mode numbers corresponding to multiple new matching coding units (if available) obtained by offsetting the initial matching coding unit.
[0147] For example, when at least one enhanced temporal motion vector prediction mode number is determined based on the coordinate information of the initial matching coding unit, an enhanced temporal candidate list may be constructed based on the at least one enhanced temporal motion vector prediction mode number.
[0148] Exemplarily, when constructing the reinforcement time candidate list, the length of the reinforcement time candidate list may be initialized to 0, ie, the initial length of the reinforcement time candidate list is 0.
[0149] For example, the length of the enhanced temporal candidate list may increase according to the number of enhanced temporal motion vector prediction mode numbers added.
[0150] In one example, the coordinate information of the matching coding unit is the upper left corner coordinate in the temporal reference image of the matching coding unit, and the step of constructing the enhanced temporal candidate list according to at least one enhanced temporal motion vector prediction mode number includes the steps of: adding the enhanced temporal motion vector prediction mode number 0 to the enhanced temporal candidate list, and adding 1 to the length of the enhanced temporal candidate list; if My+8 is equal to or smaller than the smaller value of y_ctb_pos+lcu_size-cu_height and vertical_size-cu_height, and the motion information of the A1 position is different from the motion information of the C3 position, or the motion information of the A2 position is different from the motion information of the C4 position, adding an enhanced temporal motion vector prediction mode number 1 to an enhanced temporal candidate list, and adding 1 to the length of the enhanced temporal candidate list; if Mx+8 is equal to or smaller than the smaller value of x_ctb_pos+lcu_size-cu_width and horizontal_size-cu_width, and the motion information of the A1 position is different from the motion information of the B2 position, or the motion information of the A3 position is different from the motion information of the B4 position, adding an enhanced temporal motion vector prediction mode number 2 to an enhanced temporal candidate list, and adding 1 to the length of the enhanced temporal candidate list; if My-8 is equal to or greater than y_ctb_pos and the motion information at the A3 position is different from the motion information at the C1 position, or the motion information at the A4 position is different from the motion information at the C2 position, adding an enhanced temporal motion vector prediction mode number 3 to an enhanced temporal candidate list, and adding 1 to the length of the enhanced temporal candidate list; If Mx-8 is greater than or equal to x_ctb_pos and the motion information at position A2 is different from the motion information at position B1, or the motion information at position A4 is different from the motion information at position B3, adding enhanced temporal motion vector prediction mode number 4 to the enhanced temporal candidate list and adding 1 to the length of the enhanced temporal candidate list.
[0151] For example, (Mx, My) is the coordinate information of the initial matching coding unit, (x_ctb_pos, y_ctb_pos) is the top left corner coordinate in the image of the current largest coding unit, lcu_size is the size of the largest coding unit, cu_width and cu_height are the width and height of the current coding unit, respectively, and horizontal_size and vertical_size are the width and height of the current image, respectively.
[0152] For example, A1 is the 4*4 block in the upper left corner of the initial matching coding unit, B1 is the 4*4 block immediately to the left of A1, C1 is the 4*4 block immediately above A1, A2 is the 4*4 block in the upper right corner of the initial matching coding unit, B2 is the 4*4 block immediately to the right of A2, C2 is the 4*4 block immediately above A2, A3 is the 4*4 block in the lower left corner of the initial matching coding unit, B3 is the 4*4 block immediately to the left of A3, C3 is the 4*4 block immediately below A3, A4 is the 4*4 block in the lower right corner of the initial matching coding unit, B4 is the 4*4 block immediately to the right of A4, and C4 is the 4*4 block immediately below A4, and a schematic diagram thereof may be as shown in FIG. 4.
[0153] For example, when offsetting the matching coding unit, the offset unit is 8 pixels, for example, when offsetting the matching coding unit downward, the matching coding unit is offset downward by 8 pixels.
[0154] Considering that a new matching coding unit can be obtained by offsetting the matching coding unit up / down / left / right in the embodiment of the present invention, a candidate matching coding unit is added, and new candidate motion information is added.
[0155] Taking offsetting the matching coding unit downward as an example, if the motion information at positions A1 and C3 is the same, and the motion information at positions A2 and C4 is the same, considering that there is a high probability that the motion information of the new matching coding unit obtained by offsetting the matching coding unit downward is the same as the motion information of the original matching coding unit, this offset may not be able to obtain new motion information.
[0156] Therefore, the motion information at position A1 is compared with the motion information at position C3, and the motion information at position A2 is compared with the motion information at position C4, respectively, and if at least one of the two comparison results is inconsistent, it may be determined that new motion information can be obtained by offsetting downward, that is, the matching coding unit obtained by offsetting downward can be a candidate matching coding unit.
[0157] For example, when offsetting a matching coding unit, it is necessary to ensure that the boundary in the offset direction of the new matching coding unit obtained after further offsetting does not exceed the coordinate range corresponding to the maximum coding unit in which the matching coding unit (the matching coding unit before the offset) is located, i.e., does not exceed the boundary in the offset direction of the maximum coding unit, and does not exceed the coordinate range corresponding to the image in which the matching coding unit is located, i.e., does not exceed the boundary of the image in the offset direction.
[0158] Illustratively, for an upward offset, the boundary in the offset direction is the top boundary, for a downward offset, the boundary in the offset direction is the bottom boundary, for a left offset, the boundary in the offset direction is the left boundary, and for a right offset, the boundary in the offset direction is the right boundary.
[0159] As an example, taking still offsetting downwards as an example, when offsetting the matching coding unit downwards, the ordinate after the offset (i.e., My+8) needs to be less than or equal to y_ctb_pos+lcu_size-cu_height (i.e., the bottom boundary of the new matching coding unit obtained after the offset does not exceed the bottom boundary of the maximum coding unit in which the matching coding unit before the offset is located), while the ordinate after the offset needs to be less than or equal to vertical_size-cu_height (the bottom boundary of the new matching coding unit obtained after the offset does not exceed the bottom boundary of the image in which the matching coding unit before the offset is located), i.e., My+8 needs to be less than or equal to the smaller value of y_ctb_pos+lcu_size-cu_height and vertical_size-cu_height.
[0160] In one example, in step S320, the step of constructing an enhanced temporal candidate list based on the coordinate information of the initial matching coding unit further includes, if the length of the enhanced temporal candidate list is less than 5, repeating the step of adding an enhanced temporal motion vector prediction mode number that is the same as the last enhanced temporal motion vector prediction mode number in the current enhanced temporal candidate list to the enhanced temporal candidate list and adding 1 to the length of the enhanced temporal candidate list until the length of the enhanced temporal candidate list is equal to 5.
[0161] For example, when offsetting a matching coding unit up, down, left, and right all result in available candidate matching coding units, the candidate matching coding units may include the matching coding unit before offset and four matching coding units obtained by matching, that is, the length of the enhanced time candidate list is considered to be 5.
[0162] In order to improve the robustness of decoding and avoid decoding errors, if the length of the enhanced temporal candidate list constructed by the above method is less than 5, the length of the enhanced temporal candidate list may be extended to 5 according to a policy.
[0163] For example, if the length of the reinforcement time candidate list is less than 5, an reinforcement time motion vector prediction mode number that is the same as the last reinforcement time motion vector prediction mode number in the current reinforcement time candidate list may be added to the reinforcement time candidate list, and the operation of adding 1 to the length of the reinforcement time candidate list may be repeated until the length of the reinforcement time candidate list becomes 5.
[0164] In some embodiments, the step of obtaining a corresponding enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list according to the enhanced temporal motion vector prediction mode index value, and determining coordinate information of the target matching coding unit corresponding to the enhanced temporal motion vector prediction mode number includes: determining that Px is equal to Mx and Py is equal to My if the enhanced temporal motion vector prediction mode number is zero; determining that if the enhanced temporal motion vector prediction mode number is 1, then Px is equal to Mx and Py is equal to My+n; determining that Px is equal to Mx+n and Py is equal to My if the enhanced temporal motion vector prediction mode number is 2; determining that if the enhanced temporal motion vector prediction mode number is 3, then Px is equal to Mx and Py is equal to My-n; determining that if the enhanced temporal motion vector prediction mode number is 4, then Px is equal to Mx-n and Py is equal to My; Exemplarily, (Mx, My) is the upper left corner coordinate of the initial matching coding unit, and (Px, Py) is the upper left corner coordinate of the target matching coding unit.
[0165] Take for example the matching coding unit obtained by offsetting n pixels up / down / left / right from the matching coding unit, where n=8 for example.
[0166] As an example, suppose that the reinforced temporal motion vector prediction mode number corresponding to the initial matching coding unit is 0, the reinforced temporal motion vector prediction mode number corresponding to the matching coding unit obtained by offsetting downward is 1, the reinforced temporal motion vector prediction mode number corresponding to the matching coding unit obtained by offsetting right is 2, the reinforced temporal motion vector prediction mode number corresponding to the matching coding unit obtained by offsetting upward is 3, and the reinforced temporal motion vector prediction mode number corresponding to the matching coding unit obtained by offsetting left is 4.
[0167] After obtaining the reinforced temporal candidate list constructed in the above manner, the reinforced temporal motion vector prediction mode index value obtained in step S300 may be used to obtain the corresponding reinforced temporal motion vector prediction mode number in the reinforced temporal candidate list.
[0168] For example, if the enhanced temporal motion vector prediction mode number is 1, the target matching coding unit is a temporal reference coding unit obtained by offsetting the entire initial matching coding unit downward by n pixels, i.e., Px is equal to Mx and Py is equal to My+n.
[0169] If the enhanced temporal motion vector prediction mode number is 2, the target matching coding unit is the temporal reference coding unit obtained by offsetting the entire initial matching coding unit n pixels to the right, i.e., Px is equal to Mx+n and Py is equal to My.
[0170] If the enhanced temporal motion vector prediction mode number is 3, the target matching coding unit is the temporal reference coding unit obtained by offsetting the entire initial matching coding unit n pixels upward, i.e., Px is equal to Mx and Py is equal to My-n.
[0171] If the enhanced temporal motion vector prediction mode number is 4, the target matching coding unit is the temporal reference coding unit obtained by offsetting the entire initial matching coding unit n pixels to the left, that is, Px is equal to Mx-n and Py is equal to My.
[0172] In some embodiments, in step S340, the step of determining motion information of a sub-block at a corresponding position in the current coding unit based on the motion information of each sub-block in the target matching coding unit may include, for any sub-block in the target matching coding unit, if the current image frame type is a P picture, if forward motion information of the sub-block is available, scaling the forward motion information of the sub-block to point to the first frame of List0, and providing the scaled forward motion information to the sub-block at the corresponding position in the current coding unit.
[0173] In some embodiments, in step S340, the step of determining motion information of a sub-block at a corresponding position in the current coding unit based on the motion information of each sub-block in the target matching coding unit may include: for any sub-block in the target matching coding unit, when the current image frame type is a B picture, if 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 in the current coding unit, respectively; if forward motion information of the sub-block is available but backward motion information is not available, scaling the forward motion information of the sub-block to point to the first frame of List0, and providing the scaled forward motion information to the sub-block at the corresponding position in the current coding unit; and 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 in the current coding unit.
[0174] For example, in order to improve the efficiency of determining motion information for each sub-block of the current coding unit, for any sub-block in the target matching coding unit, it may be determined whether motion information for that sub-block is available.
[0175] For example, when the current image frame type is a P picture, it may be determined whether forward motion information of the sub-block is available, and when the current image frame type is a B picture, it may be determined whether forward motion information and backward motion information of the sub-block are available, respectively.
[0176] For example, for any sub-block in the target matching coding unit, if the determination is that forward motion information is available, the forward motion information of the sub-block may be scaled to point to the first frame of List0, and the scaled forward motion information may be provided to the sub-block at the corresponding position in the current coding unit.
[0177] For example, for any sub-block in the target matching coding unit, if the determination is that backward motion information is available (if the current image frame type is a B picture), the backward motion information of the sub-block may be scaled to point to the first frame of List1, and the scaled backward motion information may be provided to the sub-block at the corresponding position in the current coding unit.
[0178] For example, for any sub-block in the target matching coding unit, if the determination result is that both forward motion information and backward motion information are available (when the current image frame type is a B picture), the forward motion information and backward 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 forward motion information and backward motion information may be provided to the sub-block at the corresponding position of the current coding unit, respectively.
[0179] In some embodiments, in step S340, the step of determining the motion information of the sub-block at the corresponding position in the current coding unit based on the motion information of each sub-block in the target matching coding unit includes the steps of: for any sub-block in the target matching coding unit, if the current image frame type is a P picture, if the forward motion information of the sub-block is unavailable, scaling the forward motion information of the first peripheral block to point to the first frame of List0 when the forward motion information of the first peripheral block of the current coding unit is available, and providing the scaled forward motion information to the sub-block at the corresponding position in the current coding unit; and if the forward motion information of the first peripheral block is unavailable, providing zero motion information to the sub-block at the corresponding position in the current coding unit; and if the current image frame type is a B picture, if both the forward motion information and the backward motion information of the sub-block are unavailable, scaling the forward motion information of the first peripheral block to point to the first frame of List0 when the forward motion information of the first peripheral block of the current coding unit is available. The method may include steps of: scaling the forward motion information and backward motion information of the first peripheral 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 coding unit, when the forward motion information of the first peripheral block is available but the backward motion information is unavailable, scaling the forward motion information of the first peripheral block to point to the first frame of List0 and providing the scaled forward motion information to the sub-block at the corresponding position of the current coding unit, when the backward motion information of the first peripheral block is available but the forward motion information is unavailable, scaling the backward motion information of the first peripheral 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 coding unit, and when both the forward motion information and backward motion information of the first peripheral block are unavailable, providing zero motion information to the sub-block at the corresponding position of the current coding unit.
[0180] Illustratively, the motion information of the sub-block in the current coding unit may be determined based on the motion information of a neighboring block (herein referred to as a first neighboring block) of the current coding unit.
[0181] Exemplarily, the first neighboring block of the current coding unit may include, but is not limited to, any decoded neighboring block or non-neighboring block of the current coding unit.
[0182] For example, the first peripheral block of the current coding unit may be as shown in Figure 5. As shown in Figure 5, E is the current coding unit, and the first peripheral block of the current coding unit may include any of blocks A, B, C, D, F and G.
[0183] Illustratively, one coding unit includes at least one sub-block, the width of each sub-block does not exceed the width of the current coding unit, and the height of each sub-block does not exceed the height of the current coding unit, for example, each sub-block is an 8*8 block.
[0184] In one example, the first peripheral block of the current coding unit is F in Fig. 5. Exemplarily, the size of F may be 8*8, i.e., the first peripheral block is an 8*8 block adjacent to the lower left corner of the current coding unit. Exemplarily, the size of F may be 4*4, i.e., the first peripheral block is a 4*4 block adjacent to the lower left corner of the current coding unit.
[0185] For example, when the current image frame type is a P picture, when forward motion information of a sub-block of the target matching coding unit is unavailable, the motion information of the sub-block of the current coding unit may be determined further based on the motion information of the first neighboring block of the current coding unit.
[0186] For example, when the current image frame type is a B picture, when neither forward motion information nor backward motion information of the sub-block of the target matching coding unit is available, the motion information of the sub-block of the current coding unit may be determined further based on the motion information of the first neighboring block of the current coding unit.
[0187] For example, when the current image frame type is a P picture, when neither the forward motion information of the sub-block of the target matching coding unit nor the forward motion information of the first surrounding block of the current image coding unit is available, zero motion information may be provided to the sub-block at the corresponding position of the current coding unit.
[0188] For example, when the current image frame type is a B picture, when neither forward motion information nor backward motion information of a sub-block of the target matching coding unit is available, and neither forward motion information nor backward motion information of the first surrounding block is available, zero motion information may be provided to the sub-block at the corresponding position of the current coding unit.
[0189] In some embodiments, as shown in FIG. 6, in step S340, after determining the motion information of a sub-block at a corresponding position in the current coding unit based on the motion information of each sub-block in the target matching coding unit, the method may further include step S350 of performing motion compensation on the corresponding sub-block in the current coding unit based on the motion information of each sub-block in the current coding unit.
[0190] For example, after determining the motion information of each sub-block in the current coding unit through the above method, the motion compensation may be performed on the corresponding sub-block in the current coding unit according to the motion information of each sub-block in the current coding unit. For example, the motion compensation may be performed on the sub-block in the h-th row and l-th column in the current coding unit according to the motion information of the sub-block in the h-th row and l-th column in the current coding unit.
[0191] In one example, in step S350, the step of performing motion compensation on corresponding sub-blocks in the current coding unit based on the motion information of each sub-block in the current coding unit may include: for any sub-block of the current coding unit, not performing a decoding side motion vector adjustment technique on the motion information of the sub-block; if the sub-block satisfies a bidirectional optical flow condition, performing motion compensation on the sub-block based on the motion information of the sub-block, and using a bidirectional optical flow technique to add an optical flow offset value to the compensated pixel value to obtain a predicted sample matrix of the sub-block; and otherwise performing motion compensation on the sub-block based on the motion information of the sub-block, and obtaining a predicted sample matrix of the sub-block.
[0192] Illustratively, the predicted samples of the current coding unit consist of predicted samples of each sub-block.
[0193] In one example, the sequence level high level syntax for a sub-block to satisfy the bidirectional optical flow condition includes: enabling of bidirectional optical flow techniques is allowed; the motion vector precision of the current coding unit is equal to 0; the sub-block uses bidirectional prediction (bi-prediction); and the display orders of the reference frame with reference frame index value refIdxL0 in reference image list 0 of the sub-block and the reference frame with reference frame index value refIdxL1 in reference image list 1 of the sub-block are located on either side of the current frame, respectively.
[0194] As an example, an embodiment of the present invention further provides an encoding method, which can be applied to an encoding device, and the method may include the following steps:
[0195] In T100, determine the coordinate information of the initial matching coding unit of the current coding unit according to the coordinate information of the current coding unit, the specific implementation of which may refer to step S310 in the embodiment shown in FIG.3, and the embodiment of the present invention will not be described here.
[0196] In T110, construct an enhanced time candidate list according to the coordinate information of the initial matching coding unit, the specific implementation of which may refer to step S320 in the embodiment shown in FIG. 3, and the embodiment of the present invention will not be described here.
[0197] In T120, each enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list is traversed in order, and the coordinate information of the target matching coding unit corresponding to each enhanced temporal motion vector prediction mode number is determined.
[0198] Illustratively, if the enhanced temporal candidate list is constructed in the manner described in step T110, the encoding device may traverse each candidate enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list.
[0199] For any candidate enhanced temporal motion vector prediction mode number, the encoding device may determine coordinate information of the corresponding target matching encoding unit based on the candidate enhanced temporal motion vector prediction mode number, and the specific implementation may refer to step S330 in the embodiment shown in FIG. 3, and the embodiment of the present invention will not be described here.
[0200] In step T130, determine motion information of the target matching coding unit according to the coordinate information of the target matching coding unit, which includes motion information of each sub-block in the target matching coding unit, and determine motion information of the sub-block at the corresponding position in the current coding unit according to the motion information of each sub-block in the target matching coding unit. A specific implementation thereof may refer to step S340 in the embodiment shown in FIG. 3, and the embodiment of the present invention will not be described here.
[0201] In T140, according to the motion information of each sub-block in the current coding unit, perform motion compensation for the corresponding sub-block in the current coding unit, the specific implementation of which may refer to step S350 in the embodiment shown in Fig. 6, and the description of the embodiment of the present invention is omitted here.
[0202] At T150, a rate-distortion cost value corresponding to the enhanced temporal motion vector prediction mode is calculated, the rate-distortion cost value is compared with the rate-distortion cost values of other prediction modes, the prediction mode corresponding to the smallest rate-distortion cost value is selected, and the corresponding enhanced temporal motion vector prediction mode flag value and enhanced temporal motion vector prediction mode index value are written into the bitstream and transmitted to the decoding device.
[0203] For example, the encoding device may determine a prediction mode with a minimum rate-distortion cost value based on the RDO decision, and based on the prediction mode corresponding to the minimum rate-distortion cost value, determine a value of an enhanced temporal motion vector prediction mode flag and an enhanced temporal motion vector prediction mode index value, write them into a bitstream, and transmit them to the decoding device.
[0204] Illustratively, the implementation flows of encoding and decoding in each of the above embodiments may be cross-referenced.
[0205] In order to facilitate understanding of those skilled in the art of the technical solutions provided in the embodiments of the present invention, the technical solutions provided in the embodiments of the present invention will be described below with reference to specific examples.
[0206] Example 1 An embodiment of the present invention provides an enhanced temporal motion information prediction method, which determines a matching coding unit using motion information of a co-located coding unit in a co-located frame of a current coding unit, and performs a series of offsets, such as up, down, left, right, etc., on the matching coding unit obtained by the search to generate multiple temporal candidate modes, thereby to a certain extent avoiding the problem of inaccurate search of a matching coding unit due to inaccurate motion information of surrounding coding units.
[0207] The main implementation flow of the embodiment of the present invention may include the following six parts: In a first part, according to an encoding / decoding condition of a current coding unit, encoding / analyzing an enhanced temporal motion vector prediction mode flag and an enhanced temporal motion vector prediction mode index value; In a second part, the coordinate information of an initial matching coding unit of the current coding unit is determined based on the coordinate information of the current coding unit. In a third part, constructing an enhanced temporal candidate list according to the coordinate information of the initial matching coding unit; In a fourth part, according to the enhanced temporal motion vector prediction mode index value, obtain a corresponding enhanced temporal motion vector prediction mode in the enhanced temporal candidate mode list, and determine coordinate information of a target matching coding unit corresponding to the enhanced temporal motion vector prediction mode; In a fifth part, obtain motion information of each sub-block in the current coding unit according to the coordinate information of the target matching coding unit; In a sixth part, based on the motion information of each sub-block in the current coding unit, motion compensation is performed on the corresponding sub-block in the current coding unit.
[0208] Illustratively, the order of the above six parts may be adjusted.
[0209] Example 2 The encoding method provided in the embodiment of the present invention may include the following steps. 1. According to the coordinate information of the current coding unit, determine the coordinate information of the initial matching coding unit of the current coding unit; 2. Construct an enhanced time candidate list based on the coordinate information of the initial matching coding unit; 3. Traverse each reinforcement time candidate mode in the reinforcement time candidate list in order, and determine the coordinate information of the target matching coding unit corresponding to each mode; 4. Determine motion information of each sub-block in the current coding unit according to the motion information corresponding to the coordinate information of the target matching coding unit; 5. According to the motion information of each sub-block in the current coding unit, perform motion compensation for the corresponding sub-block in the current coding unit; 6. Calculate a rate-distortion cost value corresponding to the enhanced temporal motion vector prediction mode, compare the rate-distortion cost value with the rate-distortion cost values of other prediction modes, select the prediction mode corresponding to the smallest rate-distortion cost value, write the corresponding enhanced temporal motion vector prediction mode flag and enhanced temporal motion vector prediction mode index value into the bitstream, and transmit them to the decoding device.
[0210] Example 3 The decoding method provided in the embodiment of the present invention may include the following steps. 1. Obtain a value of an enhanced temporal motion vector prediction mode flag of a current coding unit and an enhanced temporal motion vector prediction mode index value. If the value of the enhanced temporal motion vector prediction mode flag of the current coding unit obtained is a first value, perform steps 2 to 6; 2. Determine the coordinate information of an initial matching coding unit of the current coding unit according to the coordinate information of the current coding unit; 3. Construct an enhanced time candidate list based on the coordinate information of the initial matching coding unit; 4. According to the obtained enhanced temporal motion vector prediction mode index value, obtain a corresponding enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list, and determine coordinate information of a target matching coding unit corresponding to the enhanced temporal motion vector prediction mode number; 5. Determine motion information of each sub-block in the current coding unit according to the motion information corresponding to the coordinate information of the target matching coding unit; 6. According to the motion information of each sub-block in the current coding unit, perform motion compensation for the corresponding sub-block in the current coding unit.
[0211] Below, each part of the main flow of the embodiment of the present invention (that is, each part among the first part to the sixth part) will be described in accordance with the embodiment.
[0212] The first part, encodes / parses an enhanced temporal motion vector prediction mode flag and an enhanced temporal motion vector prediction mode index value. For example, the step of analyzing the enhanced temporal motion vector prediction mode flag and the enhanced temporal motion vector prediction mode index value may include: 1) analyzing an enhanced temporal motion vector prediction mode flag (which may be denoted as etmvp_flag); and 2) analyzing an enhanced temporal motion vector prediction mode index value (which may be denoted as cu_etmvp_cand_index).
[0213] Example 4 If the current coding unit satisfies analysis condition 1 (i.e., the first analysis condition above), analyze the enhanced temporal motion vector prediction mode flag from the bitstream; otherwise, the value of the enhanced temporal motion vector prediction mode flag is 0 (i.e., the second value above is 0).
[0214] For example, when the current coding unit satisfies the analysis condition 1, reference may be made to Examples 5 to 10, respectively.
[0215] Example 5 The current coding unit satisfying analysis condition 1 includes the current coding unit being in skip mode or direct mode.
[0216] Example 6 The current coding unit satisfies the analysis condition 1, including that the size of the current coding unit satisfies the restriction that the width and height of the current coding unit are both equal to or greater than N0 (i.e., the above-mentioned preset size restriction). For example, N0=8.
[0217] Example 7 The current coding unit satisfying analysis condition 1 includes that the high level syntax at the sequence level allows the current coding unit to enable enhanced temporal motion vector prediction techniques.
[0218] Example 8 The current coding unit satisfying the analysis condition 1 includes that the current coding unit satisfies the usage condition of angle weighting prediction or satisfies the usage condition of ultimate motion vector representation.
[0219] Exemplarily, the conditions for using angle weighted prediction may include, in the sequence level high level syntax, that the current encoding unit is allowed to enable angle weighted prediction technique, the width and height of the current encoding unit are both greater than or equal to N1, and the width and height of the current encoding unit are both less than or equal to N2, and the current image frame type is a B picture.
[0220] Illustratively, N1 = 8. Illustratively, N2 = 64.
[0221] Illustratively, the current coding unit satisfying the conditions for using the ultimate motion vector representation includes that the sequence level high level syntax allows the current coding unit to enable the ultimate motion vector representation technique.
[0222] Example 9 The current coding unit satisfies analysis condition 1 including the following: 1), the current coding unit is in skip mode or direct mode; 2),The size of the current coding unit satisfies the following constraints: 2.1) The width and height of the current coding unit are both greater than or equal to N0, for example, N0=8; 3),The high-level syntax at the sequence level allows the current coding unit to enable enhanced temporal motion vector prediction techniques.
[0223] Example 10 The current coding unit satisfies analysis condition 1 including the following: 1), the current coding unit is in skip mode or direct mode; 2),The size of the current coding unit satisfies the following constraints: 2.1) The width and height of the current coding unit are both greater than or equal to N0, for example, N0=8; 3), the high-level syntax at the sequence level allows the current coding unit to enable enhanced temporal motion vector prediction techniques; 4) The current coding unit satisfies the usage conditions of angle weighted prediction or the usage conditions of the ultimate motion vector representation.
[0224] Exemplarily, the conditions for using angle weighting prediction may include the following: 4.1), the high level syntax at the sequence level allows the current coding unit to enable angle weighting prediction technique; 4.2), the width and height of the current coding unit are both greater than or equal to N1, and the width and height of the current coding unit are both less than or equal to N2; 4.3), the current image frame type is a B picture.
[0225] Illustratively, N1 = 8. Illustratively, N2 = 64.
[0226] Illustratively, the current coding unit satisfying the conditions for using the ultimate motion vector representation includes that the sequence level high level syntax allows the current coding unit to enable the ultimate motion vector representation technique.
[0227] In addition, in the embodiments of the present invention, the current coding unit satisfying analysis condition 1 is not limited to the cases described in the above embodiments 5 to 10, but may also include the cases obtained by combining any two of the embodiments 5 to 8, and the cases obtained by combining any three of the embodiments (embodiment 9 is obtained by combining embodiments 5 to 7).
[0228] Example 11 If the current coding unit satisfies the analysis condition 1, analyze the enhanced temporal motion vector prediction mode flag from the bitstream; otherwise, the value of the enhanced temporal motion vector prediction mode flag is 0.
[0229] Illustratively, the enhanced temporal motion vector prediction mode flag uses context-adaptive binary arithmetic coding.
[0230] Example 12 If the current coding unit satisfies the analysis condition 1, analyze the enhanced temporal motion vector prediction mode flag from the bitstream; otherwise, the value of the enhanced temporal motion vector prediction mode flag is 0.
[0231] For example, in a specific case where the current coding unit satisfies the analysis condition 1, the relevant explanation in the above embodiments, for example, the explanation in any one of the embodiments 5 to 10, may be referred to.
[0232] Illustratively, the enhanced temporal motion vector prediction mode flag uses context-adaptive binary arithmetic coding and employs one context model.
[0233] Example 13 If the current coding unit satisfies the analysis condition 1, analyze the enhanced temporal motion vector prediction mode flag from the bitstream; otherwise, the value of the enhanced temporal motion vector prediction mode flag is 0.
[0234] For example, in a specific case where the current coding unit satisfies the analysis condition 1, the relevant explanation in the above embodiments, for example, the explanation in any one of the embodiments 5 to 10, may be referred to.
[0235] Illustratively, the enhanced temporal motion vector prediction mode flag employs context-adaptive binary arithmetic coding and employs multiple context models.
[0236] Illustratively, the multiple context models may be determined based on the size of the current coding unit.
[0237] By way of example, the size of the current coding unit may include, but is not limited to, the width and / or height of the current coding unit, the maximum or minimum of the width and height of the current coding unit, or the product of the width and height of the current coding unit, etc.
[0238] Example 14 If the current coding unit satisfies analysis condition 2 (i.e., the second analysis condition above), analyze the enhanced temporal motion vector prediction mode index value from the bitstream; otherwise, the enhanced temporal motion vector prediction mode index value is 0 (i.e., the third value above is 0).
[0239] For example, when the current coding unit satisfies the analysis condition 2, reference may be made to Examples 15 to 17, respectively.
[0240] Example 15 The current coding unit satisfying analysis condition 2 includes the current coding unit being in skip mode or direct mode.
[0241] Example 16 The current coding unit satisfying the analysis condition 2 includes that the current coding unit is in an enhanced temporal motion vector prediction mode.
[0242] Example 17 The current coding unit satisfies analysis condition 2 including the following: 1), the current coding unit is in skip mode or direct mode; 2), the current coding unit is in enhanced temporal motion vector prediction mode.
[0243] For example, a syntax description of the enhanced temporal motion vector prediction mode index value may be as follows: [Table 2]
[0244] Example 18 If the current coding unit satisfies analysis condition 2 (i.e., the second analysis condition above), analyze the enhanced temporal motion vector prediction mode index value from the bitstream; otherwise, the enhanced temporal motion vector prediction mode index value is 0 (i.e., the third value above is 0).
[0245] For example, when the current coding unit satisfies the analysis condition 2, the description in any one of the fifteenth to seventeenth embodiments may be referred to.
[0246] Exemplarily, the de-binarization of the enhanced temporal motion vector prediction mode index value is realized based on a truncated unary with a maximum value of 4, the truncated unary using a maximum of 4 binary strings (bins), each binary string (bin) using a single context model, and a total of 4 context models. For example, the realization of the de-binarization of the enhanced temporal motion vector prediction mode index value may refer to Table 1.
[0247] A second part, determining coordinate information of an initial matching coding unit of the current coding unit according to the coordinate information of the current coding unit. Exemplarily, the step of determining the coordinate information of the initial matching coding unit of the current coding unit based on the coordinate information of the current coding unit may include: determining a temporal reference image in which the matching coding unit is located based on a current image frame type; and determining the coordinate information of the initial matching coding unit of the current coding unit based on the coordinate information of the current coding unit.
[0248] Exemplarily, a temporal reference block whose width and height in the temporal reference image match those of the current coding unit is the matching coding unit of the current coding unit.
[0249] For example, if the current image frame type is a P-picture, the temporal reference picture is the reference picture with a reference frame index value of 0 in reference picture list 0, and if the current image frame type is a B-picture, the temporal reference picture is the reference picture with a reference frame index value of 0 in reference picture list 1.
[0250] Exemplarily, the coordinate information of the current coding unit may be the upper left corner coordinate in an image (current image) of the current coding unit, and the coordinate information of the matching coding unit may be the upper left corner coordinate in a temporal reference image of the matching coding unit.
[0251] Exemplarily, the step of determining the coordinate information of the initial matching coding unit of the current coding unit based on the coordinate information of the current coding unit may include the step of determining the coordinate information of the initial matching coding unit based on the top left corner coordinate in the image of the current largest coding unit, the size of the largest coding unit, the size of the current image, the size of the current coding unit, and the top left corner coordinate in the image of the current coding unit.
[0252] Exemplarily, the step of determining coordinate information of the initial matching coding unit based on the top left corner coordinate in the image of the current largest coding unit, the size of the largest coding unit, the size of the current image, the size of the current coding unit, and the top left corner coordinate in the image of the current coding unit includes the step of determining the abscissa of the initial matching coding unit based on the top left corner abscissa in the image of the current largest coding unit, the size of the largest coding unit, the width of the current coding unit, the width of the current image, and the top left corner abscissa in the image of the current coding unit; and the step of determining the ordinate of the initial matching coding unit based on the top left corner ordinate in the image of the current largest coding unit, the size of the current largest coding unit, the height of the current coding unit, the height of the current image, and the top left corner ordinate in the image of the current coding unit.
[0253] Exemplarily, for a specific implementation of determining the coordinate information of the initial matching coding unit of the current coding unit based on the coordinate information of the current coding unit, reference may be made to the description of any one of Examples 19 to 21.
[0254] Example 19 Assuming that (Xpos, Ypos) are the coordinates of the top left corner in the image of the current coding unit, (x_ctb_pos, y_ctb_pos) are the coordinates of the top left corner in the image of the current largest coding unit, cu_width and cu_height are the width and height of the current coding unit, horizontal_size and vertical_size are the width and height of the current image, and lcu_size is the size of the largest coding unit, then derive the coordinates (Mx, My) of the matching coding unit as follows: Mx=Clip3(x_ctb_pos,min(x_ctb_pos+lcu_size-cu_width,horizontal_size-cu_width),((Xpos+4)>>3)<<3) My=Clip3(y_ctb_pos,min(y_ctb_pos+lcu_size-cu_height,vertical_size-cu_height),((Ypos+4)>>3)<<3)
[0255] Example 20 Assuming that (Xpos, Ypos) are the coordinates of the top left corner in the image of the current coding unit, (x_ctb_pos, y_ctb_pos) are the coordinates of the top left corner in the image of the current largest coding unit, cu_width and cu_height are the width and height of the current coding unit, horizontal_size and vertical_size are the width and height of the current image, and lcu_size is the size of the largest coding unit, then derive the coordinates (Mx, My) of the matching coding unit as follows: Mx=min(((Xpos+4)>>3)<<3,min(x_ctb_pos+lcu_size-cu_width,horizontal_size-cu_width)) My=min(((Ypos+4)>>3)<<3,min(y_ctb_pos+lcu_size-cu_height,vertical_size-cu_height))
[0256] Example 21 (Xpos, Ypos) are the upper left corner coordinates in the image of the current coding unit, (x_ctb_pos, y_ctb_pos) are the upper left corner coordinates in the image of the current maximum coding unit, cu_width and cu_height are the width and height of the current coding unit respectively, horizontal_size and vertical_size are the width and height of the current image respectively, and lcu_size is the size of the maximum coding unit. Then, the coordinates (Mx, My) of the matching coding unit are derived by the following method. Mx = Clip3(x_ctb_pos, min(x_ctb_pos + lcu_size - cu_width, horizontal_size - cu_width), (Xpos >> 3) << 3) My = Clip3(y_ctb_pos, min(y_ctb_pos + lcu_size - cu_height, vertical_size - cu_height), (Ypos >> 3) << 3)
[0257] Example 22 (Xpos, Ypos) are the upper left corner coordinates in the image of the current coding unit. Then, the coordinates (Mx, My) of the matching coding unit may be derived by the following method. Mx = (Xpos >> shift) << shift My = (Ypos >> shift) << shift)
[0258] Exemplarily, Shift is related to the size of the sub-block. For an N*N sub-block, N = 1 << shift. For example, if the size of the sub-block is 8*8, then shift = 3.
[0259] In the third part, a enhanced temporal candidate list is constructed based on the coordinate information of the initial matching coding unit. For example, (Mx, My) is the upper left corner coordinate of the initial matching coding unit in the temporal reference image, and A1 to A4, B1 to B4, and C1 to C4 are adjacent 4*4 blocks located around the initial matching coding unit in the temporal reference image, and a schematic diagram thereof may be as shown in FIG.
[0260] Example 33 23.0, initialize the length of the reinforcement time candidate list to 0. Illustratively, the initial length of the reinforcement time candidate list is 0.
[0261] 23.1, add enhanced temporal motion vector prediction mode number 0 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0262] 23.2. If the matching coding unit located at (Mx, My) does not exceed the lower boundary of the LCU or image where the matching coding unit is located, and the motion information at position A1 is different from the motion information at position C3, or the motion information at position A2 is different from the motion information at position C4, add enhanced temporal motion vector prediction mode number 1 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0263] 23.3. If the matching coding unit located at (Mx, My) does not exceed the right boundary of the LCU or image where the matching coding unit is located, and the motion information at position A1 is different from the motion information at position B2, or the motion information at position A3 is different from the motion information at position B4, add enhanced temporal motion vector prediction mode number 2 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0264] 23.4. If the matching coding unit located at (Mx, My) does not exceed the upper boundary of the LCU or image where the matching coding unit is located, and the motion information at position A3 is different from the motion information at position C1, or the motion information at position A4 is different from the motion information at position C2, add enhanced temporal motion vector prediction mode number 3 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0265] 23.5. If the matching coding unit located at (Mx, My) does not exceed the left boundary of the LCU or image where the matching coding unit is located, and the motion information at position A2 is different from the motion information at position B1, or the motion information at position A4 is different from the motion information at position B3, add enhanced temporal motion vector prediction mode number 4 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0266] 23.6. If the length of the reinforcement time candidate list is less than 5, perform the following operations repeatedly. 23.6.1, adding the last enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list to the enhanced temporal candidate list, and adding 1 to the length of the enhanced temporal candidate list; 23.6.2, if the length of the reinforcement time candidate list is equal to 5, terminate the list building process.
[0267] Exemplarily, the implementation logic may be as follows:
[0268] 1) Initialize EtmvpCandArray[i] to 0, where i = 0 to 4, and initialize length to 0.
[0269] 2) First, set EtmvpCandArray[0] = 0 and add 1 to length.
[0270] 3) If the matching coding unit located at (Mx, My) does not exceed the lower boundary of the LCU or image where the matching coding unit is located, and the motion information at position A1 is different from the motion information at position C3, or the motion information at position A2 is different from the motion information at position C4, then set EtmvpCandArray[length]=1 and add 1 to length.
[0271] 4) If the matching coding unit located at (Mx, My) does not exceed the right boundary of the LCU or image in which the matching coding unit is located, and the motion information at position A1 is different from the motion information at position B2, or the motion information at position A3 is different from the motion information at position B4, then set EtmvpCandArray[length]=2 and add 1 to length.
[0272] 5) If the matching coding unit located at (Mx, My) does not exceed the upper boundary of the LCU or image where the matching coding unit is located, and the motion information at position A3 is different from the motion information at position C1, or the motion information at position A4 is different from the motion information at position C2, then set EtmvpCandArray[length]=3 and add 1 to length.
[0273] 6) If the matching coding unit located at (Mx, My) does not exceed the left boundary of the LCU or image in which the matching coding unit is located, and the motion information at position A2 is different from the motion information at position B1, or the motion information at position A4 is different from the motion information at position B3, then set EtmvpCandArray[length]=4 and add 1 to length.
[0274] 7) If length is less than 5, perform the following operations repeatedly. 7.1), EtmvpCandArray[length] = EtmvpCandArray[length-1], add 1 to length, 7.2),If length is equal to 5, terminate the list building process.
[0275] Example 24 24.0, initialize the length of the reinforcement time candidate list to 0. Illustratively, the initial length of the reinforcement time candidate list is 0.
[0276] 24.1, add enhanced temporal motion vector prediction mode number 0 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0277] 24.2. If the matching coding unit located at (Mx, My) does not exceed the lower boundary of the LCU or image where the matching coding unit is located, and the motion information at position A1 is different from the motion information at position C3, or the motion information at position A2 is different from the motion information at position C4, add enhanced temporal motion vector prediction mode number 1 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0278] 24.3. If the matching coding unit located at (Mx, My) does not exceed the right boundary of the LCU or image where the matching coding unit is located, and the motion information at position A1 is different from the motion information at position B2, or the motion information at position A3 is different from the motion information at position B4, add enhanced temporal motion vector prediction mode number 2 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0279] 24.4. If the matching coding unit located at (Mx, My) does not exceed the upper boundary of the LCU or image where the matching coding unit is located, and the motion information at position A3 is different from the motion information at position C1, or the motion information at position A4 is different from the motion information at position C2, add enhanced temporal motion vector prediction mode number 3 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0280] 24.5. If the matching coding unit located at (Mx, My) does not exceed the left boundary of the LCU or image where the matching coding unit is located, and the motion information at position A2 is different from the motion information at position B1, or the motion information at position A4 is different from the motion information at position B3, add enhanced temporal motion vector prediction mode number 4 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0281] Example 25 25.0, initialize the length of the reinforcement time candidate list to 0. Illustratively, the initial length of the reinforcement time candidate list is 0.
[0282] 25.1, add the enhanced temporal motion vector prediction mode number 0 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list; illustratively, the initial length of the enhanced temporal candidate list is 0;
[0283] 25.2. If the lower boundary of the matching coding unit located at (Mx, My+8) does not exceed the lower boundary of the LCU or image where the matching coding unit is located, and the motion information at position A1 is different from the motion information at position C3, or the motion information at position A2 is different from the motion information at position C4, add enhanced temporal motion vector prediction mode number 1 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0284] 25.3. If the right boundary of the matching coding unit located at (Mx+8,My) does not exceed the right boundary of the LCU or image where the matching coding unit is located, and the motion information at position A1 is different from the motion information at position B2, or the motion information at position A3 is different from the motion information at position B4, add enhanced temporal motion vector prediction mode number 2 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0285] 25.4, Mx, My-8) does not exceed the upper boundary of the LCU or image in which the matching coding unit is located, and the motion information at position A3 is different from the motion information at position C1, or the motion information at position A4 is different from the motion information at position C2, add enhanced temporal motion vector prediction mode number 3 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0286] 25.5. If the left boundary of the matching coding unit located at (Mx-8, My) does not exceed the left boundary of the LCU or image where the matching coding unit is located, and the motion information at position A2 is different from the motion information at position B1, or the motion information at position A4 is different from the motion information at position B3, add enhanced temporal motion vector prediction mode number 4 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0287] 25.6. If the length of the reinforcement time candidate list is less than 5, perform the following operations repeatedly. 25.6.1, adding the last enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list to the enhanced temporal candidate list, and adding 1 to the length of the enhanced temporal candidate list; 25.6.2, if the length of the reinforcement time candidate list is equal to 5, terminate the list building process.
[0288] Example 26 26.0, initialize the length of the reinforcement time candidate list to 0.
[0289] 26.1, add the enhanced temporal motion vector prediction mode number 0 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list; illustratively, the initial length of the enhanced temporal candidate list is 0;
[0290] 26.2. If the lower boundary of the matching coding unit located at (Mx, My+8) does not exceed the lower boundary of the LCU or image where the matching coding unit is located, and the motion information at position A1 is different from the motion information at position C3, or the motion information at position A2 is different from the motion information at position C4, add enhanced temporal motion vector prediction mode number 1 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0291] 26.3. If the right boundary of the matching coding unit located at (Mx+8,My) does not exceed the right boundary of the LCU or image where the matching coding unit is located, and the motion information at position A1 is different from the motion information at position B2, or the motion information at position A3 is different from the motion information at position B4, add enhanced temporal motion vector prediction mode number 2 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0292] 26.4. If the upper boundary of the matching coding unit located at (Mx, My-8) does not exceed the upper boundary of the LCU or image where the matching coding unit is located, and the motion information at position A3 is different from the motion information at position C1, or the motion information at position A4 is different from the motion information at position C2, add enhanced temporal motion vector prediction mode number 3 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0293] 26.5. If the left boundary of the matching coding unit located at (Mx-8, My) does not exceed the left boundary of the LCU or image where the matching coding unit is located, and the motion information at position A2 is different from the motion information at position B1, or the motion information at position A4 is different from the motion information at position B3, add enhanced temporal motion vector prediction mode number 4 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0294] Example 27 27.0, initialize the length of the reinforcement time candidate list to 0. Illustratively, the initial length of the reinforcement time candidate list is 0.
[0295] 27.1, add enhanced temporal motion vector prediction mode number 0 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0296] 27.2. If My+8 is less than the smaller of y_ctb_pos+lcu_size-cu_height and vertical_size-cu_height, and the motion information at position A1 is different from the motion information at position C3, or the motion information at position A2 is different from the motion information at position C4, add enhanced temporal motion vector prediction mode number 1 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0297] 27.3. If Mx+8 is less than the smaller of x_ctb_pos+lcu_size-cu_width and horizontal_size-cu_width, and the motion information at position A1 is different from the motion information at position B2, or the motion information at position A3 is different from the motion information at position B4, add enhanced temporal motion vector prediction mode number 2 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0298] 27.4. If My-8 is greater than or equal to y_ctb_pos, and the motion information at position A3 is different from the motion information at position C1, or the motion information at position A4 is different from the motion information at position C2, add enhanced temporal motion vector prediction mode number 3 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0299] 27.5. If Mx-8 is greater than or equal to x_ctb_pos, and the motion information at position A2 is different from the motion information at position B1, or the motion information at position A4 is different from the motion information at position B3, add enhanced temporal motion vector prediction mode number 4 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0300] 27.6. If the length of the reinforcement time candidate list is less than 5, perform the following operations repeatedly. 27.6.1, adding the last enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list to the enhanced temporal candidate list, and adding 1 to the length of the enhanced temporal candidate list; 27.6.2, if the length of the reinforcement time candidate list is equal to 5, terminate the list building process.
[0301] Example 28 28.0, initialize the length of the reinforcement time candidate list to 0. Illustratively, the initial length of the reinforcement time candidate list is 0.
[0302] 28.1, add enhanced temporal motion vector prediction mode number 0 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0303] 28.2. If My+8 is less than the smaller of y_ctb_pos+lcu_size-cu_height and vertical_size-cu_height, and the motion information at position A1 is different from the motion information at position C3, or the motion information at position A2 is different from the motion information at position C4, add enhanced temporal motion vector prediction mode number 1 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0304] 28.3. If Mx+8 is less than the smaller of x_ctb_pos+lcu_size-cu_width and horizontal_size-cu_width, and the motion information at position A1 is different from the motion information at position B2, or the motion information at position A3 is different from the motion information at position B4, add enhanced temporal motion vector prediction mode number 2 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0305] 28.4. If My-8 is greater than or equal to y_ctb_pos, and the motion information at position A3 is different from the motion information at position C1, or the motion information at position A4 is different from the motion information at position C2, add enhanced temporal motion vector prediction mode number 3 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0306] 28.5. If Mx-8 is greater than or equal to x_ctb_pos, and the motion information at position A2 is different from the motion information at position B1, or the motion information at position A4 is different from the motion information at position B3, add enhanced temporal motion vector prediction mode number 4 to the enhanced temporal candidate list, and add 1 to the length of the enhanced temporal candidate list.
[0307] A fourth part, based on the enhanced temporal motion vector prediction mode index value, obtain a corresponding enhanced temporal motion vector prediction mode in the enhanced temporal candidate mode list, and determine coordinate information of a target matching coding unit corresponding to the enhanced temporal motion vector prediction mode. Exemplarily, obtain a corresponding enhanced temporal motion vector prediction mode number (may be denoted as etmvp_mode) in the enhanced temporal candidate list according to the enhanced temporal motion vector prediction mode index (may be denoted as EtmvpCandIndex), and determine and obtain the position coordinate (Px, Py) of the target matching coding unit according to the enhanced temporal motion vector prediction mode number etmvp_mode. etmvp_mode=EtmvpCandArray[EtmvpCandIndex].
[0308] Example 29 According to the enhanced temporal motion vector prediction mode number, the position coordinates (Px, Py) of the target matching coding unit are determined by a lookup table. For example, the correspondence relationship between etmvp_mode and Px, Py may be as shown in Table 2. [Table 3]
[0309] Illustratively, n may be eight.
[0310] Example 30 If the enhanced temporal motion vector prediction mode number is 0, the target matching coding unit is the initial matching coding unit, i.e., Px is equal to Mx, Py is equal to My; If the enhanced temporal motion vector prediction mode number is 1, the target matching coding unit is a temporal reference block obtained by offsetting the entire initial matching coding unit downward by n pixels, i.e., Px is equal to Mx, Py is equal to My+n; If the enhanced temporal motion vector prediction mode number is 2, the target matching coding unit is a temporal reference block obtained by offsetting the entire initial matching coding unit to the right by n pixels, that is, Px is equal to Mx+n, Py is equal to My; If the enhanced temporal motion vector prediction mode number is 3, the target matching coding unit is a temporal reference block obtained by offsetting the entire initial matching coding unit upward by n pixels, that is, Px is equal to Mx, Py is equal to My-n; If the enhanced temporal motion vector prediction mode number is 4, the target matching coding unit is a temporal reference block obtained by offsetting the entire initial matching coding unit n pixels to the left, that is, Px is equal to Mx-n and Py is equal to My.
[0311] Illustratively, n may be eight.
[0312] A fifth part, obtaining motion information of each sub-block in the current coding unit according to the coordinate information of the target matching coding unit. Exemplarily, based on the coordinate information of the target matching coding unit, motion information of the target matching coding unit may be determined, which includes motion information of each sub-block in the target matching coding unit, and based on the motion information of each sub-block in the target matching coding unit, motion information of a sub-block at a corresponding position of the current coding unit may be determined.
[0313] Illustratively, the first peripheral block of the current coding unit may be as shown in Figure 5. As shown in Figure 5, E is the current coding unit, and the first peripheral block of the current coding unit may include any of blocks A, B, C, D, F and G.
[0314] Illustratively, one coding unit includes at least one sub-block, the width of each sub-block does not exceed the width of the current coding unit, and the height of each sub-block does not exceed the height of the current coding unit, for example, each sub-block is an 8*8 block.
[0315] In one example, the first neighboring block of the current coding unit is F in FIG.
[0316] For example, for any sub-block in the target matching coding unit (taking an 8*8 sub-block as an example), the upper left corner coordinate of each 8*8 sub-block is (Px+(i<<3),Py+(j<<3)), where i is the horizontal index value of the sub-block, j is the vertical index value of the sub-block, where i=0~(cu_width>>3)-1, and j=0~(cu_height>>3)-1.
[0317] Exemplarily, for any sub-block in the current coding unit (taking an 8*8 sub-block as an example), the motion information of each 8*8 sub-block is denoted as MotionArray[i][j], where i is the horizontal index value of the sub-block, j is the vertical index value of the sub-block, i = 0 ~ (cu_width>> 3) - 1, and j = 0 ~ (cu_height>> 3) - 1.
[0318] Example 31 For any sub-block in the target matching coding unit, 31.1, if the forward motion information and backward motion information of the sub-block are both 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 coding unit, respectively; 31.2, 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 coding unit; 31.3, 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 coding unit; 31.4. If neither forward nor backward motion information of a subblock is available, pad with default motion information.
[0319] Illustratively, embodiments of the present invention are not limited on the default motion information, for example, the default motion information may be zero motion information or motion information derived from neighboring blocks of the current coding unit.
[0320] Example 32 For any sub-block in the target matching coding unit, 32.1, if forward motion information of the sub-block is 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 coding unit; 32.2. If forward motion information for the sub-block is unavailable, pad with default motion information.
[0321] Illustratively, embodiments of the present invention are not limited on the default motion information, for example, the default motion information may be zero motion information or motion information derived from neighboring blocks of the current coding unit.
[0322] Example 33 For any sub-block in the target matching coding unit, 33.1. If the current image frame type is a P-picture, 33.1.1, if forward motion information of the sub-block is 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 coding unit; 33.1.2. If forward motion information for the sub-block is unavailable, pad with default motion information.
[0323] Illustratively, embodiments of the present invention are not limited on the default motion information, for example, the default motion information may be zero motion information or motion information derived from neighboring blocks of the current coding unit.
[0324] 33.2, if the current image frame type is a B-picture, 33.2.1, if the forward motion information and backward motion information of the sub-block are both 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 coding unit, respectively; 33.2.2, 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 coding unit; 33.2.3, 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 coding unit; 33.2.4, if neither forward nor backward motion information of a subblock is available, pad with default motion information.
[0325] Illustratively, embodiments of the present invention are not limited on the default motion information, for example, the default motion information may be zero motion information or motion information derived from neighboring blocks of the current coding unit.
[0326] Example 34 For any sub-block in the target matching coding unit, 34.1, if the forward motion information and backward motion information of the sub-block are both 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 coding unit, respectively; 34.2, 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 coding unit; 34.3, 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 coding unit; 34.4, if neither forward nor backward motion information of a subblock is available, 34.4.1, if the forward motion information and backward motion information of the first peripheral block of the current coding unit are both available, scale the forward motion information and backward motion information of the first 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-blocks at the corresponding positions of the current coding unit, respectively; 34.4.2, if the forward motion information of the first peripheral block is available but the backward motion information is unavailable, scale the forward motion information of the first peripheral 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 coding unit; 34.4.3, if the backward motion information of the first peripheral block is available but the forward motion information is unavailable, scale the backward motion information of the first peripheral 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 coding unit; 34.4.4, if neither forward motion information nor backward motion information of the first surrounding block is available, provide zero motion information for the sub-block at the corresponding position of the current coding unit.
[0327] Example 35 For any sub-block in the target matching coding unit, 35.1, if forward motion information of the sub-block is 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 coding unit; 35.2, if forward motion information for the subblock is unavailable, 35.2.1, if forward motion information of the first peripheral block of the current coding unit is available, scale the forward motion information of the first peripheral 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 coding unit; 35.2.2, if forward motion information of the first surrounding block is unavailable, provide zero motion information for the sub-block at the corresponding position of the current coding unit.
[0328] Example 36 For any sub-block in the target matching coding unit, 36.1. If the current image frame type is a P-picture, 36.1.1, if forward motion information of the sub-block is 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 coding unit; 36.1.2, if forward motion information for the subblock is unavailable, 36.1.2.1, when forward motion information of a first peripheral block of a current coding unit is available, scale the forward motion information of the first peripheral block to point to the first frame of List0, and provide the scaled forward motion information to a sub-block at a corresponding position of the current coding unit; 36.1.2.2, when forward motion information of the first surrounding block is unavailable, providing zero motion information to the sub-block at the corresponding position of the current coding unit; 36.2, if the current image frame type is a B-picture, 36.2.1, if the forward motion information and backward motion information of the sub-block are both 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 coding unit, respectively; 36.2.2, if the forward motion information of the subblock is available but the backward motion information is not available, scale the forward motion information of the subblock to point to the first frame of List0, and provide the scaled forward motion information to the subblock at the corresponding position of the current coding unit; 36.2.3, 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 coding unit; 36.2.4, if neither forward nor backward motion information for a subblock is available, 36.2.4.1, when the forward motion information and backward motion information of the first peripheral block of the current coding unit are both available, scale the forward motion information and backward motion information of the first 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-blocks at the corresponding positions of the current coding unit, respectively; 36.2.4.2, when the forward motion information of the first peripheral block is available but the backward motion information is unavailable, scale the forward motion information of the first peripheral 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 coding unit; 36.2.4.3, when the backward motion information of the first peripheral block is available but the forward motion information is unavailable, scale the backward motion information of the first peripheral 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 coding unit; 36.2.4.4, when neither forward motion information nor backward motion information of the first surrounding block is available, zero motion information is provided for the sub-block at the corresponding position of the current coding unit.
[0329] A sixth part, based on the motion information of each sub-block in the current coding unit, performs motion compensation on the corresponding sub-block in the current coding unit. Illustratively, one coding unit includes at least one sub-block, where the width of each sub-block does not exceed the width of the current coding unit, and the height of each sub-block does not exceed the height of the current coding unit.
[0330] For example, each sub-block is a block of size 8*8.
[0331] Exemplarily, for any sub-block in the current coding unit (taking an 8*8 sub-block as an example), the motion information of each 8*8 sub-block is denoted as MotionArray[i][j], where i is the horizontal index value of the sub-block, j is the vertical index value of the sub-block, i = 0 ~ (cu_width>> 3) - 1, and j = 0 ~ (cu_height>> 3) - 1.
[0332] Example 37 For any sub-block of the current coding unit, perform motion compensation on the current sub-block according to the motion information of the current sub-block to obtain a prediction sample matrix of the current sub-block. Illustratively, the prediction sample of the current coding unit is composed of the prediction sample of each sub-block.
[0333] Example 38 For any sub-block of the current coding unit, if the current sub-block satisfies the BIO condition, perform motion compensation on the current sub-block based on the motion information of the current sub-block, and add an optical flow offset value to the compensated pixel value using the BIO technique to obtain a predicted sample matrix of the current sub-block; otherwise, perform motion compensation on the current sub-block based on the motion information of the current sub-block, and obtain a predicted sample matrix of the current sub-block.
[0334] Exemplarily, the predicted samples of the current coding unit consist of predicted samples of each sub-block. Exemplarily, the sub-blocks satisfying the bidirectional optical flow condition include: 1),The high-level syntax at the sequence level allows enabling bidirectional optical flow techniques, 2),The motion vector precision of the current coding unit is equal to 0; 3) the subblock uses bidirectional prediction; 4) The display order of the reference frame with the reference frame index value refIdxL0 in reference picture list 0 of the sub-block and the reference frame with the reference frame index value refIdxL1 in reference picture list 1 are located on either side of the current frame.
[0335] Example 39 For any sub-block of the current coding unit, the motion information of the current sub-block is not subjected to the decoding side motion vector adjustment (DMVR) technique, and the motion information of the current sub-block is subjected to motion compensation for the current sub-block to obtain the prediction sample matrix of the current sub-block. Illustratively, the prediction sample of the current coding unit is composed of the prediction sample of each sub-block.
[0336] Example 40 For any sub-block of the current coding unit, if the motion information of the current sub-block is not subjected to the decoding side motion vector adjustment (DMVR) technique, and the current sub-block satisfies the BIO condition, motion compensation is performed on the current sub-block based on the motion information of the current sub-block, and an optical flow offset value is added to the compensated pixel value using the BIO technique to obtain a predicted sample matrix of the current sub-block; otherwise, motion compensation is performed on the current sub-block based on the motion information of the current sub-block, and a predicted sample matrix of the current sub-block is obtained.
[0337] Illustratively, the predicted samples of the current coding unit consist of predicted samples of each sub-block.
[0338] Illustratively, the sub-blocks satisfying the bidirectional optical flow condition include: 1),The high-level syntax at the sequence level allows enabling bidirectional optical flow techniques, 2),The motion vector precision of the current coding unit is equal to 0; 3) the subblock uses bidirectional prediction; 4) The display order of the reference frame with the reference frame index value refIdxL0 in reference picture list 0 of the sub-block and the reference frame with the reference frame index value refIdxL1 in reference picture list 1 are located on either side of the current frame.
[0339] It should be noted that the above embodiments are merely specific examples of the implementation of the embodiments of the present invention, and do not limit the scope of protection of the present invention. Based on the above embodiments, new embodiments can be obtained by combining the embodiments, i.e., any combination of one or more embodiments, or modifying the embodiments, and all of them should fall within the scope of protection of the present invention.
[0340] Furthermore, the above embodiments may refer to each other, and the implementation flows of encoding and decoding may refer to each other.
[0341] Having described the method provided by the present invention, the apparatus provided by the present invention will now be described.
[0342] As shown in FIG. 7, FIG. 7 is a structural schematic diagram of a decoding device provided in an embodiment of the present invention, the device includes an acquisition unit 710 for acquiring a value of an enhanced temporal motion vector prediction mode flag and an enhanced temporal motion vector prediction mode index value of a current coding unit; a first determination unit 720 for determining coordinate information of an initial matching coding unit of the current coding unit according to coordinate information of the current coding unit when the value of the enhanced temporal motion vector prediction mode flag is a first value; a construction unit 730 for constructing an enhanced temporal candidate list according to the coordinate information of the initial matching coding unit; and a construction unit 740 for constructing an enhanced temporal candidate list of the enhanced temporal motion vector prediction mode index value of the current coding unit when the value of the enhanced temporal motion vector prediction mode flag is a first value. The present invention may further include a second determination unit 740 for obtaining a corresponding enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list based on the enhanced temporal candidate value, and determining coordinate information of a target matching coding unit corresponding to the enhanced temporal motion vector prediction mode number; and a third determination unit 750 for determining motion information of a target matching coding unit including motion information of each sub-block in the target matching coding unit based on the coordinate information of the target matching coding unit, and determining motion information of a sub-block at a corresponding position in the current coding unit based on the motion information of each sub-block in the target matching coding unit.
[0343] In some embodiments, the obtaining unit 710 obtaining the value of the enhanced temporal motion vector prediction mode flag of the current encoding unit includes: analyzing the value of the enhanced temporal motion vector prediction mode flag from the bitstream if the current encoding unit satisfies a first analysis condition; and otherwise determining that the value of the enhanced temporal motion vector prediction mode flag is a second numerical value, wherein the value of the enhanced temporal motion vector prediction mode flag being the first numerical value indicates that the current encoding unit enables the enhanced temporal motion vector prediction mode, and the value of the enhanced temporal motion vector prediction mode flag being the second numerical value indicates that the current encoding unit does not enable the enhanced temporal motion vector prediction mode.
[0344] In some embodiments, the current encoding unit satisfying the first analysis condition includes one or more of: a prediction mode of the current encoding unit is skip mode or direct mode; a size of the current encoding unit satisfies a preset size restriction; and in the sequence level high level syntax, the current encoding unit is allowed to enable enhanced temporal motion vector prediction technique; and the current encoding unit satisfies an angle weighted prediction usage condition or an ultimate motion vector representation usage condition.
[0345] In some embodiments, the current coding unit satisfying the first analysis condition includes: a prediction mode of the current coding unit is skip mode or direct mode; a size of the current coding unit satisfies a size restriction that both the width and height of the current coding unit are greater than or equal to N0; and the sequence level high level syntax includes: the current coding unit is allowed to enable enhanced temporal motion vector prediction technique; and the current coding unit satisfies the usage condition of angle weighted prediction or satisfies the usage condition of ultimate motion vector representation.
[0346] In some embodiments, the enhanced temporal motion vector prediction mode flag uses context-adaptive binary arithmetic coding and uses one context model.
[0347] In some embodiments, the obtaining unit 710 obtaining the enhanced temporal motion vector prediction mode index value of the current coding unit includes parsing the enhanced temporal motion vector prediction mode index value from a bitstream if the current coding unit satisfies a second analysis condition.
[0348] In some embodiments, the current encoding unit satisfying the second analysis condition includes one or more of: a prediction mode of the current encoding unit is skip mode or direct mode; and the current encoding unit enables an enhanced temporal motion vector prediction mode.
[0349] In some embodiments, the de-binarization of the enhanced temporal motion vector prediction mode index value is achieved based on a truncated unary with a maximum value of 4, the truncated unary using four binary strings, each binary string using a single context model, for a total of four context models.
[0350] In some embodiments, the first determination unit 720 determining the coordinate information of the initial matching coding unit of the current coding unit based on the coordinate information of the current coding unit includes: determining a temporal reference picture in which the matching coding unit is located based on the current image frame type; and determining coordinate information of the initial matching coding unit in the temporal reference picture based on the coordinate information of the current coding unit, where if the current image frame type is a P picture, the temporal reference picture is a reference picture with a reference frame index value of 0 in reference picture list 0, and if the current image frame type is a B picture, the temporal reference picture is a reference picture with a reference frame index value of 0 in reference picture list 1.
[0351] In some embodiments, the first determination unit 720 determining the coordinate information of the initial matching coding unit in the temporal reference image based on the coordinate information of the current coding unit includes determining the coordinate information of the initial matching coding unit based on the top left corner coordinate in the image of the current largest coding unit, the size of the largest coding unit, the size of the current image, the size of the current coding unit, and the top left corner coordinate in the image of the current coding unit.
[0352] In some embodiments, the first determination unit 720 determining the coordinate information of the initial matching coding unit based on the top left corner coordinate in the image of the current largest coding unit, the size of the largest coding unit, the size of the current image, the size of the current coding unit, and the top left corner coordinate in the image of the current coding unit includes: determining the abscissa of the initial matching coding unit based on the top left corner abscissa of the image of the current largest coding unit, the size of the largest coding unit, the width of the current coding unit, the width of the current image, and the top left corner abscissa of the image of the current coding unit; and determining the ordinate of the initial matching coding unit based on the top left corner ordinate of the image of the current largest coding unit, the size of the largest coding unit, the height of the current coding unit, the height of the current image, and the top left corner ordinate in the image of the current coding unit.
[0353] In some embodiments, the construction unit 730 constructing an enhanced temporal candidate list based on coordinate information of the initial matching coding unit includes determining at least one enhanced temporal motion vector prediction mode number based on the coordinate information of the initial matching coding unit, and constructing an enhanced temporal candidate list based on the at least one enhanced temporal motion vector prediction mode number.
[0354] In some embodiments, the coordinate information of the matching coding unit is the upper left corner coordinate in the temporal reference image of the matching coding unit, and the construction unit 730 constructs an enhanced temporal candidate list according to the at least one enhanced temporal motion vector prediction mode number, the construction unit 730 includes: adding an enhanced temporal motion vector prediction mode number 0 to the enhanced temporal candidate list, and adding 1 to the length of the enhanced temporal candidate list; If My+8 is equal to or smaller than the smaller value of y_ctb_pos+lcu_size-cu_height and vertical_size-cu_height, and the motion information of the A1 position is different from the motion information of the C3 position, or the motion information of the A2 position is different from the motion information of the C4 position, add the reinforced temporal motion vector prediction mode number 1 to the reinforced temporal candidate list, and add 1 to the length of the reinforced temporal candidate list; If Mx+8 is equal to or smaller than the smaller value of x_ctb_pos+lcu_size-cu_width and horizontal_size-cu_width, and the motion information of the A1 position is different from the motion information of the B2 position, or the motion information of the A3 position is different from the motion information of the B4 position, add the reinforced temporal motion vector prediction mode number 2 to the reinforced temporal candidate list, and add 1 to the length of the reinforced temporal candidate list; If My-8 is equal to or greater than y_ctb_pos, and the motion information at the A3 position is different from the motion information at the C1 position, or the motion information at the A4 position is different from the motion information at the C2 position, add the reinforced temporal motion vector prediction mode number 3 to the reinforced temporal candidate list, and add 1 to the length of the reinforced temporal candidate list; If Mx-8 is greater than or equal to x_ctb_pos and the motion information at position A2 is different from the motion information at position B1, or the motion information at position A4 is different from the motion information at position B3, adding enhanced temporal motion vector prediction mode number 4 to the enhanced temporal candidate list and adding 1 to the length of the enhanced temporal candidate list.
[0355] Here, (Mx, My) is the coordinate information of the initial matching coding unit, (x_ctb_pos, y_ctb_pos) is the top left corner coordinate of the image of the current largest coding unit, lcu_size is the size of the largest coding unit, cu_width and cu_height are the width and height of the current coding unit, respectively, and horizontal_size and vertical_size are the width and height of the current image, respectively.
[0356] A1 is the 4*4 block in the upper left corner of the initial matching coding unit, B1 is the 4*4 block immediately to the left of A1, C1 is the 4*4 block immediately above A1, A2 is the 4*4 block in the upper right corner of the initial matching coding unit, B2 is the 4*4 block immediately to the right of A2, C2 is the 4*4 block immediately above A2, A3 is the 4*4 block in the lower left corner of the initial matching coding unit, B3 is the 4*4 block immediately to the left of A3, C3 is the 4*4 block immediately below A3, A4 is the 4*4 block in the lower right corner of the initial matching coding unit, B4 is the 4*4 block immediately to the right of A4, and C4 is the 4*4 block immediately below A4.
[0357] In some embodiments, the construction unit 730 constructing an enhanced temporal candidate list based on the coordinate information of the initial matching coding unit further includes, if the length of the enhanced temporal candidate list is less than 5, repeating the operation of adding an enhanced temporal motion vector prediction mode number that is the same as the last enhanced temporal motion vector prediction mode number in the current enhanced temporal candidate list to the enhanced temporal candidate list and adding 1 to the length of the enhanced temporal candidate list until the length of the enhanced temporal candidate list is equal to 5.
[0358] In some embodiments, the second determining unit 740 obtains a corresponding enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list according to the enhanced temporal motion vector prediction mode index value, and determines coordinate information of a target matching coding unit corresponding to the enhanced temporal motion vector prediction mode number. determining that Px is equal to Mx and Py is equal to My if the enhanced temporal motion vector prediction mode number is zero; determining that Px is equal to Mx and Py is equal to My+n if the enhanced temporal motion vector prediction mode number is 1; determining that Px is equal to Mx+n and Py is equal to My if the enhanced temporal motion vector prediction mode number is 2; determining that if the enhanced temporal motion vector prediction mode number is 3, then Px is equal to Mx and Py is equal to My-n; determining that if the enhanced temporal motion vector prediction mode number is 4, then Px is equal to Mx-n and Py is equal to My; Here, (Mx, My) is the upper left corner coordinate of the initial matching coding unit, and (Px, Py) is the upper left corner coordinate of the target matching coding unit.
[0359] In some embodiments, the third determination unit 750 determining, based on the motion information of each sub-block in the target matching coding unit, the motion information of the sub-block at the corresponding position in the current coding unit includes: for any sub-block in the target matching coding unit, if the current image frame type is a P picture, if forward motion information of the sub-block is available, scaling the forward motion information of the sub-block to point to the first frame of List0, and providing the scaled forward motion information to the sub-block at the corresponding position in the current coding unit.
[0360] In some embodiments, the determination unit 750 determining, based on the motion information of each sub-block in the target matching coding unit, the motion information of the sub-block at the corresponding position in the current coding unit includes: for any sub-block in the target matching coding unit, when the current image frame type is a B picture, if 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 in the current coding unit, if the forward motion information of the sub-block is available but the backward motion information is not available, scaling the forward motion information of the sub-block to point to the first frame of List0, and providing the scaled forward motion information to the sub-block at the corresponding position in the current coding unit, and 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 in the current coding unit.
[0361] In some embodiments, the determining unit 750 determines, based on the motion information of each sub-block in the target matching coding unit, the motion information of the sub-block at the corresponding position in the current coding unit, including: for any sub-block in the target matching coding unit, if the current image frame type is a P picture, if the forward motion information of the sub-block is unavailable, scale the forward motion information of the first peripheral block to point to the first frame of List0 when the forward motion information of the first peripheral block of the current coding unit is available, and provide the scaled forward motion information to the sub-block at the corresponding position in the current coding unit; if the forward motion information of the first peripheral block is unavailable, provide zero motion information to the sub-block at the corresponding position in the current coding unit; and if the current image frame type is a B picture, if both the forward motion information and the backward motion information of the sub-block are unavailable, scale the forward motion information of the first peripheral block to point to the first frame of List0 when the forward motion information of the first peripheral block of the current coding unit is available. when the forward motion information of the first peripheral block is available but the backward motion information is unavailable, scaling the forward motion information of the first peripheral 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 coding unit, respectively; when the forward motion information of the first peripheral block is available but the backward motion information is unavailable, scaling the forward motion information of the first peripheral block to point to the first frame of List0 and providing the scaled forward motion information to the sub-block at the corresponding position of the current coding unit; when the backward motion information of the first peripheral block is available but the forward motion information is unavailable, scaling the backward motion information of the first peripheral 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 coding unit; and when both the forward motion information and backward motion information of the first peripheral block are unavailable, providing zero motion information to the sub-block at the corresponding position of the current coding unit.Here, the first neighboring block includes any decoded neighboring block of the current coding unit.
[0362] In some embodiments, as shown in FIG. 8, the decoding device further includes a motion compensation unit 760 for performing motion compensation on corresponding sub-blocks in the current coding unit based on the motion information of each sub-block in the current coding unit.
[0363] In some embodiments, the motion compensation unit 760 performing motion compensation on corresponding sub-blocks in the current coding unit based on the motion information of each sub-block in the current coding unit includes: for any sub-block of the current coding unit, not performing a decoding side motion vector adjustment technique on the motion information of the sub-block; if the sub-block satisfies a bidirectional optical flow condition, performing motion compensation on the sub-block based on the motion information of the sub-block, and adding an optical flow offset value to the compensated pixel value using a bidirectional optical flow technique to obtain a predicted sample matrix of the sub-block; otherwise, performing motion compensation on the sub-block based on the motion information of the sub-block, and obtaining a predicted sample matrix of the sub-block, where the predicted sample of the current coding unit consists of the predicted samples of each sub-block.
[0364] In one possible embodiment, the decoding device may include a video decoder.
[0365] As shown in Fig. 9, it is a schematic diagram of a hardware structure of a decoding device provided in an embodiment of the present invention. The decoding device may include a processor 901 and a machine-readable storage medium 902 in which machine-executable instructions are stored. The processor 901 and the machine-readable storage medium 902 can communicate with each other via a system bus 903. In addition, the processor 901 can read and execute the machine-executable instructions corresponding to the decoding control logic in the machine-readable storage medium 902 to perform the above-mentioned decoding method.
[0366] The machine-readable storage medium 902 referred to herein may be any electronic, magnetic, optical, or other physical storage device capable of containing or storing information such as executable instructions, data, etc. For example, the machine-readable storage medium may be a RAM (Random Access Memory), a volatile memory, a non-volatile memory, a flash memory, a storage drive (e.g., a hard disk drive), a solid-state hard disk, any type of storage disk (e.g., an optical disk, a DVD, etc.), or a similar storage medium, or a combination thereof.
[0367] In some embodiments, there is further provided a machine-readable storage medium having machine-executable instructions stored thereon, which, when executed by a processor, performs the above-mentioned decoding method. For example, the machine-readable storage medium may be a ROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0368] As shown in FIG. 10, FIG. 10 is a structural schematic diagram of an encoding device provided in an embodiment of the present invention, the device includes a first determination unit 1010 for determining coordinate information of an initial matching coding unit of a current coding unit according to coordinate information of a current coding unit; a construction unit 1020 for constructing an enhanced temporal candidate list according to the coordinate information of the initial matching coding unit; a second determination unit 1030 for traversing each enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list in order, and determining coordinate information of a target matching coding unit corresponding to each enhanced temporal motion vector prediction mode number; and a motion estimation unit 1040 for estimating the motion information of the target matching coding unit, the motion information of each sub-block in the target matching coding unit, based on the coordinate information of the target matching coding unit. a third determination unit 1040 for determining, based on the motion information of each sub-block in the target matching coding unit, motion information of a sub-block at a corresponding position in the current coding unit; a motion compensation unit 1050 for performing motion compensation on a corresponding sub-block in the current coding unit based on the motion information of each sub-block in the current coding unit; and a coding unit 1060 for calculating a rate-distortion cost value corresponding to an enhanced temporal motion vector prediction mode, comparing the rate-distortion cost value with rate-distortion cost values of other prediction modes, selecting a prediction mode corresponding to a minimum rate-distortion cost value, and writing corresponding enhanced temporal motion vector prediction mode flags and enhanced temporal motion vector prediction mode index values into a bitstream for transmission to a decoding device.
[0369] In some embodiments, the first determination unit 1010 determining the coordinate information of the initial matching coding unit of the current coding unit based on the coordinate information of the current coding unit includes: determining a temporal reference picture in which the matching coding unit is located based on the current image frame type; and determining coordinate information of the initial matching coding unit in the temporal reference picture based on the coordinate information of the current coding unit, where if the current image frame type is a P picture, the temporal reference picture is a reference picture with a reference frame index value of 0 in reference picture list 0, and if the current image frame type is a B picture, the temporal reference picture is a reference picture with a reference frame index value of 0 in reference picture list 1.
[0370] In some embodiments, the first determination unit 1010 determining coordinate information of the initial matching coding unit in the temporal reference image based on the coordinate information of the current coding unit includes determining the coordinate information of the initial matching coding unit based on the top left corner coordinate in the image of the current largest coding unit, the size of the largest coding unit, the size of the current image, the size of the current coding unit, and the top left corner coordinate in the image of the current coding unit.
[0371] In some embodiments, the first determination unit 1010 determining the coordinate information of the initial matching coding unit based on the top left corner coordinate in the image of the current largest coding unit, the size of the largest coding unit, the size of the current image, the size of the current coding unit, and the top left corner coordinate in the image of the current coding unit includes: determining the abscissa of the initial matching coding unit based on the top left corner abscissa of the image of the current largest coding unit, the size of the largest coding unit, the width of the current coding unit, the width of the current image, and the top left corner abscissa of the image of the current coding unit; and determining the ordinate of the initial matching coding unit based on the top left corner ordinate of the image of the current largest coding unit, the size of the largest coding unit, the height of the current coding unit, the height of the current image, and the top left corner ordinate in the image of the current coding unit.
[0372] In some embodiments, the construction unit 1020 constructing an enhanced temporal candidate list based on coordinate information of the initial matching coding unit includes determining at least one enhanced temporal motion vector prediction mode number based on the coordinate information of the initial matching coding unit, and constructing an enhanced temporal candidate list based on the at least one enhanced temporal motion vector prediction mode number.
[0373] In some embodiments, the coordinate information of the matching coding unit is the upper left corner coordinate in the temporal reference image of the matching coding unit, and the construction unit 1020 constructs an enhanced temporal candidate list according to the at least one enhanced temporal motion vector prediction mode number, the construction unit 1020 includes: adding an enhanced temporal motion vector prediction mode number 0 to the enhanced temporal candidate list, and adding 1 to the length of the enhanced temporal candidate list; If My+8 is equal to or smaller than the smaller value of y_ctb_pos+lcu_size-cu_height and vertical_size-cu_height, and the motion information of the A1 position is different from the motion information of the C3 position, or the motion information of the A2 position is different from the motion information of the C4 position, add the reinforced temporal motion vector prediction mode number 1 to the reinforced temporal candidate list, and add 1 to the length of the reinforced temporal candidate list; If Mx+8 is equal to or smaller than the smaller value of x_ctb_pos+lcu_size-cu_width and horizontal_size-cu_width, and the motion information of the A1 position is different from the motion information of the B2 position, or the motion information of the A3 position is different from the motion information of the B4 position, add the reinforced temporal motion vector prediction mode number 2 to the reinforced temporal candidate list, and add 1 to the length of the reinforced temporal candidate list; If My-8 is equal to or greater than y_ctb_pos, and the motion information at the A3 position is different from the motion information at the C1 position, or the motion information at the A4 position is different from the motion information at the C2 position, add the reinforced temporal motion vector prediction mode number 3 to the reinforced temporal candidate list, and add 1 to the length of the reinforced temporal candidate list; If Mx-8 is greater than or equal to x_ctb_pos and the motion information at position A2 is different from the motion information at position B1, or the motion information at position A4 is different from the motion information at position B3, adding enhanced temporal motion vector prediction mode number 4 to the enhanced temporal candidate list and adding 1 to the length of the enhanced temporal candidate list.
[0374] Here, (Mx, My) is the coordinate information of the initial matching coding unit, (x_ctb_pos, y_ctb_pos) is the top left corner coordinate of the image of the current largest coding unit, lcu_size is the size of the largest coding unit, cu_width and cu_height are the width and height of the current coding unit, respectively, and horizontal_size and vertical_size are the width and height of the current image, respectively.
[0375] A1 is the 4*4 block in the upper left corner of the initial matching coding unit, B1 is the 4*4 block immediately to the left of A1, C1 is the 4*4 block immediately above A1, A2 is the 4*4 block in the upper right corner of the initial matching coding unit, B2 is the 4*4 block immediately to the right of A2, C2 is the 4*4 block immediately above A2, A3 is the 4*4 block in the lower left corner of the initial matching coding unit, B3 is the 4*4 block immediately to the left of A3, C3 is the 4*4 block immediately below A3, A4 is the 4*4 block in the lower right corner of the initial matching coding unit, B4 is the 4*4 block immediately to the right of A4, and C4 is the 4*4 block immediately below A4.
[0376] In some embodiments, the construction unit 1020 constructing an enhanced temporal candidate list based on the coordinate information of the initial matching coding unit further includes, if the length of the enhanced temporal candidate list is less than 5, repeating the operation of adding an enhanced temporal motion vector prediction mode number that is the same as the last enhanced temporal motion vector prediction mode number in the current enhanced temporal candidate list to the enhanced temporal candidate list and adding 1 to the length of the enhanced temporal candidate list until the length of the enhanced temporal candidate list is equal to 5.
[0377] In some embodiments, the second determining unit 1030 sequentially traverses each enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list, and determines the coordinate information of the target matching coding unit corresponding to each enhanced temporal motion vector prediction mode number, for the currently traversed enhanced temporal motion vector prediction mode number: determining that Px is equal to Mx and Py is equal to My if the enhanced temporal motion vector prediction mode number is zero; determining that Px is equal to Mx and Py is equal to My+n if the enhanced temporal motion vector prediction mode number is 1; determining that Px is equal to Mx+n and Py is equal to My if the enhanced temporal motion vector prediction mode number is 2; determining that Px is equal to Mx and Py is equal to My-n if the enhanced temporal motion vector prediction mode number is 3; determining that Px is equal to Mx-n and Py is equal to My if the enhanced temporal motion vector prediction mode number is 4; Here, (Mx, My) is the upper left corner coordinate of the initial matching coding unit, and (Px, Py) is the upper left corner coordinate of the target matching coding unit.
[0378] In some embodiments, the third determination unit 1040 determining, based on the motion information of each sub-block in the target matching coding unit, the motion information of the sub-block at the corresponding position in the current coding unit includes: for any sub-block in the target matching coding unit, if the current image frame type is a P picture, if forward motion information of the sub-block is available, scaling the forward motion information of the sub-block to point to the first frame of List0, and providing the scaled forward motion information to the sub-block at the corresponding position in the current coding unit.
[0379] In some embodiments, the determination unit 1040 determining, based on the motion information of each sub-block in the target matching coding unit, the motion information of the sub-block at the corresponding position in the current coding unit includes: for any sub-block in the target matching coding unit, when the current image frame type is a B picture, if 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 in the current coding unit, if the forward motion information of the sub-block is available but the backward motion information is not available, scaling the forward motion information of the sub-block to point to the first frame of List0, and providing the scaled forward motion information to the sub-block at the corresponding position in the current coding unit, and 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 in the current coding unit.
[0380] In some embodiments, the third determination unit 1040 determines, based on the motion information of each sub-block in the target matching coding unit, the motion information of the sub-block at the corresponding position in the current coding unit, including: for any sub-block in the target matching coding unit, if the current image frame type is a P picture, if the forward motion information of the sub-block is unavailable, scale the forward motion information of the first peripheral block to point to the first frame of List0 when the forward motion information of the first peripheral block of the current coding unit is available, and provide the scaled forward motion information to the sub-block at the corresponding position in the current coding unit; if the forward motion information of the first peripheral block is unavailable, provide zero motion information to the sub-block at the corresponding position in the current coding unit; and if the current image frame type is a B picture, if both the forward motion information and the backward motion information of the sub-block are unavailable, scale the forward motion information of the first peripheral block to point to the first frame of List0 when the forward motion information of the first peripheral block of the current coding unit is available. when the forward motion information of the first peripheral block is available but the backward motion information is unavailable, scaling the forward motion information of the first peripheral 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 coding unit, respectively; when the forward motion information of the first peripheral block is available but the backward motion information is unavailable, scaling the forward motion information of the first peripheral block to point to the first frame of List0, and providing the scaled forward motion information to the sub-block at the corresponding position of the current coding unit; when the backward motion information of the first peripheral block is available but the forward motion information is unavailable, scaling the backward motion information of the first peripheral 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 coding unit; and when both the forward motion information and backward motion information of the first peripheral block are unavailable, providing zero motion information to the sub-block at the corresponding position of the current coding unit, whereinThe first neighboring block includes any decoded neighboring block of the current coding unit.
[0381] In some embodiments, the motion compensation unit 1050 performing motion compensation on corresponding sub-blocks in the current coding unit based on the motion information of each sub-block in the current coding unit includes: for any sub-block of the current coding unit, not performing a decoding side motion vector adjustment technique on the motion information of the sub-block; if the sub-block satisfies a bidirectional optical flow condition, performing motion compensation on the sub-block based on the motion information of the sub-block, and using a bidirectional optical flow technique to add an optical flow offset value to the compensated pixel value to obtain a predicted sample matrix of the sub-block; otherwise, performing motion compensation on the sub-block based on the motion information of the sub-block, and obtaining a predicted sample matrix of the sub-block, where the predicted samples of the current coding unit consist of the predicted samples of each sub-block.
[0382] In one possible embodiment, the encoding device may comprise a video encoder.
[0383] As shown in Fig. 11, it is a schematic diagram of a hardware structure of an encoding device provided in an embodiment of the present invention. The encoding device may include a processor 1101 and a machine-readable storage medium 1102 in which machine-executable instructions are stored. The processor 1101 and the machine-readable storage medium 1102 can communicate with each other via a system bus 1103. Moreover, the processor 1101 can read and execute the machine-executable instructions corresponding to the encoding control logic in the machine-readable storage medium 1102 to execute the above-mentioned encoding method.
[0384] The machine-readable storage medium 1102 referred to herein may be any electronic, magnetic, optical, or other physical storage device capable of containing or storing information such as executable instructions, data, etc. For example, the machine-readable storage medium may be a RAM (Random Access Memory), a volatile memory, a non-volatile memory, a flash memory, a storage drive (e.g., a hard disk drive), a solid-state hard disk, any type of storage disk (e.g., an optical disk, a DVD, etc.), or a similar storage medium, or a combination thereof.
[0385] In some embodiments, there is further provided a machine-readable storage medium having machine-executable instructions stored thereon, which, when executed by a processor, performs the coding method described above. For example, the machine-readable storage medium may be a ROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0386] In some embodiments, there is further provided a camera device including the encoding device of any of the above embodiments and the decoding device of any of the above embodiments.
[0387] According to a first aspect of an embodiment of the present invention, a decoding method is provided, including the steps of obtaining a value of an enhanced temporal motion vector prediction mode flag and an enhanced temporal motion vector prediction mode index value of a current coding unit; when the value of the enhanced temporal motion vector prediction mode flag is a first numerical value, determining coordinate information of an initial matching coding unit of the current coding unit based on coordinate information of the current coding unit; constructing an enhanced temporal candidate list based on the coordinate information of the initial matching coding unit; obtaining a corresponding enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list based on the enhanced temporal motion vector prediction mode index value, and determining coordinate information of a target matching coding unit corresponding to the enhanced temporal motion vector prediction mode number; determining motion information of a target matching coding unit including motion information of each sub-block in the target matching coding unit based on the coordinate information of the target matching coding unit, and determining motion information of a sub-block at a corresponding position in the current coding unit based on the motion information of each sub-block in the target matching coding unit.
[0388] In some embodiments, the step of obtaining the value of the enhanced temporal motion vector prediction mode flag of the current encoding unit includes a step of analyzing the value of the enhanced temporal motion vector prediction mode flag from the bitstream if the current encoding unit satisfies a first analysis condition, and otherwise determining that the value of the enhanced temporal motion vector prediction mode flag is a second numerical value, wherein the value of the enhanced temporal motion vector prediction mode flag being the first numerical value indicates that the current encoding unit enables the enhanced temporal motion vector prediction mode, and the value of the enhanced temporal motion vector prediction mode flag being the second numerical value indicates that the current encoding unit does not enable the enhanced temporal motion vector prediction mode.
[0389] In some embodiments, the current encoding unit satisfying the first analysis condition includes one or more of: a prediction mode of the current encoding unit is skip mode or direct mode; a size of the current encoding unit satisfies a preset size restriction; and in the sequence level high level syntax, the current encoding unit is allowed to enable enhanced temporal motion vector prediction technique; and the current encoding unit satisfies an angle weighted prediction usage condition or an ultimate motion vector representation usage condition.
[0390] In some embodiments, the pre-set size constraints include a width and a height of the current coding unit both being greater than or equal to N0.
[0391] In some embodiments, N0 is 8.
[0392] The current coding unit satisfies the condition for using angle weighting prediction, the high level syntax of the sequence level includes: the current coding unit is allowed to enable angle weighting prediction technology; the width and height of the current coding unit are both greater than or equal to N1, and the width and height of the current coding unit are both less than or equal to N2; The current image frame type is a B picture, and the current encoding unit satisfies the conditions for using the ultimate motion vector representation, including that the sequence level high level syntax allows the current encoding unit to enable the ultimate motion vector representation technique.
[0393] In some embodiments, the enhanced temporal motion vector prediction mode flag uses context-adaptive binary arithmetic coding and uses one context model.
[0394] In some embodiments, the step of obtaining an enhanced temporal motion vector prediction mode index value of a current coding unit includes a step of parsing the enhanced temporal motion vector prediction mode index value from a bitstream if the current coding unit satisfies a second analysis condition.
[0395] In some embodiments, the current encoding unit satisfying the second analysis condition includes one or more of: a prediction mode of the current encoding unit is skip mode or direct mode; and the current encoding unit enables an enhanced temporal motion vector prediction mode.
[0396] In some embodiments, the de-binarization of the enhanced temporal motion vector prediction mode index value is achieved based on a truncated unary with a maximum value of 4, the truncated unary using up to four binary strings, each binary string using a single context model, for a total of four context models.
[0397] In some embodiments, the step of determining coordinate information of an initial matching coding unit of the current coding unit based on the coordinate information of the current coding unit includes: determining a temporal reference image in which a matching coding unit is located based on a current image frame type; and determining coordinate information of the initial matching coding unit in the temporal reference image based on the coordinate information of the current coding unit, where if the current image frame type is a P picture, the temporal reference image is a reference image having a reference frame index value of 0 in reference image list 0, and if the current image frame type is a B picture, the temporal reference image is a reference image having a reference frame index value of 0 in reference image list 1, and the step of constructing an enhanced temporal candidate list based on the coordinate information of the initial matching coding unit includes constructing an enhanced temporal candidate list based on the coordinate information of the initial matching coding unit in the temporal reference image.
[0398] In some embodiments, the step of determining coordinate information of the initial matching coding unit in the temporal reference image based on the coordinate information of the current coding unit includes a step of determining coordinate information of the initial matching coding unit based on the top left corner coordinate in the image of the current largest coding unit, the size of the largest coding unit, the size of the current image, the size of the current coding unit, and the top left corner coordinate in the image of the current coding unit.
[0399] In some embodiments, the step of determining coordinate information of the initial matching coding unit based on the top left corner coordinate in the image of the current largest coding unit, the size of the largest coding unit, the size of the current image, the size of the current coding unit, and the top left corner coordinate in the image of the current coding unit includes the step of determining the abscissa of the initial matching coding unit based on the top left corner abscissa of the image of the current largest coding unit, the size of the largest coding unit, the width of the current coding unit, the width of the current image, and the top left corner abscissa of the image of the current coding unit; and the step of determining the ordinate of the initial matching coding unit based on the top left corner ordinate of the image of the current largest coding unit, the size of the largest coding unit, the height of the current coding unit, the height of the current image, and the top left corner ordinate of the image of the current coding unit.
[0400] In some embodiments, the step of constructing an enhanced temporal candidate list based on coordinate information of the initial matching coding unit includes a step of determining at least one enhanced temporal motion vector prediction mode number based on coordinate information of the initial matching coding unit, and a step of constructing an enhanced temporal candidate list based on the at least one enhanced temporal motion vector prediction mode number.
[0401] In some embodiments, the coordinate information of the matching coding unit is the upper left corner coordinate in the temporal reference image of the matching coding unit, and the step of constructing the enhanced temporal candidate list according to the at least one enhanced temporal motion vector prediction mode number includes the steps of: adding an enhanced temporal motion vector prediction mode number 0 to the enhanced temporal candidate list and adding 1 to the length of the enhanced temporal candidate list; if My+8 is less than or equal to the smaller value of y_ctb_pos+lcu_size-cu_height and vertical_size-cu_height, and the motion information of the A1 position is different from the motion information of the C3 position, or the motion information of the A2 position is different from the motion information of the C4 position; adding an enhanced temporal motion vector prediction mode number 1 to the enhanced temporal candidate list and adding 1 to the length of the enhanced temporal candidate list; if Mx+8 is less than or equal to the smaller value of x_ctb_pos+lcu_size-cu_width and horizontal_size-cu_width, and if My-8 is greater than or equal to y_ctb_pos and the motion information at the A3 position is different from the motion information at the C1 position, or the motion information at the A4 position is different from the motion information at the C2 position, adding an enhanced temporal motion vector prediction mode number 3 to the enhanced temporal candidate list and adding one to the length of the enhanced temporal candidate list; and if Mx-8 is greater than or equal to x_ctb_pos and the motion information at the A2 position is different from the motion information at the B1 position, or the motion information at the A4 position is different from the motion information at the B3 position, adding an enhanced temporal motion vector prediction mode number 4 to the enhanced temporal candidate list and adding one to the length of the enhanced temporal candidate list, where (Mx,My) is the coordinate information of the initial matching coding unit, (x_ctb_pos,y_ctb_pos) is the top-left corner coordinate of the current largest coding unit in the image, lcu_size is the size of the largest coding unit, cu_width and cu_height are the width and height of the current coding unit, horizontal_size and vertical_size are the width and height of the current image, A1 is the 4*4 block in the top-left corner of the initial matching coding unit, B1 is the 4*4 block immediately to the left of A1, and C1 is the 4*4 block immediately above A1. A block, A2 is the 4*4 block in the upper right corner of the initial matching coding unit, B2 is the 4*4 block immediately to the right of A2, C2 is the 4*4 block immediately above A2, A3 is the 4*4 block in the lower left corner of the initial matching coding unit, B3 is the 4*4 block immediately to the left of A3, C3 is the 4*4 block immediately below A3, A4 is the 4*4 block in the lower right corner of the initial matching coding unit, B4 is the 4*4 block immediately to the right of A4, and C4 is the 4*4 block immediately below A4.
[0402] In some embodiments, the step of constructing an enhanced temporal candidate list based on the coordinate information of the initial matching coding unit further includes, when the length of the enhanced temporal candidate list is less than 5, repeating the operation of adding an enhanced temporal motion vector prediction mode number that is the same as the last enhanced temporal motion vector prediction mode number in the current enhanced temporal candidate list to the enhanced temporal candidate list and adding 1 to the length of the enhanced temporal candidate list until the length of the enhanced temporal candidate list is equal to 5.
[0403] In some embodiments, the step of obtaining a corresponding enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list according to the enhanced temporal motion vector prediction mode index value, and determining coordinate information of a target matching coding unit corresponding to the enhanced temporal motion vector prediction mode number includes the steps of: if the enhanced temporal motion vector prediction mode number is 0, determining that Px is equal to Mx and Py is equal to My; and if the enhanced temporal motion vector prediction mode number is 1, determining that Px is equal to Mx and Py is equal to My+n. and determining that if the reinforced temporal motion vector prediction mode number is 2, Px is equal to Mx+n and Py is equal to My; and determining that if the reinforced temporal motion vector prediction mode number is 3, Px is equal to Mx and Py is equal to My-n; and determining that if the reinforced temporal motion vector prediction mode number is 4, Px is equal to Mx-n and Py is equal to My, where (Mx, My) is the upper left corner coordinate of the initial matching coding unit, and (Px, Py) is the upper left corner coordinate of the target matching coding unit.
[0404] In some embodiments, N is 8.
[0405] In some embodiments, the step of determining motion information of a sub-block at a corresponding position in the current coding unit based on the motion information of each sub-block in the target matching coding unit includes, for any sub-block in the target matching coding unit, if the current image frame type is a P picture, if forward motion information of the sub-block is available, scaling the forward motion information of the sub-block to point to the first frame of List0, and providing the scaled forward motion information to the sub-block at the corresponding position in the current coding unit.
[0406] In some embodiments, the step of determining motion information of a sub-block at a corresponding position in the current coding unit based on the motion information of each sub-block in the target matching coding unit includes the steps of: for any sub-block in the target matching coding unit, when the current image frame type is a B picture, if 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 in the current coding unit, respectively; if forward motion information of the sub-block is available but backward motion information is not available, scaling the forward motion information of the sub-block to point to the first frame of List0, and providing the scaled forward motion information to the sub-block at the corresponding position in the current coding unit; and 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 in the current coding unit.
[0407] In some embodiments, the step of determining, based on the motion information of each sub-block in the target matching coding unit, the motion information of the sub-block at the corresponding position in the current coding unit includes the steps of: for any sub-block in the target matching coding unit, when the current image frame type is a P picture, if the forward motion information of the sub-block is unavailable, scaling the forward motion information of the first peripheral block to point to the first frame of List0 when the forward motion information of the first peripheral block of the current coding unit is available, and providing the scaled forward motion information to the sub-block at the corresponding position in the current coding unit; when the forward motion information of the first peripheral block is unavailable, providing zero motion information to the sub-block at the corresponding position in the current coding unit; and when the current image frame type is a B picture, if both the forward motion information and the backward motion information of the sub-block are unavailable, scaling the forward motion information of the first peripheral block to point to the first frame of List0 when the forward motion information of the first peripheral block of the current coding unit is available, and providing the scaled forward motion information to the sub-block at the corresponding position in the current coding unit. scaling forward motion information and backward motion information of the blocks 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-blocks at the corresponding positions of the current coding unit, respectively; when the forward motion information of the first peripheral block is available but the backward motion information is unavailable, scaling the forward motion information of the first peripheral block to point to the first frame of List0, and providing the scaled forward motion information to the sub-blocks at the corresponding positions of the current coding unit; when the backward motion information of the first peripheral block is available but the forward motion information is unavailable, scaling the backward motion information of the first peripheral block to point to the first frame of List1, and providing the scaled backward motion information to the sub-blocks at the corresponding positions of the current coding unit; and when both the forward motion information and backward motion information of the first peripheral block are unavailable, providing zero motion information to the sub-blocks at the corresponding positions of the current coding unit, whereinThe first neighboring block includes any decoded neighboring block of the current coding unit.
[0408] In some embodiments, after the step of determining motion information of a sub-block at a corresponding position in the current coding unit based on the motion information of each sub-block in the target matching coding unit, the method further includes a step of performing motion compensation on the corresponding sub-block in the current coding unit based on the motion information of each sub-block in the current coding unit.
[0409] In some embodiments, the step of performing motion compensation on a corresponding sub-block in the current coding unit based on the motion information of each sub-block in the current coding unit includes: for any sub-block of the current coding unit, not performing a decoding side motion vector adjustment technique on the motion information of the sub-block; if the sub-block satisfies a bidirectional optical flow condition, performing motion compensation on the sub-block based on the motion information of the sub-block, and adding an optical flow offset value to the compensated pixel value using a bidirectional optical flow technique to obtain a predicted sample matrix of the sub-block; and otherwise performing motion compensation on the sub-block based on the motion information of the sub-block, and obtaining a predicted sample matrix of the sub-block, wherein the predicted samples of the current coding unit consist of the predicted samples of each sub-block.
[0410] In some embodiments, the bidirectional optical flow condition of a sub-block includes that the high level syntax at the sequence level is allowed to enable bidirectional optical flow techniques, the motion vector precision of the current coding unit is equal to 0, the sub-block uses bidirectional prediction, and the display orders of the reference frame with reference frame index value refIdxL0 in reference image list 0 of the sub-block and the reference frame with reference frame index value refIdxL1 in reference image list 1 of the sub-block are located on either side of the current frame, respectively.
[0411] In some embodiments, the step of adding an optical flow offset value to the compensated pixel value using a bidirectional optical flow technique to obtain a predicted sample matrix for the sub-block includes a step of determining a predicted sample matrix for the sub-block based on a forward motion compensation value, a backward motion compensation value and an optical flow offset value for the sub-block.
[0412] According to a second aspect of the embodiment of the present invention, the following steps are included: based on the coordinate information of the current coding unit, determining the coordinate information of an initial matching coding unit of the current coding unit; based on the coordinate information of the initial matching coding unit, constructing an enhanced temporal candidate list; traversing each enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list in order, and determining the coordinate information of a target matching coding unit corresponding to each enhanced temporal motion vector prediction mode number; based on the coordinate information of the target matching coding unit, determining the motion information of a target matching coding unit, which includes the motion information of each sub-block in the target matching coding unit, and then calculating the target matching coding unit. In accordance with the present invention, there is provided an encoding method including: determining motion information of a sub-block at a corresponding position in the current coding unit based on the motion information of each sub-block in the current coding unit; performing motion compensation for the corresponding sub-block in the current coding unit based on the motion information of each sub-block in the current coding unit; calculating a rate-distortion cost value corresponding to an enhanced temporal motion vector prediction mode, comparing the rate-distortion cost value with rate-distortion cost values of other prediction modes, selecting a prediction mode corresponding to a minimum rate-distortion cost value, writing a corresponding enhanced temporal motion vector prediction mode flag and an enhanced temporal motion vector prediction mode index value into a bitstream and transmitting to a decoding device.
[0413] In some embodiments, the step of performing motion compensation on a corresponding sub-block in the current coding unit based on the motion information of each sub-block in the current coding unit includes: for any sub-block of the current coding unit, not performing a decoding side motion vector adjustment technique on the motion information of the sub-block; if the sub-block satisfies a bidirectional optical flow condition, performing motion compensation on the sub-block based on the motion information of the sub-block, and adding an optical flow offset value to the compensated pixel value using a bidirectional optical flow technique to obtain a predicted sample matrix of the sub-block; otherwise, performing motion compensation on the sub-block based on the motion information of the sub-block, and obtaining a predicted sample matrix of the sub-block, where the predicted samples of the current coding unit consist of the predicted samples of each sub-block.
[0414] In some embodiments, the bidirectional optical flow condition of a sub-block includes that the high level syntax at the sequence level is allowed to enable bidirectional optical flow techniques, the motion vector precision of the current coding unit is equal to 0, the sub-block uses bidirectional prediction, and the display orders of the reference frame with reference frame index value refIdxL0 in reference image list 0 of the sub-block and the reference frame with reference frame index value refIdxL1 in reference image list 1 of the sub-block are located on either side of the current frame, respectively.
[0415] In some embodiments, the step of adding an optical flow offset value to the compensated pixel value using a bidirectional optical flow technique to obtain a predicted sample matrix for the sub-block includes a step of determining a predicted sample matrix for the sub-block based on a forward motion compensation value, a backward motion compensation value and an optical flow offset value for the sub-block.
[0416] In some embodiments, the step of writing a corresponding enhanced temporal motion vector prediction mode flag to a bitstream includes a step of writing a corresponding enhanced temporal motion vector prediction mode flag to a bitstream if the current encoding unit satisfies a first analysis condition, and otherwise determining that the value of the corresponding enhanced temporal motion vector prediction mode flag is a second numerical value, wherein the value of the enhanced temporal motion vector prediction mode flag being a first numerical value indicates that the current encoding unit enables the enhanced temporal motion vector prediction mode, and the value of the enhanced temporal motion vector prediction mode flag being a second numerical value indicates that the current encoding unit does not enable the enhanced temporal motion vector prediction mode.
[0417] In some embodiments, the current coding unit satisfying the first analysis condition includes one or more of: a prediction mode of the current coding unit is skip mode or direct mode; a size of the current coding unit satisfies a size restriction that both the width and height of the current coding unit are equal to or greater than 8; and the sequence level high level syntax includes one or more of: the current coding unit is allowed to enable enhanced temporal motion vector prediction technique; and the current coding unit satisfies an angle weighted prediction usage condition or an ultimate motion vector representation usage condition.
[0418] In some embodiments, the current coding unit satisfies the usage conditions for angle weighted prediction, the sequence level high level syntax includes: the current coding unit is allowed to enable angle weighted prediction technique; a width and a height of the current coding unit are both greater than or equal to N1, and a width and a height of the current coding unit are both less than or equal to N2; and the current image frame type is a B picture; and the current coding unit satisfies the usage conditions for ultimate motion vector representation, the sequence level high level syntax includes: the current coding unit is allowed to enable ultimate motion vector representation technique.
[0419] In some embodiments, the enhanced temporal motion vector prediction mode flag uses context-adaptive binary arithmetic coding and uses one context model.
[0420] In some embodiments, the step of writing the enhanced temporal motion vector prediction mode index value to the bitstream includes the step of writing the enhanced temporal motion vector prediction mode index value to the bitstream if the current coding unit satisfies a second analysis condition.
[0421] In some embodiments, the current encoding unit satisfying the second analysis condition includes one or more of: a prediction mode of the current encoding unit is skip mode or direct mode; and the current encoding unit enables an enhanced temporal motion vector prediction mode.
[0422] In some embodiments, the de-binarization of the enhanced temporal motion vector prediction mode index value is achieved based on a truncated unary with a maximum value of 4, the truncated unary using up to four binary strings, each binary string using a single context model, for a total of four context models.
[0423] In some embodiments, the step of determining coordinate information of an initial matching coding unit of the current coding unit based on the coordinate information of the current coding unit includes: determining a temporal reference image in which a matching coding unit is located based on a current image frame type; and determining coordinate information of the initial matching coding unit in the temporal reference image based on the coordinate information of the current coding unit, where if the current image frame type is a P picture, the temporal reference image is a reference image having a reference frame index value of 0 in reference image list 0, and if the current image frame type is a B picture, the temporal reference image is a reference image having a reference frame index value of 0 in reference image list 1, and the step of constructing an enhanced temporal candidate list based on the coordinate information of the initial matching coding unit includes constructing an enhanced temporal candidate list based on the coordinate information of the initial matching coding unit in the temporal reference image.
[0424] In some embodiments, the step of determining coordinate information of the initial matching coding unit in the temporal reference image based on the coordinate information of the current coding unit includes a step of determining coordinate information of the initial matching coding unit based on the top left corner coordinate in the image of the current largest coding unit, the size of the largest coding unit, the size of the current image, the size of the current coding unit, and the top left corner coordinate in the image of the current coding unit.
[0425] In some embodiments, the step of determining coordinate information of the initial matching coding unit based on the top left corner coordinate in the image of the current largest coding unit, the size of the largest coding unit, the size of the current image, the size of the current coding unit, and the top left corner coordinate in the image of the current coding unit includes the step of determining the abscissa of the initial matching coding unit based on the top left corner abscissa of the image of the current largest coding unit, the size of the largest coding unit, the width of the current coding unit, the width of the current image, and the top left corner abscissa of the image of the current coding unit; and the step of determining the ordinate of the initial matching coding unit based on the top left corner ordinate of the image of the current largest coding unit, the size of the largest coding unit, the height of the current coding unit, the height of the current image, and the top left corner ordinate of the image of the current coding unit.
[0426] In some embodiments, the step of sequentially traversing each enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list and determining the coordinate information of the target matching coding unit corresponding to each enhanced temporal motion vector prediction mode number includes the steps of: determining that Px is equal to Mx and Py is equal to My if the enhanced temporal motion vector prediction mode number is 0; determining that Px is equal to Mx and Py is equal to My+8 if the enhanced temporal motion vector prediction mode number is 1; The method includes the steps of: determining that if the enhanced temporal motion vector prediction mode number is 2, Px is equal to Mx+8, and Py is equal to My; determining that if the enhanced temporal motion vector prediction mode number is 3, Px is equal to Mx, and Py is equal to My-8; and determining that if the enhanced temporal motion vector prediction mode number is 4, Px is equal to Mx-8, and Py is equal to My, where (Mx, My) is the upper left corner coordinate of the initial matching coding unit, and (Px, Py) is the upper left corner coordinate of the target matching coding unit.
[0427] In some embodiments, the step of constructing an enhanced temporal candidate list based on coordinate information of the initial matching coding unit includes a step of determining at least one enhanced temporal motion vector prediction mode number based on coordinate information of the initial matching coding unit, and a step of constructing an enhanced temporal candidate list based on the at least one enhanced temporal motion vector prediction mode number.
[0428] In some embodiments, the coordinate information of the matching coding unit is the upper left corner coordinate in the temporal reference image of the matching coding unit, and the step of constructing the enhanced temporal candidate list according to the at least one enhanced temporal motion vector prediction mode number includes the steps of: adding an enhanced temporal motion vector prediction mode number 0 to the enhanced temporal candidate list and adding 1 to the length of the enhanced temporal candidate list; if My+8 is less than or equal to the smaller value of y_ctb_pos+lcu_size-cu_height and vertical_size-cu_height, and the motion information of the A1 position is different from the motion information of the C3 position, or the motion information of the A2 position is different from the motion information of the C4 position; adding an enhanced temporal motion vector prediction mode number 1 to the enhanced temporal candidate list and adding 1 to the length of the enhanced temporal candidate list; if Mx+8 is less than or equal to the smaller value of x_ctb_pos+lcu_size-cu_width and horizontal_size-cu_width, and if My-8 is greater than or equal to y_ctb_pos and the motion information at the A3 position is different from the motion information at the C1 position, or the motion information at the A4 position is different from the motion information at the C2 position, adding an enhanced temporal motion vector prediction mode number 3 to the enhanced temporal candidate list and adding one to the length of the enhanced temporal candidate list; and if Mx-8 is greater than or equal to x_ctb_pos and the motion information at the A2 position is different from the motion information at the B1 position, or the motion information at the A4 position is different from the motion information at the B3 position, adding an enhanced temporal motion vector prediction mode number 4 to the enhanced temporal candidate list and adding one to the length of the enhanced temporal candidate list, where (Mx,My) is the coordinate information of the initial matching coding unit, (x_ctb_pos,y_ctb_pos) is the top-left corner coordinate of the current largest coding unit in the image, lcu_size is the size of the largest coding unit, cu_width and cu_height are the width and height of the current coding unit, horizontal_size and vertical_size are the width and height of the current image, A1 is the 4*4 block in the top-left corner of the initial matching coding unit, B1 is the 4*4 block immediately to the left of A1, and C1 is the 4*4 block immediately above A1. A block, A2 is the 4*4 block in the upper right corner of the initial matching coding unit, B2 is the 4*4 block immediately to the right of A2, C2 is the 4*4 block immediately above A2, A3 is the 4*4 block in the lower left corner of the initial matching coding unit, B3 is the 4*4 block immediately to the left of A3, C3 is the 4*4 block immediately below A3, A4 is the 4*4 block in the lower right corner of the initial matching coding unit, B4 is the 4*4 block immediately to the right of A4, and C4 is the 4*4 block immediately below A4.
[0429] In some embodiments, the step of constructing an enhanced temporal candidate list based on the coordinate information of the initial matching coding unit further includes, when the length of the enhanced temporal candidate list is less than 5, repeating the operation of adding an enhanced temporal motion vector prediction mode number that is the same as the last enhanced temporal motion vector prediction mode number in the current enhanced temporal candidate list to the enhanced temporal candidate list and adding 1 to the length of the enhanced temporal candidate list until the length of the enhanced temporal candidate list is equal to 5.
[0430] In some embodiments, the step of determining motion information of a sub-block at a corresponding position in the current coding unit based on the motion information of each sub-block in the target matching coding unit includes, for any sub-block in the target matching coding unit, if the current image frame type is a P picture, if forward motion information of the sub-block is available, scaling the forward motion information of the sub-block to point to the first frame of List0, and providing the scaled forward motion information to the sub-block at the corresponding position in the current coding unit.
[0431] In some embodiments, the step of determining motion information of a sub-block at a corresponding position in the current coding unit based on the motion information of each sub-block in the target matching coding unit includes the steps of: for any sub-block in the target matching coding unit, when the current image frame type is a B picture, if 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 in the current coding unit, respectively; if forward motion information of the sub-block is available but backward motion information is not available, scaling the forward motion information of the sub-block to point to the first frame of List0, and providing the scaled forward motion information to the sub-block at the corresponding position in the current coding unit; and 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 in the current coding unit.
[0432] In some embodiments, the step of determining, based on the motion information of each sub-block in the target matching coding unit, the motion information of the sub-block at the corresponding position in the current coding unit includes the steps of: for any sub-block in the target matching coding unit, when the current image frame type is a P picture, if the forward motion information of the sub-block is unavailable, scaling the forward motion information of the first peripheral block to point to the first frame of List0 when the forward motion information of the first peripheral block of the current coding unit is available, and providing the scaled forward motion information to the sub-block at the corresponding position in the current coding unit; when the forward motion information of the first peripheral block is unavailable, providing zero motion information to the sub-block at the corresponding position in the current coding unit; and when the current image frame type is a B picture, if both the forward motion information and the backward motion information of the sub-block are unavailable, scaling the forward motion information of the first peripheral block to point to the first frame of List0 when the forward motion information of the first peripheral block of the current coding unit is available, and providing the scaled forward motion information to the sub-block at the corresponding position in the current coding unit. scaling forward motion information and backward motion information of the blocks 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-blocks at the corresponding positions of the current coding unit, respectively; when the forward motion information of the first peripheral block is available but the backward motion information is unavailable, scaling the forward motion information of the first peripheral block to point to the first frame of List0, and providing the scaled forward motion information to the sub-blocks at the corresponding positions of the current coding unit; when the backward motion information of the first peripheral block is available but the forward motion information is unavailable, scaling the backward motion information of the first peripheral block to point to the first frame of List1, and providing the scaled backward motion information to the sub-blocks at the corresponding positions of the current coding unit; and when both the forward motion information and backward motion information of the first peripheral block are unavailable, providing zero motion information to the sub-blocks at the corresponding positions of the current coding unit, whereinThe first neighboring block includes any decoded neighboring block of the current coding unit.
[0433] According to a third aspect of an embodiment of the present invention, a decoding device is provided, including: an acquisition unit for acquiring a value of an enhanced temporal motion vector prediction mode flag and an enhanced temporal motion vector prediction mode index value of a current coding unit; a first determination unit for determining coordinate information of an initial matching coding unit of the current coding unit based on coordinate information of the current coding unit when the value of the enhanced temporal motion vector prediction mode flag is a first numerical value; a construction unit for constructing an enhanced temporal candidate list based on the coordinate information of the initial matching coding unit; a second determination unit for obtaining a corresponding enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list based on the enhanced temporal motion vector prediction mode index value and determining coordinate information of a target matching coding unit corresponding to the enhanced temporal motion vector prediction mode number; and a third determination unit for determining motion information of a target matching coding unit including motion information of each sub-block in the target matching coding unit based on the coordinate information of the target matching coding unit, and determining motion information of a sub-block at a corresponding position in the current coding unit based on the motion information of each sub-block in the target matching coding unit.
[0434] According to a fourth aspect of the embodiment of the present invention, a first determination unit is provided for determining, based on coordinate information of a current coding unit, coordinate information of an initial matching coding unit of a current coding unit; a construction unit is provided for constructing an enhanced temporal candidate list based on the coordinate information of the initial matching coding unit; a second determination unit is provided for sequentially traversing each enhanced temporal candidate mode in the enhanced temporal candidate list and determining coordinate information of a target matching coding unit corresponding to each mode; and a second determination unit is provided for determining, based on the coordinate information of the target matching coding unit, motion information of a target matching coding unit including motion information of each sub-block in the target matching coding unit, and each sub-block in the target matching coding unit is determined. An encoding device is provided, the encoding device including: a third determination unit for determining, based on the motion information of a block, motion information of a sub-block at a corresponding position in the current encoding unit; a motion compensation unit for performing motion compensation on a corresponding sub-block in the current encoding unit based on the motion information of each sub-block in the current encoding unit; and an encoding unit for calculating a rate-distortion cost value corresponding to an enhanced temporal motion vector prediction mode, comparing the rate-distortion cost value with rate-distortion cost values of other prediction modes, selecting a prediction mode corresponding to the smallest rate-distortion cost value, writing corresponding enhanced temporal motion vector prediction mode flags and enhanced temporal motion vector prediction mode index values into a bitstream, and transmitting to a decoding device.
[0435] According to a fifth aspect of an embodiment of the present invention, there is provided a decoding device including a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being adapted to execute the machine-executable instructions to perform the decoding method of the first aspect.
[0436] According to a sixth aspect of an embodiment of the present invention, there is provided an encoding device including a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being adapted to execute the machine-executable instructions to implement the encoding method of the second aspect.
[0437] According to a seventh aspect of an embodiment of the present invention there is provided a machine-readable storage medium storing machine-executable instructions which, when executed by a processor, perform the method of the first or second aspect.
[0438] It should be noted that, in this specification, relational terms such as first and second, etc., are merely intended to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that any such actual relationship or order exists between those entities or operations. Also, the terms "comprise", "include", or any other variation thereof are intended to cover a non-exclusive inclusion, whereby a process, method, article, or device that includes a set of elements not only includes those elements, but also includes other elements not expressly recited, or includes elements inherent to such process, method, article, or device. In the absence of further limitations, an element qualified by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, article, or device that includes said element.
[0439] The above are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements, and improvements made within the spirit and principle of the present invention should be included within the protection scope of the present invention.
Claims
1. obtaining a value of an enhanced temporal motion vector prediction mode flag and an enhanced temporal motion vector prediction mode index value of a current coding unit; If the value of the enhanced temporal motion vector prediction mode flag is a first value, determining, according to the coordinate information of the current coding unit, coordinate information of an initial matching coding unit of the current coding unit; constructing an enhanced temporal candidate list based on coordinate information of the initial matching coding unit; obtaining a corresponding enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list according to the enhanced temporal motion vector prediction mode index value, and determining coordinate information of a target matching coding unit corresponding to the enhanced temporal motion vector prediction mode number; determining motion information of a target matching coding unit according to coordinate information of the target matching coding unit, the motion information including motion information of each sub-block in the target matching coding unit; and determining motion information of a sub-block at a corresponding position in the current coding unit according to the motion information of each sub-block in the target matching coding unit; and performing motion compensation for each sub-block in the current coding unit based on the motion information of the corresponding sub-block in the current coding unit.
2. The step of performing motion compensation on a corresponding sub-block in the current coding unit based on the motion information of each sub-block in the current coding unit includes: For any sub-block of the current coding unit, a decoding side motion vector adjustment technique is not performed on the motion information of the sub-block; If the sub-block satisfies a bidirectional optical flow condition, perform motion compensation on the sub-block according to the motion information of the sub-block, and add an optical flow offset value to the compensated pixel value by using a bidirectional optical flow technique to obtain a predicted sample matrix of the sub-block; otherwise, performing motion compensation on the sub-block according to the motion information of the sub-block to obtain a prediction sample matrix of the sub-block; 2. The method of claim 1, wherein the predictive samples of the current coding unit comprise predictive samples of each subblock.
3. The sub-block satisfies the bidirectional optical flow condition if at least The high-level syntax at the sequence level is allowed to enable bidirectional optical flow techniques; the motion vector precision of the current coding unit is equal to 0; and the sub-block uses bi-directional prediction; The method according to claim 2, characterized in that the display orders of a reference frame having a reference frame index value of refIdxL0 in reference image list 0 of the subblock and a reference frame having a reference frame index value of refIdxL1 in reference image list 1 of the subblock are located on either side of the current frame.
4. adding an optical flow offset value to the compensated pixel value using a bidirectional optical flow technique to obtain a predicted sample matrix of the sub-block; 3. The method of claim 2, further comprising determining a prediction sample matrix for a subblock based on a forward motion compensation value, a backward motion compensation value and an optical flow offset value for the subblock.
5. determining, according to the coordinate information of the current coding unit, coordinate information of an initial matching coding unit of the current coding unit; constructing an enhanced temporal candidate list based on coordinate information of the initial matching coding unit; traversing each enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list in order, and determining coordinate information of a target matching coding unit corresponding to each enhanced temporal motion vector prediction mode number; determining motion information of a target matching coding unit according to coordinate information of the target matching coding unit, the motion information including motion information of each sub-block in the target matching coding unit; and determining motion information of a sub-block at a corresponding position in the current coding unit according to the motion information of each sub-block in the target matching coding unit; performing motion compensation for each sub-block in the current coding unit based on the motion information of the corresponding sub-block in the current coding unit; calculating a rate-distortion cost value corresponding to the enhanced temporal motion vector prediction mode, comparing the rate-distortion cost value with rate-distortion cost values of other prediction modes, selecting the prediction mode corresponding to the smallest rate-distortion cost value, and writing a corresponding enhanced temporal motion vector prediction mode flag and an enhanced temporal motion vector prediction mode index value into a bitstream and transmitting to a decoding device; The step of performing motion compensation on a corresponding sub-block in the current coding unit based on the motion information of each sub-block in the current coding unit includes: For any sub-block of the current coding unit, a decoding side motion vector adjustment technique is not performed on the motion information of the sub-block; If the sub-block satisfies a bidirectional optical flow condition, perform motion compensation on the sub-block according to the motion information of the sub-block, and add an optical flow offset value to the compensated pixel value by using a bidirectional optical flow technique to obtain a predicted sample matrix of the sub-block; otherwise, performing motion compensation on the sub-block according to the motion information of the sub-block to obtain a prediction sample matrix of the sub-block; 2. The method of claim 1, wherein the predicted samples of the current coding unit comprise predicted samples of each sub-block.
6. The sub-block satisfies the bidirectional optical flow condition if at least The high-level syntax at the sequence level is allowed to enable bidirectional optical flow techniques; the motion vector precision of the current coding unit is equal to 0; and the sub-block uses bi-directional prediction; The method according to claim 5, characterized in that the display orders of a reference frame having a reference frame index value of refIdxL0 in reference image list 0 of the subblock and a reference frame having a reference frame index value of refIdxL1 in reference image list 1 of the subblock are located on either side of the current frame.
7. adding an optical flow offset value to the compensated pixel value using a bidirectional optical flow technique to obtain a predicted sample matrix of the sub-block; 6. The method of claim 5, further comprising determining a prediction sample matrix for a subblock based on a forward motion compensation value, a backward motion compensation value and an optical flow offset value for the subblock.
8. an obtaining unit for obtaining a value of an enhanced temporal motion vector prediction mode flag and an enhanced temporal motion vector prediction mode index value of a current coding unit; a first determining unit for determining, when the value of the enhanced temporal motion vector prediction mode flag is a first value, coordinate information of an initial matching coding unit of the current coding unit according to coordinate information of the current coding unit; a constructing unit for constructing an enhanced temporal candidate list according to the coordinate information of the initial matching coding unit; a second determining unit for obtaining a corresponding enhanced temporal motion vector prediction mode number in the enhanced temporal candidate list according to the enhanced temporal motion vector prediction mode index value, and determining coordinate information of a target matching coding unit corresponding to the enhanced temporal motion vector prediction mode number; a third determination unit for determining motion information of a target matching coding unit according to the coordinate information of the target matching coding unit, the motion information including the motion information of each sub-block in the target matching coding unit, and for determining the motion information of a sub-block at a corresponding position in the current coding unit according to the motion information of each sub-block in the target matching coding unit; a motion compensation unit for performing motion compensation on a corresponding sub-block in the current coding unit based on the motion information of each sub-block in the current coding unit.
9. A first determining unit for determining, according to the coordinate information of the current coding unit, coordinate information of an initial matching coding unit of the current coding unit; a constructing unit for constructing an enhanced temporal candidate list according to the coordinate information of the initial matching coding unit; a second determining unit for sequentially traversing each enhanced time candidate mode in the enhanced time candidate list and determining coordinate information of a target matching coding unit corresponding to each mode; a third determination unit for determining motion information of a target matching coding unit according to the coordinate information of the target matching coding unit, the motion information including the motion information of each sub-block in the target matching coding unit, and for determining the motion information of a sub-block at a corresponding position in the current coding unit according to the motion information of each sub-block in the target matching coding unit; a motion compensation unit for performing motion compensation on each sub-block in the current coding unit according to the motion information of the corresponding sub-block in the current coding unit; an encoding unit for calculating a rate-distortion cost value corresponding to an enhanced temporal motion vector prediction mode, comparing the rate-distortion cost value with rate-distortion cost values of other prediction modes, selecting a prediction mode corresponding to a minimum rate-distortion cost value, and writing a corresponding enhanced temporal motion vector prediction mode flag and an enhanced temporal motion vector prediction mode index value into a bitstream for transmission to a decoding device; The motion compensation unit specifically includes: For any sub-block of the current coding unit, a decoding side motion vector adjustment technique is not performed on the motion information of the sub-block; If the sub-block satisfies the bidirectional optical flow condition, perform motion compensation for the sub-block according to the motion information of the sub-block, and add an optical flow offset value to the compensated pixel value by using a bidirectional optical flow technique to obtain a predicted sample matrix of the sub-block; otherwise, the motion compensation is performed on the sub-block based on the motion information of the sub-block to obtain a prediction sample matrix of the sub-block; 2. An encoding device, comprising: a current encoding unit, the prediction samples of which comprise prediction samples of each sub-block;
10. 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 execute the machine-executable instructions to perform a method according to any one of claims 1 to 4.
11. A coding 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 execute the machine-executable instructions to perform a method according to any one of claims 5 to 7.
12. A machine-readable storage medium storing machine-executable instructions, comprising: A machine-readable storage medium, comprising machine-executable instructions which, when executed by a processor, perform the method of any one of claims 1 to 4.
13. A machine-readable storage medium storing machine-executable instructions, comprising: A machine-readable storage medium, characterized in that the machine-executable instructions, when executed by a processor, perform the method according to any one of claims 5 to 7.
Citation Information
Patent Citations
Improved TMVP derivation
WO2020003259A1
Inter-frame prediction method and device
WO2020232845A1