Newsgroups: comp.parallel
From: dbader@Glue.umd.edu (David Bader)
Subject: Re: Parallel Methods for Median Filtering
Organization: Project Glue, University of Maryland, College Park
Date: Mon, 6 Feb 1995 13:37:38 GMT
Message-ID: <3h2l17$83q@protocol.eng.umd.edu>

In article <3gutsl$1nt@spool.cs.wisc.edu>,
Jeffrey Horn <horn@cs.wisc.edu> wrote:
>I am looking for a parallel algorithm to do median filtering.  One has
>a rectangualr grid of numbers and moves a 3 x 3 or 4 x 4 grid over this
>grid.  A new grid is placed by putting the median of the numbers in the 

Why not try this:

Input:  X[n,m] is the original matrix 
Output: Y[n,m] is the median-filtering of X.
(Suppose X[i,j] is the <i,j> element of X)
Data Layout: W.L.O.G. suppose sqrt(p) divides n and m.
             Assign a tile of elements of size n/sqrt(p) x m/sqrt(p)
             to each processor i, for i in [0,p-1].
For all pixels <i,j> in parallel do
   Y[i,j] = X[i,j] + X[i-1,j] + X[i+1,j];
   barrier();
   Y[i,j] = Y[i,j] + X[i,j-1] + X[i,j+1];
   barrier();
   Y[i,j] = Y[i,j] / 9.0;
Endfor

Noting that you take care of the boundary conditions, and use
communication to collectively prefetch elements of X and Y which are
not local to each processor's data.  

-david

David A. Bader 
Electrical Engineering Department
A.V. Williams Building
University of Maryland
College Park, MD 20742
Office: 301-405-6755   
FAX:    301-314-9658

Internet: dbader@eng.umd.edu
WWW:      http://www.umiacs.umd.edu/~dbader


