spa: libcamera: fix RGB mappings

Libcamera formats are generally little-endian, matching DMA DRM
fourccs, while PW ones are big-endian. Thus we have to invert the
order.

Only RGB and BGR where tested, as these are the formats currently
supported by the software ISP. This fixes inverted red and blue in
Snapshot on the Librem5 and Pinephone (OG).

See also gstlibcamera-utils.cpp in libcamera.
This commit is contained in:
Robert Mader 2024-05-05 10:35:57 +02:00 committed by Wim Taymans
parent cc88712ea6
commit 60deeb2555

View file

@ -165,16 +165,16 @@ static const struct format_info format_info[] = {
/* RGB formats */
MAKE_FMT(formats::RGB565, RGB16, video, raw),
MAKE_FMT(formats::RGB565_BE, RGB16, video, raw),
MAKE_FMT(formats::RGB888, RGB, video, raw),
MAKE_FMT(formats::BGR888, BGR, video, raw),
MAKE_FMT(formats::XRGB8888, xRGB, video, raw),
MAKE_FMT(formats::XBGR8888, xBGR, video, raw),
MAKE_FMT(formats::RGBX8888, RGBx, video, raw),
MAKE_FMT(formats::BGRX8888, BGRx, video, raw),
MAKE_FMT(formats::ARGB8888, ARGB, video, raw),
MAKE_FMT(formats::ABGR8888, ABGR, video, raw),
MAKE_FMT(formats::RGBA8888, RGBA, video, raw),
MAKE_FMT(formats::BGRA8888, BGRA, video, raw),
MAKE_FMT(formats::RGB888, BGR, video, raw),
MAKE_FMT(formats::BGR888, RGB, video, raw),
MAKE_FMT(formats::XRGB8888, BGRx, video, raw),
MAKE_FMT(formats::XBGR8888, RGBx, video, raw),
MAKE_FMT(formats::RGBX8888, xBGR, video, raw),
MAKE_FMT(formats::BGRX8888, xRGB, video, raw),
MAKE_FMT(formats::ARGB8888, BGRA, video, raw),
MAKE_FMT(formats::ABGR8888, RGBA, video, raw),
MAKE_FMT(formats::RGBA8888, ABGR, video, raw),
MAKE_FMT(formats::BGRA8888, ARGB, video, raw),
MAKE_FMT(formats::YUYV, YUY2, video, raw),
MAKE_FMT(formats::YVYU, YVYU, video, raw),