Substituting the horizontal optical flow vx and the vertical optical flow vy calculated in this way into Equation 11 produces a prediction block of the current block. When the horizontal optical flow is skipped, vx=0 in Equation 11, and therefore the horizontal optical flow vx does not contribute to generating the prediction block. Similarly, when the vertical optical flow is skipped, vy=0, and therefore the vertical optical flow vy does not contribute to generating the prediction block. When both the horizontal and vertical optical flows are skipped, vx=0 and vy=0, and therefore a prediction block is generated by averaging the first reference block and the second reference block. That is, the prediction block is generated through typical motion compensation.