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 5846149A67 for ; Sun, 28 Apr 2024 06:47:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 40CD768D3E1; Sun, 28 Apr 2024 09:47:22 +0300 (EEST) Received: from out203-205-221-245.mail.qq.com (out203-205-221-245.mail.qq.com [203.205.221.245]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5888168C2F0 for ; Sun, 28 Apr 2024 09:47:08 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1714286819; bh=1wklaRLE14l6xLaWgU45zthbEJNQvCoOjvvidDHrzgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=tCAiBkzU09wLBOV1uzSGhAN8H49iOudHbe+vzJsQ7TYwlfoflli0XCPTIpyt+P1xE xFO7jZtcCdZcdTGXyfUv8gZg5vlFv2nevweJK65N/gnEUOsMUCXm0wT6T+QkvAmetj bQpR0JNkcJkk+ycN4T2yopHmB//BkUZA8+nqo7xU= Received: from localhost.localdomain ([119.147.10.207]) by newxmesmtplogicsvrszc5-2.qq.com (NewEsmtp) with SMTP id BB93D84A; Sun, 28 Apr 2024 14:46:57 +0800 X-QQ-mid: xmsmtpt1714286819t6j89pmfa Message-ID: X-QQ-XMAILINFO: NT9b64/RmY6NRm/A5c6lGEhx2YpRbQ53WYeTj9tGUsZPk5dE0IUkUgO7Lsj+f1 6AY06A7waAAK7GV32SWTbQIWLOnKwvtU1OX9I9Nt9+4fcPeu4e7W3C1sieQv/TmESHKeRQhN9IC7 Gc7YfJ8p7mPJCmcf2/nMngsTFZtSBTO5XN9eMeVHxW22WN67w8UxXkjtSBiVWIAPgbDqSs7blA3V +dLosByPFynTzg4TxqxQZqVcCKD8a0/vMgjvTZWB1T8IF2XLdgcz/O2RGyGQ9uLe0ox1hZlrI0KR +oqRUJbs2iR7BX5K9HuGbWMB2fq1J5e+pDz7m/ZvpcqWkgCvinDQP6Q7dAV260ihHKMWRkUh9A/4 BCGO1nz2yBpZKyhYZG1Wa+OBwzF6xHK3XasZIIXZ3ojAoCHoX/kokim/tcwQOtS9cQ8Cp2U8mniD OnzsI8ctWfI29VNMrUHbSea61OeUG2Rxx/1xZ5Kwh/L+sVq0sTrGE5j9j+3VGvRa6TlpJxoh98MJ +oMzizziFj/oOuAT+6MnUlKluHykrrxOUM1pdXY6agkbVBoQZ+7OwBTnFDONEhTJD15XIXTc/M6K T62gy3sCZFwvtRrxLw/iKuEf7XJ1x6Odx3hxGlBTaSlzzjBrfWXR1RaR6Eu0jv3rq0RXdbRWO7/A OBClJUpxgzc0bSozWaQC7y+mjY+ei34T+5rOLHxcVNaCrq0TbR/s2mnNzhe8rMGcTt4FDEi54/Gx qaHNE0iwZkEz6dC8iW3qFZUGjDhQRj1YNWpzYE8tfE8yKdhDoRKZrKkRUZSDuHCwzs6JlIhHHgfD UJOHDOPJj5bMSzpIH34ToCqYUn1LFsi+302iHXcOTp7V1sjnDH3VLg9qIcUj7hMgSASwWNuAu1Hn VPvjNMdPmDUJNYcdXDYtDa2sC6DjqluEANFLbyaodVUeP7MRkiDX5isLLTxyulLW+tZa9Tyi4q9U FnM8GeI5ZkNFFynb1bn21qzEDA9Joj3ChNjDRaYn2XS+36LhdyBUsqaQ4oocfR X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Sun, 28 Apr 2024 14:46:50 +0800 X-OQ-MSGID: <20240428064655.106853-4-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240428064655.106853-1-quinkblack@foxmail.com> References: <20240428064655.106853-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH WIP v2 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.25.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".