Point Cloud Library (PCL)  1.9.1-dev
List of all members | Public Member Functions
pcl::gpu::DeviceMemory2D Class Reference

DeviceMemory2D class More...

#include </__w/1/s/gpu/containers/include/pcl/gpu/containers/device_memory.h>

+ Inheritance diagram for pcl::gpu::DeviceMemory2D:

Public Member Functions

 DeviceMemory2D ()
 Empty constructor. More...
 
 ~DeviceMemory2D ()
 Destructor. More...
 
 DeviceMemory2D (int rows_arg, int colsBytes_arg)
 Allocates internal buffer in GPU memory. More...
 
 DeviceMemory2D (int rows_arg, int colsBytes_arg, void *data_arg, size_t step_arg)
 Initializes with user allocated buffer. More...
 
 DeviceMemory2D (const DeviceMemory2D &other_arg)
 Copy constructor. More...
 
DeviceMemory2Doperator= (const DeviceMemory2D &other_arg)
 Assignment operator. More...
 
void create (int rows_arg, int colsBytes_arg)
 Allocates internal buffer in GPU memory. More...
 
void release ()
 Decrements reference counter and releases internal buffer if needed. More...
 
void copyTo (DeviceMemory2D &other) const
 Performs data copying. More...
 
void upload (const void *host_ptr_arg, size_t host_step_arg, int rows_arg, int colsBytes_arg)
 Uploads data to internal buffer in GPU memory. More...
 
void download (void *host_ptr_arg, size_t host_step_arg) const
 Downloads data from internal buffer to CPU memory. More...
 
void swap (DeviceMemory2D &other_arg)
 Performs swap of data pointed with another device memory. More...
 
template<class T >
T * ptr (int y_arg=0)
 Returns pointer to given row in internal buffer. More...
 
template<class T >
const T * ptr (int y_arg=0) const
 Returns constant pointer to given row in internal buffer. More...
 
template<class U >
 operator PtrStep< U > () const
 Conversion to PtrStep for passing to kernel functions. More...
 
template<class U >
 operator PtrStepSz< U > () const
 Conversion to PtrStepSz for passing to kernel functions. More...
 
bool empty () const
 Returns true if unallocated otherwise false. More...
 
int colsBytes () const
 Returns number of bytes in each row. More...
 
int rows () const
 Returns number of rows. More...
 
size_t step () const
 Returns stride between two consecutive rows in bytes for internal buffer. More...
 

Detailed Description

DeviceMemory2D class

Note
This is a BLOB container class with reference counting for pitched GPU memory.
Author
Anatoly Baksheev

Definition at line 142 of file device_memory.h.

Constructor & Destructor Documentation

pcl::gpu::DeviceMemory2D::DeviceMemory2D ( )

Empty constructor.

pcl::gpu::DeviceMemory2D::~DeviceMemory2D ( )

Destructor.

pcl::gpu::DeviceMemory2D::DeviceMemory2D ( int  rows_arg,
int  colsBytes_arg 
)

Allocates internal buffer in GPU memory.

Parameters
rows_argnumber of rows to allocate
colsBytes_argwidth of the buffer in bytes
pcl::gpu::DeviceMemory2D::DeviceMemory2D ( int  rows_arg,
int  colsBytes_arg,
void *  data_arg,
size_t  step_arg 
)

Initializes with user allocated buffer.

Reference counting is disabled in this case.

Parameters
rows_argnumber of rows
colsBytes_argwidth of the buffer in bytes
data_argpointer to buffer
step_argstride between two consecutive rows in bytes
pcl::gpu::DeviceMemory2D::DeviceMemory2D ( const DeviceMemory2D other_arg)

Copy constructor.

Just increments reference counter.

Member Function Documentation

int pcl::gpu::DeviceMemory2D::colsBytes ( ) const
void pcl::gpu::DeviceMemory2D::copyTo ( DeviceMemory2D other) const

Performs data copying.

If destination size differs it will be reallocated.

Parameters
otherdestination container

Referenced by pcl::gpu::DeviceArray2D< T >::copyTo().

void pcl::gpu::DeviceMemory2D::create ( int  rows_arg,
int  colsBytes_arg 
)

Allocates internal buffer in GPU memory.

If internal buffer was created before the function recreates it with new size. If new and old sizes are equal it does nothing.

Parameters
rows_argnumber of rows to allocate
colsBytes_argwidth of the buffer in bytes

Referenced by pcl::gpu::DeviceArray2D< T >::create().

void pcl::gpu::DeviceMemory2D::download ( void *  host_ptr_arg,
size_t  host_step_arg 
) const

Downloads data from internal buffer to CPU memory.

User is responsible for correct host buffer size.

Parameters
host_ptr_argpointer to host buffer to download
host_step_argstride between two consecutive rows in bytes for host buffer

Referenced by pcl::gpu::DeviceArray2D< T >::download().

bool pcl::gpu::DeviceMemory2D::empty ( ) const

Returns true if unallocated otherwise false.

template<class U >
pcl::gpu::DeviceMemory2D::operator PtrStep< U > ( ) const

Conversion to PtrStep for passing to kernel functions.

template<class U >
pcl::gpu::DeviceMemory2D::operator PtrStepSz< U > ( ) const

Conversion to PtrStepSz for passing to kernel functions.

DeviceMemory2D& pcl::gpu::DeviceMemory2D::operator= ( const DeviceMemory2D other_arg)

Assignment operator.

Just increments reference counter.

Referenced by pcl::gpu::DeviceArray2D< T >::operator=().

template<class T >
T * pcl::gpu::DeviceMemory2D::ptr ( int  y_arg = 0)

Returns pointer to given row in internal buffer.

Parameters
y_argrow index

Definition at line 55 of file device_memory.hpp.

template<class T >
const T * pcl::gpu::DeviceMemory2D::ptr ( int  y_arg = 0) const

Returns constant pointer to given row in internal buffer.

Parameters
y_argrow index

Definition at line 56 of file device_memory.hpp.

References pcl::gpu::PtrStepSz< T >::cols, pcl::gpu::DevPtr< T >::data, pcl::gpu::PtrStepSz< T >::rows, and pcl::gpu::PtrStep< T >::step.

void pcl::gpu::DeviceMemory2D::release ( )

Decrements reference counter and releases internal buffer if needed.

Referenced by pcl::gpu::DeviceArray2D< T >::release().

int pcl::gpu::DeviceMemory2D::rows ( ) const

Returns number of rows.

Referenced by pcl::gpu::DeviceArray2D< T >::rows().

size_t pcl::gpu::DeviceMemory2D::step ( ) const

Returns stride between two consecutive rows in bytes for internal buffer.

Step is stored always and everywhere in bytes!!!

Referenced by pcl::gpu::AsyncCopy< T >::download(), pcl::gpu::DeviceArray2D< T >::elem_step(), pcl::gpu::TextureBinder::TextureBinder(), and pcl::gpu::AsyncCopy< T >::upload().

void pcl::gpu::DeviceMemory2D::swap ( DeviceMemory2D other_arg)

Performs swap of data pointed with another device memory.

Parameters
other_argdevice memory to swap with

Referenced by pcl::gpu::DeviceArray2D< T >::swap().

void pcl::gpu::DeviceMemory2D::upload ( const void *  host_ptr_arg,
size_t  host_step_arg,
int  rows_arg,
int  colsBytes_arg 
)

Uploads data to internal buffer in GPU memory.

It calls create() inside to ensure that intenal buffer size is enough.

Parameters
host_ptr_argpointer to host buffer to upload
host_step_argstride between two consecutive rows in bytes for host buffer
rows_argnumber of rows to upload
colsBytes_argwidth of host buffer in bytes

Referenced by pcl::gpu::DeviceArray2D< T >::upload().


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