[FFmpeg-devel] [PATCH 3/3] avfilter/dnn_backend_openvino: reduce indentation in free_model_ov
Zhao Zhili
quinkblack at foxmail.com
Fri Aug 18 20:52:32 EEST 2023
From: Zhao Zhili <zhilizhao at tencent.com>
No functional changes.
Signed-off-by: Zhao Zhili <zhilizhao at tencent.com>
---
libavfilter/dnn/dnn_backend_openvino.c | 75 +++++++++++++-------------
1 file changed, 39 insertions(+), 36 deletions(-)
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index 071516b17d..6afc80eda5 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -294,44 +294,47 @@ static void infer_completion_callback(void *args)
static void dnn_free_model_ov(DNNModel **model)
{
- if (*model){
- OVModel *ov_model = (*model)->model;
- while (ff_safe_queue_size(ov_model->request_queue) != 0) {
- OVRequestItem *item = ff_safe_queue_pop_front(ov_model->request_queue);
- if (item && item->infer_request) {
- ie_infer_request_free(&item->infer_request);
- }
- av_freep(&item->lltasks);
- av_freep(&item);
- }
- ff_safe_queue_destroy(ov_model->request_queue);
-
- while (ff_queue_size(ov_model->lltask_queue) != 0) {
- LastLevelTaskItem *item = ff_queue_pop_front(ov_model->lltask_queue);
- av_freep(&item);
- }
- ff_queue_destroy(ov_model->lltask_queue);
+ OVModel *ov_model;
- while (ff_queue_size(ov_model->task_queue) != 0) {
- TaskItem *item = ff_queue_pop_front(ov_model->task_queue);
- av_frame_free(&item->in_frame);
- av_frame_free(&item->out_frame);
- av_freep(&item);
- }
- ff_queue_destroy(ov_model->task_queue);
+ if (!*model)
+ return;
- if (ov_model->exe_network)
- ie_exec_network_free(&ov_model->exe_network);
- if (ov_model->network)
- ie_network_free(&ov_model->network);
- if (ov_model->core)
- ie_core_free(&ov_model->core);
- av_free(ov_model->all_output_names);
- av_free(ov_model->all_input_names);
- av_opt_free(&ov_model->ctx);
- av_freep(&ov_model);
- av_freep(model);
- }
+ ov_model = (*model)->model;
+ while (ff_safe_queue_size(ov_model->request_queue) != 0) {
+ OVRequestItem *item = ff_safe_queue_pop_front(ov_model->request_queue);
+ if (item && item->infer_request) {
+ ie_infer_request_free(&item->infer_request);
+ }
+ av_freep(&item->lltasks);
+ av_freep(&item);
+ }
+ ff_safe_queue_destroy(ov_model->request_queue);
+
+ while (ff_queue_size(ov_model->lltask_queue) != 0) {
+ LastLevelTaskItem *item = ff_queue_pop_front(ov_model->lltask_queue);
+ av_freep(&item);
+ }
+ ff_queue_destroy(ov_model->lltask_queue);
+
+ while (ff_queue_size(ov_model->task_queue) != 0) {
+ TaskItem *item = ff_queue_pop_front(ov_model->task_queue);
+ av_frame_free(&item->in_frame);
+ av_frame_free(&item->out_frame);
+ av_freep(&item);
+ }
+ ff_queue_destroy(ov_model->task_queue);
+
+ if (ov_model->exe_network)
+ ie_exec_network_free(&ov_model->exe_network);
+ if (ov_model->network)
+ ie_network_free(&ov_model->network);
+ if (ov_model->core)
+ ie_core_free(&ov_model->core);
+ av_free(ov_model->all_output_names);
+ av_free(ov_model->all_input_names);
+ av_opt_free(&ov_model->ctx);
+ av_freep(&ov_model);
+ av_freep(model);
}
--
2.25.1
More information about the ffmpeg-devel
mailing list