[libcamera-devel] [PATCH 2/2] libcamera: Add support for RGB565 format
Jacopo Mondi
jacopo at jmondi.org
Mon Jul 20 10:37:24 CEST 2020
Hi Niklas,
On Mon, Jul 20, 2020 at 10:20:15AM +0200, Niklas Söderlund wrote:
> Hi Jacopo,
>
> Thanks for your feedback.
>
> On 2020-07-20 10:03:17 +0200, Jacopo Mondi wrote:
> > Hi Niklas,
> >
> > On Sat, Jul 18, 2020 at 04:34:28PM +0200, Niklas Söderlund wrote:
> > > Add support for RGB565 format.
> > >
> > > Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> > > ---
> > > src/libcamera/formats.cpp | 10 ++++++++++
> > > src/libcamera/formats.yaml | 3 +++
> > > src/libcamera/v4l2_pixelformat.cpp | 1 +
> > > 3 files changed, 14 insertions(+)
> > >
> > > diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
> > > index 8f9bdafe821b2e69..af3996c954ae1457 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 6b5f084bb2e4e970..3a69c05fcc04fb93 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 1609f8bb6370fa65..9799d389e20b358d 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 },
> >
> > Should RGB5 come after RGB2 ?
>
> I kept the same sorting order as videodev2.h, I'm open to define a
> different sorting order here tho. What do you think?
I don't see much value in staying aligned to videodev2.h, but as long
as this was intentional I'm fine, really a minor thing. Up to you.
>
> >
> > That apart
> > Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
> >
> > Thanks
> > j
> >
> > > { V4L2PixelFormat(V4L2_PIX_FMT_BGR24), formats::RGB888 },
> > > { V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), formats::ABGR8888 },
> > > --
> > > 2.27.0
> > >
> > > _______________________________________________
> > > libcamera-devel mailing list
> > > libcamera-devel at lists.libcamera.org
> > > https://lists.libcamera.org/listinfo/libcamera-devel
>
> --
> Regards,
> Niklas Söderlund
More information about the libcamera-devel
mailing list