From patchwork Thu Feb 24 08:22:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shubhanshu Saxena X-Patchwork-Id: 34505 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6838:d078:0:0:0:0 with SMTP id x24csp1616160nkx; Thu, 24 Feb 2022 00:23:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxmbqOSE6tVnIvtJWP4lGe8HoIGKvgT7HVeV9aWaJBFQLt7KecQOc1IgQDS8z14CJuYtPNh X-Received: by 2002:a17:906:1393:b0:6ce:f3c5:49a5 with SMTP id f19-20020a170906139300b006cef3c549a5mr1355702ejc.123.1645691002751; Thu, 24 Feb 2022 00:23:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645691002; cv=none; d=google.com; s=arc-20160816; b=cXJ9QZm3uGHqjb13/Kix9KhJxhI208Pk7b8Mif3W8fIEVlSqoPrCc8UCQLD/AUSS5h Ec3OYpL9NjqR+sHFFTKSKCCX7tydqy04JlSaOYNVH6uvWcRfOjqzB5m0Wg8LCFZ1fkg+ F2vmSVqXpa24YM5MkRYWIKLPny4fHCm8LHZXephIUtDiQ9esBvC4oq+b6PMJzAFYbm7q O0g1wjYSU6jzNSx5jSyida5Va2DsU1TqamtecaMKnPFMeEiVRaOpxY4/qbJdrkDYGPqo Hb2w4/+FOdyVQ8byP4Eo20UHABVB7pf8Dx6+pC8puefIG1M/ELjqL/6H3qoxvvL8st/o ljwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=lBp6oWYaaBb3N7gw5VU166lhFv+AD+r6ap+/TQK7zWI=; b=gBlYdnibda+pvvhLQsVdV93Z22YxMZLlZCoIrPQgTog7MEdebtetANxI0VG57wccaJ as0HbzFHzAEOtA588RfO1deplcteWl61lvFMx7k9EUsUNI1NsJA9F6d5MW1iP4MkMmux 4L1fL3QpzHMxuh2C7LHYZPWZQ1c8pIwenBTxq6zPy0QRz3bI4Uddn+9EXFrmCtXXnLdS Plx1T0BcZjPM1nJtHIIZ24ZB0vomiySZ90PD3koWFKPoTjlKvTiv0a75kmrlJfjeGGm2 EnvancOs3uXuEYLoKmzCLGT/wcWFmUOUJ6Il+BKz8tfJDw7G3oeeljDTFxPRAbDnhvGl N0QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=iRGzkcRZ; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id gb4si1205135ejc.239.2022.02.24.00.23.21; Thu, 24 Feb 2022 00:23:22 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=iRGzkcRZ; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 50FBF68B28D; Thu, 24 Feb 2022 10:23:14 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6E69168B192 for ; Thu, 24 Feb 2022 10:23:08 +0200 (EET) Received: by mail-pf1-f176.google.com with SMTP id w2so1197116pfu.11 for ; Thu, 24 Feb 2022 00:23:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D8iuWV1nCXSRo5aILmGVMPQ1WT8rf7/mHmiQp0jKS8k=; b=iRGzkcRZvPsBzUS3mWCliB69VjqvUjwON6wG6kGYxpXTCz+coUjzkCmJUc39GA35q+ Y34+TkTOW+ZRtLRAwLP7vYGXOz9qYek8aBvlEp6NqDiTAkrFiv/2I0G/fMeCXydHJZjA GMvGObocmH0u/b8j95ehP7TtTKwsP2jQMDC0z205t/w7M07jGc2vEID2ixVE0n/x0lve 3J/MA3cMfZm8OHJbCNoAxO/xG5QGH1rZUduoo0+Xyl95dmzWfohRdbtz08bdP7KQNkiq x6SgRnGD/sz3Z7dVBt5lfqvImXxu9je1uTE+CtMrEhpJ+nK8r98ENb0mVs8zyIPPEDI3 yv1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D8iuWV1nCXSRo5aILmGVMPQ1WT8rf7/mHmiQp0jKS8k=; b=AMJ8Axtk+H7qZZKz5IdfBQsFDVacYaA1QPOeL0Mm4ITYQrsRFU9HosSHpPfxQxRvIM 0nWYXIHCtm/nKn9XdY+txYJvUMCH9EfWdUkiddm/3cwDJ8HTPEYdqQJ2ex6/Ft10ffmO mc1hiJ8nPCJVKwZF5q6rpwFF8DvvZA2FXAosa+xZm9gomiD7kd5WKZO2J/KA7HArKskS zv4D+bLirN2y8e6XGJV+1vEs6jQriEiHvlRU5GgIrgftejostpcArBALE5smfzTzIzr5 mpZm0m6rdwWrSgtlO5404yj/ekA6NKF8HFP4udBNUjepqpEHtCCQ8T5bBM2YgunSIa/6 vz/Q== X-Gm-Message-State: AOAM530IFaqXZ/l34ZsDPGk0R/TPn28LIBcWgS4pQ9vSfi72D7ixJboF L4WW7QinzHVM+3RLUkxeVa7W1tWIi9loog== X-Received: by 2002:a05:6a00:2348:b0:4f3:bfcd:8365 with SMTP id j8-20020a056a00234800b004f3bfcd8365mr939447pfj.38.1645690986424; Thu, 24 Feb 2022 00:23:06 -0800 (PST) Received: from Pavilion-x360.bbrouter ([103.133.123.155]) by smtp.googlemail.com with ESMTPSA id k11sm2174503pff.169.2022.02.24.00.23.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 00:23:06 -0800 (PST) From: Shubhanshu Saxena To: ffmpeg-devel@ffmpeg.org Date: Thu, 24 Feb 2022 13:52:37 +0530 Message-Id: <20220224082243.11208-2-shubhanshu.e01@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220224082243.11208-1-shubhanshu.e01@gmail.com> References: <20220224082243.11208-1-shubhanshu.e01@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/8] lavfi/dnn: Error Specificity in Native Backend Layers X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Shubhanshu Saxena Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: IKvnTTxz+/+9 This commit returns specific error codes from the execution functions in the Native Backend layers instead of DNN_ERROR. Signed-off-by: Shubhanshu Saxena --- libavfilter/dnn/dnn_backend_native_layer_avgpool.c | 6 +++--- libavfilter/dnn/dnn_backend_native_layer_avgpool.h | 3 ++- libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 14 ++++++++------ libavfilter/dnn/dnn_backend_native_layer_conv2d.h | 3 ++- libavfilter/dnn/dnn_backend_native_layer_dense.c | 6 +++--- libavfilter/dnn/dnn_backend_native_layer_dense.h | 3 ++- .../dnn/dnn_backend_native_layer_depth2space.c | 6 +++--- .../dnn/dnn_backend_native_layer_depth2space.h | 3 ++- .../dnn/dnn_backend_native_layer_mathbinary.c | 6 +++--- .../dnn/dnn_backend_native_layer_mathunary.c | 6 +++--- .../dnn/dnn_backend_native_layer_mathunary.h | 3 ++- libavfilter/dnn/dnn_backend_native_layer_maximum.c | 4 ++-- libavfilter/dnn/dnn_backend_native_layer_pad.c | 4 ++-- libavfilter/dnn_interface.h | 2 ++ 14 files changed, 39 insertions(+), 30 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_avgpool.c b/libavfilter/dnn/dnn_backend_native_layer_avgpool.c index 89f1787523..510a28a8c9 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_avgpool.c +++ b/libavfilter/dnn/dnn_backend_native_layer_avgpool.c @@ -109,12 +109,12 @@ int ff_dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t *input_ope output_operand->length = ff_calculate_operand_data_length(output_operand); if (output_operand->length <= 0) { av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n"); - return DNN_ERROR; + return AVERROR(EINVAL); } output_operand->data = av_realloc(output_operand->data, output_operand->length); if (!output_operand->data) { av_log(ctx, AV_LOG_ERROR, "Failed to reallocate memory for output\n"); - return DNN_ERROR; + return AVERROR(ENOMEM); } output = output_operand->data; @@ -143,5 +143,5 @@ int ff_dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t *input_ope } } - return 0; + return DNN_SUCCESS; } diff --git a/libavfilter/dnn/dnn_backend_native_layer_avgpool.h b/libavfilter/dnn/dnn_backend_native_layer_avgpool.h index d8972487de..118a160090 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_avgpool.h +++ b/libavfilter/dnn/dnn_backend_native_layer_avgpool.h @@ -60,7 +60,8 @@ int ff_dnn_load_layer_avg_pool(Layer *layer, AVIOContext *model_file_context, in * @param parameters average pooling parameters * @param ctx pointer to Native model context for logging * @retval 0 if the execution succeeds - * @retval DNN_ERROR if the execution fails + * @retval AVERROR(ENOMEM) if memory allocation fails + * @retval AVERROR(EINVAL) for invalid arguments */ int ff_dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t *input_operand_indexes, int32_t output_operand_index, const void *parameters, NativeContext *ctx); diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c index 7a60aa6a4b..dfa0d1ed36 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c @@ -211,12 +211,12 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_opera output_operand->length = ff_calculate_operand_data_length(output_operand); if (output_operand->length <= 0) { av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n"); - return DNN_ERROR; + return AVERROR(EINVAL); } tmp = av_realloc(output_operand->data, output_operand->length); if (!tmp) { av_log(ctx, AV_LOG_ERROR, "Failed to reallocate memory for output\n"); - return DNN_ERROR; + return AVERROR(ENOMEM); } output_operand->data = tmp; thread_common_param.output_data = output_operand->data; @@ -229,17 +229,19 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_opera #if HAVE_PTHREAD_CANCEL thread_param = av_malloc_array(thread_num, sizeof(*thread_param)); if (!thread_param) - return DNN_ERROR; + return AVERROR(ENOMEM); thread_stride = (height - pad_size * 2) / thread_num; //create threads for (int i = 0; i < thread_num; i++){ + int thread_ret = 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); - if (pthread_create(&thread_param[i].thread, NULL, - dnn_execute_layer_conv2d_thread, &thread_param[i])) { + thread_ret = pthread_create(&thread_param[i].thread, NULL, + dnn_execute_layer_conv2d_thread, &thread_param[i]); + if (thread_ret) { thread_num = i; - ret = DNN_ERROR; + ret = AVERROR(thread_ret); break; } } diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.h b/libavfilter/dnn/dnn_backend_native_layer_conv2d.h index 446f48f608..f754a9ba18 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.h +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.h @@ -60,7 +60,8 @@ int ff_dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, int * @param parameters convolution parameters * @param ctx pointer to Native model context for logging * @retval 0 if the execution succeeds - * @retval DNN_ERROR if the execution fails + * @retval AVERROR(ENOMEM) if memory allocation fails + * @retval AVERROR(EINVAL) for invalid arguments */ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_indexes, int32_t output_operand_index, const void *parameters, NativeContext *ctx); diff --git a/libavfilter/dnn/dnn_backend_native_layer_dense.c b/libavfilter/dnn/dnn_backend_native_layer_dense.c index 117590d7bb..a22a484464 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_dense.c +++ b/libavfilter/dnn/dnn_backend_native_layer_dense.c @@ -104,12 +104,12 @@ int ff_dnn_execute_layer_dense(DnnOperand *operands, const int32_t *input_operan output_operand->length = ff_calculate_operand_data_length(output_operand); if (output_operand->length <= 0) { av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n"); - return DNN_ERROR; + return AVERROR(EINVAL); } output_operand->data = av_realloc(output_operand->data, output_operand->length); if (!output_operand->data) { av_log(ctx, AV_LOG_ERROR, "Failed to reallocate memory for output\n"); - return DNN_ERROR; + return AVERROR(ENOMEM); } output = output_operand->data; @@ -147,5 +147,5 @@ int ff_dnn_execute_layer_dense(DnnOperand *operands, const int32_t *input_operan output += dense_params->output_num; } } - return 0; + return DNN_SUCCESS; } diff --git a/libavfilter/dnn/dnn_backend_native_layer_dense.h b/libavfilter/dnn/dnn_backend_native_layer_dense.h index 0488b03cc3..607fc3e684 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_dense.h +++ b/libavfilter/dnn/dnn_backend_native_layer_dense.h @@ -57,7 +57,8 @@ int ff_dnn_load_layer_dense(Layer *layer, AVIOContext *model_file_context, int f * @param parameters dense layer parameters * @param ctx pointer to Native model context for logging * @retval 0 if the execution succeeds - * @retval DNN_ERROR if the execution fails + * @retval AVERROR(ENOMEM) if memory allocation fails + * @retval AVERROR(EINVAL) for invalid arguments */ int ff_dnn_execute_layer_dense(DnnOperand *operands, const int32_t *input_operand_indexes, int32_t output_operand_index, const void *parameters, NativeContext *ctx); diff --git a/libavfilter/dnn/dnn_backend_native_layer_depth2space.c b/libavfilter/dnn/dnn_backend_native_layer_depth2space.c index 30ced43cd5..82b1a52be2 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_depth2space.c +++ b/libavfilter/dnn/dnn_backend_native_layer_depth2space.c @@ -76,12 +76,12 @@ int ff_dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_ output_operand->length = ff_calculate_operand_data_length(output_operand); if (output_operand->length <= 0) { av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n"); - return DNN_ERROR; + return AVERROR(EINVAL); } output_operand->data = av_realloc(output_operand->data, output_operand->length); if (!output_operand->data) { av_log(ctx, AV_LOG_ERROR, "Failed to reallocate memory for output\n"); - return DNN_ERROR; + return AVERROR(ENOMEM); } output = output_operand->data; @@ -98,5 +98,5 @@ int ff_dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_ } output += output_linesize; } - return 0; + return DNN_SUCCESS; } diff --git a/libavfilter/dnn/dnn_backend_native_layer_depth2space.h b/libavfilter/dnn/dnn_backend_native_layer_depth2space.h index 2792a33ebe..aaf2df4c13 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_depth2space.h +++ b/libavfilter/dnn/dnn_backend_native_layer_depth2space.h @@ -63,7 +63,8 @@ int ff_dnn_load_layer_depth2space(Layer *layer, AVIOContext *model_file_context, * @param parameters depth to space layer parameters * @param ctx pointer to Native model context for logging * @retval 0 if the execution succeeds - * @retval DNN_ERROR if the execution fails + * @retval AVERROR(ENOMEM) if memory allocation fails + * @retval AVERROR(EINVAL) for invalid arguments */ int ff_dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_operand_indexes, int32_t output_operand_index, const void *parameters, NativeContext *ctx); diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c index 81901c56d9..1a3fa3f132 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c +++ b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c @@ -159,12 +159,12 @@ int ff_dnn_execute_layer_math_binary(DnnOperand *operands, const int32_t *input_ output->length = ff_calculate_operand_data_length(output); if (output->length <= 0) { av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n"); - return DNN_ERROR; + return AVERROR(EINVAL); } output->data = av_realloc(output->data, output->length); if (!output->data) { av_log(ctx, AV_LOG_ERROR, "Failed to reallocate memory for output\n"); - return DNN_ERROR; + return AVERROR(ENOMEM); } switch (params->bin_op) { @@ -188,6 +188,6 @@ int ff_dnn_execute_layer_math_binary(DnnOperand *operands, const int32_t *input_ return 0; default: av_log(ctx, AV_LOG_ERROR, "Unmatch math binary operator\n"); - return DNN_ERROR; + return AVERROR(EINVAL); } } diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c index b8694910d9..e3c5106e5e 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c @@ -68,12 +68,12 @@ int ff_dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_o output->length = ff_calculate_operand_data_length(output); if (output->length <= 0) { av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n"); - return DNN_ERROR; + return AVERROR(EINVAL); } output->data = av_realloc(output->data, output->length); if (!output->data) { av_log(ctx, AV_LOG_ERROR, "Failed to reallocate memory for output\n"); - return DNN_ERROR; + return AVERROR(ENOMEM); } dims_count = ff_calculate_operand_dims_count(output); @@ -151,6 +151,6 @@ int ff_dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_o return 0; default: av_log(ctx, AV_LOG_ERROR, "Unmatch math unary operator\n"); - return DNN_ERROR; + return AVERROR(EINVAL); } } diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h index ed79947896..806e73b29f 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h @@ -83,7 +83,8 @@ int ff_dnn_load_layer_math_unary(Layer *layer, AVIOContext *model_file_context, * @param parameters unary math layer parameters * @param ctx pointer to Native model context for logging * @retval 0 if the execution succeeds - * @retval DNN_ERROR if the execution fails + * @retval AVERROR(ENOMEM) if memory allocation fails + * @retval AVERROR(EINVAL) for invalid arguments */ int ff_dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_operand_indexes, int32_t output_operand_index, const void *parameters, NativeContext *ctx); diff --git a/libavfilter/dnn/dnn_backend_native_layer_maximum.c b/libavfilter/dnn/dnn_backend_native_layer_maximum.c index a38759eeee..667efaa3b8 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_maximum.c +++ b/libavfilter/dnn/dnn_backend_native_layer_maximum.c @@ -65,12 +65,12 @@ int ff_dnn_execute_layer_maximum(DnnOperand *operands, const int32_t *input_oper output->length = ff_calculate_operand_data_length(output); if (output->length <= 0) { av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n"); - return DNN_ERROR; + return AVERROR(EINVAL); } output->data = av_realloc(output->data, output->length); if (!output->data) { av_log(ctx, AV_LOG_ERROR, "Failed to reallocate memory for output\n"); - return DNN_ERROR; + return AVERROR(ENOMEM); } dims_count = ff_calculate_operand_dims_count(output); diff --git a/libavfilter/dnn/dnn_backend_native_layer_pad.c b/libavfilter/dnn/dnn_backend_native_layer_pad.c index a60451a8de..e274fe12c6 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_pad.c +++ b/libavfilter/dnn/dnn_backend_native_layer_pad.c @@ -113,12 +113,12 @@ int ff_dnn_execute_layer_pad(DnnOperand *operands, const int32_t *input_operand_ output_operand->length = ff_calculate_operand_data_length(output_operand); if (output_operand->length <= 0) { av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n"); - return DNN_ERROR; + return AVERROR(EINVAL); } output_operand->data = av_realloc(output_operand->data, output_operand->length); if (!output_operand->data) { av_log(ctx, AV_LOG_ERROR, "Failed to reallocate memory for output\n"); - return DNN_ERROR; + return AVERROR(ENOMEM); } output = output_operand->data; diff --git a/libavfilter/dnn_interface.h b/libavfilter/dnn_interface.h index 37e89d9789..24e0b66661 100644 --- a/libavfilter/dnn_interface.h +++ b/libavfilter/dnn_interface.h @@ -30,6 +30,8 @@ #include "libavutil/frame.h" #include "avfilter.h" +#define DNN_GENERIC_ERROR FFERRTAG('D','N','N','!') + typedef enum {DNN_SUCCESS, DNN_ERROR} DNNReturnType; typedef enum {DNN_NATIVE, DNN_TF, DNN_OV} DNNBackendType;