{"id":27582,"url":"https://patchwork.libcamera.org/api/patches/27582/?format=json","web_url":"https://patchwork.libcamera.org/patch/27582/","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":"<20260803131435.153927-34-barnabas.pocze@ideasonboard.com>","date":"2026-08-03T13:14:18","name":"[RFC,v3,33/50] ipa: libipa: agc_mean_luminance: Remove control handling","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"57e8217441b0bae737342a7d3e3086cbd6dab884","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/?format=json","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/27582/mbox/","series":[{"id":6103,"url":"https://patchwork.libcamera.org/api/series/6103/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6103","date":"2026-08-03T13:13:45","name":"ipa: libipa: agc rework","version":3,"mbox":"https://patchwork.libcamera.org/series/6103/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/27582/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27582/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 BE17AC3342\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Aug 2026 13:15:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A8E5568101;\n\tMon,  3 Aug 2026 15:15:13 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7D0CB680A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Aug 2026 15:14:46 +0200 (CEST)","from pb-laptop.local (185.221.141.208.nat.pool.zt.hu\n\t[185.221.141.208])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 87043ABF;\n\tMon,  3 Aug 2026 15:13:37 +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=\"NqyeNT5j\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1785762817;\n\tbh=Vr+UrpcktJDrknFg+LET839LEoofGTIqR2S51uwxe90=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=NqyeNT5jsEHrCCImKdJecEqeGAVQ4KfJ4SzSXrov034uziWYcFcInmlm+635d34M3\n\ttymeHKY7Y8Y6ry1kV6pzjCJXxxbY8VGE7QvM2uHwgHHOHyawkF0nNw5yPuwjAH8qDY\n\toHF9ZNudVko5iCSadqDW/tHoXYwQFTTPuB8YKtcY=","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Subject":"[RFC PATCH v3 33/50] ipa: libipa: agc_mean_luminance: Remove control\n\thandling","Date":"Mon,  3 Aug 2026 15:14:18 +0200","Message-ID":"<20260803131435.153927-34-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","Content-Type":"text/plain; charset=UTF-8","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 `AgcMeanLuminance` type does not do any actual control handling,\nso let's remove the `ControlInfoMap::Map` member, and let the user\nhandle that using the `constraintModes()` / `exposureModeHelpers()`\ngetters.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n src/ipa/libipa/agc.cpp                | 22 +++++++++++++++++-----\n src/ipa/libipa/agc_mean_luminance.cpp | 21 +--------------------\n src/ipa/libipa/agc_mean_luminance.h   |  8 --------\n 3 files changed, 18 insertions(+), 33 deletions(-)","diff":"diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp\nindex 69f731569e..3efa4a89e1 100644\n--- a/src/ipa/libipa/agc.cpp\n+++ b/src/ipa/libipa/agc.cpp\n@@ -382,13 +382,25 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state,\n \tif (session.autoAllowed) {\n \t\tconfig.ctrlMap[&controls::ExposureValue] = ControlInfo(-8.0f, 8.0f, 0.0f);\n \n-\t\tfor (const auto &[id, info] : impl_.controls())\n-\t\t\tconfig.ctrlMap[id] = info;\n+\t\t{\n+\t\t\tstd::vector<ControlValue> options;\n+\t\t\tfor (const auto &[id, _] : impl_.constraintModes())\n+\t\t\t\toptions.emplace_back(id);\n+\n+\t\t\tconfig.ctrlMap[&controls::AeConstraintMode] = ControlInfo(options);\n+\t\t}\n+\n+\t\t{\n+\t\t\tstd::vector<ControlValue> options;\n+\t\t\tfor (const auto &[id, _] : impl_.exposureModeHelpers())\n+\t\t\t\toptions.emplace_back(id);\n+\n+\t\t\tconfig.ctrlMap[&controls::AeExposureMode] = ControlInfo(options);\n+\t\t}\n \t} else {\n \t\tconfig.ctrlMap.erase(&controls::ExposureValue);\n-\n-\t\tfor (const auto &[id, info] : impl_.controls())\n-\t\t\tconfig.ctrlMap.erase(id);\n+\t\tconfig.ctrlMap.erase(&controls::AeConstraintMode);\n+\t\tconfig.ctrlMap.erase(&controls::AeExposureMode);\n \t}\n \n \treturn 0;\ndiff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp\nindex 37e8ff154f..8303065008 100644\n--- a/src/ipa/libipa/agc_mean_luminance.cpp\n+++ b/src/ipa/libipa/agc_mean_luminance.cpp\n@@ -236,8 +236,6 @@ int AgcMeanLuminance::parseConstraint(const ValueNode &modeDict, int32_t id)\n \n int AgcMeanLuminance::parseConstraintModes(const ValueNode &tuningData)\n {\n-\tstd::vector<ControlValue> availableConstraintModes;\n-\n \tconst ValueNode &constraintModes = tuningData[controls::AeConstraintMode.name()];\n \tif (constraintModes.isDictionary()) {\n \t\tfor (const auto &[modeName, modeDict] : constraintModes.asDict()) {\n@@ -257,8 +255,6 @@ int AgcMeanLuminance::parseConstraintModes(const ValueNode &tuningData)\n \t\t\tint ret = parseConstraint(modeDict, it->second);\n \t\t\tif (ret)\n \t\t\t\treturn ret;\n-\n-\t\t\tavailableConstraintModes.push_back(it->second);\n \t\t}\n \t}\n \n@@ -277,18 +273,13 @@ int AgcMeanLuminance::parseConstraintModes(const ValueNode &tuningData)\n \t\t};\n \n \t\tconstraintModes_[controls::ConstraintNormal].push_back(std::move(constraint));\n-\t\tavailableConstraintModes.push_back(controls::ConstraintNormal);\n \t}\n \n-\tcontrols_[&controls::AeConstraintMode] = ControlInfo(availableConstraintModes);\n-\n \treturn 0;\n }\n \n int AgcMeanLuminance::parseExposureModes(const ValueNode &tuningData)\n {\n-\tstd::vector<ControlValue> availableExposureModes;\n-\n \tconst ValueNode &exposureModes = tuningData[controls::AeExposureMode.name()];\n \tif (exposureModes.isDictionary()) {\n \t\tfor (const auto &[modeName, modeValues] : exposureModes.asDict()) {\n@@ -331,7 +322,6 @@ int AgcMeanLuminance::parseExposureModes(const ValueNode &tuningData)\n \t\t\t}\n \n \t\t\texposureModeHelpers_.try_emplace(it->second, stages);\n-\t\t\tavailableExposureModes.push_back(it->second);\n \t\t}\n \t}\n \n@@ -341,13 +331,9 @@ int AgcMeanLuminance::parseExposureModes(const ValueNode &tuningData)\n \t * in the ExposureModeHelper simply driving the exposure time as high as\n \t * possible before touching gain.\n \t */\n-\tif (availableExposureModes.empty()) {\n+\tif (exposureModeHelpers_.empty())\n \t\texposureModeHelpers_.try_emplace(controls::ExposureNormal,\n \t\t\t\t\t\t Span<std::pair<utils::Duration, double>>{});\n-\t\tavailableExposureModes.push_back(controls::ExposureNormal);\n-\t}\n-\n-\tcontrols_[&controls::AeExposureMode] = ControlInfo(availableExposureModes);\n \n \treturn 0;\n }\n@@ -472,11 +458,6 @@ void AgcMeanLuminance::setLimits(utils::Duration minExposureTime,\n  * \\brief Get the ExposureModeHelpers that have been parsed from tuning data\n  */\n \n-/**\n- * \\fn AgcMeanLuminance::controls()\n- * \\brief Get the controls that have been generated after parsing tuning data\n- */\n-\n /**\n  * \\brief Estimate the initial gain needed to achieve a relative luminance\n  * target\ndiff --git a/src/ipa/libipa/agc_mean_luminance.h b/src/ipa/libipa/agc_mean_luminance.h\nindex 5e986be008..46a4d3e3f3 100644\n--- a/src/ipa/libipa/agc_mean_luminance.h\n+++ b/src/ipa/libipa/agc_mean_luminance.h\n@@ -13,8 +13,6 @@\n \n #include <libcamera/base/utils.h>\n \n-#include <libcamera/controls.h>\n-\n #include \"libcamera/internal/value_node.h\"\n \n #include \"exposure_mode_helper.h\"\n@@ -63,11 +61,6 @@ public:\n \t\treturn exposureModeHelpers_;\n \t}\n \n-\tControlInfoMap::Map controls()\n-\t{\n-\t\treturn controls_;\n-\t}\n-\n \tstruct Params {\n \t\tconst Traits &traits;\n \t\tconst Histogram &yHist;\n@@ -108,7 +101,6 @@ private:\n \tstd::vector<AgcConstraint> additionalConstraints_;\n \tstd::map<int32_t, std::vector<AgcConstraint>> constraintModes_;\n \tstd::map<int32_t, ExposureModeHelper> exposureModeHelpers_;\n-\tControlInfoMap::Map controls_;\n };\n \n } /* namespace ipa */\n","prefixes":["RFC","v3","33/50"]}