{"id":24154,"url":"https://patchwork.libcamera.org/api/patches/24154/?format=json","web_url":"https://patchwork.libcamera.org/patch/24154/","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":"<20250818082909.2001635-5-stefan.klug@ideasonboard.com>","date":"2025-08-18T08:28:42","name":"[RFC,4/4] ipa: mali-c55: agc: Do not derive from AgcMeanLuminance","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"8ab3e7b8f35805001683d167e1249f0865a92aec","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24154/mbox/","series":[{"id":5390,"url":"https://patchwork.libcamera.org/api/series/5390/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5390","date":"2025-08-18T08:28:38","name":"libipa: agc_mean_luminance: Use composition instead of","version":1,"mbox":"https://patchwork.libcamera.org/series/5390/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24154/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24154/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 DED6CC3295\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Aug 2025 08:30:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 83B3A69259;\n\tMon, 18 Aug 2025 10:30:08 +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 08C2569263\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Aug 2025 10:30:06 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:766d:a405:f64e:fe3a])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 04D8B243C; \n\tMon, 18 Aug 2025 10:29:08 +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=\"QVdZDGGm\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1755505749;\n\tbh=BrCOLSeNP8zYXYeemrRSw8LXXcpbdbJR8wtijEON/aY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=QVdZDGGmvdc5xtmYeRWkfCkui6cZ5P5GgtKYn0/axbVvR+vxtpIuHaIKfj5Y1uMJR\n\tATqrfUqTTapmeyZWAe387g3B2Hkm85oOYSW5ekgEzT8NzUIFUB1kfyDVLxBkqwWHaI\n\t0/+0/r4V2rRRckX3iooFSK7+x79hG9rlgUbmMI6M=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[RFC PATCH 4/4] ipa: mali-c55: agc: Do not derive from\n\tAgcMeanLuminance","Date":"Mon, 18 Aug 2025 10:28:42 +0200","Message-ID":"<20250818082909.2001635-5-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.48.1","In-Reply-To":"<20250818082909.2001635-1-stefan.klug@ideasonboard.com>","References":"<20250818082909.2001635-1-stefan.klug@ideasonboard.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":"There is no need to derive from AgcMeanLuminance anymore. Use\ncomposition for easier understanding.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n src/ipa/mali-c55/algorithms/agc.cpp | 21 ++++++++++-----------\n src/ipa/mali-c55/algorithms/agc.h   |  3 ++-\n 2 files changed, 12 insertions(+), 12 deletions(-)","diff":"diff --git a/src/ipa/mali-c55/algorithms/agc.cpp b/src/ipa/mali-c55/algorithms/agc.cpp\nindex 4bfb4aaeedf0..eda111cd8640 100644\n--- a/src/ipa/mali-c55/algorithms/agc.cpp\n+++ b/src/ipa/mali-c55/algorithms/agc.cpp\n@@ -129,13 +129,12 @@ void AgcStatistics::parseStatistics(const mali_c55_stats_buffer *stats)\n }\n \n Agc::Agc()\n-\t: AgcMeanLuminance()\n {\n }\n \n int Agc::init(IPAContext &context, const YamlObject &tuningData)\n {\n-\tint ret = parseTuningData(tuningData);\n+\tint ret = agc_.parseTuningData(tuningData);\n \tif (ret)\n \t\treturn ret;\n \n@@ -145,7 +144,7 @@ int Agc::init(IPAContext &context, const YamlObject &tuningData)\n \t\tstatic_cast<float>(kMaxDigitalGain),\n \t\tstatic_cast<float>(kMinDigitalGain)\n \t);\n-\tcontext.ctrlMap.merge(controls());\n+\tcontext.ctrlMap.merge(agc_.controls());\n \n \treturn 0;\n }\n@@ -168,16 +167,16 @@ int Agc::configure(IPAContext &context,\n \tcontext.activeState.agc.manual.sensorGain = context.configuration.agc.minAnalogueGain;\n \tcontext.activeState.agc.manual.exposure = context.configuration.agc.defaultExposure;\n \tcontext.activeState.agc.manual.ispGain = kMinDigitalGain;\n-\tcontext.activeState.agc.constraintMode = constraintModes().begin()->first;\n-\tcontext.activeState.agc.exposureMode = exposureModeHelpers().begin()->first;\n+\tcontext.activeState.agc.constraintMode = agc_.constraintModes().begin()->first;\n+\tcontext.activeState.agc.exposureMode = agc_.exposureModeHelpers().begin()->first;\n \n \t/* \\todo Run this again when FrameDurationLimits is passed in */\n-\tsetLimits(context.configuration.agc.minShutterSpeed,\n+\tagc_.setLimits(context.configuration.agc.minShutterSpeed,\n \t\t  context.configuration.agc.maxShutterSpeed,\n \t\t  context.configuration.agc.minAnalogueGain,\n \t\t  context.configuration.agc.maxAnalogueGain);\n \n-\tresetFrameCount();\n+\tagc_.resetFrameCount();\n \n \treturn 0;\n }\n@@ -385,10 +384,10 @@ void Agc::process(IPAContext &context,\n \tutils::Duration shutterTime;\n \tdouble aGain, dGain;\n \tstd::tie(shutterTime, aGain, dGain) =\n-\t\tcalculateNewEv(std::bind(&Agc::estimateLuminance, this, _1),\n-\t\t\t       activeState.agc.constraintMode,\n-\t\t\t       activeState.agc.exposureMode, statistics_.yHist,\n-\t\t\t       effectiveExposureValue);\n+\t\tagc_.calculateNewEv(std::bind(&Agc::estimateLuminance, this, _1),\n+\t\t\t\t    activeState.agc.constraintMode,\n+\t\t\t\t    activeState.agc.exposureMode, statistics_.yHist,\n+\t\t\t\t    effectiveExposureValue);\n \n \tdGain = std::clamp(dGain, kMinDigitalGain, kMaxDigitalGain);\n \ndiff --git a/src/ipa/mali-c55/algorithms/agc.h b/src/ipa/mali-c55/algorithms/agc.h\nindex 698de57e1ba8..06c26fd88209 100644\n--- a/src/ipa/mali-c55/algorithms/agc.h\n+++ b/src/ipa/mali-c55/algorithms/agc.h\n@@ -43,7 +43,7 @@ private:\n \tunsigned int bIndex_;\n };\n \n-class Agc : public Algorithm, public AgcMeanLuminance\n+class Agc : public Algorithm\n {\n public:\n \tAgc();\n@@ -74,6 +74,7 @@ private:\n \t\t\t\t      enum mali_c55_param_block_type type);\n \n \tAgcStatistics statistics_;\n+\tAgcMeanLuminance agc_;\n };\n \n } /* namespace ipa::mali_c55::algorithms */\n","prefixes":["RFC","4/4"]}