Doxygen Book
gsttensor_sparseenc.c File Reference

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

#include <string.h>
#include <nnstreamer_util.h>
#include "gsttensor_sparseenc.h"
Include dependency graph for gsttensor_sparseenc.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_enc_debug
 
#define DEFAULT_SILENT   TRUE
 Flag to print minimized log. More...
 
#define gst_tensor_sparse_enc_parent_class   parent_class
 

Enumerations

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

Functions

 GST_DEBUG_CATEGORY_STATIC (gst_tensor_sparse_enc_debug)
 
 G_DEFINE_TYPE (GstTensorSparseEnc, gst_tensor_sparse_enc, GST_TYPE_ELEMENT)
 
static void gst_tensor_sparse_enc_finalize (GObject *object)
 Function to finalize instance. More...
 
static void gst_tensor_sparse_enc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 Setter for tensor_sparse_enc properties. More...
 
static void gst_tensor_sparse_enc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 Getter for tensor_sparse_enc properties. More...
 
static GstFlowReturn gst_tensor_sparse_enc_chain (GstPad *pad, GstObject *parent, GstBuffer *buf)
 Internal function to transform the input buffer. More...
 
static GstCaps * gst_tensor_sparse_enc_query_caps (GstTensorSparseEnc *self, GstPad *pad, GstCaps *filter)
 Get pad caps for caps negotiation. More...
 
static gboolean gst_tensor_sparse_enc_sink_event (GstPad *pad, GstObject *parent, GstEvent *event)
 This function handles sink pad event. More...
 
static gboolean gst_tensor_sparse_enc_sink_query (GstPad *pad, GstObject *parent, GstQuery *query)
 This function handles sink pad query. More...
 
static void gst_tensor_sparse_enc_class_init (GstTensorSparseEncClass *klass)
 Initialize the tensor_sparse's class. More...
 
static void gst_tensor_sparse_enc_init (GstTensorSparseEnc *self)
 Initialize tensor_sparse_enc element. More...
 
static gboolean gst_tensor_sparse_enc_parse_caps (GstTensorSparseEnc *self, const GstCaps *caps)
 Parse caps and set tensors config. 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 encode dense tensors into sparse 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_sparseenc.c.

Macro Definition Documentation

◆ DBG

#define DBG   (!self->silent)

Macro for debug mode.

SECTION:element-tensor_sparse_enc

tensor_sparse_enc is a GStreamer element to encode incoming tensor into sparse format.

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

Please see also tensor_sparse_dec.

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

Definition at line 44 of file gsttensor_sparseenc.c.

◆ DEFAULT_SILENT

#define DEFAULT_SILENT   TRUE

Flag to print minimized log.

Definition at line 62 of file gsttensor_sparseenc.c.

◆ GST_CAT_DEFAULT

#define GST_CAT_DEFAULT   gst_tensor_sparse_enc_debug

Definition at line 48 of file gsttensor_sparseenc.c.

◆ gst_tensor_sparse_enc_parent_class

#define gst_tensor_sparse_enc_parent_class   parent_class

Definition at line 80 of file gsttensor_sparseenc.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

tensor_sparse_enc properties

Enumerator
PROP_0 
PROP_SILENT 

Definition at line 53 of file gsttensor_sparseenc.c.

Function Documentation

◆ G_DEFINE_TYPE()

G_DEFINE_TYPE ( GstTensorSparseEnc  ,
gst_tensor_sparse_enc  ,
GST_TYPE_ELEMENT   
)

◆ GST_DEBUG_CATEGORY_STATIC()

GST_DEBUG_CATEGORY_STATIC ( gst_tensor_sparse_enc_debug  )

◆ gst_tensor_sparse_enc_chain()

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

Internal function to transform the input buffer.

Definition at line 372 of file gsttensor_sparseenc.c.

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

◆ gst_tensor_sparse_enc_class_init()

static void gst_tensor_sparse_enc_class_init ( GstTensorSparseEncClass klass)
static

Initialize the tensor_sparse's class.

GstTensorSparseEnc::silent:

The flag to enable/disable debugging messages.

Definition at line 101 of file gsttensor_sparseenc.c.

Here is the call graph for this function:

◆ gst_tensor_sparse_enc_finalize()

static void gst_tensor_sparse_enc_finalize ( GObject *  object)
static

Function to finalize instance.

Definition at line 172 of file gsttensor_sparseenc.c.

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

◆ gst_tensor_sparse_enc_get_property()

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

Getter for tensor_sparse_enc properties.

Definition at line 207 of file gsttensor_sparseenc.c.

Here is the caller graph for this function:

◆ gst_tensor_sparse_enc_init()

static void gst_tensor_sparse_enc_init ( GstTensorSparseEnc self)
static

Initialize tensor_sparse_enc element.

Definition at line 142 of file gsttensor_sparseenc.c.

Here is the call graph for this function:

◆ gst_tensor_sparse_enc_parse_caps()

static gboolean gst_tensor_sparse_enc_parse_caps ( GstTensorSparseEnc self,
const GstCaps *  caps 
)
static

Parse caps and set tensors config.

not fully configured

Definition at line 228 of file gsttensor_sparseenc.c.

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

◆ gst_tensor_sparse_enc_query_caps()

static GstCaps * gst_tensor_sparse_enc_query_caps ( GstTensorSparseEnc 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 286 of file gsttensor_sparseenc.c.

Here is the caller graph for this function:

◆ gst_tensor_sparse_enc_set_property()

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

Setter for tensor_sparse_enc properties.

Definition at line 186 of file gsttensor_sparseenc.c.

Here is the caller graph for this function:

◆ gst_tensor_sparse_enc_sink_event()

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

This function handles sink pad event.

Definition at line 254 of file gsttensor_sparseenc.c.

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

◆ gst_tensor_sparse_enc_sink_query()

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

This function handles sink pad query.

Definition at line 317 of file gsttensor_sparseenc.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_CAP_DEFAULT))

Template for sink pad.

Definition at line 67 of file gsttensor_sparseenc.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_SPARSE_CAP_DEFAULT))

Template for src pad.

Definition at line 75 of file gsttensor_sparseenc.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