RealSense Cross Platform API
RealSense Cross-platform API
Public Member Functions | List of all members
rs2::gpu_frame Class Reference

#include <rs_frame.hpp>

Inheritance diagram for rs2::gpu_frame:
rs2::frame

Public Member Functions

 gpu_frame (const frame &f)
 
const void * get_gpu_data () const
 
- Public Member Functions inherited from rs2::frame
 frame ()
 
 frame (rs2_frame *ref)
 
 frame (frame &&other) noexcept
 
frameoperator= (frame other)
 
 frame (const frame &other)
 
void swap (frame &other)
 
 ~frame ()
 
void keep ()
 
 operator bool () const
 
rs2_sensorget_sensor ()
 
double get_timestamp () const
 
rs2_timestamp_domain get_frame_timestamp_domain () const
 
rs2_metadata_type get_frame_metadata (rs2_frame_metadata_value frame_metadata) const
 
bool supports_frame_metadata (rs2_frame_metadata_value frame_metadata) const
 
unsigned long long get_frame_number () const
 
const int get_data_size () const
 
const void * get_data () const
 
const void * get_gpu_data_or_upload (bool *copied=nullptr) const
 
stream_profile get_profile () const
 
template<class T >
bool is () const
 
template<class T >
as () const
 
rs2_frameget () const
 
 operator rs2_frame * ()
 
frame apply_filter (filter_interface &filter)
 

Additional Inherited Members

- Protected Member Functions inherited from rs2::frame
void add_ref () const
 
void reset ()
 

Detailed Description

GPU-Frame extension: present when the frame's pixels reside in GPU-accessible (zero-copy) memory. Reach it with frame::as<gpu_frame>() — the cast is null unless the SDK was built with BUILD_WITH_CUDA_ZEROCOPY and the frame is GPU-resident (integrated GPU / Jetson). This mirrors rs2::gl::gpu_frame: get_data() on the base frame keeps returning the HOST pointer (the viewer, recording, pyrealsense2/OpenCV and any CPU code still use it); the GPU device pointer is a SEPARATE accessor on this extension. Typical use:

auto color = frames.get_color_frame();
const void * host = color.get_data();              // host pointer, always valid
if( auto gf = color.as<rs2::gpu_frame>() )          // true only when GPU-resident
    feed_cuda( gf.get_gpu_data() );                 // device pointer, no host->device copy
else
    feed_cuda( color.get_gpu_data_or_upload() );    // not zero-copy: upload (a copy)

Constructor & Destructor Documentation

◆ gpu_frame()

rs2::gpu_frame::gpu_frame ( const frame f)
inline

Member Function Documentation

◆ get_gpu_data()

const void* rs2::gpu_frame::get_gpu_data ( ) const
inline

Retrieve the CUDA device pointer aliasing the frame data for zero-copy GPU consumption (e.g. binding the frame directly as a CUDA / TensorRT / NPP input with no host->device copy). The frame must stay alive (hold it) until the GPU work completes.

Returns
GPU device pointer aliasing the frame data

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