Image Utilities (IU)
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Groups Pages
Public Member Functions | Data Fields
iu::ImageGpu< PixelType, Allocator >::KernelData Struct Reference

Struct pointer KernelData that can be used in CUDA kernels. More...

#include <image_gpu.h>

Public Member Functions

__device__ PixelType & operator() (int x, int y)
 
__host__ KernelData (const ImageGpu< PixelType, Allocator > &im)
 

Data Fields

PixelType * data_
 
int width_
 
int height_
 
int stride_
 

Detailed Description

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>
void doSomethingWithCuda(iu::ImageGpu<PixelType, Allocator> *img, PixelType value)
{
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;
}

Constructor & Destructor Documentation

template<typename PixelType, class Allocator>
__host__ iu::ImageGpu< PixelType, Allocator >::KernelData::KernelData ( const ImageGpu< PixelType, Allocator > &  im)
inline

Constructor

Member Function Documentation

template<typename PixelType, class Allocator>
__device__ PixelType& iu::ImageGpu< PixelType, Allocator >::KernelData::operator() ( int  x,
int  y 
)
inline

Access the image via the () operator.

Parameters
xPosition in x.
yPosition in y.
Returns
value at position (x,y).

Field Documentation

template<typename PixelType, class Allocator>
PixelType* iu::ImageGpu< PixelType, Allocator >::KernelData::data_

Pointer to device buffer.

template<typename PixelType, class Allocator>
int iu::ImageGpu< PixelType, Allocator >::KernelData::height_

Height of the Image.

template<typename PixelType, class Allocator>
int iu::ImageGpu< PixelType, Allocator >::KernelData::stride_

Distance in pixels between starts of consecutive rows.

template<typename PixelType, class Allocator>
int iu::ImageGpu< PixelType, Allocator >::KernelData::width_

Width of the Image.


The documentation for this struct was generated from the following file: