Doxygen Book
tensor_filter_custom.h File Reference

Custom tensor post-processing interface for NNStreamer suite for post-processing code developers. More...

#include <stdint.h>
#include "tensor_typedef.h"
#include "nnstreamer_plugin_api_filter.h"
Include dependency graph for tensor_filter_custom.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _NNStreamer_custom_class
 Custom Filter Class. More...
 

Typedefs

typedef void *(* NNS_custom_init_func) (const GstTensorFilterProperties *prop)
 A function that is called before calling other functions. More...
 
typedef void(* NNS_custom_exit_func) (void *private_data, const GstTensorFilterProperties *prop)
 A function that is called after calling other functions, when it's ready to close. More...
 
typedef int(* NNS_custom_get_input_dimension) (void *private_data, const GstTensorFilterProperties *prop, GstTensorsInfo *info)
 Get input tensor type. More...
 
typedef int(* NNS_custom_get_output_dimension) (void *private_data, const GstTensorFilterProperties *prop, GstTensorsInfo *info)
 Get output tensor type. More...
 
typedef int(* NNS_custom_set_input_dimension) (void *private_data, const GstTensorFilterProperties *prop, const GstTensorsInfo *in_info, GstTensorsInfo *out_info)
 Set input dim by framework. Let custom plugin set output dim accordingly. More...
 
typedef int(* NNS_custom_invoke) (void *private_data, const GstTensorFilterProperties *prop, const GstTensorMemory *input, GstTensorMemory *output)
 Invoke the "main function". Without allocating output buffer. (fill in the given output buffer) More...
 
typedef int(* NNS_custom_allocate_invoke) (void *private_data, const GstTensorFilterProperties *prop, const GstTensorMemory *input, GstTensorMemory *output)
 Invoke the "main function". Without allocating output buffer. (fill in the given output buffer) More...
 
typedef void(* NNS_custom_destroy_notify) (void *data)
 It's a post-processing method about the used data pointer if it has been allocated at custom filter. More...
 
typedef struct _NNStreamer_custom_class NNStreamer_custom_class
 

Variables

NNStreamer_custom_classNNStreamer_custom
 A custom filter MUST define NNStreamer_custom. This object represents the custom filter itself. More...
 

Detailed Description

Custom tensor post-processing interface for NNStreamer suite for post-processing code developers.

GStreamer Tensor_Filter, Customized Module Copyright (C) 2018 MyungJoo Ham myung.nosp@m.joo..nosp@m.ham@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; version 2.1 of the License.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

Date
01 Jun 2018
See also
http://github.com/nnstreamer/nnstreamer
Author
MyungJoo Ham myung.nosp@m.joo..nosp@m.ham@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m
Bug:
No known bugs except for NYI items

How To for NNdevelopers:

  1. Define struct, "NNStreamer_custom", with the functions defined.
  2. Compile as a shared object. (.so in Linux)
  3. Use NNStreamer (tensor_filter framework=custom, model=FILEPATH_OF_YOUR_SO.so, ...)

To Packagers:

This file is to be packaged as "devel" package for NN developers.

Definition in file tensor_filter_custom.h.

Typedef Documentation

◆ NNS_custom_allocate_invoke

typedef int(* NNS_custom_allocate_invoke) (void *private_data, const GstTensorFilterProperties *prop, const GstTensorMemory *input, GstTensorMemory *output)

Invoke the "main function". Without allocating output buffer. (fill in the given output buffer)

Parameters
[in]private_dataThe pointer returned by NNStreamer_custom_init.
[in]propGstTensorFilter's property values. Do not change its values.
[in]inputThe array of input tensors, each tensor size = dim_1 x dim_2 x .. x dim_n x typesize, allocated by caller
[out]outputThe array of output tensors, each tensor size = dim_1 x dim_2 x .. x dim_n x typesize, the memory block for output tensor should be allocated. (data in GstTensorMemory)
Note
rank limit (NNS_TENSOR_RANK_LIMIT) and typesize (tensor_element_size) defined in tensor_typedef.h
Returns
0 if success

Definition at line 111 of file tensor_filter_custom.h.

◆ NNS_custom_destroy_notify

typedef void(* NNS_custom_destroy_notify) (void *data)

It's a post-processing method about the used data pointer if it has been allocated at custom filter.

Parameters
[in]datathe data element.

Definition at line 118 of file tensor_filter_custom.h.

◆ NNS_custom_exit_func

typedef void(* NNS_custom_exit_func) (void *private_data, const GstTensorFilterProperties *prop)

A function that is called after calling other functions, when it's ready to close.

Parameters
[in]private_dataIf you have allocated *private_data at init, free it here.
[in]propGstTensorFilter's property values. Do not change its values.

Definition at line 53 of file tensor_filter_custom.h.

◆ NNS_custom_get_input_dimension

typedef int(* NNS_custom_get_input_dimension) (void *private_data, const GstTensorFilterProperties *prop, GstTensorsInfo *info)

Get input tensor type.

Parameters
[in]private_dataThe pointer returned by NNStreamer_custom_init.
[in]propGstTensorFilter's property values. Do not change its values.
[out]infoStructure for tensor info.
Returns
0 if success

Definition at line 63 of file tensor_filter_custom.h.

◆ NNS_custom_get_output_dimension

typedef int(* NNS_custom_get_output_dimension) (void *private_data, const GstTensorFilterProperties *prop, GstTensorsInfo *info)

Get output tensor type.

Parameters
[in]private_dataThe pointer returned by NNStreamer_custom_init.
[in]propGstTensorFilter's property values. Do not change its values.
[out]infoStructure for tensor info.
Returns
0 if success

Definition at line 73 of file tensor_filter_custom.h.

◆ NNS_custom_init_func

typedef void*(* NNS_custom_init_func) (const GstTensorFilterProperties *prop)

A function that is called before calling other functions.

Parameters
[in]propGstTensorFilter's property values. Do not change its values.
Returns
The returned pointer will be passed to other functions as "private_data".

Definition at line 46 of file tensor_filter_custom.h.

◆ NNS_custom_invoke

typedef int(* NNS_custom_invoke) (void *private_data, const GstTensorFilterProperties *prop, const GstTensorMemory *input, GstTensorMemory *output)

Invoke the "main function". Without allocating output buffer. (fill in the given output buffer)

Parameters
[in]private_dataThe pointer returned by NNStreamer_custom_init.
[in]propGstTensorFilter's property values. Do not change its values.
[in]inputThe array of input tensors, each tensor size = dim_1 x dim_2 x .. x dim_n x typesize, allocated by caller
[out]outputThe array of output tensors, each tensor size = dim_1 x dim_2 x .. x dim_n x typesize, allocated by caller
Note
rank limit (NNS_TENSOR_RANK_LIMIT) and typesize (tensor_element_size) defined in tensor_typedef.h
Returns
0 if success

Definition at line 99 of file tensor_filter_custom.h.

◆ NNS_custom_set_input_dimension

typedef int(* NNS_custom_set_input_dimension) (void *private_data, const GstTensorFilterProperties *prop, const GstTensorsInfo *in_info, GstTensorsInfo *out_info)

Set input dim by framework. Let custom plugin set output dim accordingly.

Parameters
[in]private_dataThe pointer returned by NNStreamer_custom_init.
[in]propGstTensorFilter's property values. Do not change its values.
[in]in_infoInput tensor info designated by the GStreamer framework. Note that this is not a fixed value and GStreamer may try different values during pad-cap negotiations.
[out]out_infoOutput tensor info according to the input tensor info.

@caution Do not fix internal values based on this call. GStreamer may call this function repeatedly with different values during pad-cap negotiations. Fix values when invoke is finally called.

Definition at line 87 of file tensor_filter_custom.h.

◆ NNStreamer_custom_class

Definition at line 136 of file tensor_filter_custom.h.

Variable Documentation

◆ NNStreamer_custom

NNStreamer_custom_class* NNStreamer_custom

A custom filter MUST define NNStreamer_custom. This object represents the custom filter itself.