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

公共类型

using Frame = hmp::Frame

公共成员函数

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

const Frame & frame () 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)

img

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)

img

bmf_sdk::SequenceData void set_pts (int64_t pts )

int64_t pts () const

Rational time_base () 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)

img

bmf_sdk::Future Future ()

Future (const Future &)=default

Future ( 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 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 )

受保护的成员函数

VideoFrame (const std::shared_ptr< Private > &other)

img

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

构造函数和析构函数文档

 VideoFrame() [1/6]

bmf_sdk::VideoFrame::VideoFrame (  )  

构建一个未定义的 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:专用于 YUV 数据,平面之间形状不规则

 VideoFrame() [5/6]

bmf_sdk::VideoFrame::VideoFrame ( int width, 
  int height, 
  const PixelInfo & pix_info, 
  const Device & device = kCPU 
 )   

使用 factory function VideoFrame::make 构建具有给定尺寸(宽、高)、PixelInfo 和设备的 VideoFrame(Frame) 以方便使用。 Parameters

  • width:Y 平面的宽
  • height:Y 平面的高
  • pix_info:PixelFormat 和 ColorModel
  • device:device

 VideoFrame() [6/6]

bmf_sdk::VideoFrame::VideoFrame ( const std::shared_ptr< Private > & other )  

protectedprotected

成员函数文档

 copy_()

 VideoFrame & bmf_sdk::VideoFrame::copy_( const VideoFrame &from )  

原地复制。

Parameters

  • from:type和shape相同的数据源

Returns VideoFrame &

 copy_props()

 VideoFrame & bmf_sdk::VideoFrame::copy_props( const VideoFrame &from )  

复制来自 from 的所有 extra props(由成员函数set_xxx设置)(如果需要,可深度复制) 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 

返回由(x、y、w、h)指定的选定区域

Parameters

  • x:起始列索引
  • y:起始行索引
  • w:列数
  • h:行数

Returns VideoFrame

 cuda()

 VideoFrame bmf_sdk::VideoFrame::cuda(  ) const 

 device()

const Device& bmf_sdk::VideoFrame::device (  ) const 

overridevirtualoverride

virtual

接口必须由子类实现,子类提供设备信息。

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

构建 VideoFrame(Frame) 的 Facotry function

更多详细信息,请参阅 test_video_frame.cpp

//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 

检查是否定义了 VideoFrame

Returns

 operator=()

VideoFrame & bmf_sdk::VideoFrame::operator=( const VideoFrame & )  

defaultdefault

Returns VideoFrame &

 reformat()

 VideoFrame bmf_sdk::VideoFrame::reformat( const PixelInfo & pix_info )  

帧格式转换,此功能仅支持 rgb 转换为 yuv 或 yuv 转换为 rgb。

Parameters

  • pix_info

Returns VideoFrame

 to()

 VideoFrame bmf_sdk::VideoFrame::to( const Device & device, 
  bool non_blocking = false 
 )  const 

复制到目标设备上,如果目标设备上已经有,则将执行 shadow copy。

Parameters

  • device:目标设备
  • non_blocking:为 true 时,内部分配器将尝试分配固定的内存,这会导致数据复制异步

Returns VideoFrame

 width()

int bmf_sdk::VideoFrame::width (  ) const 
  • /20230627/doxygen_converter/bmf/bmf/sdk/cpp_sdk/include/bmf/sdk/ video_frame.h

最后修改 February 19, 2024 : fix baidu statistics (daa0758)