GStreamer element to crop the regions of incoming tensor. More...
#include <string.h>
#include <nnstreamer_util.h>
#include "gsttensor_crop.h"
#include "tensor_data.h"
Go to the source code of this file.
Classes | |
struct | tensor_region_s |
Internal data structure to describe tensor region. More... | |
struct | tensor_crop_info_s |
Internal data structure to describe cropping tensor data. More... | |
Macros | |
#define | GST_CAT_DEFAULT gst_tensor_crop_debug |
#define | DEFAULT_SILENT TRUE |
Flag to print minimized log. More... | |
#define | DEFAULT_LATENESS (-1) |
Default value to compare timestamp of raw and info buffer, in milliseconds (-1 means no synchronization). More... | |
#define | gst_tensor_crop_parent_class parent_class |
Enumerations | |
enum | { PROP_0, PROP_LATENESS, PROP_SILENT } |
tensor_crop properties More... | |
Functions | |
GST_DEBUG_CATEGORY_STATIC (gst_tensor_crop_debug) | |
G_DEFINE_TYPE (GstTensorCrop, gst_tensor_crop, GST_TYPE_ELEMENT) | |
static void | gst_tensor_crop_finalize (GObject *object) |
Function to finalize instance. More... | |
static void | gst_tensor_crop_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
Setter for tensor_crop properties. More... | |
static void | gst_tensor_crop_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) |
Getter for tensor_crop properties. More... | |
static GstStateChangeReturn | gst_tensor_crop_change_state (GstElement *element, GstStateChange transition) |
Handle state transition. More... | |
static gboolean | gst_tensor_crop_src_event (GstPad *pad, GstObject *parent, GstEvent *event) |
Handle event on src pad. More... | |
static gboolean | gst_tensor_crop_sink_event (GstCollectPads *pads, GstCollectData *data, GstEvent *event, gpointer user_data) |
Handle event on sink pad. More... | |
static GstFlowReturn | gst_tensor_crop_collected (GstCollectPads *pads, gpointer user_data) |
Chain function called when the buffer is available on all of the collect pads. More... | |
static void | gst_tensor_crop_class_init (GstTensorCropClass *klass) |
Initialize the tensor_crop's class. More... | |
static void | gst_tensor_crop_pad_reset (GstTensorCropPadData *cpad) |
Clear and reset old pad data. More... | |
static void | gst_tensor_crop_reset (GstTensorCrop *self) |
Clear and reset old data in tensor_crop. More... | |
static void | gst_tensor_crop_init (GstTensorCrop *self) |
Initialize tensor_crop element. More... | |
static GstFlowReturn | gst_tensor_crop_negotiate (GstTensorCrop *self) |
Set pad caps if not negotiated. More... | |
static gboolean | gst_tensor_crop_prepare_out_meta (GstTensorCrop *self, gpointer buffer, GstTensorMetaInfo *meta, GstTensorInfo *info, gboolean *is_flexible) |
Internal function to prepare output meta info. More... | |
static gboolean | gst_tensor_crop_get_crop_info (GstTensorCrop *self, GstBuffer *info, tensor_crop_info_s *cinfo) |
Internal function to parse buffer and fill crop info. More... | |
static GstBuffer * | gst_tensor_crop_do_cropping (GstTensorCrop *self, GstBuffer *raw, tensor_crop_info_s *cinfo) |
Internal function to crop incoming buffer. More... | |
static GstFlowReturn | gst_tensor_crop_chain (GstTensorCrop *self, GstCollectData *data_raw, GstCollectData *data_info) |
Internal function to transform the input buffer. More... | |
Variables | |
static GstStaticPadTemplate | raw_template |
Template for sink pad (raw data). More... | |
static GstStaticPadTemplate | info_template |
Template for sink pad (crop info). More... | |
static GstStaticPadTemplate | src_template |
Template for src pad. More... | |
GStreamer element to crop the regions of incoming tensor.
Copyright (C) 2021 Samsung Electronics Co., Ltd.
Definition in file gsttensor_crop.c.
#define DEFAULT_LATENESS (-1) |
Default value to compare timestamp of raw and info buffer, in milliseconds (-1 means no synchronization).
Definition at line 89 of file gsttensor_crop.c.
#define DEFAULT_SILENT TRUE |
Flag to print minimized log.
Definition at line 84 of file gsttensor_crop.c.
#define GST_CAT_DEFAULT gst_tensor_crop_debug |
Definition at line 69 of file gsttensor_crop.c.
#define gst_tensor_crop_parent_class parent_class |
Definition at line 116 of file gsttensor_crop.c.
anonymous enum |
tensor_crop properties
Enumerator | |
---|---|
PROP_0 | |
PROP_LATENESS | |
PROP_SILENT |
Definition at line 74 of file gsttensor_crop.c.
G_DEFINE_TYPE | ( | GstTensorCrop | , |
gst_tensor_crop | , | ||
GST_TYPE_ELEMENT | |||
) |
GST_DEBUG_CATEGORY_STATIC | ( | gst_tensor_crop_debug | ) |
|
static |
Internal function to transform the input buffer.
The case when raw and info have different timestamp. Compare timestamp and if time diff is less than lateness, crop raw buffer.
Definition at line 725 of file gsttensor_crop.c.
|
static |
Handle state transition.
Definition at line 333 of file gsttensor_crop.c.
|
static |
Initialize the tensor_crop's class.
The time difference between raw and info buffer, in milliseconds (-1 means no synchronization). If raw and info buffers on the pads have different timestamp and time-diff is larger than 'lateness', tensor-crop will drop old buffer and wait for next buffers.
The flag to enable/disable debugging messages.
Definition at line 137 of file gsttensor_crop.c.
|
static |
Chain function called when the buffer is available on all of the collect pads.
Definition at line 812 of file gsttensor_crop.c.
|
static |
Internal function to crop incoming buffer.
Definition at line 624 of file gsttensor_crop.c.
|
static |
Function to finalize instance.
Definition at line 265 of file gsttensor_crop.c.
|
static |
Internal function to parse buffer and fill crop info.
Definition at line 547 of file gsttensor_crop.c.
|
static |
Getter for tensor_crop properties.
Definition at line 309 of file gsttensor_crop.c.
|
static |
Initialize tensor_crop element.
Definition at line 228 of file gsttensor_crop.c.
|
static |
Set pad caps if not negotiated.
Cannot use gst-pad util to get stream ID (multiple sink pads). Create stream ID using first sink pad.
Get config from collect-pads and set framerate. Output is always flexible tensor.
Definition at line 423 of file gsttensor_crop.c.
|
static |
Clear and reset old pad data.
Definition at line 195 of file gsttensor_crop.c.
|
static |
Internal function to prepare output meta info.
Definition at line 497 of file gsttensor_crop.c.
|
static |
Clear and reset old data in tensor_crop.
Definition at line 205 of file gsttensor_crop.c.
|
static |
Setter for tensor_crop properties.
Definition at line 285 of file gsttensor_crop.c.
|
static |
Handle event on sink pad.
Definition at line 388 of file gsttensor_crop.c.
|
static |
Handle event on src pad.
Definition at line 368 of file gsttensor_crop.c.
|
static |
Template for sink pad (crop info).
Definition at line 103 of file gsttensor_crop.c.
|
static |
Template for sink pad (raw data).
Definition at line 94 of file gsttensor_crop.c.
|
static |
Template for src pad.
Definition at line 111 of file gsttensor_crop.c.