{"id":22832,"url":"https://patchwork.libcamera.org/api/1.1/patches/22832/?format=json","web_url":"https://patchwork.libcamera.org/patch/22832/","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":"<20250223230403.1226-11-laurent.pinchart@ideasonboard.com>","date":"2025-02-23T23:03:58","name":"[10/15] libipa: awb: Provide read-only accessor to modes_","commit_ref":null,"pull_url":null,"state":"rejected","archived":false,"hash":"2e52883f4eba0c8ab7528996817af05481fe4d79","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/22832/mbox/","series":[{"id":5012,"url":"https://patchwork.libcamera.org/api/1.1/series/5012/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5012","date":"2025-02-23T23:03:48","name":"libipa: awb: Drive-by fixes","version":1,"mbox":"https://patchwork.libcamera.org/series/5012/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/22832/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/22832/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 3BA03BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 23 Feb 2025 23:04:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 83147686D0;\n\tMon, 24 Feb 2025 00:04:50 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4B95D686D0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Feb 2025 00:04:34 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3CBA682A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Feb 2025 00:03:08 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"OOeTzBRX\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1740351788;\n\tbh=6tckMhzC0uVNDmkxqvJVwatpEZglEX66035geRe0AIo=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=OOeTzBRXIgImeP1BOEX1zKU65maV2jWzv7avV+fhKGpqLgWtrpn2VQvoCIE0kSXtA\n\tKRzuoG15SOcMos4T7GZ6NQwt7SAB0aok7XgB0nI9r0XcI5eNnafmC7Ubicj1gDyj7p\n\t7WgQ8zS4xwLTJhsZONt+KcPb7TSwnrq5yIq0XcsA=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH 10/15] libipa: awb: Provide read-only accessor to modes_","Date":"Mon, 24 Feb 2025 01:03:58 +0200","Message-ID":"<20250223230403.1226-11-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.45.3","In-Reply-To":"<20250223230403.1226-1-laurent.pinchart@ideasonboard.com>","References":"<20250223230403.1226-1-laurent.pinchart@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":"Derived classes don't need to modify the modes_ member variable. Make\nit private and provide a read-only accessor.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/libipa/awb.cpp       | 6 +++---\n src/ipa/libipa/awb.h         | 6 +++++-\n src/ipa/libipa/awb_bayes.cpp | 6 +++---\n src/ipa/libipa/awb_bayes.h   | 2 +-\n 4 files changed, 12 insertions(+), 8 deletions(-)","diff":"diff --git a/src/ipa/libipa/awb.cpp b/src/ipa/libipa/awb.cpp\nindex 04cf2d55ed00..0f54655d3234 100644\n--- a/src/ipa/libipa/awb.cpp\n+++ b/src/ipa/libipa/awb.cpp\n@@ -250,9 +250,9 @@ int AwbAlgorithm::parseModeConfigs(const YamlObject &tuningData,\n  */\n \n /**\n- * \\var AwbAlgorithm::modes_\n- * \\brief Map of all configured modes\n- * \\sa AwbAlgorithm::parseModeConfigs\n+ * \\fn AwbAlgorithm::modes()\n+ * \\brief Get the available AWB modes\n+ * \\return The map of available AWB modes\n  */\n \n } /* namespace ipa */\ndiff --git a/src/ipa/libipa/awb.h b/src/ipa/libipa/awb.h\nindex 36c05c37f5e9..017b7a0c3dc1 100644\n--- a/src/ipa/libipa/awb.h\n+++ b/src/ipa/libipa/awb.h\n@@ -54,9 +54,13 @@ protected:\n \t\tdouble ctLo;\n \t};\n \n-\tstd::map<controls::AwbModeEnum, AwbAlgorithm::ModeConfig> modes_;\n+\tconst std::map<controls::AwbModeEnum, AwbAlgorithm::ModeConfig> &modes() const\n+\t{\n+\t\treturn modes_;\n+\t}\n \n private:\n+\tstd::map<controls::AwbModeEnum, AwbAlgorithm::ModeConfig> modes_;\n \tControlInfoMap::Map controls_;\n };\n \ndiff --git a/src/ipa/libipa/awb_bayes.cpp b/src/ipa/libipa/awb_bayes.cpp\nindex 9287b884cb95..97bd256526a4 100644\n--- a/src/ipa/libipa/awb_bayes.cpp\n+++ b/src/ipa/libipa/awb_bayes.cpp\n@@ -170,7 +170,7 @@ int AwbBayes::init(const YamlObject &tuningData)\n \t\t\t<< \"Failed to parse mode parameter from tuning file\";\n \t\treturn ret;\n \t}\n-\tcurrentMode_ = &modes_[controls::AwbAuto];\n+\tcurrentMode_ = &modes().at(controls::AwbAuto);\n \n \ttransversePos_ = tuningData[\"transversePos\"].get<double>(0.01);\n \ttransverseNeg_ = tuningData[\"transverseNeg\"].get<double>(0.01);\n@@ -256,8 +256,8 @@ void AwbBayes::handleControls(const ControlList &controls)\n {\n \tauto mode = controls.get(controls::AwbMode);\n \tif (mode) {\n-\t\tauto it = modes_.find(static_cast<controls::AwbModeEnum>(*mode));\n-\t\tif (it != modes_.end())\n+\t\tauto it = modes().find(static_cast<controls::AwbModeEnum>(*mode));\n+\t\tif (it != modes().end())\n \t\t\tcurrentMode_ = &it->second;\n \t\telse\n \t\t\tLOG(Awb, Error) << \"Unsupported AWB mode \" << *mode;\ndiff --git a/src/ipa/libipa/awb_bayes.h b/src/ipa/libipa/awb_bayes.h\nindex 23bf88061118..b74201b542fb 100644\n--- a/src/ipa/libipa/awb_bayes.h\n+++ b/src/ipa/libipa/awb_bayes.h\n@@ -59,7 +59,7 @@ private:\n \tdouble transversePos_;\n \tdouble transverseNeg_;\n \n-\tModeConfig *currentMode_ = nullptr;\n+\tconst ModeConfig *currentMode_ = nullptr;\n };\n \n } /* namespace ipa */\n","prefixes":["10/15"]}