Doxygen Book
gsttensor_split.c File Reference

GStreamer plugin to split tensor (as a filter for other general neural network filters) More...

#include <string.h>
#include <gst/gst.h>
#include <glib.h>
#include "gsttensor_split.h"
#include <tensor_common.h>
#include <nnstreamer_util.h>
Include dependency graph for gsttensor_split.c:

Go to the source code of this file.

Macros

#define GST_CAT_DEFAULT   gst_tensor_split_debug
 
#define CAPS_STRING   GST_TENSOR_CAP_DEFAULT ";" GST_TENSORS_CAP_WITH_NUM ("1")
 Template caps string. More...
 
#define gst_tensor_split_parent_class   parent_class
 

Enumerations

enum  { PROP_0, PROP_SILENT, PROP_TENSORPICK, PROP_TENSORSEG }
 

Functions

 GST_DEBUG_CATEGORY_STATIC (gst_tensor_split_debug)
 
static GstFlowReturn gst_tensor_split_chain (GstPad *pad, GstObject *parent, GstBuffer *buf)
 chain function for sink (gst element vmethod) More...
 
static gboolean gst_tensor_split_event (GstPad *pad, GstObject *parent, GstEvent *event)
 event function for sink (gst element vmethod) More...
 
static GstStateChangeReturn gst_tensor_split_change_state (GstElement *element, GstStateChange transition)
 change state (gst element vmethod) More...
 
static void gst_tensor_split_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 Get property (gst element vmethod) More...
 
static void gst_tensor_split_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 Get property (gst element vmethod) More...
 
static void gst_tensor_split_finalize (GObject *object)
 finalize function for tensor split (gst element vmethod) More...
 
 G_DEFINE_TYPE (GstTensorSplit, gst_tensor_split, GST_TYPE_ELEMENT)
 
static void gst_tensor_split_class_init (GstTensorSplitClass *klass)
 initialize the tensor_split's class More...
 
static void gst_tensor_split_init (GstTensorSplit *split)
 initialize the new element instantiate pads and add them to element set pad callback functions initialize instance structure More...
 
static void gst_tensor_split_remove_src_pads (GstTensorSplit *split)
 function to remove srcpad list More...
 
static gboolean gst_tensor_split_get_capsparam (GstTensorSplit *split, GstCaps *caps)
 Set Caps in pad. More...
 
static GstTensorPadgst_tensor_split_get_tensor_pad (GstTensorSplit *split, GstBuffer *inbuf, gboolean *created, guint nth)
 Checking if the source pad is created and if not, create TensorPad. More...
 
static GstFlowReturn gst_tensor_split_combine_flows (GstTensorSplit *split, GstTensorPad *pad, GstFlowReturn ret)
 Check the status among sources in split. More...
 
static GstMemory * gst_tensor_split_get_splitted (GstTensorSplit *split, GstBuffer *buffer, gint nth)
 Make splitted tensor. More...
 
static void _clear_tensorseg (tensor_dim **element)
 Glib Array Clear Function. More...
 

Variables

static GstStaticPadTemplate src_templ
 the capabilities of the inputs and outputs. describe the real formats here. More...
 
static GstStaticPadTemplate sink_templ
 

Detailed Description

GStreamer plugin to split tensor (as a filter for other general neural network filters)

GStreamer Copyright (C) 2005 Thomas Vander Stichele thoma.nosp@m.s@ap.nosp@m.estaa.nosp@m.rt.o.nosp@m.rg Copyright (C) 2005 Ronald S. Bultje rbult.nosp@m.je@r.nosp@m.onald.nosp@m..bit.nosp@m.freak.nosp@m..net Copyright (C) 2018 Jijoong Moon jijoo.nosp@m.ng.m.nosp@m.oon@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m

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; version 2.1 of the License.

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.

Date
27 Aug 2018
See also
https://github.com/nnstreamer/nnstreamer
Author
Jijoong Moon jijoo.nosp@m.ng.m.nosp@m.oon@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m
Bug:
No known bugs except for NYI items

Definition in file gsttensor_split.c.

Macro Definition Documentation

◆ CAPS_STRING

#define CAPS_STRING   GST_TENSOR_CAP_DEFAULT ";" GST_TENSORS_CAP_WITH_NUM ("1")

Template caps string.

Definition at line 73 of file gsttensor_split.c.

◆ GST_CAT_DEFAULT

#define GST_CAT_DEFAULT   gst_tensor_split_debug

Definition at line 60 of file gsttensor_split.c.

◆ gst_tensor_split_parent_class

#define gst_tensor_split_parent_class   parent_class

Definition at line 101 of file gsttensor_split.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PROP_0 
PROP_SILENT 
PROP_TENSORPICK 
PROP_TENSORSEG 

Definition at line 62 of file gsttensor_split.c.

Function Documentation

◆ _clear_tensorseg()

static void _clear_tensorseg ( tensor_dim **  element)
static

Glib Array Clear Function.

Definition at line 569 of file gsttensor_split.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ G_DEFINE_TYPE()

G_DEFINE_TYPE ( GstTensorSplit  ,
gst_tensor_split  ,
GST_TYPE_ELEMENT   
)

◆ GST_DEBUG_CATEGORY_STATIC()

GST_DEBUG_CATEGORY_STATIC ( gst_tensor_split_debug  )

SECTION:element-tensor_split

A Deuxer that split tensors stream to tensor stream for NN frameworks. The outputs are always in the format of other/tensor.

<refsect2> <title>Example launch line</title> |[ gst-launch -v -m filesrc location=testcase_RGB_100x100.png ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,width=100,height=100,framerate=0/1 ! tensor_converter ! tensor_split name=split tensorseg=2:100:100,1:100:100 split.src_0 ! queue ! filesink location=src0.log split.src_1 ! queue ! filesink location=src1.log ]|

</refsect2>

◆ gst_tensor_split_chain()

static GstFlowReturn gst_tensor_split_chain ( GstPad *  pad,
GstObject *  parent,
GstBuffer *  buf 
)
static

chain function for sink (gst element vmethod)

Definition at line 459 of file gsttensor_split.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_split_change_state()

static GstStateChangeReturn gst_tensor_split_change_state ( GstElement *  element,
GstStateChange  transition 
)
static

change state (gst element vmethod)

Definition at line 537 of file gsttensor_split.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_split_class_init()

static void gst_tensor_split_class_init ( GstTensorSplitClass klass)
static

initialize the tensor_split's class

Definition at line 109 of file gsttensor_split.c.

Here is the call graph for this function:

◆ gst_tensor_split_combine_flows()

static GstFlowReturn gst_tensor_split_combine_flows ( GstTensorSplit split,
GstTensorPad pad,
GstFlowReturn  ret 
)
static

Check the status among sources in split.

Parameters
splitTensorSplit Object
TensorPadTensorpad
retreturn status of current pad
Returns
return status after check sources

Definition at line 387 of file gsttensor_split.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_split_event()

static gboolean gst_tensor_split_event ( GstPad *  pad,
GstObject *  parent,
GstEvent *  event 
)
static

event function for sink (gst element vmethod)

Definition at line 233 of file gsttensor_split.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_split_finalize()

static void gst_tensor_split_finalize ( GObject *  object)
static

finalize function for tensor split (gst element vmethod)

Definition at line 202 of file gsttensor_split.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_split_get_capsparam()

static gboolean gst_tensor_split_get_capsparam ( GstTensorSplit split,
GstCaps *  caps 
)
static

Set Caps in pad.

Parameters
splitGstTensorSplit object
capsincoming capability
Returns
TRUE/FALSE (if successfully generate & set cap, return TRUE)

Definition at line 220 of file gsttensor_split.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_split_get_property()

static void gst_tensor_split_get_property ( GObject *  object,
guint  prop_id,
GValue *  value,
GParamSpec *  pspec 
)
static

Get property (gst element vmethod)

If i = 1, this is previous p. Otherwise, it's previous g_strjoin result.

Definition at line 653 of file gsttensor_split.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_split_get_splitted()

static GstMemory* gst_tensor_split_get_splitted ( GstTensorSplit split,
GstBuffer *  buffer,
gint  nth 
)
static

Make splitted tensor.

Parameters
splitTensorSplit object
buffergstbuffer form src
nthorther of tensor
Returns
return GstMemory for splitted tensor

Definition at line 415 of file gsttensor_split.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_split_get_tensor_pad()

static GstTensorPad* gst_tensor_split_get_tensor_pad ( GstTensorSplit split,
GstBuffer *  inbuf,
gboolean *  created,
guint  nth 
)
static

Checking if the source pad is created and if not, create TensorPad.

Parameters
splitTensorSplit Object
inbufinputbuf GstBuffer Object including GstMeta
[out]createdwill be updated in this function
nthsource ordering
Returns
TensorPad if pad is already created, then return created pad. If not return new pad after creation.

Definition at line 276 of file gsttensor_split.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_split_init()

static void gst_tensor_split_init ( GstTensorSplit split)
static

initialize the new element instantiate pads and add them to element set pad callback functions initialize instance structure

Definition at line 160 of file gsttensor_split.c.

Here is the call graph for this function:

◆ gst_tensor_split_remove_src_pads()

static void gst_tensor_split_remove_src_pads ( GstTensorSplit split)
static

function to remove srcpad list

Definition at line 184 of file gsttensor_split.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_split_set_property()

static void gst_tensor_split_set_property ( GObject *  object,
guint  prop_id,
const GValue *  value,
GParamSpec *  pspec 
)
static

Get property (gst element vmethod)

Definition at line 578 of file gsttensor_split.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ sink_templ

GstStaticPadTemplate sink_templ
static
Initial value:
= GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (CAPS_STRING))

Definition at line 84 of file gsttensor_split.c.

◆ src_templ

GstStaticPadTemplate src_templ
static
Initial value:
= GST_STATIC_PAD_TEMPLATE ("src_%u",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
GST_STATIC_CAPS (CAPS_STRING))

the capabilities of the inputs and outputs. describe the real formats here.

Definition at line 79 of file gsttensor_split.c.

CAPS_STRING
#define CAPS_STRING
Template caps string.
Definition: gsttensor_split.c:73