Device and method for affine motion vector prediction using neighboring information
A method for decoding video data and an electronic device for performing the method are provided. The method receives the video data which includes multiple image frames. The method parses the video data to determine a first difference parameter for a first block unit within a current frame of the image frames. The method determines a first motion vector of the first block unit based on a first motion vector predictor of the first block unit, the first difference parameter, and motion vector information of one or more second block units within the current frame stored in the electronic device. The one or more second block units are adjacent to the first block unit. The method then reconstructs the first block unit based on the first motion vector and a reference frame included in the image frames.
1 . A method for decoding video data performed by an electronic device, the method comprising:
receiving the video data comprising a plurality of image frames;
parsing the video data to determine a first difference parameter for a first block unit within a current frame of the plurality of image frames;
determining a first motion vector of the first block unit based on a first motion vector prediction of the first block unit, the first difference parameter, and motion vector information of one or more second block units within the current frame stored in the electronic device, wherein the one or more second block units are adjacent to the first block unit and one of the one or more second block units is coded in an affine advanced motion vector prediction (AMVP) mode; and
reconstructing the first block unit based on the first motion vector and a reference frame included in the plurality of image frames, wherein:
determining the first motion vector comprises calculating the first motion vector of a first control point of the first block unit based on the first motion vector prediction, the first difference parameter, and a first motion vector residual of a second control point of the one of the one or more second block units,
the second control point is associated with the first control point, and
the first motion vector residual comprises a difference between a motion vector of the second control point and a motion vector prediction of the second control point.
2 . The method according to claim 1 , further comprising:
parsing the video data to further determine a second difference parameter for the first block unit within the current frame;
determining a second motion vector of the first block unit based on a second motion vector prediction of the first block unit, the first difference parameter, the second difference parameter, and the motion vector information, wherein
reconstructing the first block unit comprises reconstructing the first block unit based on the first motion vector and the reference frame, and further based on the second motion vector.
3 . The method according to claim 1 , wherein the first difference parameter comprises a difference between a second motion vector residual of the first control point of the first block unit and the first motion vector residual.
4 . The method according to claim 1 , wherein determining the first motion vector of the first block unit further comprises:
parsing the video data to determine an index; and
selecting the one of the one or more second block units based on the index.
5 . The method according to claim 1 , wherein determining the first motion vector of the first block unit further comprises:
determining whether each of the one or more second block units is coded in the affine AMVP mode based on a predefined order; and
selecting the one of the one or more second block units that is first determined to be coded in the affine AMVP mode.
6 . The method according to claim 1 , further comprising:
determining that the first block unit is coded in the AMVP mode.
7 . An electronic device for decoding video data, the electronic device comprising:
at least one processor; and
at least one non-transitory computer-readable medium coupled to the at least one processor and storing one or more computer-executable instructions that, when executed by the at least one processor, cause the electronic device to:
receive the video data comprising a plurality of image frames;
parse the video data to determine a first difference parameter for a first block unit within a current frame of the plurality of image frames;
determine a first motion vector of the first block unit based on a first motion vector prediction of the first block unit, the first difference parameter, and motion vector information of one or more second block units within the current frame stored in the electronic device, wherein the one or more second block units are adjacent to the first block unit and one of the one or more second block units is coded in an affine advanced motion vector prediction (AMVP) mode; and
reconstruct the first block unit based on the first motion vector and a reference frame included in the plurality of image frames, wherein:
determining the first motion vector of the first block unit comprises calculating the first motion vector of a first control point of the first block unit based on the first motion vector prediction, the first difference parameter and a first motion vector residual of a second control point of the one of the one or more second block units,
the second control point is associated with the first control point, and
the first motion vector residual comprises a difference between a motion vector of the second control point and a motion vector prediction of the second control point.
8 . The electronic device according to claim 7 , wherein the one or more computer-executable instructions, when executed by the at least one processor, further cause the electronic device to:
parse the video data to further determine a second difference parameter for the first block unit within the current frame;
determine a second motion vector of the first block unit based on a second motion vector prediction of the first block unit, the first difference parameter, the second difference parameter, and the motion vector information, wherein
reconstructing the first block unit comprises reconstructing the first block unit based on the first motion vector and the reference frame, and further based on the second motion vector.
9 . The electronic device according to claim 7 , wherein the first difference parameter comprises a difference between a second motion vector residual of the first control point of the first block unit and the first motion vector residual.
10 . The electronic device according to claim 7 , wherein determining the first motion vector of the first block unit further comprises:
parsing the video data to determine an index; and
selecting the one of the one or more second block units based on the index.
11 . The electronic device according to claim 7 , wherein determining the first motion vector of the first block unit further comprises:
determining whether each of the one or more second block units is coded in the affine AMVP mode based on a predefined order; and
selecting the one of the one or more second block units that is first determined to be coded in the affine AMVP mode.
12 . The electronic device according to claim 7 , wherein the one or more computer-executable instructions, when executed by the at least one processor, further cause the electronic device to:
determine that the first block unit is coded in the AMVP mode.