A filtering apparatus calculates a median of image data that includes nine
pixel values arranged in a window of 3*3. First, an input circuit
receives as an input the image data, divides the data into groups each
having three pixels, and outputs. The pixel values of each group are
sorted in accordance with magnitude order, by a plurality of sorters.
After sorting, the maximum values among the pixel values of the groups
are determined by a plurality of shifters and a plurality of maximum
value determiners, and the determined pixel values are removed from the
corresponding groups. As a result, four largest pixel values are removed
from the three groups. A last sorter extracts and outputs the maximum
pixel value (median) from the remaining five pixel values.