[FFmpeg-devel] [PATCH 02/10] lavfi/dnn: Convert output_name to char** in TaskItem

Shubhanshu Saxena shubhanshu.e01 at gmail.com
Fri May 28 12:24:46 EEST 2021


Convert output_name to char **output_names in TaskItem and use it as
a pointer to array of output names in the DNN backend.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01 at gmail.com>
---
 libavfilter/dnn/dnn_backend_common.h   |  2 +-
 libavfilter/dnn/dnn_backend_openvino.c | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_common.h b/libavfilter/dnn/dnn_backend_common.h
index 0c043e51f0..f76a05026d 100644
--- a/libavfilter/dnn/dnn_backend_common.h
+++ b/libavfilter/dnn/dnn_backend_common.h
@@ -32,7 +32,7 @@ typedef struct TaskItem {
     AVFrame *in_frame;
     AVFrame *out_frame;
     const char *input_name;
-    const char *output_name;
+    const char **output_names;
     int async;
     int do_ioproc;
     uint32_t inference_todo;
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index a84370d689..0f3b235820 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -208,7 +208,7 @@ static void infer_completion_callback(void *args)
     DNNData output;
     OVContext *ctx = &ov_model->ctx;
 
-    status = ie_infer_request_get_blob(request->infer_request, task->output_name, &output_blob);
+    status = ie_infer_request_get_blob(request->infer_request, task->output_names[0], &output_blob);
     if (status != OK) {
         //incorrect output name
         char *model_output_name = NULL;
@@ -222,7 +222,7 @@ static void infer_completion_callback(void *args)
         }
         av_log(ctx, AV_LOG_ERROR,
                "output \"%s\" may not correct, all output(s) are: \"%s\"\n",
-               task->output_name, all_output_names);
+               task->output_names[0], all_output_names);
         return;
     }
 
@@ -676,7 +676,7 @@ static DNNReturnType get_output_ov(void *model, const char *input_name, int inpu
     task.async = 0;
     task.input_name = input_name;
     task.in_frame = in_frame;
-    task.output_name = output_name;
+    task.output_names = &output_name;
     task.out_frame = out_frame;
     task.model = ov_model;
 
@@ -796,7 +796,7 @@ DNNReturnType ff_dnn_execute_model_ov(const DNNModel *model, DNNExecBaseParams *
     task.async = 0;
     task.input_name = exec_params->input_name;
     task.in_frame = exec_params->in_frame;
-    task.output_name = exec_params->output_names[0];
+    task.output_names = &exec_params->output_names[0];
     task.out_frame = exec_params->out_frame ? exec_params->out_frame : exec_params->in_frame;
     task.model = ov_model;
 
@@ -843,7 +843,7 @@ DNNReturnType ff_dnn_execute_model_async_ov(const DNNModel *model, DNNExecBasePa
     task->async = 1;
     task->input_name = exec_params->input_name;
     task->in_frame = exec_params->in_frame;
-    task->output_name = exec_params->output_names[0];
+    task->output_names = &exec_params->output_names[0];
     task->out_frame = exec_params->out_frame ? exec_params->out_frame : exec_params->in_frame;
     task->model = ov_model;
     if (ff_queue_push_back(ov_model->task_queue, task) < 0) {
-- 
2.25.1



More information about the ffmpeg-devel mailing list