Loading...
Searching...
No Matches
pcl::device::DeviceMemory2D Class Reference

DeviceMemory2D class More...

`#include </build/pcl-FTI9wM/pcl-1.15.1+dfsg/gpu/containers/include/pcl/gpu/containers/device_memory.h>`

Inheritance diagram for pcl::device::DeviceMemory2D:

## Public Member Functions

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

## 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() [2/4]

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

Allocates internal buffer in GPU memory.

Parameters

  rows_arg | number of rows to allocate
  colsBytes_arg | width 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_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

## DeviceMemory2D() [4/4]

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

Copy constructor.

Just increments reference counter.

## ~DeviceMemory2D()

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

Destructor.

## Member Function Documentation

## colsBytes()

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

Returns number of bytes in each row.

## copyTo()

void pcl::gpu::DeviceMemory2D::copyTo | ( | DeviceMemory2D & | other | ) | const

Performs data copying.

If destination size differs it will be reallocated.

Parameters

  other | destination container

## 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_arg | number of rows to allocate
  colsBytes_arg | width of the buffer in bytes

## 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_arg | pointer to host buffer to download
  host_step_arg | stride between two consecutive rows in bytes for host buffer

## 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 > | ( |  | ) | const

Conversion to PtrStep for passing to kernel functions.

Definition at line 84 of file device_memory.hpp.

## operator PtrStepSz< U >()

template<class U>

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

Conversion to PtrStepSz for passing to kernel functions.

Definition at line 93 of file device_memory.hpp.

## operator=()

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

Assignment operator.

Just increments reference counter.

## 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_arg | row 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_arg | row 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.

## rows()

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

Returns number of 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!!!

## swap()

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

Performs swap of data pointed with another device memory.

Parameters

  other_arg | device 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_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

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

- /build/pcl-FTI9wM/pcl-1.15.1+dfsg/gpu/containers/include/pcl/gpu/containers/device_memory.h
- /build/pcl-FTI9wM/pcl-1.15.1+dfsg/gpu/containers/include/pcl/gpu/containers/impl/device_memory.hpp