Cuda::Image< HostType, DeviceType, PixelType > Class Template Reference

Image. More...

#include <image.hpp>

List of all members.

Public Member Functions

 Image ()
 Default constructor.
 Image (HostType *inputHost)
 Constructor.
 Image (DeviceType *inputDevice)
 Constructor.
 Image (HostType *inputHost, DeviceType *inputDevice)
 Constructor.
void updateHostBuffer (unsigned char *data, int width, int height, uint widthStep=0)
 Updates the data on the host side - also works for reference structures (data is copied!).
HostType * getHostEntity ()
 Get the CudaTemplates reprensetation of the host memory.
DeviceType * getDeviceEntity ()
 Get the CudaTemplates reprensetation of the device memory.
PixelType * getHostBuffer ()
 Get the templated pixel reprensetation of the host memory.
PixelType * getDeviceBuffer ()
 Get the templated pixel reprensetation of the device memory.
Cuda::Size< 2 > getSize () const
 Get size.
Cuda::Size< 2 > getStride () const
 Get stride.
size_t getPitch () const
 Get pitch.
bool imageAvailable () const
 Get flag if an image is available.
bool hostModified () const
 Get flag if host instance was modified.
bool deviceModified () const
 Get flag if device instance was modified.
uint getNChannels () const
 Get Number of channels.
bool interleaved () const
 Get flag if channels are saved interleaved.

Public Attributes

uint nChannels_
 Number of channels saved in the image structure.
bool interleaved_
 Flag if color channels are interleaved or planar.

Protected Member Functions

void updateHostEntity ()
 Updates the host memory with the device memory.
void updateDeviceEntity ()
 Updates the device memory with the host memory.

Protected Attributes

HostType * hostEntity_
 CudaTemplate representation of host memory.
DeviceType * deviceEntity_
 CudaTemplate representation of device memory.
bool imageAvailable_
 Flag if host and device representations are available.
bool hostModified_
 Flag if host representation was modified.
bool deviceModified_
 Flag if device representation was modified.


Detailed Description

template<class HostType, class DeviceType, class PixelType>
class Cuda::Image< HostType, DeviceType, PixelType >

Image.

Image representation or similar data structures on device and host memory.

This is the base class for all kind of data structures that are needed on both, the host and the device.

The class is templeted over the type of host and device memory representation and the type of elements.

BE AWARE that there is no possibility to create Reference types of the CudaTemplates library due to the lack of partial specialization of member functions (here the constructor). As soon as a workaround is found the functionality will be implemented. If you need a reference type by now, please build it yourself.


Constructor & Destructor Documentation

template<class HostType, class DeviceType, class PixelType>
Cuda::Image< HostType, DeviceType, PixelType >::Image (  )  [inline]

Default constructor.

template<class HostType, class DeviceType, class PixelType>
Cuda::Image< HostType, DeviceType, PixelType >::Image ( HostType *  inputHost  )  [inline]

Constructor.

Takes a CudaTemplates representation of host memory and automatically creates the correspsonding device representation.

Parameters:
inputHost CudaTemplate representation of host memory

template<class HostType, class DeviceType, class PixelType>
Cuda::Image< HostType, DeviceType, PixelType >::Image ( DeviceType *  inputDevice  )  [inline]

Constructor.

Takes a CudaTemplates representation of device memory and automatically creates the correspsonding host representation.

Parameters:
inputDevice CudaTemplate representation of Device memory

template<class HostType, class DeviceType, class PixelType>
Cuda::Image< HostType, DeviceType, PixelType >::Image ( HostType *  inputHost,
DeviceType *  inputDevice 
) [inline]

Constructor.

Takes a CudaTemplate representation of host and device memory.

Parameters:
inputHost CudaTemplate representation of host memory
inputDevice CudaTemplate representation of device memory


Member Function Documentation

template<class HostType, class DeviceType, class PixelType>
void Cuda::Image< HostType, DeviceType, PixelType >::updateHostBuffer ( unsigned char *  data,
int  width,
int  height,
uint  widthStep = 0 
) [inline]

Updates the data on the host side - also works for reference structures (data is copied!).

Parameters:
[in] data pixel data. (e.g. of an IplImage)
[in] width image width.
[in] height image height.
[in] widthStep row size (default = width). (e.g. IplImage::widthStep if used as OpenCV connector)

template<class HostType, class DeviceType, class PixelType>
HostType* Cuda::Image< HostType, DeviceType, PixelType >::getHostEntity (  )  [inline]

Get the CudaTemplates reprensetation of the host memory.

The memory is automatically synchronized if the device memory was modified.

Returns:
templated host memory

template<class HostType, class DeviceType, class PixelType>
DeviceType* Cuda::Image< HostType, DeviceType, PixelType >::getDeviceEntity (  )  [inline]

Get the CudaTemplates reprensetation of the device memory.

The memory is automatically synchronized if the host memory was modified.

Returns:
templated device memory

template<class HostType, class DeviceType, class PixelType>
PixelType* Cuda::Image< HostType, DeviceType, PixelType >::getHostBuffer (  )  [inline]

Get the templated pixel reprensetation of the host memory.

The memory is automatically synchronized if the device memory was modified.

Returns:
templated pixel buffer of host memory

template<class HostType, class DeviceType, class PixelType>
PixelType* Cuda::Image< HostType, DeviceType, PixelType >::getDeviceBuffer (  )  [inline]

Get the templated pixel reprensetation of the device memory.

The memory is automatically synchronized if the device memory was modified.

Returns:
templated pixel buffer of host memory

template<class HostType, class DeviceType, class PixelType>
Cuda::Size<2> Cuda::Image< HostType, DeviceType, PixelType >::getSize (  )  const [inline]

Get size.

Returns:
size of the stored device memory layout in each dimension.

template<class HostType, class DeviceType, class PixelType>
Cuda::Size<2> Cuda::Image< HostType, DeviceType, PixelType >::getStride (  )  const [inline]

Get stride.

Returns:
stride of the stored device memory layout in each dimension.

template<class HostType, class DeviceType, class PixelType>
size_t Cuda::Image< HostType, DeviceType, PixelType >::getPitch (  )  const [inline]

Get pitch.

Returns:
number of bytes in a row (including any padding)

template<class HostType, class DeviceType, class PixelType>
bool Cuda::Image< HostType, DeviceType, PixelType >::imageAvailable (  )  const [inline]

Get flag if an image is available.

Returns:
true if a valid host and device representation is available and false if not.

template<class HostType, class DeviceType, class PixelType>
bool Cuda::Image< HostType, DeviceType, PixelType >::hostModified (  )  const [inline]

Get flag if host instance was modified.

Returns:
true if the host memory was modified and not synchronized with the device memory.

template<class HostType, class DeviceType, class PixelType>
bool Cuda::Image< HostType, DeviceType, PixelType >::deviceModified (  )  const [inline]

Get flag if device instance was modified.

Returns:
true if the device memory was modified and not synchronized with the host memory.

template<class HostType, class DeviceType, class PixelType>
uint Cuda::Image< HostType, DeviceType, PixelType >::getNChannels (  )  const [inline]

Get Number of channels.

Returns:
Number of color channels.

template<class HostType, class DeviceType, class PixelType>
bool Cuda::Image< HostType, DeviceType, PixelType >::interleaved (  )  const [inline]

Get flag if channels are saved interleaved.

Returns:
TRUE if channels are greater 1 and saved in interleaved mode. FALSE if saved in planar mode or only one channel is available.


Member Data Documentation

template<class HostType, class DeviceType, class PixelType>
uint Cuda::Image< HostType, DeviceType, PixelType >::nChannels_

Number of channels saved in the image structure.

template<class HostType, class DeviceType, class PixelType>
bool Cuda::Image< HostType, DeviceType, PixelType >::interleaved_

Flag if color channels are interleaved or planar.

template<class HostType, class DeviceType, class PixelType>
HostType* Cuda::Image< HostType, DeviceType, PixelType >::hostEntity_ [protected]

CudaTemplate representation of host memory.

template<class HostType, class DeviceType, class PixelType>
DeviceType* Cuda::Image< HostType, DeviceType, PixelType >::deviceEntity_ [protected]

CudaTemplate representation of device memory.

template<class HostType, class DeviceType, class PixelType>
bool Cuda::Image< HostType, DeviceType, PixelType >::imageAvailable_ [protected]

Flag if host and device representations are available.

template<class HostType, class DeviceType, class PixelType>
bool Cuda::Image< HostType, DeviceType, PixelType >::hostModified_ [protected]

Flag if host representation was modified.

template<class HostType, class DeviceType, class PixelType>
bool Cuda::Image< HostType, DeviceType, PixelType >::deviceModified_ [protected]

Flag if device representation was modified.


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

Generated on Sun Sep 13 00:55:19 2009 for cudatemplates by  doxygen 1.5.6