Ok, please don’t laugh but I need some help to tell me if I am doing nonsense or if I am in the right path…

i am trying to average each pixel with its 8 neighbors (with shared memory) and i am using a statement like this:

shared [threadIdx.x ][threadIdx.y]= src[threadIdx.x][ threadIdx.y] +

src[threadIdx.x -1][ threadIdx.y -1]+

src[threadIdx.x -1][ threadIdx.y]+

src[threadIdx.x -1][ threadIdx.y + 1]+

src[threadIdx.x][ threadIdx.y - 1]+

src[threadIdx.x][ threadIdx.y + 1]+

src[threadIdx.x +1][ threadIdx.y - 1]+

src[threadIdx.x + 1][ threadIdx.y]+

src[threadIdx.x+ 1][ threadIdx.y +1];

I mean is it possible to calculate these calculations? I am treating the pixels as 3x3 like this:

x-1,y-1 x-1,y x-1,y+1

x ,y-1 x,y x,y+1

x+1,y-1 x+1,y x+1,y+1

Please help!