[libcamera-devel] [PATCH 2/4] ipa: ipu3: af: AE and AWE lock request flow when performing AF

Kate Hsuan hpa at redhat.com
Tue Mar 22 03:41:53 CET 2022


When AF start to work, it requests to lock the AE and AWB to stabilize
the estimated variance of the AF scene. After the algorithm determinesthe
lens position, the lock will be released immediately.

Signed-off-by: Kate Hsuan <hpa at redhat.com>
---
 src/ipa/ipu3/algorithms/af.cpp | 22 ++++++++++++++++++++++
 src/ipa/ipu3/algorithms/af.h   |  2 ++
 2 files changed, 24 insertions(+)

diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp
index 40a8ddae..7b9cfd05 100644
--- a/src/ipa/ipu3/algorithms/af.cpp
+++ b/src/ipa/ipu3/algorithms/af.cpp
@@ -197,6 +197,26 @@ int Af::configure(IPAContext &context, const IPAConfigInfo &configInfo)
 	return 0;
 }
 
+/**
+ * \brief Lock AE and AWB
+ * \param[in] context The shared IPA context
+ */
+void Af::afLockAeAwb(IPAContext &context)
+{
+	if (!context.frameContext.af.stable && ignoreCounter_ == 0)
+		context.configuration.af.requireAeAwbLock = true;
+}
+
+/**
+ * \brief Unlock AE and AWB
+ * \param[in] context The shared IPA context
+ */
+void Af::afUnlockAeAwb(IPAContext &context)
+{
+	if (context.frameContext.af.stable)
+		context.configuration.af.requireAeAwbLock = false;
+}
+
 /**
  * \brief AF coarse scan
  *
@@ -451,8 +471,10 @@ void Af::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)
 		currentVariance_ = afEstimateVariance(y_item, afRawBufferLen, true);
 
 	if (!context.frameContext.af.stable) {
+		afLockAeAwb(context);
 		afCoarseScan(context);
 		afFineScan(context);
+		afUnlockAeAwb(context);
 	} else {
 		if (afIsOutOfFocus(context))
 			afReset(context);
diff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h
index 13c7e0e8..c03a163f 100644
--- a/src/ipa/ipu3/algorithms/af.h
+++ b/src/ipa/ipu3/algorithms/af.h
@@ -55,6 +55,8 @@ private:
 	double afEstimateVariance(y_table_item_t *y_item, uint32_t len,
 				  bool isY1);
 	bool afIsOutOfFocus(IPAContext context);
+	void afLockAeAwb(IPAContext &context);
+	void afUnlockAeAwb(IPAContext &context);
 
 	/* VCM step configuration. It is the current setting of the VCM step. */
 	uint32_t focus_;
-- 
2.33.1



More information about the libcamera-devel mailing list