Curious values in optical flow sample

In NvOF.cpp, I see the following:

memset(&m_BufferDesc[NV_OF_BUFFER_USAGE_COST], 0, sizeof(NV_OF_BUFFER_DESCRIPTOR));
m_BufferDesc[NV_OF_BUFFER_USAGE_COST].width = nOutWidth;
m_BufferDesc[NV_OF_BUFFER_USAGE_COST].height = nOutHeight;
m_BufferDesc[NV_OF_BUFFER_USAGE_COST].bufferFormat = NV_OF_BUFFER_FORMAT_UINT8;
m_BufferDesc[NV_OF_BUFFER_USAGE_COST].bufferUsage = NV_OF_BUFFER_USAGE_COST;
m_ElementSize[NV_OF_BUFFER_USAGE_COST] = sizeof(uint32_t);

Can anyone explain to me why m_ElementSize is sizeof(uint32_t), when the buffer is described with NV_OF_BUFFER_FORMAT_UINT8?

Hi,
I think it is a bug.
There is a segmentation fault if you use DownloadData() of a cost buffer.
The DownloadData() uses m_ElementSize to allocate.
The problem is solved by changing the m_ElementSize to uint8_t

m_ElementSize[NV_OF_BUFFER_USAGE_COST] = sizeof(uint8_t);
3 Likes