[Converter] code clean
authorJaeyun Jung <jy1210.jung@samsung.com>
Sat, 8 Dec 2018 02:05:47 +0000 (11:05 +0900)
committerMyungJoo Ham <myungjoo.ham@gmail.com>
Sat, 8 Dec 2018 09:00:48 +0000 (18:00 +0900)
1. move function video-stride to converter.
2. move mainpage tag to nnstreamer.c.
3. in nnstreamer.c, include config header for orc feature.

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
gst/nnstreamer/nnstreamer.c
gst/nnstreamer/tensor_common.c
gst/nnstreamer/tensor_common.h
gst/tensor_converter/tensor_converter.c

index a4ea767..86a178d 100644 (file)
  */
 
 /**
+ *  @mainpage nnstreamer
+ *  @section  intro         Introduction
+ *  - Introduction      :   Neural Network Streamer for AI Projects
+ *  @section   Program      Program Name
+ *  - Program Name      :   nnstreamer
+ *  - Program Details   :   It provides a neural network framework connectivities (e.g., tensorflow, caffe) for gstreamer streams.
+ *    Efficient Streaming for AI Projects: Neural network models wanted to use efficient and flexible streaming management as well.
+ *    Intelligent Media Filters!: Use a neural network model as a media filter / converter.
+ *    Composite Models!: Allow to use multiple neural network models in a single stream instance.
+ *    Multi Model Intelligence!: Allow to use multiple sources for neural network models.
+ *  @section  INOUTPUT      Input/output data
+ *  - INPUT             :   None
+ *  - OUTPUT            :   None
+ *  @section  CREATEINFO    Code information
+ *  - Initial date      :   2018/06/14
+ *  - Version           :   0.1
+ */
+
+/**
  * @file       nnstreamer.c
  * @date       11 Oct 2018
  * @brief      Registers all nnstreamer plugins for gstreamer so that we can have a single big binary
  * @bug                No known bugs except for NYI items
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <gst/gst.h>
 #include <gst/gstplugin.h>
 
index f075f0d..6717924 100644 (file)
@@ -896,30 +896,6 @@ gst_tensors_caps_from_config (const GstTensorsConfig * config)
 }
 
 /**
- * @brief Determine if we need zero-padding
- * @return 1 if we need to add (or remove) stride per row from the stream data. 0 otherwise.
- */
-gint
-gst_tensor_video_stride_padding_per_row (GstVideoFormat format, gint width)
-{
-  /** @todo The actual list is much longer. fill them (read https://gstreamer.freedesktop.org/documentation/design/mediatype-video-raw.html ) */
-  switch (format) {
-    case GST_VIDEO_FORMAT_GRAY8:
-    case GST_VIDEO_FORMAT_RGB:
-    case GST_VIDEO_FORMAT_BGR:
-    case GST_VIDEO_FORMAT_I420:
-      if (width % 4) {
-        return 1;
-      }
-      break;
-    default:
-      break;
-  }
-
-  return 0;
-}
-
-/**
  * @brief Get tensor_type from string tensor_type input
  * @return Corresponding tensor_type. _NNS_END if unrecognized value is there.
  * @param typestr The string type name, supposed to be one of tensor_element_typename[]
index 47ac875..9ab6e44 100644 (file)
@@ -364,13 +364,6 @@ extern GstCaps *
 gst_tensors_caps_from_config (const GstTensorsConfig * config);
 
 /**
- * @brief Determine if we need zero-padding
- * @return 1 if we need to add (or remove) stride per row from the stream data. 0 otherwise.
- */
-extern gint
-gst_tensor_video_stride_padding_per_row (GstVideoFormat format, gint width);
-
-/**
  * @brief Get tensor_type from string tensor_type input
  * @return Corresponding tensor_type. _NNS_END if unrecognized value is there.
  * @param typestr The string type name, supposed to be one of tensor_element_typename[]
index 95e8bb6..a997f60 100644 (file)
  */
 
 /**
- *  @mainpage nnstreamer
- *  @section  intro         Introduction
- *  - Introduction      :   Neural Network Streamer for AI Projects
- *  @section   Program      Program Name
- *  - Program Name      :   nnstreamer
- *  - Program Details   :   It provides a neural network framework connectivities (e.g., tensorflow, caffe) for gstreamer streams.
- *    Efficient Streaming for AI Projects: Neural network models wanted to use efficient and flexible streaming management as well.
- *    Intelligent Media Filters!: Use a neural network model as a media filter / converter.
- *    Composite Models!: Allow to use multiple neural network models in a single stream instance.
- *    Multi Model Intelligence!: Allow to use multiple sources for neural network models.
- *  @section  INOUTPUT      Input/output data
- *  - INPUT             :   None
- *  - OUTPUT            :   None
- *  @section  CREATEINFO    Code information
- *  - Initial date      :   2018/06/14
- *  - Version           :   0.1
- */
-
-/**
  * SECTION:element-tensor_converter
  *
  * A filter that converts media stream to tensor stream for NN frameworks.
@@ -879,6 +860,33 @@ gst_tensor_converter_reset (GstTensorConverter * self)
 }
 
 /**
+ * @brief Determine if we need zero-padding
+ * @return TRUE if we need to add (or remove) stride per row from the stream data.
+ */
+static gboolean
+gst_tensor_converter_video_stride (GstVideoFormat format, gint width)
+{
+  /**
+   * @todo The actual list is much longer, fill them.
+   * (read https://gstreamer.freedesktop.org/documentation/design/mediatype-video-raw.html)
+   */
+  switch (format) {
+    case GST_VIDEO_FORMAT_GRAY8:
+    case GST_VIDEO_FORMAT_RGB:
+    case GST_VIDEO_FORMAT_BGR:
+    case GST_VIDEO_FORMAT_I420:
+      if (width % 4) {
+        return TRUE;
+      }
+      break;
+    default:
+      break;
+  }
+
+  return FALSE;
+}
+
+/**
  * @brief Get supported format list.
  */
 static void
@@ -1117,14 +1125,15 @@ gst_tensor_converter_parse_caps (GstTensorConverter * self,
        * Emit Warning if RSTRIDE = RU4 (3BPP) && Width % 4 > 0
        * @todo Add more conditions!
        */
-      if (gst_tensor_video_stride_padding_per_row (GST_VIDEO_INFO_FORMAT
-              (&info), GST_VIDEO_INFO_WIDTH (&info))) {
+      if (gst_tensor_converter_video_stride (GST_VIDEO_INFO_FORMAT (&info),
+              GST_VIDEO_INFO_WIDTH (&info))) {
         self->remove_padding = TRUE;
         silent_debug ("Set flag to remove padding, width = %d",
             GST_VIDEO_INFO_WIDTH (&info));
 
         GST_WARNING_OBJECT (self,
-            "\nYOUR STREAM CONFIGURATION INCURS PERFORMANCE DETERIORATION!\nPlease use 4 x n as image width for inputs.\n");
+            "\nYOUR STREAM CONFIGURATION INCURS PERFORMANCE DETERIORATION!\n"
+            "Please use 4 x n as image width for inputs.\n");
       }
 
       frames_dim = 3;