From e7308678738f0442f49e2e36c2a145d484075439 Mon Sep 17 00:00:00 2001 From: Naushir Patuck Date: Mon, 26 Sep 2022 10:36:39 +0100 Subject: ipa: raspberrypi: Limit minimum exposure time for the IMX296 Limit the minimum allowable exposure time to a single line in the IMX296 camera helper. This equates to approximately 30us. Signed-off-by: Naushir Patuck Reviewed-by: Jacopo Mondi Reviewed-by: David Plowman Signed-off-by: Laurent Pinchart --- src/ipa/raspberrypi/cam_helper_imx296.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ipa/raspberrypi/cam_helper_imx296.cpp b/src/ipa/raspberrypi/cam_helper_imx296.cpp index 09f828ea..66d21e36 100644 --- a/src/ipa/raspberrypi/cam_helper_imx296.cpp +++ b/src/ipa/raspberrypi/cam_helper_imx296.cpp @@ -26,6 +26,7 @@ public: void getDelays(int &exposureDelay, int &gainDelay, int &vblankDelay) const override; private: + static constexpr uint32_t minExposureLines = 1; static constexpr uint32_t maxGainCode = 239; static constexpr Duration timePerLine = 550.0 / 37.125e6 * 1.0s; @@ -54,12 +55,12 @@ double CamHelperImx296::gain(uint32_t gainCode) const uint32_t CamHelperImx296::exposureLines(Duration exposure) const { - return (exposure - 14.26us) / timePerLine; + return std::max(minExposureLines, (exposure - 14.26us) / timePerLine); } Duration CamHelperImx296::exposure(uint32_t exposureLines) const { - return exposureLines * timePerLine + 14.26us; + return std::max(minExposureLines, exposureLines) * timePerLine + 14.26us; } void CamHelperImx296::getDelays(int &exposureDelay, int &gainDelay, -- cgit v1.2.1