Doxygen Book
gsttensor_transform.c File Reference

GStreamer plugin to transform tensor dimension or type. More...

#include <string.h>
#include <math.h>
#include <nnstreamer_log.h>
#include <nnstreamer_util.h>
#include "gsttensor_transform.h"
Include dependency graph for gsttensor_transform.c:

Go to the source code of this file.

Macros

#define DBG   (!filter->silent)
 Macro for debug mode. More...
 
#define GST_CAT_DEFAULT   gst_tensor_transform_debug
 
#define CAPS_STRING   GST_TENSOR_CAP_DEFAULT ";" GST_TENSORS_CAP_MAKE ("{ static, flexible }")
 
#define REGEX_DIMCHG_OPTION   "^([0-9]|1[0-5]):([0-9]|1[0-5])$"
 
#define REGEX_TYPECAST_OPTION   "(^[u]?int(8|16|32|64)$|^float(16|32|64)$)"
 
#define REGEX_TRANSPOSE_OPTION   "^(?:([0-2]):(?!.*\\1)){3}3$"
 
#define REGEX_STAND_OPTION   "^(default|dc-average)(:([u]?int(8|16|32|64)|float(16|32|64)))?(,per-channel:(true|false))?$"
 
#define REGEX_CLAMP_OPTION
 
#define REGEX_PADDING_OPTION   "^((left|right|top|bottom|front|back):(\\d)(,)?)+(layout:(NCHW|NHWC))?$"
 
#define REGEX_ARITH_OPTION
 
#define REGEX_ARITH_OPTION_TYPECAST   "(typecast:([u]?int(8|16|32|64)|float(16|32|64)))"
 
#define NNS_TENSOR_TRANSPOSE_RANK_LIMIT   (4)
 The transpose rank is fixed to 4. This RANK does not affect other/tensors(s)'s NNS_TENSOR_RANK_LIMIT. More...
 
#define NNS_TENSOR_PADDING_RANK_LIMIT   (3)
 The padding rank is fixed to 3. This RANK does not affect other/tensors(s)'s NNS_TENSOR_RANK_LIMIT. More...
 
#define DEFAULT_ACCELERATION   FALSE
 Flag to set orc acceleration. More...
 
#define gst_tensor_transform_parent_class   parent_class
 
#define GST_TYPE_TENSOR_TRANSFORM_MODE   (gst_tensor_transform_mode_get_type ())
 
#define _conv_to_f16(intype, o, i, n)   do { float16_not_supported (); } while (0)
 
#define _conv_from_f16(otype, o, i, n)   do { float16_not_supported (); } while (0)
 
#define _op_float16(i, n, v, op)   do { float16_not_supported (); } while (0)
 
#define handle_operator(d, v, oper, vtype)
 Macro for operator. More...
 
#define transposeloop(cl, ck, cj, ci, sl, sk, sj, si, typesize)
 

Enumerations

enum  {
  PROP_0, PROP_SILENT, PROP_MODE, PROP_OPTION,
  PROP_ACCELERATION, PROP_APPLY, PROP_TRANSPOSE_RANK_LIMIT
}
 tensor_transform properties More...
 

Functions

 GST_DEBUG_CATEGORY_STATIC (gst_tensor_transform_debug)
 
 G_DEFINE_TYPE (GstTensorTransform, gst_tensor_transform, GST_TYPE_BASE_TRANSFORM)
 
static void gst_tensor_transform_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 Set property (gst element vmethod) More...
 
static void gst_tensor_transform_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 Get property (gst element vmethod) More...
 
static void gst_tensor_transform_finalize (GObject *object)
 Function to finalize instance (gst element vmethod) More...
 
static GstFlowReturn gst_tensor_transform_transform (GstBaseTransform *trans, GstBuffer *inbuf, GstBuffer *outbuf)
 non-ip transform. required vmethod for BaseTransform class. More...
 
static GstCaps * gst_tensor_transform_transform_caps (GstBaseTransform *trans, GstPadDirection direction, GstCaps *caps, GstCaps *filtercap)
 configure srcpad cap from "proposed" cap. (required vmethod for BaseTransform) More...
 
static GstCaps * gst_tensor_transform_fixate_caps (GstBaseTransform *trans, GstPadDirection direction, GstCaps *caps, GstCaps *othercaps)
 fixate caps. required vmethod of BaseTransform More...
 
static gboolean gst_tensor_transform_set_caps (GstBaseTransform *trans, GstCaps *incaps, GstCaps *outcaps)
 set caps. required vmethod of BaseTransform More...
 
static gboolean gst_tensor_transform_transform_size (GstBaseTransform *trans, GstPadDirection direction, GstCaps *caps, gsize size, GstCaps *othercaps, gsize *othersize)
 Tell the framework the required size of buffer based on the info of the other side pad. Note that this is always the same with the input. optional vmethod of BaseTransform. More...
 
static gboolean gst_tensor_transform_convert_dimension (GstTensorTransform *filter, GstPadDirection direction, guint idx, const GstTensorInfo *in_info, GstTensorInfo *out_info)
 Dimension conversion calculation. More...
 
static GType gst_tensor_transform_mode_get_type (void)
 A private function to register GEnumValue array for the 'mode' property to a GType and return it. More...
 
static void gst_tensor_transform_class_init (GstTensorTransformClass *klass)
 initialize the tensor_transform's class More...
 
static void gst_tensor_transform_init (GstTensorTransform *filter)
 initialize the new element (G_DEFINE_TYPE requires this) instantiate pads and add them to element set pad callback functions initialize instance structure More...
 
static tensor_transform_operator gst_tensor_transform_get_operator (const gchar *str)
 Get the corresponding operator from the string value. More...
 
static tensor_transform_stand_mode gst_tensor_transform_get_stand_mode (const gchar *str)
 Get the corresponding mode from the string value. More...
 
static void float16_not_supported (void)
 Generate error if float16 is required. More...
 
 while (0)
 
static gboolean gst_tensor_transform_set_option_data (GstTensorTransform *filter)
 Setup internal data (data_* in GstTensorTransform) More...
 
static GstFlowReturn gst_tensor_transform_dimchg (GstTensorTransform *filter, GstTensorInfo *in_info, GstTensorInfo *out_info, const uint8_t *inptr, uint8_t *outptr)
 subrouting for tensor-transform, "dimchg" case. More...
 
static GstFlowReturn gst_tensor_transform_typecast (GstTensorTransform *filter, GstTensorInfo *in_info, GstTensorInfo *out_info, const uint8_t *inptr, uint8_t *outptr)
 subrouting for tensor-transform, "typecast" case. More...
 
static GstFlowReturn gst_tensor_transform_arithmetic (GstTensorTransform *filter, GstTensorInfo *in_info, GstTensorInfo *out_info, const uint8_t *inptr, uint8_t *outptr)
 subrouting for tensor-transform, "arithmetic" case. More...
 
static GstFlowReturn gst_tensor_transform_transpose (GstTensorTransform *filter, GstTensorInfo *in_info, GstTensorInfo *out_info, const uint8_t *inptr, uint8_t *outptr)
 subrouting for tensor-transform, "transpose" case. More...
 
static GstFlowReturn gst_tensor_transform_stand (GstTensorTransform *filter, GstTensorInfo *in_info, GstTensorInfo *out_info, const uint8_t *inptr, uint8_t *outptr)
 subrouting for tensor-transform, "stand" case. : pixel = abs((pixel - average(tensor))/(std(tensor) + val)) More...
 
static GstFlowReturn gst_tensor_transform_clamp (GstTensorTransform *filter, GstTensorInfo *in_info, GstTensorInfo *out_info, const uint8_t *inptr, uint8_t *outptr)
 subrouting for tensor-transform, "clamp" case. : pixel = if (pixel > max) ? max : if (pixel < min) ? min : pixel More...
 
static GstFlowReturn gst_tensor_transform_padding (GstTensorTransform *filter, GstTensorInfo *in_info, GstTensorInfo *out_info, const uint8_t *inptr, uint8_t *outptr)
 subrouting for tensor-transform, "padding" case. More...
 
static gboolean gst_tensor_transform_read_caps (GstTensorTransform *filter, const GstCaps *caps, GstTensorsConfig *config)
 Read cap, parse tensor configuration (dim/type) from the cap. More...
 

Variables

static const gchar * gst_tensor_transform_stand_string []
 
static const gchar * gst_tensor_transform_operator_string []
 
static GstStaticPadTemplate sink_factory
 The capabilities of the inputs. More...
 
static GstStaticPadTemplate src_factory
 The capabilities of the outputs. More...
 
 break
 vtype += (v)->data._##vtype; \ More...
 
case GTT_OP_MUL
 
default __pad0__
 
default Unknown operator%d", oper)
 
return FALSE
 

Detailed Description

GStreamer plugin to transform tensor dimension or type.

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 MyungJoo Ham myung.nosp@m.joo..nosp@m.ham@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
10 Jul 2018
See also
https://github.com/nnstreamer/nnstreamer
Author
MyungJoo Ham myung.nosp@m.joo..nosp@m.ham@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m
Bug:
This is NYI.

Definition in file gsttensor_transform.c.

Macro Definition Documentation

◆ _conv_from_f16

#define _conv_from_f16 (   otype,
  o,
  i,
 
)    do { float16_not_supported (); } while (0)

Definition at line 465 of file gsttensor_transform.c.

◆ _conv_to_f16

#define _conv_to_f16 (   intype,
  o,
  i,
 
)    do { float16_not_supported (); } while (0)

Definition at line 464 of file gsttensor_transform.c.

◆ _op_float16

#define _op_float16 (   i,
  n,
  v,
  op 
)    do { float16_not_supported (); } while (0)

Definition at line 466 of file gsttensor_transform.c.

◆ CAPS_STRING

#define CAPS_STRING   GST_TENSOR_CAP_DEFAULT ";" GST_TENSORS_CAP_MAKE ("{ static, flexible }")

Definition at line 69 of file gsttensor_transform.c.

◆ DBG

#define DBG   (!filter->silent)

Macro for debug mode.

SECTION:element-tensor_transform

A filter that transforms tensors dimension or type. The input and output is always in the format of other/tensor or other/tensors.

<refsect2> <title>Example launch line</title> |[ gst-launch -v -m fakesrc ! tensor_converter ! tensor_transform mode=dimchg option=0:2 ! fakesink silent=TRUE ]| <title>How to use dimchg</title> |[ option=0:2 # Move 0th dim to 2nd dim. I.e., [a][H][W][C] ==> [a][C][H][W] ]| </refsect2>

Definition at line 64 of file gsttensor_transform.c.

◆ DEFAULT_ACCELERATION

#define DEFAULT_ACCELERATION   FALSE

Flag to set orc acceleration.

Definition at line 115 of file gsttensor_transform.c.

◆ GST_CAT_DEFAULT

#define GST_CAT_DEFAULT   gst_tensor_transform_debug

Definition at line 68 of file gsttensor_transform.c.

◆ gst_tensor_transform_parent_class

#define gst_tensor_transform_parent_class   parent_class

Definition at line 148 of file gsttensor_transform.c.

◆ GST_TYPE_TENSOR_TRANSFORM_MODE

#define GST_TYPE_TENSOR_TRANSFORM_MODE   (gst_tensor_transform_mode_get_type ())

Definition at line 176 of file gsttensor_transform.c.

◆ handle_operator

#define handle_operator (   d,
  v,
  oper,
  vtype 
)
Value:
do { \
switch (oper) { \
case GTT_OP_ADD: \
(d)->data._

Macro for operator.

Definition at line 573 of file gsttensor_transform.c.

◆ NNS_TENSOR_PADDING_RANK_LIMIT

#define NNS_TENSOR_PADDING_RANK_LIMIT   (3)

The padding rank is fixed to 3. This RANK does not affect other/tensors(s)'s NNS_TENSOR_RANK_LIMIT.

Definition at line 93 of file gsttensor_transform.c.

◆ NNS_TENSOR_TRANSPOSE_RANK_LIMIT

#define NNS_TENSOR_TRANSPOSE_RANK_LIMIT   (4)

The transpose rank is fixed to 4. This RANK does not affect other/tensors(s)'s NNS_TENSOR_RANK_LIMIT.

Definition at line 87 of file gsttensor_transform.c.

◆ REGEX_ARITH_OPTION

#define REGEX_ARITH_OPTION
Value:
"^(typecast:([u]?int(8|16|32|64)|float(16|32|64)),)?"\
"(per-channel:(false|true@[0-9]+),)?"\
"(((add|mul|div)(:([-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?))+(@[0-9]+)?)(,|))+$"

Definition at line 77 of file gsttensor_transform.c.

◆ REGEX_ARITH_OPTION_TYPECAST

#define REGEX_ARITH_OPTION_TYPECAST   "(typecast:([u]?int(8|16|32|64)|float(16|32|64)))"

Definition at line 81 of file gsttensor_transform.c.

◆ REGEX_CLAMP_OPTION

#define REGEX_CLAMP_OPTION
Value:
"^((([-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?))):"\
"((([-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)))$"

Definition at line 74 of file gsttensor_transform.c.

◆ REGEX_DIMCHG_OPTION

#define REGEX_DIMCHG_OPTION   "^([0-9]|1[0-5]):([0-9]|1[0-5])$"

Definition at line 70 of file gsttensor_transform.c.

◆ REGEX_PADDING_OPTION

#define REGEX_PADDING_OPTION   "^((left|right|top|bottom|front|back):(\\d)(,)?)+(layout:(NCHW|NHWC))?$"

Definition at line 76 of file gsttensor_transform.c.

◆ REGEX_STAND_OPTION

#define REGEX_STAND_OPTION   "^(default|dc-average)(:([u]?int(8|16|32|64)|float(16|32|64)))?(,per-channel:(true|false))?$"

Definition at line 73 of file gsttensor_transform.c.

◆ REGEX_TRANSPOSE_OPTION

#define REGEX_TRANSPOSE_OPTION   "^(?:([0-2]):(?!.*\\1)){3}3$"

Definition at line 72 of file gsttensor_transform.c.

◆ REGEX_TYPECAST_OPTION

#define REGEX_TYPECAST_OPTION   "(^[u]?int(8|16|32|64)$|^float(16|32|64)$)"

Definition at line 71 of file gsttensor_transform.c.

◆ transposeloop

#define transposeloop (   cl,
  ck,
  cj,
  ci,
  sl,
  sk,
  sj,
  si,
  typesize 
)
Value:
do { \
size_t i, j, k, l; \
int inidx = 0, outidx=0; \
for(cl=0;cl<sl;cl++) \
for(ci=0;ci<si;ci++) \
for(cj=0;cj<sj;cj++) \
for(ck=0;ck<sk;ck++){ \
const uint8_t *_in; \
uint8_t *_out; \
outidx = si*sj*sk*cl + sj*sk*ci + sk*cj + ck; \
inidx = SK*SJ*SI*l + SJ*SI*k + SI*j + i; \
_in = inptr + inidx * typesize; \
_out = outptr + outidx * typesize; \
nns_memcpy(_out, _in, typesize); \
} \
} while(0);

Macro to run loop for various data types with transpose

Definition at line 1506 of file gsttensor_transform.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

tensor_transform properties

Enumerator
PROP_0 
PROP_SILENT 
PROP_MODE 
PROP_OPTION 
PROP_ACCELERATION 
PROP_APPLY 
PROP_TRANSPOSE_RANK_LIMIT 

Definition at line 98 of file gsttensor_transform.c.

Function Documentation

◆ float16_not_supported()

static void float16_not_supported ( void  )
static

Generate error if float16 is required.

Definition at line 348 of file gsttensor_transform.c.

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

◆ G_DEFINE_TYPE()

G_DEFINE_TYPE ( GstTensorTransform  ,
gst_tensor_transform  ,
GST_TYPE_BASE_TRANSFORM   
)

◆ GST_DEBUG_CATEGORY_STATIC()

GST_DEBUG_CATEGORY_STATIC ( gst_tensor_transform_debug  )

◆ gst_tensor_transform_arithmetic()

static GstFlowReturn gst_tensor_transform_arithmetic ( GstTensorTransform filter,
GstTensorInfo in_info,
GstTensorInfo out_info,
const uint8_t *  inptr,
uint8_t *  outptr 
)
static

subrouting for tensor-transform, "arithmetic" case.

Parameters
[in/out]filter "this" pointer
[in]in_infoinput tensor info
[in]out_infooutput tensor info
[in]inptrinput tensor
[out]outptroutput tensor
Returns
Gst flow status

In case of 3:4:4:1, ch_dim:0 -> #ch: 3, ch_size: 1, ch_offset: 3 ch_dim:1 -> #ch: 4, ch_size: 3, ch_offset: 12 ch_dim:2 -> #ch: 4, ch_size: 12, ch_offset: 48 ch_dim:3 -> #ch: 1, ch_size: 48, ch_offset: 48 * 4

Todo:
add more options

Definition at line 1330 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_clamp()

static GstFlowReturn gst_tensor_transform_clamp ( GstTensorTransform filter,
GstTensorInfo in_info,
GstTensorInfo out_info,
const uint8_t *  inptr,
uint8_t *  outptr 
)
static

subrouting for tensor-transform, "clamp" case. : pixel = if (pixel > max) ? max : if (pixel < min) ? min : pixel

Parameters
[in/out]filter "this" pointer
[in]in_infoinput tensor info
[in]out_infooutput tensor info
[in]inptrinput tensor
[out]outptroutput tensor
Returns
Gst flow status

Definition at line 1725 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_class_init()

static void gst_tensor_transform_class_init ( GstTensorTransformClass klass)
static

initialize the tensor_transform's class

Definition at line 224 of file gsttensor_transform.c.

Here is the call graph for this function:

◆ gst_tensor_transform_convert_dimension()

static gboolean gst_tensor_transform_convert_dimension ( GstTensorTransform filter,
GstPadDirection  direction,
guint  idx,
const GstTensorInfo in_info,
GstTensorInfo out_info 
)
static

Dimension conversion calculation.

Parameters
[in]filter"this" pointer
[in]directionGST_PAD_SINK if input->output conv
[in]idxindex of the input tensors
[in]in_infotensor info structure of source tensor (input if direction is SINK)
[out]out_infotensor info structure of destination tensor (output if direction is SINK)
Returns
TRUE if success

For both directions, dimension does not change

src = SINKPAD / dest = SRCPAD

For both directions, dimension does not change

Definition at line 2005 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_dimchg()

static GstFlowReturn gst_tensor_transform_dimchg ( GstTensorTransform filter,
GstTensorInfo in_info,
GstTensorInfo out_info,
const uint8_t *  inptr,
uint8_t *  outptr 
)
static

subrouting for tensor-transform, "dimchg" case.

Parameters
[in/out]filter "this" pointer
[in]in_infoinput tensor info
[in]out_infooutput tensor info
[in]inptrinput tensor
[out]outptroutput tensor
Returns
Gst flow status

Useless memcpy. Do not call this or

Todo:
do "IP" operation

Smaller-loop-ed a to larger-loop-ed b E.g., [N][H][W][c] (c:W:H:N) --> [N][c][H][W] (W:H:c:N)

Todo:
CRITICAL-TODO: Optimize the performance!

Larger-loop-ed a to smaller-loop-ed b E.g., [N][c][H][W] (W:H:c:N) --> [N][H][W][c] (c:W:H:N)

Todo:
NYI

Definition at line 1197 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_finalize()

static void gst_tensor_transform_finalize ( GObject *  object)
static

Function to finalize instance (gst element vmethod)

Definition at line 1163 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_fixate_caps()

static GstCaps * gst_tensor_transform_fixate_caps ( GstBaseTransform *  trans,
GstPadDirection  direction,
GstCaps *  caps,
GstCaps *  othercaps 
)
static

fixate caps. required vmethod of BaseTransform

Definition at line 2222 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_get_operator()

static tensor_transform_operator gst_tensor_transform_get_operator ( const gchar *  str)
static

Get the corresponding operator from the string value.

Parameters
[in]strThe string value for the operator
Returns
corresponding operator for the string (GTT_OP_UNKNOWN for errors)

Definition at line 319 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_get_property()

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

Get property (gst element vmethod)

Definition at line 1107 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_get_stand_mode()

static tensor_transform_stand_mode gst_tensor_transform_get_stand_mode ( const gchar *  str)
static

Get the corresponding mode from the string value.

Parameters
[in]strThe string value for the mode
Returns
corresponding mode for the string. STAND_END for errors

Definition at line 334 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_init()

static void gst_tensor_transform_init ( GstTensorTransform filter)
static

initialize the new element (G_DEFINE_TYPE requires this) instantiate pads and add them to element set pad callback functions initialize instance structure

Definition at line 299 of file gsttensor_transform.c.

Here is the call graph for this function:

◆ gst_tensor_transform_mode_get_type()

static GType gst_tensor_transform_mode_get_type ( void  )
static

A private function to register GEnumValue array for the 'mode' property to a GType and return it.

Definition at line 182 of file gsttensor_transform.c.

◆ gst_tensor_transform_padding()

static GstFlowReturn gst_tensor_transform_padding ( GstTensorTransform filter,
GstTensorInfo in_info,
GstTensorInfo out_info,
const uint8_t *  inptr,
uint8_t *  outptr 
)
static

subrouting for tensor-transform, "padding" case.

Parameters
[in/out]filter "this" pointer
[in]in_infoinput tensor info
[in]out_infooutput tensor info
[in]inptrinput tensor
[out]outptroutput tensor
Returns
Gst flow status
Todo:
Add constant option instead of using zero padding value

Definition at line 1762 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_read_caps()

static gboolean gst_tensor_transform_read_caps ( GstTensorTransform filter,
const GstCaps *  caps,
GstTensorsConfig config 
)
static

Read cap, parse tensor configuration (dim/type) from the cap.

Parameters
[in]filter"this" pointer
[in]capsThe input caps to be read
[out]configconfigured tensor info
Returns
TRUE if successful (both dim/type read). FALSE if not.

Definition at line 1978 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_set_caps()

static gboolean gst_tensor_transform_set_caps ( GstBaseTransform *  trans,
GstCaps *  incaps,
GstCaps *  outcaps 
)
static

set caps. required vmethod of BaseTransform

Definition at line 2249 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_set_option_data()

static gboolean gst_tensor_transform_set_option_data ( GstTensorTransform filter)
static

Setup internal data (data_* in GstTensorTransform)

Parameters
[in/out]filter "this" pointer. mode & option MUST BE set already.
Return values
TRUEif OK or operation-skipped, FALSE if fatal-error.

Definition at line 663 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_set_property()

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

Set property (gst element vmethod)

Definition at line 1040 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_stand()

static GstFlowReturn gst_tensor_transform_stand ( GstTensorTransform filter,
GstTensorInfo in_info,
GstTensorInfo out_info,
const uint8_t *  inptr,
uint8_t *  outptr 
)
static

subrouting for tensor-transform, "stand" case. : pixel = abs((pixel - average(tensor))/(std(tensor) + val))

Parameters
[in/out]filter "this" pointer
[in]in_infoinput tensor info
[in]out_infooutput tensor info
[in]inptrinput tensor
[out]outptroutput tensor
Returns
Gst flow status

Definition at line 1605 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_transform()

static GstFlowReturn gst_tensor_transform_transform ( GstBaseTransform *  trans,
GstBuffer *  inbuf,
GstBuffer *  outbuf 
)
static

non-ip transform. required vmethod for BaseTransform class.

Parameters
[in/out]trans "super" pointer
[in]inbufThe input gst buffer
[out]outbufThe output gst buffer
Returns
Gst Flow Status
Todo:
max rank supported in tensor-transform is 4

Definition at line 1815 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_transform_caps()

static GstCaps * gst_tensor_transform_transform_caps ( GstBaseTransform *  trans,
GstPadDirection  direction,
GstCaps *  caps,
GstCaps *  filtercap 
)
static

configure srcpad cap from "proposed" cap. (required vmethod for BaseTransform)

Parameters
trans("this" pointer)
direction(why do we need this?)
capssinkpad cap
filtercapthis element's cap (don't know specifically.)
Todo:
Get to know what the heck is @filtercap and use it!

Definition at line 2139 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_transform_size()

static gboolean gst_tensor_transform_transform_size ( GstBaseTransform *  trans,
GstPadDirection  direction,
GstCaps *  caps,
gsize  size,
GstCaps *  othercaps,
gsize *  othersize 
)
static

Tell the framework the required size of buffer based on the info of the other side pad. Note that this is always the same with the input. optional vmethod of BaseTransform.

Consider multi-tensors. Set each memory block in transform()

Definition at line 2329 of file gsttensor_transform.c.

Here is the caller graph for this function:

◆ gst_tensor_transform_transpose()

static GstFlowReturn gst_tensor_transform_transpose ( GstTensorTransform filter,
GstTensorInfo in_info,
GstTensorInfo out_info,
const uint8_t *  inptr,
uint8_t *  outptr 
)
static

subrouting for tensor-transform, "transpose" case.

Parameters
[in/out]filter "this" pointer
[in]in_infoinput tensor info
[in]out_infooutput tensor info
[in]inptrinput tensor
[out]outptroutput tensor
Returns
Gst flow status

Definition at line 1533 of file gsttensor_transform.c.

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

◆ gst_tensor_transform_typecast()

static GstFlowReturn gst_tensor_transform_typecast ( GstTensorTransform filter,
GstTensorInfo in_info,
GstTensorInfo out_info,
const uint8_t *  inptr,
uint8_t *  outptr 
)
static

subrouting for tensor-transform, "typecast" case.

Parameters
[in/out]filter "this" pointer
[in]in_infoinput tensor info
[in]out_infooutput tensor info
[in]inptrinput tensor
[out]outptroutput tensor
Returns
Gst flow status

Definition at line 1292 of file gsttensor_transform.c.

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

◆ while()

while ( )

Definition at line 592 of file gsttensor_transform.c.

Here is the call graph for this function:

Variable Documentation

◆ __pad0__

default __pad0__

Definition at line 589 of file gsttensor_transform.c.

◆ break

d data _ break

vtype += (v)->data._##vtype; \

vtype /= (v)->data._##vtype; \

Definition at line 577 of file gsttensor_transform.c.

◆ FALSE

return FALSE

Definition at line 590 of file gsttensor_transform.c.

◆ gst_tensor_transform_operator_string

const gchar* gst_tensor_transform_operator_string[]
static
Initial value:
= {
[GTT_OP_TYPECAST] = "typecast",
[GTT_OP_ADD] = "add",
[GTT_OP_MUL] = "mul",
[GTT_OP_DIV] = "div",
[GTT_OP_UNKNOWN] = NULL
}

Definition at line 124 of file gsttensor_transform.c.

◆ gst_tensor_transform_stand_string

const gchar* gst_tensor_transform_stand_string[]
static
Initial value:
= {
[STAND_DEFAULT] = "default",
[STAND_DC_AVERAGE] = "dc-average",
[STAND_END] = NULL
}

Definition at line 118 of file gsttensor_transform.c.

◆ GTT_OP_MUL

case GTT_OP_MUL

Definition at line 584 of file gsttensor_transform.c.

◆ operator%d", oper)

default Unknown operator%d", oper)

Definition at line 589 of file gsttensor_transform.c.

◆ sink_factory

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

The capabilities of the inputs.

Definition at line 135 of file gsttensor_transform.c.

◆ src_factory

GstStaticPadTemplate src_factory
static
Initial value:
= GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (CAPS_STRING))

The capabilities of the outputs.

Definition at line 143 of file gsttensor_transform.c.

data
svtc_1 data
Definition: gsttensor_if.c:844
CAPS_STRING
#define CAPS_STRING
Definition: gsttensor_transform.c:69
STAND_END
@ STAND_END
Definition: gsttensor_transform.h:84
GTT_OP_DIV
@ GTT_OP_DIV
Definition: gsttensor_transform.h:75
GTT_OP_TYPECAST
@ GTT_OP_TYPECAST
Definition: gsttensor_transform.h:72
GTT_OP_UNKNOWN
@ GTT_OP_UNKNOWN
Definition: gsttensor_transform.h:77
STAND_DEFAULT
@ STAND_DEFAULT
Definition: gsttensor_transform.h:82
GTT_OP_MUL
case GTT_OP_MUL
Definition: gsttensor_transform.c:584
STAND_DC_AVERAGE
@ STAND_DC_AVERAGE
Definition: gsttensor_transform.h:83
GTT_OP_ADD
@ GTT_OP_ADD
Definition: gsttensor_transform.h:73