Image decoding method and image decoding apparatus using candidate motion vectors
A decoding method and apparatus are provided. A first candidate having a first motion vector that has been used to decode a first block, a first prediction direction that corresponds to the first motion vector, and a first reference picture index that identifies a first reference picture is derived. A second candidate having a second motion vector that has been used to decode a second block, a second prediction direction that corresponds to the second motion vector, and a second reference picture index that identifies a second reference picture is derived. When a total number of candidates is less than a maximum number, a third candidate is derived by combining the first motion vector and the first reference picture index for the first prediction direction of the first candidate and the second motion vector and the second reference picture index for the second prediction direction of the second candidate.
1. An image decoding method for decoding a current block, the image decoding method comprising:
decoding information from a slice header indicative of a maximum number of merging candidates, wherein the slice header corresponds to a slice containing a plurality of blocks including the current block;
deriving a plurality of merging candidates for decoding the current block from a corresponding plurality of blocks that are neighbor or co-located blocks of the current block, each of the plurality of merging candidates having a motion vector for decoding a corresponding one of the plurality of blocks, a prediction direction that corresponds to the motion vector for decoding the corresponding one of the plurality of blocks, and a reference picture index that identifies a reference picture corresponding to the motion vector for decoding the corresponding one of the plurality of blocks;
determining whether a number of the plurality of merging candidates is less than the maximum number of merging candidates;
when it is determined that the number of the plurality of merging candidates is less than the maximum number of merging candidates, deriving a combined merging candidate for bi-directional prediction, by:
assigning the motion vector and the reference picture index of a first merging candidate of the plurality of merging candidates to a first prediction direction of the combined merging candidate, and
assigning the motion vector and the reference picture index of a second merging candidate of the plurality of merging candidates, to a second prediction direction of the combined merging candidate; and
decoding the current block by using a candidate selected from the plurality of merging candidates and the combined merging candidate.
2. The image decoding method of claim 1 , wherein the first merging candidate corresponds to comprises one of a spatial neighboring block of the current block or a co-located block of the current block.
3. The image decoding method of claim 1 , wherein for the second merging candidate corresponds to one of a spatial neighboring block of the current block or a co-located block of the current block.
4. The image decoding method of claim 1 , wherein the first merging candidate corresponds to a spatial neighboring block of the current block and the second merging candidate corresponds to a co-located block of the current block.
5. The image encoding method of claim 1 , wherein the first merging candidate or the second merging candidate corresponds to a co-located block of the current block coded using bi-directional prediction.
6. The image decoding method of claim 1 , further comprising decoding an index corresponding to the selected candidate, and
wherein the maximum number is used to decode the index from a bitstream.
7. The image decoding method of claim 1 , wherein deriving the plurality of merging candidates includes excluding any derived merging candidate that is identical to another derived merging candidate from the plurality of merging candidates before determining whether the total number of the plurality of merging candidates is less than the maximum number.
8. The image decoding method of claim 1 , wherein deriving the plurality of merging candidates includes excluding an unusable-for-merging candidate from the plurality of merging candidates before determining whether the total number of plurality of merging candidates is less than the maximum number.
9. An image decoding apparatus that decodes a current block, the image decoding apparatus comprising:
a processor;
a memory storing instructions, which when executed by the processor cause the apparatus to:
decode information from a slice header indicative of a maximum number of merging candidates, wherein the slice header corresponds to a slice containing a plurality of blocks including the current block;
derive a plurality of merging candidates for decoding the current block from a corresponding plurality of blocks that are neighbor or co-located blocks of the current block, each of the plurality of merging candidates having a motion vector for decoding a corresponding one of the plurality of blocks, a prediction direction that corresponds to the motion vector for decoding the corresponding one of the plurality of blocks, and a reference picture index that identifies a reference picture corresponding to the motion vector for decoding the corresponding one of the plurality of blocks;
determine whether a number of the plurality of merging candidates is less than the maximum number of merging candidates;
when it is determined that the number of the plurality of merging candidates is less than the maximum number of merging candidates, derive a combined merging candidate for bi-directional prediction, whereby the memory comprises instructions which, when executed by the processor cause the apparatus to:
assign the motion vector and the reference picture index of a first merging candidate of the plurality of merging candidates to a first prediction direction of the combined merging candidate, and
assign the motion vector and the reference picture index of a second merging candidate of the plurality of merging candidates to a second prediction direction of the combined merging candidate; and
decode the current block by using a candidate selected from the plurality of merging candidates and the combined merging candidate.
10. The image decoding apparatus of claim 9 , wherein the first merging candidate comprises corresponds to one of a spatial neighboring block of the current block or a co-located block of the current block.
11. The image decoding apparatus of claim 9 , wherein the second merging candidate corresponds to one of a spatial neighboring block of the current block or a co-located block of the current block.
12. The image decoding apparatus of claim 9 , wherein the first merging candidate corresponds to a spatial neighboring block of the current block and the respective block for the second merging candidate corresponds to a co-located block of the current block.
13. The image decoding apparatus of claim 9 , wherein one of the first merging candidate or the respective block for the second merging candidate corresponds to a co-located block of the current block coded using bi-directional prediction.
14. The image decoding apparatus of claim 9 , comprising instructions which when executed cause the apparatus to decode a coded index corresponding to the selected candidate, and
wherein the maximum number is used to decode the coded index from a bitstream.
15. The image decoding apparatus of claim 9 , wherein deriving the plurality of candidates comprises excluding any derived merging candidate that is identical to another derived merging candidate from the plurality of merging candidates before determining whether the total number of the plurality of merging candidates is less than the maximum number.
16. The image decoding apparatus of claim 9 , wherein deriving the plurality of merging candidates comprises excluding an unusable-for-merging candidate from the plurality of merging candidates before determining whether the total number of the plurality of merging candidates is less than the maximum number.