[FFmpeg-devel] [PATCH 2/6] libavfilter/dnn: use avpriv_report_missing_feature for unsupported features

Guo, Yejun yejun.guo at intel.com
Mon Jan 18 14:52:00 EET 2021


Signed-off-by: Guo, Yejun <yejun.guo at intel.com>
---
 libavfilter/dnn/dnn_backend_native.c   |  2 +-
 libavfilter/dnn/dnn_backend_openvino.c |  4 ++--
 libavfilter/dnn/dnn_backend_tf.c       |  4 ++--
 libavfilter/dnn/dnn_io_proc.c          | 10 ++++------
 libavfilter/vf_dnn_processing.c        |  4 ++--
 5 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_native.c b/libavfilter/dnn/dnn_backend_native.c
index 5e7fc0f10c..2700251ee6 100644
--- a/libavfilter/dnn/dnn_backend_native.c
+++ b/libavfilter/dnn/dnn_backend_native.c
@@ -327,7 +327,7 @@ static DNNReturnType execute_model_native(const DNNModel *model, const char *inp
     if (nb_output != 1) {
         // currently, the filter does not need multiple outputs,
         // so we just pending the support until we really need it.
-        av_log(ctx, AV_LOG_ERROR, "do not support multiple outputs\n");
+        avpriv_report_missing_feature(ctx, "multiple outputs");
         return DNN_ERROR;
     }
 
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index bb4ef3958f..5820afbcfd 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -588,12 +588,12 @@ DNNReturnType ff_dnn_execute_model_ov(const DNNModel *model, const char *input_n
     if (nb_output != 1) {
         // currently, the filter does not need multiple outputs,
         // so we just pending the support until we really need it.
-        av_log(ctx, AV_LOG_ERROR, "do not support multiple outputs\n");
+        avpriv_report_missing_feature(ctx, "multiple outputs");
         return DNN_ERROR;
     }
 
     if (ctx->options.batch_size > 1) {
-        av_log(ctx, AV_LOG_ERROR, "do not support batch mode for sync execution.\n");
+        avpriv_report_missing_feature(ctx, "batch mode for sync execution");
         return DNN_ERROR;
     }
 
diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c
index b9fe01693b..cbe83741f6 100644
--- a/libavfilter/dnn/dnn_backend_tf.c
+++ b/libavfilter/dnn/dnn_backend_tf.c
@@ -424,7 +424,7 @@ static DNNReturnType add_conv_layer(TFModel *tf_model, TF_Operation *transpose_o
         op_desc = TF_NewOperation(tf_model->graph, "Sigmoid", name_buffer);
         break;
     default:
-        av_log(ctx, AV_LOG_ERROR, "Unsupported convolutional activation function\n");
+        avpriv_report_missing_feature(ctx, "convolutional activation function %d", params->activation);
         return DNN_ERROR;
     }
     input.oper = *cur_op;
@@ -750,7 +750,7 @@ static DNNReturnType execute_model_tf(const DNNModel *model, const char *input_n
     if (nb_output != 1) {
         // currently, the filter does not need multiple outputs,
         // so we just pending the support until we really need it.
-        av_log(ctx, AV_LOG_ERROR, "do not support multiple outputs\n");
+        avpriv_report_missing_feature(ctx, "multiple outputs");
         return DNN_ERROR;
     }
 
diff --git a/libavfilter/dnn/dnn_io_proc.c b/libavfilter/dnn/dnn_io_proc.c
index 2744cb6502..193e5bd9cc 100644
--- a/libavfilter/dnn/dnn_io_proc.c
+++ b/libavfilter/dnn/dnn_io_proc.c
@@ -27,7 +27,7 @@ DNNReturnType proc_from_dnn_to_frame(AVFrame *frame, DNNData *output, void *log_
     struct SwsContext *sws_ctx;
     int bytewidth = av_image_get_linesize(frame->format, frame->width, 0);
     if (output->dt != DNN_FLOAT) {
-        av_log(log_ctx, AV_LOG_ERROR, "do not support data type rather than DNN_FLOAT\n");
+        avpriv_report_missing_feature(log_ctx, "data type rather than DNN_FLOAT");
         return DNN_ERROR;
     }
 
@@ -85,8 +85,7 @@ DNNReturnType proc_from_dnn_to_frame(AVFrame *frame, DNNData *output, void *log_
         sws_freeContext(sws_ctx);
         return DNN_SUCCESS;
     default:
-        av_log(log_ctx, AV_LOG_ERROR, "do not support frame format %s\n",
-               av_get_pix_fmt_name(frame->format));
+        avpriv_report_missing_feature(log_ctx, "%s", av_get_pix_fmt_name(frame->format));
         return DNN_ERROR;
     }
 
@@ -98,7 +97,7 @@ DNNReturnType proc_from_frame_to_dnn(AVFrame *frame, DNNData *input, void *log_c
     struct SwsContext *sws_ctx;
     int bytewidth = av_image_get_linesize(frame->format, frame->width, 0);
     if (input->dt != DNN_FLOAT) {
-        av_log(log_ctx, AV_LOG_ERROR, "do not support data type rather than DNN_FLOAT\n");
+        avpriv_report_missing_feature(log_ctx, "data type rather than DNN_FLOAT");
         return DNN_ERROR;
     }
 
@@ -158,8 +157,7 @@ DNNReturnType proc_from_frame_to_dnn(AVFrame *frame, DNNData *input, void *log_c
         sws_freeContext(sws_ctx);
         break;
     default:
-        av_log(log_ctx, AV_LOG_ERROR, "do not support frame format %s\n",
-               av_get_pix_fmt_name(frame->format));
+        avpriv_report_missing_feature(log_ctx, "%s", av_get_pix_fmt_name(frame->format));
         return DNN_ERROR;
     }
 
diff --git a/libavfilter/vf_dnn_processing.c b/libavfilter/vf_dnn_processing.c
index 240614fe65..09e1699b9e 100644
--- a/libavfilter/vf_dnn_processing.c
+++ b/libavfilter/vf_dnn_processing.c
@@ -159,7 +159,7 @@ static int check_modelinput_inlink(const DNNData *model_input, const AVFilterLin
         return AVERROR(EIO);
     }
     if (model_input->dt != DNN_FLOAT) {
-        av_log(ctx, AV_LOG_ERROR, "only support dnn models with input data type as float32.\n");
+        avpriv_report_missing_feature(ctx, "data type rather than DNN_FLOAT");
         return AVERROR(EIO);
     }
 
@@ -184,7 +184,7 @@ static int check_modelinput_inlink(const DNNData *model_input, const AVFilterLin
         }
         return 0;
     default:
-        av_log(ctx, AV_LOG_ERROR, "%s not supported.\n", av_get_pix_fmt_name(fmt));
+        avpriv_report_missing_feature(ctx, "%s", av_get_pix_fmt_name(fmt));
         return AVERROR(EIO);
     }
 
-- 
2.17.1



More information about the ffmpeg-devel mailing list