VideoFrame
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members # bmf_sdk::VideoFrame Class Reference
video_frame.h
Public Types
using Frame = hmp::Frame
Public Member Functions
VideoFrame ()
VideoFrame (const VideoFrame &)=default
VideoFrame & operator= (const VideoFrame &)=default
VideoFrame ( VideoFrame &&)=default
VideoFrame (const Frame & frame )
VideoFrame (int width , int height , const PixelInfo &pix_info, const Device & device =kCPU)
operator bool () const
int width () const
int height () const
ScalarType dtype () const
VideoFrame reformat (const PixelInfo &pix_info)
VideoFrame crop (int x, int y, int w, int h) const
const Device & device () const override
VideoFrame cpu (bool non_blocking=false) const
VideoFrame cuda () const
VideoFrame & copy_ (const VideoFrame &from)
VideoFrame to (const Device & device , bool non_blocking=false) const
VideoFrame & copy_props (const VideoFrame &from)
bmf_sdk::OpaqueDataSet OpaqueDataSet ()=default
OpaqueDataSet ( OpaqueDataSet &&)=default
OpaqueDataSet (const OpaqueDataSet &)=default
OpaqueDataSet & operator= (const OpaqueDataSet &)=default
void private_attach (const T *data, Args &&…args)
const T * private_get () const
void private_merge (const OpaqueDataSet &from)
OpaqueDataSet & copy_props (const OpaqueDataSet &from)
bmf_sdk::SequenceData void set_pts (int64_t pts )
int64_t pts () const
void set_time_base ( Rational time_base )
bool operator> (const SequenceData &other)
bool operator>= (const SequenceData &other)
bool operator< (const SequenceData &other)
bool operator<= (const SequenceData &other)
SequenceData & copy_props (const SequenceData &from)
Future (const Future &)=default
Future & operator= (const Future &)=default
virtual ~Future ()
void set_stream (uint64_t stream )
uint64_t stream () const
bool ready () const
void record (bool use_current=true)
void synchronize ()
Future & copy_props (const Future &from)
Static Public Member Functions
static VideoFrame make (int width , int height , const PixelInfo &pix_info, const Device & device =kCPU)
static VideoFrame make (int width , int height , const PixelInfo &pix_info, const std::string & device )
Protected Member Functions
VideoFrame (const std::shared_ptr< Private > &other)
bmf_sdk::OpaqueDataSet virtual void set_private_data (int key, const OpaqueData &data)
virtual const OpaqueData & private_data (int key) const
Member Typedef Documentation
Frame
using bmf_sdk::VideoFrame::Frame = hmp::Frame
Constructor & Destructor Documentation
VideoFrame() [1/6]
bmf_sdk::VideoFrame::VideoFrame ( )
Construct a undefined Video Frame object.
assert(VideoFrame() == false)
VideoFrame() [2/6]
bmf_sdk::VideoFrame::VideoFrame ( const VideoFrame & )
defaultdefault
VideoFrame is copyable.
VideoFrame() [3/6]
bmf_sdk::VideoFrame::VideoFrame ( VideoFrame && )
defaultdefault
VideoFrame is movable.
VideoFrame() [4/6]
bmf_sdk::VideoFrame::VideoFrame ( const Frame &frame )
Construct VideoFrame from Frame object.
Parameters
- frame Dedicated to YUV data, with irregular shapes between planes
VideoFrame() [5/6]
bmf_sdk::VideoFrame::VideoFrame ( int width,
int height,
const PixelInfo & pix_info,
const Device & device = kCPU
)
Construct VideoFrame(Frame) with given size (width, height), PixelInfo, and device, for ease of use, using factory function VideoFrame::make Parameters
- width width of Y plane
- height height of Y plane
- pix_info PixelFormat and ColorModel
- device device
VideoFrame() [6/6]
bmf_sdk::VideoFrame::VideoFrame ( const std::shared_ptr< Private > & other )
protectedprotected
Member Function Documentation
copy_()
VideoFrame & bmf_sdk::VideoFrame::copy_( const VideoFrame &from )
In-place copy.
Parameters
- from data source which have the same type and shape
Returns VideoFrame &
copy_props()
VideoFrame & bmf_sdk::VideoFrame::copy_props( const VideoFrame &from )
copy all extra props(set by member func set_xxx) from from
(deepcopy if needed), Parameters
- from
Returns VideoFrame &
cpu()
VideoFrame bmf_sdk::VideoFrame::cpu( bool non_blocking = false ) const
crop()
VideoFrame bmf_sdk::VideoFrame::crop( int x,
int y,
int w,
int h
) const
Return the selected region which specified by (x, y, w, h)
Parameters
- x start col index
- y start row index
- w number of cols
- h number of rows
Returns VideoFrame
cuda()
VideoFrame bmf_sdk::VideoFrame::cuda( ) const
device()
const Device& bmf_sdk::VideoFrame::device ( ) const
overridevirtualoverride
virtual
interface must implemented by sub-class, which provide device info
Returns
Implements bmf_sdk::Future .
dtype()
ScalarType bmf_sdk::VideoFrame::dtype ( ) const
frame()
const Frame & bmf_sdk::VideoFrame::frame( ) const
Returns
height()
int bmf_sdk::VideoFrame::height ( ) const
make() [1/2]
static VideoFrame bmf_sdk::VideoFrame::make( int width,
int height,
const PixelInfo & pix_info,
const Device & device = kCPU
)
inlinestaticinline
static
Facotry function to construct VideoFrame(Frame)
test_video_frame.cpp for more details
//allocate VideoFrame with default device CPU
auto H420 = PixelInfo(PF_YUV420P, CS_BT607)
auto vf = VideoFrame::make(1920, 1080, H420);
//allocate VideoFrame on CUDA device
auto vf = VideoFrame::make(1920, 1080, H420, kCUDA);
auto vf = VideoFrame::make(1920, 1080, H420, "cuda:0");
auto vf = VideoFrame::make(1920, 1080, H420, Device(kCUDA, 0));
Template Parameters
- device
Parameters
- width
- height
- format
- device const char*, string, Device - infer to Device
Returns VideoFrame
{
return VideoFrame(width, height, pix_info, device);
}
make() [2/2]
static VideoFrame bmf_sdk::VideoFrame::make( int width,
int height,
const PixelInfo & pix_info,
const std::string & device
)
inlinestaticinline
static
{
return VideoFrame(width, height, pix_info, device);
}
operator bool()
bmf_sdk::VideoFrame::operator bool ( ) const
check if VideoFrame is defined
Returns
operator=()
VideoFrame & bmf_sdk::VideoFrame::operator=( const VideoFrame & )
defaultdefault
Returns VideoFrame &
reformat()
VideoFrame bmf_sdk::VideoFrame::reformat( const PixelInfo & pix_info )
Frame reformat, this only support rgb to yuv, or yuv to rgb.
Parameters
- pix_info
Returns VideoFrame
to()
VideoFrame bmf_sdk::VideoFrame::to( const Device & device,
bool non_blocking = false
) const
Copy to target device, if it have already reside on target device, shadow copy will be performed.
Parameters
- device Target device
- non_blocking if true, internal allocator will try to allocate pinned memory, which can make data copy asynchronous
Returns VideoFrame
width()
int bmf_sdk::VideoFrame::width ( ) const
- /20230627/doxygen_converter/bmf/bmf/sdk/cpp_sdk/include/bmf/sdk/ video_frame.h