An image processing device comprising motion compensation means for performing motion compensation by using a motion vector of an encoded image, with a frame formed of a decoded image serving as a reference frame to generate a motion compensation image corresponding to a prediction image; characterized in further comprising filtering means for generating the prediction image by performing a filtering process on motion compensation images (MC0, MC1, MC2), wherein each motion compensation image (MC0, MC1, MC2) is extracted from a different reference frame (R0, R1, R2), wherein the motion compensation means is configured to extract a first motion compensation image from a first reference frame using the motion vector, and to extract a second motion compensation image by extracting a first portion that matches or is similar to the first motion compensation image from a second reference frame by using a certain cost function that is shared by a decoding device that decodes an encoded image, the portion serving as a second motion compensation image corresponding to the prediction image, and to extract a third motion compensation image by extracting a further portion that matches or is similar to the first motion compensation image from a third reference frame by using the certain cost function, the portion serving as a third motion compensation image corresponding to the prediction image, wherein the filtering process is performed by adding to the first motion compensation image a first image representing a high frequency component obtained from a difference image between the first motion compensation image and an intermediate output image generated by performing a further filtering process on the second motion compensation image and the third motion compensation image by adding a second image representing a high frequency component obtained from a further difference image between the second motion compensation image and the third motion compensation image. further comprising filtering means for generating the prediction image by performing a filtering process on motion compensation images (MC0, MC1, MC2), wherein each motion compensation image (MC0, MC1, MC2) is extracted from a different reference frame (R0, R1, R2), wherein the motion compensation means is configured to extract a first motion compensation image from a first reference frame using the motion vector, and to extract a second motion compensation image by extracting a first portion that matches or is similar to the first motion compensation image from a second reference frame by using a certain cost function that is shared by a decoding device that decodes an encoded image, the portion serving as a second motion compensation image corresponding to the prediction image, and to extract a third motion compensation image by extracting a further portion that matches or is similar to the first motion compensation image from a third reference frame by using the certain cost function, the portion serving as a third motion compensation image corresponding to the prediction image, wherein the filtering process is performed by adding to the first motion compensation image a first image representing a high frequency component obtained from a difference image between the first motion compensation image and an intermediate output image generated by performing a further filtering process on the second motion compensation image and the third motion compensation image by adding a second image representing a high frequency component obtained from a further difference image between the second motion compensation image and the third motion compensation image.