First, for an M-th candidate in the derived merging candidate list mergeCandList, determination is made as to whether a candidate M has motion information of the motion information list L0 (step S3601). In a case where the candidate M has the motion information of the motion information list L0, the motion information of the motion information list L0 of the candidate M is set as a triangle merging candidate (step S3602). For candidates M (M=0, 1, . . . , numMergeCand?1), steps S3601 and step S3602 are performed in ascending order, and triangle merging candidates are additionally derived.
Subsequently, for the M-th candidate in the derived merging candidate list mergeCandList, determination is made as to whether the candidate M has motion information of the motion information list L1 (step S3603). In a case where the candidate M has the motion information of the motion information list L1, the motion information of the motion information list L1 of the candidate M is set as a triangle merging candidate (step S3604). For candidates M (M=numMergeCand?1, . . . , 1, 0), steps S3603 and step S3604 are performed in descending order, and triangle merging candidates are additionally derived.