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 int fill_model_input_ov (OVModel *ov_model, OVRequestItem *request)
 
static void infer_completion_callback (void *args)
 
static int init_model_ov (OVModel *ov_model, const char *input_name, const char *output_name)
 
static int execute_model_ov (OVRequestItem *request, Queue *inferenceq)
 
static int get_input_ov (void *model, DNNData *input, const char *input_name)
 
static int contain_valid_detection_bbox (AVFrame *frame)
 
static int extract_lltask_from_task (DNNFunctionType func_type, TaskItem *task, Queue *lltask_queue, DNNExecBaseParams *exec_params)
 
static int 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)
 
int ff_dnn_execute_model_ov (const DNNModel *model, DNNExecBaseParams *exec_params)
 
DNNAsyncStatusType ff_dnn_get_result_ov (const DNNModel *model, AVFrame **in, AVFrame **out)
 
int 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 103 of file dnn_backend_openvino.c.

Referenced by fill_model_input_ov(), and infer_completion_callback().

◆ fill_model_input_ov()

static int fill_model_input_ov ( OVModel ov_model,
OVRequestItem request 
)
static

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

Referenced by execute_model_ov(), and init_model_ov().

◆ init_model_ov()

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

Definition at line 296 of file dnn_backend_openvino.c.

Referenced by ff_dnn_execute_model_ov(), and get_output_ov().

◆ execute_model_ov()

static int execute_model_ov ( OVRequestItem request,
Queue inferenceq 
)
static

Definition at line 445 of file dnn_backend_openvino.c.

Referenced by ff_dnn_execute_model_ov(), and get_output_ov().

◆ get_input_ov()

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

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

Referenced by extract_lltask_from_task().

◆ extract_lltask_from_task()

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

Definition at line 588 of file dnn_backend_openvino.c.

Referenced by ff_dnn_execute_model_ov(), and get_output_ov().

◆ get_output_ov()

static int 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 654 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 724 of file dnn_backend_openvino.c.

Referenced by ff_get_dnn_module().

◆ ff_dnn_execute_model_ov()

int ff_dnn_execute_model_ov ( const DNNModel model,
DNNExecBaseParams exec_params 
)

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

Referenced by ff_get_dnn_module().

◆ ff_dnn_flush_ov()

int ff_dnn_flush_ov ( const DNNModel model)

Definition at line 902 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 940 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 79 of file dnn_backend_openvino.c.

FLAGS
#define FLAGS
Definition: cmdutils.c:515
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:225
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:244
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229