ipa: ipu3: agc: Refactor ev gain calculation and testing
When we compute the new gain, we use the iqMean_ and estimate an exposure value gain to apply. Return early when the gain is less than 1%. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
parent
4fdf1e4f5e
commit
3d81620b20
1 changed files with 6 additions and 8 deletions
|
@ -188,14 +188,6 @@ void Agc::filterExposure()
|
||||||
*/
|
*/
|
||||||
void Agc::computeExposure(IPAFrameContext &frameContext)
|
void Agc::computeExposure(IPAFrameContext &frameContext)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Are we correctly exposed ? */
|
|
||||||
if (std::abs(iqMean_ - kEvGainTarget * knumHistogramBins) <= 1) {
|
|
||||||
LOG(IPU3Agc, Debug) << "We are well exposed (iqMean = "
|
|
||||||
<< iqMean_ << ")";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the effective exposure and gain applied on the sensor. */
|
/* Get the effective exposure and gain applied on the sensor. */
|
||||||
uint32_t exposure = frameContext.sensor.exposure;
|
uint32_t exposure = frameContext.sensor.exposure;
|
||||||
double analogueGain = frameContext.sensor.gain;
|
double analogueGain = frameContext.sensor.gain;
|
||||||
|
@ -203,6 +195,12 @@ void Agc::computeExposure(IPAFrameContext &frameContext)
|
||||||
/* Estimate the gain needed to have the proportion wanted */
|
/* Estimate the gain needed to have the proportion wanted */
|
||||||
double evGain = kEvGainTarget * knumHistogramBins / iqMean_;
|
double evGain = kEvGainTarget * knumHistogramBins / iqMean_;
|
||||||
|
|
||||||
|
if (std::abs(evGain - 1.0) < 0.01) {
|
||||||
|
LOG(IPU3Agc, Debug) << "We are well exposed (iqMean = "
|
||||||
|
<< iqMean_ << ")";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* extracted from Rpi::Agc::computeTargetExposure */
|
/* extracted from Rpi::Agc::computeTargetExposure */
|
||||||
/* Calculate the shutter time in seconds */
|
/* Calculate the shutter time in seconds */
|
||||||
utils::Duration currentShutter = exposure * lineDuration_;
|
utils::Duration currentShutter = exposure * lineDuration_;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue