{"id":24874,"url":"https://patchwork.libcamera.org/api/1.1/patches/24874/?format=json","web_url":"https://patchwork.libcamera.org/patch/24874/","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":"<20251028211751.2761420-4-rui.wang@ideasonboard.com>","date":"2025-10-28T21:17:37","name":"[v1,04/17] ipa: rkisp1: algorithms: Add YAML parsing helper utilities","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"bdb047a57f9245400b0dd37b8b98bcaeddb575c5","submitter":{"id":241,"url":"https://patchwork.libcamera.org/api/1.1/people/241/?format=json","name":"Rui Wang","email":"rui.wang@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24874/mbox/","series":[{"id":5542,"url":"https://patchwork.libcamera.org/api/1.1/series/5542/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5542","date":"2025-10-28T21:17:34","name":"[v1,01/17] ipa: rkisp1: algorithms: add Denoise base class shell","version":1,"mbox":"https://patchwork.libcamera.org/series/5542/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24874/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24874/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 E7D43BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Oct 2025 21:18:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9788460844;\n\tTue, 28 Oct 2025 22:18:36 +0100 (CET)","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 2F15D606DE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Oct 2025 22:18:35 +0100 (CET)","from rui-Precision-7560.local (unknown [209.216.122.90])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DCB4BAD0;\n\tTue, 28 Oct 2025 22:16:45 +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=\"iEFE/IhD\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1761686206;\n\tbh=+eyGqc5p9uACWenOcU/Wnu+Z5BE8b3Mww6kmViso+Wk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=iEFE/IhDikSMcoJ5VZu90xZJpz3b2k4YWSVQyPM6IK/HHo4TV01S0EHv6WI2ILMiJ\n\tI//vyfLW7C5Cwxst4AHAUb7KA1M4n1p61qiZyB2jg6e3Dtr19Aig7yY5jesJmZ1hHh\n\t/rVX/o9CGqtADRZQedaG1Aon2msscbD/CQZgubxk=","From":"Rui Wang <rui.wang@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Rui Wang <rui.wang@ideasonboard.com>","Subject":"[PATCH v1 04/17] ipa: rkisp1: algorithms: Add YAML parsing helper\n\tutilities","Date":"Tue, 28 Oct 2025 17:17:37 -0400","Message-ID":"<20251028211751.2761420-4-rui.wang@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20251028211751.2761420-1-rui.wang@ideasonboard.com>","References":"<20251028211751.2761420-1-rui.wang@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":"Introduce yaml_helper.h with standardized functions for parsing YAML\nconfiguration data in RkISP1 IPA algorithms. Provides type-safe parsing\nfor optional values, lists, enums, and specialized filter coefficients.\n\nKey functions:\n- opt8/16/32/bool: Type-safe optional value parsing with defaults\n- optList8/16: List parsing with size validation\n- optEnum: String-to-enum mapping with validation\n- optFilterCoeffs: Specialized filter coefficient parsing\n\nSigned-off-by: Rui Wang <rui.wang@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/yaml_helper.h | 123 ++++++++++++++++++++++++\n 1 file changed, 123 insertions(+)\n create mode 100644 src/ipa/rkisp1/algorithms/yaml_helper.h","diff":"diff --git a/src/ipa/rkisp1/algorithms/yaml_helper.h b/src/ipa/rkisp1/algorithms/yaml_helper.h\nnew file mode 100644\nindex 00000000..ed2ba926\n--- /dev/null\n+++ b/src/ipa/rkisp1/algorithms/yaml_helper.h\n@@ -0,0 +1,123 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2025, Ideas On Board\n+ *\n+ * RkISP1 YAML parsing helper functions\n+ */\n+\n+#pragma once\n+\n+#include <map>\n+#include <optional>\n+#include <vector>\n+\n+#include \"libcamera/internal/yaml_parser.h\"\n+\n+namespace libcamera {\n+\n+namespace ipa::rkisp1::algorithms {\n+\n+namespace yamlHelper {\n+\n+inline void opt32(const YamlObject &level, const char *key, std::optional<uint32_t> &dst)\n+{\n+\tdst = level[key].get<uint32_t>();\n+}\n+\n+inline void opt16(const YamlObject &level, const char *key, std::optional<uint16_t> &dst)\n+{\n+\tdst = level[key].get<uint16_t>();\n+}\n+\n+inline void opt8(const YamlObject &level, const char *key, std::optional<uint8_t> &dst)\n+{\n+\tdst = level[key].get<uint8_t>();\n+}\n+\n+inline void optbool(const YamlObject &level, const char *key, std::optional<bool> &dst)\n+{\n+\tdst = level[key].get<bool>();\n+}\n+\n+inline void optbool(const YamlObject &level, const char *key, bool &dst, bool defaultVal)\n+{\n+\tstd::optional<bool> val = level[key].get<bool>();\n+\tdst = val.value_or(defaultVal);\n+}\n+\n+inline void opt8(const YamlObject &level, const char *key, uint8_t &dst, uint8_t defaultVal)\n+{\n+\tstd::optional<uint8_t> val = level[key].get<uint8_t>();\n+\tdst = val.value_or(defaultVal);\n+}\n+\n+inline void opt16(const YamlObject &level, const char *key, uint16_t &dst, uint16_t defaultVal)\n+{\n+\tstd::optional<uint16_t> val = level[key].get<uint16_t>();\n+\tdst = val.value_or(defaultVal);\n+}\n+\n+inline void opt32(const YamlObject &level, const char *key, uint32_t &dst, uint32_t defaultVal)\n+{\n+\tstd::optional<uint32_t> val = level[key].get<uint32_t>();\n+\tdst = val.value_or(defaultVal);\n+}\n+\n+inline bool optList8(const YamlObject &level, const char *key, std::vector<uint8_t> &dst, size_t expectedSize)\n+{\n+\tstd::optional<std::vector<uint8_t>> val = level[key].getList<uint8_t>();\n+\tif (!val || val->size() != expectedSize)\n+\t\treturn false;\n+\tdst = *val;\n+\treturn true;\n+}\n+\n+inline bool optList16(const YamlObject &level, const char *key, std::vector<uint16_t> &dst, size_t expectedSize)\n+{\n+\tstd::optional<std::vector<uint16_t>> val = level[key].getList<uint16_t>();\n+\tif (!val || val->size() != expectedSize)\n+\t\treturn false;\n+\tdst = *val;\n+\treturn true;\n+}\n+\n+template<typename EnumType>\n+inline bool optEnum(const YamlObject &level, const char *key, EnumType &dst, EnumType defaultVal,\n+\t\t    const std::map<std::string, EnumType> &enumMap)\n+{\n+\tstd::optional<std::string> val = level[key].get<std::string>();\n+\tif (!val) {\n+\t\tdst = defaultVal;\n+\t\treturn true;\n+\t}\n+\tauto it = enumMap.find(*val);\n+\tif (it == enumMap.end())\n+\t\treturn false;\n+\tdst = it->second;\n+\treturn true;\n+}\n+\n+inline bool optFilterCoeffs(const YamlObject &level, const char *key, uint8_t *coeffs, uint32_t &filterSize, size_t maxCoeffs)\n+{\n+\tstd::optional<std::vector<uint8_t>> val = level[key].getList<uint8_t>();\n+\tif (!val)\n+\t\treturn false;\n+\n+\tsize_t size = val->size();\n+\tif (size == maxCoeffs - 1) {\n+\t\tfilterSize = 0; // 9x9 filter\n+\t} else if (size == maxCoeffs) {\n+\t\tfilterSize = 1; // 13x9 filter\n+\t} else {\n+\t\treturn false; // Invalid size\n+\t}\n+\n+\tstd::copy_n(val->begin(), size, coeffs);\n+\treturn true;\n+}\n+\n+} /* namespace yamlHelper */\n+\n+} /* namespace ipa::rkisp1::algorithms */\n+\n+} /* namespace libcamera */\n","prefixes":["v1","04/17"]}