Point Cloud Library (PCL)  1.14.0-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, std::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, std::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, std::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...
 
std::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 183 of file device_memory.h.

Constructor & Destructor Documentation

◆ DeviceMemory2D() [1/4]

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

Empty constructor.

◆ ~DeviceMemory2D()

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

Destructor.

◆ DeviceMemory2D() [2/4]

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

◆ DeviceMemory2D() [3/4]

pcl::gpu::DeviceMemory2D::DeviceMemory2D ( int  rows_arg,
int  colsBytes_arg,
void *  data_arg,
std::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

◆ DeviceMemory2D() [4/4]

pcl::gpu::DeviceMemory2D::DeviceMemory2D ( const DeviceMemory2D other_arg)

Copy constructor.

Just increments reference counter.

Member Function Documentation

◆ colsBytes()

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

◆ copyTo()

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().

◆ create()

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().

◆ download()

void pcl::gpu::DeviceMemory2D::download ( void *  host_ptr_arg,
std::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().

◆ empty()

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

Returns true if unallocated otherwise false.

◆ operator PtrStep< U >()

template<class U >
pcl::gpu::DeviceMemory2D::operator PtrStep< U >

Conversion to PtrStep for passing to kernel functions.

Definition at line 84 of file device_memory.hpp.

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

◆ operator PtrStepSz< U >()

template<class U >
pcl::gpu::DeviceMemory2D::operator PtrStepSz< U >

Conversion to PtrStepSz for passing to kernel functions.

Definition at line 93 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.

◆ operator=()

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

Assignment operator.

Just increments reference counter.

Referenced by pcl::gpu::DeviceArray2D< prob_histogram >::DeviceArray2D().

◆ ptr() [1/2]

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 71 of file device_memory.hpp.

◆ ptr() [2/2]

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 78 of file device_memory.hpp.

◆ release()

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

Decrements reference counter and releases internal buffer if needed.

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

◆ rows()

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

Returns number of rows.

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

◆ step()

std::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().

◆ swap()

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

Performs swap of data pointed with another device memory.

Parameters
other_argdevice memory to swap with

◆ upload()

void pcl::gpu::DeviceMemory2D::upload ( const void *  host_ptr_arg,
std::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 internal 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: