NVIDIA DeepStream SDK API Reference

6.4 Release
infer_preprocess_kernel.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2018-2022 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 
18 #ifndef __NVDSINFER_PREPROCESS_KERNEL_H__
19 #define __NVDSINFER_PREPROCESS_KERNEL_H__
20 
21 #include <cuda.h>
22 #include <cuda_fp16.h>
23 
24 #define NVDSINFER_MAX_PREPROC_CHANNELS 4
25 #define NVDSINFER_INVALID_CONVERSION_KEY UINT32_MAX
26 
28  unsigned int widthAlign;
29  unsigned int heightAlign;
30  unsigned int channelAlign;
31  // NCHW:pitchPerRow >= widthAlign
32  // NHWC:pitchPerRow >= widthAlign*channelAlign
33  unsigned int pitchPerRow;
34  unsigned int dataSizePerBatch;
35 };
36 
37 bool NvDsInferConvert_CxToPx(void* outBuffer, int outDataType,
38  BatchSurfaceInfo outBufferInfo, void* inBuffer, int inDatatype,
39  BatchSurfaceInfo inBufferInfo, int validN, int cropC, int cropH,
40  int cropW, // crop area
41  float scaleFactor, float meanOffsets[NVDSINFER_MAX_PREPROC_CHANNELS],
42  int fromChannelIndices[NVDSINFER_MAX_PREPROC_CHANNELS], int toNCHW,
43  cudaStream_t stream);
44 
45 bool NvDsInferConvert_CxToPxWithMeanBuffer(void* outBuffer, int outDataType,
46  BatchSurfaceInfo outBufferInfo, void* inBuffer, int inDatatype,
47  BatchSurfaceInfo inBufferInfo, int validN, int cropC, int cropH,
48  int cropW, // crop area
49  float scaleFactor, float* meanDataBuffer,
50  int fromChannelIndices[NVDSINFER_MAX_PREPROC_CHANNELS], int toNCHW,
51  cudaStream_t stream);
52 
57 typedef void (*NvDsInferConvertFcn)(void* outBuffer, int outDataType,
58  BatchSurfaceInfo outBufferInfo, void* inBuffer, int inDatatype,
59  BatchSurfaceInfo inBufferInfo, int validN, int cropC, int cropH,
60  int cropW, // crop area
61  float scaleFactor, float* meanDataBuffer,
62  int fromChannelIndices[NVDSINFER_MAX_PREPROC_CHANNELS], int toNCHW,
63  cudaStream_t stream);
64 
65 #endif /* __NVDSINFER_CONVERSION_H__ */
NvDsInferConvertFcn
void(* NvDsInferConvertFcn)(void *outBuffer, int outDataType, BatchSurfaceInfo outBufferInfo, void *inBuffer, int inDatatype, BatchSurfaceInfo inBufferInfo, int validN, int cropC, int cropH, int cropW, float scaleFactor, float *meanDataBuffer, int fromChannelIndices[NVDSINFER_MAX_PREPROC_CHANNELS], int toNCHW, cudaStream_t stream)
Function pointer type to which any of the NvDsInferConvert functions can be assigned.
Definition: infer_preprocess_kernel.h:57
BatchSurfaceInfo
Definition: infer_preprocess_kernel.h:27
NvDsInferConvert_CxToPx
bool NvDsInferConvert_CxToPx(void *outBuffer, int outDataType, BatchSurfaceInfo outBufferInfo, void *inBuffer, int inDatatype, BatchSurfaceInfo inBufferInfo, int validN, int cropC, int cropH, int cropW, float scaleFactor, float meanOffsets[NVDSINFER_MAX_PREPROC_CHANNELS], int fromChannelIndices[NVDSINFER_MAX_PREPROC_CHANNELS], int toNCHW, cudaStream_t stream)
BatchSurfaceInfo::widthAlign
unsigned int widthAlign
Definition: infer_preprocess_kernel.h:28
NvDsInferConvert_CxToPxWithMeanBuffer
bool NvDsInferConvert_CxToPxWithMeanBuffer(void *outBuffer, int outDataType, BatchSurfaceInfo outBufferInfo, void *inBuffer, int inDatatype, BatchSurfaceInfo inBufferInfo, int validN, int cropC, int cropH, int cropW, float scaleFactor, float *meanDataBuffer, int fromChannelIndices[NVDSINFER_MAX_PREPROC_CHANNELS], int toNCHW, cudaStream_t stream)
NVDSINFER_MAX_PREPROC_CHANNELS
#define NVDSINFER_MAX_PREPROC_CHANNELS
Header file for pre-processing CUDA kernels with normalization and mean subtraction required by nvdsi...
Definition: infer_preprocess_kernel.h:24
cudaStream_t
struct CUstream_st * cudaStream_t
Forward declaration of cudaStream_t.
Definition: nvbufsurftransform.h:29
BatchSurfaceInfo::channelAlign
unsigned int channelAlign
Definition: infer_preprocess_kernel.h:30
BatchSurfaceInfo::dataSizePerBatch
unsigned int dataSizePerBatch
Definition: infer_preprocess_kernel.h:34
BatchSurfaceInfo::heightAlign
unsigned int heightAlign
Definition: infer_preprocess_kernel.h:29
BatchSurfaceInfo::pitchPerRow
unsigned int pitchPerRow
Definition: infer_preprocess_kernel.h:33