ipa: ipu3: agc: Introduce previous exposure value
We need to calculate the gain on the previous exposure value calculated. Now that we initialise the exposure and gain values in configure(), we know the initial exposure value, and we can set it before any loop is running. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
fd5a82ea88
commit
cd0b3402ea
2 changed files with 18 additions and 2 deletions
|
@ -42,7 +42,8 @@ static constexpr double kEvGainTarget = 0.5;
|
|||
Agc::Agc()
|
||||
: frameCount_(0), lastFrame_(0), iqMean_(0.0), lineDuration_(0s),
|
||||
minExposureLines_(0), maxExposureLines_(0), filteredExposure_(0s),
|
||||
filteredExposureNoDg_(0s), currentExposure_(0s), currentExposureNoDg_(0s)
|
||||
filteredExposureNoDg_(0s), currentExposure_(0s),
|
||||
currentExposureNoDg_(0s), prevExposureValue_(0s)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -62,6 +63,10 @@ int Agc::configure(IPAContext &context, const IPAConfigInfo &configInfo)
|
|||
context.configuration.agc.minAnalogueGain;
|
||||
context.frameContext.agc.exposure = minExposureLines_;
|
||||
|
||||
prevExposureValue_ = context.frameContext.agc.gain
|
||||
* context.frameContext.agc.exposure
|
||||
* lineDuration_;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -147,7 +152,7 @@ void Agc::lockExposureGain(uint32_t &exposure, double &analogueGain)
|
|||
<< " Gain " << analogueGain
|
||||
<< " Needed ev gain " << evGain;
|
||||
|
||||
currentExposure_ = currentExposureNoDg_ * evGain;
|
||||
currentExposure_ = prevExposureValue_ * evGain;
|
||||
utils::Duration minShutterSpeed = minExposureLines_ * lineDuration_;
|
||||
utils::Duration maxShutterSpeed = maxExposureLines_ * lineDuration_;
|
||||
|
||||
|
@ -176,6 +181,16 @@ void Agc::lockExposureGain(uint32_t &exposure, double &analogueGain)
|
|||
|
||||
exposure = shutterTime / lineDuration_;
|
||||
analogueGain = stepGain;
|
||||
|
||||
/*
|
||||
* Update the exposure value for the next process call.
|
||||
*
|
||||
* \todo Obtain the values of the exposure time and analog gain
|
||||
* that were actually used by the sensor, either from embedded
|
||||
* data when available, or from the delayed controls
|
||||
* infrastructure in case a slow down caused a mismatch.
|
||||
*/
|
||||
prevExposureValue_ = shutterTime * analogueGain;
|
||||
}
|
||||
lastFrame_ = frameCount_;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue