nvjpeg die on decoding picture

When input one of JPEG picture to Tegra multimedia API sample jpeg_decode.
Program die and cannot catch exception.

How can I avoid program dying program ?

nvidia@tegra-ubuntu:~/tegra_multimedia_api/samples/06_jpeg_decode$ ./jpeg_decode num_files 1 ../../data/Picture/ng.jpg ng.raw --decode-fd
Failed to query video capabilities: Inappropriate ioctl for device
Improper call to JPEG library in state 205
nvbuf_utils: dmabuf_fd -1 mapped entry NOT found

When succeed

nvidia@tegra-ubuntu:~/tegra_multimedia_api/samples/06_jpeg_decode$ ./jpeg_decode num_files 1 ../../data/Picture/nvidia-logo.jpg ok.raw --decode-fd
Failed to query video capabilities: Inappropriate ioctl for device
Image Resolution - 1920 x 1080
libv4l2_nvvidconv (0):(792) (INFO) : Allocating (1) OUTPUT PLANE BUFFERS Layout=0
libv4l2_nvvidconv (0):(808) (INFO) : Allocating (1) CAPTURE PLANE BUFFERS Layout=0
App run was successful

ng.jpg
ng2.jpg

ng.jpg

ng2.jpg

Hi nobutaka,
We will check and update.

Please apply attached patch to NvJpegDecoder class and run

06_jpeg_decode$ ./jpeg_decode num_files 1 ng.jpg test.raw --decode-buffer

‘–decode-fd’ is not supported due to limit of HW alignment.

0001-mm_api-jpeg_decode-fix-decoding-failure_1.zip (2.55 KB)

Thank you !!
I was able to decode by pached code.

Excuse me, one more anothor problem with ng2.jpg

nvidia@tegra-ubuntu:~/tegra_multimedia_api/samples/06_jpeg_decode$ ./jpeg_decode num_files 1 ng2.jpg x.raw --decode-buffer
Image Resolution - 620 x 349
nvbuf_utils: dmabuf_fd -1 mapped entry NOT found
*** Error in `./jpeg_decode’: double free or corruption (!prev): 0x0000000000483270 ***
Aborted (core dumped)

Please use libnvjpeg.so at
https://devtalk.nvidia.com/default/topic/1035699/jetson-tx1/premature-end-of-jpeg-file-tegra_multimedia-master-samples-06_jpeg_decode-/post/5263099/#5263099

And apply updated patch at #3

Thank you again !!

I was able to decode all jpeg pictures I have.