A method includes calculating a mean of a plurality of pixels of a motion
window, calculating a pixel amount of pixels similar to a center pixel,
calculating a variance of the pixels, determining whether a difference
between the center pixel and the mean is greater than a first
predetermined value, determining whether the pixel amount similar to the
center pixel is greater than a second predetermined value if the
difference between the center pixel and the mean is not greater than the
first predetermined value, determining whether the variance is smaller
than a threshold value if the pixel amount similar to the center pixel is
not greater than the second predetermined value, and filtering the center
pixel according to a result of determining whether the variance is
smaller than the threshold value. Finally, temporal weighted mean filters
involving motion estimation are used for motion compensation in images
after spatial filtering.