[libcamera-devel,v1] pipeline: raspberrypi: Fix incorrect advertising of ScalerCrop
diff mbox series

Message ID 20220705134100.26713-1-naush@raspberrypi.com
State Superseded
Headers show
Series
  • [libcamera-devel,v1] pipeline: raspberrypi: Fix incorrect advertising of ScalerCrop
Related show

Commit Message

Naushir Patuck July 5, 2022, 1:41 p.m. UTC
The controls::ScalerCrop in the ControlInfoMap was advertised based on the ISP
output Rectangle. This is incorrect, it needs to be set based on the sensor
output Rectangle. Fix this.

Additionally, do not use emplace to be consistent with the other controls set
in the ControlInfoMap.

Fixes: 9dacde0d651d (pipeline: raspberrypi: Advertise ScalerCrop from the pipeline handler)
Reported-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Plowman July 5, 2022, 1:45 p.m. UTC | #1
Hi Naush

Thanks for the fix!

On Tue, 5 Jul 2022 at 14:41, Naushir Patuck <naush@raspberrypi.com> wrote:
>
> The controls::ScalerCrop in the ControlInfoMap was advertised based on the ISP
> output Rectangle. This is incorrect, it needs to be set based on the sensor
> output Rectangle. Fix this.
>
> Additionally, do not use emplace to be consistent with the other controls set
> in the ControlInfoMap.
>
> Fixes: 9dacde0d651d (pipeline: raspberrypi: Advertise ScalerCrop from the pipeline handler)
> Reported-by: David Plowman <david.plowman@raspberrypi.com>
> Signed-off-by: Naushir Patuck <naush@raspberrypi.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 66a84b1dfb97..d1ecc50af3b9 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -946,8 +946,8 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
>                 ctrlMap.emplace(c.first, c.second);
>
>         /* Add the ScalerCrop control limits based on the current mode. */
> -       ctrlMap.emplace(&controls::ScalerCrop,
> -                       ControlInfo(Rectangle(data->ispMinCropSize_), Rectangle(data->sensorInfo_.outputSize)));
> +       ctrlMap[&controls::ScalerCrop] =
> +               ControlInfo(Rectangle(data->ispMinCropSize_), Rectangle(data->sensorInfo_.analogCrop.size()));

Actually (and really sorry only to notice this now), I wonder if the
ispMinCropSize needs scaling up to native pixel units?

David

>
>         data->controlInfo_ = ControlInfoMap(std::move(ctrlMap), result.controlInfo.idmap());
>
> --
> 2.25.1
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 66a84b1dfb97..d1ecc50af3b9 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -946,8 +946,8 @@  int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
 		ctrlMap.emplace(c.first, c.second);
 
 	/* Add the ScalerCrop control limits based on the current mode. */
-	ctrlMap.emplace(&controls::ScalerCrop,
-			ControlInfo(Rectangle(data->ispMinCropSize_), Rectangle(data->sensorInfo_.outputSize)));
+	ctrlMap[&controls::ScalerCrop] =
+		ControlInfo(Rectangle(data->ispMinCropSize_), Rectangle(data->sensorInfo_.analogCrop.size()));
 
 	data->controlInfo_ = ControlInfoMap(std::move(ctrlMap), result.controlInfo.idmap());