Patent ID: 8345770

Claim:
A method for coding an image on a macroblock basis, said image being divided into a plurality of macroblocks, the method comprising: generating a motion compensated image from a reference image; obtaining a motion compensation error between an input image and the motion compensated image; coding the motion compensation error; decoding the coded motion compensation error to obtain a decoded motion compensation error; adding the decoded motion compensation error and the motion compensated image to obtain a reconstructed image; removing a coding distortion in the reconstructed image to obtain a coding distortion removed image; and storing the coding distortion removed image as a reference image, to code a following input image, wherein, in the case of removing a coding distortion in pixels of two adjacent transform blocks which are located inside a single macroblock in the reconstructed image and have a motion compensation error equal to zero, the transform blocks being units for which a frequency transform is applied, removing the coding distortion comprises: determining whether a coded motion compensation error of motion compensation blocks in which the two adjacent transform blocks are included is equal to zero, each of the two adjacent motion-compensation blocks being a unit for which a motion compensation is applied; switching on removing block coding distortion when the decoded motion compensation error of the motion compensation blocks in which the two adjacent transform blocks are included is not equal to zero and switching off removing block coding distortion when the decoded motion compensation error of the motion compensation blocks in which the two adjacent transform blocks are included is equal to zero; and removing block coding distortion in pixels of a boundary between the two adjacent transform blocks, wherein the switching switches on the removing when a block boundary of the two adjacent transform blocks is a boundary of two adjacent motion-compensation blocks even if the decoded motion compensation error of the motion compensation blocks in which the two adjacent transform blocks are included is equal to zero, and switches off the removing when a block boundary of the two adjacent transform blocks is a boundary of two adjacent transform blocks located inside either one of the two adjacent motion-compensation blocks, and wherein a block size of each of the two adjacent motion-compensation blocks is smaller than a block size of a macroblock, and a block size of each of the two adjacent motion-compensation blocks is greater than a block size of a transform block.