[Decoder] Pull decoder subplugins out to /ext
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Wed, 30 Jan 2019 10:06:14 +0000 (19:06 +0900)
committerwooksong <wook16.song@samsung.com>
Wed, 13 Feb 2019 07:27:02 +0000 (16:27 +0900)
Decoder subplugins can now be built externally
without the need to be built along with nnstreamer.

Thus, from now on, third party developers can
write decoder subplugins without nnstreamer sources.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
14 files changed:
debian/nnstreamer-dev.install
debian/nnstreamer.install
debian/rules
ext/nnstreamer/tensor_decoder/font.h [moved from gst/nnstreamer/tensor_decoder/font.h with 100% similarity]
ext/nnstreamer/tensor_decoder/meson.build [new file with mode: 0644]
ext/nnstreamer/tensor_decoder/tensordec-boundingbox.c [moved from gst/nnstreamer/tensor_decoder/tensordec-boundingbox.c with 99% similarity]
ext/nnstreamer/tensor_decoder/tensordec-directvideo.c [moved from gst/nnstreamer/tensor_decoder/tensordec-directvideo.c with 98% similarity]
ext/nnstreamer/tensor_decoder/tensordec-imagelabel.c [moved from gst/nnstreamer/tensor_decoder/tensordec-imagelabel.c with 99% similarity]
gst/nnstreamer/nnstreamer_plugin_api.h
gst/nnstreamer/tensor_common.h
gst/nnstreamer/tensor_decoder/meson.build
gst/nnstreamer/tensor_typedef.h
meson.build
packaging/nnstreamer.spec

index a94543c..b64018c 100644 (file)
@@ -1,4 +1,3 @@
 /usr/include/nnstreamer/*.h
 /usr/lib/*/pkgconfig/*.pc
-/usr/lib/*/libnnstreamer.a
-/usr/lib/*/libnnstreamer_filter*.a
+/usr/lib/*/*.a
index b1b67c3..8da9627 100644 (file)
@@ -1,3 +1,4 @@
 /usr/lib/nnstreamer/filters/libnnstreamer_filter_*.so
+/usr/lib/nnstreamer/decoders/libnnstreamer_decoder_*.so
 /usr/lib/*/gstreamer-1.0/*.so
 /etc/nnstreamer.ini
index c5ce450..539a8f0 100755 (executable)
 ROOT_DIR:=$(shell pwd)
 export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
 export DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
+export LD_LIBRARY_PATH=${ROOT_DIR}/build/gst/nnstreamer
+export GST_PLUGIN_PATH=${ROOT_DIR}/build/gst/nnstreamer
+export NNSTREAMER_FILTERS=${ROOT_DIR}/build/ext/nnstreamer/tensor_filter
+export NNSTREAMER_DECODERS=${ROOT_DIR}/build/ext/nnstreamer/tensor_decoder
 
 ifneq ($(filter $(DEB_HOST_ARCH),amd64 arm64),)
 enable_tf=true
@@ -37,11 +41,6 @@ override_dh_auto_build:
        ninja -C build
 
 override_dh_auto_test:
-       export LD_LIBRARY_PATH=${ROOT_DIR}/build/gst/nnstreamer:${ROOT_DIR}/build/gst/nnstreamer/tensor_filter
-       export GST_PLUGIN_PATH=${ROOT_DIR}/build
-       export NNSTREAMER_FILTERS=${ROOT_DIR}/build/ext/nnstreamer/tensor_filter
-       export NNSTREAMER_DECODERS=${ROOT_DIR}/build/gst/nnstreamer/tensor_decoder
-       ls -l
        cd build && ./tests/unittest_common && cd ..
        cd build && ./tests/unittest_sink --gst-plugin-path=. && cd ..
        cd build && ./tests/unittest_plugins --gst-plugin-path=. && cd ..
diff --git a/ext/nnstreamer/tensor_decoder/meson.build b/ext/nnstreamer/tensor_decoder/meson.build
new file mode 100644 (file)
index 0000000..e4e8be3
--- /dev/null
@@ -0,0 +1,44 @@
+tensor_decoder_directvideo_shared = shared_library('nnstreamer_decoder_direct_video',
+    [ 'tensordec-directvideo.c' ],
+  dependencies: [nnstreamer_dep, glib_dep, gst_dep],
+  include_directories: nnstreamer_inc,
+  install: true,
+  install_dir: decoder_subplugin_install_dir
+)
+tensor_decoder_directvideo_static = static_library('nnstreamer_decoder_direct_video',
+    [ 'tensordec-directvideo.c' ],
+  dependencies: [nnstreamer_dep, glib_dep, gst_dep],
+  include_directories: nnstreamer_inc,
+  install: true,
+  install_dir: nnstreamer_libdir
+)
+
+tensor_decoder_imagelabel_shared = shared_library('nnstreamer_decoder_image_labeling',
+    [ 'tensordec-imagelabel.c' ],
+  dependencies: [nnstreamer_dep, glib_dep, gst_dep],
+  include_directories: nnstreamer_inc,
+  install: true,
+  install_dir: decoder_subplugin_install_dir
+)
+tensor_decoder_imagelabel_static = static_library('nnstreamer_decoder_image_labeling',
+    [ 'tensordec-imagelabel.c' ],
+  dependencies: [nnstreamer_dep, glib_dep, gst_dep],
+  include_directories: nnstreamer_inc,
+  install: true,
+  install_dir: nnstreamer_libdir
+)
+
+tensor_decoder_boundingbox_shared = shared_library('nnstreamer_decoder_bounding_boxes',
+    [ 'tensordec-boundingbox.c' ],
+  dependencies: [nnstreamer_dep, glib_dep, gst_dep],
+  include_directories: nnstreamer_inc,
+  install: true,
+  install_dir: decoder_subplugin_install_dir
+)
+tensor_decoder_boundingbox_static = static_library('nnstreamer_decoder_bounding_boxes',
+    [ 'tensordec-boundingbox.c' ],
+  dependencies: [nnstreamer_dep, glib_dep, gst_dep],
+  include_directories: nnstreamer_inc,
+  install: true,
+  install_dir: nnstreamer_libdir
+)
@@ -54,9 +54,9 @@
 #include <glib.h>
 #include <gst/gst.h>
 #include <math.h>               /* expf */
-#include <tensor_common.h>
-#include "tensordec.h"
 #include "font.h"
+#include <nnstreamer_plugin_api_decoder.h>
+#include <nnstreamer_plugin_api.h>
 
 #define BOX_SIZE                  4
 #define TFLITE_SSD_DETECTION_MAX  1917
@@ -28,8 +28,8 @@
 
 #include <string.h>
 #include <glib.h>
-#include "tensordec.h"
-#include <tensor_common.h>
+#include <gst/video/video-format.h>
+#include <nnstreamer_plugin_api_decoder.h>
 
 /** @brief tensordec-plugin's TensorDecDef callback */
 static int
@@ -35,8 +35,8 @@
 #include <string.h>
 #include <glib.h>
 #include <gst/gstinfo.h>
-#include <tensor_common.h>
-#include "tensordec.h"
+#include <nnstreamer_plugin_api_decoder.h>
+#include <nnstreamer_plugin_api.h>
 
 /** @brief Internal data structure for image labeling */
 typedef struct
index 7d496e0..60f6547 100644 (file)
@@ -240,5 +240,13 @@ get_tensor_element_count (const tensor_dim dim);
 extern tensor_type
 get_tensor_type (const gchar * typestr);
 
+/**
+ * @brief Find the index value of the given key string array
+ * @return Corresponding index
+ * @param strv Null terminated array of gchar *
+ * @param key The key string value
+ */
+extern int find_key_strv (const gchar ** strv, const gchar * key);
+
 G_END_DECLS
 #endif /* __NNS_PLUGIN_API_H__ */
index ef72583..7f6a6b9 100644 (file)
 
 G_BEGIN_DECLS
 
-#define GST_TENSOR_VIDEO_CAPS_STR \
-    GST_VIDEO_CAPS_MAKE ("{ RGB, BGR, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, GRAY8 }") \
-    ", views = (int) 1, interlace-mode = (string) progressive"
-
-#define GST_TENSOR_AUDIO_CAPS_STR \
-    GST_AUDIO_CAPS_MAKE ("{ S8, U8, S16LE, S16BE, U16LE, U16BE, S32LE, S32BE, U32LE, U32BE, F32LE, F32BE, F64LE, F64BE }") \
-    ", layout = (string) interleaved"
-
-#define GST_TENSOR_TEXT_CAPS_STR \
-    "text/x-raw, format = (string) utf8"
-
-#define GST_TENSOR_OCTET_CAPS_STR \
-    "application/octet-stream"
-
-/**
- * @brief Caps string for supported types
- * @todo Support other types
- */
-#define GST_TENSOR_MEDIA_CAPS_STR \
-    GST_TENSOR_VIDEO_CAPS_STR "; " \
-    GST_TENSOR_AUDIO_CAPS_STR "; " \
-    GST_TENSOR_TEXT_CAPS_STR "; " \
-    GST_TENSOR_OCTET_CAPS_STR
-
-#define GST_TENSOR_TYPE_ALL "{ float32, float64, int64, uint64, int32, uint32, int16, uint16, int8, uint8 }"
-
 /**
  * @brief time synchronization options
  */
@@ -194,14 +168,6 @@ extern GstCaps *
 gst_tensors_caps_from_config (const GstTensorsConfig * config);
 
 /**
- * @brief Find the index value of the given key string array
- * @return Corresponding index
- * @param strv Null terminated array of gchar *
- * @param key The key string value
- */
-extern int find_key_strv (const gchar ** strv, const gchar * key);
-
-/**
  * @brief A callback for typefind, trying to find whether a file is other/tensors or not.
  * For the concrete definition of headers, please look at the wiki page of nnstreamer:
  * https://github.com/nnsuite/nnstreamer/wiki/Design-External-Save-Format-for-other-tensor-and-other-tensors-Stream-for-TypeFind
index ac1120d..8f4c22c 100644 (file)
@@ -1,8 +1,5 @@
 tensor_decoder_sources = [
   'tensordec.c',
-  'tensordec-directvideo.c',
-  'tensordec-imagelabel.c',
-  'tensordec-boundingbox.c'
 ]
 
 foreach s : tensor_decoder_sources
index 762a039..2e0f913 100644 (file)
      * "dimensions = (string) dim1:dim2:dim3:dim4, dim1:dim2:dim3:dim4"
      */
 
+#define GST_TENSOR_VIDEO_CAPS_STR \
+    GST_VIDEO_CAPS_MAKE ("{ RGB, BGR, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, GRAY8 }") \
+    ", views = (int) 1, interlace-mode = (string) progressive"
+
+#define GST_TENSOR_AUDIO_CAPS_STR \
+    GST_AUDIO_CAPS_MAKE ("{ S8, U8, S16LE, S16BE, U16LE, U16BE, S32LE, S32BE, U32LE, U32BE, F32LE, F32BE, F64LE, F64BE }") \
+    ", layout = (string) interleaved"
+
+#define GST_TENSOR_TEXT_CAPS_STR \
+    "text/x-raw, format = (string) utf8"
+
+#define GST_TENSOR_OCTET_CAPS_STR \
+    "application/octet-stream"
+
+/**
+ * @brief Caps string for supported types
+ * @todo Support other types
+ */
+#define GST_TENSOR_MEDIA_CAPS_STR \
+    GST_TENSOR_VIDEO_CAPS_STR "; " \
+    GST_TENSOR_AUDIO_CAPS_STR "; " \
+    GST_TENSOR_TEXT_CAPS_STR "; " \
+    GST_TENSOR_OCTET_CAPS_STR
+
+#define GST_TENSOR_TYPE_ALL "{ float32, float64, int64, uint64, int32, uint32, int16, uint16, int8, uint8 }"
+
 /**
  * @brief Possible data element types of other/tensor.
  */
index 77d9a0a..3e73468 100644 (file)
@@ -108,6 +108,7 @@ subdir('gst')
 
 # Build ext subplugins (filter-subplugins)
 subdir('ext/nnstreamer/tensor_filter')
+subdir('ext/nnstreamer/tensor_decoder')
 
 # Build nnstreamer examples
 if get_option('enable-test') or get_option('install-example')
index 320181f..ccb0c8f 100644 (file)
@@ -104,7 +104,10 @@ ninja -C build %{?_smp_mflags}
 
 %if 0%{?unit_test}
     pushd build
-    export LD_LIBRARY_PATH=$(pwd)/gst/nnstreamer:$(pwd)/gst/nnstreamer/tensor_filter
+    export LD_LIBRARY_PATH=$(pwd)/gst/nnstreamer
+    export GST_PLUGIN_PATH=$(pwd)/gst/nnstreamer
+    export NNSTREAMER_FILTERS=$(pwd)/ext/nnstreamer/tensor_filter
+    export NNSTREAMER_DECODERS=$(pwd)/ext/nnstreamer/tensor_decoder
     %ifarch x86_64 aarch64
     export TEST_TENSORFLOW=1
     %endif
@@ -112,7 +115,6 @@ ninja -C build %{?_smp_mflags}
     ./tests/unittest_sink --gst-plugin-path=.
     ./tests/unittest_plugins --gst-plugin-path=.
     popd
-    export NNSTREAMER_FILTERS=$(pwd)/build/ext/nnstreamer/tensor_filter
     pushd tests
     ssat -n
     popd
@@ -172,6 +174,7 @@ popd
 %defattr(-,root,root,-)
 %license LICENSE
 %{_prefix}/lib/nnstreamer/filters/libnnstreamer_filter_*.so
+%{_prefix}/lib/nnstreamer/decoders/libnnstreamer_decoder_*.so
 %{gstlibdir}/*.so
 %{_sysconfdir}/nnstreamer.ini