Hello,
I start to learn Multimedia API with sample code with my USB camera (MJPEG mode VGA 640x480).
When I generate JPEG files and try to decode these files frame by frame,
Jpeg decode sample code (or libnvjpeg) returns “Premature end of JPEG file”(JWRN_JPEG_EOF).
However, when I try to decode these files in Ubuntu 16.04 desktop, sw decoder normally done without any error.
Seems not related to the size of image.
Not always happen. around 75% (75files/100files) on Jetson TX1. 0% on desktop.
Any suggestion is welcome.
Sho
Jetson Tx1 R28 revision 2
target code 06_jpeg_decode (tegra_multimedia-master/samples)
>jpeg_decode sample_011053857913.jpg t.pgm --decode-buffer
Premature end of JPEG file <--------------------------------
Image Resolution - 640 x 480
nvbuf_utils: dmabuf_fd -1 mapped entry NOT found
App run was successful
decodeToBuffer()@jpeg_decode_main.cpp returns 0 (but NvJPEGDecorder::decodeToBuffer almost always return 0)
jerror.h
JMESSAGE(JWRN_JPEG_EOF, “Premature end of JPEG file”)
Hi sho.murakoshi,
We tried to repro your issue, but test 100 times, still no issue on JetPack3.2/TX1.
nvidia@tegra-ubuntu:~/tegra_multimedia_api/samples/06_jpeg_decode$ ./jpeg_decode num_files 1 ../../data/Picture/nvidia-logo.jpg test.yuv --decode-buffer
Image Resolution - 1920 x 1080
nvbuf_utils: dmabuf_fd -1 mapped entry NOT found
App run was successful
Hi carolyuu,
Thank you for confirmation.
Could you test with attached jpeg file “Premature_end_of_JPEG_file.jpg”?
Regards
Sho
Hi sho.murakoshi,
We can repro issue with “Premature_end_of_JPEG_file.jpg” file.
Our internal will check issue first and update to you.
Hi carolyuu,
Thanks for reply.
P.S.
libturbojpeg@TX1 & libjpeg@Desktop can decode the file without any warning&error.
Sho
Hi carolyuu,
How the progress of checking?
Sho
Please try attached libnvjpeg.so
r28.2-libnvjpeg.so.txt (309 KB)
Hello,
I had checked 100 frames of data.
There is no “Premature_end_of_JPEG_file” message.
Thank you.
Question:
-The decoded image is same as original?
-Why nvidia-logo.jpg is OK and my jpeg is NG even if size is smaller?
Regards
Sho
Hi Sho time,
Ususally EOI is at the end of file
xx xx xx FF D9
But JPEGS from your USB camera are with padding bytes at end:
FF D9 00 00 00
xx FF D9 00 00
xx xx FF D9 00
Attached libnvjpeg.so adds logic of searching EOI at last few bytes.
Hi DaneLLL,
I had checked more than 100 files and confirm the padding bytes at end.
The position of EOI is from EOF-3 to EOF, and probability of occurrence is flat.
I’ll add EOI serch function to ignore padding bytes with resize the length of data before jpeg decoding.
Thanks a lot.
Regards
Sho