Go to the documentation of this file.
59 #define G_TENSOR_FILTER_SINGLE_PRIV(obj) ((GTensorFilterSinglePrivate *) (obj)->priv)
61 #define g_tensor_filter_single_parent_class parent_class
68 guint prop_id,
const GValue * value, GParamSpec * pspec);
70 guint prop_id, GValue * value, GParamSpec * pspec);
91 GObjectClass *gobject_class;
93 gobject_class = (GObjectClass *) klass;
120 self->priv = g_type_instance_get_private ((GTypeInstance *)
self,
150 G_OBJECT_CLASS (parent_class)->finalize (
object);
158 const GValue * value, GParamSpec * pspec)
168 ml_logd (
"Setting property for prop %d.\n", prop_id);
171 G_OBJECT_WARN_INVALID_PROPERTY_ID (
object, prop_id, pspec);
179 GValue * value, GParamSpec * pspec)
189 ml_logd (
"Getting property for prop %d.\n", prop_id);
192 G_OBJECT_WARN_INVALID_PROPERTY_ID (
object, prop_id, pspec);
230 static inline gboolean
255 if (G_UNLIKELY (priv->
fw == NULL))
353 out_tensors[i].size = output[i].size;
359 output[i].
data = g_try_malloc (output[i].size);
360 if (!output[i].
data) {
361 ml_loge (
"Failed to allocate the output tensor.");
371 if (_out != output) {
373 memcpy (output[i].
data, _out[i].
data, output[i].size);
386 output[i].
data = NULL;
405 gint status = -EINVAL;
void gst_tensor_filter_common_open_fw(GstTensorFilterPrivate *priv)
Open NN framework.
#define NNS_TENSOR_SIZE_LIMIT
The number of tensors NNStreamer supports is 256. The max memories of gst-buffer is 16 (See NNS_TENSO...
gboolean gst_tensor_filter_common_set_property(GstTensorFilterPrivate *priv, guint prop_id, const GValue *value, GParamSpec *pspec)
Set the properties for tensor_filter.
Internal meta data exchange format for a other/tensors instance.
#define GST_TF_FW_INVOKE_COMPAT(priv, ret, in, out)
static gboolean g_tensor_filter_single_invoke(GTensorFilterSingle *self, const GstTensorMemory *input, GstTensorMemory *output, gboolean allocate)
Called when an input supposed to be invoked.
Internal log util for NNStreamer plugins and native APIs.
static void g_tensor_filter_single_class_init(GTensorFilterSingleClass *klass)
initialize the tensor_filter's class
void gst_tensors_info_init(GstTensorsInfo *info)
Initialize the tensors info structure.
The unit of each data tensors. It will be used as an input/output tensor of other/tensors.
void gst_tensors_info_free(GstTensorsInfo *info)
Free allocated data in tensors info structure.
static gboolean g_tensor_filter_single_start(GTensorFilterSingle *self)
Called when the element starts processing, if fw not loaded.
static void g_tensor_filter_single_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
Getter for tensor_filter_single properties.
gint(* set_input_info)(GTensorFilterSingle *self, const GstTensorsInfo *in_info, GstTensorsInfo *out_info)
static gboolean g_tensor_filter_allocate_in_invoke(GTensorFilterSingle *self)
Determine if this filter framework supports allocation in invoke.
g_free(self->option[(opnum) - 1])
opnum: \
void gst_tensor_filter_common_free_property(GstTensorFilterPrivate *priv)
Free the properties for tensor-filter.
struct _GTensorFilterSinglePrivate GTensorFilterSinglePrivate
Private data struct for tensor-filter single class.
static void g_tensor_filter_single_init(GTensorFilterSingle *self)
initialize the new element
G_DEFINE_TYPE_WITH_PRIVATE(GTensorFilterSingle, g_tensor_filter_single, G_TYPE_OBJECT)
void(* destroy_notify)(GTensorFilterSingle *self, GstTensorMemory *mem)
gboolean(* start)(GTensorFilterSingle *self)
static void g_tensor_filter_single_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
Setter for tensor_filter_single properties.
gboolean(* output_configured)(GTensorFilterSingle *self)
Internal data structure for tensor_filter_single instances.
void gst_tensor_filter_destroy_notify_util(GstTensorFilterPrivate *priv, void *data)
Free the data allocated for tensor filter output.
void gst_tensor_filter_install_properties(GObjectClass *gobject_class)
Installs all the properties for tensor_filter.
Structure definition for common tensor-filter properties.
#define G_TENSOR_FILTER_SINGLE(obj)
Private data struct for tensor-filter single class.
Element to use general neural network framework individually without gstreamer pipeline.
const GstTensorFilterFramework * fw
gboolean(* input_configured)(GTensorFilterSingle *self)
GstTensorsInfo output_meta
static gboolean g_tensor_filter_single_stop(GTensorFilterSingle *self)
Called when the element stops processing, if fw loaded.
gboolean(* stop)(GTensorFilterSingle *self)
static gboolean g_tensor_filter_output_configured(GTensorFilterSingle *self)
Determine if output is configured (both input and output tensor)
GstTensorsInfo input_meta
int(* setInputDimension)(const GstTensorFilterProperties *prop, void **private_data, const GstTensorsInfo *in_info, GstTensorsInfo *out_info)
int(* getModelInfo)(const GstTensorFilterFramework *self, const GstTensorFilterProperties *prop, void *private_data, model_info_ops ops, GstTensorsInfo *in_info, GstTensorsInfo *out_info)
static gint g_tensor_filter_set_input_info(GTensorFilterSingle *self, const GstTensorsInfo *in_info, GstTensorsInfo *out_info)
Set input tensor information in the framework.
static void g_tensor_filter_single_finalize(GObject *object)
Function to finalize instance.
GstTensorFilterPrivate filter_priv
#define G_TYPE_TENSOR_FILTER_SINGLE
gboolean gst_tensor_filter_common_get_property(GstTensorFilterPrivate *priv, guint prop_id, GValue *value, GParamSpec *pspec)
Get the properties for tensor_filter.
void gst_tensor_filter_load_tensor_info(GstTensorFilterPrivate *priv)
Load tensor info from NN model. (both input and output tensor)
gboolean(* invoke)(GTensorFilterSingle *self, const GstTensorMemory *input, GstTensorMemory *output, gboolean allocate)
gboolean gst_tensor_filter_allocate_in_invoke(GstTensorFilterPrivate *priv)
check if the allocate_in_invoke is valid for the framework
#define G_TENSOR_FILTER_SINGLE_PRIV(obj)
Common functions for various tensor_filters.
void gst_tensor_filter_common_init_property(GstTensorFilterPrivate *priv)
Initialize the properties for tensor-filter.
GstTensorFilterProperties prop
static void g_tensor_filter_destroy_notify(GTensorFilterSingle *self, GstTensorMemory *mem)
Called to notify the framework to destroy the allocated memory.
void gst_tensors_info_copy(GstTensorsInfo *dest, const GstTensorsInfo *src)
Copy tensor info.
void gst_tensor_filter_common_close_fw(GstTensorFilterPrivate *priv)
Close NN framework.
gboolean(* allocate_in_invoke)(GTensorFilterSingle *self)
GTensorFilterSingleClass inherits GObjectClass.
gboolean allocate_in_invoke
static gboolean g_tensor_filter_input_configured(GTensorFilterSingle *self)
Determine if input is configured (both input and output tensor)