[libcamera-devel,v2,3/4] libcamera: pipeline: rpi: Adjust to new implementation
diff mbox series

Message ID 20201231155336.7058-4-sebastian.fricke.linux@gmail.com
State Superseded
Headers show
Series
  • Improve BayerFormat class
Related show

Commit Message

Sebastian Fricke Dec. 31, 2020, 3:53 p.m. UTC
Remove the construction of a BayerFormat from a V4L2PixelFormat through
the old constructor. Add the new 'fromV4L2PixelFormat' static member
function.

Signed-off-by: Sebastian Fricke <sebastian.fricke.linux@gmail.com>
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jacopo Mondi Jan. 8, 2021, 11:32 a.m. UTC | #1
Hi Sebastian

On Thu, Dec 31, 2020 at 04:53:35PM +0100, Sebastian Fricke wrote:
> Remove the construction of a BayerFormat from a V4L2PixelFormat through
> the old constructor. Add the new 'fromV4L2PixelFormat' static member
> function.

Ah here you go. I would squash this in 1/4

Thanks
   j
>
> Signed-off-by: Sebastian Fricke <sebastian.fricke.linux@gmail.com>
> ---
>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index 7a5f5881..8ca9b9cf 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -358,7 +358,7 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()
>  			 */
>  			V4L2PixelFormat fourcc = sensorFormat.fourcc;
>  			if (data_->flipsAlterBayerOrder_) {
> -				BayerFormat bayer(fourcc);
> +				BayerFormat bayer = BayerFormat::fromV4L2PixelFormat(fourcc);
>  				bayer.order = data_->nativeBayerOrder_;
>  				bayer = bayer.transform(combined);
>  				fourcc = bayer.toV4L2PixelFormat();
> @@ -1007,7 +1007,7 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)
>  	BayerFormat bayerFormat;
>  	for (const auto &iter : dev->formats()) {
>  		V4L2PixelFormat v4l2Format = iter.first;
> -		bayerFormat = BayerFormat(v4l2Format);
> +		bayerFormat = BayerFormat::fromV4L2PixelFormat(v4l2Format);
>  		if (bayerFormat.isValid())
>  			break;
>  	}
> --
> 2.25.1
>
Laurent Pinchart Jan. 11, 2021, 12:56 a.m. UTC | #2
On Fri, Jan 08, 2021 at 12:32:33PM +0100, Jacopo Mondi wrote:
> Hi Sebastian
> 
> On Thu, Dec 31, 2020 at 04:53:35PM +0100, Sebastian Fricke wrote:
> > Remove the construction of a BayerFormat from a V4L2PixelFormat through
> > the old constructor. Add the new 'fromV4L2PixelFormat' static member
> > function.
> 
> Ah here you go. I would squash this in 1/4

Yes, otherwise it breaks bisection. Another option would be to have a
first patch that adds the new function, a second patch that updates the
RPi pipeline handler, and a third patch that removes the constructor.
Given that the change to the pipeline handler is small, it's not worth
splitting it in three patches.

> >
> > Signed-off-by: Sebastian Fricke <sebastian.fricke.linux@gmail.com>
> > ---
> >  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> > index 7a5f5881..8ca9b9cf 100644
> > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> > @@ -358,7 +358,7 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()
> >  			 */
> >  			V4L2PixelFormat fourcc = sensorFormat.fourcc;
> >  			if (data_->flipsAlterBayerOrder_) {
> > -				BayerFormat bayer(fourcc);
> > +				BayerFormat bayer = BayerFormat::fromV4L2PixelFormat(fourcc);
> >  				bayer.order = data_->nativeBayerOrder_;
> >  				bayer = bayer.transform(combined);
> >  				fourcc = bayer.toV4L2PixelFormat();
> > @@ -1007,7 +1007,7 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)
> >  	BayerFormat bayerFormat;
> >  	for (const auto &iter : dev->formats()) {
> >  		V4L2PixelFormat v4l2Format = iter.first;
> > -		bayerFormat = BayerFormat(v4l2Format);
> > +		bayerFormat = BayerFormat::fromV4L2PixelFormat(v4l2Format);
> >  		if (bayerFormat.isValid())
> >  			break;
> >  	}

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 7a5f5881..8ca9b9cf 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -358,7 +358,7 @@  CameraConfiguration::Status RPiCameraConfiguration::validate()
 			 */
 			V4L2PixelFormat fourcc = sensorFormat.fourcc;
 			if (data_->flipsAlterBayerOrder_) {
-				BayerFormat bayer(fourcc);
+				BayerFormat bayer = BayerFormat::fromV4L2PixelFormat(fourcc);
 				bayer.order = data_->nativeBayerOrder_;
 				bayer = bayer.transform(combined);
 				fourcc = bayer.toV4L2PixelFormat();
@@ -1007,7 +1007,7 @@  bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)
 	BayerFormat bayerFormat;
 	for (const auto &iter : dev->formats()) {
 		V4L2PixelFormat v4l2Format = iter.first;
-		bayerFormat = BayerFormat(v4l2Format);
+		bayerFormat = BayerFormat::fromV4L2PixelFormat(v4l2Format);
 		if (bayerFormat.isValid())
 			break;
 	}