From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 56A2048A6A for ; Sat, 27 Apr 2024 16:43:23 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 985C268D404; Sat, 27 Apr 2024 19:42:28 +0300 (EEST) Received: from out203-205-221-210.mail.qq.com (out203-205-221-210.mail.qq.com [203.205.221.210]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 012E668D2AB for ; Sat, 27 Apr 2024 19:42:14 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1714236125; bh=ij3BuPB+1SDO4TrQLufpRme6GURUZXSvBIfypWPgQBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LfQH5xNyw/Fu9XHG7thLHFNCJnDhNdpz6ycLOPHYG4mSWJ+uAD+Eg/uKTIVtnUtHt C9gL8N9VF6Z3iy3YyII8wXjXEOb5BWToY/D6YHyMwkPdbsaykheKW/EdkZfSkqaTf2 pbcmonFWDJRnUbOtucAzCVwLhJI98jrizqdPgqU8= Received: from localhost.localdomain ([113.118.107.199]) by newxmesmtplogicsvrszc19-0.qq.com (NewEsmtp) with SMTP id A8200E2A; Sun, 28 Apr 2024 00:42:02 +0800 X-QQ-mid: xmsmtpt1714236124tv0wjsslv Message-ID: X-QQ-XMAILINFO: MK5U7QanZrCwSEL0746FVDmNNenX6OzdoJquzX76WyhSRMPmoBYA3ZYzkdc9Vl A1kVEWV/dTY86wlbCYaM/UDNaN7vpmLbCfBSSTDAHoAZy3XH5gbh7zvcnYTeVJPiVpyIAwnToS3B J6e+ius09cxxuQu8d0V5u4WlubiSK3MjVpewxrcBKliwl5HjuhoZevKcZfHTcUcqQ/UfxwG3r9JX bz0dC98C5FD1zkpGBUhZqIMF3SNew6DU29XBHUa8W62tL5FCiur7Vl6smI64y9H/22CAslbhHgpz RVWELCeDee1nn5O/jhx1vSLiag6MO7XijEo5FgZeFh8hVtseFINPlbytHvDJ5urkvA0jnBX/uy2J YG4nONK0uFLPoj+xnjbmrcZKHFk2P1xjZSoGPca6auoUdmE2jxcbeHHj0FGFK18Pnz4F+xNN8LE7 c7RMACo1Yl7JM9ZwYprQvSqoanEbjexLsKnhYweDjOvyOVz5ghwbrZznk27mtKN6tUp6k1HGF9Al 91hxaDpW7c/0cC/JJ5b9fvkj0Iu6OlmdUoAvPx1y8Y3Bi0zbOstztfxKKdneb0L/Scu9Ho6hq6WT 876oX/D7p2nHv17Sg1oM+/++BT54IkwYM1ZO05a2hErKrVBWEyePl/kLyNQ9EMoRNR7v0XgqWOlf TK4JEneugJPp+NHun8yg3703s3OdRUMMF5csdiHf2AcKvjRqwOmsAVCIH6LcsVR9NJ4PxUIHkMQ7 d2YCmcrAASvZVJQMa1SBRjswKTWNlNvPhg6dqyZ4fS/5uoGD5v4q1OBmNKP3iQwWrMyRnfdIJNVt bxXV0tu89yzvj0hw5obB3+Tvvohc81NCqSScVtivhAIMVjTc/Xp7HeTjPAdMbjtCipP6Gfpu+x1d jfHYQqLaQiSjsrly9gBOj1F5VJ5Sz8Sxsm2A3r6jrVWna7tV2dV3kFG/SsAwf6iayen28iacqYGT Zciszu896TB6Aj8iYM/LD1EZdoT4jCYWWEq4xptVg= X-QQ-XMRINFO: OWPUhxQsoeAVDbp3OJHYyFg= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Sun, 28 Apr 2024 00:41:54 +0800 X-OQ-MSGID: <20240427164159.82771-5-quinkblack@foxmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240427164159.82771-1-quinkblack@foxmail.com> References: <20240427164159.82771-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH WIP 4/9] avfilter/dnn_backend_tf: Remove one level of indentation 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: Zhao Zhili Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Zhao Zhili --- libavfilter/dnn/dnn_backend_tf.c | 63 ++++++++++++++++---------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c index d24591b90b..60f9e57fb7 100644 --- a/libavfilter/dnn/dnn_backend_tf.c +++ b/libavfilter/dnn/dnn_backend_tf.c @@ -483,41 +483,42 @@ static void dnn_free_model_tf(DNNModel **model) { TFModel *tf_model; - if (*model){ - tf_model = (*model)->model; - while (ff_safe_queue_size(tf_model->request_queue) != 0) { - TFRequestItem *item = ff_safe_queue_pop_front(tf_model->request_queue); - destroy_request_item(&item); - } - ff_safe_queue_destroy(tf_model->request_queue); + if (!model || !*model) + return; - while (ff_queue_size(tf_model->lltask_queue) != 0) { - LastLevelTaskItem *item = ff_queue_pop_front(tf_model->lltask_queue); - av_freep(&item); - } - ff_queue_destroy(tf_model->lltask_queue); + tf_model = (*model)->model; + while (ff_safe_queue_size(tf_model->request_queue) != 0) { + TFRequestItem *item = ff_safe_queue_pop_front(tf_model->request_queue); + destroy_request_item(&item); + } + ff_safe_queue_destroy(tf_model->request_queue); - while (ff_queue_size(tf_model->task_queue) != 0) { - TaskItem *item = ff_queue_pop_front(tf_model->task_queue); - av_frame_free(&item->in_frame); - av_frame_free(&item->out_frame); - av_freep(&item); - } - ff_queue_destroy(tf_model->task_queue); + while (ff_queue_size(tf_model->lltask_queue) != 0) { + LastLevelTaskItem *item = ff_queue_pop_front(tf_model->lltask_queue); + av_freep(&item); + } + ff_queue_destroy(tf_model->lltask_queue); - if (tf_model->graph){ - TF_DeleteGraph(tf_model->graph); - } - if (tf_model->session){ - TF_CloseSession(tf_model->session, tf_model->status); - TF_DeleteSession(tf_model->session, tf_model->status); - } - if (tf_model->status){ - TF_DeleteStatus(tf_model->status); - } - av_freep(&tf_model); - av_freep(&model); + while (ff_queue_size(tf_model->task_queue) != 0) { + TaskItem *item = ff_queue_pop_front(tf_model->task_queue); + av_frame_free(&item->in_frame); + av_frame_free(&item->out_frame); + av_freep(&item); + } + ff_queue_destroy(tf_model->task_queue); + + if (tf_model->graph){ + TF_DeleteGraph(tf_model->graph); + } + if (tf_model->session){ + TF_CloseSession(tf_model->session, tf_model->status); + TF_DeleteSession(tf_model->session, tf_model->status); + } + if (tf_model->status){ + TF_DeleteStatus(tf_model->status); } + av_freep(&tf_model); + av_freep(&model); } static DNNModel *dnn_load_model_tf(DnnContext *ctx, DNNFunctionType func_type, AVFilterContext *filter_ctx) -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".