From 76cafca59b692d19f2c8bb95a1c3545f0fca0e55 Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Thu, 28 Mar 2019 11:19:03 +0900 Subject: [PATCH] Remove tensor_save/load. It's unimplemented skeleton abandoned. It has been abandoned for too long time that has incorrect skeleton. To promote better design, remove the whole skeleton. Signed-off-by: MyungJoo Ham --- gst/nnstreamer/meson.build | 1 - gst/nnstreamer/nnstreamer.c | 4 - gst/nnstreamer/tensor_saveload/README.md | 2 - gst/nnstreamer/tensor_saveload/meson.build | 7 - gst/nnstreamer/tensor_saveload/tensor_load.c | 324 --------------------------- gst/nnstreamer/tensor_saveload/tensor_load.h | 89 -------- jni/Android-nnstreamer.mk | 2 - 7 files changed, 429 deletions(-) delete mode 100644 gst/nnstreamer/tensor_saveload/README.md delete mode 100644 gst/nnstreamer/tensor_saveload/meson.build delete mode 100644 gst/nnstreamer/tensor_saveload/tensor_load.c delete mode 100644 gst/nnstreamer/tensor_saveload/tensor_load.h diff --git a/gst/nnstreamer/meson.build b/gst/nnstreamer/meson.build index d5fd0eb..5b436a7 100644 --- a/gst/nnstreamer/meson.build +++ b/gst/nnstreamer/meson.build @@ -56,7 +56,6 @@ nnst_plugins = [ 'tensor_demux', 'tensor_merge', 'tensor_mux', - 'tensor_saveload', 'tensor_sink', 'tensor_source', 'tensor_split', diff --git a/gst/nnstreamer/nnstreamer.c b/gst/nnstreamer/nnstreamer.c index 4a6e73e..2157d55 100644 --- a/gst/nnstreamer/nnstreamer.c +++ b/gst/nnstreamer/nnstreamer.c @@ -61,8 +61,6 @@ NNSTREAMER_PLUGIN (tensor_decoder); NNSTREAMER_PLUGIN (tensor_demux); NNSTREAMER_PLUGIN (tensor_merge); NNSTREAMER_PLUGIN (tensor_mux); -NNSTREAMER_PLUGIN (tensor_load); -/* NNSTREAMER_PLUGIN (tensor_save); */ NNSTREAMER_PLUGIN (tensor_sink); NNSTREAMER_PLUGIN (tensor_src_iio); NNSTREAMER_PLUGIN (tensor_split); @@ -94,8 +92,6 @@ gst_nnstreamer_init (GstPlugin * plugin) NNSTREAMER_INIT (tensor_demux, plugin); NNSTREAMER_INIT (tensor_merge, plugin); NNSTREAMER_INIT (tensor_mux, plugin); - NNSTREAMER_INIT (tensor_load, plugin); - /* NNSTREAMER_INIT (tensor_save, plugin); */ NNSTREAMER_INIT (tensor_sink, plugin); NNSTREAMER_INIT (tensor_src_iio, plugin); NNSTREAMER_INIT (tensor_split, plugin); diff --git a/gst/nnstreamer/tensor_saveload/README.md b/gst/nnstreamer/tensor_saveload/README.md deleted file mode 100644 index 705e9cc..0000000 --- a/gst/nnstreamer/tensor_saveload/README.md +++ /dev/null @@ -1,2 +0,0 @@ -- tensor\_load: other/tensorsave to other/tensors or other/tensor -- tensor\_save: other/tensors or other/tensor to other/tensorsave diff --git a/gst/nnstreamer/tensor_saveload/meson.build b/gst/nnstreamer/tensor_saveload/meson.build deleted file mode 100644 index ca8b276..0000000 --- a/gst/nnstreamer/tensor_saveload/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -tensor_saveload_sources = [ - 'tensor_load.c' -] - -foreach s : tensor_saveload_sources - nnstreamer_sources += join_paths(meson.current_source_dir(), s) -endforeach diff --git a/gst/nnstreamer/tensor_saveload/tensor_load.c b/gst/nnstreamer/tensor_saveload/tensor_load.c deleted file mode 100644 index 9b92449..0000000 --- a/gst/nnstreamer/tensor_saveload/tensor_load.c +++ /dev/null @@ -1,324 +0,0 @@ -/** - * GStreamer - * Copyright (C) 2005 Thomas Vander Stichele - * Copyright (C) 2005 Ronald S. Bultje - * Copyright (C) 2018 MyungJoo Ham - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - */ -/** - * @file tensor_load.c - * @date 24 Jul 2018 - * @brief GStreamer plugin to convert other/tensorsave to other/tensor(s) - * @see http://github.com/nnsuite/nnstreamer - * @author MyungJoo Ham - * @bug No known bugs except for NYI items - * - */ -/** - * SECTION:element-tensor_load - * - * Decode other/tensorsave and provide the raw data represented in - * other/tensor (if # tensors = 1) or other/tensors (if # tensors > 1). - * - * @todo NYI: this code supports # tensors = 1 case only! - * - * - * Example launch line - * |[ - * gst-launch -v -m filesrc location="test.tnsr" ! tensor_load ! tensor_filter ... ! tensor_sink ... - * ]| - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include - -#include "tensor_load.h" - -GST_DEBUG_CATEGORY_STATIC (gst_tensor_load_debug); -#define GST_CAT_DEFAULT gst_tensor_load_debug - -/* Filter signals and args */ -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -enum -{ - PROP_0, - PROP_SILENT, -}; - -/** - * the capabilities of the inputs - * - * In v0.0.1, this is "bitmap" image stream - */ -static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("other/tensorsave") - ); - -/** - * @brief The capabilities of the outputs - */ -static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - /* This can be both other/tensor and other/tensors */ - -#define gst_tensor_load_parent_class parent_class -G_DEFINE_TYPE (GstTensor_Load, gst_tensor_load, GST_TYPE_BASE_TRANSFORM); - -static void gst_tensor_load_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_tensor_load_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -/* GstBaseTransformer vmethod implementations */ -static GstFlowReturn gst_tensor_load_transform (GstBaseTransform * trans, - GstBuffer * inbuf, GstBuffer * outbuf); -static GstFlowReturn gst_tensor_load_transform_ip (GstBaseTransform * - trans, GstBuffer * buf); -static GstCaps *gst_tensor_load_transform_caps (GstBaseTransform * trans, - GstPadDirection direction, GstCaps * caps, GstCaps * filter); -static GstCaps *gst_tensor_load_fixate_caps (GstBaseTransform * trans, - GstPadDirection direction, GstCaps * caps, GstCaps * othercaps); -static gboolean gst_tensor_load_set_caps (GstBaseTransform * trans, - GstCaps * incaps, GstCaps * outcaps); -static gboolean gst_tensor_load_transform_size (GstBaseTransform * trans, - GstPadDirection direction, GstCaps * caps, gsize size, - GstCaps * othercaps, gsize * othersize); -/* GObject vmethod implementations */ - -/** - * @brief initialize the tensor_load's class - */ -static void -gst_tensor_load_class_init (GstTensor_LoadClass * g_class) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - GstBaseTransformClass *trans_class; - GstTensor_LoadClass *klass; - - klass = (GstTensor_LoadClass *) g_class; - trans_class = (GstBaseTransformClass *) klass; - gstelement_class = (GstElementClass *) trans_class; - gobject_class = (GObjectClass *) gstelement_class; - - gobject_class->set_property = gst_tensor_load_set_property; - gobject_class->get_property = gst_tensor_load_get_property; - - g_object_class_install_property (gobject_class, PROP_SILENT, - g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?", - FALSE, G_PARAM_READWRITE)); - - gst_element_class_set_details_simple (gstelement_class, - "Tensor_Load", - "Convert other/tensorsave to other/tensors or other/tensor", - "Convert other/tensorsave to other/tensors or other/tensor if # tensors is 1", - "MyungJoo Ham "); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&src_factory)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sink_factory)); - /* Refer: https://gstreamer.freedesktop.org/documentation/design/element-transform.html */ - trans_class->passthrough_on_same_caps = FALSE; - - /* Processing units */ - trans_class->transform = GST_DEBUG_FUNCPTR (gst_tensor_load_transform); - trans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_tensor_load_transform_ip); - - /* Negotiation units */ - trans_class->transform_caps = - GST_DEBUG_FUNCPTR (gst_tensor_load_transform_caps); - trans_class->fixate_caps = GST_DEBUG_FUNCPTR (gst_tensor_load_fixate_caps); - trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_tensor_load_set_caps); - - /* Allocation units */ - trans_class->transform_size = - GST_DEBUG_FUNCPTR (gst_tensor_load_transform_size); -} - -/** - * @brief initialize the new element (G_DEFINE_TYPE requires this) - * instantiate pads and add them to element - * set pad calback functions - * initialize instance structure - */ -static void -gst_tensor_load_init (GstTensor_Load * filter) -{ - filter->silent = TRUE; - - filter->num_tensors = 0; - filter->dims = NULL; - filter->types = NULL; - filter->ranks = NULL; - filter->framerate_numerator = -1; - filter->framerate_denominator = -1; - filter->frameSize = 0; -} - -/** - * @brief Set property (gst element vmethod) - */ -static void -gst_tensor_load_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstTensor_Load *filter = GST_TENSOR_LOAD (object); - - switch (prop_id) { - case PROP_SILENT: - filter->silent = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -/** - * @brief Get property (gst element vmethod) - */ -static void -gst_tensor_load_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec) -{ - GstTensor_Load *filter = GST_TENSOR_LOAD (object); - - switch (prop_id) { - case PROP_SILENT: - g_value_set_boolean (value, filter->silent); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -/****************************************************************** - * GstElement vmethod implementations - */ - -#define return_false_if_fail(x) \ - ret = (x); \ - if (!ret) \ - return FALSE; \ - ; - -/** - * @brief non-ip transform. required vmethod for BaseTransform class. - */ -static GstFlowReturn -gst_tensor_load_transform (GstBaseTransform * trans, - GstBuffer * inbuf, GstBuffer * outbuf) -{ - /** @todo NYI */ - return GST_FLOW_NOT_SUPPORTED; -} - -/** - * @brief in-place transform. required vmethod for BaseTransform class. - */ -static GstFlowReturn -gst_tensor_load_transform_ip (GstBaseTransform * trans, GstBuffer * buf) -{ - /** @todo NYI */ - return GST_FLOW_NOT_SUPPORTED; -} - -/** - * @brief configure srcpad cap from "proposed" cap. (required vmethod for BaseTransform) - * - * @param trans ("this" pointer) - * @param direction (why do we need this?) - * @param caps sinkpad cap - * @param filter this element's cap (don't know specifically.) - */ -static GstCaps * -gst_tensor_load_transform_caps (GstBaseTransform * trans, - GstPadDirection direction, GstCaps * caps, GstCaps * filter) -{ - /** @todo NYI */ - return NULL; -} - -/** - * @brief fixate caps. required vmethod of BaseTransform - */ -static GstCaps * -gst_tensor_load_fixate_caps (GstBaseTransform * trans, - GstPadDirection direction, GstCaps * caps, GstCaps * othercaps) -{ - /** @todo NYI */ - return NULL; -} - -/** - * @brief set caps. required vmethod of BaseTransform - */ -static gboolean -gst_tensor_load_set_caps (GstBaseTransform * trans, - GstCaps * incaps, GstCaps * outcaps) -{ - /** @todo NYI */ - return FALSE; -} - -/** - * @brief Tell the framework the required size of buffer based on the info of the other side pad. optional vmethod of BaseTransform - * - * We cannot directly get the value from size value, we need to review the pad-caps. - * This is called when non-ip mode is used. - */ -static gboolean -gst_tensor_load_transform_size (GstBaseTransform * trans, - GstPadDirection direction, GstCaps * caps, gsize size, - GstCaps * othercaps, gsize * othersize) -{ - /** @todo NYI */ - return FALSE; -} - -/** - * @brief entry point to initialize the plug-in - * initialize the plug-in itself - * register the element factories and other features - */ -NNSTREAMER_PLUGIN_INIT (tensor_load) -{ - /** - * debug category for fltering log messages - * - * exchange the string 'Template tensor_load' with your description - */ - GST_DEBUG_CATEGORY_INIT (gst_tensor_load_debug, "tensor_load", - 0, "Template tensor_load"); - - return gst_element_register (plugin, "tensor_load", - GST_RANK_NONE, GST_TYPE_TENSOR_LOAD); -} diff --git a/gst/nnstreamer/tensor_saveload/tensor_load.h b/gst/nnstreamer/tensor_saveload/tensor_load.h deleted file mode 100644 index 5bc6c5b..0000000 --- a/gst/nnstreamer/tensor_saveload/tensor_load.h +++ /dev/null @@ -1,89 +0,0 @@ -/** - * GStreamer - * Copyright (C) 2005 Thomas Vander Stichele - * Copyright (C) 2005 Ronald S. Bultje - * Copyright (C) 2018 MyungJoo Ham - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - */ -/** - * @file tensor_load.c - * @date 24 Jul 2018 - * @brief GStreamer plugin to convert other/tensorsave to other/tensor(s) - * @see http://github.com/nnsuite/nnstreamer - * @author MyungJoo Ham - * @bug No known bugs except for NYI items - * - */ - -#ifndef __GST_TENSOR_LOAD_H__ -#define __GST_TENSOR_LOAD_H__ - -#include -#include -#include - -G_BEGIN_DECLS -/* #defines don't like whitespacey bits */ -#define GST_TYPE_TENSOR_LOAD \ - (gst_tensor_load_get_type()) -#define GST_TENSOR_LOAD(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TENSOR_LOAD,GstTensor_Load)) -#define GST_TENSOR_LOAD_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TENSOR_LOAD,GstTensor_LoadClass)) -#define GST_IS_TENSOR_LOAD(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TENSOR_LOAD)) -#define GST_IS_TENSOR_LOAD_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TENSOR_LOAD)) -#define GST_TENSOR_LOAD_CAST(obj) ((GstTensor_Load *)(obj)) -typedef struct _GstTensor_Load GstTensor_Load; - -typedef struct _GstTensor_LoadClass GstTensor_LoadClass; - -/** - * @brief Internal data structure for tensor_load instances. - */ -struct _GstTensor_Load -{ - GstBaseTransform element; /**< This is the parent object */ - - /* For Tensor */ - gboolean silent; /**< True if logging is minimized */ - - guint num_tensors; /**< Number of tensors in each frame */ - tensor_dim *dims; /**< Array of tensor_dim, [num_tensors] */ - tensor_type *types; /**< Array of tensor_type, [num_tensors] */ - gint *ranks; /**< Array of rank, [num_tensors] */ - gint framerate_numerator; /**< framerate is in fraction, which is numerator/denominator */ - gint framerate_denominator; /**< framerate is in fraction, which is numerator/denominator */ - gsize frameSize; /**< Size of a frame in # bytes */ -}; - -/** - * @brief GstTensor_LoadClass inherits GstBaseTransformClass. - * - * Referring another child (sibiling), GstVideoFilter (abstract class) and - * its child (concrete class) GstVideoLoad. - * Note that GstTensor_LoadClass is a concrete class; thus we need to look at both. - */ -struct _GstTensor_LoadClass -{ - GstBaseTransformClass parent_class; /**< Inherits GstBaseTransformClass */ -}; - -/** - * @brief Get Type function required for gst elements - */ -GType gst_tensor_load_get_type (void); - -G_END_DECLS -#endif /* __GST_TENSOR_LOAD_H__ */ diff --git a/jni/Android-nnstreamer.mk b/jni/Android-nnstreamer.mk index 611f67e..b1c145b 100644 --- a/jni/Android-nnstreamer.mk +++ b/jni/Android-nnstreamer.mk @@ -123,7 +123,6 @@ LOCAL_SRC_FILES := $(NNSTREAMER_GST_HOME)/nnstreamer.c \ $(NNSTREAMER_GST_HOME)/tensor_mux/gsttensormux.c \ $(NNSTREAMER_GST_HOME)/tensor_reposink/tensor_reposink.c \ $(NNSTREAMER_GST_HOME)/tensor_reposrc/tensor_reposrc.c \ - $(NNSTREAMER_GST_HOME)/tensor_saveload/tensor_load.c \ $(NNSTREAMER_GST_HOME)/tensor_sink/tensor_sink.c \ $(NNSTREAMER_GST_HOME)/tensor_source/tensor_src_iio.c \ $(NNSTREAMER_GST_HOME)/tensor_split/gsttensorsplit.c \ @@ -139,7 +138,6 @@ LOCAL_C_INCLUDES := $(NNSTREAMER_GST_HOME)/ \ $(NNSTREAMER_GST_HOME)/tensor_mux/ \ $(NNSTREAMER_GST_HOME)/tensor_reposink/ \ $(NNSTREAMER_GST_HOME)/tensor_reposrc/ \ - $(NNSTREAMER_GST_HOME)/tensor_saveload/ \ $(NNSTREAMER_GST_HOME)/tensor_sink/ \ $(NNSTREAMER_GST_HOME)/tensor_source/ \ $(NNSTREAMER_GST_HOME)/tensor_split/ \ -- 2.7.4