Go to the documentation of this file.
41 static const gchar *custom_accl_support[] = {
69 if (*private_data != NULL) {
71 ml_loge (
"Init is called but it is already initialized.\n");
75 if (!
prop->model_files ||
prop->num_models != 1 ||
76 !
prop->model_files[0] ||
prop->model_files[0][0] ==
'\0') {
78 ml_logw (
"Custom filter file is not given.\n");
83 prop->model_files[0])) {
85 ml_logw (
"Custom filter file %s is invalid.\n",
prop->model_files[0]);
91 ml_loge (
"Failed to allocate memory for custom filter.\n");
96 ptr->
module = g_module_open (
prop->model_files[0], 0);
100 ml_logw (
"Cannot load custom filter file %s.\n",
prop->model_files[0]);
104 if (!g_module_symbol (ptr->
module,
"NNStreamer_custom", &custom_cls)) {
105 ml_loge (
"tensor_filter_custom:loadlib error: %s\n", g_module_error ());
106 g_module_close (ptr->
module);
108 *private_data = NULL;
115 ml_loge (
"tensor_filter_custom (%s) requires a valid 'initfunc'.",
116 prop->model_files[0]);
129 (
"tensor_filter_custom (%s) requires input/output dimension callbacks.",
130 prop->model_files[0]);
154 (
"An invoke callback is not given or both invoke functions are given. Cannot load %s.\n",
155 prop->model_files[0]);
173 g_return_val_if_fail (*private_data != NULL, -EINVAL);
174 g_return_val_if_fail (input != NULL, -EINVAL);
175 g_return_val_if_fail (output != NULL, -EINVAL);
183 prop, input, output);
199 g_return_val_if_fail (ptr != NULL, -EINVAL);
200 g_return_val_if_fail (info != NULL, -EINVAL);
218 g_return_val_if_fail (ptr != NULL, -EINVAL);
219 g_return_val_if_fail (info != NULL, -EINVAL);
237 g_return_val_if_fail (ptr != NULL, -EINVAL);
238 g_return_val_if_fail (in_info != NULL, -EINVAL);
239 g_return_val_if_fail (out_info != NULL, -EINVAL);
245 prop, in_info, out_info);
256 g_return_if_fail (ptr != NULL);
260 *private_data = NULL;
311 .allow_in_place =
FALSE,
312 .allocate_in_invoke =
TRUE,
313 .run_without_model =
FALSE,
accl_hw
acceleration hw properties.
static int custom_loadlib(const GstTensorFilterProperties *prop, void **private_data)
Load the custom library. Will skip loading if it's already loaded.
static void custom_destroyNotify(void **private_data, void *data)
The optional callback for GstTensorFilterFramework.
NNS_custom_exit_func exitfunc
void nnstreamer_filter_exit(const char *name)
Filter's sub-plugin may call this to unregister itself.
static int custom_open(const GstTensorFilterProperties *prop, void **private_data)
The open callback for GstTensorFilterFramework. Called before anything else.
Internal header for conf/env-var management.
Internal meta data exchange format for a other/tensors instance.
NNS_custom_get_input_dimension getInputDim
GstTensorSrcIIOChannelProperties * prop
DTYPE_UNSIGNED ( .
Internal log util for NNStreamer plugins and native APIs.
The unit of each data tensors. It will be used as an input/output tensor of other/tensors.
Tensor_Filter Subplugin definition.
static GstTensorFilterFramework NNS_support_custom
void * customFW_private_data
g_free(self->option[(opnum) - 1])
opnum: \
static int custom_getInputDim(const GstTensorFilterProperties *prop, void **private_data, GstTensorsInfo *info)
The optional callback for GstTensorFilterFramework.
NNS_custom_init_func initfunc
__attribute__((__format__(__printf__, 1, 2)))
overwrites the error message buffer with the new message.
gboolean nnsconf_validate_file(nnsconf_type_path type, const gchar *fullpath)
Public function to validate sub-plugin library is available.
@ NNSCONF_PATH_CUSTOM_FILTERS
#define GST_TENSOR_FILTER_FRAMEWORK_V0
const char * get_accl_hw_str(const accl_hw key)
return string based on accl_hw type
Custom tensor post-processing interface for NNStreamer suite for post-processing code developers.
void init_filter_custom(void)
Initialize this object for tensor_filter subplugin runtime register.
static gchar filter_subplugin_custom[]
static int custom_getOutputDim(const GstTensorFilterProperties *prop, void **private_data, GstTensorsInfo *info)
The optional callback for GstTensorFilterFramework.
Mandatory APIs for NNStreamer Filter sub-plugins (No External Dependencies)
int nnstreamer_filter_probe(GstTensorFilterFramework *tfsp)
Filter's sub-plugin should call this function to register itself.
GstTensorFilter's properties for NN framework (internal data structure)
static int custom_setInputDim(const GstTensorFilterProperties *prop, void **private_data, const GstTensorsInfo *in_info, GstTensorsInfo *out_info)
The set-input-dim callback for GstTensorFilterFramework.
static int custom_checkAvailability(accl_hw hw)
Check support of the backend.
NNS_custom_get_output_dimension getOutputDim
NNS_custom_allocate_invoke allocate_invoke
NNS_custom_destroy_notify destroy_notify
NNStreamer_custom_class * methods
static int custom_invoke(const GstTensorFilterProperties *prop, void **private_data, const GstTensorMemory *input, GstTensorMemory *output)
The mandatory callback for GstTensorFilterFramework.
static void custom_close(const GstTensorFilterProperties *prop, void **private_data)
Free privateData and move on.
void fini_filter_custom(void)
Destruct the subplugin.
static int custom_allocateInInvoke(void **private_data)
The optional callback for GstTensorFilterFramework.
NNS_custom_set_input_dimension setInputDim