Doxygen Book
gsttensor_sparsedec.c File Reference

GStreamer element to decode sparse tensors into dense tensors. More...

#include <string.h>
#include <nnstreamer_util.h>
#include "gsttensor_sparsedec.h"
Include dependency graph for gsttensor_sparsedec.c:

Go to the source code of this file.

Macros

#define DBG   (!self->silent)
 Macro for debug mode. More...
 
#define GST_CAT_DEFAULT   gst_tensor_sparse_dec_debug
 
#define DEFAULT_SILENT   TRUE
 Flag to print minimized log. More...
 
#define gst_tensor_sparse_dec_parent_class   parent_class
 

Enumerations

enum  { PROP_0, PROP_SILENT }
 tensor_sparse_dec properties More...
 

Functions

 GST_DEBUG_CATEGORY_STATIC (gst_tensor_sparse_dec_debug)
 
 G_DEFINE_TYPE (GstTensorSparseDec, gst_tensor_sparse_dec, GST_TYPE_ELEMENT)
 
static void gst_tensor_sparse_dec_finalize (GObject *object)
 Function to finalize instance. More...
 
static void gst_tensor_sparse_dec_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 Setter for tensor_sparse_dec properties. More...
 
static void gst_tensor_sparse_dec_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 Getter for tensor_sparse_dec properties. More...
 
static GstFlowReturn gst_tensor_sparse_dec_chain (GstPad *pad, GstObject *parent, GstBuffer *buf)
 Internal function to transform the input buffer. More...
 
static gboolean gst_tensor_sparse_dec_sink_event (GstPad *pad, GstObject *parent, GstEvent *event)
 This function handles sink pad event. More...
 
static gboolean gst_tensor_sparse_dec_sink_query (GstPad *pad, GstObject *parent, GstQuery *query)
 This function handles sink pad query. More...
 
static void gst_tensor_sparse_dec_class_init (GstTensorSparseDecClass *klass)
 Initialize the tensor_sparse's class. More...
 
static void gst_tensor_sparse_dec_init (GstTensorSparseDec *self)
 Initialize tensor_sparse_dec element. More...
 
static GstCaps * gst_tensor_sparse_dec_query_caps (GstTensorSparseDec *self, GstPad *pad, GstCaps *filter)
 Get pad caps for caps negotiation. More...
 

Variables

static GstStaticPadTemplate sink_template
 Template for sink pad. More...
 
static GstStaticPadTemplate src_template
 Template for src pad. More...
 

Detailed Description

GStreamer element to decode sparse tensors into dense tensors.

Copyright (C) 2021 Samsung Electronics Co., Ltd.

Date
27 Jul 2021
See also
https://github.com/nnstreamer/nnstreamer
Author
Yongjoo Ahn yongj.nosp@m.oo1..nosp@m.ahn@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m
Bug:
No known bugs except for NYI items

Definition in file gsttensor_sparsedec.c.

Macro Definition Documentation

◆ DBG

#define DBG   (!self->silent)

Macro for debug mode.

SECTION:element-tensor_sparse_dec

tensor_sparse_dec is a GStreamer element to decode incoming sparse tensor into static (dense) format.

The input is always in the format of other/tensors,format=sparse. The output is always in the format of ohter/tensors,format=static.

Please see also tensor_sparse_enc.

<refsect2> <title>Example launch line</title> |[ gst-launch-1.0 ... ! other/tensors,format=static ! \ tensor_sparse_enc ! other/tensors,format=sparse ! \ tensor_sparse_dec ! tensor_sink ]| </refsect2>

Definition at line 45 of file gsttensor_sparsedec.c.

◆ DEFAULT_SILENT

#define DEFAULT_SILENT   TRUE

Flag to print minimized log.

Definition at line 63 of file gsttensor_sparsedec.c.

◆ GST_CAT_DEFAULT

#define GST_CAT_DEFAULT   gst_tensor_sparse_dec_debug

Definition at line 49 of file gsttensor_sparsedec.c.

◆ gst_tensor_sparse_dec_parent_class

#define gst_tensor_sparse_dec_parent_class   parent_class

Definition at line 81 of file gsttensor_sparsedec.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

tensor_sparse_dec properties

Enumerator
PROP_0 
PROP_SILENT 

Definition at line 54 of file gsttensor_sparsedec.c.

Function Documentation

◆ G_DEFINE_TYPE()

G_DEFINE_TYPE ( GstTensorSparseDec  ,
gst_tensor_sparse_dec  ,
GST_TYPE_ELEMENT   
)

◆ GST_DEBUG_CATEGORY_STATIC()

GST_DEBUG_CATEGORY_STATIC ( gst_tensor_sparse_dec_debug  )

◆ gst_tensor_sparse_dec_chain()

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

Internal function to transform the input buffer.

Todo:
consider more error handling

Definition at line 359 of file gsttensor_sparsedec.c.

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

◆ gst_tensor_sparse_dec_class_init()

static void gst_tensor_sparse_dec_class_init ( GstTensorSparseDecClass klass)
static

Initialize the tensor_sparse's class.

GstTensorSparseDec::silent:

The flag to enable/disable debugging messages.

Definition at line 101 of file gsttensor_sparsedec.c.

Here is the call graph for this function:

◆ gst_tensor_sparse_dec_finalize()

static void gst_tensor_sparse_dec_finalize ( GObject *  object)
static

Function to finalize instance.

Definition at line 172 of file gsttensor_sparsedec.c.

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

◆ gst_tensor_sparse_dec_get_property()

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

Getter for tensor_sparse_dec properties.

Definition at line 208 of file gsttensor_sparsedec.c.

Here is the caller graph for this function:

◆ gst_tensor_sparse_dec_init()

static void gst_tensor_sparse_dec_init ( GstTensorSparseDec self)
static

Initialize tensor_sparse_dec element.

Definition at line 141 of file gsttensor_sparsedec.c.

Here is the call graph for this function:

◆ gst_tensor_sparse_dec_query_caps()

static GstCaps* gst_tensor_sparse_dec_query_caps ( GstTensorSparseDec self,
GstPad *  pad,
GstCaps *  filter 
)
static

Get pad caps for caps negotiation.

pad don't have current caps. use the template caps

Definition at line 229 of file gsttensor_sparsedec.c.

Here is the caller graph for this function:

◆ gst_tensor_sparse_dec_set_property()

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

Setter for tensor_sparse_dec properties.

Definition at line 187 of file gsttensor_sparsedec.c.

Here is the caller graph for this function:

◆ gst_tensor_sparse_dec_sink_event()

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

This function handles sink pad event.

Definition at line 313 of file gsttensor_sparsedec.c.

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

◆ gst_tensor_sparse_dec_sink_query()

static gboolean gst_tensor_sparse_dec_sink_query ( GstPad *  pad,
GstObject *  parent,
GstQuery *  query 
)
static

This function handles sink pad query.

Definition at line 260 of file gsttensor_sparsedec.c.

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

Variable Documentation

◆ sink_template

GstStaticPadTemplate sink_template
static
Initial value:
= GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_TENSORS_SPARSE_CAP_DEFAULT))

Template for sink pad.

Definition at line 68 of file gsttensor_sparsedec.c.

◆ src_template

GstStaticPadTemplate src_template
static
Initial value:
= GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_TENSORS_CAP_DEFAULT))

Template for src pad.

Definition at line 76 of file gsttensor_sparsedec.c.

GST_TENSORS_SPARSE_CAP_DEFAULT
#define GST_TENSORS_SPARSE_CAP_DEFAULT
Caps string for the caps template of sparse tensors. This mimetype handles non-static,...
Definition: tensor_typedef.h:131
GST_TENSORS_CAP_DEFAULT
#define GST_TENSORS_CAP_DEFAULT
Caps string for the caps template of static tensor stream.
Definition: tensor_typedef.h:115