From patchwork Mon Jan 18 12:51:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Yejun" X-Patchwork-Id: 25007 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A1F7544B682 for ; Mon, 18 Jan 2021 14:53:53 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7E8D76802C2; Mon, 18 Jan 2021 14:53:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CE6CD6802C2 for ; Mon, 18 Jan 2021 14:53:46 +0200 (EET) IronPort-SDR: WHHNDJz2V9Kp/Rqdkqff6+QjHMnjeLAYT4qm7TfES+/4pfO8B1JiPfOrzBGYJQjusY7I7XXgFI 6Q/07T6H177Q== X-IronPort-AV: E=McAfee;i="6000,8403,9867"; a="178020764" X-IronPort-AV: E=Sophos;i="5.79,356,1602572400"; d="scan'208";a="178020764" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2021 04:53:39 -0800 IronPort-SDR: zFTqiBM0xKbUQfYVHm2nW6KJvUztpp/2HuAmgeGys+Fgw5IJLqDsMlwFCQ0BzpUtuu1YW2kvSS fcQP0EBBDajQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,356,1602572400"; d="scan'208";a="355179966" Received: from yguo18-skl-u1604.sh.intel.com ([10.239.159.53]) by fmsmga008.fm.intel.com with ESMTP; 18 Jan 2021 04:53:37 -0800 From: "Guo, Yejun" To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Jan 2021 20:51:51 +0800 Message-Id: <20210118125151.27280-1-yejun.guo@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH 1/6] dnn_backend_openvino.c: add version mismatch reminder X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: yejun.guo@intel.com MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The OpenVINO model file format changes when OpenVINO goes to a new release, it does not work if the versions between model file and runtime are mismatched. Signed-off-by: Guo, Yejun --- libavfilter/dnn/dnn_backend_openvino.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index 8a7abb33f0..bb4ef3958f 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -544,8 +544,15 @@ DNNModel *ff_dnn_load_model_ov(const char *model_filename, const char *options, goto err; status = ie_core_read_network(ov_model->core, model_filename, NULL, &ov_model->network); - if (status != OK) + if (status != OK) { + ie_version_t ver; + ver = ie_c_api_version(); + av_log(ctx, AV_LOG_ERROR, "Failed to read the network from model file %s,\n" + "Please check if the model version matches the runtime OpenVINO %s\n", + model_filename, ver.api_version); + ie_version_free(&ver); goto err; + } model->get_input = &get_input_ov; model->get_output = &get_output_ov; From patchwork Mon Jan 18 12:52:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Yejun" X-Patchwork-Id: 25008 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id AAF5844B682 for ; Mon, 18 Jan 2021 14:54:02 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9243C688154; Mon, 18 Jan 2021 14:54:02 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8B3A5687FC9 for ; Mon, 18 Jan 2021 14:53:55 +0200 (EET) IronPort-SDR: P1RkuZJLg/pBPtHqSo6Ly/2vdlCfLa/5+7Knua8Tk8x7B8YdA+4MP7CsxCCXnMU2Jynz7kx9fT XIKHaSEa1Xfw== X-IronPort-AV: E=McAfee;i="6000,8403,9867"; a="166465363" X-IronPort-AV: E=Sophos;i="5.79,356,1602572400"; d="scan'208";a="166465363" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2021 04:53:48 -0800 IronPort-SDR: osYV0GlnSdDw8dQ1fxKPLmNVQGOZ6FkyA7m5IRasPx3nnpgEyHmu180AX2HBdKM7vLIArmGZDx deXPUR/PwNgQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,356,1602572400"; d="scan'208";a="573273847" Received: from yguo18-skl-u1604.sh.intel.com ([10.239.159.53]) by fmsmga005.fm.intel.com with ESMTP; 18 Jan 2021 04:53:46 -0800 From: "Guo, Yejun" To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Jan 2021 20:52:00 +0800 Message-Id: <20210118125200.27329-1-yejun.guo@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH 2/6] libavfilter/dnn: use avpriv_report_missing_feature for unsupported features X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: yejun.guo@intel.com MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Guo, Yejun --- 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); } From patchwork Mon Jan 18 12:52:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Yejun" X-Patchwork-Id: 25009 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id C0CD044B771 for ; Mon, 18 Jan 2021 14:54:14 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A47A2688174; Mon, 18 Jan 2021 14:54:14 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D02BE688188 for ; Mon, 18 Jan 2021 14:54:07 +0200 (EET) IronPort-SDR: GQYmfZDTnzRbkjbuIihITWJMxZfBlhuBLpKmNVJqeAj4bmNoRgQZ28eynoGlo3f3lJ8/sGwPbZ /yMKsYIxyufQ== X-IronPort-AV: E=McAfee;i="6000,8403,9867"; a="242868855" X-IronPort-AV: E=Sophos;i="5.79,356,1602572400"; d="scan'208";a="242868855" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2021 04:54:01 -0800 IronPort-SDR: 1sunP855Jn4W7kZTyykR5laXBkKBrZXM/U28dEh4IWkTZUb7mWm32jc6oE6OFNWhWmM/ZX+MAz Bszkc9EOALuw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,356,1602572400"; d="scan'208";a="573273867" Received: from yguo18-skl-u1604.sh.intel.com ([10.239.159.53]) by fmsmga005.fm.intel.com with ESMTP; 18 Jan 2021 04:54:00 -0800 From: "Guo, Yejun" To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Jan 2021 20:52:13 +0800 Message-Id: <20210118125213.27377-1-yejun.guo@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH 3/6] libavfilter/dnn: add prefix ff_ for internal functions X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: yejun.guo@intel.com MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" from proc_from_frame_to_dnn to ff_proc_from_frame_to_dnn, and from proc_from_dnn_to_frame to ff_proc_from_dnn_to_frame. Signed-off-by: Guo, Yejun --- libavfilter/dnn/dnn_backend_native.c | 4 ++-- libavfilter/dnn/dnn_backend_openvino.c | 4 ++-- libavfilter/dnn/dnn_backend_tf.c | 4 ++-- libavfilter/dnn/dnn_io_proc.c | 4 ++-- libavfilter/dnn/dnn_io_proc.h | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native.c b/libavfilter/dnn/dnn_backend_native.c index 2700251ee6..2c0b938839 100644 --- a/libavfilter/dnn/dnn_backend_native.c +++ b/libavfilter/dnn/dnn_backend_native.c @@ -320,7 +320,7 @@ static DNNReturnType execute_model_native(const DNNModel *model, const char *inp if (native_model->model->pre_proc != NULL) { native_model->model->pre_proc(in_frame, &input, native_model->model->filter_ctx); } else { - proc_from_frame_to_dnn(in_frame, &input, ctx); + ff_proc_from_frame_to_dnn(in_frame, &input, ctx); } } @@ -368,7 +368,7 @@ static DNNReturnType execute_model_native(const DNNModel *model, const char *inp if (native_model->model->post_proc != NULL) { native_model->model->post_proc(out_frame, &output, native_model->model->filter_ctx); } else { - proc_from_dnn_to_frame(out_frame, &output, ctx); + ff_proc_from_dnn_to_frame(out_frame, &output, ctx); } } else { out_frame->width = output.width; diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index 5820afbcfd..9c803c8188 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -160,7 +160,7 @@ static DNNReturnType fill_model_input_ov(OVModel *ov_model, RequestItem *request if (ov_model->model->pre_proc != NULL) { ov_model->model->pre_proc(task->in_frame, &input, ov_model->model->filter_ctx); } else { - proc_from_frame_to_dnn(task->in_frame, &input, ctx); + ff_proc_from_frame_to_dnn(task->in_frame, &input, ctx); } } input.data = (uint8_t *)input.data @@ -228,7 +228,7 @@ static void infer_completion_callback(void *args) if (task->ov_model->model->post_proc != NULL) { task->ov_model->model->post_proc(task->out_frame, &output, task->ov_model->model->filter_ctx); } else { - proc_from_dnn_to_frame(task->out_frame, &output, ctx); + ff_proc_from_dnn_to_frame(task->out_frame, &output, ctx); } } else { task->out_frame->width = output.width; diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c index cbe83741f6..f77f3dd817 100644 --- a/libavfilter/dnn/dnn_backend_tf.c +++ b/libavfilter/dnn/dnn_backend_tf.c @@ -743,7 +743,7 @@ static DNNReturnType execute_model_tf(const DNNModel *model, const char *input_n if (tf_model->model->pre_proc != NULL) { tf_model->model->pre_proc(in_frame, &input, tf_model->model->filter_ctx); } else { - proc_from_frame_to_dnn(in_frame, &input, ctx); + ff_proc_from_frame_to_dnn(in_frame, &input, ctx); } } @@ -800,7 +800,7 @@ static DNNReturnType execute_model_tf(const DNNModel *model, const char *input_n if (tf_model->model->post_proc != NULL) { tf_model->model->post_proc(out_frame, &output, tf_model->model->filter_ctx); } else { - proc_from_dnn_to_frame(out_frame, &output, ctx); + ff_proc_from_dnn_to_frame(out_frame, &output, ctx); } } else { out_frame->width = output.width; diff --git a/libavfilter/dnn/dnn_io_proc.c b/libavfilter/dnn/dnn_io_proc.c index 193e5bd9cc..bee1423342 100644 --- a/libavfilter/dnn/dnn_io_proc.c +++ b/libavfilter/dnn/dnn_io_proc.c @@ -22,7 +22,7 @@ #include "libavutil/imgutils.h" #include "libswscale/swscale.h" -DNNReturnType proc_from_dnn_to_frame(AVFrame *frame, DNNData *output, void *log_ctx) +DNNReturnType ff_proc_from_dnn_to_frame(AVFrame *frame, DNNData *output, void *log_ctx) { struct SwsContext *sws_ctx; int bytewidth = av_image_get_linesize(frame->format, frame->width, 0); @@ -92,7 +92,7 @@ DNNReturnType proc_from_dnn_to_frame(AVFrame *frame, DNNData *output, void *log_ return DNN_SUCCESS; } -DNNReturnType proc_from_frame_to_dnn(AVFrame *frame, DNNData *input, void *log_ctx) +DNNReturnType ff_proc_from_frame_to_dnn(AVFrame *frame, DNNData *input, void *log_ctx) { struct SwsContext *sws_ctx; int bytewidth = av_image_get_linesize(frame->format, frame->width, 0); diff --git a/libavfilter/dnn/dnn_io_proc.h b/libavfilter/dnn/dnn_io_proc.h index 4c7dc7c1a2..6a410ccc7b 100644 --- a/libavfilter/dnn/dnn_io_proc.h +++ b/libavfilter/dnn/dnn_io_proc.h @@ -30,7 +30,7 @@ #include "../dnn_interface.h" #include "libavutil/frame.h" -DNNReturnType proc_from_frame_to_dnn(AVFrame *frame, DNNData *input, void *log_ctx); -DNNReturnType proc_from_dnn_to_frame(AVFrame *frame, DNNData *output, void *log_ctx); +DNNReturnType ff_proc_from_frame_to_dnn(AVFrame *frame, DNNData *input, void *log_ctx); +DNNReturnType ff_proc_from_dnn_to_frame(AVFrame *frame, DNNData *output, void *log_ctx); #endif From patchwork Mon Jan 18 12:52:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Yejun" X-Patchwork-Id: 25010 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id BEB984498EA for ; Mon, 18 Jan 2021 14:54:22 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A9DE1688189; Mon, 18 Jan 2021 14:54:22 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7404968815C for ; Mon, 18 Jan 2021 14:54:15 +0200 (EET) IronPort-SDR: pF4p4CclGs3oFpjAwDeZCCSXLCQ9tiKoEGyzlO/Xpc0IwJbYL2oZ9QGO841ILwv3mRpTw22BEI tFr2Qi82fFug== X-IronPort-AV: E=McAfee;i="6000,8403,9867"; a="165888233" X-IronPort-AV: E=Sophos;i="5.79,356,1602572400"; d="scan'208";a="165888233" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2021 04:54:10 -0800 IronPort-SDR: 2Rw8umKWw+gQH4IQ7EhmyOOCw7zwtvtJW++vEm0XidfwyZ3IWLrftKjw0U9CdRVaI7UXrAYQYr H9kdqVOgpuGA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,356,1602572400"; d="scan'208";a="573273885" Received: from yguo18-skl-u1604.sh.intel.com ([10.239.159.53]) by fmsmga005.fm.intel.com with ESMTP; 18 Jan 2021 04:54:09 -0800 From: "Guo, Yejun" To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Jan 2021 20:52:23 +0800 Message-Id: <20210118125223.27426-1-yejun.guo@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH 4/6] dnn/queue: remove prefix FF for Queue and SafeQueue X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: yejun.guo@intel.com MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" we don't need FF prefix for internal data struct Signed-off-by: Guo, Yejun --- libavfilter/dnn/dnn_backend_openvino.c | 4 +- libavfilter/dnn/queue.c | 58 +++++++++++++------------- libavfilter/dnn/queue.h | 20 ++++----- libavfilter/dnn/safe_queue.c | 18 ++++---- libavfilter/dnn/safe_queue.h | 14 +++---- 5 files changed, 57 insertions(+), 57 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index 9c803c8188..573344e628 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -55,8 +55,8 @@ typedef struct OVModel{ ie_infer_request_t *infer_request; /* for async execution */ - FFSafeQueue *request_queue; // holds RequestItem - FFQueue *task_queue; // holds TaskItem + SafeQueue *request_queue; // holds RequestItem + Queue *task_queue; // holds TaskItem } OVModel; typedef struct TaskItem { diff --git a/libavfilter/dnn/queue.c b/libavfilter/dnn/queue.c index e64f567906..954437a8b4 100644 --- a/libavfilter/dnn/queue.c +++ b/libavfilter/dnn/queue.c @@ -23,31 +23,31 @@ #include "libavutil/mem.h" #include "libavutil/avassert.h" -typedef struct FFQueueEntry FFQueueEntry; +typedef struct QueueEntry QueueEntry; -struct FFQueueEntry { +struct QueueEntry { void *value; - FFQueueEntry *prev; - FFQueueEntry *next; + QueueEntry *prev; + QueueEntry *next; }; -struct FFQueue { - FFQueueEntry *head; - FFQueueEntry *tail; +struct Queue { + QueueEntry *head; + QueueEntry *tail; size_t length; }; -static inline FFQueueEntry *create_entry(void *val) +static inline QueueEntry *create_entry(void *val) { - FFQueueEntry *entry = av_malloc(sizeof(*entry)); + QueueEntry *entry = av_malloc(sizeof(*entry)); if (entry) entry->value = val; return entry; } -FFQueue* ff_queue_create(void) +Queue* ff_queue_create(void) { - FFQueue *q = av_malloc(sizeof(*q)); + Queue *q = av_malloc(sizeof(*q)); if (!q) return NULL; @@ -70,15 +70,15 @@ FFQueue* ff_queue_create(void) return q; } -void ff_queue_destroy(FFQueue *q) +void ff_queue_destroy(Queue *q) { - FFQueueEntry *entry; + QueueEntry *entry; if (!q) return; entry = q->head; while (entry != NULL) { - FFQueueEntry *temp = entry; + QueueEntry *temp = entry; entry = entry->next; av_freep(&temp); } @@ -86,12 +86,12 @@ void ff_queue_destroy(FFQueue *q) av_freep(&q); } -size_t ff_queue_size(FFQueue *q) +size_t ff_queue_size(Queue *q) { return q ? q->length : 0; } -void *ff_queue_peek_front(FFQueue *q) +void *ff_queue_peek_front(Queue *q) { if (!q || q->length == 0) return NULL; @@ -99,7 +99,7 @@ void *ff_queue_peek_front(FFQueue *q) return q->head->next->value; } -void *ff_queue_peek_back(FFQueue *q) +void *ff_queue_peek_back(Queue *q) { if (!q || q->length == 0) return NULL; @@ -107,10 +107,10 @@ void *ff_queue_peek_back(FFQueue *q) return q->tail->prev->value; } -int ff_queue_push_front(FFQueue *q, void *v) +int ff_queue_push_front(Queue *q, void *v) { - FFQueueEntry *new_entry; - FFQueueEntry *original_next; + QueueEntry *new_entry; + QueueEntry *original_next; if (!q) return 0; @@ -128,10 +128,10 @@ int ff_queue_push_front(FFQueue *q, void *v) return q->length; } -int ff_queue_push_back(FFQueue *q, void *v) +int ff_queue_push_back(Queue *q, void *v) { - FFQueueEntry *new_entry; - FFQueueEntry *original_prev; + QueueEntry *new_entry; + QueueEntry *original_prev; if (!q) return 0; @@ -149,10 +149,10 @@ int ff_queue_push_back(FFQueue *q, void *v) return q->length; } -void *ff_queue_pop_front(FFQueue *q) +void *ff_queue_pop_front(Queue *q) { - FFQueueEntry *front; - FFQueueEntry *new_head_next; + QueueEntry *front; + QueueEntry *new_head_next; void *ret; if (!q || q->length == 0) @@ -170,10 +170,10 @@ void *ff_queue_pop_front(FFQueue *q) return ret; } -void *ff_queue_pop_back(FFQueue *q) +void *ff_queue_pop_back(Queue *q) { - FFQueueEntry *back; - FFQueueEntry *new_tail_prev; + QueueEntry *back; + QueueEntry *new_tail_prev; void *ret; if (!q || q->length == 0) diff --git a/libavfilter/dnn/queue.h b/libavfilter/dnn/queue.h index df913d91ac..4d7121366a 100644 --- a/libavfilter/dnn/queue.h +++ b/libavfilter/dnn/queue.h @@ -22,20 +22,20 @@ #ifndef AVFILTER_DNN_QUEUE_H #define AVFILTER_DNN_QUEUE_H -typedef struct FFQueue FFQueue; +typedef struct Queue Queue; -FFQueue *ff_queue_create(void); -void ff_queue_destroy(FFQueue *q); +Queue *ff_queue_create(void); +void ff_queue_destroy(Queue *q); -size_t ff_queue_size(FFQueue *q); +size_t ff_queue_size(Queue *q); -void *ff_queue_peek_front(FFQueue *q); -void *ff_queue_peek_back(FFQueue *q); +void *ff_queue_peek_front(Queue *q); +void *ff_queue_peek_back(Queue *q); -int ff_queue_push_front(FFQueue *q, void *v); -int ff_queue_push_back(FFQueue *q, void *v); +int ff_queue_push_front(Queue *q, void *v); +int ff_queue_push_back(Queue *q, void *v); -void *ff_queue_pop_front(FFQueue *q); -void *ff_queue_pop_back(FFQueue *q); +void *ff_queue_pop_front(Queue *q); +void *ff_queue_pop_back(Queue *q); #endif diff --git a/libavfilter/dnn/safe_queue.c b/libavfilter/dnn/safe_queue.c index 6b55b75246..e962d4cb7e 100644 --- a/libavfilter/dnn/safe_queue.c +++ b/libavfilter/dnn/safe_queue.c @@ -43,15 +43,15 @@ static inline int dnn_cond_wait(DNNCond *cond, AVMutex *mutex) } #endif -struct FFSafeQueue { - FFQueue *q; +struct SafeQueue { + Queue *q; AVMutex mutex; DNNCond cond; }; -FFSafeQueue *ff_safe_queue_create(void) +SafeQueue *ff_safe_queue_create(void) { - FFSafeQueue *sq = av_malloc(sizeof(*sq)); + SafeQueue *sq = av_malloc(sizeof(*sq)); if (!sq) return NULL; @@ -66,7 +66,7 @@ FFSafeQueue *ff_safe_queue_create(void) return sq; } -void ff_safe_queue_destroy(FFSafeQueue *sq) +void ff_safe_queue_destroy(SafeQueue *sq) { if (!sq) return; @@ -77,12 +77,12 @@ void ff_safe_queue_destroy(FFSafeQueue *sq) av_freep(&sq); } -size_t ff_safe_queue_size(FFSafeQueue *sq) +size_t ff_safe_queue_size(SafeQueue *sq) { return sq ? ff_queue_size(sq->q) : 0; } -int ff_safe_queue_push_front(FFSafeQueue *sq, void *v) +int ff_safe_queue_push_front(SafeQueue *sq, void *v) { int ret; ff_mutex_lock(&sq->mutex); @@ -92,7 +92,7 @@ int ff_safe_queue_push_front(FFSafeQueue *sq, void *v) return ret; } -int ff_safe_queue_push_back(FFSafeQueue *sq, void *v) +int ff_safe_queue_push_back(SafeQueue *sq, void *v) { int ret; ff_mutex_lock(&sq->mutex); @@ -102,7 +102,7 @@ int ff_safe_queue_push_back(FFSafeQueue *sq, void *v) return ret; } -void *ff_safe_queue_pop_front(FFSafeQueue *sq) +void *ff_safe_queue_pop_front(SafeQueue *sq) { void *value; ff_mutex_lock(&sq->mutex); diff --git a/libavfilter/dnn/safe_queue.h b/libavfilter/dnn/safe_queue.h index 548a282f0c..36d6daabaf 100644 --- a/libavfilter/dnn/safe_queue.h +++ b/libavfilter/dnn/safe_queue.h @@ -21,16 +21,16 @@ #ifndef AVFILTER_DNN_SAFE_QUEUE_H #define AVFILTER_DNN_SAFE_QUEUE_H -typedef struct FFSafeQueue FFSafeQueue; +typedef struct SafeQueue SafeQueue; -FFSafeQueue *ff_safe_queue_create(void); -void ff_safe_queue_destroy(FFSafeQueue *sq); +SafeQueue *ff_safe_queue_create(void); +void ff_safe_queue_destroy(SafeQueue *sq); -size_t ff_safe_queue_size(FFSafeQueue *sq); +size_t ff_safe_queue_size(SafeQueue *sq); -int ff_safe_queue_push_front(FFSafeQueue *sq, void *v); -int ff_safe_queue_push_back(FFSafeQueue *sq, void *v); +int ff_safe_queue_push_front(SafeQueue *sq, void *v); +int ff_safe_queue_push_back(SafeQueue *sq, void *v); -void *ff_safe_queue_pop_front(FFSafeQueue *sq); +void *ff_safe_queue_pop_front(SafeQueue *sq); #endif From patchwork Mon Jan 18 12:52:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Yejun" X-Patchwork-Id: 25011 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 08B544498EA for ; Mon, 18 Jan 2021 14:54:30 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DFBCB688197; Mon, 18 Jan 2021 14:54:29 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DD95D68818C for ; Mon, 18 Jan 2021 14:54:27 +0200 (EET) IronPort-SDR: mmKZSetVsq6swbk/fEi1NmREV7KMPkux577HliyXlupQXZziFz9iUlf0faB3lr03EEhvlSO7UG bDP6jcQ2h5hw== X-IronPort-AV: E=McAfee;i="6000,8403,9867"; a="178948696" X-IronPort-AV: E=Sophos;i="5.79,356,1602572400"; d="scan'208";a="178948696" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2021 04:54:19 -0800 IronPort-SDR: 8SplQmte59pL6W6CN31NYnDBRu3TyPGaiJ7xwluQGZZ3avLHGAtQS04EjolZkSBnqJ76fwzj9F JBlxJeDDOS/w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,356,1602572400"; d="scan'208";a="573273917" Received: from yguo18-skl-u1604.sh.intel.com ([10.239.159.53]) by fmsmga005.fm.intel.com with ESMTP; 18 Jan 2021 04:54:19 -0800 From: "Guo, Yejun" To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Jan 2021 20:52:32 +0800 Message-Id: <20210118125232.27474-1-yejun.guo@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH 5/6] dnn_backend_native_layer_conv2d.c: correct struct name with CamelCase X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: yejun.guo@intel.com MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Guo, Yejun --- .../dnn/dnn_backend_native_layer_conv2d.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c index 0fb968a1fc..7c6d96e916 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c @@ -26,19 +26,19 @@ #define CLAMP_TO_EDGE(x, w) ((x) < 0 ? 0 : ((x) >= (w) ? (w - 1) : (x))) //struct to pass parameters -typedef struct thread_common_param{ +typedef struct ThreadCommonParam{ DnnOperand *operands; const int32_t *input_operand_indexes; int32_t output_operand_index; const void *parameters; NativeContext *ctx; float *output_data; -} thread_common_param; +} ThreadCommonParam; -typedef struct thread_param{ - thread_common_param *thread_common_param; +typedef struct ThreadParam{ + ThreadCommonParam *thread_common_param; int thread_start, thread_end; -} thread_param; +} ThreadParam; int dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num) { @@ -108,8 +108,8 @@ int dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int fil static void * dnn_execute_layer_conv2d_thread(void *threadarg) { //pass parameters - thread_param *thread_param = (struct thread_param *)threadarg; - thread_common_param *thread_common_param = thread_param->thread_common_param; + ThreadParam *thread_param = threadarg; + ThreadCommonParam *thread_common_param = thread_param->thread_common_param; DnnOperand *operands = thread_common_param->operands; int32_t input_operand_index = thread_common_param->input_operand_indexes[0]; int height = operands[input_operand_index].dims[1]; @@ -190,8 +190,8 @@ int dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_ pthread_t *thread_id = av_malloc(thread_num * sizeof(pthread_t)); int thread_stride; #endif - thread_param **thread_param = av_malloc(thread_num * sizeof(*thread_param)); - thread_common_param thread_common_param; + ThreadParam **thread_param = av_malloc(thread_num * sizeof(*thread_param)); + ThreadCommonParam thread_common_param; const ConvolutionalParams *conv_params = (const ConvolutionalParams *)(parameters); int height = operands[input_operand_indexes[0]].dims[1]; int width = operands[input_operand_indexes[0]].dims[2]; From patchwork Mon Jan 18 12:52:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Yejun" X-Patchwork-Id: 25012 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 0913C4498EA for ; Mon, 18 Jan 2021 14:54:41 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E626868818E; Mon, 18 Jan 2021 14:54:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9BF9D688188 for ; Mon, 18 Jan 2021 14:54:33 +0200 (EET) IronPort-SDR: +rybAA2cFwfjR9J19Vmdq6eS7sKDoNWmmm/0QqbfQ+grO4Tq266No/j12FXcV5umPZV+NRowmZ qFRuQb5Hd2Sg== X-IronPort-AV: E=McAfee;i="6000,8403,9867"; a="240340626" X-IronPort-AV: E=Sophos;i="5.79,356,1602572400"; d="scan'208";a="240340626" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2021 04:54:28 -0800 IronPort-SDR: PqyPdHJ56/lYkn104CKkyOkT1fTfZiucCkOtQ/WnPUzxdUm3thmdTvdAUdjCamPhtwUBsBfJnE NdaJoVB4y+0A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,356,1602572400"; d="scan'208";a="573273984" Received: from yguo18-skl-u1604.sh.intel.com ([10.239.159.53]) by fmsmga005.fm.intel.com with ESMTP; 18 Jan 2021 04:54:27 -0800 From: "Guo, Yejun" To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Jan 2021 20:52:40 +0800 Message-Id: <20210118125240.27522-1-yejun.guo@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH 6/6] dnn_backend_native_layer_conv2d.c: refine code with av_malloc_array and av_freep X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: yejun.guo@intel.com MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Guo, Yejun --- .../dnn/dnn_backend_native_layer_conv2d.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c index 7c6d96e916..9dc50b7cbe 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c @@ -70,7 +70,7 @@ int dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int fil return 0; } - conv_params->kernel = av_malloc(kernel_size * sizeof(float)); + conv_params->kernel = av_malloc_array(kernel_size, sizeof(*conv_params->kernel)); if (!conv_params->kernel) { av_freep(&conv_params); return 0; @@ -81,7 +81,7 @@ int dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int fil conv_params->biases = NULL; if (conv_params->has_bias) { - conv_params->biases = av_malloc(conv_params->output_num * sizeof(float)); + conv_params->biases = av_malloc_array(conv_params->output_num, sizeof(*conv_params->biases)); if (!conv_params->biases){ av_freep(&conv_params->kernel); av_freep(&conv_params); @@ -187,10 +187,10 @@ int dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_ int thread_num = (ctx->options.conv2d_threads <= 0 || ctx->options.conv2d_threads > av_cpu_count()) ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads); #if HAVE_PTHREAD_CANCEL - pthread_t *thread_id = av_malloc(thread_num * sizeof(pthread_t)); + pthread_t *thread_id = av_malloc_array(thread_num, sizeof(*thread_id)); int thread_stride; #endif - ThreadParam **thread_param = av_malloc(thread_num * sizeof(*thread_param)); + ThreadParam **thread_param = av_malloc_array(thread_num, sizeof(*thread_param)); ThreadCommonParam thread_common_param; const ConvolutionalParams *conv_params = (const ConvolutionalParams *)(parameters); int height = operands[input_operand_indexes[0]].dims[1]; @@ -224,7 +224,7 @@ int dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_ thread_stride = (height - pad_size * 2) / thread_num; //create threads for (int i = 0; i < thread_num; i++){ - thread_param[i] = av_malloc(sizeof(**thread_param)); + thread_param[i] = av_malloc(sizeof(*thread_param[0])); thread_param[i]->thread_common_param = &thread_common_param; thread_param[i]->thread_start = thread_stride * i + pad_size; thread_param[i]->thread_end = (i == thread_num - 1) ? (height - pad_size) : (thread_param[i]->thread_start + thread_stride); @@ -237,20 +237,20 @@ int dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_ } //release memory - av_free(thread_id); + av_freep(&thread_id); for (int i = 0; i < thread_num; i++){ - av_free(thread_param[i]); + av_freep(&thread_param[i]); } #else - thread_param[0] = av_malloc(sizeof(**thread_param)); + thread_param[0] = av_malloc(sizeof(*thread_param[0])); thread_param[0]->thread_common_param = &thread_common_param; thread_param[0]->thread_start = pad_size; thread_param[0]->thread_end = height - pad_size; dnn_execute_layer_conv2d_thread((void *)thread_param[0]); - av_free(thread_param[0]); + av_freep(&thread_param[0]); #endif - av_free(thread_param); + av_freep(&thread_param); return DNN_SUCCESS; }