{"id":27478,"url":"https://patchwork.libcamera.org/api/patches/27478/?format=json","web_url":"https://patchwork.libcamera.org/patch/27478/","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":"<20260723154327.1357866-30-barnabas.pocze@ideasonboard.com>","date":"2026-07-23T15:43:12","name":"[RFC,v2,29/43] ipa: libipa: agc_mean_luminance: Remove control handling","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"4114190fee5a187b7e4d81feea0f5319222c4243","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/27478/mbox/","series":[{"id":6075,"url":"https://patchwork.libcamera.org/api/series/6075/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6075","date":"2026-07-23T15:42:43","name":"ipa: libipa: agc rework","version":2,"mbox":"https://patchwork.libcamera.org/series/6075/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/27478/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27478/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 2DC0BC3264\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Jul 2026 15:44:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9809567F2B;\n\tThu, 23 Jul 2026 17:44:14 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0569D67EBA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Jul 2026 17:43:38 +0200 (CEST)","from pb-laptop.local (185.182.215.156.nat.pool.zt.hu\n\t[185.182.215.156])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2F62B23B9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Jul 2026 17:42: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=\"Bxpt61Ky\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1784821357;\n\tbh=aWh+IgfsTvy5vDPYR92YbZbmyRF0EDyYCrGoKHPcQPE=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Bxpt61KyNhC5alKblhPrJEVwXOAyeCjqq8YVBZVZglaT93TPIM01NhhtfwY3AnEih\n\tkeli8LKcxTgKRkzAULqxjC+byJqTdWKxjEOv/ssQqSNwhBO6M2xPxFy7v3d+0fKl9X\n\tZX0ra7p2hsW1V3Z8+kOdmoITNVC6qk+QUbepbSno=","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[RFC PATCH v2 29/43] ipa: libipa: agc_mean_luminance: Remove control\n\thandling","Date":"Thu, 23 Jul 2026 17:43:12 +0200","Message-ID":"<20260723154327.1357866-30-barnabas.pocze@ideasonboard.com>","X-Mailer":"git-send-email 2.55.0","In-Reply-To":"<20260723154327.1357866-1-barnabas.pocze@ideasonboard.com>","References":"<20260723154327.1357866-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>\n---\n src/ipa/libipa/agc.cpp                | 23 +++++++++++++++++------\n src/ipa/libipa/agc_mean_luminance.cpp | 20 +-------------------\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 54c5c6c349..27edc96fc6 100644\n--- a/src/ipa/libipa/agc.cpp\n+++ b/src/ipa/libipa/agc.cpp\n@@ -400,16 +400,27 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, cons\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-\n \treturn 0;\n }\n \ndiff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp\nindex a40b34b725..2c9c0b352c 100644\n--- a/src/ipa/libipa/agc_mean_luminance.cpp\n+++ b/src/ipa/libipa/agc_mean_luminance.cpp\n@@ -237,8 +237,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@@ -258,8 +256,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@@ -278,18 +274,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@@ -332,7 +323,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@@ -342,14 +332,11 @@ 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 \n@@ -473,11 +460,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","v2","29/43"]}