[libcamera-devel] [PATCH v6 08/10] ipa: rkisp1: Add AF controls to the RkISP1 IPA

Daniel Semkowicz dse at thaumatec.com
Fri Mar 31 10:19:28 CEST 2023


Add controls supported by the AF algorithm to the list of controls
supported by the RkISP1 IPA. This exposes the AF controls to the user
and allows controlling the AF algorithm using the top level API.

Signed-off-by: Daniel Semkowicz <dse at thaumatec.com>
---
 src/ipa/rkisp1/rkisp1.cpp | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index 292768cf..9c8b4a82 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -456,6 +456,28 @@ void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo,
 							      frameDurations[1],
 							      frameDurations[2]);
 
+	if (lensControls_) {
+		const ControlInfo &focusAbsolute =
+			lensControls_->at(V4L2_CID_FOCUS_ABSOLUTE);
+
+		using namespace controls;
+
+		ctrlMap[&AfMetering] = ControlInfo(AfMeteringValues);
+		ctrlMap[&AfMode] = ControlInfo(AfModeValues);
+		ctrlMap[&AfPause] = ControlInfo(
+			Span<const ControlValue>{
+				{ static_cast<int32_t>(AfPauseImmediate),
+				  static_cast<int32_t>(AfPauseResume) } });
+		ctrlMap[&AfTrigger] = ControlInfo(AfTriggerValues);
+		ctrlMap[&AfWindows] = ControlInfo(
+			Rectangle(), Rectangle(sensorInfo.outputSize),
+			Rectangle());
+		ctrlMap[&LensPosition] = ControlInfo(
+			static_cast<float>(focusAbsolute.min().get<int32_t>()),
+			static_cast<float>(focusAbsolute.max().get<int32_t>()),
+			static_cast<float>(focusAbsolute.def().get<int32_t>()));
+	}
+
 	*ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);
 }
 
-- 
2.39.2



More information about the libcamera-devel mailing list