[libcamera-devel] [PATCH v2 5/6] libcamera: Add support for XRGB8888 and XBGR8888
Niklas Söderlund
niklas.soderlund at ragnatech.se
Fri Oct 2 16:49:51 CEST 2020
Hi Jacopo,
On 2020-10-02 16:12:09 +0200, Jacopo Mondi wrote:
> Hi Niklas,
>
> On Thu, Oct 01, 2020 at 05:45:59PM +0200, Niklas Söderlund wrote:
> > Add support for XRGB8888 and XBGR8888 formats.
> >
> > Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> > ---
> > * Changes since v1
> > - Fix type in v4l2_pixelformat.cpp where V4L2_PIX_FMT_XBGR32 was added
> > twice instead of adding V4L2_PIX_FMT_XBGR32 and V4L2_PIX_FMT_XRGB32.
> > ---
> > src/libcamera/formats.cpp | 20 ++++++++++++++++++++
> > src/libcamera/v4l2_pixelformat.cpp | 2 ++
> > 2 files changed, 22 insertions(+)
> >
> > diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
> > index ebaae9be3d75fe58..cc6e579005b2d4b6 100644
> > --- a/src/libcamera/formats.cpp
> > +++ b/src/libcamera/formats.cpp
> > @@ -175,6 +175,26 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
> > .pixelsPerGroup = 1,
> > .planes = {{ { 3, 1 }, { 0, 0 }, { 0, 0 } }},
> > } },
> > + { formats::XRGB8888, {
> > + .name = "XRGB8888",
> > + .format = formats::XRGB8888,
> > + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_XBGR32),
> > + .bitsPerPixel = 32,
> > + .colourEncoding = PixelFormatInfo::ColourEncodingRGB,
> > + .packed = false,
> > + .pixelsPerGroup = 1,
> > + .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }},
> > + } },
> > + { formats::XBGR8888, {
> > + .name = "XBGR8888",
> > + .format = formats::XBGR8888,
> > + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_XRGB32),
> > + .bitsPerPixel = 32,
> > + .colourEncoding = PixelFormatInfo::ColourEncodingRGB,
> > + .packed = false,
> > + .pixelsPerGroup = 1,
> > + .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }},
> > + } },
>
> Just to make sure: is it intented that XRGB maps to V4L2's XBGR and
> XBGR to XRGB ? (note the RGB->BGR permutation) ?
Yes this is intentional, see the ABGR8888 (and friends below). This is
one of these really nice things of the split world of fourcc right :-)
>
> > { formats::ABGR8888, {
> > .name = "ABGR8888",
> > .format = formats::ABGR8888,
> > diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
> > index 30c94bb98f442b08..6b05909f56ae975b 100644
> > --- a/src/libcamera/v4l2_pixelformat.cpp
> > +++ b/src/libcamera/v4l2_pixelformat.cpp
> > @@ -48,6 +48,8 @@ const std::map<V4L2PixelFormat, PixelFormat> vpf2pf{
> > { 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_XBGR32), formats::XRGB8888 },
> > + { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::XBGR8888 },
> > { V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), formats::ABGR8888 },
> > { V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), formats::ARGB8888 },
> > { V4L2PixelFormat(V4L2_PIX_FMT_ARGB32), formats::BGRA8888 },
> > --
> > 2.28.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