[RFC,4/4] ipa: mali-c55: agc: Do not derive from AgcMeanLuminance
diff mbox series

Message ID 20250818082909.2001635-5-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • libipa: agc_mean_luminance: Use composition instead of
Related show

Commit Message

Stefan Klug Aug. 18, 2025, 8:28 a.m. UTC
There is no need to derive from AgcMeanLuminance anymore. Use
composition for easier understanding.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
---
 src/ipa/mali-c55/algorithms/agc.cpp | 21 ++++++++++-----------
 src/ipa/mali-c55/algorithms/agc.h   |  3 ++-
 2 files changed, 12 insertions(+), 12 deletions(-)

Patch
diff mbox series

diff --git a/src/ipa/mali-c55/algorithms/agc.cpp b/src/ipa/mali-c55/algorithms/agc.cpp
index 4bfb4aaeedf0..eda111cd8640 100644
--- a/src/ipa/mali-c55/algorithms/agc.cpp
+++ b/src/ipa/mali-c55/algorithms/agc.cpp
@@ -129,13 +129,12 @@  void AgcStatistics::parseStatistics(const mali_c55_stats_buffer *stats)
 }
 
 Agc::Agc()
-	: AgcMeanLuminance()
 {
 }
 
 int Agc::init(IPAContext &context, const YamlObject &tuningData)
 {
-	int ret = parseTuningData(tuningData);
+	int ret = agc_.parseTuningData(tuningData);
 	if (ret)
 		return ret;
 
@@ -145,7 +144,7 @@  int Agc::init(IPAContext &context, const YamlObject &tuningData)
 		static_cast<float>(kMaxDigitalGain),
 		static_cast<float>(kMinDigitalGain)
 	);
-	context.ctrlMap.merge(controls());
+	context.ctrlMap.merge(agc_.controls());
 
 	return 0;
 }
@@ -168,16 +167,16 @@  int Agc::configure(IPAContext &context,
 	context.activeState.agc.manual.sensorGain = context.configuration.agc.minAnalogueGain;
 	context.activeState.agc.manual.exposure = context.configuration.agc.defaultExposure;
 	context.activeState.agc.manual.ispGain = kMinDigitalGain;
-	context.activeState.agc.constraintMode = constraintModes().begin()->first;
-	context.activeState.agc.exposureMode = exposureModeHelpers().begin()->first;
+	context.activeState.agc.constraintMode = agc_.constraintModes().begin()->first;
+	context.activeState.agc.exposureMode = agc_.exposureModeHelpers().begin()->first;
 
 	/* \todo Run this again when FrameDurationLimits is passed in */
-	setLimits(context.configuration.agc.minShutterSpeed,
+	agc_.setLimits(context.configuration.agc.minShutterSpeed,
 		  context.configuration.agc.maxShutterSpeed,
 		  context.configuration.agc.minAnalogueGain,
 		  context.configuration.agc.maxAnalogueGain);
 
-	resetFrameCount();
+	agc_.resetFrameCount();
 
 	return 0;
 }
@@ -385,10 +384,10 @@  void Agc::process(IPAContext &context,
 	utils::Duration shutterTime;
 	double aGain, dGain;
 	std::tie(shutterTime, aGain, dGain) =
-		calculateNewEv(std::bind(&Agc::estimateLuminance, this, _1),
-			       activeState.agc.constraintMode,
-			       activeState.agc.exposureMode, statistics_.yHist,
-			       effectiveExposureValue);
+		agc_.calculateNewEv(std::bind(&Agc::estimateLuminance, this, _1),
+				    activeState.agc.constraintMode,
+				    activeState.agc.exposureMode, statistics_.yHist,
+				    effectiveExposureValue);
 
 	dGain = std::clamp(dGain, kMinDigitalGain, kMaxDigitalGain);
 
diff --git a/src/ipa/mali-c55/algorithms/agc.h b/src/ipa/mali-c55/algorithms/agc.h
index 698de57e1ba8..06c26fd88209 100644
--- a/src/ipa/mali-c55/algorithms/agc.h
+++ b/src/ipa/mali-c55/algorithms/agc.h
@@ -43,7 +43,7 @@  private:
 	unsigned int bIndex_;
 };
 
-class Agc : public Algorithm, public AgcMeanLuminance
+class Agc : public Algorithm
 {
 public:
 	Agc();
@@ -74,6 +74,7 @@  private:
 				      enum mali_c55_param_block_type type);
 
 	AgcStatistics statistics_;
+	AgcMeanLuminance agc_;
 };
 
 } /* namespace ipa::mali_c55::algorithms */