[RFC,v2,15/43] ipa: libipa: agc_mean_luminance: constraintClampGain(): Mark `const`
diff mbox series

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

Commit Message

Barnabás Pőcze July 23, 2026, 3:42 p.m. UTC
There is no reason not to have this member function as `const`. Change the
map lookup to use `at()` just like it is done for `calculateNewEv()`, with
the same requirement that validation is the job of the caller.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 src/ipa/libipa/agc_mean_luminance.cpp | 4 ++--
 src/ipa/libipa/agc_mean_luminance.h   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Patch
diff mbox series

diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp
index 083d67eb70..e8679c66be 100644
--- a/src/ipa/libipa/agc_mean_luminance.cpp
+++ b/src/ipa/libipa/agc_mean_luminance.cpp
@@ -539,7 +539,7 @@  double AgcMeanLuminance::estimateInitialGain(const Traits &traits) const
  */
 double AgcMeanLuminance::constraintClampGain(uint32_t constraintModeIndex,
 					     const Histogram &hist,
-					     double gain)
+					     double gain) const
 {
 	auto applyConstraint = [this, &gain, &hist](const AgcConstraint &constraint) {
 		double lux = lux_;
@@ -569,7 +569,7 @@  double AgcMeanLuminance::constraintClampGain(uint32_t constraintModeIndex,
 		}
 	};
 
-	std::vector<AgcConstraint> &constraints = constraintModes_[constraintModeIndex];
+	const std::vector<AgcConstraint> &constraints = constraintModes_.at(constraintModeIndex);
 	std::for_each(constraints.begin(), constraints.end(), applyConstraint);
 
 	std::for_each(additionalConstraints_.begin(), additionalConstraints_.end(), applyConstraint);
diff --git a/src/ipa/libipa/agc_mean_luminance.h b/src/ipa/libipa/agc_mean_luminance.h
index eb9d6fec2b..9b82d97ab6 100644
--- a/src/ipa/libipa/agc_mean_luminance.h
+++ b/src/ipa/libipa/agc_mean_luminance.h
@@ -105,7 +105,7 @@  private:
 	double estimateInitialGain(const Traits &traits) const;
 	double constraintClampGain(uint32_t constraintModeIndex,
 				   const Histogram &hist,
-				   double gain);
+				   double gain) const;
 	utils::Duration filterExposure(utils::Duration exposureValue);
 
 	utils::Duration filteredExposure_;