[Build] remove warning
authorJaeyun <jy1210.jung@samsung.com>
Thu, 18 Apr 2019 11:56:52 +0000 (20:56 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Fri, 19 Apr 2019 02:22:21 +0000 (11:22 +0900)
update changes to remove warning message

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
ext/nnstreamer/tensor_decoder/tensordec-boundingbox.c
ext/nnstreamer/tensor_filter/tensor_filter_tensorflow.c
gst/nnstreamer/nnstreamer_conf.c
gst/nnstreamer/tensor_common.c
gst/nnstreamer/tensor_demux/gsttensordemux.c
gst/nnstreamer/tensor_merge/gsttensormerge.c
gst/nnstreamer/tensor_source/tensor_src_iio.c
gst/nnstreamer/tensor_transform/tensor_transform.c

index d4f208a..9b55349 100644 (file)
@@ -800,14 +800,15 @@ nms (GArray * results)
 #define _get_objects_tf(bb, _type, typename, numinput, classinput, scoreinput, boxesinput, config, results) \
   case typename: \
   { \
-    int d; \
+    int d, num; \
+    size_t boxbpi; \
     _type * num_detection_ = (_type *) numinput; \
     _type * classes_ = (_type *) classinput; \
     _type * scores_ = (_type *) scoreinput; \
     _type * boxes_ = (_type *) boxesinput; \
-    int num = (int) num_detection_[0]; \
+    num = (int) num_detection_[0]; \
     results = g_array_sized_new (FALSE, TRUE, sizeof (detectedObject), num); \
-    size_t boxbpi = config->info.info[3].dimension[0]; \
+    boxbpi = config->info.info[3].dimension[0]; \
     for (d = 0; d < num; d++) { \
       detectedObject object; \
       object.valid = TRUE; \
index 39d4750..edc56bd 100644 (file)
@@ -67,6 +67,8 @@ static int
 tf_loadModelFile (const GstTensorFilterProperties * prop, void **private_data)
 {
   tf_data *tf;
+  gboolean tf_mem_optmz;
+
   if (*private_data != NULL) {
     tf = *private_data;
     if (strcmp (prop->model_file, tf_core_getModelPath (tf->tf_private_data))) {
@@ -75,13 +77,13 @@ tf_loadModelFile (const GstTensorFilterProperties * prop, void **private_data)
       return 1;
     }
   }
+
+  tf_mem_optmz = nnsconf_get_value_bool (NNSCONF_VAL_TF_MEM_OPTMZ);
+
   tf = g_new0 (tf_data, 1); /** initialize tf Fill Zero! */
   *private_data = tf;
   tf->tf_private_data = tf_core_new (prop->model_file);
 
-  const gboolean tf_mem_optmz =
-      nnsconf_get_value_bool (NNSCONF_VAL_TF_MEM_OPTMZ);
-
   if (tf->tf_private_data) {
     if (tf_core_init (tf->tf_private_data, prop, tf_mem_optmz)) {
       g_printerr ("failed to initailize the object: tensorflow");
index bf82e88..1d39d6b 100644 (file)
@@ -365,11 +365,13 @@ const gchar *subplugin_prefixes[NNSCONF_PATH_END] = {
 const gchar *
 nnsconf_get_fullpath (const gchar * subpluginname, nnsconf_type_path type)
 {
+  gchar *filename;
+  const gchar *ret;
+
   nnsconf_loadconf (FALSE);
 
-  gchar *filename =
-      g_strconcat (subplugin_prefixes[type], subpluginname, ".so", NULL);
-  const gchar *ret = nnsconf_get_fullpath_fromfile (filename, type);
+  filename = g_strconcat (subplugin_prefixes[type], subpluginname, ".so", NULL);
+  ret = nnsconf_get_fullpath_fromfile (filename, type);
 
   g_free (filename);
   return ret;
index 92cc4b2..65dfe66 100644 (file)
@@ -1036,15 +1036,17 @@ gst_tensor_set_current_time (GstCollectPads * collect,
     GstClockTime * current_time, tensor_time_sync_data sync)
 {
   GSList *walk = NULL;
-  walk = collect->data;
   gboolean isEOS = FALSE;
   guint count = 0;
 
+  walk = collect->data;
   while (walk) {
-    GstCollectData *data = (GstCollectData *) walk->data;
-    walk = g_slist_next (walk);
-    GstBuffer *buf = NULL;
+    GstCollectData *data;
+    GstBuffer *buf;
+
+    data = (GstCollectData *) walk->data;
     buf = gst_collect_pads_peek (collect, data);
+    walk = g_slist_next (walk);
 
     if (buf == NULL) {
       isEOS = TRUE;
@@ -1092,10 +1094,14 @@ gst_gen_tensors_from_collectpad (GstCollectPads * collect,
   walk = collect->data;
 
   if (sync.mode == SYNC_BASEPAD) {
+    GstCollectData *data;
+    GstTensorCollectPadData *pad;
+    GstBuffer *buf;
+
     walk = g_slist_nth (walk, sync.data_basepad.sink_id);
-    GstCollectData *data = (GstCollectData *) walk->data;
-    GstTensorCollectPadData *pad = (GstTensorCollectPadData *) data;
-    GstBuffer *buf = NULL;
+    data = (GstCollectData *) walk->data;
+    pad = (GstTensorCollectPadData *) data;
+
     buf = gst_collect_pads_peek (collect, data);
     if (buf != NULL) {
       if (pad->buffer != NULL)
@@ -1114,6 +1120,7 @@ gst_gen_tensors_from_collectpad (GstCollectPads * collect,
     GstTensorCollectPadData *pad = (GstTensorCollectPadData *) data;
     GstCaps *caps = gst_pad_get_current_caps (pad->pad);
     GstStructure *s = gst_caps_get_structure (caps, 0);
+    GstBuffer *buf;
 
     gst_tensors_config_from_structure (&in_configs, s);
     g_assert (gst_tensors_config_validate (&in_configs));
@@ -1126,9 +1133,6 @@ gst_gen_tensors_from_collectpad (GstCollectPads * collect,
     gst_caps_unref (caps);
 
     walk = g_slist_next (walk);
-
-    GstBuffer *buf = NULL;
-
     buf = gst_collect_pads_peek (collect, data);
 
     switch (sync.mode) {
index 203181f..9f7c784 100644 (file)
@@ -303,6 +303,14 @@ gst_tensor_demux_get_tensor_pad (GstTensorDemux * tensor_demux,
     gboolean * created, gint nth)
 {
   GSList *walk;
+  GstPad *pad;
+  GstTensorPad *tensorpad;
+  gchar *name;
+  GstEvent *event;
+  gchar *stream_id;
+  GstCaps *caps;
+  GstTensorConfig config;
+
   walk = tensor_demux->srcpads;
   while (walk) {
     GstTensorPad *pad = (GstTensorPad *) walk->data;
@@ -315,14 +323,6 @@ gst_tensor_demux_get_tensor_pad (GstTensorDemux * tensor_demux,
     walk = walk->next;
   }
 
-  GstPad *pad;
-  GstTensorPad *tensorpad;
-  gchar *name;
-  GstEvent *event;
-  gchar *stream_id;
-  GstCaps *caps;
-  GstTensorConfig config;
-
   tensorpad = g_new0 (GstTensorPad, 1);
   GST_DEBUG_OBJECT (tensor_demux, "createing pad: %d(%dth)",
       tensor_demux->num_srcpads, nth);
@@ -436,6 +436,12 @@ gst_tensor_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
   g_assert (gst_buffer_n_memory (buf) == num_tensors);
 
   for (i = 0; i < num_tensors; i++) {
+    GstTensorPad *srcpad;
+    GstBuffer *outbuf;
+    GstMemory *mem;
+    gboolean created;
+    GstClockTime ts;
+
     if (tensor_demux->tensorpick != NULL) {
       gboolean found = FALSE;
       GList *list;
@@ -449,11 +455,6 @@ gst_tensor_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
         continue;
     }
 
-    GstTensorPad *srcpad;
-    GstBuffer *outbuf;
-    GstMemory *mem;
-    gboolean created;
-    GstClockTime ts;
     srcpad = gst_tensor_demux_get_tensor_pad (tensor_demux, &created, i);
 
     outbuf = gst_buffer_new ();
@@ -569,7 +570,7 @@ gst_tensor_demux_get_property (GObject * object, guint prop_id,
     case PROP_TENSORPICK:
     {
       GList *list;
-      char *p = "";
+      char *p;
       GPtrArray *arr = g_ptr_array_new ();
       gchar **strings;
 
index dee0c23..30cde5e 100644 (file)
@@ -522,11 +522,13 @@ gst_tensor_merge_generate_mem (GstTensorMerge * tensor_merge,
           for (l = 0; l < dim[3]; l++) {
             for (i = 0; i < dim[2]; i++) {
               for (k = 0; k < num_mem; k++) {
-                size_t c = 1;
+                size_t c, s;
+
+                c = 1;
                 for (j = 0; j < LINEAR_SECOND + 1; j++)
                   c *= tensor_merge->tensors_config.info.info[k].dimension[j];
 
-                size_t s = tensor_element_size[type] * c;
+                s = tensor_element_size[type] * c;
 
                 inptr = mInfo[k].data + (l * dim[2] + i) * s;
 
@@ -542,11 +544,13 @@ gst_tensor_merge_generate_mem (GstTensorMerge * tensor_merge,
         {
           for (l = 0; l < dim[3]; l++) {
             for (k = 0; k < num_mem; k++) {
-              size_t c = 1;
+              size_t c, s;
+
+              c = 1;
               for (j = 0; j < LINEAR_THIRD + 1; j++)
                 c *= tensor_merge->tensors_config.info.info[k].dimension[j];
 
-              size_t s = tensor_element_size[type] * c;
+              s = tensor_element_size[type] * c;
 
               inptr = mInfo[k].data + l * s;
 
@@ -560,11 +564,13 @@ gst_tensor_merge_generate_mem (GstTensorMerge * tensor_merge,
         case LINEAR_FOURTH:
         {
           for (k = 0; k < num_mem; k++) {
-            size_t c = 1;
+            size_t c, s;
+
+            c = 1;
             for (j = 0; j < LINEAR_FOURTH + 1; j++)
               c *= tensor_merge->tensors_config.info.info[k].dimension[j];
 
-            size_t s = tensor_element_size[type] * c;
+            s = tensor_element_size[type] * c;
 
             inptr = mInfo[k].data;
             memcpy (outptr, inptr, s);
index acf7fd1..f61a0cd 100644 (file)
@@ -1046,11 +1046,11 @@ gst_tensor_src_iio_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec)
 {
   GstTensorSrcIIO *self;
-  self = GST_TENSOR_SRC_IIO (object);
-
   GstStateChangeReturn status;
   GstState state;
 
+  self = GST_TENSOR_SRC_IIO (object);
+
   /**
    * No support for setting properties in PAUSED/PLAYING state as it needs to
    * reset the device. To change the properties, user should stop the pipeline
@@ -1114,7 +1114,7 @@ gst_tensor_src_iio_set_property (GObject * object, guint prop_id,
               strlen (CHANNELS_ENABLED_AUTO_CHAR))) {
         self->channels_enabled = CHANNELS_ENABLED_AUTO;
       } else {
-        gint i;
+        gint i, num;
         gint64 val;
         gchar **strv;
         gchar *endptr = NULL;
@@ -1126,7 +1126,7 @@ gst_tensor_src_iio_set_property (GObject * object, guint prop_id,
         self->custom_channel_table =
             g_hash_table_new (g_direct_hash, g_direct_equal);
         strv = g_strsplit_set (param, ",;", -1);
-        gint num = g_strv_length (strv);
+        num = g_strv_length (strv);
         for (i = 0; i < num; i++) {
           val = g_ascii_strtoull (strv[i], &endptr, 10);
           if (errno == ERANGE || errno == EINVAL || (endptr == strv[i]
@@ -1399,12 +1399,13 @@ static guint
 gst_tensor_get_size_from_channels (GList * channels)
 {
   guint size_bytes = 0;
+  guint remain = 0;
   GList *list;
   GstTensorSrcIIOChannelProperties *channel_prop = NULL;
 
   for (list = channels; list != NULL; list = list->next) {
     channel_prop = (GstTensorSrcIIOChannelProperties *) list->data;
-    guint remain = size_bytes % channel_prop->storage_bytes;
+    remain = size_bytes % channel_prop->storage_bytes;
     if (remain == 0) {
       channel_prop->location = size_bytes;
     } else {
@@ -2071,9 +2072,10 @@ gst_tensor_src_iio_fixate (GstBaseSrc * src, GstCaps * caps)
    * Caps are fixated based on the device source in _start().
    */
   GstTensorSrcIIO *self;
-  self = GST_TENSOR_SRC_IIO_CAST (src);
   GstCaps *updated_caps, *fixated_caps;
 
+  self = GST_TENSOR_SRC_IIO_CAST (src);
+
   if (self->is_tensor) {
     GstTensorConfig tensor_config;
     gst_tensor_info_copy (&tensor_config.info,
index f0af5d1..158c16c 100644 (file)
@@ -1231,13 +1231,15 @@ gst_tensor_transform_arithmetic (GstTensorTransform * filter,
     int inidx = 0, outidx=0;                            \
     for(cl=0;cl<sl;cl++)                      \
       for(ci=0;ci<si;ci++)                    \
-       for(cj=0;cj<sj;cj++)                  \
-         for(ck=0;ck<sk;ck++){               \
-           outidx=si*sj*sk*cl + sj*sk*ci + sk*cj+ck; \
-           inidx = SK*SJ*SI*l + SJ*SI*k + SI*j + i; \
-           const uint8_t *_in = inptr+inidx*typesize; \
-           uint8_t *_out = outptr + outidx *typesize; \
-           nns_memcpy(_out, _in, typesize); \
+        for(cj=0;cj<sj;cj++)                  \
+          for(ck=0;ck<sk;ck++){               \
+            const uint8_t *_in; \
+            uint8_t *_out; \
+            outidx = si*sj*sk*cl + sj*sk*ci + sk*cj+ck; \
+            inidx = SK*SJ*SI*l + SJ*SI*k + SI*j + i; \
+            _in = inptr + inidx * typesize; \
+            _out = outptr + outidx *typesize; \
+            nns_memcpy(_out, _in, typesize); \
          }                                                      \
   } while(0);