{"id":26531,"url":"https://patchwork.libcamera.org/api/patches/26531/?format=json","web_url":"https://patchwork.libcamera.org/patch/26531/","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":"<20260423230059.3180987-10-laurent.pinchart@ideasonboard.com>","date":"2026-04-23T23:00:31","name":"[v3,09/37] libcamera: yaml_parser: Move Size handling to geometry.cpp","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"20543b7ccb788ea1bf465720afdd204cc4c36f05","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/26531/mbox/","series":[{"id":5883,"url":"https://patchwork.libcamera.org/api/series/5883/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5883","date":"2026-04-23T23:00:22","name":"libcamera: Global configuration file improvements","version":3,"mbox":"https://patchwork.libcamera.org/series/5883/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/26531/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/26531/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 5F32FBDCB5\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Apr 2026 23:01:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 00F1162F97;\n\tFri, 24 Apr 2026 01:01:19 +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 5045D62F6B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Apr 2026 01:01:13 +0200 (CEST)","from killaraus.ideasonboard.com\n\t(2001-14ba-703d-e500--2a1.rev.dnainternet.fi\n\t[IPv6:2001:14ba:703d:e500::2a1])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BB10C802\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Apr 2026 00:59:33 +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=\"TQtX4sT9\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1776985173;\n\tbh=UZgZhlQwgVg3fgwm9dX9iwtTkaGYqG3RmFMKUCvmRw4=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=TQtX4sT9nnwVgImBQt32yctAW9ZauCuaA0kD5RwGNDZTerDLufqjtxBjxlNbt2b96\n\tXyh1CBC5q+NjOPQ7zrVKk8QtnqY8s6zRDjBljGqx6ZWaxOBw5MVNxwvYxgNJ/s+8ql\n\tywz9jRm7oss8VOcErmjuyUwIczslKwRQkZ0NTizM=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH v3 09/37] libcamera: yaml_parser: Move Size handling to\n\tgeometry.cpp","Date":"Fri, 24 Apr 2026 02:00:31 +0300","Message-ID":"<20260423230059.3180987-10-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260423230059.3180987-1-laurent.pinchart@ideasonboard.com>","References":"<20260423230059.3180987-1-laurent.pinchart@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 YamlObject::Accessor structure is designed to extend the YamlObject\nclass with new getter and setter types without modifying\nyaml_parser.cpp. This feature is used for various libcamera classes,\nwhile standard C++ types are handled in yaml_parser.cpp.\n\nThe Size class is an outlier: it is a libcamera class, but is handled in\nyaml_parser.cpp. Move it to geometry.cpp. Drop the std::vector<Size>\nspecialization as it is currently unused.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\nReviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>\n---\n include/libcamera/internal/yaml_parser.h |  2 --\n src/ipa/libipa/lsc_polynomial.h          |  2 ++\n src/libcamera/geometry.cpp               | 29 ++++++++++++++++++++++++\n src/libcamera/yaml_parser.cpp            | 22 ------------------\n test/yaml-parser.cpp                     |  2 ++\n 5 files changed, 33 insertions(+), 24 deletions(-)","diff":"diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h\nindex c41397df67ab..7707e7469aca 100644\n--- a/include/libcamera/internal/yaml_parser.h\n+++ b/include/libcamera/internal/yaml_parser.h\n@@ -17,8 +17,6 @@\n \n #include <libcamera/base/class.h>\n \n-#include <libcamera/geometry.h>\n-\n namespace libcamera {\n \n class File;\ndiff --git a/src/ipa/libipa/lsc_polynomial.h b/src/ipa/libipa/lsc_polynomial.h\nindex df3a0d4b39c4..c71f215de3fc 100644\n--- a/src/ipa/libipa/lsc_polynomial.h\n+++ b/src/ipa/libipa/lsc_polynomial.h\n@@ -14,6 +14,8 @@\n #include <libcamera/base/log.h>\n #include <libcamera/base/span.h>\n \n+#include <libcamera/geometry.h>\n+\n #include \"libcamera/internal/yaml_parser.h\"\n \n namespace libcamera {\ndiff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\nindex 2763967a6e57..2e8e9e33ea78 100644\n--- a/src/libcamera/geometry.cpp\n+++ b/src/libcamera/geometry.cpp\n@@ -12,6 +12,8 @@\n \n #include <libcamera/base/log.h>\n \n+#include \"libcamera/internal/yaml_parser.h\"\n+\n /**\n  * \\file geometry.h\n  * \\brief Data structures related to geometric objects\n@@ -924,4 +926,31 @@ std::ostream &operator<<(std::ostream &out, const Rectangle &r)\n \treturn out;\n }\n \n+#ifndef __DOXYGEN__\n+/*\n+ * The YAML data shall be a list of two numerical values containing the x and y\n+ * coordinates, in that order.\n+ */\n+template<>\n+std::optional<Size>\n+YamlObject::Accessor<Size>::get(const YamlObject &obj) const\n+{\n+\tif (obj.type_ != Type::List)\n+\t\treturn std::nullopt;\n+\n+\tif (obj.list_.size() != 2)\n+\t\treturn std::nullopt;\n+\n+\tauto width = obj.list_[0].value->get<uint32_t>();\n+\tif (!width)\n+\t\treturn std::nullopt;\n+\n+\tauto height = obj.list_[1].value->get<uint32_t>();\n+\tif (!height)\n+\t\treturn std::nullopt;\n+\n+\treturn Size(*width, *height);\n+}\n+#endif /* __DOXYGEN__ */\n+\n } /* namespace libcamera */\ndiff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp\nindex b1439bc8124d..c5f3af24a7df 100644\n--- a/src/libcamera/yaml_parser.cpp\n+++ b/src/libcamera/yaml_parser.cpp\n@@ -284,27 +284,6 @@ void YamlObject::Accessor<std::string>::set(YamlObject &obj, std::string value)\n \tobj.value_ = std::move(value);\n }\n \n-template<>\n-std::optional<Size>\n-YamlObject::Accessor<Size>::get(const YamlObject &obj) const\n-{\n-\tif (obj.type_ != Type::List)\n-\t\treturn std::nullopt;\n-\n-\tif (obj.list_.size() != 2)\n-\t\treturn std::nullopt;\n-\n-\tauto width = obj.list_[0].value->get<uint32_t>();\n-\tif (!width)\n-\t\treturn std::nullopt;\n-\n-\tauto height = obj.list_[1].value->get<uint32_t>();\n-\tif (!height)\n-\t\treturn std::nullopt;\n-\n-\treturn Size(*width, *height);\n-}\n-\n template<typename T>\n struct YamlObject::Accessor<std::vector<T>> {\n \tstd::optional<std::vector<T>> get(const YamlObject &obj) const\n@@ -336,7 +315,6 @@ template struct YamlObject::Accessor<std::vector<uint16_t>>;\n template struct YamlObject::Accessor<std::vector<int32_t>>;\n template struct YamlObject::Accessor<std::vector<uint32_t>>;\n template struct YamlObject::Accessor<std::vector<std::string>>;\n-template struct YamlObject::Accessor<std::vector<Size>>;\n #endif /* __DOXYGEN__ */\n \n /**\ndiff --git a/test/yaml-parser.cpp b/test/yaml-parser.cpp\nindex 566401afcab6..01e734d23059 100644\n--- a/test/yaml-parser.cpp\n+++ b/test/yaml-parser.cpp\n@@ -14,6 +14,8 @@\n #include <libcamera/base/file.h>\n #include <libcamera/base/utils.h>\n \n+#include <libcamera/geometry.h>\n+\n #include \"libcamera/internal/yaml_parser.h\"\n \n #include \"test.h\"\n","prefixes":["v3","09/37"]}