summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-07-18 16:20:55 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-07-21 14:19:09 +0200
commitd9295552b17c72c57357e901cd256bcf66528233 (patch)
treec0665fda3cc1895f5a34e7db35e3cbe4252f6dc2
parent7855dc922f789a30930f777b062d630d38391ba0 (diff)
libcamera: Add support for RGB565 format
Add support for RGB565 format. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-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 8f9bdafe..af3996c9 100644
--- a/src/libcamera/formats.cpp
+++ b/src/libcamera/formats.cpp
@@ -233,6 +233,16 @@ const PixelFormatInfo pixelFormatInfoInvalid{};
const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
/* RGB formats. */
+ { formats::RGB565, {
+ .name = "RGB565",
+ .format = formats::RGB565,
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_RGB565),
+ .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 6b5f084b..3a69c05f 100644
--- a/src/libcamera/formats.yaml
+++ b/src/libcamera/formats.yaml
@@ -8,6 +8,9 @@ formats:
- R8:
fourcc: DRM_FORMAT_R8
+ - RGB565:
+ fourcc: DRM_FORMAT_RGB565
+
- RGB888:
fourcc: DRM_FORMAT_RGB888
- BGR888:
diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
index 2ebc1f18..c8f69ee9 100644
--- a/src/libcamera/v4l2_pixelformat.cpp
+++ b/src/libcamera/v4l2_pixelformat.cpp
@@ -45,6 +45,7 @@ namespace {
const std::map<V4L2PixelFormat, PixelFormat> vpf2pf{
/* RGB formats. */
+ { V4L2PixelFormat(V4L2_PIX_FMT_RGB565), formats::RGB565 },
{ V4L2PixelFormat(V4L2_PIX_FMT_RGB24), formats::BGR888 },
{ V4L2PixelFormat(V4L2_PIX_FMT_BGR24), formats::RGB888 },
{ V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), formats::ABGR8888 },