[libcamera-devel] qcam: Corrupt JPEG data

Christian Rauch Rauch.Christian at gmx.de
Thu Sep 1 23:44:24 CEST 2022


Hi Laurent,

Am 01.09.22 um 07:40 schrieb Laurent Pinchart:
> Hi Christian,
>
> On Wed, Aug 31, 2022 at 11:13:50PM +0200, Christian Rauch via libcamera-devel wrote:
>> Hi,
>>
>> I have a "Logitech, Inc. Webcam C270" (046d:0825) USB wecam that causes
>> an MJPEG related error message in qcam of the form: "Corrupt JPEG data:
>> XX extraneous bytes before marker 0xXX". I don't see obvious issues with
>> the resulting (decoded) image.
>
> How often does this occur ? Do you see the message for every frame, or
> once in a while ?

I see this every 2~4 frame.

>> I don't have this issue with other cameras on MJPEG mode or in "cam". I,
>
> "cam" doesn't attempt to decompress JPEG images, so you won't see the
> rror there indeed.
>
>> however, have this same issue in my own code where I decode the jpeg
>> payload via OpenCV imdecode.
>
>> The error message originates from "libjpeg-turbo":
>> https://github.com/libjpeg-turbo/libjpeg-turbo/blob/2.1.4/jerror.h#L192-L193
>>
>> Is this a:
>> a) hardware issue
>> b) libcamera issue
>> c) libjpeg-turbo issue
>> d) all of the above :-)
>
> Could you share one JPEG frame that triggers the issue ?

I attached a 160x120 jpeg ("img.jpg") that I dumped from within "qcam"
via the "src->data(0).data()" in "FormatConverter::convert".

Running
  python3 -c "import cv2; cv2.imread('img.jpg')"
on this give me
  Corrupt JPEG data: 2 extraneous bytes before marker 0xd4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: img.jpg
Type: image/jpeg
Size: 4711 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20220901/5f751f3e/attachment.jpg>


More information about the libcamera-devel mailing list