[libcamera-devel] [PATCH 4/4] ipa: ipu3: agc: AE lock for AF scanning

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


When the AF starts to perform the scan, AWB will be suspended to maintain
the AF scene variance and improve the AF performance. Any changes in
the exposure value will lead to an incorrect focus value during scanning.

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

diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp
index 7d4b3503..2f28747a 100644
--- a/src/ipa/ipu3/algorithms/agc.cpp
+++ b/src/ipa/ipu3/algorithms/agc.cpp
@@ -314,6 +314,17 @@ double Agc::estimateLuminance(IPAFrameContext &frameContext,
 	return ySum / (grid.height * grid.width) / 255;
 }
 
+/**
+ * \brief Test the AF requested lock is exist.
+ */
+bool Agc::isAfRequestedLock(IPAContext context)
+{
+	if (context.configuration.af.requireAeAwbLock)
+		return true;
+	else
+		return false;
+}
+
 /**
  * \brief Process IPU3 statistics, and run AGC operations
  * \param[in] context The shared IPA context
@@ -343,6 +354,9 @@ void Agc::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)
 	double yGain = 1.0;
 	double yTarget = kRelativeLuminanceTarget;
 
+	if (isAfRequestedLock(context))
+		return;
+
 	for (unsigned int i = 0; i < 8; i++) {
 		double yValue = estimateLuminance(context.frameContext,
 						  context.configuration.grid.bdsGrid,
diff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h
index ad705605..e00b28e5 100644
--- a/src/ipa/ipu3/algorithms/agc.h
+++ b/src/ipa/ipu3/algorithms/agc.h
@@ -40,6 +40,7 @@ private:
 				 const ipu3_uapi_grid_config &grid,
 				 const ipu3_uapi_stats_3a *stats,
 				 double gain);
+	bool isAfRequestedLock(IPAContext context);
 
 	uint64_t frameCount_;
 
-- 
2.33.1



More information about the libcamera-devel mailing list