Adaptive resolution for motion vector difference
This disclosure relates to encoding and decoding of motion vector difference for inter-predicting a video block. An example is disclosed for decoding an inter-predicted video block of a video stream. The method may include determining that a motion vector associated with the inter-predicted video block is encoded as a motion vector difference (MVD) between the motion vector and a reference motion vector; obtaining, from the video stream, an indication of a magnitude range of the MVD among a plurality of predefined magnitude ranges for motion vector differences; determining a pixel resolution for the MVD according to the magnitude range; identifying additional MVD information in the video stream based on the pixel resolution; extracting the additional MVD information from the video stream; and decoding the inter-predicted video block based on the pixel resolution, the additional MVD information, the reference motion vector, and a reference frame associated with the motion vector.
1. A method for decoding an inter-predicted video block of a video bitstream, comprising:
receiving the video bitstream;
determining that the inter-predicted video block is encoded in a compound inter-prediction mode;
determining that only one motion vector difference (MVD) relative to one reference motion vector associated with the inter-predicted video block is signaled in the video bitstream;
obtaining, from the video bitstream, an indication of a magnitude range of the one MVD among a plurality of predefined magnitude ranges for motion vector differences;
determining a pixel resolution for the MVD according to the magnitude range; and
decoding the MVD from the video bitstream based on the pixel resolution for the one MVD.
2. The method of claim 1 , wherein determining the pixel resolution for the one MVD according to the magnitude range comprises:
determining whether the magnitude range of the one MVD is higher than a predetermined MVD magnitude range threshold level; and
when the magnitude range of the one MVD is higher than the predetermined MVD magnitude range threshold level, determining that the pixel resolution is of an integer number of pixels, otherwise determining that the pixel resolution is a fraction of a pixel.
3. The method of claim 2 , wherein decoding the one MVD from the video bitstream based on the pixel resolution for the one MVD comprises:
extracting a set of second syntax elements from the video bitstream for the one MVD, wherein a number of the set of second syntax elements depends on the pixel resolution for the one MVD; and
deriving the one MVD from the set of second syntax elements.
4. The method of claim 2 , wherein the predetermined MVD magnitude range threshold level comprises a lowest or a second lowest of a predefined set of MVD magnitude ranges.
5. The method of claim 1 , wherein obtaining the indication of the magnitude range of the one MVD comprises:
extracting a first predefined syntax element from the video bitstream indicating an MVD class of the one MVD among a predefined set of MVD classes, a lower MVD class corresponding to a smaller MVD magnitude range; and
determining the magnitude range of the one MVD according to the MVD class.
6. The method of claim 5 , wherein determining the pixel resolution for the MVD according to the magnitude range comprises:
determining whether the MVD class of the one MVD is higher than a predetermined MVD class threshold level; and
when the MVD class of the one MVD is higher than the predetermined MVD class threshold level, determining that the pixel resolution is of an integer number of pixels, otherwise determining that the pixel resolution is a fraction of a pixel.
7. The method of claim 6 , wherein decoding the MVD from the video bitstream based on the pixel resolution for the one MVD comprises:
extracting a set of second syntax elements from the video bitstream for the one MVD, wherein a number of the set of second syntax elements depends on the pixel resolution for the one MVD; and
deriving the one MVD from the set of second syntax elements.
8. The method of claim 6 , wherein each of the predefined set of MVD classes having magnitude range higher than the predetermined MVD class threshold level is associated with a single allowed integer MVD pixel value.
9. The method of claim 1 , wherein the plurality of predefined magnitude ranges for motion vector differences are associated, in a predefined manner, with pixel resolutions in a non-ascending order, wherein a higher pixel resolution is associated with a smaller pixel resolution value.
10. An electronic device comprising a memory for storing computer instructions and at least one processor for executing the computer instructions to cause the electronic device to:
determine that a video block is to be predicted under a compound inter-prediction mode using two motion vectors, and that one of the two motion vectors is to be predicted based on a motion vector difference (MVD) relative to a reference motion vector;
determine a magnitude range of the MVD among a plurality of predefined magnitude ranges for motion vector differences;
determine a pixel resolution for the MVD according to the magnitude range; and
encode the MVD into a video bitstream as a single signaled MVD for the video block based on the pixel resolution for the one MVD.
11. The electronic device of claim 10 , wherein the at least one processor is configured to execute the computer instructions to further cause the electronic device to:
generate an indication of the magnitude range of the MVD; and
encode the indication into the video bitstream.
12. The electronic device of claim 11 , wherein the at least one processor is configured to execute the computer instructions to determine the pixel resolution for the MVD according to the magnitude range by:
determining whether the magnitude range of the one MVD is higher than a predetermined MVD magnitude range threshold level; and
when the magnitude range of the MVD is higher than the predetermined MVD magnitude range threshold level, determining that the pixel resolution is of an integer number of pixels, otherwise determining that the pixel resolution is a fraction of a pixel.
13. The electronic device of claim 12 , wherein the at least one processor is configured to execute the computer instructions to encode the MVD into the video bitstream based on the pixel resolution for the MVD by:
determining a set of second syntax elements for the MVD, wherein a number of the set of second syntax elements depends on the pixel resolution for the MVD; and
encoding the set of second syntax elements into the video bitstream.
14. The electronic device of claim 12 , wherein the predetermined MVD magnitude range threshold level comprises a lowest or a second lowest of a predefined set of MVD magnitude ranges.
15. The electronic device of claim 11 , wherein the at least one processor is configured to execute the computer instructions to generate the indication of the magnitude range of the MVD by:
determining an MVD class of the one MVD among a predefined set of MVD classes, a lower MVD class corresponding to a smaller MVD magnitude range; and
generating the indication for signaling the MVD class.
16. The electronic device of claim 15 , wherein the at least one processor is configured to execute the computer instructions to determine the pixel resolution for the MVD according to the magnitude range by:
determining whether the MVD class of the one MVD is higher than a predetermined MVD class threshold level; and
when the MVD class of the one MVD is higher than the predetermined MVD class threshold level, determining that the pixel resolution is of an integer number of pixels, otherwise determining that the pixel resolution is a fraction of a pixel.
17. The electronic device of claim 16 , wherein the at least one processor is configured to execute the computer instructions to encode the MVD into the video bitstream based on the pixel resolution for the MVD by:
determining a set of second syntax elements for the MVD, wherein a number of the set of second syntax elements depends on the pixel resolution for the MVD; and
encoding the set of second syntax elements into the video bitstream.
18. The electronic device of claim 16 , wherein each of the predefined set of MVD classes having magnitude range higher than the predetermined MVD class threshold level is associated with a single allowed integer MVD pixel value.
19. The electronic device of claim 10 , wherein the plurality of predefined magnitude ranges for motion vector differences are associated, in a predefined manner, with pixel resolutions in a non-ascending order, wherein a higher pixel resolution is associated with a smaller pixel resolution value.
20. A method for processing an inter-predicted video block in a compound inter-prediction mode, comprising converting the inter-predicted video block to a video bitstream, wherein the video bitstream comprises:
a first syntax element for indicating that only one motion vector difference (MVD) relative to o reference motion vector associated with the inter-predicted video block is signaled in the video bitstream;
a second syntax element for indicating a magnitude range of the one MVD among a plurality of predefined magnitude ranges for motion vector differences and for indicating an MVD pixel resolution for the one MVD among a plurality of predefined MVD pixel resolutions; and
a third set of syntax elements for encoding the one MVD, the third set of syntax elements being dependent on the MVD pixel resolution for the one MVD.