NVIDIA DeepStream SDK API Reference

9.2 Release
FrameInputTexture Class Reference

Detailed Description

Manages CUDA texture objects for batched input frames.

Definition at line 56 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

Public Member Functions

 FrameInputTexture ()
 Construct an uninitialized input-texture manager. More...
 
 ~FrameInputTexture ()
 Release resources owned by the FrameInputTexture instance. More...
 
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. More...
 
bool create_batch (const std::map< NvMOTStreamId, NvMOTFrame * > &nvFramesInBatch)
 Cache a batch of source frames and create their texture objects. More...
 
void createTexObjInBatch ()
 Create texture objects for BGRA or grayscale frames in the current batch. More...
 
void createTexObjInBatch_NV12 ()
 Create texture objects for NV12 frames in the current batch. More...
 
void destroyTextureObjects ()
 Destroy all texture objects for the current batch. More...
 
void cleanUpTextureObjects (int cleanUpNum)
 Remove the requested number of cached BGRA or grayscale texture objects. More...
 
void cleanUpTextureObjects_NV12 (int cleanUpNum)
 Remove the requested number of cached NV12 texture objects. More...
 
cudaTextureObject_t * getTexturePointer (NvMOTStreamId streamId)
 Get the BGRA or grayscale texture-object pointer for a stream. More...
 
TextureObjects * getTexturePointer_NV12 (NvMOTStreamId streamId)
 Get the NV12 texture-object pair for a stream. More...
 
int getWidthIn ()
 Get the input image width in pixels. More...
 
int getHeightIn ()
 Get the input image height in pixels. More...
 
int getChannelsIn ()
 Get the number of input image channels. More...
 
NvBufSurfaceColorFormat getColorFormat () const
 Get the input surface color format. More...
 
 FrameInputTexture ()
 Construct an uninitialized input-texture manager. More...
 
 ~FrameInputTexture ()
 Release resources owned by the FrameInputTexture instance. More...
 
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. More...
 
bool create_batch (const std::map< NvMOTStreamId, NvMOTFrame * > &nvFramesInBatch)
 Cache a batch of source frames and create their texture objects. More...
 
void createTexObjInBatch ()
 Create texture objects for BGRA or grayscale frames in the current batch. More...
 
void createTexObjInBatch_NV12 ()
 Create texture objects for NV12 frames in the current batch. More...
 
void destroyTextureObjects ()
 Destroy all texture objects for the current batch. More...
 
void cleanUpTextureObjects (int cleanUpNum)
 Remove the requested number of cached BGRA or grayscale texture objects. More...
 
void cleanUpTextureObjects_NV12 (int cleanUpNum)
 Remove the requested number of cached NV12 texture objects. More...
 
cudaTextureObject_t * getTexturePointer (NvMOTStreamId streamId)
 Get the BGRA or grayscale texture-object pointer for a stream. More...
 
TextureObjects * getTexturePointer_NV12 (NvMOTStreamId streamId)
 Get the NV12 texture-object pair for a stream. More...
 
int getWidthIn ()
 Get the input image width in pixels. More...
 
int getHeightIn ()
 Get the input image height in pixels. More...
 
int getChannelsIn ()
 Get the number of input image channels. More...
 
NvBufSurfaceColorFormat getColorFormat () const
 Get the input surface color format. More...
 

Protected Member Functions

void initialize4Input (uint numFramesInBatch, const NvMotDataTypes::Size frameSize, const uint srcImgPitch, const uint frameChannels)
 Set the input image layout and allocate batch memory. More...
 
void initializeTextureDescriptors ()
 Initialize CUDA resource and texture descriptors. More...
 
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. More...
 
void deAllocateInputMemoriesBatch ()
 Release device and host memory for the input images. More...
 
void uploadDeviceData2DeviceMemories (const std::map< NvMOTStreamId, NvMOTFrame * > &nvFramesInBatch)
 Upload a batch of source frames to pitch-linear CUDA memory. More...
 
void initialize4Input (uint numFramesInBatch, const NvMotDataTypes::Size frameSize, const uint srcImgPitch, const uint frameChannels)
 Set the input image layout and allocate batch memory. More...
 
void initializeTextureDescriptors ()
 Initialize CUDA resource and texture descriptors. More...
 
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. More...
 
void deAllocateInputMemoriesBatch ()
 Release device and host memory for the input images. More...
 
void uploadDeviceData2DeviceMemories (const std::map< NvMOTStreamId, NvMOTFrame * > &nvFramesInBatch)
 Upload a batch of source frames to pitch-linear CUDA memory. More...
 

Protected Attributes

bool m_isInit
 Indicates whether input texture state is initialized. More...
 
std::map< NvMOTStreamId, NvMOTFrame * > m_srcNvFrames
 Input source frames keyed by stream ID. More...
 
std::map< NvMOTStreamId, cudaTextureObject_t * > m_pTex
 BGRA or grayscale texture pointers keyed by stream ID. More...
 
std::map< NvMOTStreamId, TextureObjects * > m_pTex_NV12
 NV12 texture-object pairs keyed by stream ID. More...
 
std::map< const NvBufSurfaceParams *, cudaTextureObject_t > m_texInputAddrMap
 BGRA or grayscale texture objects keyed by surface address. More...
 
std::map< const NvBufSurfaceParams *, TextureObjects > m_texInputAddrMap_NV12
 NV12 texture-object pairs keyed by surface address. More...
 
cudaResourceDesc m_resDesc_luma
 CUDA resource descriptor for NV12 luma data. More...
 
cudaResourceDesc m_resDesc_chroma
 CUDA resource descriptor for NV12 chroma data. More...
 
cudaResourceDesc m_resDesc
 CUDA resource descriptor for RGBA data. More...
 
cudaTextureDesc m_texDesc
 CUDA texture descriptor shared by input formats. More...
 
int m_maxTexAddrSize
 Maximum number of cached texture addresses. More...
 
uint m_numFramesInBatchMax
 Maximum number of frames processed in a batch. More...
 
int m_width_in
 
int m_height_in
 
int m_pitch_in
 
int m_channels_in
 Width, height, pitch, and channel count of the source image. More...
 
NvBufSurfaceColorFormat m_colorFormatType
 Color format of the source surface. More...
 
int m_integrated_gpu
 Indicates whether execution uses an integrated GPU. More...
 
int m_deviceId
 GPU device identifier. More...
 
int m_debugVerboseLevel
 Debug verbosity level. More...
 

Constructor & Destructor Documentation

◆ FrameInputTexture() [1/2]

FrameInputTexture::FrameInputTexture ( )

Construct an uninitialized input-texture manager.

◆ ~FrameInputTexture() [1/2]

FrameInputTexture::~FrameInputTexture ( )

Release resources owned by the FrameInputTexture instance.

◆ FrameInputTexture() [2/2]

FrameInputTexture::FrameInputTexture ( )

Construct an uninitialized input-texture manager.

◆ ~FrameInputTexture() [2/2]

FrameInputTexture::~FrameInputTexture ( )

Release resources owned by the FrameInputTexture instance.

Member Function Documentation

◆ allocateInputMemoriesBatch() [1/2]

void FrameInputTexture::allocateInputMemoriesBatch ( const uint  numFramesInBatch,
const int  nx,
const int  ny,
const uint  pitch_in 
)
protected

Allocate device and host memory for a batch of input images.

Parameters
[in]numFramesInBatchNumber of frames in the batch.
[in]nxInput image width in pixels.
[in]nyInput image height in pixels.
[in]pitch_inInput image pitch in bytes.

◆ allocateInputMemoriesBatch() [2/2]

void FrameInputTexture::allocateInputMemoriesBatch ( const uint  numFramesInBatch,
const int  nx,
const int  ny,
const uint  pitch_in 
)
protected

Allocate device and host memory for a batch of input images.

Parameters
[in]numFramesInBatchNumber of frames in the batch.
[in]nxInput image width in pixels.
[in]nyInput image height in pixels.
[in]pitch_inInput image pitch in bytes.

◆ cleanUpTextureObjects() [1/2]

void FrameInputTexture::cleanUpTextureObjects ( int  cleanUpNum)

Remove the requested number of cached BGRA or grayscale texture objects.

Parameters
[in]cleanUpNumNumber of cached texture objects to remove.

◆ cleanUpTextureObjects() [2/2]

void FrameInputTexture::cleanUpTextureObjects ( int  cleanUpNum)

Remove the requested number of cached BGRA or grayscale texture objects.

Parameters
[in]cleanUpNumNumber of cached texture objects to remove.

◆ cleanUpTextureObjects_NV12() [1/2]

void FrameInputTexture::cleanUpTextureObjects_NV12 ( int  cleanUpNum)

Remove the requested number of cached NV12 texture objects.

Parameters
[in]cleanUpNumNumber of cached texture objects to remove.

◆ cleanUpTextureObjects_NV12() [2/2]

void FrameInputTexture::cleanUpTextureObjects_NV12 ( int  cleanUpNum)

Remove the requested number of cached NV12 texture objects.

Parameters
[in]cleanUpNumNumber of cached texture objects to remove.

◆ create_batch() [1/2]

bool FrameInputTexture::create_batch ( const std::map< NvMOTStreamId, NvMOTFrame * > &  nvFramesInBatch)

Cache a batch of source frames and create their texture objects.

Parameters
[in]nvFramesInBatchSource frames keyed by stream ID.
Returns
True when texture objects were created for the batch.

◆ create_batch() [2/2]

bool FrameInputTexture::create_batch ( const std::map< NvMOTStreamId, NvMOTFrame * > &  nvFramesInBatch)

Cache a batch of source frames and create their texture objects.

Parameters
[in]nvFramesInBatchSource frames keyed by stream ID.
Returns
True when texture objects were created for the batch.

◆ createTexObjInBatch() [1/2]

void FrameInputTexture::createTexObjInBatch ( )

Create texture objects for BGRA or grayscale frames in the current batch.

◆ createTexObjInBatch() [2/2]

void FrameInputTexture::createTexObjInBatch ( )

Create texture objects for BGRA or grayscale frames in the current batch.

◆ createTexObjInBatch_NV12() [1/2]

void FrameInputTexture::createTexObjInBatch_NV12 ( )

Create texture objects for NV12 frames in the current batch.

◆ createTexObjInBatch_NV12() [2/2]

void FrameInputTexture::createTexObjInBatch_NV12 ( )

Create texture objects for NV12 frames in the current batch.

◆ deAllocateInputMemoriesBatch() [1/2]

void FrameInputTexture::deAllocateInputMemoriesBatch ( )
protected

Release device and host memory for the input images.

◆ deAllocateInputMemoriesBatch() [2/2]

void FrameInputTexture::deAllocateInputMemoriesBatch ( )
protected

Release device and host memory for the input images.

◆ destroyTextureObjects() [1/2]

void FrameInputTexture::destroyTextureObjects ( )

Destroy all texture objects for the current batch.

◆ destroyTextureObjects() [2/2]

void FrameInputTexture::destroyTextureObjects ( )

Destroy all texture objects for the current batch.

◆ getChannelsIn() [1/2]

int FrameInputTexture::getChannelsIn ( )
inline

Get the number of input image channels.

Definition at line 128 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

References m_channels_in.

◆ getChannelsIn() [2/2]

int FrameInputTexture::getChannelsIn ( )
inline

Get the number of input image channels.

Definition at line 128 of file 9.2/sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

References m_channels_in.

◆ getColorFormat() [1/2]

NvBufSurfaceColorFormat FrameInputTexture::getColorFormat ( ) const
inline

Get the input surface color format.

Definition at line 131 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

References m_colorFormatType.

◆ getColorFormat() [2/2]

NvBufSurfaceColorFormat FrameInputTexture::getColorFormat ( ) const
inline

Get the input surface color format.

Definition at line 131 of file 9.2/sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

References m_colorFormatType.

◆ getHeightIn() [1/2]

int FrameInputTexture::getHeightIn ( )
inline

Get the input image height in pixels.

Definition at line 125 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

References m_height_in.

◆ getHeightIn() [2/2]

int FrameInputTexture::getHeightIn ( )
inline

Get the input image height in pixels.

Definition at line 125 of file 9.2/sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

References m_height_in.

◆ getTexturePointer() [1/2]

cudaTextureObject_t* FrameInputTexture::getTexturePointer ( NvMOTStreamId  streamId)

Get the BGRA or grayscale texture-object pointer for a stream.

Parameters
[in]streamIdVideo stream identifier.
Returns
Pointer to the stream's texture object, or null when unavailable.

◆ getTexturePointer() [2/2]

cudaTextureObject_t* FrameInputTexture::getTexturePointer ( NvMOTStreamId  streamId)

Get the BGRA or grayscale texture-object pointer for a stream.

Parameters
[in]streamIdVideo stream identifier.
Returns
Pointer to the stream's texture object, or null when unavailable.

◆ getTexturePointer_NV12() [1/2]

TextureObjects* FrameInputTexture::getTexturePointer_NV12 ( NvMOTStreamId  streamId)

Get the NV12 texture-object pair for a stream.

Parameters
[in]streamIdVideo stream identifier.
Returns
Pointer to the stream's texture-object pair, or null when unavailable.

◆ getTexturePointer_NV12() [2/2]

TextureObjects* FrameInputTexture::getTexturePointer_NV12 ( NvMOTStreamId  streamId)

Get the NV12 texture-object pair for a stream.

Parameters
[in]streamIdVideo stream identifier.
Returns
Pointer to the stream's texture-object pair, or null when unavailable.

◆ getWidthIn() [1/2]

int FrameInputTexture::getWidthIn ( )
inline

Get the input image width in pixels.

Definition at line 122 of file 9.2/sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

References m_width_in.

◆ getWidthIn() [2/2]

int FrameInputTexture::getWidthIn ( )
inline

Get the input image width in pixels.

Definition at line 122 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

References m_width_in.

◆ initialize() [1/2]

void FrameInputTexture::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.

Parameters
[in]debugVerboseLevelDebug verbosity level.
[in]maxStreamNumMaximum number of input streams.
[in]maxBufSurfAddrSizeMaximum number of cached surface-buffer addresses.
[in]srcImgSizeInput image dimensions.
[in]srcImgPitchInput image pitch in bytes.
[in]colorFormatTypeInput surface color format.

◆ initialize() [2/2]

void FrameInputTexture::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.

Parameters
[in]debugVerboseLevelDebug verbosity level.
[in]maxStreamNumMaximum number of input streams.
[in]maxBufSurfAddrSizeMaximum number of cached surface-buffer addresses.
[in]srcImgSizeInput image dimensions.
[in]srcImgPitchInput image pitch in bytes.
[in]colorFormatTypeInput surface color format.

◆ initialize4Input() [1/2]

void FrameInputTexture::initialize4Input ( uint  numFramesInBatch,
const NvMotDataTypes::Size  frameSize,
const uint  srcImgPitch,
const uint  frameChannels 
)
protected

Set the input image layout and allocate batch memory.

Parameters
[in]numFramesInBatchNumber of frames in the batch.
[in]frameSizeInput frame dimensions.
[in]srcImgPitchInput image pitch in bytes.
[in]frameChannelsNumber of input image channels.

◆ initialize4Input() [2/2]

void FrameInputTexture::initialize4Input ( uint  numFramesInBatch,
const NvMotDataTypes::Size  frameSize,
const uint  srcImgPitch,
const uint  frameChannels 
)
protected

Set the input image layout and allocate batch memory.

Parameters
[in]numFramesInBatchNumber of frames in the batch.
[in]frameSizeInput frame dimensions.
[in]srcImgPitchInput image pitch in bytes.
[in]frameChannelsNumber of input image channels.

◆ initializeTextureDescriptors() [1/2]

void FrameInputTexture::initializeTextureDescriptors ( )
protected

Initialize CUDA resource and texture descriptors.

◆ initializeTextureDescriptors() [2/2]

void FrameInputTexture::initializeTextureDescriptors ( )
protected

Initialize CUDA resource and texture descriptors.

◆ uploadDeviceData2DeviceMemories() [1/2]

void FrameInputTexture::uploadDeviceData2DeviceMemories ( const std::map< NvMOTStreamId, NvMOTFrame * > &  nvFramesInBatch)
protected

Upload a batch of source frames to pitch-linear CUDA memory.

Parameters
[in]nvFramesInBatchSource frames keyed by stream ID.

◆ uploadDeviceData2DeviceMemories() [2/2]

void FrameInputTexture::uploadDeviceData2DeviceMemories ( const std::map< NvMOTStreamId, NvMOTFrame * > &  nvFramesInBatch)
protected

Upload a batch of source frames to pitch-linear CUDA memory.

Parameters
[in]nvFramesInBatchSource frames keyed by stream ID.

Field Documentation

◆ m_channels_in

int FrameInputTexture::m_channels_in
protected

Width, height, pitch, and channel count of the source image.

Definition at line 200 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

Referenced by getChannelsIn().

◆ m_colorFormatType

NvBufSurfaceColorFormat FrameInputTexture::m_colorFormatType
protected

Color format of the source surface.

Definition at line 201 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

Referenced by getColorFormat().

◆ m_debugVerboseLevel

int FrameInputTexture::m_debugVerboseLevel
protected

◆ m_deviceId

int FrameInputTexture::m_deviceId
protected

◆ m_height_in

int FrameInputTexture::m_height_in
protected

◆ m_integrated_gpu

int FrameInputTexture::m_integrated_gpu
protected

Indicates whether execution uses an integrated GPU.

Definition at line 204 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_isInit

bool FrameInputTexture::m_isInit
protected

Indicates whether input texture state is initialized.

Definition at line 170 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_maxTexAddrSize

int FrameInputTexture::m_maxTexAddrSize
protected

Maximum number of cached texture addresses.

Definition at line 182 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_numFramesInBatchMax

uint FrameInputTexture::m_numFramesInBatchMax
protected

Maximum number of frames processed in a batch.

Definition at line 183 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_pitch_in

int FrameInputTexture::m_pitch_in
protected

◆ m_pTex

std::map< NvMOTStreamId, cudaTextureObject_t * > FrameInputTexture::m_pTex
protected

BGRA or grayscale texture pointers keyed by stream ID.

Definition at line 174 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_pTex_NV12

std::map< NvMOTStreamId, TextureObjects * > FrameInputTexture::m_pTex_NV12
protected

NV12 texture-object pairs keyed by stream ID.

Definition at line 175 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_resDesc

cudaResourceDesc FrameInputTexture::m_resDesc
protected

CUDA resource descriptor for RGBA data.

Definition at line 180 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_resDesc_chroma

cudaResourceDesc FrameInputTexture::m_resDesc_chroma
protected

CUDA resource descriptor for NV12 chroma data.

Definition at line 179 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_resDesc_luma

cudaResourceDesc FrameInputTexture::m_resDesc_luma
protected

CUDA resource descriptor for NV12 luma data.

Definition at line 178 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_srcNvFrames

std::map< NvMOTStreamId, NvMOTFrame * > FrameInputTexture::m_srcNvFrames
protected

Input source frames keyed by stream ID.

Definition at line 173 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_texDesc

cudaTextureDesc FrameInputTexture::m_texDesc
protected

CUDA texture descriptor shared by input formats.

Definition at line 181 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_texInputAddrMap

std::map< const NvBufSurfaceParams *, cudaTextureObject_t > FrameInputTexture::m_texInputAddrMap
protected

BGRA or grayscale texture objects keyed by surface address.

Definition at line 176 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_texInputAddrMap_NV12

std::map< const NvBufSurfaceParams *, TextureObjects > FrameInputTexture::m_texInputAddrMap_NV12
protected

NV12 texture-object pairs keyed by surface address.

Definition at line 177 of file sources/libs/nvmultiobjecttracker/include/modules/FrameTransform/FrameTransform.hpp.

◆ m_width_in

int FrameInputTexture::m_width_in
protected

The documentation for this class was generated from the following file: