summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-04-01 14:38:39 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-04-01 14:48:24 +0300
commit401199478079994a405a64f11a3edbaffe417068 (patch)
tree01fe1c4de435e8dae4dde9873b37226edb421973
parent8ad9249fb09d598cb24bae85101526fa822270ff (diff)
libipa: camera_sensor_helper: Add IMX290 helper
The IMX290 is a Sony sensor that expresses its gain in 0.3dB units. It thus maps to the exponential gain model. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
-rw-r--r--src/ipa/libipa/camera_sensor_helper.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
index 7bb999e1..136b9f6b 100644
--- a/src/ipa/libipa/camera_sensor_helper.cpp
+++ b/src/ipa/libipa/camera_sensor_helper.cpp
@@ -332,6 +332,26 @@ std::vector<CameraSensorHelperFactory *> &CameraSensorHelperFactory::factories()
#ifndef __DOXYGEN__
+/*
+ * Helper function to compute the m parameter of the exponential gain model
+ * when the gain code is expressed in dB.
+ */
+static constexpr double expGainDb(double step)
+{
+ constexpr double log2_10 = 3.321928094887362;
+
+ /*
+ * The gain code is expressed in step * dB (e.g. in 0.1 dB steps):
+ *
+ * G_code = G_dB/step = 20/step*log10(G_linear)
+ *
+ * Inverting the formula, we get
+ *
+ * G_linear = 10^(step/20*G_code) = 2^(log2(10)*step/20*G_code)
+ */
+ return log2_10 * step / 20;
+}
+
class CameraSensorHelperImx219 : public CameraSensorHelper
{
public:
@@ -354,6 +374,17 @@ public:
};
REGISTER_CAMERA_SENSOR_HELPER("imx258", CameraSensorHelperImx258)
+class CameraSensorHelperImx290 : public CameraSensorHelper
+{
+public:
+ CameraSensorHelperImx290()
+ {
+ gainType_ = AnalogueGainExponential;
+ gainConstants_.exp = { 1.0, expGainDb(0.3) };
+ }
+};
+REGISTER_CAMERA_SENSOR_HELPER("imx290", CameraSensorHelperImx290)
+
class CameraSensorHelperOv2740 : public CameraSensorHelper
{
public: