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>
This commit is contained in:
Niklas Söderlund 2020-07-18 16:20:55 +02:00
parent 7855dc922f
commit d9295552b1
3 changed files with 14 additions and 0 deletions

View file

@ -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,

View file

@ -8,6 +8,9 @@ formats:
- R8:
fourcc: DRM_FORMAT_R8
- RGB565:
fourcc: DRM_FORMAT_RGB565
- RGB888:
fourcc: DRM_FORMAT_RGB888
- BGR888:

View file

@ -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 },