From patchwork Mon Mar 28 12:03:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 15574 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 9B3E2C3266 for ; Mon, 28 Mar 2022 12:03:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 372D665641; Mon, 28 Mar 2022 14:03:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1648469026; bh=+d6kCB2e1hteA+xpyl+y3/U0IOD1WIQchvxBLbIwORg=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=HPydSr1dR4bY2VsdTYNc5Sh/vFc81WF1hA858NeHddLD9Joq0fZNbyj8GOa0YGhTE uJUqEqmG60UtdnzXIIw7fs2j0y7lRsVBQQnXvTKN9oJs9pyzqX+SBzNkgLKBcHFJvZ /NZ6Jj7yUZzk9pB3WOw/AzC7XP+IEXf7PPmFZ9n+gyT8sVroXLWX9VMc2B4pYk88n0 /w4jjqqTzkHJBuHV9rBVQbghv91n6X4nd5mzv16Km/IAqVwD3MOaDgg4an6VHq3hX/ +yKgfYUQeJg2hMPtM6h/xfHV9bELNugwpYdcKX7T86Dgxexa7bWs6zKXrteBJH8S0w Sm0N+47SYtFiQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E3ACE601F5 for ; Mon, 28 Mar 2022 14:03:42 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Zh/EU+e7"; dkim-atps=neutral Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8A46EE0A for ; Mon, 28 Mar 2022 14:03:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1648469022; bh=+d6kCB2e1hteA+xpyl+y3/U0IOD1WIQchvxBLbIwORg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Zh/EU+e7mWOr22MPn4Bv8px+4pKkGvn4Q0xqX5W3YonzpaFnT7AFYqzqcr0HEn3bO 60HVDiT++yiV49OEBTRTKZGj2WusrZ7BNqFgq2lY2W8C67D4e92SXNexU0IQIFpGyj /BXnrNdRMkXW7mYx0IN90NjzpCUumxgDitXAVb0A= To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Mar 2022 15:03:35 +0300 Message-Id: <20220328120336.10834-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220328120336.10834-1-laurent.pinchart@ideasonboard.com> References: <20220328120336.10834-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/4] libipa: camera_sensor_helper: Add IMX290 helper X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 Reviewed-by: Jacopo Mondi Reviewed-by: Paul Elder Reviewed-by: Umang Jain --- src/ipa/libipa/camera_sensor_helper.cpp | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp index 7bb999e19102..136b9f6bc3c5 100644 --- a/src/ipa/libipa/camera_sensor_helper.cpp +++ b/src/ipa/libipa/camera_sensor_helper.cpp @@ -332,6 +332,26 @@ std::vector &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: