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/cpu.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  OVRequestItem
 

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, OVRequestItem *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 (OVRequestItem *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_lltask_from_task (DNNFunctionType func_type, TaskItem *task, Queue *lltask_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)
 
DNNAsyncStatusType ff_dnn_get_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 101 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,
OVRequestItem request 
)
static

Definition at line 115 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 197 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

Definition at line 304 of file dnn_backend_openvino.c.

Referenced by ff_dnn_execute_model_ov(), and get_output_ov().

◆ execute_model_ov()

static DNNReturnType execute_model_ov ( OVRequestItem request,
Queue inferenceq 
)
static

Definition at line 426 of file dnn_backend_openvino.c.

Referenced by ff_dnn_execute_model_ov(), and get_output_ov().

◆ get_input_ov()

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

Definition at line 483 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 533 of file dnn_backend_openvino.c.

Referenced by extract_lltask_from_task().

◆ extract_lltask_from_task()

static DNNReturnType extract_lltask_from_task ( DNNFunctionType  func_type,
TaskItem task,
Queue lltask_queue,
DNNExecBaseParams exec_params 
)
static

Definition at line 570 of file dnn_backend_openvino.c.

Referenced by ff_dnn_execute_model_ov(), and get_output_ov().

◆ 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 636 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 704 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 761 of file dnn_backend_openvino.c.

Referenced by ff_get_dnn_module().

◆ ff_dnn_get_result_ov()

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

Definition at line 840 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 846 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 884 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 },
{ "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 77 of file dnn_backend_openvino.c.

FLAGS
#define FLAGS
Definition: cmdutils.c:535
DNN_BACKEND_COMMON_OPTIONS
#define DNN_BACKEND_COMMON_OPTIONS
Definition: dnn_backend_common.h:31
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:224
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:241
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:228