The merging candidate selector 347 compares calculated pluralities of code amounts and distortion amounts, thereby selecting coding block splitting directions and triangle merging candidates of divided partitions. In a case where encoding is performed using the triangle merge mode, the merging candidate selector 347 supplies selected information (the coding block splitting directions merge_triangle_split_dir and merge triangle indexes merge_triangle_idx0, merge_triangle_idx1 indicating the triangle merging candidates of the divided partitions) and inter prediction information of the triangle merging candidates to the motion compensation prediction unit 306. The bit strings coding unit 108 encodes the selected information.
On the other hand, in the case of the triangle merge mode, the merging candidate selector 447 on the decoding side selects triangle merging candidates based on decoded information (the coding block splitting directions merge_triangle_split_dir and the merge triangle indexes merge_triangle_idx0 and merge_triangle_idx1 indicating the triangle merging candidates of the divided partitions) and supplies inter prediction information of the selected triangle merging candidates to the motion compensation prediction unit 406.
In the case of the triangle merge mode, the motion compensation prediction units 306 and 406 perform weighted averaging described below. In the case of luminance, the motion compensation prediction units 306 and 406 calculate nCbR=(nCbW>nCbH) ? (nCbW/nCbH):(nCbH/nCbW) with respect to width nCbW and height nCbH of the coding block. Then, in a position (x, y) in the coding block, weight wValue in the case of
(Clip3(0, 8, x/nCbR?y+4)):