[libcamera-devel] qcam: Corrupt JPEG data

Eric Curtin ecurtin at redhat.com
Thu Sep 1 11:14:04 CEST 2022


On Thu, 1 Sept 2022 at 06:41, Laurent Pinchart via libcamera-devel
<libcamera-devel at lists.libcamera.org> wrote:
>
> 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.

This camera is referenced twice in this issue:

https://github.com/tensorflow/models/issues/2194

There is some python based decoder that has gotten good feedback on
this issue. We could try and rewrite this solution in C/C++ here:

src/cam/sdl_texture_mjpg.cpp

and test with `cam -S`

>
> How often does this occur ? Do you see the message for every frame, or
> once in a while ?
>
> > I don't have this issue with other cameras on MJPEG mode or in "cam". I,

We could add a decompress option for file output (or direct DRM/KMS)
if it helped debug the issue, since we have the decompression code
written in the file referenced above.

>
> "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 ?
>
> --
> Regards,
>
> Laurent Pinchart
>



More information about the libcamera-devel mailing list