[libcamera-devel,v1,2/2] libcamera: Adds pixel format BGRX8888
diff mbox series

Message ID 20210702120850.457492-2-vedantparanjape160201@gmail.com
State Superseded
Headers show
Series
  • [libcamera-devel,v1,1/2] Fixes: libcamera: Fix the V4L2 pixel format for formats::XBGR8888
Related show

Commit Message

Vedant Paranjape July 2, 2021, 12:08 p.m. UTC
This patch adds pixel format BGRX8888 to libcamera. Additionally adds
mapping of V4L2 pixel format (V4L2_PIX_FMT_XRGB32) to BGRX8888.

Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
---
 src/libcamera/formats.cpp          | 10 ++++++++++
 src/libcamera/v4l2_pixelformat.cpp |  1 +
 2 files changed, 11 insertions(+)

Comments

Paul Elder July 6, 2021, 10:05 a.m. UTC | #1
Hi Vedant,

s/Adds/add/ in the subject.

On Fri, Jul 02, 2021 at 05:38:50PM +0530, Vedant Paranjape wrote:
> This patch adds pixel format BGRX8888 to libcamera. Additionally adds
> mapping of V4L2 pixel format (V4L2_PIX_FMT_XRGB32) to BGRX8888.
> 
> Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>

Other than that, looks good.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  src/libcamera/formats.cpp          | 10 ++++++++++
>  src/libcamera/v4l2_pixelformat.cpp |  1 +
>  2 files changed, 11 insertions(+)
> 
> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
> index 578ac4af..8f1197de 100644
> --- a/src/libcamera/formats.cpp
> +++ b/src/libcamera/formats.cpp
> @@ -205,6 +205,16 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.pixelsPerGroup = 1,
>  		.planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }},
>  	} },
> +	{ formats::BGRX8888, {
> +		.name = "BGRX8888",
> +		.format = formats::BGRX8888,
> +		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_XRGB32),
> +		.bitsPerPixel = 32,
> +		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
> +		.packed = false,
> +		.pixelsPerGroup = 1,
> +		.planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }},
> +	} },
>  	{ formats::ABGR8888, {
>  		.name = "ABGR8888",
>  		.format = formats::ABGR8888,
> diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
> index 59a01e02..93fc4446 100644
> --- a/src/libcamera/v4l2_pixelformat.cpp
> +++ b/src/libcamera/v4l2_pixelformat.cpp
> @@ -52,6 +52,7 @@ const std::map<V4L2PixelFormat, PixelFormat> vpf2pf{
>  	{ 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::BGRX8888 },
>  	{ V4L2PixelFormat(V4L2_PIX_FMT_RGBX32), formats::XBGR8888 },
>  	{ V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), formats::ABGR8888 },
>  	{ V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), formats::ARGB8888 },
> -- 
> 2.25.1
>
Laurent Pinchart July 13, 2021, 1:11 a.m. UTC | #2
Hi Vedant,

Thank you for the patch.

On Tue, Jul 06, 2021 at 07:05:09PM +0900, paul.elder@ideasonboard.com wrote:
> Hi Vedant,
> 
> s/Adds/add/ in the subject.
> 
> On Fri, Jul 02, 2021 at 05:38:50PM +0530, Vedant Paranjape wrote:
> > This patch adds pixel format BGRX8888 to libcamera. Additionally adds
> > mapping of V4L2 pixel format (V4L2_PIX_FMT_XRGB32) to BGRX8888.
> > 
> > Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
> 
> Other than that, looks good.
> 
> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Can you send a v2 of the series ? We'll then apply it.

> > ---
> >  src/libcamera/formats.cpp          | 10 ++++++++++
> >  src/libcamera/v4l2_pixelformat.cpp |  1 +
> >  2 files changed, 11 insertions(+)
> > 
> > diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
> > index 578ac4af..8f1197de 100644
> > --- a/src/libcamera/formats.cpp
> > +++ b/src/libcamera/formats.cpp
> > @@ -205,6 +205,16 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
> >  		.pixelsPerGroup = 1,
> >  		.planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }},
> >  	} },
> > +	{ formats::BGRX8888, {
> > +		.name = "BGRX8888",
> > +		.format = formats::BGRX8888,
> > +		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_XRGB32),
> > +		.bitsPerPixel = 32,
> > +		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
> > +		.packed = false,
> > +		.pixelsPerGroup = 1,
> > +		.planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }},
> > +	} },
> >  	{ formats::ABGR8888, {
> >  		.name = "ABGR8888",
> >  		.format = formats::ABGR8888,
> > diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
> > index 59a01e02..93fc4446 100644
> > --- a/src/libcamera/v4l2_pixelformat.cpp
> > +++ b/src/libcamera/v4l2_pixelformat.cpp
> > @@ -52,6 +52,7 @@ const std::map<V4L2PixelFormat, PixelFormat> vpf2pf{
> >  	{ 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::BGRX8888 },
> >  	{ V4L2PixelFormat(V4L2_PIX_FMT_RGBX32), formats::XBGR8888 },
> >  	{ V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), formats::ABGR8888 },
> >  	{ V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), formats::ARGB8888 },

Patch
diff mbox series

diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
index 578ac4af..8f1197de 100644
--- a/src/libcamera/formats.cpp
+++ b/src/libcamera/formats.cpp
@@ -205,6 +205,16 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.pixelsPerGroup = 1,
 		.planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }},
 	} },
+	{ formats::BGRX8888, {
+		.name = "BGRX8888",
+		.format = formats::BGRX8888,
+		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_XRGB32),
+		.bitsPerPixel = 32,
+		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
+		.packed = false,
+		.pixelsPerGroup = 1,
+		.planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }},
+	} },
 	{ formats::ABGR8888, {
 		.name = "ABGR8888",
 		.format = formats::ABGR8888,
diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
index 59a01e02..93fc4446 100644
--- a/src/libcamera/v4l2_pixelformat.cpp
+++ b/src/libcamera/v4l2_pixelformat.cpp
@@ -52,6 +52,7 @@  const std::map<V4L2PixelFormat, PixelFormat> vpf2pf{
 	{ 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::BGRX8888 },
 	{ V4L2PixelFormat(V4L2_PIX_FMT_RGBX32), formats::XBGR8888 },
 	{ V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), formats::ABGR8888 },
 	{ V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), formats::ARGB8888 },