@@ -77,11 +77,11 @@ int Agc::init(IPAContext &context, const YamlObject &tuningData)
{
int ret;
- ret = parseTuningData(tuningData);
+ ret = agc_.parseTuningData(tuningData);
if (ret)
return ret;
- context.ctrlMap.merge(controls());
+ context.ctrlMap.merge(agc_.controls());
return 0;
}
@@ -113,13 +113,13 @@ int Agc::configure(IPAContext &context,
activeState.agc.gain = minAnalogueGain_;
activeState.agc.exposure = 10ms / configuration.sensor.lineDuration;
- 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(minExposureTime_, maxExposureTime_, minAnalogueGain_,
- maxAnalogueGain_);
- resetFrameCount();
+ agc_.setLimits(minExposureTime_, maxExposureTime_, minAnalogueGain_,
+ maxAnalogueGain_);
+ agc_.resetFrameCount();
return 0;
}
@@ -225,10 +225,10 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
utils::Duration newExposureTime;
double aGain, dGain;
std::tie(newExposureTime, aGain, dGain) =
- calculateNewEv(std::bind(&Agc::estimateLuminance, this, _1),
- context.activeState.agc.constraintMode,
- context.activeState.agc.exposureMode, hist,
- effectiveExposureValue);
+ agc_.calculateNewEv(std::bind(&Agc::estimateLuminance, this, _1),
+ context.activeState.agc.constraintMode,
+ context.activeState.agc.exposureMode, hist,
+ effectiveExposureValue);
LOG(IPU3Agc, Debug)
<< "Divided up exposure time, analogue gain and digital gain are "
@@ -24,7 +24,7 @@ struct IPACameraSensorInfo;
namespace ipa::ipu3::algorithms {
-class Agc : public Algorithm, public AgcMeanLuminance
+class Agc : public Algorithm
{
public:
Agc();
@@ -42,6 +42,8 @@ private:
Histogram parseStatistics(const ipu3_uapi_stats_3a *stats,
const ipu3_uapi_grid_config &grid);
+ AgcMeanLuminance agc_;
+
utils::Duration minExposureTime_;
utils::Duration maxExposureTime_;
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/ipu3/algorithms/agc.cpp | 22 +++++++++++----------- src/ipa/ipu3/algorithms/agc.h | 4 +++- 2 files changed, 14 insertions(+), 12 deletions(-)