Research Article

True 4D Image Denoising on the GPU

Algorithm 2

//  Code  that  is  executed  before  the  kernel  is  launched
intthreadsInX  =  32;
intthreadsInY  =  16;
intthreadsIn = 1;
intblocksInX = (DATA_W+threadsInX-1)/threadsInX;
intblocksInY = (DATA_H+threadsInY-1)/threadsInY;
intblocksInZ = (DATA_D+threadsInZ-1)/threadsInZ;
dim3  dimGrid  =  dim3(blocksInX, blocksInY*blocksInZ);
dim3  dimBlock  =  dim3(threadsInX, threadsInY, threadsInZ);
//  Code  that  is  executed  inside  the  kernel
intblockIdxz  =  __float2uint_rd(blockIdx.y  *  invBlocksInY);
intblockIdxy  =  blockIdx.y    blockIdxz  *  blocksInY;
int x  =  blockIdx.x  *  blockDim.x  +  threadIdx.x;
int y  =  blockIdxy  *  blockDim.y  +  threadIdx.y;
int z  =  blockIdxz  *  blockDim.z  +  threadIdx.z;