Method for encoding and decoding images, and device using same
According to the present invention, an inter-prediction method includes: receiving mode information on the inter-prediction of a current block; decoding the received mode information; and performing inter-prediction using the decoded mode information. According to the present invention, image compression efficiency may be improved.
1. A method for inter prediction, comprising:
receiving, by a decoding apparatus, mode information on an inter prediction of a current block, wherein the mode information includes merge flag information indicating whether an inter prediction mode for the current block is a merge mode;
deriving, by the decoding apparatus, merge candidates of the current block based on neighboring blocks of the current block;
selecting, by the decoding apparatus, a merge candidate from the derived merge candidates;
deriving, by the decoding apparatus, a motion vector of the current block as to be equal to a motion vector of the selected merge candidate; and
generating, by the decoding apparatus, a prediction sample of the current block based on the motion vector of the current block,
wherein the neighboring blocks includes a left neighboring block, an upper neighboring block, an upper-right corner neighboring block, an upper-left corner neighboring block, and a lower-left corner neighboring block of the current block.
2. The method of claim 1 , wherein the mode information includes residual flag information indicating whether there is a residual signal for the current block, and wherein the residual flag information is received prior to the merge flag information.
3. The method of claim 2 , wherein the merge candidates has the same configuration regardless whether there is the residual signal for the current block.
4. The method of claim 2 , wherein the derived motion vector is one of L 0 motion vector for forward prediction, L 1 motion vector for backward prediction, and Bi motion vector for bi prediction.
5. The method of claim 2 , wherein the left neighboring block is a bottom-most block among left neighboring blocks adjacent to the left boundary of the current block, and the top neighboring block is a right-most block among upper neighboring blocks adjacent to the upper boundary of the current block.
6. The method of claim 1 , wherein the neighboring blocks further includes a co-located block which is a block at the same position as the current block among blocks in a reference picture.
7. The method of claim 2 , wherein decoding the received mode information comprises:
decoding the merge flag information prior to the residual flag information; and
decoding the residual flag information only when the decoded merge flag information indicates that the inter prediction mode for the current block is the merge mode.
8. A decoding apparatus for decoding video, comprising:
an entropy decoder configured to receive mode information on an inter prediction of a current block, wherein the mode information includes merge flag information indicating whether an inter prediction mode for the current block is a merge mode;
a predictor configured to derive merge candidates of the current block based on neighboring blocks of the current block, to select a merge candidate from the derived merge candidates, to derive a motion vector of the current block as to be equal to a motion vector of the selected merge candidate, and to generate a prediction sample of the current block based on the motion vector of the current block,
wherein the neighboring blocks includes a left neighboring block, an upper neighboring block, an upper-right corner neighboring block, an upper-left corner neighboring block, and a lower-left corner neighboring block of the current block.
9. The apparatus of claim 8 , wherein the mode information includes residual flag information indicating whether there is a residual signal for the current block, and
wherein the residual flag information is received prior to the merge flag information.
10. The apparatus of claim 9 , wherein the merge candidates has the same configuration regardless whether there is the residual signal for the current block.
11. The apparatus of claim 9 , wherein the derived motion vector is one of L 0 motion vector for forward prediction, L 1 motion vector for backward prediction, and Bi motion vector for bi prediction.
12. The apparatus of claim 9 , wherein the left neighboring block is a bottom-most block among left neighboring blocks adjacent to the left boundary of the current block, and the top neighboring block is a right-most block among upper neighboring blocks adjacent to the upper boundary of the current block.
13. The apparatus of claim 8 , wherein the neighboring blocks further includes a co-located block which is a block at the same position as the current block among blocks in a reference picture.
14. The apparatus of claim 9 , wherein an entropy decoder decodes the received mode information:
wherein the merge flag information is decoded prior to the residual flag information; and
wherein the residual flag information is decoded only when the decoded merge flag information indicates that the inter prediction mode for the current block is the merge mode.