27#define DNN_ASYNC_SUCCESS (void *)0
28#define DNN_ASYNC_FAIL (void *)-1
51 if (task ==
NULL || exec_params ==
NULL || backend_model ==
NULL)
53 if (do_ioproc != 0 && do_ioproc != 1)
55 if (async != 0 && async != 1)
63 task->
model = backend_model;
77 void *request = async_module->
args;
92#if HAVE_PTHREAD_CANCEL
123#if HAVE_PTHREAD_CANCEL
182 in_frame->
width = input_width;
183 in_frame->
height = input_height;
int ff_check_exec_params(void *ctx, DNNBackendType backend, DNNFunctionType func_type, DNNExecBaseParams *exec_params)
void ff_dnn_wait_requests(SafeQueue *request_queue, int nireq)
Wait for all inference requests to complete before teardown.
#define DNN_ASYNC_SUCCESS
static void * async_thread_routine(void *args)
Thread routine for async execution.
DNNAsyncStatusType ff_dnn_get_result_common(Queue *task_queue, AVFrame **in, AVFrame **out)
Extract input and output frame from the Task Queue after asynchronous inference.
int ff_dnn_async_module_cleanup(DNNAsyncExecModule *async_module)
Join the Async Execution thread and set module pointers to NULL.
int ff_dnn_fill_task(TaskItem *task, DNNExecBaseParams *exec_params, void *backend_model, int async, int do_ioproc)
Fill the Task for Backend Execution.
int ff_dnn_start_inference_async(void *ctx, DNNAsyncExecModule *async_module)
Start asynchronous inference routine for the TensorFlow model on a detached thread.
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.
DNN common functions different backends.
#define DNN_GENERIC_ERROR
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Memory handling functions.
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
static av_always_inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
void * ff_queue_pop_front(Queue *q)
Remove and free first element from the Queue.
void * ff_queue_peek_front(Queue *q)
Return a pointer to the data at the head of the queue.
void ff_safe_queue_wait_for_size(SafeQueue *sq, size_t min_size)
Wait until queue length reaches at least min_size.
This structure describes decoded (raw) audio or video data.
Common Async Execution Mechanism for the DNN Backends.
void * args
Argument for the execution functions.
int(* start_inference)(void *request)
Synchronous inference function for the backend with corresponding request item as the argument.
void(* callback)(void *args)
Completion Callback for the backend.
const char ** output_names
Linear double-ended data structure.
Double-ended queue with mutex locks ensuring data consistency while multithreading.
const char ** output_names
static AVFormatContext * ctx