From patchwork Mon May 29 12:39:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18653 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 61ECCC31E9 for ; Mon, 29 May 2023 12:39:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AE5CC626FD; Mon, 29 May 2023 14:39:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1685363984; bh=mzdHXjpzGJdchKXzi2JrbWrhahYKxDdtjGIrBvYN2u0=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=f4M3+J+lsOPZrhNZfahLYIU13f7eyqJW7iQDPho5mJMdYOX4dOTwEJ7XQQGK2zRH9 vJQreNcVvb6IeqqXm68b4YzpdRDVLZOFVFxkZGE0dfYo69Ycu/UeUKK4JE5S1lW30i nMPhZKAXNUa3M6aK7WSY9aVfzLcSJB+O5aEmXQG0mdgE0ZdGNFvMpRSJNh3Oi/+01c a2GJ80OwsogiuYmitxX+yy37+TydSlEjkYXz+fsbLgs53vmXFVDQETsCDVePBFlThx w9amRAt4rtj3durmKilYdp/Qvtk5AYgNbaM/qbYXeQWBBIgOKaJcCdCUNZbCovKwyz TE8IxuKz/baYw== 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 A703C626F5 for ; Mon, 29 May 2023 14:39:43 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="KRYmgEr9"; dkim-atps=neutral Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6C1416D5; Mon, 29 May 2023 14:39:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1685363963; bh=mzdHXjpzGJdchKXzi2JrbWrhahYKxDdtjGIrBvYN2u0=; h=From:To:Cc:Subject:Date:From; b=KRYmgEr9i18exkvMjlTGHAlYbLccRSNK61rMBX/7T4Y2PHRyELReFrkrcN/d2NJYH uP1xzSH+uRKo63omPxImHAUf5pGdx8j+WPc2mQ3i0n1MYB/iQGs4cG9PXD9/BdDcIU c1b+sKJ4EPXFm2XZbkbWekoRSihYD3R9RQzJXbHM= To: libcamera-devel@lists.libcamera.org Date: Mon, 29 May 2023 14:39:25 +0200 Message-Id: <20230529123926.74775-1-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] ipa: ipu3: agc: Drop hard-codec analogue gain max 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: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" As the sensor's analogue gain range is known, drop the arbitrary maximum limit for the sensor analogue gain. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/ipa/ipu3/algorithms/agc.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp index b5309bdbea25..606a237a4a59 100644 --- a/src/ipa/ipu3/algorithms/agc.cpp +++ b/src/ipa/ipu3/algorithms/agc.cpp @@ -47,9 +47,8 @@ namespace ipa::ipu3::algorithms { LOG_DEFINE_CATEGORY(IPU3Agc) -/* Limits for analogue gain values */ +/* Minimum limit for analogue gain value */ static constexpr double kMinAnalogueGain = 1.0; -static constexpr double kMaxAnalogueGain = 8.0; /* \todo Honour the FrameDurationLimits control instead of hardcoding a limit */ static constexpr utils::Duration kMaxShutterSpeed = 60ms; @@ -97,10 +96,10 @@ int Agc::configure(IPAContext &context, kMaxShutterSpeed); minAnalogueGain_ = std::max(configuration.agc.minAnalogueGain, kMinAnalogueGain); - maxAnalogueGain_ = std::min(configuration.agc.maxAnalogueGain, kMaxAnalogueGain); + maxAnalogueGain_ = configuration.agc.maxAnalogueGain; /* Configure the default exposure and gain. */ - activeState.agc.gain = std::max(minAnalogueGain_, kMinAnalogueGain); + activeState.agc.gain = minAnalogueGain_; activeState.agc.exposure = 10ms / configuration.sensor.lineDuration; frameCount_ = 0; From patchwork Mon May 29 12:39:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18654 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 8366AC328E for ; Mon, 29 May 2023 12:39:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5DD8162702; Mon, 29 May 2023 14:39:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1685363985; bh=5WhfivtXQp75812WPuMXBMgrMPus8kKYq1X9gRi4nuA=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=qgee1L1NcwVWXvvab/VGOUz6t404XzM6rhgcwbaTMrDyNC/u/KwheQHF2hH9dXWhJ Dycxiubb5seFLZfoxCq8XBrDU5HrdCRY9hyH650/l8ZGGhfnUEZzE1n68TWBt+M3SM I5wVLamyhjaLPRozd32650NBeiZWh4EhK13yJ5jR0v101Oiqp9f8WcEuNtCcb1RUYz tAMvwW2v13XKarVnJGNjfQvSBvuurvFJFL8dN1tGXnOy/2FHyvZheQ/AHD+bI6lTsd C4QivQ3VWKVVkYFlgO3qG1zAClpK1TPEERdx2qxSmpc3tjk+5WQFUmZxJ7Aiu8xo+c 2vofuDXlmI5dQ== 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 E7CA3626F8 for ; Mon, 29 May 2023 14:39:43 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="VYyy1WYE"; dkim-atps=neutral Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CB8B9844; Mon, 29 May 2023 14:39:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1685363964; bh=5WhfivtXQp75812WPuMXBMgrMPus8kKYq1X9gRi4nuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VYyy1WYEQv9th2g7REKxH/Uf517Nyy1K2FvBji84GAJPtIcaUKtpFpl3wYI2ytuS1 qnbi28jeLfxbQrHpTtGpkxiRRpZaO9q9wOm4g3YYZVmA3WWHEy9yi/6n7kFP6T6iaP 69K8BB/cCw1E1vwC7rSbQ1aLX+MUSjMXn6sDk8dg= To: libcamera-devel@lists.libcamera.org Date: Mon, 29 May 2023 14:39:26 +0200 Message-Id: <20230529123926.74775-2-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230529123926.74775-1-jacopo.mondi@ideasonboard.com> References: <20230529123926.74775-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] ipa: rkisp1: agc: Restore minimum analogue gain limit 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: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: Jacopo Mondi , Benjamin Bara Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Commit a3178dd0391f ("ipa: rkisp1: agc: drop hard-coded analogue gain range") removed both minimum and maximum limits for the analogue gain value. However, as some sensors can potentially have a minimum gain lower than 1.0, restore the check for the minimum limit. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/ipa/rkisp1/algorithms/agc.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.40.1 diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index a4e5500e72d6..e5aeb3426eff 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -36,6 +36,9 @@ namespace ipa::rkisp1::algorithms { LOG_DEFINE_CATEGORY(RkISP1Agc) +/* Minimum limit for analogue gain value */ +static constexpr double kMinAnalogueGain = 1.0; + /* \todo Honour the FrameDurationLimits control instead of hardcoding a limit */ static constexpr utils::Duration kMaxShutterSpeed = 60ms; @@ -254,7 +257,8 @@ void Agc::computeExposure(IPAContext &context, IPAFrameContext &frameContext, utils::Duration maxShutterSpeed = std::min(configuration.sensor.maxShutterSpeed, kMaxShutterSpeed); - double minAnalogueGain = configuration.sensor.minAnalogueGain; + double minAnalogueGain = std::max(configuration.sensor.minAnalogueGain, + kMinAnalogueGain); double maxAnalogueGain = configuration.sensor.maxAnalogueGain; /* Consider within 1% of the target as correctly exposed. */