[libcamera-devel] [PATCH] ipa: raspberrypi: Limit minimum exposure time for the IMX296

Naushir Patuck naush at raspberrypi.com
Mon Sep 26 11:36:39 CEST 2022


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 <naush at raspberrypi.com>
---
 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 09f828ea6249..66d21e36ecd0 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<uint32_t>(minExposureLines, (exposure - 14.26us) / timePerLine);
 }
 
 Duration CamHelperImx296::exposure(uint32_t exposureLines) const
 {
-	return exposureLines * timePerLine + 14.26us;
+	return std::max<uint32_t>(minExposureLines, exposureLines) * timePerLine + 14.26us;
 }
 
 void CamHelperImx296::getDelays(int &exposureDelay, int &gainDelay,
-- 
2.25.1



More information about the libcamera-devel mailing list