@@ -184,6 +184,39 @@ utils::Duration CameraSensorHelper::maxShutterTime(utils::Duration maxFrameDurat
return maxFrameDuration - exposureMargin * lineDuration;
}
+/**
+ * \brief Compute the minimum frame duration required for a desired exposure
+ * \param[in] shutterTime The shutter time
+ * \param[in] lineDuration The current sensor line duration
+ *
+ * This function returns the minimum frame duration required to achieve the
+ * desired \a shutterTime. The frame duration is calculated by adding to
+ * \a shutterTime the difference between the frame length and the maximum
+ * achievable integration time.
+ *
+ * The intended users of this function are IPA modules that want to calculate
+ * the minium required frame duration give a newly calculated shutter time.
+ *
+ * \todo The line duration should be a property of the CameraSensorHelper class
+ * instead of being provided by the IPA.
+ *
+ * \return The minimum frame duration required to achieve the desired shutter
+ * time
+ */
+utils::Duration CameraSensorHelper::minFrameDuration(utils::Duration shutterTime,
+ utils::Duration lineDuration) const
+{
+ /* Use a static to rate-limit the error message. */
+ static uint32_t exposureMargin = exposureMargin_.has_value()
+ ? exposureMargin_.value() : 0;
+ if (!exposureMargin_.has_value() && !exposureMargin) {
+ LOG(CameraSensorHelper, Warning)
+ << "Exposure margin not known. Default to 4";
+ exposureMargin = 4;
+ }
+
+ return shutterTime + exposureMargin * lineDuration;
+}
/**
* \struct CameraSensorHelper::AnalogueGainLinear
* \brief Analogue gain constants for the linear gain model
@@ -33,6 +33,8 @@ public:
double quantizeGain(double gain, double *quantizationGain) const;
utils::Duration maxShutterTime(utils::Duration maxFrameDuration,
utils::Duration lineDuration) const;
+ utils::Duration minFrameDuration(utils::Duration exposureTime,
+ utils::Duration lineDuration) const;
protected:
struct AnalogueGainLinear {
After having introduced CameraSensorHelper::maxShutterTime() which calculates the maximum shutter time which can be achieved given a frame duration, this patch introduces the opposite operation, that given a desired shutter time calculates what is the minimum frame duration required to achieve it. The intended users of this function are IPA modules that after having calculated a new exposure time need to regulate the frame duration to achieve it. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> --- src/ipa/libipa/camera_sensor_helper.cpp | 33 +++++++++++++++++++++++++++++++++ src/ipa/libipa/camera_sensor_helper.h | 2 ++ 2 files changed, 35 insertions(+)