Struct opencv::core::HostMem

source ·
pub struct HostMem { /* private fields */ }
Expand description

Class with reference counting wrapping special memory type allocation functions from CUDA.

Its interface is also Mat-like but with additional memory type parameters.

  • PAGE_LOCKED sets a page locked memory type used commonly for fast and asynchronous uploading/downloading data from/to GPU.
  • SHARED specifies a zero copy memory allocation that enables mapping the host memory to GPU address space, if supported.
  • WRITE_COMBINED sets the write combined buffer that is not cached by CPU. Such buffers are used to supply GPU with data when GPU only reads it. The advantage is a better CPU cache utilization.

Note: Allocation size of such memory types is usually limited. For more details, see CUDA 2.2 Pinned Memory APIs document or CUDA C Programming Guide.

Implementations§

source§

impl HostMem

source

pub fn new(alloc_type: HostMem_AllocType) -> Result<HostMem>

C++ default parameters
  • alloc_type: HostMem::AllocType::PAGE_LOCKED
source

pub fn copy(m: &HostMem) -> Result<HostMem>

source

pub fn new_1( rows: i32, cols: i32, typ: i32, alloc_type: HostMem_AllocType ) -> Result<HostMem>

C++ default parameters
  • alloc_type: HostMem::AllocType::PAGE_LOCKED
source

pub fn new_2( size: Size, typ: i32, alloc_type: HostMem_AllocType ) -> Result<HostMem>

C++ default parameters
  • alloc_type: HostMem::AllocType::PAGE_LOCKED
source

pub fn new_3( arr: &dyn ToInputArray, alloc_type: HostMem_AllocType ) -> Result<HostMem>

creates from host memory with coping data

C++ default parameters
  • alloc_type: HostMem::AllocType::PAGE_LOCKED

Trait Implementations§

source§

impl Boxed for HostMem

source§

unsafe fn from_raw(ptr: *mut c_void) -> Self

Wrap the specified raw pointer Read more
source§

fn into_raw(self) -> *mut c_void

Return an the underlying raw pointer while consuming this wrapper. Read more
source§

fn as_raw(&self) -> *const c_void

Return the underlying raw pointer. Read more
source§

fn as_raw_mut(&mut self) -> *mut c_void

Return the underlying mutable raw pointer Read more
source§

impl Clone for HostMem

source§

fn clone(&self) -> Self

Calls try_clone() and panics if that fails

1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Drop for HostMem

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl HostMemTrait for HostMem

source§

fn as_raw_mut_HostMem(&mut self) -> *mut c_void

source§

fn set_flags(&mut self, val: i32)

source§

fn set_rows(&mut self, val: i32)

source§

fn set_cols(&mut self, val: i32)

source§

fn set_step(&mut self, val: size_t)

source§

fn data(&mut self) -> *mut u8

source§

unsafe fn set_data(&mut self, val: *mut u8)

source§

fn refcount(&mut self) -> *mut i32

source§

unsafe fn set_refcount(&mut self, val: *mut i32)

source§

fn datastart(&mut self) -> *mut u8

source§

unsafe fn set_datastart(&mut self, val: *mut u8)

source§

fn set_alloc_type(&mut self, val: HostMem_AllocType)

source§

fn swap(&mut self, b: &mut HostMem) -> Result<()>

swaps with other smart pointer
source§

fn create(&mut self, rows: i32, cols: i32, typ: i32) -> Result<()>

allocates new matrix data unless the matrix already has specified size and type.
source§

fn create_1(&mut self, size: Size, typ: i32) -> Result<()>

source§

fn release(&mut self) -> Result<()>

decrements reference counter and released memory if needed.
source§

impl HostMemTraitConst for HostMem

source§

fn as_raw_HostMem(&self) -> *const c_void

source§

fn flags(&self) -> i32

source§

fn rows(&self) -> i32

source§

fn cols(&self) -> i32

source§

fn step(&self) -> size_t

source§

fn dataend(&self) -> *const u8

source§

fn alloc_type(&self) -> HostMem_AllocType

source§

fn try_clone(&self) -> Result<HostMem>

returns deep copy of the matrix, i.e. the data is copied
source§

fn reshape(&self, cn: i32, rows: i32) -> Result<HostMem>

creates alternative HostMem header for the same data, with different number of channels and/or different number of rows Read more
source§

fn create_mat_header(&self) -> Result<Mat>

returns matrix header with disabled reference counting for HostMem data.
source§

fn create_gpu_mat_header(&self) -> Result<GpuMat>

Maps CPU memory to GPU address space and creates the cuda::GpuMat header without reference counting for it. Read more
source§

fn is_continuous(&self) -> Result<bool>

source§

fn elem_size(&self) -> Result<size_t>

source§

fn elem_size1(&self) -> Result<size_t>

source§

fn typ(&self) -> Result<i32>

source§

fn depth(&self) -> Result<i32>

source§

fn channels(&self) -> Result<i32>

source§

fn step1(&self) -> Result<size_t>

source§

fn size(&self) -> Result<Size>

source§

fn empty(&self) -> Result<bool>

source§

impl ToInputArray for &HostMem

source§

impl ToInputArray for HostMem

source§

impl ToInputOutputArray for &mut HostMem

source§

impl ToInputOutputArray for HostMem

source§

impl ToOutputArray for &mut HostMem

source§

impl ToOutputArray for HostMem

source§

impl Send for HostMem

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.