Point Cloud Library (PCL)
1.14.1-dev
|
DeviceMemory2D class More...
#include </__w/1/s/gpu/containers/include/pcl/gpu/containers/device_memory.h>
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... | |
DeviceMemory2D & | operator= (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... | |
DeviceMemory2D class
Definition at line 183 of file device_memory.h.
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.
rows_arg | number of rows to allocate |
colsBytes_arg | width of the buffer in bytes |
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.
rows_arg | number of rows |
colsBytes_arg | width of the buffer in bytes |
data_arg | pointer to buffer |
step_arg | stride between two consecutive rows in bytes |
pcl::gpu::DeviceMemory2D::DeviceMemory2D | ( | const DeviceMemory2D & | other_arg | ) |
Copy constructor.
Just increments reference counter.
int pcl::gpu::DeviceMemory2D::colsBytes | ( | ) | const |
Returns number of bytes in each row.
Referenced by pcl::gpu::AsyncCopy< T >::download(), pcl::gpu::DeviceArray2D< prob_histogram >::elem_step(), and pcl::gpu::AsyncCopy< T >::upload().
void pcl::gpu::DeviceMemory2D::copyTo | ( | DeviceMemory2D & | other | ) | const |
Performs data copying.
If destination size differs it will be reallocated.
other | destination 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.
rows_arg | number of rows to allocate |
colsBytes_arg | width of the buffer in bytes |
Referenced by pcl::gpu::DeviceArray2D< T >::create().
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.
host_ptr_arg | pointer to host buffer to download |
host_step_arg | stride 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.
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.
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.
DeviceMemory2D& pcl::gpu::DeviceMemory2D::operator= | ( | const DeviceMemory2D & | other_arg | ) |
Assignment operator.
Just increments reference counter.
Referenced by pcl::gpu::DeviceArray2D< prob_histogram >::DeviceArray2D().
T * pcl::gpu::DeviceMemory2D::ptr | ( | int | y_arg = 0 | ) |
Returns pointer to given row in internal buffer.
y_arg | row index |
Definition at line 71 of file device_memory.hpp.
const T * pcl::gpu::DeviceMemory2D::ptr | ( | int | y_arg = 0 | ) | const |
Returns constant pointer to given row in internal buffer.
y_arg | row index |
Definition at line 78 of file device_memory.hpp.
void pcl::gpu::DeviceMemory2D::release | ( | ) |
Decrements reference counter and releases internal buffer if needed.
Referenced by pcl::gpu::DeviceArray2D< prob_histogram >::create().
int pcl::gpu::DeviceMemory2D::rows | ( | ) | const |
Returns number of rows.
Referenced by pcl::gpu::DeviceArray2D< T >::rows().
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().
void pcl::gpu::DeviceMemory2D::swap | ( | DeviceMemory2D & | other_arg | ) |
Performs swap of data pointed with another device memory.
other_arg | device memory to swap with |
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.
host_ptr_arg | pointer to host buffer to upload |
host_step_arg | stride between two consecutive rows in bytes for host buffer |
rows_arg | number of rows to upload |
colsBytes_arg | width of host buffer in bytes |
Referenced by pcl::gpu::DeviceArray2D< T >::upload().