A grid detector detects the existence and the location of grids in DCT
compressed videos. When a grid is detected in the input video, a
post-processor is turned on and the de-blocking processing is applied on
the grid detected by the grid detector. When no grid is detected,
indicating that the input video is either an uncompressed video or an
already de-blocked video, post-processing turned off to avoid degrading
the picture quality. To detect grids, the grid detector: (a) computes
horizontal and vertical second derivatives for all pixels of the image;
(b) generates horizontal second derivative zero-crossing mask and
vertical second derivative zero-crossing mask by marking the those pixels
whose second derivatives have opposite signs with respect to their
horizontal or vertical neighboring pixels'; (c) applies horizontal and
vertical integral projections to the horizontal and vertical
zero-crossing masks respectively; (d) generates the local maximum masks
by locating the local maximum of the two projected 1-D signals; and (e)
determines grid location by computing the positions of the local maximum
masks.