summaryrefslogtreecommitdiff
path: root/libavfilter/dnn/dnn_backend_common.c
diff options
context:
space:
mode:
authorShubhanshu Saxena <shubhanshu.e01@gmail.com>2021-08-08 16:25:32 +0530
committerGuo Yejun <yejun.guo@intel.com>2021-08-10 22:27:27 +0800
commitc71657858833008d2c17990ee78d2ec792996a1a (patch)
treeacc99d38758c124b21b884cbb94da5408eea6081 /libavfilter/dnn/dnn_backend_common.c
parent86f0a4f9deb702528b914a194fac727f08e76c20 (diff)
lavfi/dnn: Common Function to Get Async Result in DNN Backends
This commits refactors the get async result function for common use in all three backends. Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
Diffstat (limited to 'libavfilter/dnn/dnn_backend_common.c')
-rw-r--r--libavfilter/dnn/dnn_backend_common.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libavfilter/dnn/dnn_backend_common.c b/libavfilter/dnn/dnn_backend_common.c
index 4c9045501f..df4bab85e0 100644
--- a/libavfilter/dnn/dnn_backend_common.c
+++ b/libavfilter/dnn/dnn_backend_common.c
@@ -122,3 +122,23 @@ DNNReturnType ff_dnn_start_inference_async(void *ctx, DNNAsyncExecModule *async_
#endif
return DNN_SUCCESS;
}
+
+DNNAsyncStatusType ff_dnn_get_async_result_common(Queue *task_queue, AVFrame **in, AVFrame **out)
+{
+ TaskItem *task = ff_queue_peek_front(task_queue);
+
+ if (!task) {
+ return DAST_EMPTY_QUEUE;
+ }
+
+ if (task->inference_done != task->inference_todo) {
+ return DAST_NOT_READY;
+ }
+
+ *in = task->in_frame;
+ *out = task->out_frame;
+ ff_queue_pop_front(task_queue);
+ av_freep(&task);
+
+ return DAST_SUCCESS;
+}