{"id":23585,"url":"https://patchwork.libcamera.org/api/1.1/patches/23585/?format=json","web_url":"https://patchwork.libcamera.org/patch/23585/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20250617082956.5699-3-david.plowman@raspberrypi.com>","date":"2025-06-17T08:29:50","name":"[2/7] ipa: rpi: agc: Make the maximum digital gain configurable","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"1cf0d98731196874d3e02eaa0b6dbd2f90890ef7","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/1.1/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/23585/mbox/","series":[{"id":5225,"url":"https://patchwork.libcamera.org/api/1.1/series/5225/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5225","date":"2025-06-17T08:29:48","name":"Raspberry Pi AEC/AGC update","version":1,"mbox":"https://patchwork.libcamera.org/series/5225/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23585/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23585/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 3D042BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 Jun 2025 08:30:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6B52868DD6;\n\tTue, 17 Jun 2025 10:30:06 +0200 (CEST)","from mail-wr1-x433.google.com (mail-wr1-x433.google.com\n\t[IPv6:2a00:1450:4864:20::433])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C3B6468DCB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Jun 2025 10:30:02 +0200 (CEST)","by mail-wr1-x433.google.com with SMTP id\n\tffacd0b85a97d-3a4f72cba73so4399396f8f.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Jun 2025 01:30:02 -0700 (PDT)","from raspberrypi.pitowers.org\n\t([2a00:1098:3142:1f:ffc9:aff6:7f7f:893b])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-4532e259108sm166062955e9.32.2025.06.17.01.30.01\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 17 Jun 2025 01:30:01 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"qMKJDaTq\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1750149002; x=1750753802;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=hJMknMs8EuyLaccgLb33jdJSpEDrlFJKRlOxS4uGqYI=;\n\tb=qMKJDaTq+SsiIDzpot1Ly9Rbv2ZxSC3XzvIN0nTie+ntr/3pHTy8pdRZRx+RSY6nKx\n\tI0V3cMXKj26LeoQaDcYx2FGOfr5uu8BqEvoS9K0q/m01KzPMjKN448yMy3dqvQaBorYR\n\tLwVyk7psil/iLlC+6G1r7/CB12Q7PLCT6vxztpD2BqzIQrm+QQqw0feHt1B/CFJhjdi6\n\tjhlrpN5f6dDXy291Pq6jiSQnvmYje/jzb7DB8vDnHKxySSopBiQuNURHHMIMWoayTNjT\n\ta7wuQlbLRcoIoGH1VPABtZ/hYnNKZtIG+ZfQhWjGfUzp2MUftVD1lsqM3bpgZGt/pgEd\n\tH3pw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1750149002; x=1750753802;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=hJMknMs8EuyLaccgLb33jdJSpEDrlFJKRlOxS4uGqYI=;\n\tb=oFT1zvjoUrmM4WRAPS/6ILU+o77VG9fJltVJWJCRmoRSQRG06jDzQPF+WKPtaGc0AZ\n\tFBAS9HInGlaKHqzaIyp9s/N4HI9Hv5TmVaoTPN6kpEeBL20wlm2CJxINVu4AYhd/bFgx\n\tCFdxHmhWG1lFVW50W/s3qRS5RtjZx9O93ZS0SA/lHhG9ZeCoVGT/HPXTG2ExR8MYZM5c\n\tYLvQzZGwIA0JQYzoj71k21qFsZk807WfExPtwMJBYT9Tq5X4PZlH4Kje3MXbFFc/v0Gw\n\tBVybberlCZ2iAbGVZbb+vcFTYd521txJhqQARU9UBeyxap51RY5jrMkpp7vGx83hqvtJ\n\t7N0A==","X-Gm-Message-State":"AOJu0Yx+pmnS/4GV0i1yNQjbNbQAhy9Iv83gKjr4vxRZixIbzxjuvp/K\n\tzYmvPz+iEG/EwYKpvyl+MxVEHKqfHiWAZ8taG449y9/yduG+kIbTHarHCTv/mcvXcscdoK2VALu\n\taTFMQ","X-Gm-Gg":"ASbGncvEyOM3pLYaGZQ46s+y4N/tj5RxV4DFMrtWy4lQC5UpBEHq+XpeKEgfXPs+d2j\n\tvWA8DLhjQOkf4QxRy8pWGx8oNer3LIWZnxJfUuPU5Hr2K5kBFkjJIxkZ8HjgwC4ydZ+goEqAbtS\n\tS9x7wRFSLxo9C+UD5dpn3w+D8l3/Pt0xMRxOmSUhBIaqbUbgb9S9FCYt0afzjSj3CjABGgPy9hC\n\tGDuCaWFezyyV/urgxpMG/6IYopgfaY9sWgSqlKzC/ZkAOOlE/15JKuZcqaqwg6+KuzC+IF2Ug8h\n\tzCOAVCEDO/9Cwu1GpfUdM0w4/P0KAkpiOCiSJfj9yWMBCywELLPA4WNtOJPh478Ts+odKzCrRHq\n\t+MBtWJv4eZ0Gq2hlhqw==","X-Google-Smtp-Source":"AGHT+IFNGvm8b/42IZxmyDiZDevdm74XMOYEyqoSJv4s4fRaRhIRdoKkAsm1NcZeqXvT15aKY313Vg==","X-Received":"by 2002:a05:6000:26cb:b0:3a4:f607:a5ad with SMTP id\n\tffacd0b85a97d-3a56d834103mr11170136f8f.19.1750149001942; \n\tTue, 17 Jun 2025 01:30:01 -0700 (PDT)","From":"David Plowman <david.plowman@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"David Plowman <david.plowman@raspberrypi.com>","Subject":"[PATCH 2/7] ipa: rpi: agc: Make the maximum digital gain\n\tconfigurable","Date":"Tue, 17 Jun 2025 09:29:50 +0100","Message-Id":"<20250617082956.5699-3-david.plowman@raspberrypi.com>","X-Mailer":"git-send-email 2.39.5","In-Reply-To":"<20250617082956.5699-1-david.plowman@raspberrypi.com>","References":"<20250617082956.5699-1-david.plowman@raspberrypi.com>","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":"The maximum allowed digital gain is hard-coded to 4. Make it a\nconfigurable parameter.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/rpi/controller/rpi/agc_channel.cpp | 5 ++++-\n src/ipa/rpi/controller/rpi/agc_channel.h   | 1 +\n 2 files changed, 5 insertions(+), 1 deletion(-)","diff":"diff --git a/src/ipa/rpi/controller/rpi/agc_channel.cpp b/src/ipa/rpi/controller/rpi/agc_channel.cpp\nindex a87dc194..d7fff2fc 100644\n--- a/src/ipa/rpi/controller/rpi/agc_channel.cpp\n+++ b/src/ipa/rpi/controller/rpi/agc_channel.cpp\n@@ -260,6 +260,8 @@ int AgcConfig::read(const libcamera::YamlObject &params)\n \n \tdesaturate = params[\"desaturate\"].get<int>(1);\n \n+\tmaxDigitalGain = params[\"max_digital_gain\"].get<double>(4.0);\n+\n \treturn 0;\n }\n \n@@ -508,7 +510,8 @@ void AgcChannel::prepare(Metadata *imageMetadata)\n \t\t\t\t * Never ask for a gain < 1.0, and also impose\n \t\t\t\t * some upper limit. Make it customisable?\n \t\t\t\t */\n-\t\t\t\tprepareStatus.digitalGain = std::max(1.0, std::min(digitalGain, 4.0));\n+\t\t\t\tprepareStatus.digitalGain = std::max(1.0, std::min(digitalGain,\n+\t\t\t\t\t\t\t\t\t\t   config_.maxDigitalGain));\n \t\t\t\tLOG(RPiAgc, Debug) << \"Actual exposure \" << actualExposure;\n \t\t\t\tLOG(RPiAgc, Debug) << \"Use digitalGain \" << prepareStatus.digitalGain;\n \t\t\t\tLOG(RPiAgc, Debug) << \"Effective exposure \"\ndiff --git a/src/ipa/rpi/controller/rpi/agc_channel.h b/src/ipa/rpi/controller/rpi/agc_channel.h\nindex fa697e6f..e3475d86 100644\n--- a/src/ipa/rpi/controller/rpi/agc_channel.h\n+++ b/src/ipa/rpi/controller/rpi/agc_channel.h\n@@ -78,6 +78,7 @@ struct AgcConfig {\n \tdouble defaultAnalogueGain;\n \tdouble stableRegion;\n \tbool desaturate;\n+\tdouble maxDigitalGain;\n };\n \n class AgcChannel\n","prefixes":["2/7"]}