map smoothing

Hey guys

im trying to smooth a big array that represents heights map by taking all 8 points surrounding a single point in space and find their average.
for a example

xxx
xzx
xxx

and z will contain the avg of all points around it.
the problem is that the only idea the pop ups will cause many bank conflicts and slower the calculation.

thanks for your help.

It is classic avg filtering You are trying to do, if I am getting it right. You could use a texture for input and write output to global memory (or somewhere else). Using texture sampling solves problems with borders, according to appropriate texture coordinates configuration (whether to clamp, mirror or wrap coordinates larger then 1.0 or smaller then 0.0, if normalized).

Regrads,

MK

Hi Krinista
Did you solve your problem? I am trying to do the same thing with 2D array containing 200 rows and 200 columns. Can you help me out with this?

Bicubic texture filtering in the SDK is something which might be very useful for you. Bicubic interpolation uses 16 surrounding points in a 4x4 grid and gives a really smooth image.

Can you give me an algorithm or a code to do the spatial averaging like that of Krinitsa? Plz help me out…

Check out the box filter SDK example.

I think what you are actually looking for is the matlab conv2 equivalent with a simple constant mask.