[libcamera-devel] [PATCH v2 3/3] ipa: ipu3: awb: Suspend AWB when AF is working

Kate Hsuan hpa at redhat.com
Fri May 6 07:18:41 CEST 2022


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 at redhat.com>
---
 src/ipa/ipu3/algorithms/awb.cpp | 8 +++++++-
 src/ipa/ipu3/algorithms/awb.h   | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

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];
-- 
2.35.1



More information about the libcamera-devel mailing list