ipa: libipa: agc_mean_luminance: Error out when effectiveExposureValue is zero
In a proper system it never happens that the effectiveExposureValue drops to zero. If that still happens due to a bug outside of agc_mean_luminance, the calculated gain goes towards infinity but the newExposureValue is still 0 because it is the result of multiplying the effectiveExposureTime with the gain, leading to wild oscillations. Catch that condition, print an error message and set the new effective exposure value to an arbitrary 10ms. Note that in any case the underlying problem must be fixed. The important change is the added error message to be able to detect such a situation. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
94e94c6e8d
commit
03bae6b924
1 changed files with 12 additions and 0 deletions
|
@ -541,6 +541,18 @@ AgcMeanLuminance::calculateNewEv(uint32_t constraintModeIndex,
|
||||||
std::shared_ptr<ExposureModeHelper> exposureModeHelper =
|
std::shared_ptr<ExposureModeHelper> exposureModeHelper =
|
||||||
exposureModeHelpers_.at(exposureModeIndex);
|
exposureModeHelpers_.at(exposureModeIndex);
|
||||||
|
|
||||||
|
if (effectiveExposureValue == 0s) {
|
||||||
|
LOG(AgcMeanLuminance, Error)
|
||||||
|
<< "Effective exposure value is 0. This is a bug in AGC "
|
||||||
|
"and must be fixed for proper operation.";
|
||||||
|
/*
|
||||||
|
* Return an arbitrary exposure time > 0 to ensure regulation
|
||||||
|
* doesn't get stuck with 0 in case the sensor driver allows a
|
||||||
|
* min exposure of 0.
|
||||||
|
*/
|
||||||
|
return exposureModeHelper->splitExposure(10ms);
|
||||||
|
}
|
||||||
|
|
||||||
double gain = estimateInitialGain();
|
double gain = estimateInitialGain();
|
||||||
gain = constraintClampGain(constraintModeIndex, yHist, gain);
|
gain = constraintClampGain(constraintModeIndex, yHist, gain);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue