NVIDIA DeepStream SDK API Reference

9.1 Release
sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
33 #ifndef __NVDSPREPROCESS_INTERFACE_H__
34 #define __NVDSPREPROCESS_INTERFACE_H__
35 
36 #include <cuda.h>
37 #include <cuda_runtime.h>
38 #include "nvbufsurface.h"
39 #include "nvbufsurftransform.h"
40 #include "gstnvdsmeta.h"
41 
42 #include "nvds_roi_meta.h"
43 #include "nvtx3/nvToolsExt.h"
44 #include <unordered_map>
45 
49 typedef struct CustomCtx CustomCtx;
50 
54 typedef enum
55 {
80 
86 typedef enum
87 {
95 
99 typedef enum
100 {
115 
121 typedef struct
122 {
130 
134 typedef struct
135 {
140  std::vector<int> network_input_shape;
144  guint64 buffer_size = 1;
150  std::string tensor_name;
152 
156 typedef struct
157 {
159  unsigned int width;
161  unsigned int height;
163  unsigned int channels;
165 
169 typedef struct
170 {
172  std::vector<NvDsRoiMeta> roi_vector;
174 
178 typedef struct
179 {
185 
189 typedef struct
190 {
192  guint unique_id;
196  std::unordered_map <std::string, std::string> user_configs;
200 
205 {
207  void *memory_ptr;
208 };
209 
215 {
216 public:
218  virtual NvDsPreProcessCustomBuf *acquire() = 0;
220  virtual gboolean release(NvDsPreProcessCustomBuf *) = 0;
221 };
222 
226 typedef struct
227 {
229  NvDsObjectMeta *obj_meta = nullptr;
231  NvDsFrameMeta *frame_meta = nullptr;
234  guint batch_index = 0;
236  gulong frame_num = 0;
238  NvBufSurfaceParams *input_surf_params = nullptr;
243  gpointer converted_frame_ptr = nullptr;
246 
248 
252 typedef struct
253 {
255  std::vector<NvDsPreProcessUnit> units;
257  std::vector<NvBufSurfTransformSyncObj_t> sync_objects;
259  GstBuffer *inbuf = nullptr;
261  gulong inbuf_batch_num = 0;
266  gboolean push_buffer = FALSE;
270  gboolean event_marker = FALSE;
272  GstBuffer *converted_buf = nullptr;
278  uint32_t pitch;
280  nvtxRangeId_t nvtx_complete_buf_range = 0;
282 
283 #endif //__NVDSPREPROCESS_INTERFACE_H__
284 
NvDsPreProcessFormat_Unknown
@ NvDsPreProcessFormat_Unknown
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:113
NvDsPreProcessTensorParams::data_type
NvDsDataType data_type
DataType for tensor formation.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:146
CustomInitParams
Custom Initialization parameter for custom library.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:189
NvDsPreProcessTensorParams::network_input_order
NvDsPreProcessNetworkInputOrder network_input_order
network order at which model will work
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:137
NvBufSurfTransformSyncObj_t
struct NvBufSurfTransformSyncObj * NvBufSurfTransformSyncObj_t
Holds the information about synchronization objects for asynchronous transform/composite APIs.
Definition: sources/includes/nvbufsurftransform.h:301
NVDSPREPROCESS_CUSTOM_LIB_FAILED
@ NVDSPREPROCESS_CUSTOM_LIB_FAILED
Custom Library interface implementation failed.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:62
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: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:245
NVDSPREPROCESS_CONFIG_FAILED
@ NVDSPREPROCESS_CONFIG_FAILED
Failed to configure the tensor_impl instance possibly due to an erroneous initialization property.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:60
_NvBufSurfaceTransformParams
Holds transform parameters for a transform call.
Definition: sources/includes/nvbufsurftransform.h:196
NvDsPreProcessFormat_RGB
@ NvDsPreProcessFormat_RGB
Specifies 24-bit interleaved R-G-B format.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:102
NvDsPreProcessNetworkInputOrder_kNHWC
@ NvDsPreProcessNetworkInputOrder_kNHWC
Specifies NHWC network input order.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:91
NvDsPreProcessNetworkSize
Holds information about the model network.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:156
NVDSPREPROCESS_TENSOR_NOT_READY
@ NVDSPREPROCESS_TENSOR_NOT_READY
Tensor Yet not ready to be attached as meta.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:78
NVDSPREPROCESS_RESOURCE_ERROR
@ NVDSPREPROCESS_RESOURCE_ERROR
Resource error was encountered.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:76
NvDsPreProcessBatch::batch_meta
NvDsBatchMeta * batch_meta
Deepstream batch meta.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:276
NvDsPreProcessBatch
Holds information about the batch of frames to be inferred.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:252
NvDsPreProcessFormat_RGBA
@ NvDsPreProcessFormat_RGBA
Specifies 32-bit interleaved R-G-B-A format.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:108
NvDsPreProcessNetworkSize::height
unsigned int height
Holds the input height for the model.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:161
NvDsPreProcessFormat_GRAY
@ NvDsPreProcessFormat_GRAY
Specifies 8-bit Luma format.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:106
CustomInitParams::user_configs
std::unordered_map< std::string, std::string > user_configs
User config map key-value pair.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:196
NVDSPREPROCESS_INVALID_PARAMS
@ NVDSPREPROCESS_INVALID_PARAMS
Invalid parameters were supplied.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:68
NvDsPreProcessStatus
NvDsPreProcessStatus
Enum for the status codes returned by NvDsPreProcessImpl.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:54
CustomTransformParams
custom transformation parameter for calling nvbufsurftransform api for scaling and converting the ROI...
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:121
NVDSPREPROCESS_SUCCESS
@ NVDSPREPROCESS_SUCCESS
NvDsPreprocess operation succeeded.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:57
NvDsPreProcessTensorParams::network_color_format
NvDsPreProcessFormat network_color_format
Holds the network input format.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:142
CustomSeqProcTensorParams::roi_vector
std::vector< NvDsRoiMeta > roi_vector
vector of rois which can be modified by custom lib
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:172
NvDsPreProcessBatch::sync_objects
std::vector< NvBufSurfTransformSyncObj_t > sync_objects
Vector of sync objects for async transformation of the batch.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:257
_NvBufSurfTransformConfigParams
Holds configuration parameters for a transform/composite session.
Definition: sources/includes/nvbufsurftransform.h:175
NvDsPreProcessTensorParams::memory_type
NvBufSurfaceMemType memory_type
Memory Type for tensor formation.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:148
CustomTensorParams::seq_params
CustomSeqProcTensorParams seq_params
Additional Custom Parameters.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:183
NvBufSurfaceParams
Hold the information of single buffer in the batch.
Definition: sources/includes/nvbufsurface.h:562
NvDsPreProcessFormat_Tensor
@ NvDsPreProcessFormat_Tensor
NCHW planar.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:112
NvDsPreProcessBatch::pitch
uint32_t pitch
Holds the pitch of the buffer.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:278
NVDSPREPROCESS_CUSTOM_TENSOR_FAILED
@ NVDSPREPROCESS_CUSTOM_TENSOR_FAILED
Custom Tensor Preparation failed.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:66
NvDsPreProcessUnit
A preprocess unit for processing which can be Frame/ROI.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:226
NvDsPreProcessNetworkSize::width
unsigned int width
Holds the input width for the model.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:159
CustomTransformParams::transform_config_params
NvBufSurfTransformConfigParams transform_config_params
transform config params for nvbufsurftransform api
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:124
_NvDsBatchMeta
Holds information about a formed batch containing frames from different sources.
Definition: sources/includes/nvdsmeta.h:262
NVDSPREPROCESS_TENSORRT_ERROR
@ NVDSPREPROCESS_TENSORRT_ERROR
TensorRT interface failed.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:74
CustomTensorParams
Tensor params passed to custom library for tensor preparation.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:178
NvDsPreProcessBatch::units
std::vector< NvDsPreProcessUnit > units
Vector of units in the batch.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:255
NVDSPREPROCESS_CUSTOM_TRANSFORMATION_FAILED
@ NVDSPREPROCESS_CUSTOM_TRANSFORMATION_FAILED
Custom Group Transformation failed.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:64
NvDsPreProcessBatch::scaling_pool_format
NvDsPreProcessFormat scaling_pool_format
scaling pool color format
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:274
NvDsPreProcessCustomBuf
Custom Buffer passed to the custom lib for preparing tensor.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:204
NvDsPreProcessAcquirer
class for acquiring and releasing a buffer from tensor pool by custom lib.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:214
NvBufSurfaceMemType
NvBufSurfaceMemType
Specifies memory types for NvBufSurface.
Definition: sources/includes/nvbufsurface.h:350
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: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:140
CustomInitParams::tensor_params
NvDsPreProcessTensorParams tensor_params
tensor params from read from config file
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:194
NvDsPreProcessTensorParams
Holds model parameters for tensor preparation.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:134
CustomInitParams::config_file_path
gchar * config_file_path
nvdspreprocess config file path
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:198
CustomTensorParams::params
NvDsPreProcessTensorParams params
tensor params from plugin
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:181
NvDsPreProcessNetworkInputOrder
NvDsPreProcessNetworkInputOrder
Enum for the network input order according to which network shape will be provided to prepare raw ten...
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:86
NvDsPreProcessFormat_BGRx
@ NvDsPreProcessFormat_BGRx
Specifies 32-bit interleaved B-G-R-x format.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:110
NvDsRoiMeta
Holds Information about ROI Metadata.
Definition: sources/includes/nvds_roi_meta.h:95
CustomInitParams::unique_id
guint unique_id
unique id of the preprocess plugin
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:192
CustomTransformParams::transform_params
NvBufSurfTransformParams transform_params
transform params for nvbufsurftransform api
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:126
NvDsPreProcessNetworkInputOrder_kNCHW
@ NvDsPreProcessNetworkInputOrder_kNCHW
Specifies NCHW network input order.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:89
NvDsPreProcessTensorParams::tensor_name
std::string tensor_name
Name of the tensor same as input layer name of model.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:150
NvDsPreProcessNetworkSize::channels
unsigned int channels
Holds the number of input channels for the model.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:163
_NvDsFrameMeta
Holds metadata for a frame in a batch.
Definition: sources/includes/nvdsmeta.h:306
NvDsPreProcessNetworkInputOrder_CUSTOM
@ NvDsPreProcessNetworkInputOrder_CUSTOM
Specifies any other custom input order handled by custom lib.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:93
CustomCtx
struct CustomCtx CustomCtx
Context for custom library.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:49
NvDsPreProcessFormat_BGR
@ NvDsPreProcessFormat_BGR
Specifies 24-bit interleaved B-G-R format.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:104
NVDSPREPROCESS_OUTPUT_PARSING_FAILED
@ NVDSPREPROCESS_OUTPUT_PARSING_FAILED
Output parsing failed.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:70
NvDsPreProcessFormat
NvDsPreProcessFormat
Defines model color formats.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:99
NVDSPREPROCESS_CUDA_ERROR
@ NVDSPREPROCESS_CUDA_ERROR
CUDA error was encountered.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:72
NvDsPreProcessAcquirer::acquire
virtual NvDsPreProcessCustomBuf * acquire()=0
method to acquire a buffer from buffer pool
NvDsDataType
NvDsDataType
Data type used for model in infer.
Definition: sources/includes/nvds_roi_meta.h:59
CustomSeqProcTensorParams
Tensor params for Custom sequence processing for 3d conv network.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:169
GstBuffer
struct _GstBuffer GstBuffer
Definition: sources/includes/ds3d/common/idatatype.h:24
NvDsPreProcessCustomBuf::memory_ptr
void * memory_ptr
memory ptr where to store prepared tensor
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:207
_NvDsObjectMeta
Holds metadata for an object in the frame.
Definition: sources/includes/nvdsmeta.h:365