{"id":26819,"url":"https://patchwork.libcamera.org/api/patches/26819/?format=json","web_url":"https://patchwork.libcamera.org/patch/26819/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260603140818.2558156-1-jai.luthra@ideasonboard.com>","date":"2026-06-03T14:08:18","name":"ipa: simple: Fix againMinStep calculation","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"72dfbcb8d950224425a21d45d0515bc700aa2d59","submitter":{"id":223,"url":"https://patchwork.libcamera.org/api/people/223/?format=json","name":"Jai Luthra","email":"jai.luthra@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/26819/mbox/","series":[{"id":5974,"url":"https://patchwork.libcamera.org/api/series/5974/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5974","date":"2026-06-03T14:08:18","name":"ipa: simple: Fix againMinStep calculation","version":1,"mbox":"https://patchwork.libcamera.org/series/5974/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/26819/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/26819/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 064B7C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Jun 2026 14:08:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 33C9C63171;\n\tWed,  3 Jun 2026 16:08:39 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3F5B1630BA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Jun 2026 16:08:38 +0200 (CEST)","from mail.ideasonboard.com (unknown\n\t[IPv6:2401:4900:1c66:476d:c684:fe78:389f:7375])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BFE2C929;\n\tWed,  3 Jun 2026 16:08:13 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"fFnxLMqH\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1780495694;\n\tbh=FpZWLumGQUEHFZkhUIv/dtdy3OPu1d36lZmILmk9TMw=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=fFnxLMqH6IScC1qXxZNLvZDzSyCYSXkUmv3pqx008jGuw+ce8AYboHJD4dANgJkKf\n\tECQhOayFiJ1K+DgjFrUXD90Z8hwobsIZDMSf0w4ANu2v3rjqQ+S5x0JXQx513j2qfy\n\tCxZ0c5FNxMwohCxKWoXYLE3ot1r+H0d9DNG7nhr4=","From":"Jai Luthra <jai.luthra@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Jai Luthra <jai.luthra@ideasonboard.com>","Subject":"[PATCH] ipa: simple: Fix againMinStep calculation","Date":"Wed,  3 Jun 2026 19:38:18 +0530","Message-ID":"<20260603140818.2558156-1-jai.luthra@ideasonboard.com>","X-Mailer":"git-send-email 2.54.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Use the difference between againMin + 1 and againMin as the againMinStep\nvalue. This is better than a heuristic of 1% of the whole range, which\ndoesn't match the actual allowed values by the V4L2 control, especially\nfor sensors with an exponential gain model (that map the control values\nto equal-sized dB increments).\n\nWithout this change I saw a lot of oscillations with IMX678. While the\noscillations did go away after I narrowed the gain control to only map\nto 0 - 30dB of analogue gain, and ignore the 30.3 - 72dB digital gain\nrange, I still think we should use the minimum step allowed by V4L2\nrather than a heuristic of 1%.\n\nEven for sensors with a linear gain model like IMX219, that allow\nsetting more than 100 values, this should make the AGC algorithm\nsmoother.\n\nSigned-off-by: Jai Luthra <jai.luthra@ideasonboard.com>\n---\n src/ipa/simple/soft_simple.cpp | 5 ++---\n 1 file changed, 2 insertions(+), 3 deletions(-)","diff":"diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\nindex 629e1a32d..e463e38af 100644\n--- a/src/ipa/simple/soft_simple.cpp\n+++ b/src/ipa/simple/soft_simple.cpp\n@@ -228,10 +228,9 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo)\n \t\tcontext_.configuration.agc.againMin = camHelper_->gain(againMin);\n \t\tcontext_.configuration.agc.againMax = camHelper_->gain(againMax);\n \t\tcontext_.configuration.agc.again10 = std::max(context_.configuration.agc.againMin, 1.0);\n+\t\tdouble againNext = camHelper_->gain(std::min(againMin + 1, againMax));\n \t\tcontext_.configuration.agc.againMinStep =\n-\t\t\t(context_.configuration.agc.againMax -\n-\t\t\t context_.configuration.agc.againMin) /\n-\t\t\t100.0;\n+\t\t\tagainNext - context_.configuration.agc.againMin;\n \t\tif (camHelper_->blackLevel().has_value()) {\n \t\t\t/*\n \t\t\t * The black level from camHelper_ is a 16 bit value, software ISP\n","prefixes":[]}