[v3,15/19] libipa: agc_mean_luminance: Introduce effectiveYTarget() accessor
diff mbox series

Message ID 20250815102945.1602071-16-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • Implement WDR algorithm
Related show

Commit Message

Stefan Klug Aug. 15, 2025, 10:29 a.m. UTC
The upcoming WDR algorithm needs to know the effective y target (Which
includes the current ExposureValue). Add a accessor for that.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>

---

Changes in v3:
- Added this patch
---
 src/ipa/libipa/agc_mean_luminance.cpp | 16 ++++++++++++++--
 src/ipa/libipa/agc_mean_luminance.h   |  2 ++
 2 files changed, 16 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp
index 6c7cf0038b16..2bfafe9b2d02 100644
--- a/src/ipa/libipa/agc_mean_luminance.cpp
+++ b/src/ipa/libipa/agc_mean_luminance.cpp
@@ -458,8 +458,7 @@  void AgcMeanLuminance::setLimits(utils::Duration minExposureTime,
  */
 double AgcMeanLuminance::estimateInitialGain() const
 {
-	double yTarget = std::min(relativeLuminanceTarget_ * exposureCompensation_,
-				  kMaxRelativeLuminanceTarget);
+	double yTarget = effectiveYTarget();
 	double yGain = 1.0;
 
 	/*
@@ -521,6 +520,19 @@  double AgcMeanLuminance::constraintClampGain(uint32_t constraintModeIndex,
 	return gain;
 }
 
+/**
+ * \brief Get the currently effective y target
+ *
+ * This function return the current y target including exposure compensation.
+ *
+ * \return The y target value
+ */
+double AgcMeanLuminance::effectiveYTarget() const
+{
+	return std::min(relativeLuminanceTarget_ * exposureCompensation_,
+			kMaxRelativeLuminanceTarget);
+}
+
 /**
  * \brief Apply a filter on the exposure value to limit the speed of changes
  * \param[in] exposureValue The target exposure from the AGC algorithm
diff --git a/src/ipa/libipa/agc_mean_luminance.h b/src/ipa/libipa/agc_mean_luminance.h
index fbb526f6ae8e..950b7b893754 100644
--- a/src/ipa/libipa/agc_mean_luminance.h
+++ b/src/ipa/libipa/agc_mean_luminance.h
@@ -72,6 +72,8 @@  public:
 	calculateNewEv(uint32_t constraintModeIndex, uint32_t exposureModeIndex,
 		       const Histogram &yHist, utils::Duration effectiveExposureValue);
 
+	double effectiveYTarget() const;
+
 	void resetFrameCount()
 	{
 		frameCount_ = 0;