@@ -240,7 +240,22 @@ ExposureModeHelper::splitExposure(utils::Duration exposure) const
exposure / (exposureTime * gain * quantGain) };
}
- double lastStageGain = clampGain(1.0);
+ const double unitGain = clampGain(1.0);
+
+ /*
+ * If no stages are present, max out the exposure time, then the
+ * analogue gain, and use digital gain for the rest.
+ */
+ if (stages_.empty()) {
+ exposureTime = clampExposureTime(exposure / unitGain, &quantGain);
+ gain = clampGain(exposure / exposureTime, &quantGain2);
+ quantGain *= quantGain2;
+
+ return { exposureTime, gain, quantGain,
+ exposure / (exposureTime * gain * quantGain) };
+ }
+
+ double lastStageGain = unitGain;
for (const auto &stage : stages_) {
utils::Duration stageExposureTime = clampExposureTime(stage.exposureTime,
@@ -282,9 +297,7 @@ ExposureModeHelper::splitExposure(utils::Duration exposure) const
/*
* From here on all we can do is max out the exposure time, followed by
* the analogue gain. If we still haven't achieved the target we send
- * the rest of the exposure time to digital gain. If we were given no
- * stages to use then the default gain of 1.0 is used so that exposure
- * time is maxed before gain is touched at all.
+ * the rest of the exposure time to digital gain.
*/
exposureTime = clampExposureTime(exposure / lastStageGain, &quantGain);
gain = clampGain(exposure / exposureTime, &quantGain2);
Make the handling of the "no stage" explicit. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> --- src/ipa/libipa/exposure_mode_helper.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)