template<typename PixelType, class Allocator>
struct iu::ImageGpu< PixelType, Allocator >::KernelData
Struct pointer KernelData that can be used in CUDA kernels.
This struct provides the device data pointer as well as important class properties.
template<typename PixelType, class Allocator>
__global__ void cudaFunctionKernel(ImageGpu<PixelType, Allocator>::KernelData img, PixelType value)
{
const unsigned int x = threadIdx.x + blockIdx.x * blockDim.x;
const unsigned int y = threadIdx.y + blockIdx.y * blockDim.y;
if (x < img.width_ && y < img.height_)
{
img(x, y) += value;
}
}
template<typename PixelType, class Allocator>
{
dim3 dimBlock(32,32);
dim3 dimGrid(iu::divUp(img->
width(), dimBlock.x),
iu::divUp(img->
height(), dimBlock.y));
cudaFunctionKernel<PixelType, Allocator><<<dimGrid, dimBlock>>>(*img, value);
IU_CUDA_CHECK;
}