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. */