Decoding method, coding method, apparatus, device, and storage medium
By dynamically determining motion information candidates based on high-level syntax and image type, the solution addresses inefficiencies in existing video encoding technologies, reducing bit costs and enhancing encoding and decoding performance through optimized index value encoding.
Patent Information
- Application Number
- JP2024110195
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2021-06-30
- Filing Date
- 2024-07-09
- Publication Date
- 2024-09-12
- Estimated Expiration
- 2042-06-06
AI Technical Summary
Existing video encoding technologies face inefficiencies in determining motion information index values for skip and direct modes, leading to increased bit costs and reduced encoding and decoding performance due to fixed maximum index values and inflexible candidate list constructions.
The solution involves dynamically determining the number of motion information candidates for motion vector angle prediction and historical motion information candidates based on high-level syntax and image type, allowing for flexible construction of candidate lists and optimized index value encoding using truncated unary binarization, thereby reducing bit costs and improving encoding and decoding performance.
This approach enhances the flexibility in determining motion information index values, reduces bit costs, and improves encoding and decoding efficiency by optimizing the candidate list construction and index value encoding in video encoding and decoding processes.
Smart Images

Figure 2024124549000001
Abstract
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 by using surrounding coded units as references, effectively removing redundancy in the spatial domain. Inter prediction predicts the current image by 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, a decoding method is provided, comprising: receiving a bitstream, 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 step of analyzing the skip mode or direct mode motion information index value of the current coding unit comprises the steps of 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 the motion vector angle prediction and the number of history motion information candidates for the 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; traversing each prediction mode in the candidate list of prediction modes in order; 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; 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 prediction mode candidates, and selecting a prediction mode corresponding to the smallest rate-distortion cost value; and selecting the current coding mode corresponding to the prediction mode with the smallest rate-distortion cost value. and a step of adding a skip mode or direct mode motion information index value of the current coding unit corresponding to the prediction mode having the smallest rate-distortion cost value to the bitstream, and transmitting the motion information index value to a 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 having the smallest rate-distortion cost value to the bitstream includes a step of obtaining a number of motion information candidates for motion vector angle prediction and a number of historical motion information candidates for inter prediction, and a step of 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, a decoding device is provided, comprising: a decoding module for receiving a bitstream and analyzing a skip mode or direct mode motion information index value 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 skip mode or direct mode motion information index value and the candidate list of the current coding unit; 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 for the current coding unit, wherein the decoding module is specifically used to obtain a number of motion information candidates for motion vector angle prediction and a number of historical motion information candidates for the inter prediction, and 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 and the number of historical motion information candidates for inter prediction.
[0007] According to a fourth aspect of the embodiment of the present invention, the present invention includes 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 the motion information of the current coding unit; and a 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 encoding unit corresponding to a prediction mode having the smallest rate-distortion cost value and transmitting 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 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.
[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 adapted to execute the machine-executable instructions to implement 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 a motion information index value of a skip mode or direct mode of a current coding unit, constructs a candidate list for skip mode or direct mode, determines 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, obtains 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 motion information index value of the skip mode or direct mode of the current coding unit, obtains the number of motion information candidates for motion vector angle prediction and the number of historical motion information candidates for inter prediction, and determines 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 motion vector angle prediction and the number of historical motion information candidates for inter prediction, thereby improving the flexibility of determining the motion information index value of the skip mode or direct mode of the current coding unit and improving the encoding and decoding performance. [Brief description of the drawings]
[0012] [Figure 1a] FIG. 2 is a schematic diagram illustrating an encoding and decoding method according to an exemplary embodiment of the present invention; [Figure 1b] FIG. 2 is a schematic diagram illustrating an encoding and decoding method according to an exemplary embodiment of the present invention; [Diagram 2] FIG. 2 is a schematic diagram illustrating block division of the SBTMVP mode shown in an exemplary embodiment of the present invention. [Diagram 3] FIG. 2 is a schematic diagram illustrating the locations 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 showing the correspondence between mode indexes and modes of the MVAP modes shown in an exemplary embodiment of the present invention. [Diagram 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 according to an exemplary embodiment of the present invention. [Figure 7] 4 is a flow chart 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] 4 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] FIG. 2 is a schematic diagram illustrating the structure of a decoding device according to an exemplary embodiment of the present invention; [Figure 12] 2 is a schematic diagram illustrating the structure of an encoding device according to an exemplary embodiment of the present invention; [Figure 13] FIG. 2 is a schematic diagram illustrating a hardware structure of a decoding device according to an exemplary embodiment of the present invention; [Figure 14] FIG. 2 is a schematic diagram illustrating a hardware structure of an encoding device according to an exemplary embodiment of the present invention. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0013] Exemplary embodiments will now be described in detail, examples of which are shown in the drawings. Where the following description refers to the drawings, the same numerals in different 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 describing specific embodiments and are not intended to limit the present invention. The singular forms "a kind," "said," and "the" used in the present invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.
[0015] In order to enable those skilled in the art to 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 and the main processes of conventional video encoding and decoding.
[0016] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present invention, the following first briefly describes some technical terms related to the embodiments of the present invention.
[0017] 1. Technical terms
[0018] 1. Inter Prediction: Inter prediction takes advantage of the temporal correlation of video. Since video sequences usually contain relatively strong temporal correlation, the pixels of the current image can be predicted using the pixels of adjacent encoded images, which can effectively remove the temporal redundancy of video.
[0019] 2. Prediction Signal: A pixel value derived from encoded 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 position is discrete, it is necessary to obtain the final predicted pixel through an interpolation operation. The closer the predicted pixel is to the original pixel, the smaller the residual energy obtained by subtracting the two will be, and the higher the coding compression performance will be.
[0021] 3. Motion Vector (MV for short): 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 (which may be called a sub-block) has a corresponding motion vector that needs to be transmitted to the decoding side. If the MV of each block is coded and transmitted independently, many bits will be consumed, especially for the sub-blocks that are divided into small sizes. In order to reduce the number of bits for coding the MV, video coding utilizes the spatial correlation between adjacent blocks to predict the MV of the current block to be coded based on the MV of the adjacent coded blocks, and then codes the prediction difference. In this way, the number of bits representing the MV can be effectively reduced. Based on this, when coding the MV of the current image block, generally, the MV of the current image block is predicted using the MV of the adjacent coded blocks first, and then the difference between the predicted value of the MV (Motion Vector Prediction, MVP for short) and the actual estimated value of the motion vector, that is, the motion vector difference (MVD for short), is coded, thereby effectively reducing the number of bits for coding the MV.
[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 represent which reference image is used through the index information of the reference image. For the current image, a reference image list is usually created based on a specific principle, and the reference image index information represents which reference image in the reference image list is used by the current image block. In addition, since there are many coding technologies that support multiple reference image lists, it is necessary to represent which reference image list is used with one index value, and the index value may 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 as is.
[0024] 6. Direct mode: Direct mode is a direct mode in inter prediction. It requires sending residual information, but does not require sending MVD. It only requires sending 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 prediction value to obtain the reconstruction value.
[0025] 7. Binarization and de-binarization method for truncated unary: The relationship between synElVal and binary strings may be as shown in Table 1. [Table 1]
[0026] The encoding side may derive 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 derive the value of synElVal according to Table 1 from the binary string and maxVal.
[0027] 8. Rate-Distortion Optimization (RDO) Principle: The indexes for evaluating coding efficiency include bit rate and Peak Signal to Noise Ratio (PSNR). The smaller the bit stream, the higher the compression ratio, 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 stands for 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 code an image block in the 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) in FIG. 1, taking video encoding as an example, video encoding generally includes processes such as prediction, transformation, quantization, entropy encoding, etc., and the encoding process may be realized in the framework of (b) in FIG. 1.
[0032] Here, prediction can be divided into intra prediction and inter prediction. Intra prediction predicts a current uncoded block by using surrounding coded blocks as references, effectively removing redundancy in the spatial domain. Inter prediction predicts a current image by using adjacent coded images, effectively removing redundancy in the temporal domain.
[0033] Transformation is the process of converting an image from the spatial domain to the transform domain and using transform coefficients to represent the image. Many images have many flat and slowly changing parts, and by applying an appropriate transformation, the image can be transformed from a scattered distribution in the spatial domain to a relatively concentrated distribution in the transform domain, eliminating the frequency domain correlation between signals, and effectively compressing the bitstream in conjunction with the quantization process.
[0034] Entropy coding is a lossless coding method that converts a series of element symbols into a binary bitstream for transmission or storage, where 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] The above has been introduced using encoding as an example, but the process of video decoding is the opposite of the process of video encoding; that is, video decoding usually includes the processes of entropy decoding, prediction, inverse quantization, inverse transform, and filtering, and the realization principle of each process is the same as or similar to that of video encoding.
[0036] Third, 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, TMVP and SBTMVP technologies are currently adopted in the standard. If both the width and height of the current block are greater than or equal to 16, 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, in the time-domain reference frame, find the motion information at the same position as the preset position of the current coding unit, and scale it to be the temporal motion information of the current block, where for P picture, the time-domain reference frame is the first frame in list0, and for B picture, the time-domain 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 FIG. 2. Firstly, find a region in the time-domain reference frame that is the same 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, in which motion information of a spatial domain neighboring block of the current coding unit is used to predict motion information of the current coding unit.
[0043] The MHBSKIP mode constructs three motion information, namely, bidirectional, forward and backward motion information, 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 adopts the MVAP technology in its standard, which divides the current coding unit into sub-blocks, and copies motion information from the surrounding spatial domain neighboring blocks at a preset angle for each sub-block using up to five prediction angles. This makes it possible to provide more motion information within the current coding unit without dividing the coding unit, improving coding performance.
[0047] Exemplarily, the correspondence between the mode index and the mode 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, m and n be W / 4 and H / 4, respectively, and (x, y) be the pixel coordinates of the top-left corner of the current decoding unit. A0, A1, ..., Am-1 are 4x4 blocks at the bottom-left corner of the current block, Am, Am+1, ..., Am+n-1 are 4x4 blocks at the left of the current block, Am+n is 4x4 blocks at the top-left corner of the current block, Am+n+1, Am+n+2, ..., A2m+n are 4x4 blocks at the top of the current block, and A2m+n+1, A2m+n+1, ..., A2m+2n are 4x4 blocks at the top-right corner of the current block.
[0051] Exemplarily, a schematic diagram of the positions 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 coordinate of Ai is (x-1, y+H+W-4×i-1), and when the value range of i is m+n+1 to 2m+2n, the coordinate of Ai is (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 both W and H are 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 the motion information is different, or if the Am+n block and the Am+n+1 block both use inter prediction mode and the motion information is different, 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, then 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 to 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 "available", 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 steps:
[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] is equal to neighborMotions[i-1].
[0073] 3.3.3. Derive the motion information array MotionArray.
[0074] Based on curMvapMode and neighborMotions, determine a motion information array MotionArray[i][j](interPredRefMode, MvE0, MvE1, fIndexL0, RefIndexL1) of a sub-block in the current coding unit, where i=0~(W>>3)-1, j=0~(H>>3)-1, (i,j) is the index of an 8×8 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, derive a 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, and its principle is to predict the motion information of the current coding unit using the motion information of the coding blocks up to now. By creating an HMVP table, the motion information of the coding units up to now is stored, and when a certain 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 the prediction accuracy.
[0077] Exemplarily, the decoding flow chart of the HMVP method may be as shown in FIG.
[0078] 3.5, ETMVP
[0079] In AVS3, ETMVP technology is currently adopted in the standard, first find the area in the time domain reference frame that is the same position as the current coding unit, then take the scaling value of the motion vector in the time motion information storage unit where each 8x8 block in the area is located as the first candidate, then offset the area by 8 luminance samples left and right, up and down as the subsequent candidates, after obtaining each candidate, the candidate needs to be checked for duplication, and then put into the motion vector candidate list, where for P picture, the time domain reference frame is the first frame of list0, and for B picture, the time domain reference frame is the first frame of list1. Finally, for each candidate in the list, obtain the motion information of the 8x8 sub-block, perform motion compensation, and 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 length of the list is 1+1+8=10.
[0082] If the current picture is a B picture, the time 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 length of the list 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, it is necessary to mark it with the motion information index value cu_subtype_index for skip or direct mode of the current coding unit. Currently, the value range of cu_subtype_index is 0 to 11, and the binarization coding is performed using truncated unary and maxVal is equal to 11.
[0085] However, in practice, since 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, 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 cost.
[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] Then, 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 and 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 a motion information index value of a current coding unit in skip mode or direct mode.
[0093] Step S710 builds a candidate list for skip mode or direct mode.
[0094] Step S720: determining a prediction mode of the current coding unit according to 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 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.
[0096] As shown in FIG. 8, in step S700, the step of 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 history motion information candidates for inter prediction are obtained.
[0098] Step S702: determining a motion information index value of a skip mode or a direct mode of a current coding unit according to the number of motion information candidates of the motion vector angle prediction and the number of history motion information candidates of the 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 the motion information index value 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] Exemplarily, 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, the decoding device may determine a motion information index value for skip mode or direct mode of the current encoding 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 parsing the above sequence level high-level syntax may include a step of analyzing an enable flag 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 a step of 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 an enable flag (etmvp_mvap_enable_flag) for enhanced temporal motion vector prediction and motion vector angle prediction, and an index of 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] Exemplarily, 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 based on the value of etmvp_mvap_enable_flag according to the following scheme: 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 enhanced temporal motion vector prediction and motion vector angle prediction can be used for the current encoding unit, i.e., the current encoding unit simultaneously enables enhanced temporal motion vector prediction and motion vector angle prediction.
[0111] If the value of the enhanced temporal motion vector prediction and motion vector angle prediction enable flag is 0, it is determined that the number of motion information candidates for motion vector angle prediction is 0, where 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 does not exist in the bitstream, which 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 a 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 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 a step of analyzing the motion information index value for a skip mode or direct mode of the current coding unit using a truncated unary inverse binarization method based on the maximum index value.
[0114] Exemplarily, when 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 skip mode or direct mode motion information index value of the current coding unit using a truncated unary debinarization manner based on the determined maxVal. Exemplarily, maxVal determined based on the determined NumOfMvapCand and NumOfHmvpCand is less than or equal to 11.
[0115] As an example, the step of determining the maximum index value based on the number of motion information candidates of motion vector angle prediction and the number of historical motion information candidates of inter prediction may include the steps of determining the maximum value among the number of motion information candidates of motion vector angle prediction and the number of historical motion information candidates of inter prediction, and determining the maximum index value as the sum of the maximum value and 3. Exemplarily, 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 the 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 the encoding and decoding costs and improving the 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 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 may include determining a motion information index value for 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 the image type of the current image.
[0119] Illustratively, it is considered that the number of motion information candidates of MHBSKIP corresponding to different picture types may be different, for example, for a P picture, the number of motion information candidates of MHBSKIP is 1, and for a B picture, the number of motion information candidates of MHBSKIP is 3. Therefore, in order to improve the flexibility of determining the motion information index value of the skip mode or direct mode, the picture type may be taken into consideration when determining the motion information index value of the skip mode or direct mode, i.e., the decoding device may 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 of the motion vector angle prediction and the number of historical motion information candidates of the 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] Exemplarily, 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. Exemplarily, the picture type may include, but is not limited to, B picture or 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 a maximum index value based on the number of motion information candidates for the above-mentioned 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 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, and if the image type of the current image is a P picture, a step of determining 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, a step of determining the sum of the maximum value and 3 as the maximum index value.
[0124] Consider, for example, that for a P picture, the number of motion information candidates in MHBSKIP is 1, and for a B picture, the number of motion information candidates in MHBSKIP is 3. Therefore, when the picture type of the current picture is a P picture, the sum of the maximum value of NumOfMvapCand and NumOfHmvpCand and 1 may be determined as maxVal. When the picture type of the current picture is a B picture, the sum of the maximum value of NumOfMvapCand and NumOfHmvpCand and 3 may be determined as maxVal.
[0125] When the picture type is a P picture, the value of the number of motion information candidates in MHBSKIP is 1, and the determined maxVal is lower than the realization method that does not consider the picture type and directly sets the number of motion information candidates in MHBSKIP to 3. Therefore, it is possible to save the bit cost 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] Exemplarily, when the decoding device determines maxVal in the above manner, it may analyze the motion information index value of the skip mode or direct mode of the current coding unit using the truncated unary inverse binarization manner based on the determined maxVal. Exemplarily, the correspondence relationship between maxVal and the motion information index value of the skip mode or direct mode may refer to the related information listed in Table 1.
[0127] In some embodiments, in step S720, determining a prediction mode for the current coding unit based on a motion information index value of the skip mode or direct mode of the current coding unit and the candidate list may include determining a prediction mode for the current coding unit based on the number of valid angular prediction modes and a motion information index value of the skip mode or direct mode.
[0128] Exemplarily, 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 decoding device may determine the prediction mode of the current coding unit 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 a 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 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] Exemplarily, 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. Exemplarily, 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] Exemplarily, 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 the 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 the 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 the motion vector angle prediction mode.
[0135] When ValidMvapModeNum is equal to 0, or when 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, i.e., when the motion vector angle prediction mode has not generated a motion information candidate, or the motion information candidate corresponding to the motion information index value of the 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 encoding 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] Exemplarily, 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 the above conditions, the decoding device may update the historical motion information list (HmvpCandList). Exemplarily, the decoding device may update the historical 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 being 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 being 0 or the absence of the enable flag for enhanced temporal motion vector prediction and motion vector angle prediction 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] Exemplarily, 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 motion information of the current coding unit and a skip mode or direct mode motion information index value of the current coding unit.
[0149] In step S910, motion compensation is performed on 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, 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 history motion information candidates for inter prediction are obtained.
[0154] In step S932, a motion information index value of skip mode or direct mode of the current coding unit is coded based on the number of motion information candidates of the motion vector angle prediction and the number of history motion information candidates of the inter prediction, 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 the motion information index value 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] Exemplarily, when the encoding device needs to encode a motion information index value, it may obtain NumOfMvapCand and NumOfHmvpCand. Exemplarily, the encoding device may determine NumOfMvapCand and NumOfHmvpCand by encoding a high-level syntax at a sequence level.
[0157] In an embodiment of the present invention, the encoding 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 a step 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 a step of 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 a 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 less than or equal to 11.
[0161] As an example, 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 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 the 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 the encoding and decoding costs and improving the 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 illustrative purposes, it is considered that the number of MHBSKIP motion information candidates corresponding to different image types may be different, e.g., 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 the skip mode or direct mode motion information index value, the image type may be taken into consideration when encoding the skip mode or direct mode motion information index value, 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 and 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] Exemplarily, 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] As an example, consider that for a P picture, the number of motion information candidates in MHBSKIP is 1, and for a B picture, the number of motion information candidates in MHBSKIP is 3.
[0170] Therefore, if the picture type of the current picture is a P picture, the sum of the maximum value of NumOfMvapCand and NumOfHmvpCand and 1 may be determined as maxVal.
[0171] If the picture type of the current picture is a B picture, the sum of the maximum value of NumOfMvapCand and NumOfHmvpCand and 3 may be determined as maxVal.
[0172] When the picture type is a P picture, the value of the number of motion information candidates in MHBSKIP is 1, and the determined maxVal is lower than the realization method that does not consider the picture type and directly sets the number of motion information candidates in MHBSKIP to 3. Therefore, it is possible to save the bit cost 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] Exemplarily, 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 scheme based on the determined maxVal.
[0174] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present invention, the technical solutions provided by the embodiments of the present invention are described below in conjunction 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] Then, 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 and 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. Build a candidate list of skip mode or direct mode, traverse each prediction mode in the candidate list of prediction modes in order, and for each prediction mode, obtain motion information of the current coding unit and a skip mode or direct mode motion information index value of the current coding unit.
[0180] 1.2. Perform motion compensation on the current coding unit based on the motion information of 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 prediction mode candidates, 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 sent to the decoding side. (Embodiment 2, Decoding Method and Decoding Apparatus)
[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. Build a candidate list for skip or direct mode.
[0185] 2.3. Determine a prediction mode of the current coding unit according to 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] The Encoding Process
[0188] (1) Encode 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 a skip mode or direct mode motion information index value of the current coding unit 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 skip mode or direct mode motion information index value cu_subtype_index of the current coding unit based on NumOfMvapCand and NumOfHmvpCand. (Embodiment 4)
[0193] The Encoding Process
[0194] (1) Encode the sequence-level high-level syntax etmvp_mvap_enable_flag and num_of_hmvp_cand.
[0195] Exemplarily, 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 skip mode or direct mode motion information index value cu_subtype_index of the current coding unit is encoded 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] Exemplarily, 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 skip mode or direct mode motion information index value cu_subtype_index of the current coding unit using the truncated unary de-binarization method.
[0205] Illustratively, maxVal=(3+Max(NumOfMvapCand, NumOfHmvpCand)). (Embodiment 5)
[0206] The Encoding Process
[0207] (1) Encode 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, encode the skip mode or direct mode motion information index value of the current coding unit and add it 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] The Encoding Process
[0213] (1) Encode the sequence-level high-level syntax etmvp_mvap_enable_flag and num_of_hmvp_cand.
[0214] Exemplarily, 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 skip mode or direct mode motion information index value cu_subtype_index of the current coding unit is encoded using the truncated unary binarization method and added to the bitstream.
[0217] Exemplarily, maxVal=((PictureType==1)?(1:3)+Max(NumOfMvapCand,NumOfHmvpCand)), where PictureType represents the picture type of the current picture, and a value of 1 represents 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] Exemplarily, 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 skip mode or direct mode motion information index value cu_subtype_index of the current coding unit using the truncated unary de-binarization method.
[0223] Exemplarily, maxVal=((PictureType==1)?(1:3)+Max(NumOfMvapCand,NumOfHmvpCand)), where PictureType represents the picture type of the current picture, and a value of 1 represents 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) (and the same applies below). (Embodiment 7)
[0225] The Encoding Process
[0226] (1) Encode 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 skip mode or direct mode motion information index value cu_subtype_index of the current coding unit 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] The Encoding Process
[0234] (1) Encode the sequence-level high-level syntax etmvp_mvap_enable_flag and num_of_hmvp_cand.
[0235] Exemplarily, 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 greater than or equal to N+ValidMvapModeNum, it is determined that the type of the current coding unit is HMVP mode.
[0240] Exemplarily, if the current picture is a P-picture, N=2, and if the current picture is a B-picture, N=4.
[0241] (3) The skip mode or direct mode motion information index value cu_subtype_index of the current coding unit 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] Exemplarily, 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 skip mode or direct mode motion information index value cu_subtype_index of the current coding unit 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 greater than or equal to N+ValidMvapModeNum, it is determined that the type of the current coding unit is HMVP mode.
[0252] Exemplarily, if the current picture is a P-picture, N=2, and if the current picture is a B-picture, N=4. (Embodiment 9)
[0253] The Encoding Process
[0254] (1) Encode 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, encode cu_subtype_index and add it 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] The Encoding Process
[0262] (1) Encode the sequence-level high-level syntax etmvp_mvap_enable_flag and num_of_hmvp_cand.
[0263] Exemplarily, 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] Exemplarily, if the current picture is a P-picture, N=2, and if the current picture is a B-picture, N=4.
[0269] (3) The skip mode or direct mode motion information index value cu_subtype_index of the current coding unit is encoded using the truncated unary binarization method and added to the bitstream.
[0270] Exemplarily, maxVal=((PictureType==1)?(1:3)+Max(NumOfMvapCand,NumOfHmvpCand)), where PictureType represents the picture type of the current picture, and a value of 1 represents 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] Exemplarily, 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 skip mode or direct mode motion information index value cu_subtype_index of the current coding unit using the truncated unary de-binarization method.
[0276] Exemplarily, maxVal=((PictureType==1)?(1:3)+Max(NumOfMvapCand,NumOfHmvpCand)), where PictureType represents the picture type of the current picture, and a value of 1 represents 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] Exemplarily, 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 sequence-level high-level syntax etmvp_mvap_enable_flag is encoded and decoded to control ETMVP and MVAP.
[0282] For example, whether to enable ETMVP and MVAP may be marked via 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 encoding 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 historical 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 historical 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, 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, and the current prediction unit is a sub-block temporal motion information prediction unit, 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, and 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 methods for realizing 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 implementing the encoding and decoding in each of the above embodiments may refer to each other.
[0293] The method provided by the present invention is as above. The device provided by the present invention will be described below. FIG. 11 is a schematic diagram showing the structure of a decoding device provided by an embodiment of the present invention, where the decoding device may include: a decoding module 1110 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 1120 for constructing a candidate list of a 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 of 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 of motion vector angle prediction and the number of historical motion information candidates of inter prediction, and 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 of the motion vector angle prediction and the number of historical motion information candidates of 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 parsing a high-level syntax at the sequence level.
[0295] In some embodiments, the decoding module 1110 is specifically used for analyzing an enable flag of enhanced temporal motion vector prediction and motion vector angle prediction, and determining the number of motion information candidates for the motion vector angle prediction based on the value of the enable flag of the 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 the inter prediction based on the value of the index of the number of historical motion information candidates for inter prediction, where the enable flag of 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, N=2, and if the picture type of the current picture is a B-picture, 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 to 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 when the value of the enhanced temporal motion vector prediction and motion vector angle prediction enable flag is 1, and determine that the number of motion information candidates for the motion vector angle prediction is 0 when 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] FIG. 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 encoding unit and a skip mode or direct mode motion information index value of the current encoding unit; a compensation module 1220 for performing motion compensation on the current encoding unit based on the motion information of the current encoding unit; a decision module 1230 for calculating a rate-distortion cost value corresponding to the prediction mode, comparing the rate-distortion cost value with the cost values of other prediction mode candidates, 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 encoding unit corresponding to the prediction mode with the smallest rate-distortion cost value to a bitstream and transmitting it to the 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 a 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 with each other 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), a volatile memory, a non-volatile memory, a 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, a DVD, etc.), or a similar storage medium, or a combination thereof.
[0309] In some embodiments, there is further provided a machine-readable storage medium having machine-executable instructions stored thereon, which, when executed by a processor, implements the above-mentioned decoding method of the decoding device. For example, the machine-readable storage medium may be a ROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[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 with each other 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), a volatile memory, a non-volatile memory, a 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, a DVD, etc.), or a similar storage medium, or a combination thereof.
[0312] In some embodiments, there is further provided a machine-readable storage medium having machine-executable instructions stored thereon, the machine-executable instructions being, when executed by a processor, to implement the encoding method of the encoding device described above. In some embodiments, there is further provided 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 only 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", "contains", 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, an element qualified by the phrase "comprises a ..." does not exclude the presence of further identical elements in the process, method, article, or device that includes said element.
[0314] The above description is only a preferred embodiment of the present invention, and is not intended to 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 candidate list for skip mode or direct mode; determining 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; 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; Wherein, the step of analyzing the motion information index value of the skip mode or direct mode of the current coding unit includes: obtaining a number of motion information candidates for motion vector angle prediction and a number of history motion information candidates for inter prediction; determining a motion information index value of the current coding unit in skip mode or direct mode according to a number of motion information candidates of the motion vector angle prediction and a number of history motion information candidates of the inter prediction; 4. 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: The method includes a step of obtaining the number of motion information candidates of the motion vector angle prediction and the number of history motion information candidates of the inter prediction by analyzing a high-level syntax of a sequence level.
2. The method of claim 1 .
3. The step of obtaining the number of motion information candidates of the motion vector angle prediction and the number of history motion information candidates of the inter prediction by analyzing a high-level syntax of a sequence level includes: analyzing an enable flag of enhanced temporal motion vector prediction and motion vector angle prediction, and determining a number of motion information candidates of the motion vector angle prediction according to a value of the enable flag of the enhanced temporal motion vector prediction and the motion vector angle prediction; Analyzing an index of a number of historical motion information candidates of the inter prediction, and determining a number of historical motion information candidates of the inter prediction based on a value of the index of the number of historical motion information candidates of the inter prediction; Here, the enable flag of the enhanced temporal motion vector prediction and the motion vector angle prediction is used to indicate that the enhanced temporal motion vector prediction mode and the motion vector angle prediction mode are simultaneously turned on, or the enhanced temporal motion vector prediction mode and the motion vector angle prediction mode are simultaneously turned off.
3. The method of claim 2 .
4. The step of determining a motion information index value of the current coding unit in skip mode or direct mode based on a number of motion information candidates of the motion vector angle prediction and a number of history motion information candidates of the inter prediction includes: determining a motion information index value of the current coding unit in skip mode or direct mode based on a number of motion information candidates of the motion vector angle prediction, a number of historical motion information candidates of the inter prediction, and an image type of the current image; The method according to any one of claims 1 to 3.
5. The step of determining a motion information index value of the current coding unit in skip mode or direct mode based on a number of motion information candidates of the motion vector angle prediction, a number of history motion information candidates of the inter prediction, and an image type of the current image, includes: determining a maximum index value based on a number of motion information candidates of the motion vector angle prediction, a number of historical motion information candidates of 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 de-binarization scheme based on the maximum index value.
5. The method of claim 4.
6. The step of determining a maximum 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, includes: determining a maximum value among a number of motion information candidates of the motion vector angle prediction and a number of history motion information candidates of 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.
6. The method of claim 5 .
7. Determining 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, determining 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 the direct mode; The method according to any one of claims 1 to 6.
8. determining whether a prediction mode of the current coding unit is a motion vector angle prediction mode or a motion vector prediction mode based on history information according to a number of valid angle prediction modes and a motion information index value of the skip mode or direct mode, If the motion information index value of the skip mode or direct mode is equal to or greater than N, When the number of the 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 the valid angular prediction modes, determining that the prediction mode of the current coding unit is a motion vector angular prediction mode; determining that the prediction mode of the current coding unit is a motion vector prediction mode based on history information when the number of valid angular prediction modes is equal to 0 or when the motion information index value of the skip mode or direct mode is equal to or greater than the sum of N and the number of valid angular prediction modes; 8. The method of claim 7.
9. If the picture type of the current picture is a P-picture, N=2; if the picture type of the current picture is a B-picture, N=4.
9. The method of claim 8.
10. After determining a prediction mode for the current coding unit, When the prediction mode of the current coding unit is a motion vector prediction mode based on history information, if the current coding unit is an inter prediction unit, and is not an affine prediction unit, and is not an angle weighting 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 a number of history motion information candidates of the inter prediction is greater than 0, updating a history motion information list; otherwise, not updating the history motion information list. The method according to any one of claims 7 to 9.
11. The step of determining the number of motion information candidates of the motion vector angle prediction based on the value of the enable flag of the enhanced temporal motion vector prediction and the motion vector angle prediction includes: 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, the value of the enable flag for the enhanced temporal motion vector prediction and the motion vector angle prediction being 1 indicates that the enhanced temporal motion vector prediction and the motion vector angle prediction can be used for the current coding unit; determining that a number of motion information candidates for the motion vector angle prediction is 0 if a 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, wherein the value of the enable flag for the enhanced temporal motion vector prediction and the motion vector angle prediction being 0 or the enable flag for the enhanced temporal motion vector prediction and the motion vector angle prediction being not present in the bitstream indicates that the enhanced temporal motion vector prediction and the motion vector angle prediction should not be used for the current coding unit.
4. The method according to claim 3 .
12. building 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; 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 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 sending the motion information index value to a decoding side; wherein the step of 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 the bitstream includes: obtaining a number of motion information candidates for motion vector angle prediction and a 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 a number of motion information candidates of the motion vector angle prediction and a number of history motion information candidates of the inter prediction, and adding the motion information index value to a bitstream.
13. An encoding method comprising:
13. The step of encoding a skip mode or direct mode motion information index value of the current coding unit according to a number of motion information candidates of the motion vector angle prediction and a number of history motion information candidates of the inter prediction includes: determining a maximum index value based on a number of motion information candidates of the motion vector angle prediction and a number of history motion information candidates of the 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.
13. The method of claim 12.
14. The step of determining a maximum index value based on the number of motion information candidates of the motion vector angle prediction and the number of history motion information candidates of the inter prediction includes: determining the maximum index value based on a number of motion information candidates of the motion vector angle prediction, a number of historical motion information candidates of the inter prediction, and an image type of a current image; 14. The method of claim 13.
15. The step of encoding a skip mode or direct mode motion information index value of the current coding unit according to a number of motion information candidates of the motion vector angle prediction and a number of history motion information candidates of the inter prediction includes: determining a maximum index value based on a number of motion information candidates of the motion vector angle prediction, a number of historical motion information candidates of the inter prediction, and an image type of a current image; 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.
13. The method of claim 12.
16. The step of determining a maximum 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 an image type of a current image, includes: determining a maximum value among a number of motion information candidates of the motion vector angle prediction and a number of history motion information candidates of 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.
16. The method of claim 15 .
17. a decoding module for receiving a bitstream and analyzing a skip mode or direct mode motion information index value of a current coding unit; a construction module for constructing a skip mode or direct mode candidate list; a determination module for determining 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; is used to determine a motion information index value of the current coding unit in skip mode or direct mode according to the number of motion information candidates of the motion vector angle prediction and the number of history motion information candidates of the inter prediction. A decoding device comprising:
18. 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 the 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; and an encoding module for adding a motion information index value of the skip mode or direct mode of the current encoding 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; based on the number of motion information candidates of the motion vector angle prediction and the number of history motion information candidates of the inter prediction, the motion information index value of the skip mode or direct mode of the current coding unit is encoded and added to the bitstream.
13. An encoding device comprising:
19. 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 according to any one of claims 1 to 11. A decoding device comprising:
20. A coding device comprising a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being adapted to execute the machine-executable instructions to perform the method of any one of claims 12 to 16.
13. An encoding device comprising:
21. A machine-readable storage medium storing machine-executable instructions which, when executed by a processor, perform the method of any one of claims 1 to 11 or 12 to 16. 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
