From patchwork Fri Mar 6 14:42: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: 26265 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 840D5BDCC1 for ; Fri, 6 Mar 2026 14:42:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7E8CC62620; Fri, 6 Mar 2026 15:42:33 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="i7cf4NsV"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9104D620FA for ; Fri, 6 Mar 2026 15:42:31 +0100 (CET) Received: from pb-laptop.local (185.182.214.224.nat.pool.zt.hu [185.182.214.224]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 50BD7874; Fri, 6 Mar 2026 15:41:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1772808087; bh=+sQZWPUwfa/K5DzfQhEpXj8tBcoN8m9ka1BefeQEKm4=; h=From:To:Cc:Subject:Date:From; b=i7cf4NsVBitkRaCe0PWdDp7ncNxHSgdid+pVGz/yhMrEmJUT+uOcKbixBPPSrsYKL Gwg1HFGe5v21ptMFVxVUX7DBD9WNaBLw8EtqFQqHA9D/agZ1P7FwQPh7ggcnpQ5Ysf jTiFA98HIjc3sw8+D+oCtUXOKOg3b3iJDMCX68zU= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Cc: Hans de Goede Subject: [PATCH v1] ipa: simple: Fix `again10` value with sensor helper Date: Fri, 6 Mar 2026 15:42:28 +0100 Message-ID: <20260306144228.1017799-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.53.0 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" `CameraSensorHelper::gain(uint32_t)` maps a gain code to the actual floating point gain value. Calling it with `1.0` as the argument will simply get the real gain for gain code 1. This is most likely not what was intended. For example, in the case of the `ov2740` sensor, `againMin` is 1, but the calculated `again10` (1 / 128 ~ 0.078) ends up being < 1, meaning that the agc algorithm will never lower the exposure. Fix that by using the maximum of the minimum gain and 1 as `again10`. Fixes: 950ca85e8aa5 ("ipa: software_isp: AGC: Do not lower gain below 1.0") Reviewed-by: Milan Zamazal Signed-off-by: Barnabás Pőcze Reviewed-by: Hans de Goede --- src/ipa/simple/soft_simple.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.53.0 diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp index c35277cfe..7d25bdd26 100644 --- a/src/ipa/simple/soft_simple.cpp +++ b/src/ipa/simple/soft_simple.cpp @@ -227,7 +227,7 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo) if (camHelper_) { context_.configuration.agc.againMin = camHelper_->gain(againMin); context_.configuration.agc.againMax = camHelper_->gain(againMax); - context_.configuration.agc.again10 = camHelper_->gain(1.0); + context_.configuration.agc.again10 = std::max(context_.configuration.agc.againMin, 1.0); context_.configuration.agc.againMinStep = (context_.configuration.agc.againMax - context_.configuration.agc.againMin) /