FFmpeg
Data Structures | Functions | Variables
dnn_backend_openvino.c File Reference
#include "dnn_io_proc.h"
#include "libavformat/avio.h"
#include "libavutil/avassert.h"
#include "libavutil/cpu.h"
#include "libavutil/mem.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  OVModel
 
struct  OVRequestItem
 

Functions

static int ov2_map_error (ov_status_e status, const char **desc)
 
static DNNDataType precision_to_datatype (ov_element_type_e precision) 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 void dnn_free_model_ov (DNNModel **model)
 
static int init_model_ov (OVModel *ov_model, const char *input_name, const char **output_names, int nb_outputs)
 
static int execute_model_ov (OVRequestItem *request, Queue *inferenceq)
 
static int get_input_ov (DNNModel *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 (DNNModel *model, const char *input_name, int input_width, int input_height, const char *output_name, int *output_width, int *output_height)
 

Variables

static const AVOption dnn_openvino_options []
 
struct {
   ov_status_e   status
 
   int   av_err
 
   const char *   desc
 
ov2_errors []
 

Detailed Description

DNN OpenVINO backend implementation.

Definition in file dnn_backend_openvino.c.

Function Documentation

◆ ov2_map_error()

static int ov2_map_error ( ov_status_e  status,
const char **  desc 
)
static

◆ precision_to_datatype()

static DNNDataType precision_to_datatype ( ov_element_type_e  precision)
static

◆ get_datatype_size()

static int get_datatype_size ( DNNDataType  dt)
static

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

Referenced by execute_model_ov(), and get_output_ov().

◆ infer_completion_callback()

static void infer_completion_callback ( void *  args)
static

Definition at line 334 of file dnn_backend_openvino.c.

Referenced by execute_model_ov(), and init_model_ov().

◆ dnn_free_model_ov()

static void dnn_free_model_ov ( DNNModel **  model)
static

Definition at line 512 of file dnn_backend_openvino.c.

Referenced by get_output_ov().

◆ init_model_ov()

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

Definition at line 577 of file dnn_backend_openvino.c.

Referenced by get_output_ov().

◆ execute_model_ov()

static int execute_model_ov ( OVRequestItem request,
Queue inferenceq 
)
static

Definition at line 964 of file dnn_backend_openvino.c.

Referenced by get_output_ov().

◆ get_input_ov()

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

Definition at line 1061 of file dnn_backend_openvino.c.

Referenced by get_output_ov().

◆ contain_valid_detection_bbox()

static int contain_valid_detection_bbox ( AVFrame frame)
static

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

Referenced by get_output_ov().

◆ get_output_ov()

static int get_output_ov ( DNNModel 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 1257 of file dnn_backend_openvino.c.

Variable Documentation

◆ dnn_openvino_options

const AVOption dnn_openvino_options[]
static
Initial value:
= {
{ "batch_size", "batch size per request", OFFSET(batch_size), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 1000, FLAGS},
{ "input_resizable", "can input be resizable or not", OFFSET(input_resizable), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
{ "layout", "input layout of model", OFFSET(layout), AV_OPT_TYPE_INT, { .i64 = DL_NONE}, DL_NONE, DL_NHWC, FLAGS, .unit = "layout" },
{ "none", "none", 0, AV_OPT_TYPE_CONST, { .i64 = DL_NONE }, 0, 0, FLAGS, .unit = "layout"},
{ "nchw", "nchw", 0, AV_OPT_TYPE_CONST, { .i64 = DL_NCHW }, 0, 0, FLAGS, .unit = "layout"},
{ "nhwc", "nhwc", 0, AV_OPT_TYPE_CONST, { .i64 = DL_NHWC }, 0, 0, FLAGS, .unit = "layout"},
{ "scale", "Add scale preprocess operation. Divide each element of input by specified value.", OFFSET(scale), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, INT_MIN, INT_MAX, FLAGS},
{ "mean", "Add mean preprocess operation. Subtract specified value from each element of input.", OFFSET(mean), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, INT_MIN, INT_MAX, FLAGS},
{ NULL }
}

Definition at line 86 of file dnn_backend_openvino.c.

◆ status

ov_status_e status

Definition at line 100 of file dnn_backend_openvino.c.

Referenced by activate(), aribcaption_decode(), aribcaption_trans_bitmap_subtitle(), avf_read_packet(), check_status(), consume_from_fifos(), control_port_cb(), copy_avframe_to_pixel_buffer(), copy_cvpixelbuffer(), copy_param_sets(), copy_replace_length_codes(), count_nalus(), create_cv_pixel_buffer(), create_cv_pixel_buffer_info(), decode_frame(), dnn_classify_activate(), dnn_detect_activate(), er_add_slice(), evaluate_parameters(), execute_model_ov(), ff_avfilter_link_set_in_status(), ff_dnn_async_module_cleanup(), ff_dnn_start_inference_async(), ff_er_add_slice(), ff_er_frame_end(), ff_h264_check_intra4x4_pred_mode(), ff_inlink_set_status(), ff_mediacodec_dec_init(), ff_mediacodec_dec_receive(), ff_mediacodec_dec_send(), ff_outlink_set_status(), ff_vc1_parse_frame_header(), ff_vc1_parse_frame_header_adv(), ff_vdpau_common_end_frame(), ff_vdpau_common_init(), ff_vdpau_common_uninit(), ffat_create_decoder(), ffat_init_encoder(), ffat_set_extradata(), ffmal_update_format(), ffmmal_fill_input_port(), ffmmal_fill_output_port(), ffmmal_flush(), ffmmal_init_decoder(), ffmmal_read_frame(), fill_model_input_ov(), forward_frame(), framesync_inject_status(), generate_output(), get_cv_pixel_info(), get_frame_internal(), get_input_ov(), get_input_tf(), get_length_code_size(), get_output_ov(), get_params_size(), guess_status_pts(), handle_input(), infer_completion_callback(), init_model_ov(), link_set_out_status(), map_ssl_error(), media_status_to_error(), mediacodec_dec_flush_codec(), mediacodec_ndk_configure(), mediacodec_ndk_onError(), mediacodec_ndk_releaseOutputBuffer(), mediacodec_ndk_releaseOutputBufferAtTime(), mediacodec_ndk_setAsyncNotifyCallback(), mediacodec_ndk_signalEndOfInputStream(), mediacodec_wrap_hw_buffer(), mediacodec_wrap_sw_audio_buffer(), mediacodec_wrap_sw_video_buffer(), ov2_map_error(), parse_ptl(), request_frame(), set_encoder_property_or_log(), set_extradata(), shdc_shader_compile(), start_jack(), tls_open(), vdpau_error(), vt_dump_encoder(), vtenc_cm_to_avpacket(), vtenc_configure_encoder(), vtenc_create_encoder(), vtenc_frame(), vtenc_init(), vtenc_output_callback(), vtenc_populate_extradata(), vtenc_send_frame(), write_status(), and xfade_opencl_activate().

◆ av_err

int av_err

Definition at line 101 of file dnn_backend_openvino.c.

◆ desc

const char* desc

Definition at line 102 of file dnn_backend_openvino.c.

Referenced by ov2_map_error().

◆ ov2_errors

const { ... } ov2_errors[]
Initial value:
= {
{ OK, 0, "success" },
{ GENERAL_ERROR, AVERROR_EXTERNAL, "general error" },
{ NOT_IMPLEMENTED, AVERROR(ENOSYS), "not implemented" },
{ NETWORK_NOT_LOADED, AVERROR_EXTERNAL, "network not loaded" },
{ PARAMETER_MISMATCH, AVERROR(EINVAL), "parameter mismatch" },
{ NOT_FOUND, AVERROR_EXTERNAL, "not found" },
{ OUT_OF_BOUNDS, AVERROR(EOVERFLOW), "out of bounds" },
{ UNEXPECTED, AVERROR_EXTERNAL, "unexpected" },
{ REQUEST_BUSY, AVERROR(EBUSY), "request busy" },
{ RESULT_NOT_READY, AVERROR(EBUSY), "result not ready" },
{ NOT_ALLOCATED, AVERROR(ENODATA), "not allocated" },
{ INFER_NOT_STARTED, AVERROR_EXTERNAL, "infer not started" },
{ NETWORK_NOT_READ, AVERROR_EXTERNAL, "network not read" },
{ INFER_CANCELLED, AVERROR(ECANCELED), "infer cancelled" },
{ INVALID_C_PARAM, AVERROR(EINVAL), "invalid C parameter" },
{ UNKNOWN_C_ERROR, AVERROR_UNKNOWN, "unknown C error" },
{ NOT_IMPLEMENT_C_METHOD, AVERROR(ENOSYS), "not implement C method" },
{ UNKNOW_EXCEPTION, AVERROR_UNKNOWN, "unknown exception" },
}

Referenced by ov2_map_error().

AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
FLAGS
#define FLAGS
Definition: cmdutils.c:595
AVERROR_UNKNOWN
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:73
DL_NHWC
@ DL_NHWC
Definition: dnn_interface.h:66
DL_NCHW
@ DL_NCHW
Definition: dnn_interface.h:65
NULL
#define NULL
Definition: coverity.c:32
AVERROR_EXTERNAL
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition: error.h:59
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition: opt.h:271
layout
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel layout
Definition: filter_design.txt:18
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
Underlying C type is int.
Definition: opt.h:259
mean
static float mean(const float *input, int size)
Definition: vf_nnedi.c:866
DL_NONE
@ DL_NONE
Definition: dnn_interface.h:64
scale
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition: intra.c:291
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299