[TensorDec] Add initalize function for image labeling data of tensor decoder
authorjinhyuck-park <jinhyuck83.park@samsung.com>
Fri, 14 Sep 2018 08:00:59 +0000 (17:00 +0900)
committerMyungJoo Ham <myungjoo.ham@gmail.com>
Mon, 17 Sep 2018 13:02:22 +0000 (22:02 +0900)
Add function for image labeling data when initialize tensor decoder

Signed-off-by: jinhyuck-park <jinhyuck83.park@samsung.com>
gst/tensor_decoder/tensordec.c
gst/tensor_decoder/tensordec.h

index e5ae4d1..6da1926 100644 (file)
@@ -103,26 +103,6 @@ enum
 };
 
 /**
- * @brief Data structure for image labeling info.
- */
-typedef struct
-{
-  gchar *label_path; /**< label file path */
-  GList *labels; /**< list of loaded labels */
-  guint total_labels; /**< count of labels */
-} Mode_image_labeling;
-
-/**
- * @brief Data structure for tensor decoder image labeling mode.
- */
-typedef struct
-{
-  gint current_label_index; /**< current label index */
-  gint new_label_index; /**< new label index */
-  Mode_image_labeling image_labeling_info; /**< tflite image labeling mode info */
-} TensorDec_Mode_image_Label;
-
-/**
  * @brief Default output type.
  */
 #define DEFAULT_OUTPUT_TYPE OUTPUT_VIDEO
@@ -173,6 +153,20 @@ static gboolean gst_tensordec_transform_size (GstBaseTransform * trans,
     GstCaps * othercaps, gsize * othersize);
 
 /**
+ * @brief initialize data in tensor decoder image labeling info structure.
+ */
+static void
+gst_tensordec_image_labeling_init (TensorDec_Mode_image_Label *
+    mode_image_label)
+{
+  mode_image_label->image_labeling_info.label_path = NULL;
+  mode_image_label->image_labeling_info.labels = NULL;
+  mode_image_label->image_labeling_info.total_labels = 0;
+  mode_image_label->current_label_index = 0;
+  mode_image_label->new_label_index = 0;
+}
+
+/**
  * @brief Get video caps from tensor config
  * @param self "this" pointer
  * @param config tensor config info
@@ -452,6 +446,7 @@ gst_tensordec_init (GstTensorDec * self)
   self->output_type = OUTPUT_VIDEO;
   self->mode = Mode[0];
   gst_tensor_config_init (&self->tensor_config);
+  gst_tensordec_image_labeling_init (&self->tensordec_mode_image_label);
 }
 
 /**
index 092a6ff..05265d9 100644 (file)
@@ -50,6 +50,26 @@ typedef struct _GstTensorDec GstTensorDec;
 typedef struct _GstTensorDecClass GstTensorDecClass;
 
 /**
+ * @brief Data structure for image labeling info.
+ */
+typedef struct
+{
+  gchar *label_path; /**< label file path */
+  GList *labels; /**< list of loaded labels */
+  guint total_labels; /**< count of labels */
+} Mode_image_labeling;
+
+/**
+ * @brief Data structure for tensor decoder image labeling mode.
+ */
+typedef struct
+{
+  gint current_label_index; /**< current label index */
+  gint new_label_index; /**< new label index */
+  Mode_image_labeling image_labeling_info; /**< tflite image labeling mode info */
+} TensorDec_Mode_image_Label;
+
+/**
  * @brief Internal data structure for tensordec instances.
  */
 struct _GstTensorDec
@@ -66,6 +86,7 @@ struct _GstTensorDec
   /** For Tensor */
   gboolean configured; /**< TRUE if already successfully configured tensor metadata */
   GstTensorConfig tensor_config; /**< configured tensor info */
+  TensorDec_Mode_image_Label tensordec_mode_image_label;/** tensor decoder image labeling mode info */
 };
 
 /**