FFmpeg
Data Structures | Macros | Functions
dnn_filter_common.h File Reference
#include "dnn_interface.h"

Go to the source code of this file.

Data Structures

struct  DnnContext
 

Macros

#define DNN_COMMON_OPTIONS
 

Functions

int ff_dnn_init (DnnContext *ctx, DNNFunctionType func_type, AVFilterContext *filter_ctx)
 
int ff_dnn_set_frame_proc (DnnContext *ctx, FramePrePostProc pre_proc, FramePrePostProc post_proc)
 
int ff_dnn_set_detect_post_proc (DnnContext *ctx, DetectPostProc post_proc)
 
int ff_dnn_set_classify_post_proc (DnnContext *ctx, ClassifyPostProc post_proc)
 
DNNReturnType ff_dnn_get_input (DnnContext *ctx, DNNData *input)
 
DNNReturnType ff_dnn_get_output (DnnContext *ctx, int input_width, int input_height, int *output_width, int *output_height)
 
DNNReturnType ff_dnn_execute_model (DnnContext *ctx, AVFrame *in_frame, AVFrame *out_frame)
 
DNNReturnType ff_dnn_execute_model_async (DnnContext *ctx, AVFrame *in_frame, AVFrame *out_frame)
 
DNNReturnType ff_dnn_execute_model_classification (DnnContext *ctx, AVFrame *in_frame, AVFrame *out_frame, char *target)
 
DNNAsyncStatusType ff_dnn_get_async_result (DnnContext *ctx, AVFrame **in_frame, AVFrame **out_frame)
 
DNNReturnType ff_dnn_flush (DnnContext *ctx)
 
void ff_dnn_uninit (DnnContext *ctx)
 

Detailed Description

common functions for the dnn based filters

Definition in file dnn_filter_common.h.

Macro Definition Documentation

◆ DNN_COMMON_OPTIONS

#define DNN_COMMON_OPTIONS
Value:
{ "model", "path to model file", OFFSET(model_filename), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS },\
{ "input", "input name of the model", OFFSET(model_inputname), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS },\
{ "output", "output name of the model", OFFSET(model_outputnames_string), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS },\
{ "backend_configs", "backend configs", OFFSET(backend_options), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS },\
{ "options", "backend configs", OFFSET(backend_options), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS },\
{ "async", "use DNN async inference", OFFSET(async), AV_OPT_TYPE_BOOL, { .i64 = 1}, 0, 1, FLAGS},

Definition at line 43 of file dnn_filter_common.h.

Function Documentation

◆ ff_dnn_init()

int ff_dnn_init ( DnnContext ctx,
DNNFunctionType  func_type,
AVFilterContext filter_ctx 
)

Definition at line 54 of file dnn_filter_common.c.

Referenced by dnn_classify_init(), dnn_detect_init(), and init().

◆ ff_dnn_set_frame_proc()

int ff_dnn_set_frame_proc ( DnnContext ctx,
FramePrePostProc  pre_proc,
FramePrePostProc  post_proc 
)

Definition at line 102 of file dnn_filter_common.c.

◆ ff_dnn_set_detect_post_proc()

int ff_dnn_set_detect_post_proc ( DnnContext ctx,
DetectPostProc  post_proc 
)

Definition at line 109 of file dnn_filter_common.c.

Referenced by dnn_detect_init().

◆ ff_dnn_set_classify_post_proc()

int ff_dnn_set_classify_post_proc ( DnnContext ctx,
ClassifyPostProc  post_proc 
)

Definition at line 115 of file dnn_filter_common.c.

Referenced by dnn_classify_init().

◆ ff_dnn_get_input()

DNNReturnType ff_dnn_get_input ( DnnContext ctx,
DNNData input 
)

Definition at line 121 of file dnn_filter_common.c.

Referenced by config_input().

◆ ff_dnn_get_output()

DNNReturnType ff_dnn_get_output ( DnnContext ctx,
int  input_width,
int  input_height,
int output_width,
int output_height 
)

Definition at line 126 of file dnn_filter_common.c.

Referenced by config_output().

◆ ff_dnn_execute_model()

DNNReturnType ff_dnn_execute_model ( DnnContext ctx,
AVFrame in_frame,
AVFrame out_frame 
)

Definition at line 132 of file dnn_filter_common.c.

Referenced by dnn_detect_filter_frame(), and filter_frame().

◆ ff_dnn_execute_model_async()

DNNReturnType ff_dnn_execute_model_async ( DnnContext ctx,
AVFrame in_frame,
AVFrame out_frame 
)

Definition at line 144 of file dnn_filter_common.c.

Referenced by activate_async(), and dnn_detect_activate_async().

◆ ff_dnn_execute_model_classification()

DNNReturnType ff_dnn_execute_model_classification ( DnnContext ctx,
AVFrame in_frame,
AVFrame out_frame,
char *  target 
)

Definition at line 156 of file dnn_filter_common.c.

Referenced by dnn_classify_activate().

◆ ff_dnn_get_async_result()

DNNAsyncStatusType ff_dnn_get_async_result ( DnnContext ctx,
AVFrame **  in_frame,
AVFrame **  out_frame 
)

◆ ff_dnn_flush()

DNNReturnType ff_dnn_flush ( DnnContext ctx)

◆ ff_dnn_uninit()

void ff_dnn_uninit ( DnnContext ctx)

Definition at line 181 of file dnn_filter_common.c.

Referenced by dnn_classify_uninit(), dnn_detect_uninit(), and uninit().

FLAGS
#define FLAGS
Definition: cmdutils.c:539
NULL
#define NULL
Definition: coverity.c:32
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_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:242
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229