NVIDIA DeepStream SDK API Reference

9.1 Release
9.1/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 {
124  NvBufSurfTransformConfigParams transform_config_params;
126  NvBufSurfTransformParams transform_params;
128  NvBufSurfTransformSyncObj_t sync_obj = NULL;
130 
134 typedef struct
135 {
137  NvDsPreProcessNetworkInputOrder network_input_order;
140  std::vector<int> network_input_shape;
142  NvDsPreProcessFormat network_color_format;
144  guint64 buffer_size = 1;
146  NvDsDataType data_type;
148  NvBufSurfaceMemType memory_type;
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 {
183  CustomSeqProcTensorParams seq_params;
185 
189 typedef struct
190 {
192  guint unique_id;
194  NvDsPreProcessTensorParams tensor_params;
196  std::unordered_map <std::string, std::string> user_configs;
198  gchar *config_file_path;
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;
245  NvDsRoiMeta roi_meta;
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;
274  NvDsPreProcessFormat scaling_pool_format;
276  NvDsBatchMeta *batch_meta;
278  uint32_t pitch;
280  nvtxRangeId_t nvtx_complete_buf_range = 0;
282 
283 #endif //__NVDSPREPROCESS_INTERFACE_H__
284 
NvDsPreProcessFormat_Unknown
@ NvDsPreProcessFormat_Unknown
Definition: 9.1/sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:113
CustomInitParams
Custom Initialization parameter for custom library.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:189
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: 9.1/sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:62
NvDsPreProcessAcquirer::release
virtual gboolean release(NvDsPreProcessCustomBuf *)=0
method to release buffer from buffer pool
NVDSPREPROCESS_CONFIG_FAILED
@ NVDSPREPROCESS_CONFIG_FAILED
Failed to configure the tensor_impl instance possibly due to an erroneous initialization property.
Definition: 9.1/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: 9.1/sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:102
NvDsPreProcessNetworkInputOrder_kNHWC
@ NvDsPreProcessNetworkInputOrder_kNHWC
Specifies NHWC network input order.
Definition: 9.1/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: 9.1/sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:78
NVDSPREPROCESS_RESOURCE_ERROR
@ NVDSPREPROCESS_RESOURCE_ERROR
Resource error was encountered.
Definition: 9.1/sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:76
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: 9.1/sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:108
NvDsPreProcessFormat_GRAY
@ NvDsPreProcessFormat_GRAY
Specifies 8-bit Luma format.
Definition: 9.1/sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:106
NVDSPREPROCESS_INVALID_PARAMS
@ NVDSPREPROCESS_INVALID_PARAMS
Invalid parameters were supplied.
Definition: 9.1/sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:68
NvDsPreProcessStatus
NvDsPreProcessStatus
Enum for the status codes returned by NvDsPreProcessImpl.
Definition: 9.1/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: 9.1/sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:57
_NvBufSurfTransformConfigParams
Holds configuration parameters for a transform/composite session.
Definition: sources/includes/nvbufsurftransform.h:175
NvBufSurfaceParams
Hold the information of single buffer in the batch.
Definition: sources/includes/nvbufsurface.h:562
NvDsPreProcessFormat_Tensor
@ NvDsPreProcessFormat_Tensor
NCHW planar.
Definition: 9.1/sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:112
NVDSPREPROCESS_CUSTOM_TENSOR_FAILED
@ NVDSPREPROCESS_CUSTOM_TENSOR_FAILED
Custom Tensor Preparation failed.
Definition: 9.1/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
_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: 9.1/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
NVDSPREPROCESS_CUSTOM_TRANSFORMATION_FAILED
@ NVDSPREPROCESS_CUSTOM_TRANSFORMATION_FAILED
Custom Group Transformation failed.
Definition: 9.1/sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:64
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
Holds model parameters for tensor preparation.
Definition: sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:134
NvDsPreProcessNetworkInputOrder
NvDsPreProcessNetworkInputOrder
Enum for the network input order according to which network shape will be provided to prepare raw ten...
Definition: 9.1/sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:86
NvDsPreProcessFormat_BGRx
@ NvDsPreProcessFormat_BGRx
Specifies 32-bit interleaved B-G-R-x format.
Definition: 9.1/sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:110
NvDsRoiMeta
Holds Information about ROI Metadata.
Definition: sources/includes/nvds_roi_meta.h:95
NvDsPreProcessNetworkInputOrder_kNCHW
@ NvDsPreProcessNetworkInputOrder_kNCHW
Specifies NCHW network input order.
Definition: 9.1/sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:89
_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: 9.1/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: 9.1/sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:104
NVDSPREPROCESS_OUTPUT_PARSING_FAILED
@ NVDSPREPROCESS_OUTPUT_PARSING_FAILED
Output parsing failed.
Definition: 9.1/sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:70
NvDsPreProcessFormat
NvDsPreProcessFormat
Defines model color formats.
Definition: 9.1/sources/gst-plugins/gst-nvdspreprocess/include/nvdspreprocess_interface.h:99
NVDSPREPROCESS_CUDA_ERROR
@ NVDSPREPROCESS_CUDA_ERROR
CUDA error was encountered.
Definition: 9.1/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