[libcamera-devel,v2,3/3] ipa: ipu3: awb: Suspend AWB when AF is working
diff mbox series

Message ID 20220506051841.70792-4-hpa@redhat.com
State New
Headers show
Series
  • ipa: ipu3: af: Temporarily suspend AWB during AF scanning
Related show

Commit Message

Kate Hsuan May 6, 2022, 5:18 a.m. UTC
An unstable AWB results in AF performance degradation. AWB is properly
paused during AF scanning to improve the accuracy of focus.

Signed-off-by: Kate Hsuan<hpa@redhat.com>
---
 src/ipa/ipu3/algorithms/awb.cpp | 8 +++++++-
 src/ipa/ipu3/algorithms/awb.h   | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp
index 87a6cc7a..3c924fc9 100644
--- a/src/ipa/ipu3/algorithms/awb.cpp
+++ b/src/ipa/ipu3/algorithms/awb.cpp
@@ -384,12 +384,18 @@  void Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats)
 	}
 }
 
+bool Awb::isAfStable(IPAContext context)
+{
+	return context.frameContext.af.stable;
+}
+
 /**
  * \copydoc libcamera::ipa::Algorithm::process
  */
 void Awb::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)
 {
-	calculateWBGains(stats);
+	if (!isAfStable(context))
+		calculateWBGains(stats);
 
 	/*
 	 * Gains are only recalculated if enough zones were detected.
diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h
index ab4b0a33..131a51e4 100644
--- a/src/ipa/ipu3/algorithms/awb.h
+++ b/src/ipa/ipu3/algorithms/awb.h
@@ -72,6 +72,7 @@  private:
 	void awbGreyWorld();
 	uint32_t estimateCCT(double red, double green, double blue);
 	static constexpr uint16_t threshold(float value);
+	bool isAfStable(IPAContext context);
 
 	std::vector<RGB> zones_;
 	Accumulator awbStats_[kAwbStatsSizeX * kAwbStatsSizeY];