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)
 
int ff_dnn_get_input (DnnContext *ctx, DNNData *input)
 
int ff_dnn_get_output (DnnContext *ctx, int input_width, int input_height, int *output_width, int *output_height)
 
int ff_dnn_execute_model (DnnContext *ctx, AVFrame *in_frame, AVFrame *out_frame)
 
int ff_dnn_execute_model_classification (DnnContext *ctx, AVFrame *in_frame, AVFrame *out_frame, const char *target)
 
DNNAsyncStatusType ff_dnn_get_result (DnnContext *ctx, AVFrame **in_frame, AVFrame **out_frame)
 
int 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 (deprecated, use backend_configs)", OFFSET(backend_options), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS | AV_OPT_FLAG_DEPRECATED},\
{ "async", "use DNN async inference (ignored, use backend_configs='async=1')", 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()

int 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()

int 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()

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

Definition at line 134 of file dnn_filter_common.c.

Referenced by activate(), dnn_detect_activate(), and filter_frame().

◆ ff_dnn_execute_model_classification()

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

Definition at line 146 of file dnn_filter_common.c.

Referenced by dnn_classify_activate().

◆ ff_dnn_get_result()

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

◆ ff_dnn_flush()

int ff_dnn_flush ( DnnContext ctx)

◆ ff_dnn_uninit()

void ff_dnn_uninit ( DnnContext ctx)

Definition at line 171 of file dnn_filter_common.c.

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

FLAGS
#define FLAGS
Definition: cmdutils.c:584
NULL
#define NULL
Definition: coverity.c:32
AV_OPT_FLAG_DEPRECATED
#define AV_OPT_FLAG_DEPRECATED
Set if option is deprecated, users should refer to AVOption.help text for more information.
Definition: opt.h:303
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:251
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:239