[libcamera-devel] [PATCH 3/3] pipeline: raspberrypi: Advertise ScalerCrop from the pipeline handler

Naushir Patuck naush at raspberrypi.com
Fri Jun 10 14:25:33 CEST 2022


The ScalerCrop control is handled directly by the pipeline handler. Remove the
control from the IPA's static ControlInfoMap, and let the pipeline handler add
it to the ControlInfoMap advertised to the application, ensuring the limits
are set appropriately based on the current sensor mode.

Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
---
 src/ipa/raspberrypi/raspberrypi.cpp                |  1 -
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 10 +++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index 295f6b735dc0..f46fccdd4177 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -86,7 +86,6 @@ static const ControlInfoMap::Map ipaControls{
 	{ &controls::Saturation, ControlInfo(0.0f, 32.0f, 1.0f) },
 	{ &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },
 	{ &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) },
-	{ &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },
 	{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }
 };
 
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 4596f2babcea..66a84b1dfb97 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -941,7 +941,15 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
 	data->properties_.set(properties::SensorSensitivity, result.modeSensitivity);
 
 	/* Update the controls that the Raspberry Pi IPA can handle. */
-	data->controlInfo_ = result.controlInfo;
+	ControlInfoMap::Map ctrlMap;
+	for (auto const &c : result.controlInfo)
+		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)));
+
+	data->controlInfo_ = ControlInfoMap(std::move(ctrlMap), result.controlInfo.idmap());
 
 	/* Setup the Video Mux/Bridge entities. */
 	for (auto &[device, link] : data->bridgeDevices_) {
-- 
2.25.1



More information about the libcamera-devel mailing list