summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-01-31 20:40:00 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-02-01 22:34:13 +0200
commit040a6dcfbccaf1005da2c571769b1f89df1f07cf (patch)
treee2871cb95083f6831f94c6f4b00384ebe17aa5af
parent7c496f1c54dd5846925183471b30fec227624a65 (diff)
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>
-rw-r--r--src/libcamera/formats.cpp10
-rw-r--r--src/libcamera/formats.yaml3
-rw-r--r--src/libcamera/v4l2_pixelformat.cpp1
3 files changed, 14 insertions, 0 deletions
diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
index cc6e5790..55822f4c 100644
--- a/src/libcamera/formats.cpp
+++ b/src/libcamera/formats.cpp
@@ -155,6 +155,16 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
.pixelsPerGroup = 1,
.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, {
.name = "BGR888",
.format = formats::BGR888,
diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml
index 6a2fb721..43b5877e 100644
--- a/src/libcamera/formats.yaml
+++ b/src/libcamera/formats.yaml
@@ -10,6 +10,9 @@ formats:
- RGB565:
fourcc: DRM_FORMAT_RGB565
+ - RGB565_BE:
+ fourcc: DRM_FORMAT_RGB565
+ big_endian: true
- RGB888:
fourcc: DRM_FORMAT_RGB888
diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
index 03ab085c..166d93cf 100644
--- a/src/libcamera/v4l2_pixelformat.cpp
+++ b/src/libcamera/v4l2_pixelformat.cpp
@@ -47,6 +47,7 @@ namespace {
const std::map<V4L2PixelFormat, PixelFormat> vpf2pf{
/* RGB formats. */
{ 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_BGR24), formats::RGB888 },
{ V4L2PixelFormat(V4L2_PIX_FMT_XBGR32), formats::XRGB8888 },