@@ -502,9 +502,8 @@ void AgcMeanLuminance::setLimits(utils::Duration minExposureTime,
* target
* \return The calculated initial gain
*/
-double AgcMeanLuminance::estimateInitialGain(const Traits &traits) const
+double AgcMeanLuminance::estimateInitialGain(const Traits &traits, double yTarget) const
{
- double yTarget = effectiveYTarget();
double yGain = 1.0;
/*
@@ -671,6 +670,9 @@ utils::Duration AgcMeanLuminance::filterExposure(utils::Duration exposureValue)
/**
* \struct AgcMeanLuminance::Result
* \brief Collection of results of the mean luminance AGC algorithm
+ *
+ * \var AgcMeanLuminance::Result::yTarget
+ * \brief The current y target including exposure compensation
*/
/**
@@ -694,6 +696,7 @@ AgcMeanLuminance::calculateNewEv(const Params ¶ms)
*/
ExposureModeHelper &exposureModeHelper =
exposureModeHelpers_.at(params.exposureModeIndex);
+ double yTarget = effectiveYTarget();
if (params.effectiveExposureValue == 0s) {
LOG(AgcMeanLuminance, Error)
@@ -704,10 +707,10 @@ AgcMeanLuminance::calculateNewEv(const Params ¶ms)
* doesn't get stuck with 0 in case the sensor driver allows a
* min exposure of 0.
*/
- return { exposureModeHelper.splitExposure(10ms) };
+ return { exposureModeHelper.splitExposure(10ms), yTarget };
}
- double gain = estimateInitialGain(params.traits);
+ double gain = estimateInitialGain(params.traits, yTarget);
gain = constraintClampGain(params.constraintModeIndex, params.yHist, gain);
/*
@@ -726,7 +729,7 @@ AgcMeanLuminance::calculateNewEv(const Params ¶ms)
newExposureValue = filterExposure(newExposureValue);
frameCount_++;
- return { exposureModeHelper.splitExposure(newExposureValue) };
+ return { exposureModeHelper.splitExposure(newExposureValue), yTarget };
}
/**
@@ -87,6 +87,7 @@ public:
};
struct Result : ExposureModeHelper::Result {
+ double yTarget;
};
[[nodiscard]] Result calculateNewEv(const Params ¶ms);
@@ -103,7 +104,7 @@ private:
int parseConstraint(const ValueNode &modeDict, int32_t id);
int parseConstraintModes(const ValueNode &tuningData);
int parseExposureModes(const ValueNode &tuningData);
- double estimateInitialGain(const Traits &traits) const;
+ double estimateInitialGain(const Traits &traits, double yTarget) const;
double constraintClampGain(uint32_t constraintModeIndex,
const Histogram &hist,
double gain) const;
@@ -741,7 +741,7 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
activeState.agc.automatic.exposure = newEv.exposureTime / lineDuration;
activeState.agc.automatic.gain = newEv.analogueGain;
activeState.agc.automatic.quantizationGain = newEv.quantizationGain;
- activeState.agc.automatic.yTarget = agc_.effectiveYTarget();
+ activeState.agc.automatic.yTarget = newEv.yTarget;
/*
* Expand the target frame duration so that we do not run faster than
* the minimum frame duration when we have short exposures.
Return the current applicable y target as part of the result set. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> --- src/ipa/libipa/agc_mean_luminance.cpp | 13 ++++++++----- src/ipa/libipa/agc_mean_luminance.h | 3 ++- src/ipa/rkisp1/algorithms/agc.cpp | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-)