diff mbox series

[FFmpeg-devel,v4,06/11] avfilter/dnn_backend_tf: Remove one level of indentation

Message ID tencent_58701E2D0D9A5740489AE69F3DAB254E2508@qq.com
State New
Headers show
Series [FFmpeg-devel,v4,01/11] avfilter/dnn: Refactor DNN parameter configuration system | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Zhao Zhili May 7, 2024, 4:08 p.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
---
 libavfilter/dnn/dnn_backend_tf.c | 63 ++++++++++++++++----------------
 1 file changed, 32 insertions(+), 31 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c
index 0ab3bd13ed..eb4a2a5289 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)