From patchwork Mon Aug 3 13:14:28 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 27596 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 8CA44C334E for ; Mon, 3 Aug 2026 13:15:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 467A968102; Mon, 3 Aug 2026 15:15:24 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="uk0b3NzN"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7C66D68080 for ; Mon, 3 Aug 2026 15:14:48 +0200 (CEST) Received: from pb-laptop.local (185.221.141.208.nat.pool.zt.hu [185.221.141.208]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9DADD512 for ; Mon, 3 Aug 2026 15:13:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1785762819; bh=us5b72jVS9CEihNUNUbHeWP3SVXlyNl+8YqisAEAHEU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uk0b3NzNfhFLy+HMY4p9E4ARucw88Ao0poqg7Bn9XaobfEwSvLQMXkeksJLUsP3Ql BM8C6dBBpDXUKD6PyLhhDVwGN1/52pkYem2qzq6aNp/WZxcApTklqwQFjj4lWQv0UB FURQVT8OS24GX+8erDazz0dzMzBQHIyq5QvEuA68= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [RFC PATCH v3 43/50] ipa: libipa: agc_msv: Handle min gain > 1.0 case Date: Mon, 3 Aug 2026 15:14:28 +0200 Message-ID: <20260803131435.153927-44-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260803131435.153927-1-barnabas.pocze@ideasonboard.com> References: <20260803131435.153927-1-barnabas.pocze@ideasonboard.com> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When manual gain control is enabled in `AgcAlgorithm`, the limits will be set to that particular value. This is very likely larger than 1.0. In this case, however, the algorithm should still adjust the exposure time if it can. So compare the gain with the minimum of 1.0 and the configured min gain, in order to ensure that the exposure will be adjusted if the lower boundary of the allowed analogue gains is reached. Signed-off-by: Barnabás Pőcze --- src/ipa/libipa/agc_msv.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ipa/libipa/agc_msv.cpp b/src/ipa/libipa/agc_msv.cpp index 956551685c..9fec2ba48a 100644 --- a/src/ipa/libipa/agc_msv.cpp +++ b/src/ipa/libipa/agc_msv.cpp @@ -206,7 +206,7 @@ AgcMSV::Result AgcMSV::updateExposure(uint32_t exposure, double again, float exp } } else { /* Scene too bright: decrease gain first, then exposure. */ - if (again > limits_.gain1) { + if (again > std::max(limits_.gain1, limits_.gain[0])) { double next = again * factor; again = std::min(next, again - limits_.gainMinStep); } else {