{"id":20281,"url":"https://patchwork.libcamera.org/api/1.1/patches/20281/?format=json","web_url":"https://patchwork.libcamera.org/patch/20281/","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":"<20240613013944.23344-10-laurent.pinchart@ideasonboard.com>","date":"2024-06-13T01:39:42","name":"[09/11] ipa: libipa: pwl: Specialize YamlObject getter","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"df11f1a1a76b7055a28f5baa9b8f0035a9f33120","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/20281/mbox/","series":[{"id":4386,"url":"https://patchwork.libcamera.org/api/1.1/series/4386/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4386","date":"2024-06-13T01:39:33","name":"ipa: libipa: Vector and Pwl improvements","version":1,"mbox":"https://patchwork.libcamera.org/series/4386/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20281/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20281/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 81598C32CF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 13 Jun 2024 01:40:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CF4B0654A2;\n\tThu, 13 Jun 2024 03:40:30 +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 E22AB6548C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 13 Jun 2024 03:40:16 +0200 (CEST)","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 201E1D77;\n\tThu, 13 Jun 2024 03:40:03 +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=\"gKaMeQRi\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1718242803;\n\tbh=yota/oSVAMrw0hkf+nFveAese1LIg7FjfDaAk+OTDKM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=gKaMeQRi6R9aNd2v9kg+VDqoqOFqPnsiDh2KgFWG5zDq/jFSVDU3EPJ1lY7CrzjM2\n\tZh7Qy9tmVi7Yfk2hdr62Wc+Hbj8bPNyrid0YInt4cGZf1K4mwGlZ5RthsuPg8i32Jz\n\tfqlqIivZ20fDl5qKNToKOR8n6+13L/Gvp2eBtFqU=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Paul Elder <paul.elder@ideasonboard.com>,\n\tDavid Plowman <david.plowman@raspberrypi.com>,\n\tNaushir Patuck <naush@raspberrypi.com>","Subject":"[PATCH 09/11] ipa: libipa: pwl: Specialize YamlObject getter","Date":"Thu, 13 Jun 2024 04:39:42 +0300","Message-ID":"<20240613013944.23344-10-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.44.2","In-Reply-To":"<20240613013944.23344-1-laurent.pinchart@ideasonboard.com>","References":"<20240613013944.23344-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":"Implement a specialization of the YamlObject::Getter structure to\nsupport deserializing ipa::Pwl objects from YAML data.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/libipa/pwl.cpp | 35 +++++++++++++++++++++++++++++++++++\n 1 file changed, 35 insertions(+)","diff":"diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp\nindex cf864fbb3889..3c639645fa3d 100644\n--- a/src/ipa/libipa/pwl.cpp\n+++ b/src/ipa/libipa/pwl.cpp\n@@ -459,4 +459,39 @@ std::string Pwl::toString() const\n \n } /* namespace ipa */\n \n+#ifndef __DOXYGEN__\n+/*\n+ * The YAML data shall be a list of numerical values with an even number of\n+ * elements. They are parsed in pairs into x and y points in the piecewise\n+ * linear function, and added in order. x must be monotonically increasing.\n+ */\n+template<>\n+std::optional<ipa::Pwl>\n+YamlObject::Getter<ipa::Pwl>::get(const YamlObject &obj) const\n+{\n+\tif (!obj.size() || obj.size() % 2)\n+\t\treturn std::nullopt;\n+\n+\tipa::Pwl pwl;\n+\n+\tconst auto &list = obj.asList();\n+\n+\tfor (auto it = list.begin(); it != list.end(); it++) {\n+\t\tauto x = it->get<double>();\n+\t\tif (!x)\n+\t\t\treturn std::nullopt;\n+\t\tauto y = (++it)->get<double>();\n+\t\tif (!y)\n+\t\t\treturn std::nullopt;\n+\n+\t\tpwl.append(*x, *y);\n+\t}\n+\n+\tif (pwl.size() != obj.size() / 2)\n+\t\treturn std::nullopt;\n+\n+\treturn pwl;\n+}\n+#endif /* __DOXYGEN__ */\n+\n } /* namespace libcamera */\n","prefixes":["09/11"]}