[RFC,v3,50/50] ipa: libipa: agc_mean_luminance: Fold resetFrameCount() in configure()
diff mbox series

Message ID 20260803131435.153927-51-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • ipa: libipa: agc rework
Related show

Commit Message

Barnabás Pőcze Aug. 3, 2026, 1:14 p.m. UTC
From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

The AgcMeanLuminance::resetFrameCount() function has to be called
after a call to AgcMeanLuminance::configure(). As the two calls always
happen one after another, do not require each IPA implementation to do
that but fold instead the call to resetFrameCount() in
AgcMeanLuminance::configure().

Update the AgcMeanLuminance class documentation accordingly.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
---
 src/ipa/libipa/agc.cpp                |  1 -
 src/ipa/libipa/agc_mean_luminance.cpp | 21 ++++++---------------
 src/ipa/libipa/agc_mean_luminance.h   |  5 -----
 3 files changed, 6 insertions(+), 21 deletions(-)

Patch
diff mbox series

diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp
index 169a53f2cd..cd10bd45b6 100644
--- a/src/ipa/libipa/agc.cpp
+++ b/src/ipa/libipa/agc.cpp
@@ -413,7 +413,6 @@  int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state,
 
 			ASSERT(sensor_);
 			impl.configure(session.lineDuration, sensor_);
-			impl.resetFrameCount();
 
 			if (session.autoAllowed) {
 				config.ctrlMap[&controls::ExposureValue] = ControlInfo(-8.0f, 8.0f, 0.0f);
diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp
index 8303065008..2459f8b44a 100644
--- a/src/ipa/libipa/agc_mean_luminance.cpp
+++ b/src/ipa/libipa/agc_mean_luminance.cpp
@@ -169,11 +169,11 @@  static constexpr unsigned int kDefaultLuxLevel = 500;
  *
  * IPA modules that want to use this class to implement their AEGC algorithm
  * should derive AgcMeanLuminance::Traits and override the necessary functions.
- * The users must call parseTuningData() in init(), and must also call setLimits()
- * and resetFrameCounter() in configure(). They may then use calculateNewEv() in
- * process(). If the limits passed to setLimits() change for any reason (for example,
- * in response to a FrameDurationLimit control being passed in queueRequest())
- * then setLimits() must be called again with the new values.
+ * The users must call parseTuningData() in init(), and must also call configure()
+ * and setLimits() in configure(). They may then use calculateNewEv() in process().
+ * If the limits passed to setLimits() change for any reason (for example, in
+ * response to a FrameDurationLimit control being passed in queueRequest()) then
+ * setLimits() must be called again with the new values.
  */
 
 AgcMeanLuminance::AgcMeanLuminance()
@@ -354,6 +354,7 @@  void AgcMeanLuminance::configure(utils::Duration lineDuration,
 
 	luxWarningEnabled_ = true;
 	filteredExposure_ = 0s;
+	frameCount_ = 0;
 }
 
 /**
@@ -699,16 +700,6 @@  AgcMeanLuminance::calculateNewEv(const Params &params)
 	return { exposureModeHelper.splitExposure(newExposureValue), yTarget };
 }
 
-/**
- * \fn AgcMeanLuminance::resetFrameCount()
- * \brief Reset the frame counter
- *
- * This function resets the internal frame counter, which exists to help the
- * algorithm decide whether it should respond instantly or not. The expectation
- * is for users to call this function before each camera start call in their
- * configure() function.
- */
-
 } /* namespace ipa */
 
 } /* namespace libcamera */
diff --git a/src/ipa/libipa/agc_mean_luminance.h b/src/ipa/libipa/agc_mean_luminance.h
index 46a4d3e3f3..f799618ffc 100644
--- a/src/ipa/libipa/agc_mean_luminance.h
+++ b/src/ipa/libipa/agc_mean_luminance.h
@@ -79,11 +79,6 @@  public:
 
 	double effectiveYTarget(double lux, double exposureCompensation) const;
 
-	void resetFrameCount()
-	{
-		frameCount_ = 0;
-	}
-
 private:
 	int parseRelativeLuminanceTarget(const ValueNode &tuningData);
 	int parseConstraint(const ValueNode &modeDict, int32_t id);