Optional/Additional NNStreamer APIs for sub-plugin writers. (No GStreamer dependency) More...
Go to the source code of this file.
Macros | |
#define | _STR_NULL(str) ((str) ? (str) : "(NULL)") |
If the given string is NULL, print "(NULL)". Copied from GST_STR_NULL More... | |
#define | gst_tensors_config_is_static(c) ((c)->info.format == _NNS_TENSOR_FORMAT_STATIC) |
Macro to check stream format (static tensors for caps negotiation) More... | |
#define | gst_tensors_config_is_flexible(c) ((c)->info.format == _NNS_TENSOR_FORMAT_FLEXIBLE) |
Macro to check stream format (flexible tensors for caps negotiation) More... | |
#define | gst_tensors_config_is_sparse(c) ((c)->info.format == _NNS_TENSOR_FORMAT_SPARSE) |
Macro to check stream format (sparse tensors for caps negotiation) More... | |
Functions | |
void | gst_tensor_info_init (GstTensorInfo *info) |
Initialize the tensor info structure. More... | |
void | gst_tensor_info_free (GstTensorInfo *info) |
Free allocated data in tensor info structure. More... | |
gsize | gst_tensor_info_get_size (const GstTensorInfo *info) |
Get data size of single tensor. More... | |
gboolean | gst_tensor_info_validate (const GstTensorInfo *info) |
Check the tensor info is valid. More... | |
gboolean | gst_tensor_info_is_equal (const GstTensorInfo *i1, const GstTensorInfo *i2) |
Compare tensor info. More... | |
void | gst_tensor_info_copy_n (GstTensorInfo *dest, const GstTensorInfo *src, const guint n) |
Copy tensor info up to n elements. More... | |
void | gst_tensor_info_copy (GstTensorInfo *dest, const GstTensorInfo *src) |
Copy tensor info. More... | |
gboolean | gst_tensor_info_convert_to_meta (GstTensorInfo *info, GstTensorMetaInfo *meta) |
Convert GstTensorInfo structure to GstTensorMetaInfo. More... | |
guint | gst_tensor_info_get_rank (const GstTensorInfo *info) |
Get tensor rank. More... | |
GstTensorInfo * | gst_tensors_info_get_nth_info (GstTensorsInfo *info, guint index) |
Get the pointer of nth tensor information. More... | |
void | gst_tensors_info_init (GstTensorsInfo *info) |
Initialize the tensors info structure. More... | |
void | gst_tensors_info_free (GstTensorsInfo *info) |
Free allocated data in tensors info structure. More... | |
gsize | gst_tensors_info_get_size (const GstTensorsInfo *info, gint index) |
Get data size of single tensor. More... | |
guint | gst_tensors_info_parse_dimensions_string (GstTensorsInfo *info, const gchar *dim_string) |
Parse the string of dimensions. More... | |
guint | gst_tensors_info_parse_types_string (GstTensorsInfo *info, const gchar *type_string) |
Parse the string of types. More... | |
guint | gst_tensors_info_parse_names_string (GstTensorsInfo *info, const gchar *name_string) |
Parse the string of names. More... | |
gchar * | gst_tensors_info_get_dimensions_string (const GstTensorsInfo *info) |
Get the string of dimensions in tensors info. More... | |
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. More... | |
gchar * | gst_tensors_info_get_types_string (const GstTensorsInfo *info) |
Get the string of types in tensors info. More... | |
gchar * | gst_tensors_info_get_names_string (const GstTensorsInfo *info) |
Get the string of tensor names in tensors info. More... | |
gboolean | gst_tensors_info_validate (const GstTensorsInfo *info) |
Check the tensors info is valid. More... | |
gboolean | gst_tensors_info_is_equal (const GstTensorsInfo *i1, const GstTensorsInfo *i2) |
Compare tensors info. More... | |
void | gst_tensors_info_copy (GstTensorsInfo *dest, const GstTensorsInfo *src) |
Copy tensor info. More... | |
gchar * | gst_tensors_info_to_string (const GstTensorsInfo *info) |
GstTensorsInfo represented as a string. Caller should free it. More... | |
void | gst_tensors_config_init (GstTensorsConfig *config) |
Initialize the tensors config info structure (for other/tensors) More... | |
void | gst_tensors_config_free (GstTensorsConfig *config) |
Free allocated data in tensors config structure. More... | |
gboolean | gst_tensors_config_validate (const GstTensorsConfig *config) |
Check the tensors are all configured (for other/tensors) More... | |
gboolean | gst_tensors_config_is_equal (const GstTensorsConfig *c1, const GstTensorsConfig *c2) |
Compare tensor config info (for other/tensors) More... | |
void | gst_tensors_config_copy (GstTensorsConfig *dest, const GstTensorsConfig *src) |
Copy tensors config. More... | |
gchar * | gst_tensors_config_to_string (const GstTensorsConfig *config) |
Tensor config represented as a string. Caller should free it. More... | |
gboolean | gst_tensor_dimension_is_valid (const tensor_dim dim) |
Check the tensor dimension is valid. More... | |
gboolean | gst_tensor_dimension_is_equal (const tensor_dim dim1, const tensor_dim dim2) |
Compare the tensor dimension. More... | |
guint | gst_tensor_dimension_get_rank (const tensor_dim dim) |
Get the rank of tensor dimension. More... | |
guint | gst_tensor_dimension_get_min_rank (const tensor_dim dim) |
Get the minimum rank of tensor dimension. More... | |
guint | gst_tensor_parse_dimension (const gchar *dimstr, tensor_dim dim) |
Parse tensor dimension parameter string. More... | |
gchar * | gst_tensor_get_dimension_string (const tensor_dim dim) |
Get dimension string from given tensor dimension. More... | |
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. More... | |
gboolean | gst_tensor_dimension_string_is_equal (const gchar *dimstr1, const gchar *dimstr2) |
Compare dimension strings. More... | |
gulong | gst_tensor_get_element_count (const tensor_dim dim) |
Count the number of elements of a tensor. More... | |
gsize | gst_tensor_get_element_size (tensor_type type) |
Get element size of tensor type (byte per element) More... | |
tensor_type | gst_tensor_get_type (const gchar *typestr) |
Get tensor type from string input. More... | |
const gchar * | gst_tensor_get_type_string (tensor_type type) |
Get type string of tensor type. More... | |
tensor_format | gst_tensor_get_format (const gchar *format_str) |
Get tensor format from string input. More... | |
const gchar * | gst_tensor_get_format_string (tensor_format format) |
Get tensor format string. More... | |
gint | find_key_strv (const gchar **strv, const gchar *key) |
Find the index value of the given key string array. More... | |
void | gst_tensor_meta_info_init (GstTensorMetaInfo *meta) |
Initialize the tensor meta info structure. More... | |
void | gst_tensor_meta_info_get_version (GstTensorMetaInfo *meta, guint *major, guint *minor) |
Get the version of tensor meta. More... | |
gboolean | gst_tensor_meta_info_validate (GstTensorMetaInfo *meta) |
Check the meta info is valid. More... | |
gsize | gst_tensor_meta_info_get_header_size (GstTensorMetaInfo *meta) |
Get the header size to handle a tensor meta. More... | |
gsize | gst_tensor_meta_info_get_data_size (GstTensorMetaInfo *meta) |
Get the data size calculated from tensor meta. More... | |
gboolean | gst_tensor_meta_info_update_header (GstTensorMetaInfo *meta, gpointer header) |
Update header from tensor meta. More... | |
gboolean | gst_tensor_meta_info_parse_header (GstTensorMetaInfo *meta, gpointer header) |
Parse header and fill the tensor meta. More... | |
gboolean | gst_tensor_meta_info_convert (GstTensorMetaInfo *meta, GstTensorInfo *info) |
Convert GstTensorMetaInfo structure to GstTensorInfo. More... | |
gchar * | nnstreamer_version_string (void) |
Get the version of NNStreamer. More... | |
void | nnstreamer_version_fetch (guint *major, guint *minor, guint *micro) |
Get the version of NNStreamer (int, divided). More... | |
Optional/Additional NNStreamer APIs for sub-plugin writers. (No GStreamer dependency)
NNStreamer Common API Header for sub-plugin writers Copyright (C) 2022 Gichan Jang gicha n2.j ang@s amsu ng.co m
Definition in file nnstreamer_plugin_api_util.h.
#define _STR_NULL | ( | str | ) | ((str) ? (str) : "(NULL)") |
If the given string is NULL, print "(NULL)". Copied from GST_STR_NULL
Definition at line 26 of file nnstreamer_plugin_api_util.h.
#define gst_tensors_config_is_flexible | ( | c | ) | ((c)->info.format == _NNS_TENSOR_FORMAT_FLEXIBLE) |
Macro to check stream format (flexible tensors for caps negotiation)
Definition at line 279 of file nnstreamer_plugin_api_util.h.
#define gst_tensors_config_is_sparse | ( | c | ) | ((c)->info.format == _NNS_TENSOR_FORMAT_SPARSE) |
Macro to check stream format (sparse tensors for caps negotiation)
Definition at line 284 of file nnstreamer_plugin_api_util.h.
#define gst_tensors_config_is_static | ( | c | ) | ((c)->info.format == _NNS_TENSOR_FORMAT_STATIC) |
Macro to check stream format (static tensors for caps negotiation)
Definition at line 274 of file nnstreamer_plugin_api_util.h.
gint find_key_strv | ( | const gchar ** | strv, |
const gchar * | key | ||
) |
Find the index value of the given key string array.
strv | Null terminated array of gchar * |
key | The key string value |
strv | Null terminated array of gchar * |
key | The key string value |
Definition at line 1586 of file nnstreamer_plugin_api_util_impl.c.
guint gst_tensor_dimension_get_min_rank | ( | const tensor_dim | dim | ) |
Get the minimum rank of tensor dimension.
The C-arrays with dim 4:4:4 and 4:4:4:1 have same data. In this case, this function returns min rank 3.
dim | tensor dimension. |
Definition at line 1017 of file nnstreamer_plugin_api_util_impl.c.
guint gst_tensor_dimension_get_rank | ( | const tensor_dim | dim | ) |
Get the rank of tensor dimension.
dim | tensor dimension. |
dim | tensor dimension. |
Definition at line 998 of file nnstreamer_plugin_api_util_impl.c.
gboolean gst_tensor_dimension_is_equal | ( | const tensor_dim | dim1, |
const tensor_dim | dim2 | ||
) |
Compare the tensor dimension.
Definition at line 972 of file nnstreamer_plugin_api_util_impl.c.
gboolean gst_tensor_dimension_is_valid | ( | const tensor_dim | dim | ) |
Check the tensor dimension is valid.
dim | tensor dimension |
Definition at line 940 of file nnstreamer_plugin_api_util_impl.c.
gboolean gst_tensor_dimension_string_is_equal | ( | const gchar * | dimstr1, |
const gchar * | dimstr2 | ||
) |
Compare dimension strings.
Definition at line 1140 of file nnstreamer_plugin_api_util_impl.c.
gchar* gst_tensor_get_dimension_string | ( | const tensor_dim | dim | ) |
Get dimension string from given tensor dimension.
dim | tensor dimension |
Definition at line 1083 of file nnstreamer_plugin_api_util_impl.c.
gulong gst_tensor_get_element_count | ( | const tensor_dim | dim | ) |
Count the number of elements of a tensor.
dim | The tensor dimension |
Definition at line 1186 of file nnstreamer_plugin_api_util_impl.c.
gsize gst_tensor_get_element_size | ( | tensor_type | type | ) |
Get element size of tensor type (byte per element)
Definition at line 1205 of file nnstreamer_plugin_api_util_impl.c.
tensor_format gst_tensor_get_format | ( | const gchar * | format_str | ) |
Get tensor format from string input.
format_str | The string format name, supposed to be one of tensor_format_name[]. |
Definition at line 1309 of file nnstreamer_plugin_api_util_impl.c.
const gchar* gst_tensor_get_format_string | ( | tensor_format | format | ) |
Get tensor format string.
Definition at line 1325 of file nnstreamer_plugin_api_util_impl.c.
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.
dim | tensor dimension |
rank | rank count of given tensor dimension |
Definition at line 1107 of file nnstreamer_plugin_api_util_impl.c.
tensor_type gst_tensor_get_type | ( | const gchar * | typestr | ) |
Get tensor type from string input.
typestr | The string type name, supposed to be one of tensor_element_typename[] |
Definition at line 1218 of file nnstreamer_plugin_api_util_impl.c.
const gchar* gst_tensor_get_type_string | ( | tensor_type | type | ) |
Get type string of tensor type.
Definition at line 1296 of file nnstreamer_plugin_api_util_impl.c.
gboolean gst_tensor_info_convert_to_meta | ( | GstTensorInfo * | info, |
GstTensorMetaInfo * | meta | ||
) |
Convert GstTensorInfo structure to GstTensorMetaInfo.
[in] | info | GstTensorInfo to be converted |
[out] | meta | tensor meta structure to be filled |
Definition at line 260 of file nnstreamer_plugin_api_util_impl.c.
void gst_tensor_info_copy | ( | GstTensorInfo * | dest, |
const GstTensorInfo * | src | ||
) |
Copy tensor info.
Definition at line 248 of file nnstreamer_plugin_api_util_impl.c.
void gst_tensor_info_copy_n | ( | GstTensorInfo * | dest, |
const GstTensorInfo * | src, | ||
const guint | n | ||
) |
Copy tensor info up to n elements.
Definition at line 227 of file nnstreamer_plugin_api_util_impl.c.
void gst_tensor_info_free | ( | GstTensorInfo * | info | ) |
Free allocated data in tensor info structure.
info | tensor info structure |
Definition at line 140 of file nnstreamer_plugin_api_util_impl.c.
guint gst_tensor_info_get_rank | ( | const GstTensorInfo * | info | ) |
Get tensor rank.
info | tensor info structure |
Definition at line 285 of file nnstreamer_plugin_api_util_impl.c.
gsize gst_tensor_info_get_size | ( | const GstTensorInfo * | info | ) |
Get data size of single tensor.
info | tensor info structure |
Definition at line 156 of file nnstreamer_plugin_api_util_impl.c.
void gst_tensor_info_init | ( | GstTensorInfo * | info | ) |
Initialize the tensor info structure.
info | tensor info structure to be initialized |
Definition at line 121 of file nnstreamer_plugin_api_util_impl.c.
gboolean gst_tensor_info_is_equal | ( | const GstTensorInfo * | i1, |
const GstTensorInfo * | i2 | ||
) |
Compare tensor info.
Definition at line 197 of file nnstreamer_plugin_api_util_impl.c.
gboolean gst_tensor_info_validate | ( | const GstTensorInfo * | info | ) |
Check the tensor info is valid.
info | tensor info structure |
Definition at line 174 of file nnstreamer_plugin_api_util_impl.c.
gboolean gst_tensor_meta_info_convert | ( | GstTensorMetaInfo * | meta, |
GstTensorInfo * | info | ||
) |
Convert GstTensorMetaInfo structure to GstTensorInfo.
[in] | meta | tensor meta structure to be converted |
[out] | info | GstTensorInfo to be filled |
Definition at line 1562 of file nnstreamer_plugin_api_util_impl.c.
gsize gst_tensor_meta_info_get_data_size | ( | GstTensorMetaInfo * | meta | ) |
Get the data size calculated from tensor meta.
[in] | meta | tensor meta structure |
Definition at line 1477 of file nnstreamer_plugin_api_util_impl.c.
gsize gst_tensor_meta_info_get_header_size | ( | GstTensorMetaInfo * | meta | ) |
Get the header size to handle a tensor meta.
[in] | meta | tensor meta structure |
Definition at line 1456 of file nnstreamer_plugin_api_util_impl.c.
void gst_tensor_meta_info_get_version | ( | GstTensorMetaInfo * | meta, |
guint * | major, | ||
guint * | minor | ||
) |
Get the version of tensor meta.
[in] | meta | tensor meta structure |
[out] | major | pointer to get the major version number |
[out] | minor | pointer to get the minor version number |
Definition at line 1393 of file nnstreamer_plugin_api_util_impl.c.
void gst_tensor_meta_info_init | ( | GstTensorMetaInfo * | meta | ) |
Initialize the tensor meta info structure.
[in,out] | meta | tensor meta structure to be initialized |
Definition at line 1372 of file nnstreamer_plugin_api_util_impl.c.
gboolean gst_tensor_meta_info_parse_header | ( | GstTensorMetaInfo * | meta, |
gpointer | header | ||
) |
Parse header and fill the tensor meta.
[out] | meta | tensor meta structure to be filled |
[in] | header | pointer to header to be parsed |
Definition at line 1527 of file nnstreamer_plugin_api_util_impl.c.
gboolean gst_tensor_meta_info_update_header | ( | GstTensorMetaInfo * | meta, |
gpointer | header | ||
) |
Update header from tensor meta.
[in] | meta | tensor meta structure |
[out] | header | pointer to header to be updated |
Definition at line 1505 of file nnstreamer_plugin_api_util_impl.c.
gboolean gst_tensor_meta_info_validate | ( | GstTensorMetaInfo * | meta | ) |
Check the meta info is valid.
[in] | meta | tensor meta structure |
Definition at line 1414 of file nnstreamer_plugin_api_util_impl.c.
guint gst_tensor_parse_dimension | ( | const gchar * | dimstr, |
tensor_dim | dim | ||
) |
Parse tensor dimension parameter string.
dimstr | The dimension string in the format of d1:...:d16, d1:d2:d3, d1:d2, or d1, where dN is a positive integer and d1 is the innermost dimension; i.e., dim[d16]...[d1]; |
dim | dimension to be filled. |
Definition at line 1040 of file nnstreamer_plugin_api_util_impl.c.
void gst_tensors_config_copy | ( | GstTensorsConfig * | dest, |
const GstTensorsConfig * | src | ||
) |
Copy tensors config.
Definition at line 904 of file nnstreamer_plugin_api_util_impl.c.
void gst_tensors_config_free | ( | GstTensorsConfig * | config | ) |
Free allocated data in tensors config structure.
config | tensors config structure |
Definition at line 845 of file nnstreamer_plugin_api_util_impl.c.
void gst_tensors_config_init | ( | GstTensorsConfig * | config | ) |
Initialize the tensors config info structure (for other/tensors)
config | tensors config structure to be initialized |
Definition at line 830 of file nnstreamer_plugin_api_util_impl.c.
gboolean gst_tensors_config_is_equal | ( | const GstTensorsConfig * | c1, |
const GstTensorsConfig * | c2 | ||
) |
Compare tensor config info (for other/tensors)
TRUE | if equal |
Compare tensor config info (for other/tensors)
TRUE | if equal |
Definition at line 881 of file nnstreamer_plugin_api_util_impl.c.
gchar* gst_tensors_config_to_string | ( | const GstTensorsConfig * | config | ) |
Tensor config represented as a string. Caller should free it.
config | tensor config structure |
Definition at line 920 of file nnstreamer_plugin_api_util_impl.c.
gboolean gst_tensors_config_validate | ( | const GstTensorsConfig * | config | ) |
Check the tensors are all configured (for other/tensors)
config | tensor config structure |
Check the tensors are all configured (for other/tensors)
config | tensor config structure |
Definition at line 858 of file nnstreamer_plugin_api_util_impl.c.
void gst_tensors_info_copy | ( | GstTensorsInfo * | dest, |
const GstTensorsInfo * | src | ||
) |
Copy tensor info.
Definition at line 502 of file nnstreamer_plugin_api_util_impl.c.
void gst_tensors_info_free | ( | GstTensorsInfo * | info | ) |
Free allocated data in tensors info structure.
info | tensors info structure |
Definition at line 347 of file nnstreamer_plugin_api_util_impl.c.
gchar* gst_tensors_info_get_dimensions_string | ( | const GstTensorsInfo * | info | ) |
Get the string of dimensions in tensors info.
info | tensors info structure |
Definition at line 661 of file nnstreamer_plugin_api_util_impl.c.
gchar* gst_tensors_info_get_names_string | ( | const GstTensorsInfo * | info | ) |
Get the string of tensor names in tensors info.
info | tensors info structure |
Definition at line 749 of file nnstreamer_plugin_api_util_impl.c.
GstTensorInfo* gst_tensors_info_get_nth_info | ( | GstTensorsInfo * | info, |
guint | index | ||
) |
Get the pointer of nth tensor information.
info | tensors info structure |
index | the index of tensor to be fetched |
Definition at line 296 of file nnstreamer_plugin_api_util_impl.c.
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.
info | tensors info structure |
rank | rank count of given tensor dimension |
Definition at line 676 of file nnstreamer_plugin_api_util_impl.c.
gsize gst_tensors_info_get_size | ( | const GstTensorsInfo * | info, |
gint | index | ||
) |
Get data size of single tensor.
info | tensors info structure |
index | the index of tensor (-1 to get total size of tensors) |
Definition at line 376 of file nnstreamer_plugin_api_util_impl.c.
gchar* gst_tensors_info_get_types_string | ( | const GstTensorsInfo * | info | ) |
Get the string of types in tensors info.
info | tensors info structure |
Definition at line 714 of file nnstreamer_plugin_api_util_impl.c.
void gst_tensors_info_init | ( | GstTensorsInfo * | info | ) |
Initialize the tensors info structure.
info | tensors info structure to be initialized |
Definition at line 325 of file nnstreamer_plugin_api_util_impl.c.
gboolean gst_tensors_info_is_equal | ( | const GstTensorsInfo * | i1, |
const GstTensorsInfo * | i2 | ||
) |
Compare tensors info.
Definition at line 454 of file nnstreamer_plugin_api_util_impl.c.
guint gst_tensors_info_parse_dimensions_string | ( | GstTensorsInfo * | info, |
const gchar * | dim_string | ||
) |
Parse the string of dimensions.
info | tensors info structure |
dim_string | string of dimensions |
Definition at line 532 of file nnstreamer_plugin_api_util_impl.c.
guint gst_tensors_info_parse_names_string | ( | GstTensorsInfo * | info, |
const gchar * | name_string | ||
) |
Parse the string of names.
info | tensors info structure |
name_string | string of names |
Definition at line 612 of file nnstreamer_plugin_api_util_impl.c.
guint gst_tensors_info_parse_types_string | ( | GstTensorsInfo * | info, |
const gchar * | type_string | ||
) |
Parse the string of types.
info | tensors info structure |
type_string | string of types |
Definition at line 572 of file nnstreamer_plugin_api_util_impl.c.
gchar* gst_tensors_info_to_string | ( | const GstTensorsInfo * | info | ) |
GstTensorsInfo represented as a string. Caller should free it.
info | GstTensorsInfo structure |
Definition at line 783 of file nnstreamer_plugin_api_util_impl.c.
gboolean gst_tensors_info_validate | ( | const GstTensorsInfo * | info | ) |
Check the tensors info is valid.
info | tensors info structure |
Definition at line 404 of file nnstreamer_plugin_api_util_impl.c.
void nnstreamer_version_fetch | ( | guint * | major, |
guint * | minor, | ||
guint * | micro | ||
) |
Get the version of NNStreamer (int, divided).
[out] | major | MAJOR.minor.micro, won't set if it's null. |
[out] | minor | major.MINOR.micro, won't set if it's null. |
[out] | micro | major.minor.MICRO, won't set if it's null. |
Definition at line 1624 of file nnstreamer_plugin_api_util_impl.c.
gchar* nnstreamer_version_string | ( | void | ) |
Get the version of NNStreamer.
Get the version of NNStreamer.
Definition at line 1609 of file nnstreamer_plugin_api_util_impl.c.