[libcamera-devel] [PATCH v2 2/3] ipa: ipu3: af: Trigger AF after AGC is stable
Kate Hsuan
hpa at redhat.com
Fri May 6 07:18:40 CEST 2022
AGC stable status is used to determine that AF is triggered or paused.
If AGC is ready, AF can start to evaluate the lens position.
Signed-off-by: Kate Hsuan<hpa at redhat.com>
---
src/ipa/ipu3/algorithms/af.cpp | 12 ++++++++++++
src/ipa/ipu3/algorithms/af.h | 2 ++
2 files changed, 14 insertions(+)
diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp
index f700b01f..8cabd064 100644
--- a/src/ipa/ipu3/algorithms/af.cpp
+++ b/src/ipa/ipu3/algorithms/af.cpp
@@ -403,6 +403,16 @@ bool Af::afIsOutOfFocus(IPAContext context)
return false;
}
+void Af::pause(IPAContext &context)
+{
+ context.frameContext.af.focus = focus_;
+}
+
+bool Af::isAgcStable(IPAContext context)
+{
+ return context.frameContext.agc.stable;
+}
+
/**
* \brief Determine the max contrast image and lens position.
* \param[in] context The IPA context.
@@ -421,6 +431,8 @@ bool Af::afIsOutOfFocus(IPAContext context)
*/
void Af::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)
{
+ if (!isAgcStable(context))
+ pause(context);
/* Evaluate the AF buffer length */
uint32_t afRawBufferLen = context.configuration.af.afGrid.width *
context.configuration.af.afGrid.height;
diff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h
index b85cf941..c1c9d39e 100644
--- a/src/ipa/ipu3/algorithms/af.h
+++ b/src/ipa/ipu3/algorithms/af.h
@@ -44,6 +44,8 @@ private:
double afEstimateVariance(Span<const y_table_item_t> y_items, bool isY1);
bool afIsOutOfFocus(IPAContext context);
+ bool isAgcStable(IPAContext context);
+ void pause(IPAContext &context);
/* VCM step configuration. It is the current setting of the VCM step. */
uint32_t focus_;
--
2.35.1
More information about the libcamera-devel
mailing list