[v3,12/19] ipa: libipa: agc: Compute max shutter time with frame duration
diff mbox series

Message ID 20251114-exposure-limits-v3-12-b7c07feba026@ideasonboard.com
State New
Headers show
Series
  • libipa: agc: Calculate exposure limits
Related show

Commit Message

Jacopo Mondi Nov. 14, 2025, 2:17 p.m. UTC
The maximum shutter time the AGC algorithm can achieve is, by definition,
limited by the maximum programmed frame duration.

When configuring the AGC algorithm, use the frame duration to calculate
the maximum shutter time by using the CameraSensorHelper::maxShutterTime()
function, unless the IPA has asked for a fixed exposure by setting min ==
max.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
---
 src/ipa/libipa/exposure_mode_helper.cpp | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/src/ipa/libipa/exposure_mode_helper.cpp b/src/ipa/libipa/exposure_mode_helper.cpp
index f771b10a28eead2976c0000cf099ba5cfbe78e0f..45f51f9088170c983bb0de2c18714627514c5641 100644
--- a/src/ipa/libipa/exposure_mode_helper.cpp
+++ b/src/ipa/libipa/exposure_mode_helper.cpp
@@ -127,14 +127,30 @@  ExposureModeHelper::ExposureModeHelper(const Span<std::pair<utils::Duration, dou
 void ExposureModeHelper::configure(const SensorConfiguration &sensorConfig,
 				   const CameraSensorHelper *sensorHelper)
 {
+	ASSERT(sensorHelper);
+
 	sensor_ = sensorConfig;
 	sensorHelper_ = sensorHelper;
 
 	/* Initialize run-time limits with sensor's default. */
-	minExposureTime_ = sensor_.minExposureTime_;
-	maxExposureTime_ = sensor_.maxExposureTime_;
 	minGain_ = sensor_.minGain_;
 	maxGain_ = sensor_.maxGain_;
+
+	minExposureTime_ = sensor_.minExposureTime_;
+
+	/*
+	 * Compute the maximum shutter time.
+	 *
+	 * If maxExposureTime is equal to minExposureTime then we use them
+	 * to fix the exposure time.
+	 *
+	 * Otherwise, if the exposure can range between a min and max delegate
+	 * the maximum shutter time calculation to the sensor helper.
+	 */
+	maxExposureTime_ = minExposureTime_ != sensorConfig.maxExposureTime_
+			 ? sensorHelper_->maxShutterTime(sensorConfig.maxFrameDuration_,
+							 sensorConfig.lineDuration_)
+			 : minExposureTime_;
 }
 
 /**