FFmpeg
Data Structures | Functions | Variables
dnn_backend_openvino.c File Reference
#include "dnn_backend_openvino.h"
#include "dnn_io_proc.h"
#include "libavformat/avio.h"
#include "libavutil/avassert.h"
#include "libavutil/opt.h"
#include "libavutil/avstring.h"
#include "libavutil/detection_bbox.h"

Go to the source code of this file.

Data Structures

struct  OVOptions
 
struct  OVContext
 
struct  OVModel
 
struct  RequestItem
 

Functions

 AVFILTER_DEFINE_CLASS (dnn_openvino)
 
static DNNDataType precision_to_datatype (precision_e precision)
 
static int get_datatype_size (DNNDataType dt)
 
static DNNReturnType fill_model_input_ov (OVModel *ov_model, RequestItem *request)
 
static void infer_completion_callback (void *args)
 
static DNNReturnType init_model_ov (OVModel *ov_model, const char *input_name, const char *output_name)
 
static DNNReturnType execute_model_ov (RequestItem *request, Queue *inferenceq)
 
static DNNReturnType get_input_ov (void *model, DNNData *input, const char *input_name)
 
static int contain_valid_detection_bbox (AVFrame *frame)
 
static DNNReturnType extract_inference_from_task (DNNFunctionType func_type, TaskItem *task, Queue *inference_queue, DNNExecBaseParams *exec_params)
 
static DNNReturnType get_output_ov (void *model, const char *input_name, int input_width, int input_height, const char *output_name, int *output_width, int *output_height)
 
DNNModelff_dnn_load_model_ov (const char *model_filename, DNNFunctionType func_type, const char *options, AVFilterContext *filter_ctx)
 
DNNReturnType ff_dnn_execute_model_ov (const DNNModel *model, DNNExecBaseParams *exec_params)
 
DNNReturnType ff_dnn_execute_model_async_ov (const DNNModel *model, DNNExecBaseParams *exec_params)
 
DNNAsyncStatusType ff_dnn_get_async_result_ov (const DNNModel *model, AVFrame **in, AVFrame **out)
 
DNNReturnType ff_dnn_flush_ov (const DNNModel *model)
 
void ff_dnn_free_model_ov (DNNModel **model)
 

Variables

static const AVOption dnn_openvino_options []
 

Detailed Description

DNN OpenVINO backend implementation.

Definition in file dnn_backend_openvino.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( dnn_openvino  )

◆ precision_to_datatype()

static DNNDataType precision_to_datatype ( precision_e  precision)
static

◆ get_datatype_size()

static int get_datatype_size ( DNNDataType  dt)
static

Definition at line 100 of file dnn_backend_openvino.c.

Referenced by fill_model_input_ov(), and infer_completion_callback().

◆ fill_model_input_ov()

static DNNReturnType fill_model_input_ov ( OVModel ov_model,
RequestItem request 
)
static

Definition at line 114 of file dnn_backend_openvino.c.

Referenced by execute_model_ov(), and ff_dnn_flush_ov().

◆ infer_completion_callback()

static void infer_completion_callback ( void *  args)
static

Definition at line 196 of file dnn_backend_openvino.c.

Referenced by execute_model_ov(), and init_model_ov().

◆ init_model_ov()

static DNNReturnType init_model_ov ( OVModel ov_model,
const char *  input_name,
const char *  output_name 
)
static

◆ execute_model_ov()

static DNNReturnType execute_model_ov ( RequestItem request,
Queue inferenceq 
)
static

◆ get_input_ov()

static DNNReturnType get_input_ov ( void *  model,
DNNData input,
const char *  input_name 
)
static

Definition at line 474 of file dnn_backend_openvino.c.

Referenced by ff_dnn_load_model_ov().

◆ contain_valid_detection_bbox()

static int contain_valid_detection_bbox ( AVFrame frame)
static

Definition at line 524 of file dnn_backend_openvino.c.

Referenced by extract_inference_from_task().

◆ extract_inference_from_task()

static DNNReturnType extract_inference_from_task ( DNNFunctionType  func_type,
TaskItem task,
Queue inference_queue,
DNNExecBaseParams exec_params 
)
static

◆ get_output_ov()

static DNNReturnType get_output_ov ( void *  model,
const char *  input_name,
int  input_width,
int  input_height,
const char *  output_name,
int output_width,
int output_height 
)
static

Definition at line 627 of file dnn_backend_openvino.c.

Referenced by ff_dnn_load_model_ov().

◆ ff_dnn_load_model_ov()

DNNModel* ff_dnn_load_model_ov ( const char *  model_filename,
DNNFunctionType  func_type,
const char *  options,
AVFilterContext filter_ctx 
)

Definition at line 712 of file dnn_backend_openvino.c.

Referenced by ff_get_dnn_module().

◆ ff_dnn_execute_model_ov()

DNNReturnType ff_dnn_execute_model_ov ( const DNNModel model,
DNNExecBaseParams exec_params 
)

Definition at line 769 of file dnn_backend_openvino.c.

Referenced by ff_get_dnn_module().

◆ ff_dnn_execute_model_async_ov()

DNNReturnType ff_dnn_execute_model_async_ov ( const DNNModel model,
DNNExecBaseParams exec_params 
)

Definition at line 818 of file dnn_backend_openvino.c.

Referenced by ff_get_dnn_module().

◆ ff_dnn_get_async_result_ov()

DNNAsyncStatusType ff_dnn_get_async_result_ov ( const DNNModel model,
AVFrame **  in,
AVFrame **  out 
)

Definition at line 874 of file dnn_backend_openvino.c.

Referenced by ff_get_dnn_module().

◆ ff_dnn_flush_ov()

DNNReturnType ff_dnn_flush_ov ( const DNNModel model)

Definition at line 895 of file dnn_backend_openvino.c.

Referenced by ff_get_dnn_module().

◆ ff_dnn_free_model_ov()

void ff_dnn_free_model_ov ( DNNModel **  model)

Definition at line 933 of file dnn_backend_openvino.c.

Referenced by ff_dnn_load_model_ov(), ff_get_dnn_module(), and init_model_ov().

Variable Documentation

◆ dnn_openvino_options

const AVOption dnn_openvino_options[]
static
Initial value:
= {
{ "device", "device to run model", OFFSET(options.device_type), AV_OPT_TYPE_STRING, { .str = "CPU" }, 0, 0, FLAGS },
{ "nireq", "number of request", OFFSET(options.nireq), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
{ "batch_size", "batch size per request", OFFSET(options.batch_size), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 1000, FLAGS},
{ "input_resizable", "can input be resizable or not", OFFSET(options.input_resizable), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
{ NULL }
}

Definition at line 76 of file dnn_backend_openvino.c.

FLAGS
#define FLAGS
Definition: cmdutils.c:539
NULL
#define NULL
Definition: coverity.c:32
options
const OptionDef options[]
OFFSET
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option keep it simple and lowercase description are in without and describe what they for example set the foo of the bar offset is the offset of the field in your see the OFFSET() macro
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:242
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229