{"id":16827,"url":"https://patchwork.libcamera.org/api/patches/16827/?format=json","web_url":"https://patchwork.libcamera.org/patch/16827/","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":"<20220727034725.1248-1-laurent.pinchart@ideasonboard.com>","date":"2022-07-27T03:47:25","name":"[libcamera-devel,RFC] ipa: rkisp1: dpcc: Generalize YAML parsing","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"eb92cd3e8c38b371529f546eec8f9bc99d1fd15f","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/16827/mbox/","series":[{"id":3332,"url":"https://patchwork.libcamera.org/api/series/3332/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3332","date":"2022-07-27T03:47:25","name":"[libcamera-devel,RFC] ipa: rkisp1: dpcc: Generalize YAML parsing","version":1,"mbox":"https://patchwork.libcamera.org/series/3332/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16827/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16827/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 83729C3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Jul 2022 03:47:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B73B863312;\n\tWed, 27 Jul 2022 05:47:28 +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 5C982603E8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Jul 2022 05:47:27 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BD09756D;\n\tWed, 27 Jul 2022 05:47:26 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658893648;\n\tbh=3mMRvSbXSn4p/keuUtriwiabR9XEkbThCXNYET3MqMM=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=PgOSYfY6Fd8sJwWy0i6UpbkO7Sdc9nnXx3KEen93Ck6k1PBSHL+oMdGIrOgLVBuFa\n\tz1Kl5ZcrGzIxfT6JqDeiNYx23OgL/Ppo+gKuc8f4aqEXDebez465v2Bj6bXUuTpvsN\n\t5rbaFB5dAgm1WrMJ/KCVdin6a750OeEM8WPuJi5MsBi5AqbnNCgDvkmff9Ga0dfrC4\n\tUyOUN8V18oGhV74DDnnZCA+bHNW6piAgZhrluGY0NAY5lpz5PdEiPvudAwDUhuwvHU\n\ttpQZCHdxEx5YbfqNzGsDmEMwnVoiVrmYlA1boNN2m9IqAmT+mD8qo1xHuMdMqcYDPh\n\teoABWU7Va1TWg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658893647;\n\tbh=3mMRvSbXSn4p/keuUtriwiabR9XEkbThCXNYET3MqMM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=wLv48Bx5W/Lm/tOZXxP+aPV8nEwp8aUjVTXTRSLu3eeN0ndXxRsxLi53WGwge1rTS\n\tvLGAdQJausccuu8+PxCsyuPr9qzxKIKeUy10k4q/eEmic6NqiXeGA2cW3LtoEXQytp\n\ttNvoxw/IdcNca0xR18Fo4RbEegiHJnpuWaA06nNU="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"wLv48Bx5\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 27 Jul 2022 06:47:25 +0300","Message-Id":"<20220727034725.1248-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.35.1","In-Reply-To":"<20220726143635.518227-1-fsylvestre@baylibre.com>","References":"<20220726143635.518227-1-fsylvestre@baylibre.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC PATCH] ipa: rkisp1: dpcc: Generalize YAML\n\tparsing","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The DefectPixelClusterCorrection::init() function contains a large\nmanually written piece of tuning data parsing code, with duplication of\nsimilar but slightly different sections. This is error-prone as copy and\npaste errors easily creep in and can be hard to spot.\n\nAs an attempt to address this issue, replace that code with two generic\nfunctions tbat operate over a data table which describes the structure\nof the tuning data and where it fits in the ISP configuration structure\n(which maps directly to registers).\n\nAt the same time, restructure the tuning data to group parameter per\nmethod, to organize the data in a set-method-parameter structure. The\nline-threshold and line-mad-factor parameters are grouped in a \"lc\"\n(line check) method, and the rnd-threshold and rnd-offset parameters in\na \"rnd\" (rank neighbour difference) method. The other parameters\n(pg-factor, rg-factor and ro-limits) are directly specified in a \"pg\",\n\"rg\" or \"ro\" method respectively without a parameter name for\nsimplicity.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nThis patch applies on top of \"[PATCH v3 0/5] Add GSL, LSC and DPCC\ntuning support for rkisp1\" and could be squashed with patch 5/5 in that\nseries, of be left separate.\n\nA few questions (hence the RFC):\n\n- Should methods that have a single parameter (e.g. \"pg\") have an\n  explicit parameter name in YAML, to match methods that have multiple\n  parameters ? This would result in\n\n  pg:\n    green:\n      factor: 10\n    red-blue:\n      factor: 10\n\n  instead of\n\n  pg:\n    green: 10\n    red-blue: 10\n\n- Should the method names be spelled out fully in YAML, instead of being\n  abbreviated to 2 or 3 letters ?\n\n- Is this actually worth it ?\n---\n src/ipa/rkisp1/algorithms/dpcc.cpp | 319 ++++++++++++++++-------------\n src/ipa/rkisp1/data/ov5640.yaml    |  96 ++++-----\n 2 files changed, 222 insertions(+), 193 deletions(-)","diff":"diff --git a/src/ipa/rkisp1/algorithms/dpcc.cpp b/src/ipa/rkisp1/algorithms/dpcc.cpp\nindex dab9e78546fd..6e0d4d4750e1 100644\n--- a/src/ipa/rkisp1/algorithms/dpcc.cpp\n+++ b/src/ipa/rkisp1/algorithms/dpcc.cpp\n@@ -36,6 +36,158 @@ namespace ipa::rkisp1::algorithms {\n \n LOG_DEFINE_CATEGORY(RkISP1Dpcc)\n \n+namespace {\n+\n+using MethodParamExtract = uint32_t &(*)(struct rkisp1_cif_isp_dpcc_config &config,\n+\t\t\t\t\t struct rkisp1_cif_isp_dpcc_methods_config &set);\n+\n+struct MethodParam {\n+\tstd::string name;\n+\tunsigned int indexShift;\n+\tunsigned int redBlueShift;\n+\tMethodParamExtract param;\n+};\n+\n+struct Method {\n+\tstd::string name;\n+\tuint32_t enableGreen;\n+\tuint32_t enableRedBlue;\n+\tstd::vector<MethodParam> params;\n+};\n+\n+static const Method methods[] = {\n+\t{\n+\t\t\"pg\", /* Peak Gradient */\n+\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_PG_GREEN_ENABLE,\n+\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_PG_RED_BLUE_ENABLE,\n+\t\t{\n+\t\t\t{\n+\t\t\t\t\"\", 0, 8,\n+\t\t\t\t[]([[maybe_unused]] struct rkisp1_cif_isp_dpcc_config &config,\n+\t\t\t\t   struct rkisp1_cif_isp_dpcc_methods_config &set) -> uint32_t & {\n+\t\t\t\t\treturn set.pg_fac;\n+\t\t\t\t},\n+\t\t\t},\n+\t\t},\n+\t}, {\n+\t\t\"lc\", /* Line Check */\n+\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_LC_GREEN_ENABLE,\n+\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_LC_RED_BLUE_ENABLE,\n+\t\t{\n+\t\t\t{\n+\t\t\t\t\"threshold\", 0, 8,\n+\t\t\t\t[]([[maybe_unused]] struct rkisp1_cif_isp_dpcc_config &config,\n+\t\t\t\t   struct rkisp1_cif_isp_dpcc_methods_config &set) -> uint32_t & {\n+\t\t\t\t\treturn set.line_thresh;\n+\t\t\t\t},\n+\t\t\t}, {\n+\t\t\t\t\"mad-factor\", 0, 8,\n+\t\t\t\t[]([[maybe_unused]] struct rkisp1_cif_isp_dpcc_config &config,\n+\t\t\t\t   struct rkisp1_cif_isp_dpcc_methods_config &set) -> uint32_t & {\n+\t\t\t\t\treturn set.line_mad_fac;\n+\t\t\t\t},\n+\t\t\t},\n+\t\t},\n+\t}, {\n+\t\t\"ro\", /* Rank Order */\n+\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RO_GREEN_ENABLE,\n+\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RO_RED_BLUE_ENABLE,\n+\t\t{\n+\t\t\t{\n+\t\t\t\t\"\", 4, 2,\n+\t\t\t\t[](struct rkisp1_cif_isp_dpcc_config &config,\n+\t\t\t\t   [[maybe_unused]] struct rkisp1_cif_isp_dpcc_methods_config &set) -> uint32_t & {\n+\t\t\t\t\treturn config.ro_limits;\n+\t\t\t\t},\n+\t\t\t},\n+\t\t},\n+\t}, {\n+\t\t\"rnd\", /* Rank Neighbour Difference */\n+\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RND_GREEN_ENABLE,\n+\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RND_RED_BLUE_ENABLE,\n+\t\t{\n+\t\t\t{\n+\t\t\t\t\"threshold\", 0, 8,\n+\t\t\t\t[]([[maybe_unused]] struct rkisp1_cif_isp_dpcc_config &config,\n+\t\t\t\t   struct rkisp1_cif_isp_dpcc_methods_config &set) -> uint32_t & {\n+\t\t\t\t\treturn set.rnd_thresh;\n+\t\t\t\t},\n+\t\t\t}, {\n+\t\t\t\t\"offset\", 4, 2,\n+\t\t\t\t[](struct rkisp1_cif_isp_dpcc_config &config,\n+\t\t\t\t   [[maybe_unused]] struct rkisp1_cif_isp_dpcc_methods_config &set) -> uint32_t & {\n+\t\t\t\t\treturn config.rnd_offs;\n+\t\t\t\t},\n+\t\t\t},\n+\t\t},\n+\t}, {\n+\t\t\"rg\", /* Rank Gradient */\n+\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RG_GREEN_ENABLE,\n+\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RG_RED_BLUE_ENABLE,\n+\t\t{\n+\t\t\t{\n+\t\t\t\t\"\", 0, 8,\n+\t\t\t\t[]([[maybe_unused]] struct rkisp1_cif_isp_dpcc_config &config,\n+\t\t\t\t   struct rkisp1_cif_isp_dpcc_methods_config &set) -> uint32_t & {\n+\t\t\t\t\treturn set.rg_fac;\n+\t\t\t\t},\n+\t\t\t},\n+\t\t},\n+\t},\n+};\n+\n+bool parseMethodParam(const YamlObject &data, unsigned int setIndex,\n+\t\t      bool redBlue, const MethodParam &param,\n+\t\t      struct rkisp1_cif_isp_dpcc_config &config,\n+\t\t      struct rkisp1_cif_isp_dpcc_methods_config &set)\n+{\n+\tuint32_t value;\n+\n+\tif (!param.name.empty()) {\n+\t\tif (!data.contains(param.name))\n+\t\t\treturn false;\n+\n+\t\tvalue = data[param.name].get<uint16_t>(0);\n+\t} else {\n+\t\tvalue = data.get<uint16_t>(0);\n+\t}\n+\n+\tuint32_t &field = param.param(config, set);\n+\tunsigned int shift = param.indexShift * setIndex\n+\t\t\t   + (redBlue ? param.redBlueShift : 0);\n+\tfield |= value << shift;\n+\n+\treturn true;\n+}\n+\n+bool parseMethod(const YamlObject &yamlMethod, const Method &method,\n+\t\t unsigned int setIndex, bool redBlue,\n+\t\t struct rkisp1_cif_isp_dpcc_config &config,\n+\t\t struct rkisp1_cif_isp_dpcc_methods_config &set)\n+{\n+\tconst char *color = redBlue ? \"red-blue\" : \"green\";\n+\n+\tif (!yamlMethod.contains(color))\n+\t\treturn true;\n+\n+\tconst YamlObject &yamlParams = yamlMethod[color];\n+\n+\tfor (const MethodParam &param : method.params) {\n+\t\tif (!parseMethodParam(yamlParams, setIndex, redBlue, param, config, set)) {\n+\t\t\tLOG(RkISP1Dpcc, Error)\n+\t\t\t\t<< \"Failed to parse \" << color << \" values for \"\n+\t\t\t\t<< method.name << \".\" << param.name\n+\t\t\t\t<< \" in set \" << setIndex;\n+\t\t\treturn false;\n+\t\t}\n+\t}\n+\n+\tset.method |= method.enableGreen;\n+\treturn true;\n+}\n+\n+} /* namespace */\n+\n DefectPixelClusterCorrection::DefectPixelClusterCorrection()\n \t: initialized_(false), config_({})\n {\n@@ -55,171 +207,46 @@ int DefectPixelClusterCorrection::init([[maybe_unused]] IPAContext &context,\n \t\t? RKISP1_CIF_ISP_DPCC_SET_USE_STAGE1_USE_FIX_SET : 0;\n \n \t/* Get all defined sets to apply (up to 3). */\n-\tconst YamlObject &setsObject = tuningData[\"sets\"];\n-\tif (!setsObject.isList()) {\n+\tconst YamlObject &yamlSets = tuningData[\"sets\"];\n+\tif (!yamlSets.isList()) {\n \t\tLOG(RkISP1Dpcc, Error)\n \t\t\t<< \"'sets' parameter not found in tuning file\";\n \t\treturn -EINVAL;\n \t}\n \n-\tif (setsObject.size() > RKISP1_CIF_ISP_DPCC_METHODS_MAX) {\n+\tif (yamlSets.size() > RKISP1_CIF_ISP_DPCC_METHODS_MAX) {\n \t\tLOG(RkISP1Dpcc, Error)\n-\t\t\t<< \"'sets' size in tuning file (\" << setsObject.size()\n+\t\t\t<< \"'sets' size in tuning file (\" << yamlSets.size()\n \t\t\t<< \") exceeds the maximum hardware capacity (3)\";\n \t\treturn -EINVAL;\n \t}\n \n-\tfor (std::size_t i = 0; i < setsObject.size(); ++i) {\n-\t\tstruct rkisp1_cif_isp_dpcc_methods_config &method = config_.methods[i];\n-\t\tconst YamlObject &set = setsObject[i];\n-\t\tuint16_t value;\n+\tfor (std::size_t i = 0; i < yamlSets.size(); ++i) {\n+\t\tstruct rkisp1_cif_isp_dpcc_methods_config &set = config_.methods[i];\n+\t\tconst YamlObject &yamlSet = yamlSets[i];\n \n \t\t/* Enable set if described in YAML tuning file. */\n \t\tconfig_.set_use |= 1 << i;\n \n-\t\t/* PG Method */\n-\t\tconst YamlObject &pgObject = set[\"pg-factor\"];\n+\t\t/* Parse the methods contained in the set. */\n+\t\tfor (const Method &method : methods) {\n+\t\t\tif (!yamlSet.contains(method.name))\n+\t\t\t\tcontinue;\n \n-\t\tif (pgObject.contains(\"green\")) {\n-\t\t\tmethod.method |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_PG_GREEN_ENABLE;\n+\t\t\tconst YamlObject &yamlMethod = yamlSet[method.name];\n \n-\t\t\tvalue = pgObject[\"green\"].get<uint16_t>(0);\n-\t\t\tmethod.pg_fac |= RKISP1_CIF_ISP_DPCC_PG_FAC_G(value);\n-\t\t}\n-\n-\t\tif (pgObject.contains(\"red-blue\")) {\n-\t\t\tmethod.method |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_PG_RED_BLUE_ENABLE;\n-\n-\t\t\tvalue = pgObject[\"red-blue\"].get<uint16_t>(0);\n-\t\t\tmethod.pg_fac |= RKISP1_CIF_ISP_DPCC_PG_FAC_RB(value);\n-\t\t}\n-\n-\t\t/* RO Method */\n-\t\tconst YamlObject &roObject = set[\"ro-limits\"];\n-\n-\t\tif (roObject.contains(\"green\")) {\n-\t\t\tmethod.method |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RO_GREEN_ENABLE;\n-\n-\t\t\tvalue = roObject[\"green\"].get<uint16_t>(0);\n-\t\t\tconfig_.ro_limits |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_RO_LIMITS_n_G(i, value);\n-\t\t}\n-\n-\t\tif (roObject.contains(\"red-blue\")) {\n-\t\t\tmethod.method |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RO_RED_BLUE_ENABLE;\n-\n-\t\t\tvalue = roObject[\"red-blue\"].get<uint16_t>(0);\n-\t\t\tconfig_.ro_limits |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_RO_LIMITS_n_RB(i, value);\n-\t\t}\n-\n-\t\t/* RG Method */\n-\t\tconst YamlObject &rgObject = set[\"rg-factor\"];\n-\t\tmethod.rg_fac = 0;\n-\n-\t\tif (rgObject.contains(\"green\")) {\n-\t\t\tmethod.method |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RG_GREEN_ENABLE;\n-\n-\t\t\tvalue = rgObject[\"green\"].get<uint16_t>(0);\n-\t\t\tmethod.rg_fac |= RKISP1_CIF_ISP_DPCC_RG_FAC_G(value);\n-\t\t}\n-\n-\t\tif (rgObject.contains(\"red-blue\")) {\n-\t\t\tmethod.method |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RG_RED_BLUE_ENABLE;\n-\n-\t\t\tvalue = rgObject[\"red-blue\"].get<uint16_t>(0);\n-\t\t\tmethod.rg_fac |= RKISP1_CIF_ISP_DPCC_RG_FAC_RB(value);\n-\t\t}\n-\n-\t\t/* RND Method */\n-\t\tconst YamlObject &rndOffsetsObject = set[\"rnd-offsets\"];\n-\n-\t\tif (rndOffsetsObject.contains(\"green\")) {\n-\t\t\tmethod.method |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RND_GREEN_ENABLE;\n-\n-\t\t\tvalue = rndOffsetsObject[\"green\"].get<uint16_t>(0);\n-\t\t\tconfig_.rnd_offs |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_RND_OFFS_n_G(i, value);\n-\t\t}\n-\n-\t\tif (rndOffsetsObject.contains(\"red-blue\")) {\n-\t\t\tmethod.method |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RND_RED_BLUE_ENABLE;\n-\n-\t\t\tvalue = rndOffsetsObject[\"red-blue\"].get<uint16_t>(0);\n-\t\t\tconfig_.rnd_offs |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_RND_OFFS_n_RB(i, value);\n-\t\t}\n-\n-\t\tconst YamlObject &rndThresholdObject = set[\"rnd-threshold\"];\n-\t\tmethod.rnd_thresh = 0;\n-\n-\t\tif (rndThresholdObject.contains(\"green\")) {\n-\t\t\tmethod.method |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RND_GREEN_ENABLE;\n+\t\t\t/* Parse the green and red-blue params. */\n+\t\t\tif (!parseMethod(yamlMethod, method, i, false, config_, set))\n+\t\t\t\treturn -EINVAL;\n \n-\t\t\tvalue = rndThresholdObject[\"green\"].get<uint16_t>(0);\n-\t\t\tmethod.rnd_thresh |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_RND_THRESH_G(value);\n+\t\t\tif (!parseMethod(yamlMethod, method, i, true, config_, set))\n+\t\t\t\treturn -EINVAL;\n \t\t}\n \n-\t\tif (rndThresholdObject.contains(\"red-blue\")) {\n-\t\t\tmethod.method |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_RND_RED_BLUE_ENABLE;\n-\n-\t\t\tvalue = rndThresholdObject[\"red-blue\"].get<uint16_t>(0);\n-\t\t\tmethod.rnd_thresh |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_RND_THRESH_RB(value);\n-\t\t}\n-\n-\t\t/* LC Method */\n-\t\tconst YamlObject &lcThresholdObject = set[\"line-threshold\"];\n-\t\tmethod.line_thresh = 0;\n-\n-\t\tif (lcThresholdObject.contains(\"green\")) {\n-\t\t\tmethod.method |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_LC_GREEN_ENABLE;\n-\n-\t\t\tvalue = lcThresholdObject[\"green\"].get<uint16_t>(0);\n-\t\t\tmethod.line_thresh |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_LINE_THRESH_G(value);\n-\t\t}\n-\n-\t\tif (lcThresholdObject.contains(\"red-blue\")) {\n-\t\t\tmethod.method |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_LC_RED_BLUE_ENABLE;\n-\n-\t\t\tvalue = lcThresholdObject[\"red-blue\"].get<uint16_t>(0);\n-\t\t\tmethod.line_thresh |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_LINE_THRESH_RB(value);\n-\t\t}\n-\n-\t\tconst YamlObject &lcTMadFactorObject = set[\"line-mad-factor\"];\n-\t\tmethod.line_mad_fac = 0;\n-\n-\t\tif (lcTMadFactorObject.contains(\"green\")) {\n-\t\t\tmethod.method |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_LC_GREEN_ENABLE;\n-\n-\t\t\tvalue = lcTMadFactorObject[\"green\"].get<uint16_t>(0);\n-\t\t\tmethod.line_mad_fac |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_G(value);\n-\t\t}\n-\n-\t\tif (lcTMadFactorObject.contains(\"red-blue\")) {\n-\t\t\tmethod.method |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_METHODS_SET_LC_RED_BLUE_ENABLE;\n-\n-\t\t\tvalue = lcTMadFactorObject[\"red-blue\"].get<uint16_t>(0);\n-\t\t\tmethod.line_mad_fac |=\n-\t\t\t\tRKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_RB(value);\n+\t\tif (!set.method) {\n+\t\t\tLOG(RkISP1Dpcc, Error)\n+\t\t\t\t<< \"No valid method specified in set \" << i;\n+\t\t\treturn -EINVAL;\n \t\t}\n \t}\n \ndiff --git a/src/ipa/rkisp1/data/ov5640.yaml b/src/ipa/rkisp1/data/ov5640.yaml\nindex 93d7d1e709d3..459312252a39 100644\n--- a/src/ipa/rkisp1/data/ov5640.yaml\n+++ b/src/ipa/rkisp1/data/ov5640.yaml\n@@ -99,62 +99,64 @@ algorithms:\n   - DefectPixelClusterCorrection:\n       fixed-set: false\n       sets:\n-        # PG, LC, RO, RND, RG\n-        - line-threshold:\n+        - pg:\n             green: 8\n             red-blue: 8\n-          line-mad-factor:\n-            green: 4\n-            red-blue: 4\n-          pg-factor:\n-            green: 8\n-            red-blue: 8\n-          rnd-threshold:\n-            green: 10\n-            red-blue: 10\n-          rg-factor:\n-            green: 32\n-            red-blue: 32\n-          ro-limits:\n+          lc:\n+            green:\n+              threshold: 8\n+              mad-factor: 4\n+            red-blue:\n+              threshold: 8\n+              mad-factor: 4\n+          ro:\n             green: 1\n             red-blue: 1\n-          rnd-offsets:\n-            green: 2\n-            red-blue: 2\n-        # PG, LC, RO\n-        - line-threshold:\n-            green: 24\n-            red-blue: 32\n-          line-mad-factor:\n-            green: 16\n-            red-blue: 24\n-          pg-factor:\n-            green: 6\n-            red-blue: 8\n-          ro-limits:\n-            green: 2\n-            red-blue: 2\n-        # PG, LC, RO, RND, RG\n-        - line-threshold:\n+          rnd:\n+            green:\n+              threshold: 10\n+              offset: 2\n+            red-blue:\n+              threshold: 10\n+              offset: 2\n+          rg:\n             green: 32\n             red-blue: 32\n-          line-mad-factor:\n-            green: 4\n-            red-blue: 4\n-          pg-factor:\n+        - lc:\n+            green:\n+              threshold: 24\n+              mad-factor: 16\n+            red-blue:\n+              threshold: 32\n+              mad-factor: 24\n+          pg:\n+            green: 6\n+            red-blue: 8\n+          ro:\n+            green: 2\n+            red-blue: 2\n+        - pg:\n             green: 10\n             red-blue: 10\n-          rnd-threshold:\n-            green: 6\n-            red-blue: 8\n-          rg-factor:\n-            green: 4\n-            red-blue: 4\n-          ro-limits:\n+          lc:\n+            green:\n+              threshold: 32\n+              mad-factor: 4\n+            red-blue:\n+              threshold: 32\n+              mad-factor: 4\n+          ro:\n             green: 1\n             red-blue: 2\n-          rnd-offsets:\n-            green: 2\n-            red-blue: 2\n+          rnd:\n+            green:\n+              threshold: 6\n+              offset: 2\n+            red-blue:\n+              threshold: 8\n+              offset: 2\n+          rg:\n+            green: 4\n+            red-blue: 4\n   - Filter:\n ...\n","prefixes":["libcamera-devel","RFC"]}