FFmpeg
Macros | Functions | Variables
dnn_backend_native.c File Reference
#include "dnn_backend_native.h"
#include "libavutil/avassert.h"
#include "dnn_backend_native_layer_conv2d.h"
#include "dnn_backend_native_layers.h"
#include "dnn_io_proc.h"
#include "dnn_backend_common.h"

Go to the source code of this file.

Macros

#define OFFSET(x)   offsetof(NativeContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM
 
#define DNN_NATIVE_MAGIC   "FFMPEGDNNNATIVE"
 

Functions

static int execute_model_native (Queue *lltask_queue)
 
static int extract_lltask_from_task (TaskItem *task, Queue *lltask_queue)
 
static int get_input_native (void *model, DNNData *input, const char *input_name)
 
static int get_output_native (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_native (const char *model_filename, DNNFunctionType func_type, const char *options, AVFilterContext *filter_ctx)
 
int ff_dnn_execute_model_native (const DNNModel *model, DNNExecBaseParams *exec_params)
 
int ff_dnn_flush_native (const DNNModel *model)
 
DNNAsyncStatusType ff_dnn_get_result_native (const DNNModel *model, AVFrame **in, AVFrame **out)
 
int32_t ff_calculate_operand_dims_count (const DnnOperand *oprd)
 
int32_t ff_calculate_operand_data_length (const DnnOperand *oprd)
 
void ff_dnn_free_model_native (DNNModel **model)
 

Variables

static const AVOption dnn_native_options []
 
static const AVClass dnn_native_class
 

Detailed Description

DNN native backend implementation.

Definition in file dnn_backend_native.c.

Macro Definition Documentation

◆ OFFSET

#define OFFSET (   x)    offsetof(NativeContext, x)

Definition at line 33 of file dnn_backend_native.c.

◆ FLAGS

#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM

Definition at line 34 of file dnn_backend_native.c.

◆ DNN_NATIVE_MAGIC

#define DNN_NATIVE_MAGIC   "FFMPEGDNNNATIVE"

Function Documentation

◆ execute_model_native()

static int execute_model_native ( Queue lltask_queue)
static

◆ extract_lltask_from_task()

static int extract_lltask_from_task ( TaskItem task,
Queue lltask_queue 
)
static

Definition at line 51 of file dnn_backend_native.c.

Referenced by ff_dnn_execute_model_native(), and get_output_native().

◆ get_input_native()

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

Definition at line 73 of file dnn_backend_native.c.

Referenced by ff_dnn_load_model_native().

◆ get_output_native()

static int get_output_native ( 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 99 of file dnn_backend_native.c.

Referenced by ff_dnn_load_model_native().

◆ ff_dnn_load_model_native()

DNNModel* ff_dnn_load_model_native ( const char *  model_filename,
DNNFunctionType  func_type,
const char *  options,
AVFilterContext filter_ctx 
)

check file header with string and version

Definition at line 139 of file dnn_backend_native.c.

Referenced by ff_get_dnn_module(), and load_native_model().

◆ ff_dnn_execute_model_native()

int ff_dnn_execute_model_native ( const DNNModel model,
DNNExecBaseParams exec_params 
)

Definition at line 435 of file dnn_backend_native.c.

Referenced by ff_get_dnn_module().

◆ ff_dnn_flush_native()

int ff_dnn_flush_native ( const DNNModel model)

Definition at line 474 of file dnn_backend_native.c.

Referenced by ff_get_dnn_module().

◆ ff_dnn_get_result_native()

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

Definition at line 488 of file dnn_backend_native.c.

Referenced by ff_get_dnn_module().

◆ ff_calculate_operand_dims_count()

int32_t ff_calculate_operand_dims_count ( const DnnOperand oprd)

◆ ff_calculate_operand_data_length()

int32_t ff_calculate_operand_data_length ( const DnnOperand oprd)

◆ ff_dnn_free_model_native()

void ff_dnn_free_model_native ( DNNModel **  model)

Variable Documentation

◆ dnn_native_options

const AVOption dnn_native_options[]
static
Initial value:
= {
{ "conv2d_threads", "threads num for conv2d layer", OFFSET(options.conv2d_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS },
{ "async", "use DNN async inference", OFFSET(options.async), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
{ NULL },
}

Definition at line 35 of file dnn_backend_native.c.

◆ dnn_native_class

const AVClass dnn_native_class
static
Initial value:
= {
.class_name = "dnn_native",
.item_name = av_default_item_name,
.option = dnn_native_options,
}

Definition at line 41 of file dnn_backend_native.c.

Referenced by ff_dnn_load_model_native().

OFFSET
#define OFFSET(x)
Definition: dnn_backend_native.c:33
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
dnn_native_options
static const AVOption dnn_native_options[]
Definition: dnn_backend_native.c:35
AV_CLASS_CATEGORY_FILTER
@ AV_CLASS_CATEGORY_FILTER
Definition: log.h:36
options
const OptionDef options[]
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
FLAGS
#define FLAGS
Definition: dnn_backend_native.c:34
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:244