Decoding method, encoding method, apparatus, device and storage medium

JP7726554B2Active Publication Date: 2025-08-20HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
JP2024110195
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2021-06-30
Filing Date
2024-07-09
Publication Date
2025-08-20
Estimated Expiration
2042-06-06

AI Technical Summary

Technical Problem

Existing video coding technologies face inefficiencies in determining motion information index values for skip and direct modes, leading to redundant bit costs due to fixed maximum index values and variable candidate lists in video encoding and decoding processes.

Method used

A method and device that dynamically determine the maximum index value for skip and direct modes based on the number of motion information candidates for motion vector angle prediction and historical motion information candidates for inter prediction, optimizing the construction of candidate lists to reduce bit costs.

Benefits of technology

Improves encoding and decoding performance by reducing bit costs and enhancing flexibility in determining motion information index values, thereby optimizing video coding efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007726554000005
    Figure 0007726554000005
  • Figure 0007726554000006
    Figure 0007726554000006
  • Figure 0007726554000007
    Figure 0007726554000007
Patent Text Reader

Abstract

To provide a decoding method, a coding method, an apparatus, a device, and a storage medium.SOLUTION: The present invention provides a decoding method, a coding method, an apparatus, a device, and a machine-readable storage medium. In an example of the decoding method, for a received bitstream, by parsing a motion information index value of a skip mode or a direct mode of a current coding unit, a candidate list of the skip mode or the direct mode may be constructed, and a prediction mode of the current coding unit can be determined, thus, motion compensation can be performed on the current coding unit based on motion information of the current coding unit acquired based on the prediction mode of the current coding unit. Herein, the motion information index value of the skip mode or the direct mode of the current coding unit can be obtained by parsing based on the number of motion vector angle prediction motion information candidates and the number of inter-prediction historical motion information candidates.SELECTED DRAWING: Figure 8
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present invention relates to the field of video encoding and decoding, 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 usually includes operations such as prediction, transformation, quantization, entropy coding, and filtering. Prediction can be divided into intra prediction and inter prediction. Intra prediction predicts the current uncoded unit using surrounding coded units as reference, effectively removing redundancy in the spatial domain. Inter prediction predicts the current image using neighboring coded images, effectively removing redundancy in the temporal domain. Summary of the Invention

[0003] In view of this, the present invention provides a decoding method, an encoding method, an apparatus, a device and a machine-readable storage medium.

[0004] According to a first aspect of an embodiment of the present invention, there is provided a decoding method, comprising: receiving a bitstream and analyzing a skip mode or direct mode motion information index value of a current coding unit; constructing a skip mode or direct mode candidate list; determining a prediction mode of the current coding unit based on the skip mode or direct mode motion information index value of the current coding unit and the candidate list; obtaining motion information of the current coding unit based on the prediction mode of the current coding unit and performing motion compensation for the current coding unit, wherein the analyzing the skip mode or direct mode motion information index value of the current coding unit comprises obtaining a number of motion information candidates for motion vector angle prediction and a number of history motion information candidates for inter prediction; and determining a skip mode or direct mode motion information index value of the current coding unit based on the number of motion information candidates for motion vector angle prediction and the number of history motion information candidates for inter prediction.

[0005] According to a second aspect of the embodiment of the present invention, the method includes the steps of: constructing a candidate list of skip mode or direct mode; sequentially traversing each prediction mode in the candidate list of prediction modes; obtaining, for each prediction mode, motion information of a current coding unit and a skip mode or direct mode motion information index value of the current coding unit; performing motion compensation on the current coding unit based on the motion information of the current coding unit; calculating a rate-distortion cost value corresponding to the prediction mode; comparing the rate-distortion cost value with cost values of other candidate prediction modes; and selecting the prediction mode corresponding to the smallest rate-distortion cost value. and adding a skip mode or direct mode motion information index value of the current coding unit corresponding to the prediction mode with the smallest rate-distortion cost value to the bitstream, and transmitting the motion information index value to the decoding side, wherein the step of adding a skip mode or direct mode motion information index value of the current coding unit corresponding to the prediction mode with the smallest rate-distortion cost value to the bitstream includes the steps of obtaining the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction, and encoding the skip mode or direct mode motion information index value of the current coding unit based on the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction, and adding the motion information index value to the bitstream.

[0006] According to a third aspect of an embodiment of the present invention, there is provided a decoding device comprising: a decoding module for receiving a bitstream and analyzing a motion information index value of a skip mode or direct mode of a current coding unit; a construction module for constructing a candidate list for skip mode or direct mode; a determination module for determining a prediction mode of the current coding unit based on the motion information index value of the skip mode or direct mode of the current coding unit and the candidate list; and a compensation module for obtaining motion information of the current coding unit based on the prediction mode of the current coding unit and performing motion compensation on the current coding unit, wherein the decoding module is specifically used to obtain the number of motion information candidates for motion vector angle prediction and the number of history motion information candidates for the inter prediction, and to determine the motion information index value of the skip mode or direct mode of the current coding unit based on the number of motion information candidates for the motion vector angle prediction and the number of history motion information candidates for the inter prediction.

[0007] According to a fourth aspect of the embodiment of the present invention, there is provided a construction module for constructing a candidate list of skip mode or direct mode, sequentially traversing each prediction mode in the candidate list of prediction modes, and for each prediction mode, obtaining motion information of a current coding unit and a skip mode or direct mode motion information index value of the current coding unit; a compensation module for performing motion compensation on the current coding unit based on the motion information of the current coding unit; and a motion compensation module for calculating a rate-distortion cost value corresponding to the prediction mode, comparing the rate-distortion cost value with cost values of other candidate prediction modes, and selecting the prediction mode corresponding to the smallest rate-distortion cost value. and an encoding module for adding to a bitstream a motion information index value of skip mode or direct mode of the current coding unit corresponding to a prediction mode with the smallest rate-distortion cost value, and transmitting the motion information index value to a decoding side, wherein the encoding module is specifically used to obtain the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction, and to encode and add to the bitstream the motion information index value of skip mode or direct mode of the current coding unit based on the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction.

[0008] According to a fifth aspect of an embodiment of the present invention, there is provided a decoding device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being used to execute the machine-executable instructions to perform the decoding method provided by the first aspect.

[0009] According to a sixth aspect of an embodiment of the present invention, there is provided an encoding device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being adapted to execute the machine-executable instructions to implement the encoding method provided by the second aspect.

[0010] 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.

[0011] A decoding method of an embodiment of the present invention receives a bitstream, analyzes the skip mode or direct mode motion information index value of the current coding unit, constructs a skip mode or direct mode candidate list, determines a prediction mode of the current coding unit based on the skip mode or direct mode motion information index value of the current coding unit and the candidate list, obtains the motion information of the current coding unit based on the prediction mode of the current coding unit, performs motion compensation for the current coding unit, and when analyzing the skip mode or direct mode motion information index value of the current coding unit, obtains the number of motion information candidates for motion vector angle prediction and the number of history motion information candidates for inter prediction, and determines the skip mode or direct mode motion information index value of the current coding unit based on the number of motion information candidates for motion vector angle prediction and the number of history motion information candidates for inter prediction, thereby improving the flexibility of determining the skip mode or direct mode motion information index value of the current coding unit and improving encoding and decoding performance. [Brief explanation of the drawings]

[0012] [Figure 1a] 1 is a schematic diagram illustrating an encoding and decoding method according to an exemplary embodiment of the present invention; [Figure 1b] 1 is a schematic diagram illustrating an encoding and decoding method according to an exemplary embodiment of the present invention; [Figure 2] FIG. 1 is a schematic diagram illustrating block division in SBTMVP mode as shown in an exemplary embodiment of the present invention. [Figure 3] 1 is a schematic diagram illustrating the location of spatial domain neighboring blocks for Skip and Direct modes as shown in an exemplary embodiment of the present invention; [Figure 4] FIG. 2 is a schematic diagram illustrating the correspondence between mode indexes and modes of the MVAP mode shown in an exemplary embodiment of the present invention. [Figure 5] FIG. 4 is a schematic diagram illustrating the locations of motion vector angle prediction samples as shown in an exemplary embodiment of the present invention. [Figure 6] 1 is a flowchart illustrating the decoding of the HMVP method shown in an exemplary embodiment of the present invention. [Figure 7] 4 is a flowchart illustrating a decoding method according to an exemplary embodiment of the present invention. [Figure 8] 4 is a flowchart illustrating another decoding method according to an exemplary embodiment of the present invention. [Figure 9] 3 is a flowchart illustrating an encoding method according to an exemplary embodiment of the present invention. [Figure 10] 4 is a flowchart illustrating another encoding method according to an exemplary embodiment of the present invention. [Figure 11] 1 is a schematic diagram illustrating the structure of a decoding device according to an exemplary embodiment of the present invention; [Figure 12] 1 is a schematic diagram illustrating the structure of an encoding device according to an exemplary embodiment of the present invention; [Figure 13] 2 is a schematic diagram illustrating the hardware structure of a decoding device shown in an exemplary embodiment of the present invention; [Figure 14] 2 is a schematic diagram illustrating the hardware structure of an encoding device shown in an exemplary embodiment of the present invention; DETAILED DESCRIPTION OF THE INVENTION

[0013] Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the drawings. Where the following description refers to the drawings, the same numerals in different figures represent the same or similar elements unless otherwise noted. The implementations described in the following exemplary embodiments do not represent all implementations 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.

[0014] The terms used in the present invention are merely for the purpose of describing particular 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 dictates otherwise.

[0015] In order to help those skilled in the art better understand the technical solutions provided by the embodiments of the present invention, the following will first briefly describe some technical terms used in the embodiments of the present invention and the main processes of conventional video encoding and decoding.

[0016] In order to help those skilled in the art better understand the technical solutions provided by the embodiments of the present invention, the following first briefly describes some technical terms used in the embodiments of the present invention.

[0017] 1. Technical terms

[0018] 1. Inter Prediction: Inter prediction utilizes the temporal correlation of video. Since video sequences usually contain relatively strong temporal correlation, the temporal redundancy of video can be effectively removed by predicting the pixels of the current image using the pixels of adjacent coded images.

[0019] 2. Prediction signal: A pixel value derived from coded and decoded pixels. The residual is obtained from the difference between the original pixel and the predicted pixel, and then residual transformation and quantization and coefficient coding are performed.

[0020] For example, an inter-predicted pixel is a pixel value derived from a reference frame (reconstructed image) of a current block, and since the pixel positions are discrete, the final predicted pixel must be obtained through an interpolation operation. The closer the predicted pixel is to the original pixel, the smaller the residual energy obtained by subtracting the two, and the higher the encoding compression performance.

[0021] 3. Motion Vector (MV): In inter-coding, MV is used to represent the relative displacement between the current coding block and its best matching block in the reference image. Each divided block (also called a sub-block) has a corresponding motion vector that needs to be transmitted to the decoder. Encoding and transmitting the MV of each block independently consumes many bits, especially for sub-blocks divided into smaller sizes. To reduce the number of bits required for MV encoding, video coding utilizes the spatial correlation between neighboring blocks to predict the MV of the current block to be coded based on the MV of neighboring coded blocks, and then encodes the prediction difference. This effectively reduces the number of bits required to represent the MV. Based on this, when encoding the MV of a current image block, the MV of the current image block is generally predicted using the MV of neighboring coded blocks, and then the difference between the predicted MV (Motion Vector Prediction, or MVP) and the actual estimated value of the motion vector, i.e., the motion vector difference (MVD), is encoded, thereby effectively reducing the number of bits required for MV encoding.

[0022] 4. Motion Information: Since MV represents the relative displacement between the current image block and the best matching block in a specific reference image, in order to accurately obtain information for an image block, in addition to MV, it is necessary to indicate which reference image was used through reference image index information. For the current image, a reference image list is usually created based on a specific principle, and the reference image index information indicates which reference image in the reference image list was used by the current image block. Furthermore, since many coding technologies support multiple reference image lists, it is necessary to indicate which reference image list was used with a single index value, which can also be called the reference direction. In video coding, information related to motion, such as MV, reference frame index, and reference direction, is collectively called motion information.

[0023] 5. Skip mode: Skip mode is a skip mode in inter prediction. It does not need to send residual information or MVD, but only needs to send an index of motion information. The decoding side can derive the motion information of the coding unit by analyzing the index. After obtaining the motion information, the predicted value can be used as the reconstructed value.

[0024] 6. Direct mode: Direct mode is a direct mode for inter-prediction. It requires transmitting residual information, but does not require transmitting MVD. It only requires transmitting an index of motion information. The decoding side can derive the motion information of the coding unit by analyzing the index. After obtaining the motion information, the residual value is added to the predicted value to obtain the reconstructed value.

[0025] 7. Truncated Unary Binarization and De-Binarization Method: The relationship between synElVal and binary strings may be as shown in Table 1. [Table 1]

[0026] The encoding side may obtain a binary string that needs to be encoded according to Table 1 from maxVal and the value synElVal that needs to be encoded, and the decoding side may uniquely obtain the value of synElVal according to Table 1 from the binary string and maxVal.

[0027] 8. Rate-Distortion Optimization (RDO) Principle: The indexes used to evaluate coding efficiency include bit rate and Peak Signal to Noise Ratio (PSNR). The smaller the bit stream, the higher the compression rate, and the higher the PSNR, the better the quality of the reconstructed image. When selecting a mode, the discriminant is essentially a comprehensive evaluation of both.

[0028] The cost corresponding to a mode is: J(mode) = D + λ * R, where D represents distortion, which is generally evaluated using the SSE (Sum of the Squared Errors) index, where SSE refers to the sum of squared residuals between the reconstructed block and the source image, λ is the Lagrange multiplier, and R is the actual number of bits required to encode an image block in that mode, including the sum of bits required for coding mode information, motion information, residuals, etc.

[0029] When selecting a mode, using the RDO principle to compare coding modes generally ensures optimal coding performance.

[0030] Second, the main processes of video encoding and decoding are briefly explained below.

[0031] Referring to (a) of Figure 1, taking video coding as an example, video coding generally includes processes such as prediction, transformation, quantization, entropy coding, etc., and the coding process may be realized in the framework of (b) of Figure 1.

[0032] Here, prediction can be divided into intra prediction and inter prediction. Intra prediction predicts a current uncoded block using surrounding coded blocks as references, effectively eliminating redundancy in the spatial domain. Inter prediction predicts a current image using adjacent coded images, effectively eliminating redundancy in the temporal domain.

[0033] Transformation is the process of converting an image from the spatial domain to the transform domain and representing the image using transform coefficients. Many images have many flat and slowly changing areas, and by applying an appropriate transform, an image can be transformed from a scattered distribution in the spatial domain to a relatively concentrated distribution in the transform domain, eliminating frequency-domain correlations between signals and effectively compressing the bitstream in conjunction with quantization.

[0034] Entropy coding is a lossless coding method that converts a series of element symbols into a binary bitstream for transmission or storage. The input symbols may include quantized transform coefficients, motion vector information, prediction mode information, syntax for transform and quantization, etc. Entropy coding can effectively remove redundancy in video element symbols.

[0035] Although the above has been introduced using encoding as an example, the process of video decoding is the opposite of the process of video encoding. That is, video decoding usually includes the processes of entropy decoding, prediction, inverse quantization, inverse transform, and filtering, and the realization principles of each process are the same as or similar to those of video encoding.

[0036] 3. Below, we will briefly explain the implementation of Temporal Motion Vector Prediction (TMVP) mode / Sub-Block Temporal Motion Vector Prediction (SBTMVP), MHBSKIP, Motion Vector Angle Prediction (MVAP), History-based Motion Vector Prediction (HMVP), and Enhanced Temporal Motion Vector Prediction (ETMVP) technologies.

[0037] 3.1. TMVP / SBTMVP

[0038] In AVS3, the TMVP and SBTMVP technologies are currently adopted in the standard. If both the width and height of the current block are 16 or more, the temporal motion information of the current block is the motion information generated by SBTMVP; otherwise, the temporal motion information of the current block is the motion information generated by TMVP.

[0039] TMVP: First, find the motion information of the same position as the preset position of the current coding unit in the temporal reference frame, and scale it to be the temporal motion information of the current block, where for P picture, the temporal reference frame is the first frame in list0, and for B picture, the temporal reference frame is the first frame in list1.

[0040] SBTMVP: The size of the current block is 2Mx2N, and the schematic diagram may be as shown in Figure 2. First, find a region in the time-domain reference frame that is located at the same position as the current coding unit. Then, divide the region into four sub-blocks, each with a size of MxN. Obtain the motion information of each sub-block at the corresponding position in the time-domain reference frame, and scale it to become the motion information of the sub-block at the corresponding position of the current block. Finally, motion compensate the motion information of each sub-block to obtain a prediction value.

[0041] 3.2, MHBSKIP

[0042] MHBSKIP is a prediction mode in Skip and Direct modes in AVS, and predicts the motion information of the current coding unit using the motion information of the spatial domain neighboring blocks of the current coding unit.

[0043] The MHBSKIP mode constructs three types of motion information, namely, bidirectional, forward, and backward, through the spatial domain neighboring blocks of the current coding unit to predict the current coding unit.

[0044] Exemplarily, the positions of spatial domain neighboring blocks for Skip and Direct modes may be as shown in FIG.

[0045] 3.3. MVAP

[0046] AVS3 currently uses MVAP technology, which divides the current coding unit into sub-blocks and copies motion information from neighboring spatial domain blocks at a preset angle for each sub-block using up to five prediction angles. This allows more motion information to be stored within the current coding unit without dividing the coding unit, improving coding performance.

[0047] For example, the correspondence between mode indexes and modes in the MVAP technique may be seen in Table 2 and FIG. 4, respectively. [Table 2]

[0048] The specific steps are as follows:

[0049] 3.3.1. Derive the number of valid motion vector angle prediction modes (ValidMvapModeNum).

[0050] Let W and H be the width and height of the current decoding unit, W / 4 and H / 4 be the values of m and n, respectively, and (x, y) be the pixel coordinates of the upper-left corner of the current decoding unit. A0, A1, ..., Am-1 are the 4x4 blocks at the bottom-left corner of the current block, Am, Am+1, ..., Am+n-1 are the 4x4 blocks at the left of the current block, Am+n is the 4x4 block at the top-left corner of the current block, Am+n+1, Am+n+2, ..., A2m+n are the 4x4 blocks at the top of the current block, and A2m+n+1, A2m+n+1, ..., A2m+2n are the 4x4 blocks at the top-right corner of the current block.

[0051] Exemplarily, a schematic diagram of the locations of the motion vector angle prediction samples may be as shown in FIG.

[0052] For example, when the value range of i is 0 to m+n, the coordinates of Ai are (x-1, y+H+W-4×i-1), and when the value range of i is m+n+1 to 2m+2n, the coordinates of Ai are (x+4×iWH-1, y-1).

[0053] Derive ValidMvapModeNum and ValidMvapModeFlag[s] (s=0 to 4) according to the following procedure.

[0054] 3.3.1.1, Initialize ValidMvapModeNum to 0 and ValidMvapModeFlag[s] to 0 (s = 0 to 4).

[0055] 3.3.1.2. If any of the following conditions are met, ValidMvapModeNum is equal to 0 and ValidMvapModeFlag[s] is equal to 0 (s=0~4).

[0056] 3.3.1.2.1, the value of EtmvpMvapEnableFlag is 0.

[0057] 3.3.1.2.2, W is less than 8, or H is less than 8, or W and H are both equal to 8.

[0058] 3.3.1.3. Otherwise, update the values of ValidMvapModeNum and ValidMvapModeFlag[s] according to the following procedure:

[0059] 3.3.1.3.1 If the Am-1+H / 8 block and the Am+n-1 block both use inter prediction mode and have different motion information, ValidMvapModeFlag[0] is equal to 1 and 1 is added to the value of ValidMvapModeNum.

[0060] 3.3.1.3.2 If the Am+n+1+W / 8 block and the Am+n+1 block both use inter prediction mode and have different motion information, ValidMvapModeFlag[1] is equal to 1 and 1 is added to the value of ValidMvapModeNum.

[0061] 3.3.1.3.3. If the Am+n-1 block and the Am+n block both use inter prediction mode and have different motion information, or if the Am+n block and the Am+n+1 block both use inter prediction mode and have different motion information, ValidMvapModeFlag[2] is equal to 1 and 1 is added to the value of ValidMvapModeNum.

[0062] 3.3.1.3.4. If the AW / 8-1 block and the Am-1 block both use inter prediction mode and have different motion information, or if the Am-1 block and the Am-1+H / 8 block both use inter prediction mode and have different motion information, ValidMvapModeFlag[3] is equal to 1 and the value of ValidMvapModeNum is incremented by 1.

[0063] 3.3.1.3.5. If the Am+n+1+W / 8 block and the A2m+n+1 block both use inter prediction mode and have different motion information, or if the A2m+n+1 block and the A2m+n+1+H / 8 block both use inter prediction mode and have different motion information, ValidMvapModeFlag[4] is equal to 1 and 1 is added to the value of ValidMvapModeNum.

[0064] 3.3.2. Fill the reference motion information list neighborMotions[i] (i=0~2m+2n).

[0065] neighborMotions[i] is the i-th motion information (interPredRefMode, mvE0, mvE1, refIndexL0, refIndexL1) in the reference motion information list, and the value of i ranges from 0 to 2m+2n.

[0066] If the motion information of the spatial domain storage unit at the Ai position is "usable", the motion information of the spatial domain storage unit at the Ai position is recorded as motionInfoAi (i=0 to 2m+2n).

[0067] 3.3.2.1, fill neighborMotions[0].

[0068] 3.3.2.1.1, if the motion information of the spatial domain storage unit at position A0 is "unavailable", set the prediction reference mode interPredRefMode of neighborMotions[0] to "PRED_List0", set mvE0 of neighborMotions[0] to a zero vector, and set refIndexL0 of neighborMotions[0] to 0.

[0069] 3.3.2.1.2, otherwise set neighborMotions[0] to motionInfoA0.

[0070] 3.3.2.2. Traverse Ai from smallest to largest and fill neighborMotions[i] according to the following procedure.

[0071] 3.3.2.2.1, if the motion information of the spatial domain storage unit at position Ai is "available", neighborMotions[i] is motionInfoAi.

[0072] 3.3.2.2.2, otherwise neighborMotions[i] equals neighborMotions[i-1].

[0073] 3.3.3. Derive the motion information array MotionArray.

[0074] Based on curMvapMode and neighborMotions, determine the motion information array MotionArray[i][j](interPredRefMode, MvE0, MvE1, fIndexL0, RefIndexL1) of the sub-blocks in the current coding unit, where i = 0 to (W>>3)-1, j = 0 to (H>>3)-1, (i, j) is the index of the 8x8 sub-block in the current coding unit, i is the horizontal index value of the sub-block, and j is the vertical index value of the sub-block. Traverse each sub-block to derive the sub-block motion information array MotionArray for motion vector angle prediction, and set BgcFlag and BgcIndex to zero. [Table 3]

[0075] 3.4, HMVP

[0076] The motion vector prediction method based on history information is a technology adopted in the next-generation video coding standard AVS3. Its principle is to predict the motion information of the current coding unit using the motion information of previous coding blocks. By creating an HMVP table, the motion information of previous coding units is stored, and when a block is decoded, the HMVP table is updated. Therefore, for the current coding unit, usable motion information is always available in the HMVP table, improving prediction accuracy.

[0077] Illustratively, the decoding flow chart of the HMVP method may be as shown in FIG.

[0078] 3.5, ETMVP

[0079] AVS3 currently uses the ETMVP technology, which first finds the region in the temporal reference frame that is the same location as the current coding unit. Then, the scaling value of the motion vector in the temporal motion information storage unit where each 8x8 block in that region is located is used as the first candidate. Next, the region is offset by eight luminance samples to the left, right, top, or bottom to create subsequent candidates. After obtaining each candidate, the candidate is checked for duplication and then added to a motion vector candidate list. For P pictures, the temporal reference frame is the first frame in list0, and for B pictures, the temporal reference frame is the first frame in list1. Finally, for each candidate in the list, the motion information of the 8x8 sub-block is obtained, and motion compensation is performed to obtain a prediction value.

[0080] In the related art, the list construction order for skip / direct mode is time domain + MHBSKIP + MVAP + HMVP, that is, the candidate list for skip / direct mode is constructed in the order of time domain, MHBSKIP, MVAP, and HMVP.

[0081] If the current picture is a P picture, the time domain generates one motion information candidate, MHBSKIP generates one motion information candidate, MVAP and HMVP generate a total of eight motion information candidates, and the list length is 1+1+8=10.

[0082] If the current picture is a B picture, the temporal domain generates one motion information candidate, MHBSKIP generates three motion information candidates, and MVAP and HMVP generate a total of eight motion information candidates, and the list length is 1+3+8=12.

[0083] Here, MVAP and HMVP generate a total of eight motion information candidates, for example, MVAP generates ValidMvapModeNum motion information candidates, HMVP generates the remaining 8-ValidMvapModeNum motion information candidates, and the value range of ValidMvapModeNum is 0 to 5.

[0084] To represent each different motion information candidate, the motion information index value cu_subtype_index must be marked for skip or direct mode of the current coding unit. Currently, the value range of cu_subtype_index is 0 to 11, and binarization is performed using truncated unary encoding, with maxVal equal to 11.

[0085] However, in reality, P pictures and B pictures generate candidate lists of different lengths, and the maximum number of motion information candidates allowed to be generated by HMVP and MVAP is not fixed, so the value range of cu_subtype_index is also not fixed, and using a fixed maxVal of 11 to encode cu_subtype_index would result in redundant bit costs.

[0086] In order to improve the flexibility of determining index values and reduce coding redundancy, thereby improving encoding and decoding performance, the optimization solution of an embodiment of the present invention may include some or all of the following:

[0087] First, the high-level syntax is obtained, the number of motion information candidates for motion vector angle prediction (NumOfMvapCand) and the number of historical motion information candidates for inter prediction (NumOfHmvpCand) are obtained, and the image type of the current image is obtained.

[0088] Next, analyze the skip mode or direct mode motion information index value cu_subtype_index of the current coding unit based on the picture type of the current picture, NumOfMvapCand and NumOfHmvpCand.

[0089] Finally, obtain ValidMvapModeNum, and determine whether the type of the current coding unit is MVAP mode or HMVP mode based on cu_subtype_index and ValidMvapModeNum.

[0090] In order to make the above objectives, features and advantages of the embodiments of the present invention more clear and understandable, the following further describes the technical solutions in the embodiments of the present invention in detail in conjunction with the accompanying drawings.

[0091] FIG. 7 is a flowchart of a decoding method provided by an embodiment of the present invention, where the decoding method can be applied to a decoding device, and as shown in FIG. 7, the decoding method may include the following steps:

[0092] Step S700: receiving a bitstream and analyzing the motion information index value of the skip mode or direct mode of the current coding unit;

[0093] Step S710: Build a candidate list for skip mode or direct mode.

[0094] In step S720, a prediction mode of the current coding unit is determined based on the motion information index value of the skip mode or direct mode of the current coding unit and the candidate list.

[0095] In step S730, obtain motion information of the current coding unit according to the prediction mode of the current coding unit, and perform motion compensation for the current coding unit.

[0096] As shown in FIG. 8, in step S700, analyzing the motion information index value of the skip mode or direct mode of the current coding unit may be realized by the following steps:

[0097] In step S701, the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction are obtained.

[0098] Step S702: determining a motion information index value of the current coding unit in skip mode or direct mode according to the number of motion information candidates for motion vector angle prediction and the number of history motion information candidates for inter prediction.

[0099] In an embodiment of the present invention, since it is considered that the maximum number of motion information candidates allowed to be generated by HMVP and MVAP is not fixed, and the value range of motion information index values for skip mode or direct mode is also not fixed, in order to improve the flexibility of determining the motion information index value for skip mode or direct mode, the maximum index value (i.e., maxVal) is not fixed to 11, but may be determined based on the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction.

[0100] Illustratively, when a decoding device receives a bitstream, it may obtain the number of motion information candidates for motion vector angle prediction (ie, NumOfMvapCand) and the number of history motion information candidates for inter prediction (ie, NumOfHmvpCand).

[0101] In some embodiments, the number of motion information candidates for motion vector angle prediction and the number of history motion information candidates for inter prediction are obtained by parsing the high-level syntax at the sequence level.

[0102] When the decoding device obtains the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction, it may determine a motion information index value for skip mode or direct mode of the current coding unit based on the obtained number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction.

[0103] In one example, the step of obtaining the number of motion information candidates for the motion vector angle prediction and the number of historical motion information candidates for the inter-prediction by analyzing the above sequence-level high-level syntax may include the steps of analyzing enable flags for enhanced temporal motion vector prediction and motion vector angle prediction and determining the number of motion information candidates for motion vector angle prediction based on the values of the enable flags for enhanced temporal motion vector prediction and motion vector angle prediction, and analyzing an index of the number of historical motion information candidates for inter-prediction and determining the number of historical motion information candidates for inter-prediction based on the value of the index of the number of historical motion information candidates for the inter-prediction.

[0104] For example, the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction may be determined using the enable flag (etmvp_mvap_enable_flag) for enhanced temporal motion vector prediction and motion vector angle prediction and an index for the number of historical motion information candidates for inter prediction, respectively, through high-level syntax at the sequence level.

[0105] Illustratively, the enhanced temporal motion vector prediction and motion vector angle prediction enable flags are used to indicate that the enhanced temporal motion vector prediction mode and the motion vector angle prediction mode are turned on simultaneously, or that the enhanced temporal motion vector prediction mode and the motion vector angle prediction mode are turned off simultaneously.

[0106] Illustratively, the value range of etmvp_mvap_enable_flag is 0 to 1, and the value range of num_of_hmvp_cand is 0 to 8.

[0107] Illustratively, each decoding device may determine NumOfMvapCand by analyzing the value of etmvp_mvap_enable_flag and determine NumOfHmvpCand by analyzing the value of num_of_hmvp_cand.

[0108] For example, the decoding device may determine NumOfMvapCand according to the following scheme based on the value of etmvp_mvap_enable_flag: The value of NumOfMvapCand is etmvp_mvap_enable_flag==1?5:0.

[0109] Here, if the value of etmvp_mvap_enable_flag is 1, the value of NumOfMvapCand is 5, and if the value of etmvp_mvap_enable_flag is not 1, the value of NumOfMvapCand is 0.

[0110] That is, if the value of the enable flag for enhanced temporal motion vector prediction and motion vector angle prediction is 1, it is determined that the number of motion information candidates for the motion vector angle prediction is 5, where the value of the enable flag for enhanced temporal motion vector prediction and motion vector angle prediction is 1 indicates that the current encoding unit can use enhanced temporal motion vector prediction and motion vector angle prediction, i.e., the current encoding unit simultaneously enables enhanced temporal motion vector prediction and motion vector angle prediction.

[0111] If the value of the enable flag for enhanced temporal motion vector prediction and motion vector angle prediction is 0, it is determined that the number of motion information candidates for motion vector angle prediction is 0, where the value of the enable flag for enhanced temporal motion vector prediction and motion vector angle prediction is 0, or the enable flag for enhanced temporal motion vector prediction and motion vector angle prediction does not exist in the bitstream, it indicates that enhanced temporal motion vector prediction and motion vector angle prediction should not be used for the current encoding unit, i.e., the current encoding unit does not enable enhanced temporal motion vector prediction and motion vector angle prediction simultaneously.

[0112] Illustratively, the decoding device may use the value of num_of_hmvp_cand as NumOfHmvpCand.

[0113] In one example, the step of determining a motion information index value for skip mode or direct mode of the current coding unit based on the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction may include the steps of determining a maximum index value based on the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction, and analyzing the motion information index value for skip mode or direct mode of the current coding unit using a truncated unary de-binarization method based on the maximum index value.

[0114] For example, if NumOfMvapCand and NumOfHmvpCand are determined in the above manner, the decoding device may determine a maximum index value (i.e., maxVal) based on the determined NumOfMvapCand and NumOfHmvpCand, and analyze a motion information index value for skip mode or direct mode of the current coding unit using the truncated unary debinarization method based on the determined maxVal. For example, maxVal determined based on the determined NumOfMvapCand and NumOfHmvpCand is less than or equal to 11.

[0115] As an example, determining the maximum index value based on the number of motion information candidates for motion vector angle prediction and the number of history motion information candidates for inter prediction may include determining the maximum value among the number of motion information candidates for motion vector angle prediction and the number of history motion information candidates for inter prediction, and determining the maximum index value as the sum of the maximum value and 3. Illustratively, considering that the maximum number of temporal motion information candidates and MHBSKIP motion information candidates is 4 and the value of maxVal is the length of the list minus 1, maxVal may be determined based on the sum of the maximum value among NumOfMvapCand and NumOfHmvpCand and 3.

[0116] Illustratively, the decoding device may determine maxVal according to the following scheme: maxVal=(3+Max(NumOfMvapCand,NumOfHmvpCand))

[0117] Here, since Max(NumOfMvapCand, NumOfHmvpCand)≦8, maxVal determined according to the above method≦11. When encoding a skip mode or direct mode motion information index value using the truncated unary binarization method based on maxVal, the number of bits required is less than or equal to the number of bits required when maxVal=11. Therefore, by using the method provided by an embodiment of the present invention, the number of bits required to encode a skip mode or direct mode motion information index can be reduced with a high probability, thereby reducing encoding and decoding costs and improving encoding and decoding performance.

[0118] In some embodiments, in step S702, determining a motion information index value for skip mode or direct mode of the current coding unit based on the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction may include determining a motion information index value for skip mode or direct mode of the current coding unit based on the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction, and the image type of the current image.

[0119] Illustratively, the number of MHBSKIP motion information candidates corresponding to different picture types may be different, for example, for a P picture, the number of MHBSKIP motion information candidates is 1, and for a B picture, the number of MHBSKIP motion information candidates is 3. Therefore, in order to improve the flexibility of determining the motion information index value for skip mode or direct mode, the picture type may be taken into consideration when determining the motion information index value for skip mode or direct mode, that is, the decoding device may determine the motion information index value for skip mode or direct mode of the current coding unit based on the number of motion information candidates for motion vector angle prediction, the number of history motion information candidates for inter prediction, and the picture type of the current picture.

[0120] In one example, the step of determining a motion information index value for skip mode or direct mode of the current coding unit based on the number of motion information candidates for motion vector angle prediction, the number of historical motion information candidates for inter prediction, and the image type of the current image may include a step of determining a maximum index value based on the number of motion information candidates for motion vector angle prediction, the number of historical motion information candidates for inter prediction, and the image type of the current image, and a step of analyzing the motion information index value for skip mode or direct mode of the current coding unit using a truncated unary de-binarization method based on the maximum index value.

[0121] Illustratively, the decoding device may obtain the picture type of the video picture to which the current coding unit belongs (referred to as the current picture in the present invention), in addition to obtaining NumOfMvapCand and NumOfHmvpCand in the manner described in the above embodiment. Illustratively, the picture type may include, but is not limited to, a B picture or a P picture.

[0122] Illustratively, the decoding device may determine the maximum index value based on the number of motion information candidates for motion vector angle prediction, the number of historical motion information candidates for inter prediction, and the image type of the current image.

[0123] As an example, the step of determining the maximum index value based on the number of motion information candidates for motion vector angle prediction, the number of historical motion information candidates for inter prediction, and the image type of the current image may include the steps of determining the maximum value among the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction, determining the sum of the maximum value and 1 as the maximum index value if the image type of the current image is a P picture, and determining the sum of the maximum value and 3 as the maximum index value if the image type of the current image is a B picture.

[0124] For example, consider that the number of MHBSKIP motion information candidates for a P picture is 1, and the number of MHBSKIP motion information candidates for a B picture is 3. Therefore, if the picture type of the current picture is a P picture, maxVal may be determined as the sum of the maximum value of NumOfMvapCand and NumOfHmvpCand and 1. If the picture type of the current picture is a B picture, maxVal may be determined as the sum of the maximum value of NumOfMvapCand and NumOfHmvpCand and 3.

[0125] When the picture type is a P picture, the value of the number of MHBSKIP motion information candidates is 1, and the determined maxVal is lower than the implementation method in which the number of MHBSKIP motion information candidates is directly set to 3 without considering the picture type. Therefore, it is possible to save bit costs when encoding the motion information index value in skip mode or direct mode using the truncated unary binarization method, and improve the encoding and decoding performance.

[0126] For example, if the decoding device determines maxVal in the above manner, it may analyze the motion information index value of the current coding unit in skip mode or direct mode using a truncated unary debinarization method based on the determined maxVal. For example, the correspondence between maxVal and the motion information index value of the current coding unit in skip mode or direct mode may refer to the related information listed in Table 1.

[0127] In some embodiments, in step S720, determining the prediction mode of the current coding unit based on the motion information index value of the skip mode or direct mode of the current coding unit and the candidate list may include determining the prediction mode of the current coding unit based on the number of valid angle prediction modes and the motion information index value of the skip mode or direct mode.

[0128] For example, when the decoding device determines the motion information index value of the skip mode or direct mode of the current coding unit in the above manner, the prediction mode of the current coding unit may be determined based on the number of valid angle prediction modes (ValidMvapModeNum) and the motion information index value of the skip mode or direct mode.

[0129] In one example, the step of determining the prediction mode of the current coding unit based on the number of valid angular prediction modes and the motion information index value of the skip mode or direct mode may include the steps of: determining that the prediction mode of the current coding unit is a motion vector angular prediction mode when the motion information index value of the skip mode or direct mode is greater than or equal to N, the number of valid angular prediction modes is greater than 0, and the motion information index value of the skip mode or direct mode is less than the sum of N and the number of valid angular prediction modes, and determining that the prediction mode of the current coding unit is a motion vector prediction mode based on historical information when the number of valid angular prediction modes is equal to 0 or the motion information index value of the skip mode or direct mode is greater than or equal to the sum of N and the number of valid angular prediction modes.

[0130] Illustratively, when the decoding device determines the motion information index value of the skip mode or the direct mode in the above manner, it may determine whether the motion information index value of the skip mode or the direct mode is greater than N. Illustratively, N is a positive integer.

[0131] Exemplarily, N may be the sum of the temporal motion information candidates in the candidate list and the motion information candidates generated by MHBSKIP. Exemplarily, the value of N may be determined based on the image type of the current image.

[0132] As an example, if the picture type of the current picture is a P picture, N=2, and if the picture type of the current picture is a B picture, N=4.

[0133] Illustratively, if the decoding device determines that the motion information index value of the skip mode or direct mode is greater than or equal to N, the decoding device may further determine whether ValidMvapModeNum is greater than 0 and whether the motion information index value of the skip mode or direct mode is less than the sum of N and ValidMvapModeNum.

[0134] When ValidMvapModeNum is greater than 0 and the motion information index value of skip mode or direct mode is less than the sum of N and ValidMvapModeNum, i.e., when the motion vector angle prediction mode generates a motion information candidate and the motion information candidate corresponding to the motion information index value of skip mode or direct mode points to the motion information candidate generated by the motion vector angle prediction mode, the decoding device may determine that the prediction mode of the current encoding unit is motion vector angle prediction mode.

[0135] When ValidMvapModeNum is equal to 0, or when the motion information index value of skip mode or direct mode is greater than or equal to the sum of N and the number of valid angle prediction modes, i.e., when the motion vector angle prediction mode does not generate a motion information candidate, or when the motion information candidate corresponding to the motion information index value of skip mode or direct mode points to a motion information candidate generated by a motion vector prediction mode based on historical information, the decoding device may determine that the prediction mode of the current coding unit is a motion vector prediction mode based on historical information.

[0136] In some embodiments, after determining the prediction mode of the current coding unit as described above, when the prediction mode of the current coding unit is a motion vector prediction mode based on historical information, if the current coding unit is an inter prediction unit, and is not an affine prediction unit, and is not an angle weighted prediction unit, and is not an enhanced temporal motion vector prediction unit, and is not a motion vector angle prediction unit, and is not a sub-block temporal motion information prediction unit, and the number of historical motion information candidates for inter prediction is greater than 0, the method may further include a step of updating the historical motion information list, and not updating the historical motion information list otherwise.

[0137] Illustratively, when the decoding device determines in the manner described in the above embodiment that the prediction mode of the current coding unit is a motion vector prediction mode based on history information, the decoding device may determine whether the current coding unit satisfies the following conditions: the current coding unit is an inter prediction unit; the current coding unit is not an affine prediction unit; the current coding unit is not an angle weighted prediction unit; the current coding unit is not an enhanced temporal motion vector prediction unit; the current coding unit is not a motion vector angle prediction unit; the current coding unit is not a sub-block temporal motion information prediction unit; and the number of history motion information candidates for inter prediction (i.e., NumOfHmvpCand) is greater than 0.

[0138] If the decoding device determines that the current coding unit satisfies all of the above conditions, the decoding device may update the history motion information list (HmvpCandList). Exemplarily, the decoding device may update the history motion information list based on the motion information, BgcFlag, and BgcIndex of the current prediction block.

[0139] If the decoding device determines that the current coding unit does not satisfy at least one of the above conditions, the decoding device may not update the historical motion information list.

[0140] In some embodiments, the step of determining the number of motion information candidates for motion vector angle prediction based on the value of the enable flag for enhanced temporal motion vector prediction and motion vector angle prediction may include the steps of: determining that the number of motion information candidates for motion vector angle prediction is 5 if the value of the enable flag for enhanced temporal motion vector prediction and motion vector angle prediction is 1, wherein the value of the enable flag for enhanced temporal motion vector prediction and motion vector angle prediction is 1 indicates that enhanced temporal motion vector prediction and motion vector angle prediction can be used; and determining that the number of motion information candidates for motion vector angle prediction is 0 if the value of the enable flag for enhanced temporal motion vector prediction and motion vector angle prediction is 0 or if the enable flag for enhanced temporal motion vector prediction and motion vector angle prediction is not present in the bitstream, wherein the value of the enable flag for enhanced temporal motion vector prediction and motion vector angle prediction is 0 or if the enable flag for enhanced temporal motion vector prediction and motion vector angle prediction is not present in the bitstream indicates that enhanced temporal motion vector prediction and motion vector angle prediction should not be used.

[0141] For example, the enhanced temporal motion vector prediction and motion vector angle prediction enable flag may indicate whether the enhanced temporal motion vector prediction and motion vector angle prediction can be used.

[0142] For example, a value of 1 for the permission flag for enhanced temporal motion vector prediction and motion vector angle prediction indicates that enhanced temporal motion vector prediction and motion vector angle prediction can be used, and a value of 0 for the permission flag for enhanced temporal motion vector prediction and motion vector angle prediction indicates that enhanced temporal motion vector prediction and motion vector angle prediction should not be used.

[0143] Illustratively, when a decoding device receives a bitstream, it may analyze the values of the enable flags for enhanced temporal motion vector prediction and motion vector angle prediction.

[0144] If the value of the enhanced temporal motion vector prediction and motion vector angle prediction enable flag is 1, i.e., if enhanced temporal motion vector prediction and motion vector angle prediction can be used, the decoding device may determine that NumOfMvapCand is 5.

[0145] If the value of the enhanced temporal motion vector prediction and motion vector angle prediction enable flag is 0, i.e., if enhanced temporal motion vector prediction and motion vector angle prediction cannot be used, the decoding device may determine that NumOfMvapCand is 0.

[0146] For example, if the decoding device is unable to parse the enable flag for enhanced temporal motion vector prediction and motion vector angle prediction from the bitstream, it may determine that the value of the enable flag for enhanced temporal motion vector prediction and motion vector angle prediction is 0, i.e., enhanced temporal motion vector prediction and motion vector angle prediction cannot be used, in which case the decoding device may determine that NumOfMvapCand is 0.

[0147] FIG. 9 is a flowchart of an encoding method provided by an embodiment of the present invention, where the encoding method can be applied to an encoding device, and as shown in FIG. 9, the encoding method may include the following steps:

[0148] Step S900: construct a candidate list for skip mode or direct mode, traverse each prediction mode in the candidate list of prediction modes in order, and for each prediction mode, obtain the motion information of the current coding unit and the motion information index value of the skip mode or direct mode of the current coding unit.

[0149] Step S910: perform motion compensation for the current coding unit according to the motion information of the current coding unit.

[0150] In step S920, a rate-distortion cost value corresponding to the prediction mode is calculated, and the rate-distortion cost value is compared with the cost values of other prediction mode candidates, and the prediction mode corresponding to the smallest rate-distortion cost value is selected.

[0151] In step S930, the motion information index value of the skip mode or direct mode of the current coding unit corresponding to the prediction mode with the smallest rate-distortion cost value is added to the bitstream and transmitted to the decoding side.

[0152] As shown in FIG. 10, in step S930, the step of adding the motion information index value of the skip mode or direct mode of the current coding unit corresponding to the prediction mode with the smallest rate-distortion cost value to the bitstream can be realized by the following steps.

[0153] In step S931, the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction are obtained.

[0154] In step S932, based on the number of motion information candidates for motion vector angle prediction and the number of history motion information candidates for inter prediction, the motion information index value for skip mode or direct mode of the current coding unit is coded and added to the bitstream.

[0155] In an embodiment of the present invention, since it is considered that the maximum number of motion information candidates allowed to be generated by HMVP and MVAP is not fixed, and the value range of motion information index values for skip mode or direct mode is also not fixed, in order to improve the flexibility of determining the motion information index value for skip mode or direct mode, the maximum index value (i.e., maxVal) is not fixed to 11, but may be determined based on the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction.

[0156] Illustratively, when the encoding device needs to encode a motion information index value, it may obtain NumOfMvapCand and NumOfHmvpCand. Illustratively, the encoding device may determine NumOfMvapCand and NumOfHmvpCand by encoding a high-level syntax at the sequence level.

[0157] In an embodiment of the present invention, the coding device may encode and add to the bitstream a skip mode or direct mode motion information index value of the current coding unit based on NumOfMvapCand and NumOfHmvpCand.

[0158] In some embodiments, in step S932, the step of encoding a skip mode or direct mode motion information index value of the current coding unit based on the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction may include the steps of determining a maximum index value based on the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction, and encoding a skip mode or direct mode motion information index value of the current coding unit using a truncated unary binarization scheme based on the maximum index value.

[0159] For example, when NumOfMvapCand and NumOfHmvpCand are determined in the above manner, the encoding device may determine a maximum index value (i.e., maxVal) based on the determined NumOfMvapCand and NumOfHmvpCand, and encode the skip mode or direct mode motion information index value of the current coding unit using a truncated unary binarization method based on the maxVal.

[0160] Illustratively, maxVal determined based on the determined NumOfMvapCand and NumOfHmvpCand is 11 or less.

[0161] For example, since the maximum number of temporal motion information candidates and MHBSKIP motion information candidates is 4 and the value of maxVal is the length of the list minus 1, maxVal may be determined based on the sum of the maximum value of NumOfMvapCand and NumOfHmvpCand and 3.

[0162] Illustratively, the decoding device may determine maxVal according to the following scheme: maxVal=(3+Max(NumOfMvapCand,NumOfHmvpCand))

[0163] Here, since Max(NumOfMvapCand, NumOfHmvpCand)≦8, maxVal determined according to the above method≦11. When encoding a skip mode or direct mode motion information index value using the truncated unary binarization method based on maxVal, the number of bits required is less than or equal to the number of bits required when maxVal=11. Therefore, by using the method provided by an embodiment of the present invention, the number of bits required to encode a skip mode or direct mode motion information index can be reduced with a high probability, thereby reducing encoding and decoding costs and improving encoding and decoding performance.

[0164] In one example, the step of determining a maximum index value based on the number of motion information candidates for the motion vector angle prediction and the number of historical motion information candidates for inter-prediction may include a step of determining a maximum index value based on the number of motion information candidates for the motion vector angle prediction and the number of historical motion information candidates for inter-prediction, and the image type of the current image.

[0165] For example, it is considered that the number of MHBSKIP motion information candidates corresponding to different image types may be different, for example, for a P picture, the number of MHBSKIP motion information candidates is 1, and for a B picture, the number of MHBSKIP motion information candidates is 3.

[0166] Therefore, in order to improve the flexibility of encoding skip mode or direct mode motion information index values, the image type may be taken into consideration when encoding skip mode or direct mode motion information index values, i.e., the encoding device may encode the skip mode or direct mode motion information index value of the current encoding unit based on the number of motion information candidates for motion vector angle prediction, the number of historical motion information candidates for inter prediction, and the image type of the current image.

[0167] By way of example, the image type may include, but is not limited to, a B picture or a P picture.

[0168] Illustratively, the encoding device may determine the maximum index value based on the number of motion information candidates for motion vector angle prediction, the number of historical motion information candidates for inter prediction, and the image type of the current image.

[0169] For example, consider that the number of motion information candidates of MHBSKIP is 1 for a P picture, and the number of motion information candidates of MHBSKIP is 3 for a B picture.

[0170] Therefore, if the picture type of the current picture is a P picture, maxVal may be determined as the sum of the maximum value of NumOfMvapCand and NumOfHmvpCand and 1.

[0171] If the picture type of the current picture is a B picture, maxVal may be determined as the sum of the maximum value of NumOfMvapCand and NumOfHmvpCand and 3.

[0172] When the picture type is a P picture, the value of the number of MHBSKIP motion information candidates is 1, and the determined maxVal is lower than the implementation method in which the number of MHBSKIP motion information candidates is directly set to 3 without considering the picture type. Therefore, it is possible to save bit costs when encoding the motion information index value in skip mode or direct mode using the truncated unary binarization method, and improve the encoding and decoding performance.

[0173] For example, if the encoding device determines maxVal in the above manner, it may encode the skip mode or direct mode motion information index value of the current coding unit using a truncated unary binarization method based on the determined maxVal.

[0174] In order to help those skilled in the art better understand the technical solutions provided by the embodiments of the present invention, the following describes the technical solutions provided by the embodiments of the present invention in combination with specific examples.

[0175] In order to improve the flexibility of determining index values and reduce coding redundancy, thereby improving encoding and decoding performance, the optimization solution of an embodiment of the present invention may include some or all of the following:

[0176] First, the high-level syntax is obtained, the number of motion information candidates for motion vector angle prediction (NumOfMvapCand) and the number of historical motion information candidates for inter prediction (NumOfHmvpCand) are obtained, and the image type of the current image is obtained.

[0177] Next, analyze the skip mode or direct mode motion information index value cu_subtype_index of the current coding unit based on the picture type of the current picture, NumOfMvapCand and NumOfHmvpCand.

[0178] Finally, obtain ValidMvapModeNum, and determine whether the type of the current coding unit is MVAP mode or HMVP mode based on cu_subtype_index and ValidMvapModeNum. (Embodiment 1, encoding method and encoding device)

[0179] 1.1. Construct a candidate list of skip mode or direct mode, traverse each prediction mode in the candidate list of prediction modes in order, and obtain, for each prediction mode, the motion information of the current coding unit and the motion information index value of the skip mode or direct mode of the current coding unit.

[0180] 1.2. Based on the motion information of the current coding unit, motion compensation is performed on the current coding unit.

[0181] 1.3. Calculate a rate-distortion cost value corresponding to the prediction mode, compare the rate-distortion cost value with the cost values of other candidate prediction modes, and select the prediction mode corresponding to the smallest rate-distortion cost value.

[0182] 1.4. The motion information index value of the skip mode or direct mode of the current coding unit corresponding to the prediction mode with the smallest rate-distortion cost value is added to the bitstream and transmitted to the decoding side. (Embodiment 2, Decoding Method and Decoding Device)

[0183] 2.1. Receive a bitstream and analyze the motion information index value of the current coding unit in skip mode or direct mode.

[0184] 2.2, Building a candidate list for skip mode or direct mode.

[0185] 2.3. Determine the prediction mode of the current coding unit based on the motion information index value of the skip mode or direct mode of the current coding unit and the candidate list.

[0186] 2.4. Obtain the motion information of the current coding unit according to the prediction mode of the current coding unit, and perform motion compensation for the current coding unit. (Embodiment 3)

[0187] Encoding Process

[0188] (1) Encode the high-level syntax at the sequence level to obtain the number of motion information candidates NumOfMvapCand for motion vector angle prediction and the number of historical motion information candidates NumOfHmvpCand for inter prediction.

[0189] (2) Based on NumOfMvapCand and NumOfHmvpCand, encode the motion information index value of the current coding unit in skip mode or direct mode and add it to the bitstream.

[0190] Decryption Process

[0191] (1) By analyzing the high-level syntax at the sequence level, the number of motion information candidates NumOfMvapCand for motion vector angle prediction and the number of historical motion information candidates NumOfHmvpCand for inter prediction are obtained.

[0192] (2) Analyze the motion information index value cu_subtype_index of the current coding unit in skip mode or direct mode based on NumOfMvapCand and NumOfHmvpCand. (Embodiment 4)

[0193] Encoding Process

[0194] (1) Encode the sequence-level high-level syntax etmvp_mvap_enable_flag and num_of_hmvp_cand.

[0195] Illustratively, the value of NumOfMvapCand is etmvp_mvap_enable_flag==1?5:0, and the value range of etmvp_mvap_enable_flag is 0 to 1.

[0196] Here, etmvp_mvap_enable_flag==1?5:0 means that when the value of etmvp_mvap_enable_flag is 1, the value of NumOfMvapCand is 5, and when the value of etmvp_mvap_enable_flag is not 1, i.e., when the value of etmvp_mvap_enable_flag is 0, the value of NumOfMvapCand is 0 (the same applies below).

[0197] Exemplarily, the value of NumOfHmvpCand is num_of_hmvp_cand, and the value range of num_of_hmvp_cand is 0 to 8.

[0198] (2) The motion information index value cu_subtype_index of the current coding unit in skip mode or direct mode is coded using the truncated unary binarization method and added to the bitstream.

[0199] Illustratively, maxVal=(3+Max(NumOfMvapCand, NumOfHmvpCand)).

[0200] Decryption Process

[0201] (1) Analyze the sequence-level high-level syntax etmvp_mvap_enable_flag and num_of_hmvp_cand.

[0202] Illustratively, the value of NumOfMvapCand is etmvp_mvap_enable_flag==1?5:0, and the value range of etmvp_mvap_enable_flag is 0 to 1.

[0203] Exemplarily, the value of NumOfHmvpCand is num_of_hmvp_cand, and the value range of num_of_hmvp_cand is 0 to 8.

[0204] (2) Analyze the motion information index value cu_subtype_index of the current coding unit in skip mode or direct mode using the truncated unary de-binarization method.

[0205] Illustratively, maxVal=(3+Max(NumOfMvapCand, NumOfHmvpCand)). (Embodiment 5)

[0206] Encoding Process

[0207] (1) Encode the high-level syntax at the sequence level to obtain the number of motion information candidates NumOfMvapCand for motion vector angle prediction and the number of historical motion information candidates NumOfHmvpCand for inter prediction.

[0208] (2) Based on the picture type of the current picture, NumOfMvapCand and NumOfHmvpCand, the skip mode or direct mode motion information index value of the current coding unit is coded and added to the bitstream.

[0209] Decryption Process

[0210] (1) By analyzing the high-level syntax at the sequence level, the number of motion information candidates NumOfMvapCand for motion vector angle prediction and the number of historical motion information candidates NumOfHmvpCand for inter prediction are obtained.

[0211] (2) Analyze the skip mode or direct mode motion information index value cu_subtype_index of the current coding unit based on the picture type of the current picture, NumOfMvapCand and NumOfHmvpCand. (Embodiment 6)

[0212] Encoding Process

[0213] (1) Encode the sequence-level high-level syntax etmvp_mvap_enable_flag and num_of_hmvp_cand.

[0214] Illustratively, the value of NumOfMvapCand is etmvp_mvap_enable_flag==1?5:0, and the value range of etmvp_mvap_enable_flag is 0 to 1.

[0215] Exemplarily, the value of NumOfHmvpCand is num_of_hmvp_cand, and the value range of num_of_hmvp_cand is 0 to 8.

[0216] (2) The motion information index value cu_subtype_index of the current coding unit in skip mode or direct mode is coded using the truncated unary binarization method and added to the bitstream.

[0217] Illustratively, maxVal=((PictureType==1)?(1:3)+Max(NumOfMvapCand, NumOfHmvpCand)), where PictureType represents the picture type of the current picture, and a value of 1 indicates that the current picture is a P picture.

[0218] Decryption Process

[0219] (1) Analyze the sequence-level high-level syntax etmvp_mvap_enable_flag and num_of_hmvp_cand.

[0220] Illustratively, the value of NumOfMvapCand is etmvp_mvap_enable_flag==1?5:0, and the value range of etmvp_mvap_enable_flag is 0 to 1.

[0221] Exemplarily, the value of NumOfHmvpCand is num_of_hmvp_cand, and the value range of num_of_hmvp_cand is 0 to 8.

[0222] (2) Analyze the motion information index value cu_subtype_index of the current coding unit in skip mode or direct mode using the truncated unary de-binarization method.

[0223] Illustratively, maxVal=((PictureType==1)?(1:3)+Max(NumOfMvapCand, NumOfHmvpCand)), where PictureType represents the picture type of the current picture, and a value of 1 indicates that the current picture is a P picture.

[0224] Here, maxVal = ((PictureType == 1)?(1:3) + Max(NumOfMvapCand, NumOfHmvpCand)) means that if the value of PictureType is 1, then maxVal = 1 + Max(NumOfMvapCand, NumOfHmvpCand), and if the value of PictureType is not 1, then maxVal = 3 + Max(NumOfMvapCand, NumOfHmvpCand) (same below). (Embodiment 7)

[0225] Encoding Process

[0226] (1) Encode the high-level syntax at the sequence level to obtain the number of motion information candidates NumOfMvapCand for motion vector angle prediction and the number of historical motion information candidates NumOfHmvpCand for inter prediction.

[0227] (2) Obtain ValidMvapModeNum, and determine whether the type of the current coding unit is MVAP mode or HMVP mode based on the motion information index value cu_subtype_index of the skip mode or direct mode of the current coding unit and ValidMvapModeNum.

[0228] (3) Based on NumOfMvapCand and NumOfHmvpCand, encode cu_subtype_index and add it to the bitstream.

[0229] Decryption Process

[0230] (1) By analyzing the high-level syntax at the sequence level, the number of motion information candidates NumOfMvapCand for motion vector angle prediction and the number of historical motion information candidates NumOfHmvpCand for inter prediction are obtained.

[0231] (2) Analyze the motion information index value cu_subtype_index of the current coding unit in skip mode or direct mode based on NumOfMvapCand and NumOfHmvpCand.

[0232] (3) Obtain ValidMvapModeNum, and determine whether the type of the current coding unit is MVAP mode or HMVP mode based on cu_subtype_index and ValidMvapModeNum. (Embodiment 8)

[0233] Encoding Process

[0234] (1) Encode the sequence-level high-level syntax etmvp_mvap_enable_flag and num_of_hmvp_cand.

[0235] Illustratively, the value of NumOfMvapCand is etmvp_mvap_enable_flag==1?5:0, and the value range of etmvp_mvap_enable_flag is 0 to 1.

[0236] Exemplarily, the value of NumOfHmvpCand is num_of_hmvp_cand, and the value range of num_of_hmvp_cand is 0 to 8.

[0237] (2) Get the number of valid angle prediction modes, ValidMvapModeNum, and if CuSubTypeIndex is greater than or equal to N,

[0238] When ValidMvapModeNum is greater than 0 and CuSubTypeIndex is less than N+ValidMvapModeNum, it is determined that the type of the current coding unit is MVAP mode.

[0239] When ValidMvapModeNum is equal to 0, or CuSubTypeIndex is equal to or greater than N+ValidMvapModeNum, it is determined that the type of the current coding unit is HMVP mode.

[0240] For example, if the current picture is a P picture, N=2, and if the current picture is a B picture, N=4.

[0241] (3) The motion information index value cu_subtype_index of the current coding unit in skip mode or direct mode is encoded using the truncated unary binarization method and added to the bitstream.

[0242] Illustratively, maxVal=(3+Max(NumOfMvapCand, NumOfHmvpCand)).

[0243] Decryption Process

[0244] (1) Analyze the sequence-level high-level syntax etmvp_mvap_enable_flag and num_of_hmvp_cand.

[0245] Illustratively, the value of NumOfMvapCand is etmvp_mvap_enable_flag==1?5:0, and the value range of etmvp_mvap_enable_flag is 0 to 1.

[0246] Exemplarily, the value of NumOfHmvpCand is num_of_hmvp_cand, and the value range of num_of_hmvp_cand is 0 to 8.

[0247] (2) Analyze the motion information index value cu_subtype_index of the current coding unit in skip mode or direct mode using the truncated unary de-binarization method.

[0248] Illustratively, maxVal=(3+Max(NumOfMvapCand, NumOfHmvpCand)).

[0249] (3) Get the number of valid angle prediction modes, ValidMvapModeNum, and if CuSubTypeIndex is greater than or equal to N,

[0250] When ValidMvapModeNum is greater than 0 and CuSubTypeIndex is less than N+ValidMvapModeNum, it is determined that the type of the current coding unit is MVAP mode.

[0251] When ValidMvapModeNum is equal to 0, or CuSubTypeIndex is equal to or greater than N+ValidMvapModeNum, it is determined that the type of the current coding unit is HMVP mode.

[0252] For example, if the current picture is a P picture, N=2, and if the current picture is a B picture, N=4. (Embodiment 9)

[0253] Encoding Process

[0254] (1) Encode the high-level syntax at the sequence level to obtain the number of motion information candidates NumOfMvapCand for motion vector angle prediction and the number of historical motion information candidates NumOfHmvpCand for inter prediction.

[0255] (2) Obtain ValidMvapModeNum, and determine whether the type of the current coding unit is MVAP mode or HMVP mode based on the motion information index value cu_subtype_index of the skip mode or direct mode of the current coding unit and ValidMvapModeNum.

[0256] (3) Based on the picture type of the current picture, NumOfMvapCand and NumOfHmvpCand, cu_subtype_index is coded and added to the bitstream.

[0257] Decryption Process

[0258] (1) By analyzing the high-level syntax at the sequence level, the number of motion information candidates NumOfMvapCand for motion vector angle prediction and the number of historical motion information candidates NumOfHmvpCand for inter prediction are obtained.

[0259] (2) Analyze the skip mode or direct mode motion information index value cu_subtype_index of the current coding unit based on the picture type of the current picture, NumOfMvapCand and NumOfHmvpCand.

[0260] (3) Obtain ValidMvapModeNum, and determine whether the type of the current coding unit is MVAP mode or HMVP mode based on cu_subtype_index and ValidMvapModeNum. (Embodiment 10)

[0261] Encoding Process

[0262] (1) Encode the sequence-level high-level syntax etmvp_mvap_enable_flag and num_of_hmvp_cand.

[0263] Illustratively, the value of NumOfMvapCand is etmvp_mvap_enable_flag==1?5:0, and the value range of etmvp_mvap_enable_flag is 0 to 1.

[0264] Exemplarily, the value of NumOfHmvpCand is num_of_hmvp_cand, and the value range of num_of_hmvp_cand is 0 to 8.

[0265] (2) Get the number of valid angle prediction modes, ValidMvapModeNum, and if CuSubTypeIndex is greater than or equal to N,

[0266] When ValidMvapModeNum is greater than 0 and CuSubTypeIndex is less than N+ValidMvapModeNum, the type of the current coding unit is MVAP mode.

[0267] When ValidMvapModeNum is equal to 0 or CuSubTypeIndex is greater than or equal to N+ValidMvapModeNum, the type of the current coding unit is HMVP mode.

[0268] For example, if the current picture is a P picture, N=2, and if the current picture is a B picture, N=4.

[0269] (3) The motion information index value cu_subtype_index of the current coding unit in skip mode or direct mode is encoded using the truncated unary binarization method and added to the bitstream.

[0270] Illustratively, maxVal=((PictureType==1)?(1:3)+Max(NumOfMvapCand, NumOfHmvpCand)), where PictureType represents the picture type of the current picture, and a value of 1 indicates that the current picture is a P picture.

[0271] Decryption Process

[0272] (1) Analyze the sequence-level high-level syntax etmvp_mvap_enable_flag and num_of_hmvp_cand.

[0273] Illustratively, the value of NumOfMvapCand is etmvp_mvap_enable_flag==1?5:0, and the value range of etmvp_mvap_enable_flag is 0 to 1.

[0274] Exemplarily, the value of NumOfHmvpCand is num_of_hmvp_cand, and the value range of num_of_hmvp_cand is 0 to 8.

[0275] (2) Analyze the motion information index value cu_subtype_index of the current coding unit in skip mode or direct mode using the truncated unary de-binarization method.

[0276] Illustratively, maxVal=((PictureType==1)?(1:3)+Max(NumOfMvapCand, NumOfHmvpCand)), where PictureType represents the picture type of the current picture, and a value of 1 indicates that the current picture is a P picture.

[0277] (3) Get the number of valid angle prediction modes, ValidMvapModeNum, and if CuSubTypeIndex is greater than or equal to N,

[0278] When ValidMvapModeNum is greater than 0 and CuSubTypeIndex is less than N+ValidMvapModeNum, the type of the current coding unit is MVAP mode.

[0279] When ValidMvapModeNum is equal to 0 or CuSubTypeIndex is greater than or equal to N+ValidMvapModeNum, the type of the current coding unit is HMVP mode.

[0280] For example, if the current picture is a P picture, N=2, and if the current picture is a B picture, N=4. (Embodiment 11)

[0281] The high-level syntax etmvp_mvap_enable_flag at the sequence level is coded and decoded to control ETMVP and MVAP.

[0282] For example, whether ETMVP and MVAP are enabled may be marked through etmvp_mvap_enable_flag.

[0283] By way of example, the syntax description may be as shown in the following table: [Table 4]

[0284] Semantic Description

[0285] Enhanced temporal motion vector prediction and motion vector angle prediction enable flag (etmvp_mvap_enable_flag): a binary variable. A value of "1" indicates that enhanced temporal motion vector prediction and motion vector angle prediction can be used, and a value of "0" indicates that enhanced temporal motion vector prediction and motion vector angle prediction should not be used. The value of EtmvpMvapEnableFlag is equal to the value of etmvp_mvap_enable_flag.

[0286] Illustratively, if etmvp_mvap_enable_flag is not present in the bitstream, the value of EtmvpMvapEnableFlag is 0.

[0287] If the value of EtmvpMvapEnableFlag is 1, the value of NumOfMvapCand is equal to 5; otherwise, the value of NumOfMvapCand is equal to 0. (Embodiment 12)

[0288] After completing decoding of the current prediction unit (i.e., the current coding unit), if the current prediction unit is an inter prediction unit, and is not an enhanced temporal motion vector prediction unit, and is not a motion vector angle prediction unit, and is not a sub-block temporal motion information prediction unit, and NumOfHmvpCand (the number of updatable motion information) is greater than 0, update the history motion information list HmvpCandList based on the motion information of the current prediction block, BgcFlag, and BgcIndex.

[0289] Otherwise, if at least one of the following conditions is met, i.e., NumOfHmvpCand=0, the current prediction unit is not an inter prediction unit, the current prediction unit is an enhanced temporal motion vector prediction unit, the current prediction unit is a motion vector angle prediction unit, or the current prediction unit is a sub-block temporal motion information prediction unit, the history motion information list is not updated. (Embodiment 13)

[0290] After completing decoding of the current prediction unit (i.e., the current block), if the current prediction unit is an inter prediction unit, and not an affine prediction unit, and not an angle weighted prediction unit, and not an enhanced temporal motion vector prediction unit, and not a motion vector angle prediction unit, and not a sub-block temporal motion information prediction unit, and NumOfHmvpCand (the number of updatable motion information) is greater than 0, the historical motion information list HmvpCandList is updated based on the motion information of the current prediction block, BgcFlag, and BgcIndex; otherwise, if at least one of the following conditions is met, i.e., NumOfHmvpCand=0, the current prediction unit is not an inter prediction unit, the current prediction unit is an affine prediction unit, the current prediction unit is an angle weighted prediction unit, the current prediction unit is an enhanced temporal motion vector prediction unit, the current prediction unit is a motion vector angle prediction unit, or the current prediction unit is a sub-block temporal motion information prediction unit, the historical motion information list is not updated.

[0291] It should be noted that the above-described embodiments are merely specific examples of how to realize the embodiments of the present invention, and do not limit the scope of protection of the present invention. Based on the above-described embodiments, new embodiments can be obtained by combining the embodiments with each other or by modifying the embodiments, and all of these are intended to be included in the scope of protection of the present invention.

[0292] Furthermore, the processes for realizing the encoding and decoding aspects of the above embodiments may refer to each other.

[0293] The method provided by the present invention has been described above. The following describes the device provided by the present invention. Figure 11 is a schematic diagram illustrating the structure of a decoding device provided by an embodiment of the present invention, which may include: a decoding module 1110 for receiving a bitstream and analyzing a motion information index value for a skip mode or direct mode of a current coding unit; a construction module 1120 for constructing a candidate list for the skip mode or direct mode; a determination module 1130 for determining a prediction mode of the current coding unit based on the motion information index value for the skip mode or direct mode of the current coding unit and the candidate list; and a compensation module 1140 for obtaining motion information of the current coding unit based on the prediction mode of the current coding unit and performing motion compensation on the current coding unit. Here, the decoding module 1110 is specifically used to obtain the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction, and to determine the motion information index value for the skip mode or direct mode of the current coding unit based on the number of motion information candidates for the motion vector angle prediction and the number of historical motion information candidates for inter prediction.

[0294] In some embodiments, the decoding module 1110 is specifically used to obtain the number of motion information candidates for the motion vector angle prediction and the number of historical motion information candidates for the inter prediction by analyzing high-level syntax at the sequence level.

[0295] In some embodiments, the decoding module 1110 is specifically used to analyze an enable flag for enhanced temporal motion vector prediction and motion vector angle prediction, and determine the number of motion information candidates for the motion vector angle prediction based on the value of the enable flag for enhanced temporal motion vector prediction and motion vector angle prediction, and to analyze an index for the number of historical motion information candidates for inter prediction, and determine the number of historical motion information candidates for inter prediction based on the value of the index for the number of historical motion information candidates for inter prediction, wherein the enable flag for enhanced temporal motion vector prediction and motion vector angle prediction is used to indicate that the enhanced temporal motion vector prediction mode and the motion vector angle prediction mode are turned on simultaneously, or that the enhanced temporal motion vector prediction mode and the motion vector angle prediction mode are turned off simultaneously.

[0296] In some embodiments, the determination module 1130 is specifically used to determine a skip mode or direct mode motion information index value of the current coding unit based on the number of motion information candidates for the motion vector angle prediction, the number of historical motion information candidates for inter prediction, and the image type of the current image.

[0297] In some embodiments, the determination module 1130 is specifically used to determine a maximum index value based on the number of motion information candidates for the motion vector angle prediction, the number of historical motion information candidates for inter prediction, and the image type of the current image, and to analyze the motion information index value of the skip mode or direct mode of the current coding unit using a truncated unary de-binarization method based on the maximum index value.

[0298] In some embodiments, the determination module 1130 is specifically used to determine the maximum value among the number of motion information candidates for the motion vector angle prediction and the number of historical motion information candidates for inter prediction, and if the image type of the current image is a P picture, determine the sum of the maximum value and 1 as the maximum index value, and if the image type of the current image is a B picture, determine the sum of the maximum value and 3 as the maximum index value.

[0299] In some embodiments, the determination module 1130 is specifically used to determine whether the prediction mode of the current coding unit is a motion vector angle prediction mode or a motion vector prediction mode based on history information based on the number of valid angle prediction modes and the motion information index value of the skip mode or direct mode.

[0300] In some embodiments, the determination module 1130 is specifically used to determine that the prediction mode of the current coding unit is a motion vector angle prediction mode when the motion information index value of the skip mode or direct mode is greater than or equal to N, the number of valid angle prediction modes is greater than 0, and the motion information index value of the skip mode or direct mode is less than the sum of N and the number of valid angle prediction modes, and to determine that the prediction mode of the current coding unit is a motion vector angle prediction mode based on history information when the number of valid angle prediction modes is equal to 0 or the motion information index value of the skip mode or direct mode is greater than or equal to the sum of N and the number of valid angle prediction modes.

[0301] In some embodiments, if the picture type of the current picture is a P picture, then N=2, and if the picture type of the current picture is a B picture, then N=4.

[0302] In some embodiments, the decision module 1130 is further used to update the history motion information list when the prediction mode of the current coding unit is a history information based motion vector prediction mode, if the current coding unit is an inter prediction unit, and is not an affine prediction unit, and is not an angle weighted prediction unit, and is not an enhanced temporal motion vector prediction unit, and is not a motion vector angle prediction unit, and is not a sub-block temporal motion information prediction unit, and the number of history motion information candidates for the inter prediction is greater than 0, and not update the history motion information list otherwise.

[0303] In some embodiments, the decoding module 1110 is specifically used to determine that the number of motion information candidates for the motion vector angle prediction is 5 if the value of the enhanced temporal motion vector prediction and motion vector angle prediction enable flag is 1, and to determine that the number of motion information candidates for the motion vector angle prediction is 0 if the value of the enhanced temporal motion vector prediction and motion vector angle prediction enable flag is 0 or the enhanced temporal motion vector prediction and motion vector angle prediction enable flag is not present in the bitstream, where the value of the enhanced temporal motion vector prediction and motion vector angle prediction enable flag is 1 indicates that enhanced temporal motion vector prediction and motion vector angle prediction can be used for the current coding unit, and the value of the enhanced temporal motion vector prediction and motion vector angle prediction enable flag is 0 or the enhanced temporal motion vector prediction and motion vector angle prediction enable flag is not present in the bitstream indicates that enhanced temporal motion vector prediction and motion vector angle prediction should not be used for the current coding unit.

[0304] 12 is a schematic diagram showing the structure of an encoding device provided by an embodiment of the present invention, in which the encoding device may include: a construction module 1210 for constructing a candidate list of skip mode or direct mode, traversing each prediction mode in the candidate list of prediction modes in order, and obtaining, for each prediction mode, motion information of the current coding unit and a skip mode or direct mode motion information index value of the current coding unit; a compensation module 1220 for performing motion compensation on the current coding unit based on the motion information of the current coding unit; a decision module 1230 for calculating a rate-distortion cost value corresponding to the prediction mode, comparing the rate-distortion cost value with cost values of other candidate prediction modes, and selecting the prediction mode corresponding to the smallest rate-distortion cost value; and an encoding module 1240 for adding the skip mode or direct mode motion information index value of the current coding unit corresponding to the prediction mode with the smallest rate-distortion cost value to a bitstream and transmitting it to a decoding side. Here, the encoding module 1240 is specifically used to obtain the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction, and encode the motion information index value of the skip mode or direct mode of the current encoding unit based on the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction, and add it to the bitstream.

[0305] In some embodiments, the encoding module 1240 is specifically used to determine a maximum index value based on the number of motion information candidates for the motion vector angle prediction and the number of historical motion information candidates for inter prediction, and to encode the skip mode or direct mode motion information index value of the current encoding unit using a truncated unary binarization scheme based on the maximum index value.

[0306] In some embodiments, the encoding module 1240 is specifically used to determine the maximum index value based on the number of motion information candidates for the motion vector angle prediction, the number of historical motion information candidates for inter prediction, and the image type of the current image.

[0307] 13 is a schematic diagram showing a hardware structure of a decoding device provided according to an embodiment of the present invention. The decoding device may include a processor 1301 and a machine-readable storage medium 1302 storing machine-executable instructions. The processor 1301 and the machine-readable storage medium 1302 can communicate via a system bus 1303. By reading and executing the machine-executable instructions corresponding to the decoding control logic in the machine-readable storage medium 1302, the processor 1301 can perform the decoding method of the decoding device described above.

[0308] The machine-readable storage medium 1302 referred to herein may be any electronic, magnetic, optical, or other physical storage device capable of containing or storing information such as executable commands, data, etc. For example, the machine-readable storage medium may be, for example, a random access memory (RAM), volatile memory, non-volatile memory, flash memory, a storage drive (such as a hard disk drive), a solid-state drive, any type of storage disk (such as an optical disk, DVD, etc.), or similar storage medium, or a combination thereof.

[0309] In some embodiments, a machine-readable storage medium having machine-executable instructions stored thereon is further provided, which, when executed by a processor, implements the decoding method of the decoding device described above. For example, the machine-readable storage medium may be a ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.

[0310] 14 is a schematic diagram showing a hardware structure of an encoding device provided according to an embodiment of the present invention. The encoding device may include a processor 1401 and a machine-readable storage medium 1402 storing machine-executable instructions. The processor 1401 and the machine-readable storage medium 1402 may communicate via a system bus 1403. By reading and executing the machine-executable instructions corresponding to the encoding control logic in the machine-readable storage medium 1402, the processor 1401 may perform the encoding method of the encoding device described above.

[0311] The machine-readable storage medium 1402 referred to herein may be any electronic, magnetic, optical, or other physical storage device capable of containing or storing information such as executable commands, data, etc. For example, the machine-readable storage medium may be, for example, a random access memory (RAM), volatile memory, non-volatile memory, flash memory, a storage drive (such as a hard disk drive), a solid-state drive, any type of storage disk (such as an optical disk, DVD, etc.), or similar storage medium, or a combination thereof.

[0312] In some embodiments, the present invention further provides a machine-readable storage medium having stored thereon machine-executable instructions, which, when executed by a processor, implement the encoding method of the encoding device described above. In some embodiments, the present invention further provides a camera device including the decoding device and / or the encoding device of any of the above embodiments.

[0313] As used herein, relational terms such as first and second, etc., are used merely to distinguish one entity or operation from another and do not necessarily require or imply that any actual relationship or order exists between those entities or operations. Also, the terms "comprise," "contain," or any other variation thereof, are intended to include 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 listed, or includes the inherent elements of such process, method, article, or device. Absent more limitations, elements qualified by the phrase "comprise..." do not exclude the presence of additional identical elements in a process, method, article, or device that includes said elements.

[0314] The above description is only a preferred embodiment of the present invention, and does not limit the present invention. Any amendments, equivalent replacements, or improvements made within the spirit and principle of the present invention should be included within the protection scope of the present invention.

Claims

1. receiving a bitstream and analyzing a skip mode or direct mode motion information index value of a current coding unit; building a skip mode or direct mode candidate list; determining a prediction mode for the current coding unit based on a motion information index value of skip mode or direct mode for the current coding unit and a candidate list; obtaining motion information of the current coding unit based on a prediction mode of the current coding unit, and performing motion compensation on the current coding unit; Wherein, the step of analyzing the motion information index value of the skip mode or direct mode of the current coding unit includes: obtaining the number of motion information candidates for motion vector angle prediction and the number of history motion information candidates for inter prediction; determining a motion information index value for a skip mode or a direct mode of the current coding unit based on the number of motion information candidates for the motion vector angle prediction, the number of history motion information candidates for the inter prediction, and an image type of the current image; A decoding method comprising:

2. The step of acquiring the number of motion information candidates for motion vector angle prediction and the number of history motion information candidates for inter prediction includes: Parsing a high-level syntax at a sequence level to obtain the number of motion information candidates for the motion vector angle prediction and the number of history motion information candidates for the inter prediction; The step of parsing a high-level syntax at a sequence level to obtain the number of motion information candidates for the motion vector angle prediction and the number of history motion information candidates for the inter prediction includes: analyzing an enable flag of enhanced temporal motion vector prediction and motion vector angle prediction, and determining a number of motion information candidates for the motion vector angle prediction based on values of the enable flags of the enhanced temporal motion vector prediction and motion vector angle prediction; analyzing an index of the number of history motion information candidates for inter prediction, and determining the number of history motion information candidates for inter prediction based on the value of the index of the number of history motion information candidates for inter prediction; The enhanced temporal motion vector prediction and motion vector angle prediction enable flag is used to indicate that the enhanced temporal motion vector prediction mode and the motion vector angle prediction mode are simultaneously turned on, or that the enhanced temporal motion vector prediction mode and the motion vector angle prediction mode are simultaneously turned off.

2. The method of claim 1 .

3. determining a motion information index value of the current coding unit in skip mode or direct mode based on the number of motion information candidates for the motion vector angle prediction, the number of history motion information candidates for the inter prediction, and an image type of the current image, determining a maximum index value based on the number of motion information candidates for the motion vector angle prediction, the number of history motion information candidates for the inter prediction, and an image type of the current image; and analyzing a skip mode or direct mode motion information index value of the current coding unit using a truncated unary debinarization scheme based on the maximum index value.

2. The method of claim 1 .

4. The step of determining a maximum index value based on the number of motion information candidates for the motion vector angle prediction, the number of history motion information candidates for the inter prediction, and the image type of the current image, includes: determining a maximum value among the number of motion information candidates for the motion vector angle prediction and the number of history motion information candidates for the inter prediction; if the picture type of the current picture is a P picture, determining the sum of the maximum value and 1 as the maximum index value; if the picture type of the current picture is a B picture, determining the sum of the maximum value and 3 as the maximum index value.

4. The method of claim 3.

5. determining the number of motion information candidates for the motion vector angle prediction based on the values of the enable flags for the enhanced temporal motion vector prediction and the motion vector angle prediction, determining that the number of motion information candidates for the motion vector angle prediction is 5 when the value of the enable flag for the enhanced temporal motion vector prediction and the motion vector angle prediction is 1; determining that the number of motion information candidates for the motion vector angle prediction is 0 if the value of the enable flag for the enhanced temporal motion vector prediction and the motion vector angle prediction is 0 or if the enable flag for the enhanced temporal motion vector prediction and the motion vector angle prediction is not present in the bitstream; The value of the enhanced temporal motion vector prediction and motion vector angle prediction enable flag being 1 indicates that the enhanced temporal motion vector prediction and motion vector angle prediction can be used for the current coding unit, and the value of the enhanced temporal motion vector prediction and motion vector angle prediction enable flag being 0, or the absence of the enhanced temporal motion vector prediction and motion vector angle prediction enable flag in the bitstream, indicates that the enhanced temporal motion vector prediction and motion vector angle prediction should not be used for the current coding unit.

3. The method of claim 2.

6. constructing a candidate list of skip mode or direct mode, traversing each prediction mode in the candidate list of prediction modes in turn, and obtaining, for each prediction mode, motion information of the current coding unit and a skip mode or direct mode motion information index value of the current coding unit; performing motion compensation on the current coding unit based on motion information of the current coding unit; calculating a rate-distortion cost value corresponding to the prediction mode, comparing the rate-distortion cost value with cost values of other prediction mode candidates, and selecting the prediction mode corresponding to the smallest rate-distortion cost value; adding a motion information index value of the skip mode or direct mode of the current coding unit corresponding to the prediction mode with the smallest rate-distortion cost value to a bitstream and transmitting the bitstream to a decoding side; wherein the step of adding, to the bitstream, a motion information index value of the skip mode or direct mode of the current coding unit corresponding to the prediction mode with the smallest rate-distortion cost value comprises: obtaining the number of motion information candidates for motion vector angle prediction and the number of history motion information candidates for inter prediction; and encoding a motion information index value of a skip mode or a direct mode of the current coding unit based on the number of motion information candidates of the motion vector angle prediction, the number of history motion information candidates of the inter prediction, and the image type of the current image, and adding the encoded motion information index value to a bitstream.

10. A coding method comprising:

7. The step of encoding a motion information index value of the skip mode or direct mode of the current coding unit based on the number of motion information candidates of the motion vector angle prediction, the number of history motion information candidates of the inter prediction, and the image type of the current image includes: determining a maximum index value based on the number of motion information candidates for the motion vector angle prediction, the number of history motion information candidates for the inter prediction, and an image type of the current image; encoding a skip mode or direct mode motion information index value of the current coding unit using a truncated unary binarization scheme based on the maximum index value.

7. The method of claim 6.

8. The step of determining a maximum index value based on the number of motion information candidates for the motion vector angle prediction, the number of history motion information candidates for the inter prediction, and the image type of the current image, includes: determining a maximum value among the number of motion information candidates for the motion vector angle prediction and the number of history motion information candidates for the inter prediction; if the picture type of the current picture is a P picture, determining the sum of the maximum value and 1 as the maximum index value; if the picture type of the current picture is a B picture, determining the sum of the maximum value and 3 as the maximum index value.

8. The method of claim 7.

9. a decoding module for receiving the bitstream and analyzing a skip mode or direct mode motion information index value of the current coding unit; a construction module for constructing a skip mode or direct mode candidate list; a decision module for deciding a prediction mode of the current coding unit based on a motion information index value of a skip mode or a direct mode of the current coding unit and a candidate list; a compensation module for obtaining motion information of the current coding unit according to a prediction mode of the current coding unit, and performing motion compensation on the current coding unit; Here, the decoding module specifically includes: Obtain the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction; The motion information index value of the current coding unit is used to determine a skip mode or direct mode motion information index value based on the number of motion information candidates of the motion vector angle prediction, the number of history motion information candidates of the inter prediction, and the image type of the current image. A decoding device characterized by:

10. a construction module for constructing a candidate list of skip mode or direct mode, traversing each prediction mode in the candidate list of prediction modes in order, and obtaining, for each prediction mode, motion information of a current coding unit and a skip mode or direct mode motion information index value of the current coding unit; a compensation module for performing motion compensation on the current coding unit based on motion information of the current coding unit; a decision module for calculating a rate-distortion cost value corresponding to the prediction mode, comparing the rate-distortion cost value with cost values of other candidate prediction modes, and selecting the prediction mode corresponding to the smallest rate-distortion cost value; an encoding module for adding a motion information index value of skip mode or direct mode of the current coding unit corresponding to the prediction mode with the smallest rate-distortion cost value to a bitstream and transmitting the motion information index value to a decoding side; Here, the encoding module specifically includes: Obtain the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction; A motion information index value of the current coding unit in skip mode or direct mode is coded and added to a bitstream based on the number of motion information candidates for the motion vector angle prediction, the number of history motion information candidates for the inter prediction, and the image type of the current image.

1. An encoding device comprising:

11. A decoding device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being adapted to execute the machine-executable instructions to perform the method of any one of claims 1 to 5.

10. A decoding device comprising:

12. A coding device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being used to execute the machine-executable instructions to perform the method of any one of claims 6 to 8.

10. A coding device comprising:

13. A machine-readable storage medium storing machine-executable instructions that, when executed by a processor, perform the method of any one of claims 1 to 8. A machine-readable storage medium comprising:

Citation Information

Patent Citations

  • Video encoding and decoding method and device based on motion vector angle prediction

    CN112073733A

  • Video encoding method and related device

    CN112291565A

  • Decoding and coding method, device and equipment

    CN112565747A

  • Inter prediction-based image coding method and device

    WO2020251323A1