[libcamera-devel] [PATCH] libcamera: pipeline: raspberrypi: Fix scaler crop when sensor is configured

David Plowman david.plowman at raspberrypi.com
Wed Feb 9 13:08:04 CET 2022


We must calculate the initial scaler crop when the camera is
configured, otherwise the metadata will report this rectangle as being
all zeroes.

Signed-off-by: David Plowman <david.plowman at raspberrypi.com>
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 583ee798..d6c57e7a 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -887,6 +887,11 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
 	if (ret)
 		LOG(RPI, Error) << "Failed to configure the IPA: " << ret;
 
+	/* Set the scaler crop to the value that we are using. */
+	data->scalerCrop_ = data->ispCrop_.scaledBy(data->sensorInfo_.analogCrop.size(),
+						    data->sensorInfo_.outputSize);
+	data->scalerCrop_.translateBy(data->sensorInfo_.analogCrop.topLeft());
+
 	/*
 	 * Configure the Unicam embedded data output format only if the sensor
 	 * supports it.
-- 
2.30.2



More information about the libcamera-devel mailing list