NvJPEGDecoder generates the same output if called twice with different input buffer

When I run the Jpeg decoder sample (06_jpeg_decode) for 2 different input images with the same resolution, the output yuv images are identical and fit the first input image.
for example I use 1920x1080 images :
./jpeg_decode num_files 2 …/…/data/Picture/nvidia-logo.jpg ~/Downloads/tst1.yuv ~/Downloads/1080p.jpg ~/Downloads/tst2.yuv --decode-fd
the output images tst1.yuv, tst2.yuv both contain the uncompressed data of the first image.
The issue doesn’t happen if the images have different resolutions.
Also - if I delete and reallocate the NvJPEGDecoder instance (by changing the source code) before decoding the second image, the issue doesn’t happen.
is this a known issue ?
I’m using Jetpack 5.1.2 on my Nvidia AGX orin.

1 Like

This looks to be an issue. We will reproduce the issue and check further.


I have the same issue on an Orin Nano. Is there any resolution to this issue? Deleting and recreating an NVJPEGDecoder instance degrades performance when using this class to decode a live MJPEG video stream frame by frame, for example. I notice that internally the class calls standard jpeg decompression functions. Having to delete and recreate the NVJPEGDecoder instance violates the jpeg decompression API, which explicitly allows for decompressing another image without having to destroy and recreate the decompressor instance (i.e. jpeg_decompress_finish documentation indicates a new image may be decompressed using the same decompressor after calling jpeg_decompress_finish).