How is the original image of NVBufSurface encoded as JPG via NVJPEG?

Duplicated with How is the original image of NVBufSurface encoded as JPG via NVJPEG? - Jetson & Embedded Systems / Jetson Xavier NX - NVIDIA Developer Forums