[libcamera-devel,4/4] ipa: ipu3: agc: AE lock for AF scanning
diff mbox series

Message ID 20220322024155.6528-5-hpa@redhat.com
State Superseded
Headers show
Series
  • ipa: ipu3: af: Temporarily suspend AWB and AE during AF scanning
Related show

Commit Message

Kate Hsuan March 22, 2022, 2:41 a.m. UTC
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@redhat.com>
---
 src/ipa/ipu3/algorithms/agc.cpp | 14 ++++++++++++++
 src/ipa/ipu3/algorithms/agc.h   |  1 +
 2 files changed, 15 insertions(+)

Patch
diff mbox series

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_;