NVIDIA DeepStream SDK API Reference

6.4 Release
gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
38 #ifndef __NVDSPREPROCESS_INTERFACE_H__
39 #define __NVDSPREPROCESS_INTERFACE_H__
40 
41 #include <cuda.h>
42 #include <cuda_runtime.h>
43 #include "nvbufsurface.h"
44 #include "nvbufsurftransform.h"
45 #include "gstnvdsmeta.h"
46 
47 #include "nvds_roi_meta.h"
48 #include "nvtx3/nvToolsExt.h"
49 #include <unordered_map>
50 
54 typedef struct CustomCtx CustomCtx;
55 
59 typedef enum
60 {
85 
91 typedef enum
92 {
100 
104 typedef enum
105 {
120 
126 typedef struct
127 {
135 
139 typedef struct
140 {
145  std::vector<int> network_input_shape;
149  guint64 buffer_size = 1;
155  std::string tensor_name;
157 
161 typedef struct
162 {
164  unsigned int width;
166  unsigned int height;
168  unsigned int channels;
170 
174 typedef struct
175 {
177  std::vector<NvDsRoiMeta> roi_vector;
179 
183 typedef struct
184 {
190 
194 typedef struct
195 {
197  guint unique_id;
201  std::unordered_map <std::string, std::string> user_configs;
205 
210 {
212  void *memory_ptr;
213 };
214 
220 {
221 public:
223  virtual NvDsPreProcessCustomBuf *acquire() = 0;
225  virtual gboolean release(NvDsPreProcessCustomBuf *) = 0;
226 };
227 
231 typedef struct
232 {
234  NvDsObjectMeta *obj_meta = nullptr;
236  NvDsFrameMeta *frame_meta = nullptr;
239  guint batch_index = 0;
241  gulong frame_num = 0;
243  NvBufSurfaceParams *input_surf_params = nullptr;
248  gpointer converted_frame_ptr = nullptr;
251 
253 
257 typedef struct
258 {
260  std::vector<NvDsPreProcessUnit> units;
262  std::vector<NvBufSurfTransformSyncObj_t> sync_objects;
264  GstBuffer *inbuf = nullptr;
266  gulong inbuf_batch_num = 0;
271  gboolean push_buffer = FALSE;
275  gboolean event_marker = FALSE;
277  GstBuffer *converted_buf = nullptr;
283  uint32_t pitch;
285  nvtxRangeId_t nvtx_complete_buf_range = 0;
287 
288 #endif //__NVDSPREPROCESS_INTERFACE_H__
289 
NvDsPreProcessFormat_Unknown
@ NvDsPreProcessFormat_Unknown
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:118
NvDsPreProcessTensorParams::data_type
NvDsDataType data_type
DataType for tensor formation.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:151
CustomInitParams
Custom Initialization parameter for custom library.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:194
NvDsPreProcessTensorParams::network_input_order
NvDsPreProcessNetworkInputOrder network_input_order
network order at which model will work
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:142
NvBufSurfTransformSyncObj_t
struct NvBufSurfTransformSyncObj * NvBufSurfTransformSyncObj_t
Holds the information about synchronization objects for asynchronous transform/composite APIs.
Definition: nvbufsurftransform.h:282
NVDSPREPROCESS_CUSTOM_LIB_FAILED
@ NVDSPREPROCESS_CUSTOM_LIB_FAILED
Custom Library interface implementation failed.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:67
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:250
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:65
_NvBufSurfaceTransformParams
Holds transform parameters for a transform call.
Definition: nvbufsurftransform.h:185
NvDsPreProcessFormat_RGB
@ NvDsPreProcessFormat_RGB
Specifies 24-bit interleaved R-G-B format.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:107
NvDsPreProcessNetworkInputOrder_kNHWC
@ NvDsPreProcessNetworkInputOrder_kNHWC
Specifies NHWC network input order.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:96
NvDsPreProcessNetworkSize
Holds information about the model network.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:161
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:83
NVDSPREPROCESS_RESOURCE_ERROR
@ NVDSPREPROCESS_RESOURCE_ERROR
Resource error was encountered.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:81
NvDsPreProcessBatch::batch_meta
NvDsBatchMeta * batch_meta
Deepstream batch meta.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:281
NvDsPreProcessBatch
Holds information about the batch of frames to be inferred.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:257
NvDsPreProcessFormat_RGBA
@ NvDsPreProcessFormat_RGBA
Specifies 32-bit interleaved R-G-B-A format.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:113
NvDsPreProcessNetworkSize::height
unsigned int height
Holds the input height for the model.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:166
NvDsPreProcessFormat_GRAY
@ NvDsPreProcessFormat_GRAY
Specifies 8-bit Luma format.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:111
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:201
NVDSPREPROCESS_INVALID_PARAMS
@ NVDSPREPROCESS_INVALID_PARAMS
Invalid parameters were supplied.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:73
NvDsPreProcessStatus
NvDsPreProcessStatus
Enum for the status codes returned by NvDsPreProcessImpl.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:59
CustomTransformParams
custom transformation parameter for calling nvbufsurftransform api for scaling and converting the ROI...
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:126
NVDSPREPROCESS_SUCCESS
@ NVDSPREPROCESS_SUCCESS
NvDsPreprocess operation succeeded.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:62
NvDsPreProcessTensorParams::network_color_format
NvDsPreProcessFormat network_color_format
Holds the network input format.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:147
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:177
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:262
_NvBufSurfTransformConfigParams
Holds configuration parameters for a transform/composite session.
Definition: nvbufsurftransform.h:167
NvDsPreProcessTensorParams::memory_type
NvBufSurfaceMemType memory_type
Memory Type for tensor formation.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:153
CustomTensorParams::seq_params
CustomSeqProcTensorParams seq_params
Additional Custom Parameters.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:188
NvBufSurfaceParams
Hold the information of single buffer in the batch.
Definition: nvbufsurface.h:470
NvDsPreProcessFormat_Tensor
@ NvDsPreProcessFormat_Tensor
NCHW planar.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:117
NvDsPreProcessBatch::pitch
uint32_t pitch
Holds the pitch of the buffer.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:283
NVDSPREPROCESS_CUSTOM_TENSOR_FAILED
@ NVDSPREPROCESS_CUSTOM_TENSOR_FAILED
Custom Tensor Preparation failed.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:71
NvDsPreProcessUnit
A preprocess unit for processing which can be Frame/ROI.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:231
NvDsPreProcessNetworkSize::width
unsigned int width
Holds the input width for the model.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:164
CustomTransformParams::transform_config_params
NvBufSurfTransformConfigParams transform_config_params
transform config params for nvbufsurftransform api
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:129
_NvDsBatchMeta
Holds information about a formed batch containing frames from different sources.
Definition: nvdsmeta.h:240
gstnvdsmeta.h
NVDSPREPROCESS_TENSORRT_ERROR
@ NVDSPREPROCESS_TENSORRT_ERROR
TensorRT interface failed.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:79
CustomTensorParams
Tensor params passed to custom library for tensor preparation.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:183
NvDsPreProcessBatch::units
std::vector< NvDsPreProcessUnit > units
Vector of units in the batch.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:260
NVDSPREPROCESS_CUSTOM_TRANSFORMATION_FAILED
@ NVDSPREPROCESS_CUSTOM_TRANSFORMATION_FAILED
Custom Group Transformation failed.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:69
NvDsPreProcessBatch::scaling_pool_format
NvDsPreProcessFormat scaling_pool_format
scaling pool color format
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:279
NvDsPreProcessCustomBuf
Custom Buffer passed to the custom lib for preparing tensor.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:209
NvDsPreProcessAcquirer
class for acquiring and releasing a buffer from tensor pool by custom lib.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:219
NvBufSurfaceMemType
NvBufSurfaceMemType
Specifies memory types for NvBufSurface.
Definition: nvbufsurface.h:300
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:145
CustomInitParams::tensor_params
NvDsPreProcessTensorParams tensor_params
tensor params from read from config file
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:199
NvDsPreProcessTensorParams
Holds model parameters for tensor preparation.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:139
CustomInitParams::config_file_path
gchar * config_file_path
nvdspreprocess config file path
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:203
CustomTensorParams::params
NvDsPreProcessTensorParams params
tensor params from plugin
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:186
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:91
NvDsPreProcessFormat_BGRx
@ NvDsPreProcessFormat_BGRx
Specifies 32-bit interleaved B-G-R-x format.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:115
NvDsRoiMeta
Holds Information about ROI Metadata.
Definition: nvds_roi_meta.h:96
CustomInitParams::unique_id
guint unique_id
unique id of the preprocess plugin
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:197
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:131
nvds_roi_meta.h
NvDsPreProcessNetworkInputOrder_kNCHW
@ NvDsPreProcessNetworkInputOrder_kNCHW
Specifies NCHW network input order.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:94
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:155
NvDsPreProcessNetworkSize::channels
unsigned int channels
Holds the number of input channels for the model.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:168
_NvDsFrameMeta
Holds metadata for a frame in a batch.
Definition: nvdsmeta.h:284
NvDsPreProcessNetworkInputOrder_CUSTOM
@ NvDsPreProcessNetworkInputOrder_CUSTOM
Specifies any other custom input order handled by custom lib.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:98
CustomCtx
struct CustomCtx CustomCtx
Context for custom library.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:54
NvDsPreProcessFormat_BGR
@ NvDsPreProcessFormat_BGR
Specifies 24-bit interleaved B-G-R format.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:109
nvbufsurftransform.h
NVDSPREPROCESS_OUTPUT_PARSING_FAILED
@ NVDSPREPROCESS_OUTPUT_PARSING_FAILED
Output parsing failed.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:75
NvDsPreProcessFormat
NvDsPreProcessFormat
Defines model color formats.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:104
NVDSPREPROCESS_CUDA_ERROR
@ NVDSPREPROCESS_CUDA_ERROR
CUDA error was encountered.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:77
nvbufsurface.h
CustomTransformParams::sync_obj
NvBufSurfTransformSyncObj_t sync_obj
sync objects for async transform
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:133
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:64
CustomSeqProcTensorParams
Tensor params for Custom sequence processing for 3d conv network.
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:174
NvDsPreProcessCustomBuf::memory_ptr
void * memory_ptr
memory ptr where to store prepared tensor
Definition: gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:212
_NvDsObjectMeta
Holds metadata for an object in the frame.
Definition: nvdsmeta.h:342