[TENSORS] No need the tests/nnstreamer_tensors
authorjijoong.moon <jijoong.moon@samsung.com>
Fri, 29 Mar 2019 04:36:15 +0000 (13:36 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Tue, 2 Apr 2019 03:59:27 +0000 (12:59 +0900)
Test case, nnstreamer_tensors are not needed anymore. It was written
just for the temperal check of possibility of meta in the buffer.

**Self evaluation:**
1. Build test:  [X]Passed [ ]Failed [ ]Skipped
2. Run test:  [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
tests/meson.build
tests/nnstreamer_tensors/generateGoldenTestResult.py [deleted file]
tests/nnstreamer_tensors/runTest.sh [deleted file]
tests/nnstreamer_tensors/tensors_test/gsttensorscheck.c [deleted file]
tests/nnstreamer_tensors/tensors_test/gsttensorscheck.h [deleted file]
tests/nnstreamer_tensors/tensors_test/gsttesttensors.c [deleted file]
tests/nnstreamer_tensors/tensors_test/gsttesttensors.h [deleted file]

index ea1a354..0490806 100644 (file)
@@ -1,16 +1,3 @@
-# These plugins are used for multi-tensors test in nnstreamer_tensors.
-library('testtensors',
-  join_paths('nnstreamer_tensors', 'tensors_test', 'gsttesttensors.c'),
-  dependencies: [gst_dep, nnstreamer_dep],
-  install: false
-)
-
-library('tensorscheck',
-  join_paths('nnstreamer_tensors', 'tensors_test', 'gsttensorscheck.c'),
-  dependencies: [gst_dep, nnstreamer_dep],
-  install: false
-)
-
 # These custom filters are used in unittest_sink.
 library('nnscustom_framecounter',
   join_paths('nnstreamer_sink', 'nnscustom_framecounter.c'),
diff --git a/tests/nnstreamer_tensors/generateGoldenTestResult.py b/tests/nnstreamer_tensors/generateGoldenTestResult.py
deleted file mode 100755 (executable)
index e896ee5..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env python
-
-##
-# Copyright (C) 2018 Samsung Electronics
-# License: LGPL-2.1
-#
-# @file generateGoldenTestResult.py
-# @brief Generate golden test results for test cases
-# @author MyungJoo Ham <myungjoo.ham@samsung.com>
-
-from __future__ import print_function
-
-import sys
-import os
-sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
-import gen24bBMP as bmp
-
-
-bmp.write('testcase01_RGB_640x480.golden', bmp.gen_BMP_random('RGB', 640, 480, 'testcase01')[0])
diff --git a/tests/nnstreamer_tensors/runTest.sh b/tests/nnstreamer_tensors/runTest.sh
deleted file mode 100644 (file)
index 4886c34..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-##
-## @file runTest.sh
-## @author MyungJoo Ham <myungjoo.ham@gmail.com>
-## @date Nov 01 2018
-## @brief SSAT Test Cases for NNStreamer
-##
-if [[ "$SSATAPILOADED" != "1" ]]
-then
-       SILENT=0
-       INDEPENDENT=1
-       search="ssat-api.sh"
-       source $search
-       printf "${Blue}Independent Mode${NC}
-"
-fi
-
-# This is compatible with SSAT (https://github.com/myungjoo/SSAT)
-testInit $1
-
-PATH_TO_PLUGIN="../../build"
-
-if [ "$SKIPGEN" == "YES" ]
-then
-  echo "Test Case Generation Skipped"
-else
-  echo "Test Case Generation Started"
-  python generateGoldenTestResult.py
-fi
-convertBMP2PNG
-
-gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=testcase01_RGB_640x480.png ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,width=640,height=480,framerate=0/1 ! tensor_converter ! testtensors ! tensorscheck ! filesink location=\"testcase01_RGB_640x480.nonip.log\" sync=true" 1 0 0 $PERFORMANCE
-
-callCompareTest testcase01_RGB_640x480.golden testcase01_RGB_640x480.nonip.log 1 "Compare 1" 1 0
-
-report
diff --git a/tests/nnstreamer_tensors/tensors_test/gsttensorscheck.c b/tests/nnstreamer_tensors/tensors_test/gsttensorscheck.c
deleted file mode 100644 (file)
index a2fbba6..0000000
+++ /dev/null
@@ -1,370 +0,0 @@
-/**
- * GStreamer
- * Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
- * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
- * Copyright (C) 2018 Jijoong Moon <jijoong.moon@samsung.com>
- *
- * 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       gsttensorscheck.c
- * @date       26 June 2018
- * @brief      test element to check tensors
- * @see                https://github.com/nnsuite/nnstreamer
- * @author     Jijoong Moon <jijoong.moon@samsung.com>
- * @bug                No known bugs except for NYI items
- */
-
-/**
- * SECTION:element-tensorscheck
- *
- * This is the element to test tensors only.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch -v -m fakesrc ! tensorscheck ! fakesink silent=TRUE
- * ]|
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gsttensorscheck.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_tensorscheck_debug);
-#define GST_CAT_DEFAULT gst_tensorscheck_debug
-
-/** Properties */
-enum
-{
-  PROP_0,
-  PROP_PASSTHROUGH,
-  PROP_SILENT
-};
-
-/**
- * the capabilities of the inputs and outputs.
- * describe the real formats here.
- */
-static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
-    GST_PAD_SINK,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_TENSORS_CAP_DEFAULT)
-    );
-
-static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
-    GST_PAD_SRC,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_TENSOR_CAP_DEFAULT)
-    );
-
-#define gst_tensorscheck_parent_class parent_class
-G_DEFINE_TYPE (Gsttensorscheck, gst_tensorscheck, GST_TYPE_ELEMENT);
-
-/** GObject vmethod implementations */
-static void gst_tensorscheck_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec);
-static void gst_tensorscheck_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec);
-
-static gboolean gst_tensorscheck_sink_event (GstPad * pad, GstObject * parent,
-    GstEvent * event);
-static GstFlowReturn gst_tensorscheck_chain (GstPad * pad, GstObject * parent,
-    GstBuffer * buf);
-
-/**
- * @brief initialize the tensorscheck's class
- */
-static void
-gst_tensorscheck_class_init (GsttensorscheckClass * klass)
-{
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
-
-  gobject_class = (GObjectClass *) klass;
-  gstelement_class = (GstElementClass *) klass;
-
-  gobject_class->set_property = gst_tensorscheck_set_property;
-  gobject_class->get_property = gst_tensorscheck_get_property;
-
-  g_object_class_install_property (gobject_class, PROP_PASSTHROUGH,
-      g_param_spec_boolean ("passthrough", "Passthrough",
-          "Flag to pass incoming buufer", FALSE, G_PARAM_READWRITE));
-
-  g_object_class_install_property (gobject_class, PROP_SILENT,
-      g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?",
-          TRUE, G_PARAM_READWRITE));
-
-  gst_element_class_set_details_simple (gstelement_class,
-      "tensorscheck",
-      "Test/Tensor",
-      "Get Tensors and Re-construct tensor to check",
-      "Jijoong Moon <jijoong.moon@samsung.com>");
-
-  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));
-}
-
-/**
- * @brief initialize the new element
- * instantiate pads and add them to element
- * set pad calback functions
- * initialize instance structure
- */
-static void
-gst_tensorscheck_init (Gsttensorscheck * filter)
-{
-  filter->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink");
-  gst_pad_set_event_function (filter->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_tensorscheck_sink_event));
-  gst_pad_set_chain_function (filter->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_tensorscheck_chain));
-  gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
-
-  filter->srcpad = gst_pad_new_from_static_template (&src_factory, "src");
-  gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
-
-  filter->silent = TRUE;
-  filter->passthrough = FALSE;
-}
-
-/**
- * @brief set property vmthod
- */
-static void
-gst_tensorscheck_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  Gsttensorscheck *filter = GST_TENSORSCHECK (object);
-
-  switch (prop_id) {
-    case PROP_PASSTHROUGH:
-      filter->passthrough = g_value_get_boolean (value);
-      break;
-    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 vmthod
- */
-static void
-gst_tensorscheck_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec)
-{
-  Gsttensorscheck *filter = GST_TENSORSCHECK (object);
-
-  switch (prop_id) {
-    case PROP_PASSTHROUGH:
-      g_value_set_boolean (value, filter->passthrough);
-      break;
-    case PROP_SILENT:
-      g_value_set_boolean (value, filter->silent);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-/**
- * @brief Set Caps in pad.
- * @param filter Gsttensorscheck instance
- * @param caps incomming capablity
- * @return TRUE/FALSE (if successfully generate & set cap, return TRUE)
- */
-static gboolean
-gst_tensors_check_setcaps (Gsttensorscheck * filter, const GstCaps * caps)
-{
-  GstCaps *othercaps;
-  gboolean ret;
-  guint num_tensors;
-  GstTensorConfig config;
-  GstTensorsConfig tensors_config;
-  GstStructure *s = gst_caps_get_structure (caps, 0);
-
-  g_assert (gst_tensors_config_from_structure (&tensors_config, s));
-  g_assert (gst_tensors_config_validate (&tensors_config));
-
-  filter->in_config = tensors_config;
-
-  /* parse config to test tensors */
-  gst_tensor_config_init (&config);
-
-  num_tensors = tensors_config.info.num_tensors;
-
-  config.info = tensors_config.info.info[0];
-  config.info.dimension[0] = num_tensors;
-
-  config.rate_n = tensors_config.rate_n;
-  config.rate_d = tensors_config.rate_d;
-  g_assert (gst_tensor_config_validate (&config));
-
-  filter->out_config = config;
-
-  othercaps = gst_tensor_caps_from_config (&config);
-  ret = gst_pad_set_caps (filter->srcpad, othercaps);
-  gst_caps_unref (othercaps);
-
-  return ret;
-}
-
-/**
- * @brief make GstBuffer for output tensor.
- * @param filter Gsttensorscheck
- * @param inbuf incomming GstBuffer. (tensors)
- * @return GstBuffer one big GstBuffer
- */
-static GstBuffer *
-gst_tensors_check (Gsttensorscheck * filter, GstBuffer * inbuf)
-{
-  GstBuffer *outbuf;
-  gsize out_size;
-  guint i, num_tensors;
-  GstMapInfo info, src_info, dest_info;
-  guint d0, d1, d2;
-  size_t span, span1;
-
-  /** Mapping input buffer (tensors) into src_info */
-  gst_buffer_map (inbuf, &src_info, GST_MAP_READ);
-
-  /** Making output buffer (one big buffer for check tensors) */
-  out_size = gst_tensor_info_get_size (&filter->out_config.info);
-  outbuf = gst_buffer_new_allocate (NULL, out_size, NULL);
-  gst_buffer_map (outbuf, &dest_info, GST_MAP_WRITE);
-
-  /** Get number of tensors */
-  num_tensors = filter->in_config.info.num_tensors;
-  GST_DEBUG_OBJECT (filter, "Number of Tensors : %d\n", num_tensors);
-
-  for (i = 0; i < num_tensors; i++) {
-    GstMemory *mem;
-
-    mem = gst_buffer_peek_memory (inbuf, i);
-    g_assert (gst_memory_map (mem, &info, GST_MAP_WRITE));
-
-    for (d0 = 0; d0 < filter->in_config.info.info[i].dimension[3]; d0++) {
-      for (d1 = 0; d1 < filter->in_config.info.info[i].dimension[2]; d1++) {
-        span = d1 * filter->in_config.info.info[i].dimension[1];
-        span1 = d1 * filter->in_config.info.info[i].dimension[1] * 3;
-        for (d2 = 0; d2 < filter->in_config.info.info[i].dimension[1]; d2++) {
-          dest_info.data[span1 + (d2 * num_tensors) + i] = info.data[span + d2];
-        }
-      }
-    }
-    gst_memory_unmap (mem, &info);
-  }
-  gst_buffer_unmap (inbuf, &src_info);
-  gst_buffer_unmap (outbuf, &dest_info);
-
-  return outbuf;
-}
-
-/**
- * @brief this function handles sink events.
- * GstElement vmethod implementations.
- */
-static gboolean
-gst_tensorscheck_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
-{
-  Gsttensorscheck *filter;
-  gboolean ret;
-
-  filter = GST_TENSORSCHECK (parent);
-
-  GST_DEBUG_OBJECT (filter, "Received %s event: %" GST_PTR_FORMAT,
-      GST_EVENT_TYPE_NAME (event), event);
-
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_CAPS:
-    {
-      GstCaps *caps;
-
-      gst_event_parse_caps (event, &caps);
-      ret = gst_tensors_check_setcaps (filter, caps);
-      break;
-    }
-    default:
-      ret = gst_pad_event_default (pad, parent, event);
-      break;
-  }
-  return ret;
-}
-
-/**
- * @brief chain function, this function does the actual processing.
- * GstElement vmethod implementations.
- */
-static GstFlowReturn
-gst_tensorscheck_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
-{
-  Gsttensorscheck *filter;
-  GstBuffer *out;
-
-  filter = GST_TENSORSCHECK (parent);
-
-  if (filter->passthrough)
-    return gst_pad_push (filter->srcpad, buf);
-
-  out = gst_tensors_check (filter, buf);
-  gst_buffer_unref (buf);
-
-  return gst_pad_push (filter->srcpad, out);
-}
-
-/**
- * @brief entry point to initialize the plug-in
- * initialize the plug-in itself
- * register the element factories and other features
- */
-static gboolean
-tensorscheck_init (GstPlugin * plugin)
-{
-  /**
-   * debug category for fltering log messages
-   */
-  GST_DEBUG_CATEGORY_INIT (gst_tensorscheck_debug, "tensorscheck",
-      0, "Element tensorscheck to test tensors");
-
-  return gst_element_register (plugin, "tensorscheck", GST_RANK_NONE,
-      GST_TYPE_TENSORSCHECK);
-}
-
-/**
- * PACKAGE: this is usually set by autotools depending on some _INIT macro
- * in configure.ac and then written into and defined in config.h, but we can
- * just set it ourselves here in case someone doesn't use autotools to
- * compile this code. GST_PLUGIN_DEFINE needs PACKAGE to be defined.
- */
-#ifndef PACKAGE
-#define PACKAGE "tensorscheck"
-#endif
-
-/**
- * gstreamer looks for this structure to register tensorschecks
- * exchange the string 'Template tensorscheck' with your tensorscheck description
- */
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
-    GST_VERSION_MINOR,
-    tensorscheck,
-    "Element tensorscheck to test tensors",
-    tensorscheck_init, VERSION, "LGPL", "GStreamer", "http://gstreamer.net/")
diff --git a/tests/nnstreamer_tensors/tensors_test/gsttensorscheck.h b/tests/nnstreamer_tensors/tensors_test/gsttensorscheck.h
deleted file mode 100644 (file)
index df94b24..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * GStreamer
- * Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
- * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
- * Copyright (C) 2018 Jijoong Moon <jijoong.moon@samsung.com>
- *
- * 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       gsttensorscheck.h
- * @date       26 June 2018
- * @brief      test element to check tensors
- * @see                https://github.com/nnsuite/nnstreamer
- * @author     Jijoong Moon <jijoong.moon@samsung.com>
- * @bug                No known bugs except for NYI items
- */
-
-#ifndef __GST_TENSORSCHECK_H__
-#define __GST_TENSORSCHECK_H__
-
-#include <gst/gst.h>
-#include <tensor_common.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_TENSORSCHECK \
-  (gst_tensorscheck_get_type())
-#define GST_TENSORSCHECK(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TENSORSCHECK,Gsttensorscheck))
-#define GST_TENSORSCHECK_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TENSORSCHECK,GsttensorscheckClass))
-#define GST_IS_TENSORSCHECK(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TENSORSCHECK))
-#define GST_IS_TENSORSCHECK_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TENSORSCHECK))
-
-typedef struct _Gsttensorscheck Gsttensorscheck;
-typedef struct _GsttensorscheckClass GsttensorscheckClass;
-
-/**
- * @brief Internal data structure for tensorscheck instances.
- */
-struct _Gsttensorscheck
-{
-  GstElement element;
-  GstPad *sinkpad, *srcpad;
-
-  gboolean silent;
-  gboolean passthrough;
-
-  /* For Tensor */
-  GstTensorsConfig in_config;
-  GstTensorConfig out_config;
-};
-
-/**
- * @brief GsttensorscheckClass inherits GstElementClass
- */
-struct _GsttensorscheckClass
-{
-  GstElementClass parent_class;
-};
-
-/**
- * @brief Get Type function required for gst elements
- */
-GType gst_tensorscheck_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_TENSORSCHECK_H__ */
diff --git a/tests/nnstreamer_tensors/tensors_test/gsttesttensors.c b/tests/nnstreamer_tensors/tensors_test/gsttesttensors.c
deleted file mode 100644 (file)
index ccbab3d..0000000
+++ /dev/null
@@ -1,377 +0,0 @@
-/**
- * GStreamer
- * Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
- * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
- * Copyright (C) 2018 Jijoong Moon <jijoong.moon@samsung.com>
- *
- * 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       gsttesttensors.c
- * @date       26 June 2018
- * @brief      Element to test tensors (witch generates tensors)
- * @see                https://github.com/nnsuite/nnstreamer
- * @author     Jijoong Moon <jijoong.moon@samsung.com>
- * @bug                No known bugs except for NYI items
- */
-
-/**
- * SECTION:element-testtensors
- *
- * This is the element to test tensors only.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch -v -m fakesrc ! testtensors ! fakesink silent=TRUE
- * ]|
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gsttesttensors.h"
-#include <string.h>
-
-GST_DEBUG_CATEGORY_STATIC (gst_testtensors_debug);
-#define GST_CAT_DEFAULT gst_testtensors_debug
-
-/** Properties */
-enum
-{
-  PROP_0,
-  PROP_PASSTHROUGH,
-  PROP_SILENT
-};
-
-/**
- * the capabilities of the inputs and outputs.
- * describe the real formats here.
- */
-static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
-    GST_PAD_SINK,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_TENSOR_CAP_DEFAULT)
-    );
-
-static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
-    GST_PAD_SRC,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_TENSORS_CAP_DEFAULT)
-    );
-
-#define gst_testtensors_parent_class parent_class
-G_DEFINE_TYPE (Gsttesttensors, gst_testtensors, GST_TYPE_ELEMENT);
-
-/** GObject vmethod implementations */
-static void gst_testtensors_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec);
-static void gst_testtensors_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec);
-
-static gboolean gst_testtensors_sink_event (GstPad * pad, GstObject * parent,
-    GstEvent * event);
-static GstFlowReturn gst_testtensors_chain (GstPad * pad, GstObject * parent,
-    GstBuffer * buf);
-
-/**
- * @brief initialize the testtensors's class
- */
-static void
-gst_testtensors_class_init (GsttesttensorsClass * klass)
-{
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
-
-  gobject_class = (GObjectClass *) klass;
-  gstelement_class = (GstElementClass *) klass;
-
-  gobject_class->set_property = gst_testtensors_set_property;
-  gobject_class->get_property = gst_testtensors_get_property;
-
-  g_object_class_install_property (gobject_class, PROP_PASSTHROUGH,
-      g_param_spec_boolean ("passthrough", "Passthrough",
-          "Flag to pass incoming buufer", FALSE, G_PARAM_READWRITE));
-
-  g_object_class_install_property (gobject_class, PROP_SILENT,
-      g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?",
-          TRUE, G_PARAM_READWRITE));
-
-  gst_element_class_set_details_simple (gstelement_class,
-      "testtensors",
-      "Test/Tensor",
-      "Get x-raw and push tensors including three tensors",
-      "Jijoong Moon <jijoong.moon@samsung.com>");
-
-  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));
-}
-
-/**
- * @brief initialize the new element
- * instantiate pads and add them to element
- * set pad calback functions
- * initialize instance structure
- */
-static void
-gst_testtensors_init (Gsttesttensors * filter)
-{
-  filter->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink");
-  gst_pad_set_event_function (filter->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_testtensors_sink_event));
-  gst_pad_set_chain_function (filter->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_testtensors_chain));
-  gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
-
-  filter->srcpad = gst_pad_new_from_static_template (&src_factory, "src");
-  gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
-
-  filter->silent = TRUE;
-  filter->passthrough = FALSE;
-}
-
-/**
- * @brief Set property vmethod
- */
-static void
-gst_testtensors_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  Gsttesttensors *filter = GST_TESTTENSORS (object);
-
-  switch (prop_id) {
-    case PROP_PASSTHROUGH:
-      filter->passthrough = g_value_get_boolean (value);
-      break;
-    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 vmethod
- */
-static void
-gst_testtensors_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec)
-{
-  Gsttesttensors *filter = GST_TESTTENSORS (object);
-
-  switch (prop_id) {
-    case PROP_PASSTHROUGH:
-      g_value_set_boolean (value, filter->passthrough);
-      break;
-    case PROP_SILENT:
-      g_value_set_boolean (value, filter->silent);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-/**
- * @brief Set Caps in pad.
- * @param filter Gsttesttensors instance
- * @param caps incomming capablity
- * @return TRUE/FALSE (if successfully generate & set cap, return TRUE)
- */
-static gboolean
-gst_test_tensors_setcaps (Gsttesttensors * filter, const GstCaps * caps)
-{
-  GstCaps *othercaps;
-  gboolean ret;
-  guint i, num_tensors;
-  GstTensorConfig config;
-  GstTensorsConfig tensors_config;
-  GstStructure *s = gst_caps_get_structure (caps, 0);
-
-  g_assert (gst_tensor_config_from_structure (&config, s));
-  g_assert (gst_tensor_config_validate (&config));
-
-  filter->in_config = config;
-
-  /* parse config to test tensors */
-  gst_tensors_config_init (&tensors_config);
-
-  num_tensors = tensors_config.info.num_tensors = config.info.dimension[0];
-
-  config.info.dimension[0] = 1;
-  for (i = 0; i < num_tensors; i++) {
-    tensors_config.info.info[i] = config.info;
-  }
-
-  tensors_config.rate_n = config.rate_n;
-  tensors_config.rate_d = config.rate_d;
-  g_assert (gst_tensors_config_validate (&tensors_config));
-
-  filter->out_config = tensors_config;
-
-  othercaps = gst_tensors_caps_from_config (&tensors_config);
-  ret = gst_pad_set_caps (filter->srcpad, othercaps);
-  gst_caps_unref (othercaps);
-
-  return ret;
-}
-
-/**
- * @brief make GstBuffer for output tensor.
- * @param filter Gsttesttensors
- * @param inbuf incomming GstBuffer. (x-raw)
- * @return GstBuffer as 'tensors' with three tensors for test
- */
-static GstBuffer *
-gst_test_tensors (Gsttesttensors * filter, GstBuffer * inbuf)
-{
-  GstBuffer *outbuf;
-  guint i, num_tensors;
-  guint d1, d2;
-  guint width, height;
-  GstMapInfo src_info;
-  size_t span, span1;
-
-  outbuf = gst_buffer_new ();
-  gst_buffer_map (inbuf, &src_info, GST_MAP_READ);
-
-  num_tensors = filter->out_config.info.num_tensors;
-
-  for (i = 0; i < num_tensors; i++) {
-    GstMapInfo info;
-    GstMemory *mem;
-
-    width = filter->out_config.info.info[i].dimension[1];
-    height = filter->out_config.info.info[i].dimension[2];
-
-    mem = gst_allocator_alloc (NULL, width * height, NULL);
-    gst_memory_map (mem, &info, GST_MAP_WRITE);
-
-    for (d1 = 0; d1 < height; d1++) {
-      span = d1 * width * num_tensors;
-      span1 = d1 * width;
-      for (d2 = 0; d2 < width; d2++) {
-        info.data[span1 + d2] = src_info.data[span + (d2 * num_tensors) + i];
-      }
-    }
-
-    gst_memory_unmap (mem, &info);
-    gst_buffer_append_memory (outbuf, mem);
-  }
-
-  gst_buffer_unmap (inbuf, &src_info);
-
-  return outbuf;
-}
-
-/**
- * @brief this function handles sink events.
- * GstElement vmethod implementations.
- */
-static gboolean
-gst_testtensors_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
-{
-  Gsttesttensors *filter;
-  gboolean ret;
-
-  filter = GST_TESTTENSORS (parent);
-
-  GST_LOG_OBJECT (filter, "Received %s event: %" GST_PTR_FORMAT,
-      GST_EVENT_TYPE_NAME (event), event);
-
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_CAPS:
-    {
-      GstCaps *caps;
-
-      gst_event_parse_caps (event, &caps);
-      ret = gst_test_tensors_setcaps (filter, caps);
-
-      break;
-    }
-    default:
-      ret = gst_pad_event_default (pad, parent, event);
-      break;
-  }
-  return ret;
-}
-
-/**
- * @brief chain function, this function does the actual processing.
- * GstElement vmethod implementations.
- */
-static GstFlowReturn
-gst_testtensors_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
-{
-  Gsttesttensors *filter;
-  GstBuffer *out;
-
-  filter = GST_TESTTENSORS (parent);
-
-  /** just push out the incoming buffer without touching it */
-  if (filter->passthrough)
-    return gst_pad_push (filter->srcpad, buf);
-
-  out = gst_test_tensors (filter, buf);
-
-  gst_buffer_unref (buf);
-
-  /** In order to keep the data in outbuffer, we have to increase buffer ref count */
-  gst_buffer_ref (out);
-
-  return gst_pad_push (filter->srcpad, out);
-}
-
-/**
- * @brief entry point to initialize the plug-in
- * initialize the plug-in itself
- * register the element factories and other features
- */
-static gboolean
-testtensors_init (GstPlugin * plugin)
-{
-  /**
-   * debug category for fltering log messages
-   * exchange the string 'Template testtensors' with your description
-   */
-  GST_DEBUG_CATEGORY_INIT (gst_testtensors_debug, "testtensors",
-      0, "Element testtensors to test tensors");
-
-  return gst_element_register (plugin, "testtensors", GST_RANK_NONE,
-      GST_TYPE_TESTTENSORS);
-}
-
-/**
- * PACKAGE: this is usually set by autotools depending on some _INIT macro
- * in configure.ac and then written into and defined in config.h, but we can
- * just set it ourselves here in case someone doesn't use autotools to
- * compile this code. GST_PLUGIN_DEFINE needs PACKAGE to be defined.
- */
-#ifndef PACKAGE
-#define PACKAGE "testtensors"
-#endif
-
-/**
- * gstreamer looks for this structure to register testtensorss
- * exchange the string 'Template testtensors' with your testtensors description
- */
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
-    GST_VERSION_MINOR,
-    testtensors,
-    "Element testtensors to test tensors",
-    testtensors_init, VERSION, "LGPL", "GStreamer", "http://gstreamer.net/")
diff --git a/tests/nnstreamer_tensors/tensors_test/gsttesttensors.h b/tests/nnstreamer_tensors/tensors_test/gsttesttensors.h
deleted file mode 100644 (file)
index bb10d61..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * GStreamer
- * Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
- * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
- * Copyright (C) 2018 Jijoong Moon <jijoong.moon@samsung.com>
- *
- * 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       gsttesttensors.h
- * @date       26 June 2018
- * @brief      test element to generate tensors
- * @see                https://github.com/nnsuite/nnstreamer
- * @author     Jijoong Moon <jijoong.moon@samsung.com>
- * @bug                No known bugs except for NYI items
- */
-
-#ifndef __GST_TESTTENSORS_H__
-#define __GST_TESTTENSORS_H__
-
-#include <gst/gst.h>
-#include <tensor_common.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_TESTTENSORS \
-  (gst_testtensors_get_type())
-#define GST_TESTTENSORS(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TESTTENSORS,Gsttesttensors))
-#define GST_TESTTENSORS_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TESTTENSORS,GsttesttensorsClass))
-#define GST_IS_TESTTENSORS(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TESTTENSORS))
-#define GST_IS_TESTTENSORS_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TESTTENSORS))
-
-typedef struct _Gsttesttensors Gsttesttensors;
-typedef struct _GsttesttensorsClass GsttesttensorsClass;
-
-/**
- * @brief Internal data structure for testtensors instances.
- */
-struct _Gsttesttensors
-{
-  GstElement element;
-
-  GstPad *sinkpad, *srcpad;
-
-  gboolean silent;
-  gboolean passthrough;
-
-  /* For Tensor */
-  GstTensorConfig in_config;
-  GstTensorsConfig out_config;
-};
-
-/**
- * @brief Gsttesttensors inherits GstElementClass
- */
-struct _GsttesttensorsClass
-{
-  GstElementClass parent_class;
-};
-
-/**
- * @brief Get Type function required for gst elements
- */
-GType gst_testtensors_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_TESTTENSORS_H__ */