Patch Detail
Show a patch.
GET /api/patches/27460/?format=api
{ "id": 27460, "url": "https://patchwork.libcamera.org/api/patches/27460/?format=api", "web_url": "https://patchwork.libcamera.org/patch/27460/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "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-12-barnabas.pocze@ideasonboard.com>", "date": "2026-07-23T15:42:54", "name": "[RFC,v2,11/43] ipa: libipa: agc_mean_luminance: Avoid some duplicate lookups", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "951228b5772331d18d82f7c7aa5e223522a2ade1", "submitter": { "id": 216, "url": "https://patchwork.libcamera.org/api/people/216/?format=api", "name": "Barnabás Pőcze", "email": "barnabas.pocze@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/27460/mbox/", "series": [ { "id": 6075, "url": "https://patchwork.libcamera.org/api/series/6075/?format=api", "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/27460/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/27460/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 CC2B3C32CE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Jul 2026 15:43:49 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 03FE367EFC;\n\tThu, 23 Jul 2026 17:43:49 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4537167ED1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Jul 2026 17:43:33 +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 67D962C09\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Jul 2026 17:42:32 +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=\"wjsdGaCh\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1784821352;\n\tbh=ta/wrT2oavvg7MUTgIj2aW43nYGzgGvNzNdXqCtXpVE=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=wjsdGaChX/QgF5vT3evgEXT0CVXY3g8OW/+6zhWebRp2ep5fcXQkX8jQYWC50qEXd\n\t0WChBw24N55/TD0+WNMlPMLkz6LEqHHaWvDbo696UK89wd2WYCT2t7MeQVDzX6wDM1\n\tkpaUgjUdEvhqzRTbCufBTmwBlTDRPm35YrJAE9nM=", "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[RFC PATCH v2 11/43] ipa: libipa: agc_mean_luminance: Avoid some\n\tduplicate lookups", "Date": "Thu, 23 Jul 2026 17:42:54 +0200", "Message-ID": "<20260723154327.1357866-12-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": "Use iterators/references to avoid multiple map lookups. Also adjust\nthe no exposure mode / constraint cases to look similar.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n src/ipa/libipa/agc_mean_luminance.cpp | 35 +++++++++++----------------\n 1 file changed, 14 insertions(+), 21 deletions(-)", "diff": "diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp\nindex 40e4c03100..8284c15ce2 100644\n--- a/src/ipa/libipa/agc_mean_luminance.cpp\n+++ b/src/ipa/libipa/agc_mean_luminance.cpp\n@@ -225,14 +225,12 @@ int AgcMeanLuminance::parseConstraint(const ValueNode &modeDict, int32_t id)\n \t\t}\n \n \t\tAgcConstraint constraint = { bound, qLo, qHi, std::move(*yTarget) };\n-\n-\t\tif (!constraintModes_.count(id))\n-\t\t\tconstraintModes_[id] = {};\n+\t\tauto &constraints = constraintModes_[id];\n \n \t\tif (idx)\n-\t\t\tconstraintModes_[id].push_back(constraint);\n+\t\t\tconstraints.push_back(std::move(constraint));\n \t\telse\n-\t\t\tconstraintModes_[id].insert(constraintModes_[id].begin(), constraint);\n+\t\t\tconstraints.insert(constraints.begin(), std::move(constraint));\n \t}\n \n \treturn 0;\n@@ -245,8 +243,8 @@ int AgcMeanLuminance::parseConstraintModes(const ValueNode &tuningData)\n \tconst ValueNode &constraintModes = tuningData[controls::AeConstraintMode.name()];\n \tif (constraintModes.isDictionary()) {\n \t\tfor (const auto &[modeName, modeDict] : constraintModes.asDict()) {\n-\t\t\tif (AeConstraintModeNameValueMap.find(modeName) ==\n-\t\t\t AeConstraintModeNameValueMap.end()) {\n+\t\t\tauto it = AeConstraintModeNameValueMap.find(modeName);\n+\t\t\tif (it == AeConstraintModeNameValueMap.end()) {\n \t\t\t\tLOG(AgcMeanLuminance, Warning)\n \t\t\t\t\t<< \"Skipping unknown constraint mode '\" << modeName << \"'\";\n \t\t\t\tcontinue;\n@@ -258,13 +256,11 @@ int AgcMeanLuminance::parseConstraintModes(const ValueNode &tuningData)\n \t\t\t\treturn -EINVAL;\n \t\t\t}\n \n-\t\t\tint ret = parseConstraint(modeDict,\n-\t\t\t\t\t\t AeConstraintModeNameValueMap.at(modeName));\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(\n-\t\t\t\tAeConstraintModeNameValueMap.at(modeName));\n+\t\t\tavailableConstraintModes.push_back(it->second);\n \t\t}\n \t}\n \n@@ -282,9 +278,7 @@ int AgcMeanLuminance::parseConstraintModes(const ValueNode &tuningData)\n \t\t\tPwl({ { { 0.0, 0.5 } } })\n \t\t};\n \n-\t\tconstraintModes_[controls::ConstraintNormal].insert(\n-\t\t\tconstraintModes_[controls::ConstraintNormal].begin(),\n-\t\t\tconstraint);\n+\t\tconstraintModes_[controls::ConstraintNormal].push_back(std::move(constraint));\n \t\tavailableConstraintModes.push_back(controls::ConstraintNormal);\n \t}\n \n@@ -300,8 +294,8 @@ int AgcMeanLuminance::parseExposureModes(const ValueNode &tuningData)\n \tconst ValueNode &exposureModes = tuningData[controls::AeExposureMode.name()];\n \tif (exposureModes.isDictionary()) {\n \t\tfor (const auto &[modeName, modeValues] : exposureModes.asDict()) {\n-\t\t\tif (AeExposureModeNameValueMap.find(modeName) ==\n-\t\t\t AeExposureModeNameValueMap.end()) {\n+\t\t\tauto it = AeExposureModeNameValueMap.find(modeName);\n+\t\t\tif (it == AeExposureModeNameValueMap.end()) {\n \t\t\t\tLOG(AgcMeanLuminance, Warning)\n \t\t\t\t\t<< \"Skipping unknown exposure mode '\" << modeName << \"'\";\n \t\t\t\tcontinue;\n@@ -341,8 +335,8 @@ int AgcMeanLuminance::parseExposureModes(const ValueNode &tuningData)\n \t\t\tstd::shared_ptr<ExposureModeHelper> helper =\n \t\t\t\tstd::make_shared<ExposureModeHelper>(stages);\n \n-\t\t\texposureModeHelpers_[AeExposureModeNameValueMap.at(modeName)] = helper;\n-\t\t\tavailableExposureModes.push_back(AeExposureModeNameValueMap.at(modeName));\n+\t\t\texposureModeHelpers_.try_emplace(it->second, std::move(helper));\n+\t\t\tavailableExposureModes.push_back(it->second);\n \t\t}\n \t}\n \n@@ -353,14 +347,13 @@ int AgcMeanLuminance::parseExposureModes(const ValueNode &tuningData)\n \t * possible before touching gain.\n \t */\n \tif (availableExposureModes.empty()) {\n-\t\tint32_t exposureModeId = controls::ExposureNormal;\n \t\tstd::vector<std::pair<utils::Duration, double>> stages = { };\n \n \t\tstd::shared_ptr<ExposureModeHelper> helper =\n \t\t\tstd::make_shared<ExposureModeHelper>(stages);\n \n-\t\texposureModeHelpers_[exposureModeId] = helper;\n-\t\tavailableExposureModes.push_back(exposureModeId);\n+\t\texposureModeHelpers_.try_emplace(controls::ExposureNormal, std::move(helper));\n+\t\tavailableExposureModes.push_back(controls::ExposureNormal);\n \t}\n \n \tcontrols_[&controls::AeExposureMode] = ControlInfo(availableExposureModes);\n", "prefixes": [ "RFC", "v2", "11/43" ] }