"Warning: JPEG format error, rc = 5" for most of my JPEG files
|Assignee:||Andreas Huggel||% Done:|
For most images taken with my Sony A700 I'm getting the
above warning. The reason is that the SOF segment can
completely confuse the parser as it doesn't adjust the
file pointer for that segment. (I.e. it will read over
the segment boundary and may or may not sync afterwards.)
The attached patch fixes the problem.
#3 Updated by mhx - almost 10 years ago
Also, this issue makes batch processing files incredibly slow,
as the code usually jumps past the SOS marker after the SOF
segment and gets lost in the compressed image data. So it
scans the whole file instead of exiting just after discovery
of the SOS marker.
mhx@r2d2 ~/data/images/2008-06-11 $ time ~/src/c/test/exiv2-0.17/src/exiv2 *.jpg >/dev/null 2>&1
mhx@r2d2 ~/data/images/2008-06-11 $ time ~/src/c/test/exiv2-0.17-mhx/src/exiv2 *.jpg >/dev/null 2>&1
I did flush the filesystem cache before each run, the timings
are reproducible. So that's almost a slowdown by a factor of 7,
which makes a huge difference in applications that always scan
the whole image folder.