A method and apparatus are disclosed for providing an indication of a
level of distortion created by blocking artifacts in an image comprising
a plurality of pixels, the method comprising for each pixel in a first
given direction, determining a corresponding gradient between the pixel
and a neighboring pixel, for each pixel in the first direction, summing
each of the corresponding determined gradient in a second direction to
provide a plurality of gradient summing values, computing a level of
distortion for each of at least one potential block size using at least
one of the gradient summing values, determining an actual block size
using the computed at least one level of distortion and providing the
level of distortion corresponding to the determined actual block size.