FFmpeg
Data Structures | Macros | Functions
dnn_backend_common.h File Reference
#include "queue.h"
#include "../dnn_interface.h"
#include "libavutil/thread.h"

Go to the source code of this file.

Data Structures

struct   TaskItem
 
struct   LastLevelTaskItem
 
struct   DNNAsyncExecModule
  Common Async Execution Mechanism for the DNN Backends. More...
 

Macros

 
#define  DNN_DEFINE_CLASS(fname)   DNN_DEFINE_CLASS_EXT(fname, #fname, fname##_options)
 

Functions

int  ff_check_exec_params (void *ctx, DNNBackendType backend, DNNFunctionType func_type, DNNExecBaseParams *exec_params)
 
int  ff_dnn_fill_task (TaskItem *task, DNNExecBaseParams *exec_params, void *backend_model, int async, int do_ioproc)
  Fill the Task for Backend Execution. More...
 
  Join the Async Execution thread and set module pointers to NULL. More...
 
  Start asynchronous inference routine for the TensorFlow model on a detached thread. More...
 
  Extract input and output frame from the Task Queue after asynchronous inference. More...
 
int  ff_dnn_fill_gettingoutput_task (TaskItem *task, DNNExecBaseParams *exec_params, void *backend_model, int input_height, int input_width, void *ctx)
  Allocate input and output frames and fill the Task with execution parameters. More...
 

Detailed Description

DNN common functions different backends.

Definition in file dnn_backend_common.h.

Macro Definition Documentation

DNN_DEFINE_CLASS_EXT

#define DNN_DEFINE_CLASS_EXT (   name,
  desc,
  options 
)
Value:
{ \
.class_name = desc, \
.item_name = av_default_item_name, \
.option = options, \
.version = LIBAVUTIL_VERSION_INT, \
.category = AV_CLASS_CATEGORY_FILTER, \
}

Definition at line 31 of file dnn_backend_common.h.

DNN_DEFINE_CLASS

#define DNN_DEFINE_CLASS (   fname )    DNN_DEFINE_CLASS_EXT(fname, #fname, fname##_options)

Definition at line 39 of file dnn_backend_common.h.

Function Documentation

ff_check_exec_params()

int ff_check_exec_params ( void *  ctx,
DNNBackendType  backend,
DNNFunctionType  func_type,
DNNExecBaseParamsexec_params 
)

Definition at line 30 of file dnn_backend_common.c.

Referenced by dnn_execute_model_tf(), dnn_execute_model_th(), and get_output_ov().

ff_dnn_fill_task()

int ff_dnn_fill_task ( TaskItemtask,
DNNExecBaseParamsexec_params,
void *  backend_model,
int  async,
int  do_ioproc 
)

Fill the Task for Backend Execution.

It should be called after checking execution parameters using ff_check_exec_params.

Parameters
task pointer to the allocated task
exec_param pointer to execution parameters
backend_model void pointer to the backend model
async flag for async execution. Must be 0 or 1
do_ioproc flag for IO processing. Must be 0 or 1
Returns
0 if successful or error code otherwise.

Definition at line 50 of file dnn_backend_common.c.

Referenced by dnn_execute_model_tf(), dnn_execute_model_th(), ff_dnn_fill_gettingoutput_task(), and get_output_ov().

ff_dnn_async_module_cleanup()

int ff_dnn_async_module_cleanup ( DNNAsyncExecModuleasync_module )

Join the Async Execution thread and set module pointers to NULL.

Parameters
async_module pointer to DNNAsyncExecModule module
Returns
0 if successful or error code otherwise.

Definition at line 86 of file dnn_backend_common.c.

Referenced by destroy_request_item().

ff_dnn_start_inference_async()

int ff_dnn_start_inference_async ( void *  ctx,
DNNAsyncExecModuleasync_module 
)

Start asynchronous inference routine for the TensorFlow model on a detached thread.

It calls the completion callback after the inference completes. Completion callback and inference function must be set before calling this function.

If POSIX threads aren't supported, the execution rolls back to synchronous mode, calling completion callback after inference.

Parameters
ctx pointer to the backend context
async_module pointer to DNNAsyncExecModule module
Returns
0 on the start of async inference or error code otherwise.

Definition at line 105 of file dnn_backend_common.c.

Referenced by dnn_flush_tf(), and execute_model_tf().

ff_dnn_get_result_common()

DNNAsyncStatusType ff_dnn_get_result_common ( Queuetask_queue,
AVFrame **  in,
AVFrame **  out 
)

Extract input and output frame from the Task Queue after asynchronous inference.

Parameters
task_queue pointer to the task queue of the backend
in double pointer to the input frame
out double pointer to the output frame
Return values
DAST_EMPTY_QUEUE if task queue is empty
DAST_NOT_READY if inference not completed yet.
DAST_SUCCESS if result successfully extracted

Definition at line 136 of file dnn_backend_common.c.

Referenced by dnn_get_result_tf(), dnn_get_result_th(), and get_output_ov().

ff_dnn_fill_gettingoutput_task()

int ff_dnn_fill_gettingoutput_task ( TaskItemtask,
DNNExecBaseParamsexec_params,
void *  backend_model,
int  input_height,
int  input_width,
void *  ctx 
)

Allocate input and output frames and fill the Task with execution parameters.

Parameters
task pointer to the allocated task
exec_params pointer to execution parameters
backend_model void pointer to the backend model
input_height height of input frame
input_width width of input frame
ctx pointer to the backend context
Returns
0 if successful or error code otherwise.

Definition at line 156 of file dnn_backend_common.c.

Referenced by get_output_ov(), get_output_tf(), and get_output_th().

LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AV_CLASS_CATEGORY_FILTER
@ AV_CLASS_CATEGORY_FILTER
Definition: log.h:36
options
const OptionDef options[]
desc
const char * desc
Definition: libsvtav1.c:79

Generated on Fri Aug 22 2025 14:00:04 for FFmpeg by   doxygen 1.8.17

AltStyle によって変換されたページ (->オリジナル) /