libcamera: formats: Add RGB565_BE format

This new format corresponds to the V4L2 V4L2_PIX_FMT_RGB565X format, and
is the big-endian version of the DRM_FORMAT_RGB565 format.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart 2021-01-31 20:40:00 +02:00
parent 7c496f1c54
commit 040a6dcfbc
3 changed files with 14 additions and 0 deletions

View file

@ -155,6 +155,16 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
.pixelsPerGroup = 1, .pixelsPerGroup = 1,
.planes = {{ { 3, 1 }, { 0, 0 }, { 0, 0 } }}, .planes = {{ { 3, 1 }, { 0, 0 }, { 0, 0 } }},
} }, } },
{ formats::RGB565_BE, {
.name = "RGB565_BE",
.format = formats::RGB565_BE,
.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_RGB565X),
.bitsPerPixel = 16,
.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
.packed = false,
.pixelsPerGroup = 1,
.planes = {{ { 3, 1 }, { 0, 0 }, { 0, 0 } }},
} },
{ formats::BGR888, { { formats::BGR888, {
.name = "BGR888", .name = "BGR888",
.format = formats::BGR888, .format = formats::BGR888,

View file

@ -10,6 +10,9 @@ formats:
- RGB565: - RGB565:
fourcc: DRM_FORMAT_RGB565 fourcc: DRM_FORMAT_RGB565
- RGB565_BE:
fourcc: DRM_FORMAT_RGB565
big_endian: true
- RGB888: - RGB888:
fourcc: DRM_FORMAT_RGB888 fourcc: DRM_FORMAT_RGB888

View file

@ -47,6 +47,7 @@ namespace {
const std::map<V4L2PixelFormat, PixelFormat> vpf2pf{ const std::map<V4L2PixelFormat, PixelFormat> vpf2pf{
/* RGB formats. */ /* RGB formats. */
{ V4L2PixelFormat(V4L2_PIX_FMT_RGB565), formats::RGB565 }, { V4L2PixelFormat(V4L2_PIX_FMT_RGB565), formats::RGB565 },
{ V4L2PixelFormat(V4L2_PIX_FMT_RGB565X), formats::RGB565_BE },
{ V4L2PixelFormat(V4L2_PIX_FMT_RGB24), formats::BGR888 }, { V4L2PixelFormat(V4L2_PIX_FMT_RGB24), formats::BGR888 },
{ V4L2PixelFormat(V4L2_PIX_FMT_BGR24), formats::RGB888 }, { V4L2PixelFormat(V4L2_PIX_FMT_BGR24), formats::RGB888 },
{ V4L2PixelFormat(V4L2_PIX_FMT_XBGR32), formats::XRGB8888 }, { V4L2PixelFormat(V4L2_PIX_FMT_XBGR32), formats::XRGB8888 },