NVIDIA DeepStream SDK API Reference

7.0 Release
gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 
28 #ifndef __NVDSPREPROCESS_INTERFACE_H__
29 #define __NVDSPREPROCESS_INTERFACE_H__
30 
31 #include <cuda.h>
32 #include <cuda_runtime.h>
33 #include "nvbufsurface.h"
34 #include "nvbufsurftransform.h"
35 #include "gstnvdsmeta.h"
36 
37 #include "nvds_roi_meta.h"
38 #include "nvtx3/nvToolsExt.h"
39 #include <unordered_map>
40 
44 typedef struct CustomCtx CustomCtx;
45 
49 typedef enum
50 {
75 
81 typedef enum
82 {
90 
94 typedef enum
95 {
110 
116 typedef struct
117 {
125 
129 typedef struct
130 {
135  std::vector<int> network_input_shape;
139  guint64 buffer_size = 1;
145  std::string tensor_name;
147 
151 typedef struct
152 {
154  unsigned int width;
156  unsigned int height;
158  unsigned int channels;
160 
164 typedef struct
165 {
167  std::vector<NvDsRoiMeta> roi_vector;
169 
173 typedef struct
174 {
180 
184 typedef struct
185 {
187  guint unique_id;
191  std::unordered_map <std::string, std::string> user_configs;
195 
200 {
202  void *memory_ptr;
203 };
204 
210 {
211 public:
213  virtual NvDsPreProcessCustomBuf *acquire() = 0;
215  virtual gboolean release(NvDsPreProcessCustomBuf *) = 0;
216 };
217 
221 typedef struct
222 {
224  NvDsObjectMeta *obj_meta = nullptr;
226  NvDsFrameMeta *frame_meta = nullptr;
229  guint batch_index = 0;
231  gulong frame_num = 0;
233  NvBufSurfaceParams *input_surf_params = nullptr;
238  gpointer converted_frame_ptr = nullptr;
241 
243 
247 typedef struct
248 {
250  std::vector<NvDsPreProcessUnit> units;
252  std::vector<NvBufSurfTransformSyncObj_t> sync_objects;
254  GstBuffer *inbuf = nullptr;
256  gulong inbuf_batch_num = 0;
261  gboolean push_buffer = FALSE;
265  gboolean event_marker = FALSE;
267  GstBuffer *converted_buf = nullptr;
273  uint32_t pitch;
275  nvtxRangeId_t nvtx_complete_buf_range = 0;
277 
278 #endif //__NVDSPREPROCESS_INTERFACE_H__
279 
NvDsPreProcessFormat_Unknown
@ NvDsPreProcessFormat_Unknown
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:108
NvDsPreProcessTensorParams::data_type
NvDsDataType data_type
DataType for tensor formation.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:141
CustomInitParams
Custom Initialization parameter for custom library.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:184
NvDsPreProcessTensorParams::network_input_order
NvDsPreProcessNetworkInputOrder network_input_order
network order at which model will work
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:132
NvBufSurfTransformSyncObj_t
struct NvBufSurfTransformSyncObj * NvBufSurfTransformSyncObj_t
Holds the information about synchronization objects for asynchronous transform/composite APIs.
Definition: nvbufsurftransform.h:287
NVDSPREPROCESS_CUSTOM_LIB_FAILED
@ NVDSPREPROCESS_CUSTOM_LIB_FAILED
Custom Library interface implementation failed.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:57
NvDsPreProcessAcquirer::release
virtual gboolean release(NvDsPreProcessCustomBuf *)=0
method to release buffer from buffer pool
NvDsPreProcessUnit::roi_meta
NvDsRoiMeta roi_meta
New meta for rois provided.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:240
NVDSPREPROCESS_CONFIG_FAILED
@ NVDSPREPROCESS_CONFIG_FAILED
Failed to configure the tensor_impl instance possibly due to an erroneous initialization property.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:55
_NvBufSurfaceTransformParams
Holds transform parameters for a transform call.
Definition: nvbufsurftransform.h:190
NvDsPreProcessFormat_RGB
@ NvDsPreProcessFormat_RGB
Specifies 24-bit interleaved R-G-B format.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:97
NvDsPreProcessNetworkInputOrder_kNHWC
@ NvDsPreProcessNetworkInputOrder_kNHWC
Specifies NHWC network input order.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:86
NvDsPreProcessNetworkSize
Holds information about the model network.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:151
NVDSPREPROCESS_TENSOR_NOT_READY
@ NVDSPREPROCESS_TENSOR_NOT_READY
Tensor Yet not ready to be attached as meta.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:73
NVDSPREPROCESS_RESOURCE_ERROR
@ NVDSPREPROCESS_RESOURCE_ERROR
Resource error was encountered.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:71
NvDsPreProcessBatch::batch_meta
NvDsBatchMeta * batch_meta
Deepstream batch meta.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:271
NvDsPreProcessBatch
Holds information about the batch of frames to be inferred.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:247
NvDsPreProcessFormat_RGBA
@ NvDsPreProcessFormat_RGBA
Specifies 32-bit interleaved R-G-B-A format.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:103
NvDsPreProcessNetworkSize::height
unsigned int height
Holds the input height for the model.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:156
NvDsPreProcessFormat_GRAY
@ NvDsPreProcessFormat_GRAY
Specifies 8-bit Luma format.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:101
CustomInitParams::user_configs
std::unordered_map< std::string, std::string > user_configs
User config map key-value pair.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:191
NVDSPREPROCESS_INVALID_PARAMS
@ NVDSPREPROCESS_INVALID_PARAMS
Invalid parameters were supplied.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:63
NvDsPreProcessStatus
NvDsPreProcessStatus
Enum for the status codes returned by NvDsPreProcessImpl.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:49
CustomTransformParams
custom transformation parameter for calling nvbufsurftransform api for scaling and converting the ROI...
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:116
NVDSPREPROCESS_SUCCESS
@ NVDSPREPROCESS_SUCCESS
NvDsPreprocess operation succeeded.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:52
NvDsPreProcessTensorParams::network_color_format
NvDsPreProcessFormat network_color_format
Holds the network input format.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:137
CustomSeqProcTensorParams::roi_vector
std::vector< NvDsRoiMeta > roi_vector
vector of rois which can be modified by custom lib
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:167
NvDsPreProcessBatch::sync_objects
std::vector< NvBufSurfTransformSyncObj_t > sync_objects
Vector of sync objects for async transformation of the batch.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:252
_NvBufSurfTransformConfigParams
Holds configuration parameters for a transform/composite session.
Definition: nvbufsurftransform.h:172
NvDsPreProcessTensorParams::memory_type
NvBufSurfaceMemType memory_type
Memory Type for tensor formation.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:143
CustomTensorParams::seq_params
CustomSeqProcTensorParams seq_params
Additional Custom Parameters.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:178
NvBufSurfaceParams
Hold the information of single buffer in the batch.
Definition: nvbufsurface.h:476
NvDsPreProcessFormat_Tensor
@ NvDsPreProcessFormat_Tensor
NCHW planar.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:107
NvDsPreProcessBatch::pitch
uint32_t pitch
Holds the pitch of the buffer.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:273
NVDSPREPROCESS_CUSTOM_TENSOR_FAILED
@ NVDSPREPROCESS_CUSTOM_TENSOR_FAILED
Custom Tensor Preparation failed.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:61
NvDsPreProcessUnit
A preprocess unit for processing which can be Frame/ROI.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:221
NvDsPreProcessNetworkSize::width
unsigned int width
Holds the input width for the model.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:154
CustomTransformParams::transform_config_params
NvBufSurfTransformConfigParams transform_config_params
transform config params for nvbufsurftransform api
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:119
_NvDsBatchMeta
Holds information about a formed batch containing frames from different sources.
Definition: nvdsmeta.h:241
gstnvdsmeta.h
NVDSPREPROCESS_TENSORRT_ERROR
@ NVDSPREPROCESS_TENSORRT_ERROR
TensorRT interface failed.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:69
CustomTensorParams
Tensor params passed to custom library for tensor preparation.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:173
NvDsPreProcessBatch::units
std::vector< NvDsPreProcessUnit > units
Vector of units in the batch.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:250
NVDSPREPROCESS_CUSTOM_TRANSFORMATION_FAILED
@ NVDSPREPROCESS_CUSTOM_TRANSFORMATION_FAILED
Custom Group Transformation failed.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:59
NvDsPreProcessBatch::scaling_pool_format
NvDsPreProcessFormat scaling_pool_format
scaling pool color format
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:269
NvDsPreProcessCustomBuf
Custom Buffer passed to the custom lib for preparing tensor.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:199
NvDsPreProcessAcquirer
class for acquiring and releasing a buffer from tensor pool by custom lib.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:209
NvBufSurfaceMemType
NvBufSurfaceMemType
Specifies memory types for NvBufSurface.
Definition: nvbufsurface.h:306
NvDsPreProcessTensorParams::network_input_shape
std::vector< int > network_input_shape
Hold the network shape - interpreted based on network input order For resnet10 : NCHW = infer-batch-s...
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:135
CustomInitParams::tensor_params
NvDsPreProcessTensorParams tensor_params
tensor params from read from config file
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:189
NvDsPreProcessTensorParams
Holds model parameters for tensor preparation.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:129
CustomInitParams::config_file_path
gchar * config_file_path
nvdspreprocess config file path
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:193
CustomTensorParams::params
NvDsPreProcessTensorParams params
tensor params from plugin
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:176
NvDsPreProcessNetworkInputOrder
NvDsPreProcessNetworkInputOrder
Enum for the network input order according to which network shape will be provided to prepare raw ten...
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:81
NvDsPreProcessFormat_BGRx
@ NvDsPreProcessFormat_BGRx
Specifies 32-bit interleaved B-G-R-x format.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:105
NvDsRoiMeta
Holds Information about ROI Metadata.
Definition: nvds_roi_meta.h:86
CustomInitParams::unique_id
guint unique_id
unique id of the preprocess plugin
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:187
GstBuffer
struct _GstBuffer GstBuffer
Definition: idatatype.h:19
CustomTransformParams::transform_params
NvBufSurfTransformParams transform_params
transform params for nvbufsurftransform api
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:121
nvds_roi_meta.h
NvDsPreProcessNetworkInputOrder_kNCHW
@ NvDsPreProcessNetworkInputOrder_kNCHW
Specifies NCHW network input order.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:84
NvDsPreProcessTensorParams::tensor_name
std::string tensor_name
Name of the tensor same as input layer name of model.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:145
NvDsPreProcessNetworkSize::channels
unsigned int channels
Holds the number of input channels for the model.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:158
_NvDsFrameMeta
Holds metadata for a frame in a batch.
Definition: nvdsmeta.h:285
NvDsPreProcessNetworkInputOrder_CUSTOM
@ NvDsPreProcessNetworkInputOrder_CUSTOM
Specifies any other custom input order handled by custom lib.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:88
CustomCtx
struct CustomCtx CustomCtx
Context for custom library.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:44
NvDsPreProcessFormat_BGR
@ NvDsPreProcessFormat_BGR
Specifies 24-bit interleaved B-G-R format.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:99
nvbufsurftransform.h
NVDSPREPROCESS_OUTPUT_PARSING_FAILED
@ NVDSPREPROCESS_OUTPUT_PARSING_FAILED
Output parsing failed.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:65
NvDsPreProcessFormat
NvDsPreProcessFormat
Defines model color formats.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:94
NVDSPREPROCESS_CUDA_ERROR
@ NVDSPREPROCESS_CUDA_ERROR
CUDA error was encountered.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:67
nvbufsurface.h
NvDsPreProcessAcquirer::acquire
virtual NvDsPreProcessCustomBuf * acquire()=0
method to acquire a buffer from buffer pool
NvDsDataType
NvDsDataType
Data type used for model in infer.
Definition: nvds_roi_meta.h:54
CustomSeqProcTensorParams
Tensor params for Custom sequence processing for 3d conv network.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:164
NvDsPreProcessCustomBuf::memory_ptr
void * memory_ptr
memory ptr where to store prepared tensor
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:202
_NvDsObjectMeta
Holds metadata for an object in the frame.
Definition: nvdsmeta.h:343