Understanding nvjpeg dma buffer

I am working on a custom jpeg decoder that uses nvjpeg.
When I use something similar to decodeToFd I get a file handle to the dma buffer.

When does this buffer get allocated and when does the dma buffer get freed?
For example if I push all dma fds into a vector, would that be a memory leak?

Currently I use this code to get the dma buffer after the jpeg decoding:

dma_fd = cinfo.fd;

From gst-nvjpeg sources I also know that there is:

 cinfo.pVendor_buf = info.data;

Can I use cinfo.pVendor_buf to pass a preallocated dma buffer to the decoder?

Hi,
The buffer is allocated in first decodeToFd() call and destroyed in

delete ctx->jpegdec;

We would suggest keep it for putting decoded YUV and copy data to another NvBuffer through NvBufferTransform(). Please refer to how MJPG decoding is done in

/usr/src/jetson_multimedia_api/samples/12_camera_v4l2_cuda

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.