|
|
NVIDIA DeepStream SDK API Reference
|
9.2 Release
|
Go to the documentation of this file.
18 #ifndef FrameTransform_HPP_
19 #define FrameTransform_HPP_
24 #include <unordered_map>
27 #if defined(VIZ_DEBUG)
28 #include <opencv2/core.hpp>
31 #include "modules/utility/dataTypes.hpp"
32 #include "modules/NvMultiObjectTracker/nvdstracker.h"
34 #include <cuda_runtime.h>
36 #if defined(__aarch64__)
38 #include <EGL/eglext.h>
42 #define CUDA_TEXTURE_MAX_MULTI_SCALE_NUM 2
45 #define CUDA_LIMIT_ON_2D_TEXTURE_WIDTH 65000
46 #define CUDA_LIMIT_ON_2D_TEXTURE_HEIGHT 65000
75 const int debugVerboseLevel,
const int maxStreamNum,
const int maxBufSurfAddrSize,
84 bool create_batch(
const std::map<NvMOTStreamId, NvMOTFrame*> &nvFramesInBatch);
132 #if defined(VIZ_DEBUG)
134 const std::map<NvMOTStreamId, cv::Mat>& getSrcFramesAtHost()
const {
return m_srcFramesAtHost; }
174 std::map<NvMOTStreamId, cudaTextureObject_t*>
m_pTex;
185 #if defined(VIZ_DEBUG)
186 std::map<NvMOTStreamId, cv::Mat> m_srcFramesAtHost;
187 uint8_t *m_idata_host;
189 size_t m_idataPL_d_pitch;
193 #if defined(__aarch64__)
194 std::unordered_map<const NvBufSurfaceParams*, CUgraphicsResource> m_graphicsResourceAddrMap;
195 std::unordered_map<const NvBufSurfaceParams*, CUeglFrame> m_eglFrameAddrMap;
233 const int debugVerboseLevel,
const int maxStreamNum,
const int maxBufSurfAddrSize,
const int maxTargetNum,
281 #endif // FrameTransform_HPP_
cudaStream_t m_cuStream
CUDA stream used for frame transformations.
int m_channels_in
Width, height, pitch, and channel count of the source image.
NvBufSurfaceColorFormat getColorFormat() const
Get the input surface color format.
void initialize4Input(uint numFramesInBatch, const NvMotDataTypes::Size frameSize, const uint srcImgPitch, const uint frameChannels)
Set the input image layout and allocate batch memory.
void destroyTextureObjects()
Destroy all texture objects for the current batch.
int getWidthIn()
Get the input image width in pixels.
uint m_numFramesInBatchMax
Maximum number of frames processed in a batch.
void allocateInputMemoriesBatch(const uint numFramesInBatch, const int nx, const int ny, const uint pitch_in)
Allocate device and host memory for a batch of input images.
Manages CUDA texture objects for batched input frames.
TextureObjects * getTexturePointer_NV12(NvMOTStreamId streamId)
Get the NV12 texture-object pair for a stream.
~FrameInputTexture()
Release resources owned by the FrameInputTexture instance.
uint getMaxVideoStreams() const
Get the maximum number of video streams in a batch.
void initialize(const int debugVerboseLevel, const int maxStreamNum, const int maxBufSurfAddrSize, const NvMotDataTypes::Size srcImgSize, const uint srcImgPitch, const NvBufSurfaceColorFormat colorFormatType)
Initialize input texture state and allocate frame memory.
void allocateOutputMemories_common()
Allocate device and host memory for transform output.
cudaResourceDesc m_resDesc
CUDA resource descriptor for RGBA data.
int m_debugVerboseLevel
Debug verbosity level.
void createTexObjInBatch()
Create texture objects for BGRA or grayscale frames in the current batch.
int getHeightIn()
Get the input image height in pixels.
void createTexObjInBatch_NV12()
Create texture objects for NV12 frames in the current batch.
~FrameTransformTexture()
Release resources owned by the FrameTransformTexture instance.
int getChannelsIn()
Get the number of input image channels.
cudaTextureDesc m_texDesc
CUDA texture descriptor shared by input formats.
cudaTextureObject_t * getTexturePointer(NvMOTStreamId streamId)
Get the BGRA or grayscale texture-object pointer for a stream.
cudaResourceDesc m_resDesc_chroma
CUDA resource descriptor for NV12 chroma data.
Provides common CUDA texture state for frame transformations.
uint m_numFramesInBatchMax
Maximum number of frames processed in a batch.
std::map< const NvBufSurfaceParams *, TextureObjects > m_texInputAddrMap_NV12
NV12 texture-object pairs keyed by surface address.
void initializeTextureDescriptors()
Initialize CUDA resource and texture descriptors.
uint m_lastInd
Number of targets in the latest transform.
float4 * m_rois_d
Host and device regions of interest in x, y, width, and height order.
uint2 * m_dstOffsets_d
Host and device byte offsets into transform output memory.
bool m_isInit_common
Indicates whether common transform state is initialized.
int m_maxTexAddrSize
Maximum number of cached texture addresses.
std::shared_ptr< FrameInputTexture > m_frameInput
Shared input-frame texture manager.
NvBufSurfaceColorFormat m_colorFormatType
Color format of the source surface.
int m_deviceId
GPU device identifier.
std::map< uint, std::pair< NvMOTStreamId, uint > > m_targetNumInd2RoisInBatchMapper
Stream and bounding-box indices keyed by batch target index.
void uploadDeviceData2DeviceMemories(const std::map< NvMOTStreamId, NvMOTFrame * > &nvFramesInBatch)
Upload a batch of source frames to pitch-linear CUDA memory.
void cleanUpTextureObjects(int cleanUpNum)
Remove the requested number of cached BGRA or grayscale texture objects.
void deAllocateInputMemoriesBatch()
Release device and host memory for the input images.
void initialize_common(const int debugVerboseLevel, const int maxStreamNum, const int maxBufSurfAddrSize, const int maxTargetNum, const NvMotDataTypes::Size srcImgSize, const uint srcImgPitch, const NvBufSurfaceColorFormat colorFormatType)
Initialize common transform state and allocate output memory.
void deAllocateOutputMemories_common()
Release device and host memory for transform output.
cudaResourceDesc m_resDesc_luma
CUDA resource descriptor for NV12 luma data.
int m_integrated_gpu
Indicates whether execution uses an integrated GPU.
std::map< const NvBufSurfaceParams *, cudaTextureObject_t > m_texInputAddrMap
BGRA or grayscale texture objects keyed by surface address.
FrameTransformTexture(const int cudaBlockSize_2D=32)
Construct common frame-transform state.
void cleanUpTextureObjects_NV12(int cleanUpNum)
Remove the requested number of cached NV12 texture objects.
int m_scaleFactor
Scale that restores values read through normalized CUDA texture mode.
void updateTextureObject(const std::map< NvMOTStreamId, NvMOTFrame * > &inputMeta)
Update texture objects from a batch of source frames.
FrameInputTexture()
Construct an uninitialized input-texture manager.
bool create_batch(const std::map< NvMOTStreamId, NvMOTFrame * > &nvFramesInBatch)
Cache a batch of source frames and create their texture objects.
std::map< NvMOTStreamId, TextureObjects * > m_pTex_NV12
NV12 texture-object pairs keyed by stream ID.
cudaTextureObject_t chroma
Texture object for the chroma plane.
std::map< NvMOTStreamId, NvMOTFrame * > m_srcNvFrames
Input source frames keyed by stream ID.
Represents a two-dimensional integer size.
bool isInitialized_common() const
Report whether common frame-transform state is initialized.
Holds luma and chroma texture objects for an NV12 frame.
std::map< NvMOTStreamId, cudaTextureObject_t * > m_pTex
BGRA or grayscale texture pointers keyed by stream ID.
int m_debugVerboseLevel
Debug verbosity level.
NvBufSurfaceColorFormat getColorFormat() const
Get the input surface color format.
const int m_cudaBlockSize_2D
CUDA block width and height for two-dimensional kernels.
NvBufSurfaceColorFormat
Defines color formats for NvBufSurface.
int m_maxTargetsToTrack
Maximum number of targets in a batch.
cudaTextureObject_t luma
Texture object for the luma plane.
bool m_isInit
Indicates whether input texture state is initialized.