From ffb0a15c12cc00827eaa219cfadc9bd184b82d52 Mon Sep 17 00:00:00 2001 From: Jaeyun Jung Date: Mon, 19 Jun 2023 13:41:59 +0900 Subject: [PATCH] [Common] data size of extra tensor Fix util function, getting tensor size of extra tensor. Signed-off-by: Jaeyun Jung --- gst/nnstreamer/nnstreamer_plugin_api_util_impl.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gst/nnstreamer/nnstreamer_plugin_api_util_impl.c b/gst/nnstreamer/nnstreamer_plugin_api_util_impl.c index 5be6781..79aba8d 100644 --- a/gst/nnstreamer/nnstreamer_plugin_api_util_impl.c +++ b/gst/nnstreamer/nnstreamer_plugin_api_util_impl.c @@ -422,6 +422,7 @@ gst_tensors_info_free (GstTensorsInfo * info) gsize gst_tensors_info_get_size (const GstTensorsInfo * info, gint index) { + GstTensorInfo *_info; gsize data_size = 0; guint i; @@ -429,10 +430,13 @@ gst_tensors_info_get_size (const GstTensorsInfo * info, gint index) g_return_val_if_fail (index < (gint) info->num_tensors, 0); if (index < 0) { - for (i = 0; i < info->num_tensors; ++i) - data_size += gst_tensor_info_get_size (&info->info[i]); + for (i = 0; i < info->num_tensors; ++i) { + _info = gst_tensors_info_get_nth_info ((GstTensorsInfo *) info, i); + data_size += gst_tensor_info_get_size (_info); + } } else { - data_size = gst_tensor_info_get_size (&info->info[index]); + _info = gst_tensors_info_get_nth_info ((GstTensorsInfo *) info, index); + data_size = gst_tensor_info_get_size (_info); } return data_size; -- 2.7.4