libipa: exposure_mode_helper: Set quantizationGain in absence of a sensor helper

In commit f077c58e08 ("libipa: exposure_mode_helper: Take
exposure/gain quantization into account") calculation of the
quantization gain was added to ExposureModeHelper::clampGain(). This
works as expected when a sensor helper is configured but the gain is not
reset to 1.0 in case the sensor helper is not configured. This leads to
incorrect gain calculations in ExposureModeHelper::splitExposure() as
that expects the quantization gain to be valid in any case. Fix that by
setting the quantization gain to 1.0 in case no sensor helper is
configured.

Fixes: f077c58e08 ("libipa: exposure_mode_helper: Take exposure/gain quantization into account")
Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/292
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
This commit is contained in:
Stefan Klug
2025-11-24 20:52:41 +01:00
parent 5d8f4d0a20
commit dadeb67fcc

View File

@@ -144,9 +144,13 @@ utils::Duration ExposureModeHelper::clampExposureTime(utils::Duration exposureTi
double ExposureModeHelper::clampGain(double gain, double *quantizationGain) const
{
double clamped = std::clamp(gain, minGain_, maxGain_);
if (!sensorHelper_)
return clamped;
return sensorHelper_->quantizeGain(clamped, quantizationGain);
if (sensorHelper_)
return sensorHelper_->quantizeGain(clamped, quantizationGain);
if (quantizationGain)
*quantizationGain = 1.0;
return clamped;
}
/**