Method and apparatus for encoding/decoding images using a motion vector
The present invention relates to image processing, and more particularly, to a video coding/decoding method using a clipped motion vector and an apparatus thereof. An embodiment of the present invention relates to a method of decoding an image. The method includes clipping a motion vector of a reference picture in a predetermined dynamic range to generate a clipped motion vector, storing the clipped motion vector in a buffer, deriving a motion vector of a coding treeblock using the motion vector stored in the buffer, and performing inter prediction decoding process using the motion vector of the coding treeblock. According to the exemplary embodiment of the present invention, a size of a memory required for storing motion vectors may be reduced.
1. An image decoding apparatus, comprising:
a reference picture buffer for storing a reference picture; and
a motion compensating unit for generating a prediction block using the reference picture and a motion vector of the reference picture;
a decoder to generate a residual block of a current block in a current picture by decoding a bitstream; and
one or more processors configured to
calculate a scaling factor for the current block based on a picture order count of a reference picture,
clip the scaling factor in a first predetermined range,
scale the motion vector of the reference picture based on the clipped scaling factor,
clip the scaled motion vector of the reference picture in a second predetermined range which is defined as a predetermined fixed value range,
obtain first motion vector resolution information from a sequence parameter set within the bitstream, wherein the first motion vector resolution information in the sequence parameter set specifies a first motion vector resolution,
obtain second motion vector resolution information, from a slice header of a current slice within the bitstream, specifying whether a second motion vector resolution for all blocks in the current slice is an integer pixel unit,
modify the clipped scaled motion vector of the reference picture based on a motion vector resolution derived by the first motion vector resolution information and the second motion vector resolution information,
generate a prediction block of the current block based on the reference picture and the clipped scaled motion vector of the reference picture, and
reconstruct the current block by adding the prediction block and the residual block;
wherein the motion vector of the reference picture is a motion vector of a collocated block in the reference picture,
wherein the collocated block is determined by performing:
calculating a first position corresponding to a right-bottom position representing a position displaced from an upper-left position of the current block in the current picture by the current block's height and width,
determining a first block covering the first position in the reference picture,
determining whether the first block is coded in an intra prediction mode,
calculating, when the first is coded in the intra prediction mode, a second position corresponding to a central position of the current block in the current picture,
modifying the second position based on an arithmetic shift operation, and
determining a second block covering the modified second position in the reference picture,
wherein the clipped scaled motion vector of the reference picture is a motion vector that a resolution is modified based on a specific pixel unit specified by motion vector resolution information.
2. An image encoding apparatus, comprising:
one or more processors to generate a motion vector of a current block in a current picture and a prediction block of the current block based on a reference picture; and
an encoder configured to
calculate a scaling factor for a current block of a current picture based on a picture order count of the reference picture,
clip the scaling factor in a first predetermined range,
scale a motion vector of the reference picture based on the clipped scaling factor,
clip the scaled motion vector of the reference picture in a second predetermined range which is defined as a predetermined fixed value range,
determine first motion vector resolution information to be encoded in a sequence parameter set, wherein the first motion vector resolution information in the sequence parameter set specifies a first motion vector resolution,
determine second motion vector resolution information specifying whether a second motion vector resolution for all blocks in a current slice is an integer pixel unit,
modify the clipped scaled motion vector of the reference picture based on a motion vector resolution derived by the first motion vector resolution information and second motion vector resolution information,
encode the motion vector of the current based on the clipped scaled motion vector of the reference picture,
encode a residual block of the current block generated by subtracting the prediction block from the current block, and
generate a bitstream based on the encoded motion vector of the current block and the encoded residual block,
wherein the motion vector of the reference picture is a motion vector of a collocated block in the reference picture,
wherein the collocated is determined by performing:
calculating a first position corresponding to a right-bottom position representing a position displaced from an upper-left position of the current block in the current picture by the current block's height and width,
determining a first block covering the first position in the reference picture,
determining whether the first block is coded in an intra prediction mode,
calculating, when the first block is coded in the intra prediction mode, a second position corresponding to a central position of the current block in the current picture,
modifying the second position based on an arithmetic shift operation, and
determining a second block covering the modified second position in the reference picture,
wherein the clipped scaled motion vector of the reference picture is a motion vector that a resolution is modified based on a specific pixel unit specified by motion vector resolution information,
wherein the motion vector resolution information specifies whether a motion vector resolution for motion vectors in a current slice is an integer pixel unit,
wherein the first motion vector resolution information is included in the sequence parameter set within the bitstream,
wherein the second motion vector resolution information is included in a slice header of the current slice within the bitstream.
3. A non-transitory computer-readable storage medium storing a bitstream generated by an image encoding apparatus, the image encoding apparatus comprising:
one or more processors to generate a motion vector of a current block in a current picture and a prediction block of the current block based on a reference picture; and
an encoder configured to
calculate a scaling factor based on a picture order count of the reference picture,
clip the scaling factor in a first predetermined range,
scale a motion vector of the reference picture based on the clipped scaling factor,
clip the scaled motion vector of the reference picture in a second predetermined range which is defined as a predetermined fixed value range,
determine first motion vector resolution information to be encoded in a sequence parameter set, wherein the first motion vector resolution information in the sequence parameter set specifies a first motion vector resolution,
determine second motion vector resolution information specifying whether a second motion vector resolution for all blocks in a current slice is an integer pixel unit,
modify the clipped scaled motion vector of the reference picture based on a motion vector resolution derived by the first motion vector resolution information and second motion vector resolution information,
encode the motion vector of the current block based on the clipped scaled motion vector of the reference picture,
encode a residual block of the current block generated by subtracting the prediction block from the current block, and
generate the bitstream based on the encoded motion vector of the current block and the encoded residual block,
wherein the motion vector of the reference picture is a motion vector of a collocated block in the reference picture,
wherein the collocated block is determined by performing:
calculating a first position corresponding to a right-bottom position representing a position displaced from an upper-left position of the current block in the current picture by the current block's height and width,
determining a first block covering the first position in the reference picture,
determining whether the first block is coded in an intra prediction mode,
calculating, when the first block is coded in the intra prediction mode, a second position corresponding to a central position of the current block in the current picture,
modifying the second position based on an arithmetic shift operation, and
determining a second block covering the modified second position in the reference picture,
wherein the clipped scaled motion vector of the reference picture is a motion vector that a resolution is modified based on a specific pixel unit specified by motion vector resolution information,
wherein the motion vector resolution information specifies whether a motion vector resolution for motion vectors in a current slice is an integer pixel unit,
wherein the first motion vector resolution information is included in the sequence parameter set within the bitstream,
wherein the second motion vector resolution information is included in a slice header of the current slice within the bitstream.
4. An image decoding method, characterized by comprising:
calculate a scaling factor for a current block based on a picture order count of a reference picture;
clipping the scaling factor in a first predetermined range;
scaling a motion vector of the reference picture based on the clipped scaling factor;
clipping the scaled motion vector of the reference picture in a second predetermined range which is defined as a predetermined fixed value range; and
obtaining first motion vector resolution information from a sequence parameter set within the bitstream, wherein the first motion vector resolution information in the sequence parameter set specifies a first motion vector resolution,
obtaining second motion vector resolution information, from a slice header of a current slice within the bitstream, specifying whether a second motion vector resolution for all blocks in the current slice is an integer pixel unit,
modifying the clipped scaled motion vector of the reference picture based on a motion vector resolution derived by the first motion vector resolution information and second motion vector resolution information,
deriving a motion vector of the current block using the clipped scaled motion vector;
performing inter prediction using the motion vector of the current block to generate a prediction block of the current block based on the reference picture and the clipped scaled motion vector of the reference picture, and
reconstructing the current block by adding the prediction block and the residual block;
wherein the motion vector of the reference picture is a motion vector of a collocated block in the reference picture, wherein the motion vector of the collocated block is determined by performing:
calculating a first position corresponding to a right-bottom position representing a position displaced from an upper-left position of the current block in the current picture by the current block's height and width,
determining a first block covering the first position in the reference picture,
determining whether the first block is coded in an intra prediction mode,
calculating, when the first block is coded in the intra prediction mode, a second position corresponding to a central position of the current block in the current picture,
modifying the second position based on an arithmetic shift operation, and
determining a second block covering the modified second position in the reference picture,
wherein the clipped scaled motion vector of the reference picture is a motion vector that a resolution is modified based on a specific pixel unit specified by motion vector resolution information.