Go to the documentation of this file.
14 #ifndef __NNS_PLUGIN_API_UTIL_H__
15 #define __NNS_PLUGIN_API_UTIL_H__
19 #include <nnstreamer_version.h>
26 #define _STR_NULL(str) ((str) ? (str) : "(NULL)")
137 const gchar *dim_string);
147 const gchar * type_string);
157 const gchar * name_string);
274 #define gst_tensors_config_is_static(c) ((c)->info.format == _NNS_TENSOR_FORMAT_STATIC)
279 #define gst_tensors_config_is_flexible(c) ((c)->info.format == _NNS_TENSOR_FORMAT_FLEXIBLE)
284 #define gst_tensors_config_is_sparse(c) ((c)->info.format == _NNS_TENSOR_FORMAT_SPARSE)
gint find_key_strv(const gchar **strv, const gchar *key)
Find the index value of the given key string array.
gboolean gst_tensor_dimension_string_is_equal(const gchar *dimstr1, const gchar *dimstr2)
Compare dimension strings.
tensor_type gst_tensor_get_type(const gchar *typestr)
Get tensor type from string input.
gboolean gst_tensors_config_is_equal(const GstTensorsConfig *c1, const GstTensorsConfig *c2)
Compare tensor config info (for other/tensors)
gboolean gst_tensor_dimension_is_valid(const tensor_dim dim)
Check the tensor dimension is valid.
const gchar * gst_tensor_get_type_string(tensor_type type)
Get type string of tensor type.
gchar * nnstreamer_version_string(void)
Get the version of NNStreamer.
Internal data structure for tensor info.
uint32_t tensor_dim[NNS_TENSOR_RANK_LIMIT]
gchar * gst_tensor_get_rank_dimension_string(const tensor_dim dim, const unsigned int rank)
Get dimension string from given tensor dimension and rank count.
guint gst_tensors_info_parse_names_string(GstTensorsInfo *info, const gchar *name_string)
Parse the string of names.
Internal meta data exchange format for a other/tensors instance.
gboolean gst_tensor_meta_info_update_header(GstTensorMetaInfo *meta, gpointer header)
Update header from tensor meta.
tensor_format gst_tensor_get_format(const gchar *format_str)
Get tensor format from string input.
gboolean gst_tensors_info_validate(const GstTensorsInfo *info)
Check the tensors info is valid.
gboolean gst_tensor_meta_info_validate(GstTensorMetaInfo *meta)
Check the meta info is valid.
void gst_tensor_info_copy(GstTensorInfo *dest, const GstTensorInfo *src)
Copy tensor info.
void gst_tensors_info_init(GstTensorsInfo *info)
Initialize the tensors info structure.
gsize gst_tensor_meta_info_get_data_size(GstTensorMetaInfo *meta)
Get the data size calculated from tensor meta.
void gst_tensors_info_free(GstTensorsInfo *info)
Free allocated data in tensors info structure.
void nnstreamer_version_fetch(guint *major, guint *minor, guint *micro)
Get the version of NNStreamer (int, divided).
guint gst_tensor_parse_dimension(const gchar *dimstr, tensor_dim dim)
Parse tensor dimension parameter string.
gchar * gst_tensors_info_get_types_string(const GstTensorsInfo *info)
Get the string of types in tensors info.
gchar * gst_tensors_info_to_string(const GstTensorsInfo *info)
GstTensorsInfo represented as a string. Caller should free it.
enum _nns_tensor_type tensor_type
Possible data element types of other/tensor.
void gst_tensor_info_copy_n(GstTensorInfo *dest, const GstTensorInfo *src, const guint n)
Copy tensor info up to n elements.
gboolean gst_tensor_meta_info_parse_header(GstTensorMetaInfo *meta, gpointer header)
Parse header and fill the tensor meta.
guint gst_tensor_dimension_get_rank(const tensor_dim dim)
Get the rank of tensor dimension.
void gst_tensors_config_copy(GstTensorsConfig *dest, const GstTensorsConfig *src)
Copy tensors config.
gulong gst_tensor_get_element_count(const tensor_dim dim)
Count the number of elements of a tensor.
gsize gst_tensor_get_element_size(tensor_type type)
Get element size of tensor type (byte per element)
enum _tensor_format tensor_format
Data format of tensor stream in the pipeline.
void gst_tensors_config_free(GstTensorsConfig *config)
Free allocated data in tensors config structure.
const gchar * gst_tensor_get_format_string(tensor_format format)
Get tensor format string.
gboolean gst_tensor_info_convert_to_meta(GstTensorInfo *info, GstTensorMetaInfo *meta)
Convert GstTensorInfo structure to GstTensorMetaInfo.
gboolean gst_tensor_meta_info_convert(GstTensorMetaInfo *meta, GstTensorInfo *info)
Convert GstTensorMetaInfo structure to GstTensorInfo.
gchar * gst_tensor_get_dimension_string(const tensor_dim dim)
Get dimension string from given tensor dimension.
Internal data structure for configured tensors info (for other/tensors).
gchar * gst_tensors_config_to_string(const GstTensorsConfig *config)
Tensor config represented as a string. Caller should free it.
void gst_tensor_info_init(GstTensorInfo *info)
Initialize the tensor info structure.
Common header file for NNStreamer, the GStreamer plugin for neural networks.
gboolean gst_tensor_info_validate(const GstTensorInfo *info)
Check the tensor info is valid.
gsize gst_tensor_info_get_size(const GstTensorInfo *info)
Get data size of single tensor.
void gst_tensor_info_free(GstTensorInfo *info)
Free allocated data in tensor info structure.
gboolean gst_tensor_info_is_equal(const GstTensorInfo *i1, const GstTensorInfo *i2)
Compare tensor info.
void gst_tensor_meta_info_get_version(GstTensorMetaInfo *meta, guint *major, guint *minor)
Get the version of tensor meta.
GstTensorInfo * gst_tensors_info_get_nth_info(GstTensorsInfo *info, guint index)
Get the pointer of nth tensor information.
gsize gst_tensors_info_get_size(const GstTensorsInfo *info, gint index)
Get data size of single tensor.
gboolean gst_tensors_info_is_equal(const GstTensorsInfo *i1, const GstTensorsInfo *i2)
Compare tensors info.
gboolean gst_tensor_dimension_is_equal(const tensor_dim dim1, const tensor_dim dim2)
Compare the tensor dimension.
void gst_tensors_config_init(GstTensorsConfig *config)
Initialize the tensors config info structure (for other/tensors)
guint gst_tensor_info_get_rank(const GstTensorInfo *info)
Get tensor rank.
guint gst_tensors_info_parse_dimensions_string(GstTensorsInfo *info, const gchar *dim_string)
Parse the string of dimensions.
gboolean gst_tensors_config_validate(const GstTensorsConfig *config)
Check the tensors are all configured (for other/tensors)
gchar * gst_tensors_info_get_names_string(const GstTensorsInfo *info)
Get the string of tensor names in tensors info.
guint gst_tensor_dimension_get_min_rank(const tensor_dim dim)
Get the minimum rank of tensor dimension.
gchar * gst_tensors_info_get_dimensions_string(const GstTensorsInfo *info)
Get the string of dimensions in tensors info.
void gst_tensors_info_copy(GstTensorsInfo *dest, const GstTensorsInfo *src)
Copy tensor info.
void gst_tensor_meta_info_init(GstTensorMetaInfo *meta)
Initialize the tensor meta info structure.
gchar * gst_tensors_info_get_rank_dimensions_string(const GstTensorsInfo *info, const unsigned int rank)
Get the string of dimensions in tensors info and rank count.
guint gst_tensors_info_parse_types_string(GstTensorsInfo *info, const gchar *type_string)
Parse the string of types.
gsize gst_tensor_meta_info_get_header_size(GstTensorMetaInfo *meta)
Get the header size to handle a tensor meta.