I am using jetson multimedia api to decode a jpeg image with the hardware decoder on the Jetson AGX Orin.
The current flow is as follows
- Use NvJPEGDecoder::decodetoFd to decode the JPEG image to hardware buffer (this is in YUV format)
- Transform from YUV to BGRA with NvBufSurface::NvTransform.
- Use NvBufSurfaceFromFd to get the pointer to the NV buffer surface.
- Map the hardware buffer to CPU with NvBufSurfaceMap and use the surfaceList.mappedAddr.addr to access the data from the NvBufSurface.
In order to avoid the overhead of CPU mapping, I want to access the buffer data from the NvBufSurface directly (from the GPU memory) to create a torch tensor out of it. Does anyone know how to achieve this?
Thank you in advance.