Show a patch.

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

{
    "id": 26124,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/26124/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26124/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20260210141925.547284-5-rui.wang@ideasonboard.com>",
    "date": "2026-02-10T14:19:22",
    "name": "[v14,4/7] ipa: rkisp1: algorithms: dpf: Refactor prepare() into helpers",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "875fd487968db4b7f734d83cebc8293f99180ead",
    "submitter": {
        "id": 241,
        "url": "https://patchwork.libcamera.org/api/1.1/people/241/?format=api",
        "name": "Rui Wang",
        "email": "rui.wang@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/26124/mbox/",
    "series": [
        {
            "id": 5781,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5781/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5781",
            "date": "2026-02-10T14:19:18",
            "name": "refactor DPF parsing and initialization",
            "version": 14,
            "mbox": "https://patchwork.libcamera.org/series/5781/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26124/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26124/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 DEE1BBDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 10 Feb 2026 14:19:49 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9B280621AE;\n\tTue, 10 Feb 2026 15:19:48 +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 1FD4F62196\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 10 Feb 2026 15:19:46 +0100 (CET)",
            "from rui-Precision-7560.tail5b760b.ts.net (unknown\n\t[209.216.103.65])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C92D81587;\n\tTue, 10 Feb 2026 15:18:58 +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=\"h/Obh24G\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1770733139;\n\tbh=DXunPAlnCeWAYhbg/yHUVOOFbZeDxPrNtsopxngZr1I=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=h/Obh24GTz53g+NictgvjinsuFzCOOrZnsdH2zAuFjyaLGd9Z0YO3FQRdu1yTBgGP\n\tlBT1LpwnhKwGBe3si5EIUR4SS0WrJHyg6v0YuMBKdHJLaB3E8Gr6RSbUdlekRMeGz1\n\to2AheHBEArhV7ojEfYNUKG+os6g76Jvd6cRO/osA=",
        "From": "Rui Wang <rui.wang@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Rui Wang <rui.wang@ideasonboard.com>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tIsaac Scott <isaac.scott@ideasonboard.com>",
        "Subject": "[PATCH v14 4/7] ipa: rkisp1: algorithms: dpf: Refactor prepare()\n\tinto helpers",
        "Date": "Tue, 10 Feb 2026 09:19:22 -0500",
        "Message-ID": "<20260210141925.547284-5-rui.wang@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20260210141925.547284-1-rui.wang@ideasonboard.com>",
        "References": "<20260210141925.547284-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": "Split the prepare() function into prepareDisabledMode() and\nprepareEnabledMode() to improve readability and maintainability.\n\nThis separates the logic for disabling and enabling the DPF, making\nthe main prepare() function cleaner and easier to follow.\n\nSigned-off-by: Rui Wang <rui.wang@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>\n\n---\nchangelog since v5/v6:  Nothing changed\n\nchangelog since v8 :\n - remove [[maybe_unused] for prepareEnable and prepareDisable\n\n Reviewed-by tags from v5 are carried over (no code changes).\n---\n src/ipa/rkisp1/algorithms/dpf.cpp | 80 +++++++++++++++++++------------\n src/ipa/rkisp1/algorithms/dpf.h   |  3 ++\n 2 files changed, 52 insertions(+), 31 deletions(-)",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp\nindex ee6fe740..19bb9b0f 100644\n--- a/src/ipa/rkisp1/algorithms/dpf.cpp\n+++ b/src/ipa/rkisp1/algorithms/dpf.cpp\n@@ -336,40 +336,58 @@ void Dpf::prepare(IPAContext &context, const uint32_t frame,\n \tif (!frameContext.dpf.update && frame > 0)\n \t\treturn;\n \n+\tif (!frameContext.dpf.denoise) {\n+\t\tprepareDisabledMode(params);\n+\t\treturn;\n+\t}\n+\n+\tprepareEnabledMode(context, params);\n+}\n+\n+void Dpf::prepareDisabledMode(RkISP1Params *params)\n+{\n+\tauto dpfConfig = params->block<BlockType::Dpf>();\n+\tdpfConfig.setEnabled(false);\n+\tauto dpfStrength = params->block<BlockType::DpfStrength>();\n+\tdpfStrength.setEnabled(false);\n+}\n+\n+void Dpf::prepareEnabledMode(IPAContext &context, RkISP1Params *params)\n+{\n+\tif (activeMode_ == noiseReductionModes_.end())\n+\t\treturn;\n+\n+\tconst ModeConfig &modeConfig = *activeMode_;\n+\n \tauto config = params->block<BlockType::Dpf>();\n-\tconfig.setEnabled(frameContext.dpf.denoise);\n+\tconfig.setEnabled(true);\n+\t*config = modeConfig.dpf;\n+\n+\tconst auto &awb = context.configuration.awb;\n+\tconst auto &lsc = context.activeState.lsc;\n+\n+\tauto &mode = config->gain.mode;\n+\n+\t/*\n+\t * The DPF needs to take into account the total amount of\n+\t * digital gain, which comes from the AWB and LSC modules. The\n+\t * DPF hardware can be programmed with a digital gain value\n+\t * manually, but can also use the gains supplied by the AWB and\n+\t * LSC modules automatically when they are enabled. Use that\n+\t * mode of operation as it simplifies control of the DPF.\n+\t */\n+\tif (awb.enabled && lsc.enabled)\n+\t\tmode = RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_LSC_GAINS;\n+\telse if (awb.enabled)\n+\t\tmode = RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_GAINS;\n+\telse if (lsc.enabled)\n+\t\tmode = RKISP1_CIF_ISP_DPF_GAIN_USAGE_LSC_GAINS;\n+\telse\n+\t\tmode = RKISP1_CIF_ISP_DPF_GAIN_USAGE_DISABLED;\n \n \tauto strengthConfig = params->block<BlockType::DpfStrength>();\n-\tstrengthConfig.setEnabled(frameContext.dpf.denoise);\n-\n-\tif (frameContext.dpf.denoise) {\n-\t\tconst ModeConfig &modeConfig = *activeMode_;\n-\n-\t\t*config = modeConfig.dpf;\n-\t\t*strengthConfig = modeConfig.strength;\n-\n-\t\tconst auto &awb = context.configuration.awb;\n-\t\tconst auto &lsc = context.activeState.lsc;\n-\n-\t\tauto &mode = config->gain.mode;\n-\n-\t\t/*\n-\t\t * The DPF needs to take into account the total amount of\n-\t\t * digital gain, which comes from the AWB and LSC modules. The\n-\t\t * DPF hardware can be programmed with a digital gain value\n-\t\t * manually, but can also use the gains supplied by the AWB and\n-\t\t * LSC modules automatically when they are enabled. Use that\n-\t\t * mode of operation as it simplifies control of the DPF.\n-\t\t */\n-\t\tif (awb.enabled && lsc.enabled)\n-\t\t\tmode = RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_LSC_GAINS;\n-\t\telse if (awb.enabled)\n-\t\t\tmode = RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_GAINS;\n-\t\telse if (lsc.enabled)\n-\t\t\tmode = RKISP1_CIF_ISP_DPF_GAIN_USAGE_LSC_GAINS;\n-\t\telse\n-\t\t\tmode = RKISP1_CIF_ISP_DPF_GAIN_USAGE_DISABLED;\n-\t}\n+\tstrengthConfig.setEnabled(true);\n+\t*strengthConfig = modeConfig.strength;\n }\n \n REGISTER_IPA_ALGORITHM(Dpf, \"Dpf\")\ndiff --git a/src/ipa/rkisp1/algorithms/dpf.h b/src/ipa/rkisp1/algorithms/dpf.h\nindex 43effcbe..208d8fe9 100644\n--- a/src/ipa/rkisp1/algorithms/dpf.h\n+++ b/src/ipa/rkisp1/algorithms/dpf.h\n@@ -44,6 +44,9 @@ private:\n \n \tbool loadConfig(int32_t mode);\n \n+\tvoid prepareDisabledMode(RkISP1Params *params);\n+\tvoid prepareEnabledMode(IPAContext &context, RkISP1Params *params);\n+\n \tstd::vector<ModeConfig> noiseReductionModes_;\n \tstd::vector<ModeConfig>::const_iterator activeMode_;\n };\n",
    "prefixes": [
        "v14",
        "4/7"
    ]
}