Show a patch.

GET /api/patches/24875/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 24875,
    "url": "https://patchwork.libcamera.org/api/patches/24875/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/24875/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "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-5-rui.wang@ideasonboard.com>",
    "date": "2025-10-28T21:17:38",
    "name": "[v1,05/17] ipa: rkisp1: algorithms: dpf: add Dpf parseSingleConfig helper",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "235c8dbfcebc53a23d4de7b1dcae1d0b3d73f49e",
    "submitter": {
        "id": 241,
        "url": "https://patchwork.libcamera.org/api/people/241/?format=api",
        "name": "Rui Wang",
        "email": "rui.wang@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/24875/mbox/",
    "series": [
        {
            "id": 5542,
            "url": "https://patchwork.libcamera.org/api/series/5542/?format=api",
            "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/24875/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/24875/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 B70EDBE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Oct 2025 21:18:38 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 777EA60855;\n\tTue, 28 Oct 2025 22:18:38 +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 83F94606DE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Oct 2025 22:18:37 +0100 (CET)",
            "from rui-Precision-7560.local (unknown [209.216.122.90])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E14C1AD0;\n\tTue, 28 Oct 2025 22:16:47 +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=\"ITsrH78T\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1761686208;\n\tbh=eeCBzBL8knMj7SOHL8cPG4cTxQ4Q8BekHEC9qDqMWqo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ITsrH78TSxr9a4masl/kXCVovsyeAPDz2FmARMbYeliFfxsYmguE8ThspfBwdA1fr\n\tOHRKv1sJ6by5jtfDKKSaAao9O6JOFSgLpeXp1GQYfPoLeMOUt1cO4uwWGTl/7F9211\n\tZoHxBVZWxc+MM4ORVrUgvqQtWv9gEX5U0RN04F2g=",
        "From": "Rui Wang <rui.wang@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Rui Wang <rui.wang@ideasonboard.com>",
        "Subject": "[PATCH v1 05/17] ipa: rkisp1: algorithms: dpf: add Dpf\n\tparseSingleConfig helper",
        "Date": "Tue, 28 Oct 2025 17:17:38 -0400",
        "Message-ID": "<20251028211751.2761420-5-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": "Rework domain filter, NLL, gain, and strength parsing into a\nparseSingleConfig() helper. This extracts the parsing logic so it can be\nreused for both the base tuning and per-ISO-level configuration blocks.\n\nSigned-off-by: Rui Wang <rui.wang@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/dpf.cpp | 109 ++++++++++++++++++++++++++++++\n src/ipa/rkisp1/algorithms/dpf.h   |   7 +-\n 2 files changed, 115 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp\nindex cb6095da..9d1e6435 100644\n--- a/src/ipa/rkisp1/algorithms/dpf.cpp\n+++ b/src/ipa/rkisp1/algorithms/dpf.cpp\n@@ -171,6 +171,115 @@ int Dpf::init([[maybe_unused]] IPAContext &context,\n \treturn 0;\n }\n \n+bool Dpf::parseSingleConfig(const YamlObject &config,\n+\t\t\t    rkisp1_cif_isp_dpf_config &cfg,\n+\t\t\t    rkisp1_cif_isp_dpf_strength_config &strength)\n+{\n+\t/*\n+\t * The domain kernel is configured with a 9x9 kernel for the green\n+\t * pixels, and a 13x9 or 9x9 kernel for red and blue pixels.\n+\t *\n+\t * For the green component, we have the 9x9 kernel specified\n+\t * as 6 coefficients:\n+\t *    Y\n+\t *    ^\n+\t *  4 | 6   5   4   5   6\n+\t *  3 |   5   3   3   5\n+\t *  2 | 5   3   2   3   5\n+\t *  1 |   3   1   1   3\n+\t *  0 - 4   2   0   2   4\n+\t * -1 |   3   1   1   3\n+\t * -2 | 5   3   2   3   5\n+\t * -3 |   5   3   3   5\n+\t * -4 | 6   5   4   5   6\n+\t *    +---------|--------> X\n+\t *     -4....-1 0 1 2 3 4\n+\t *\n+\t * For the red and blue components, we have the 13x9 kernel specified\n+\t * as 6 coefficients:\n+\t *\n+\t *    Y\n+\t *    ^\n+\t *  4 | 6   5   4   3   4   5   6\n+\t *    |\n+\t *  2 | 5   4   2   1   2   4   5\n+\t *    |\n+\t *  0 - 5   3   1   0   1   3   5\n+\t *    |\n+\t * -2 | 5   4   2   1   2   4   5\n+\t *    |\n+\t * -4 | 6   5   4   3   4   5   6\n+\t *    +----------|-------------|---> X\n+\t *              -6...........-1 0 1......6\n+\t *\n+\t * For a 9x9 kernel, columns -6 and 6 are dropped, so coefficient\n+\t * number 6 is not used.\n+\t */\n+\n+\tif (!config.contains(\"DomainFilter\")) {\n+\t\tLOG(RkISP1Dpf, Error) << \"DomainFilter section missing\";\n+\t\treturn false;\n+\t}\n+\tconst YamlObject &dFObject = config[\"DomainFilter\"];\n+\n+\tstd::vector<uint8_t> gCoeffs;\n+\tif (!yamlHelper::optList8(dFObject, \"g\", gCoeffs, RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS))\n+\t\treturn false;\n+\tstd::copy_n(gCoeffs.begin(), gCoeffs.size(), std::begin(cfg.g_flt.spatial_coeff));\n+\tcfg.g_flt.gr_enable = true;\n+\tcfg.g_flt.gb_enable = true;\n+\n+\tuint32_t rbFilterSize;\n+\tif (!yamlHelper::optFilterCoeffs(dFObject, \"rb\", cfg.rb_flt.spatial_coeff, rbFilterSize, RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS))\n+\t\treturn false;\n+\tcfg.rb_flt.fltsize = rbFilterSize ? RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_13x9 : RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_9x9;\n+\tcfg.rb_flt.r_enable = true;\n+\tcfg.rb_flt.b_enable = true;\n+\n+\tif (!config.contains(\"NoiseLevelFunction\")) {\n+\t\tLOG(RkISP1Dpf, Error) << \"NoiseLevelFunction section missing\";\n+\t\treturn false;\n+\t}\n+\tconst YamlObject &rFObject = config[\"NoiseLevelFunction\"];\n+\n+\tstd::vector<uint16_t> nllCoeffs;\n+\tif (!yamlHelper::optList16(rFObject, \"coeff\", nllCoeffs, RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS))\n+\t\treturn false;\n+\tstd::copy_n(nllCoeffs.begin(), nllCoeffs.size(), std::begin(cfg.nll.coeff));\n+\n+\tconst std::map<std::string, uint32_t> scaleModeMap = {\n+\t\t{ \"linear\", RKISP1_CIF_ISP_NLL_SCALE_LINEAR },\n+\t\t{ \"logarithmic\", RKISP1_CIF_ISP_NLL_SCALE_LOGARITHMIC }\n+\t};\n+\tif (!yamlHelper::optEnum<uint32_t>(rFObject, \"scale-mode\", cfg.nll.scale_mode, RKISP1_CIF_ISP_NLL_SCALE_LINEAR, scaleModeMap)) {\n+\t\tLOG(RkISP1Dpf, Error) << \"NoiseLevelFunction:scale-mode expected 'linear' or 'logarithmic'\";\n+\t\treturn false;\n+\t}\n+\n+\tif (!config.contains(\"Gain\")) {\n+\t\tLOG(RkISP1Dpf, Error) << \"Gain section missing\";\n+\t\treturn false;\n+\t}\n+\tconst YamlObject &gObject = config[\"Gain\"];\n+\n+\tyamlHelper::opt32(gObject, \"gain_mode\", cfg.gain.mode, RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_LSC_GAINS);\n+\tyamlHelper::opt16(gObject, \"nf_r_gain\", cfg.gain.nf_r_gain, 256);\n+\tyamlHelper::opt16(gObject, \"nf_b_gain\", cfg.gain.nf_b_gain, 256);\n+\tyamlHelper::opt16(gObject, \"nf_gr_gain\", cfg.gain.nf_gr_gain, 256);\n+\tyamlHelper::opt16(gObject, \"nf_gb_gain\", cfg.gain.nf_gb_gain, 256);\n+\n+\tif (!config.contains(\"FilterStrength\")) {\n+\t\tLOG(RkISP1Dpf, Error) << \"FilterStrength section missing\";\n+\t\treturn false;\n+\t}\n+\tconst YamlObject &fSObject = config[\"FilterStrength\"];\n+\n+\tyamlHelper::opt8(fSObject, \"r\", strength.r, 64);\n+\tyamlHelper::opt8(fSObject, \"g\", strength.g, 64);\n+\tyamlHelper::opt8(fSObject, \"b\", strength.b, 64);\n+\treturn true;\n+}\n+\n /**\n  * \\copydoc libcamera::ipa::Algorithm::queueRequest\n  */\ndiff --git a/src/ipa/rkisp1/algorithms/dpf.h b/src/ipa/rkisp1/algorithms/dpf.h\nindex 2dd8cd36..cfd6ef44 100644\n--- a/src/ipa/rkisp1/algorithms/dpf.h\n+++ b/src/ipa/rkisp1/algorithms/dpf.h\n@@ -10,12 +10,14 @@\n #include <sys/types.h>\n \n #include \"algorithm.h\"\n+#include \"denoise.h\"\n+#include \"yaml_helper.h\"\n \n namespace libcamera {\n \n namespace ipa::rkisp1::algorithms {\n \n-class Dpf : public Algorithm\n+class Dpf : public DenoiseBaseAlgorithm\n {\n public:\n \tDpf();\n@@ -32,6 +34,9 @@ public:\n private:\n \tstruct rkisp1_cif_isp_dpf_config config_;\n \tstruct rkisp1_cif_isp_dpf_strength_config strengthConfig_;\n+\tbool parseSingleConfig(const YamlObject &config,\n+\t\t\t       rkisp1_cif_isp_dpf_config &cfg,\n+\t\t\t       rkisp1_cif_isp_dpf_strength_config &strength);\n };\n \n } /* namespace ipa::rkisp1::algorithms */\n",
    "prefixes": [
        "v1",
        "05/17"
    ]
}