[PATCH v1 1/7] controls: rpi: Add a vendor rpi::ScalerCrops control

Naushir Patuck naush at raspberrypi.com
Thu Aug 8 12:23:40 CEST 2024


Add a vendor control rpi::ScalerCrops that is analogous to the current
core::ScalerCrop, but can apply a different crop to each configured
stream.

This control takes a span of Rectangle structures - the order of
rectangles must match the order of streams configured by the application.

Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
---
 src/ipa/rpi/common/ipa_base.cpp    |  2 ++
 src/libcamera/control_ids_rpi.yaml | 15 +++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp
index ee3848b54f21..463f6d384c9e 100644
--- a/src/ipa/rpi/common/ipa_base.cpp
+++ b/src/ipa/rpi/common/ipa_base.cpp
@@ -71,6 +71,7 @@ const ControlInfoMap::Map ipaControls{
 	{ &controls::HdrMode, ControlInfo(controls::HdrModeValues) },
 	{ &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },
 	{ &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },
+	{ &controls::rpi::ScalerCrops, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },
 	{ &controls::FrameDurationLimits, ControlInfo(INT64_C(33333), INT64_C(120000)) },
 	{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) },
 	{ &controls::rpi::StatsOutputEnable, ControlInfo(false, true, false) },
@@ -1070,6 +1071,7 @@ void IpaBase::applyControls(const ControlList &controls)
 			break;
 		}
 
+		case controls::rpi::SCALER_CROPS:
 		case controls::SCALER_CROP: {
 			/* We do nothing with this, but should avoid the warning below. */
 			break;
diff --git a/src/libcamera/control_ids_rpi.yaml b/src/libcamera/control_ids_rpi.yaml
index cb097f887e16..3d4a305dd8f5 100644
--- a/src/libcamera/control_ids_rpi.yaml
+++ b/src/libcamera/control_ids_rpi.yaml
@@ -26,4 +26,19 @@ controls:
 
         \sa StatsOutputEnable
 
+  - ScalerCrops:
+      type: Rectangle
+      size: [n]
+      description: |
+        An array of rectangles, where each singular value has identical functionality
+        to the ScalerCrop control. This control allows the Raspberry Pi pipeline
+        handler to control individual scaler crops per output stream.
+
+        The order of rectangles passed into the control must match the order of
+        streams configured by the application.
+
+        Note that using different crop rectangles for each output stream is only
+        applicable on the Pi5/PiSP platform.
+
+        \sa ScalerCrop
 ...
-- 
2.34.1



More information about the libcamera-devel mailing list