Show a patch.

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

{
    "id": 25705,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/25705/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/25705/",
    "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": "<20260108-sklug-lsc-resampling-v2-dev-v2-15-e682ec4b9893@ideasonboard.com>",
    "date": "2026-01-08T16:05:58",
    "name": "[v2,15/15] ipa: rkisp1: Implement LensShadingCorrectionEnable control",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "b1e958baee18dc3426c6fdb8b0265e072682e390",
    "submitter": {
        "id": 184,
        "url": "https://patchwork.libcamera.org/api/1.1/people/184/?format=api",
        "name": "Stefan Klug",
        "email": "stefan.klug@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/25705/mbox/",
    "series": [
        {
            "id": 5697,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5697/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5697",
            "date": "2026-01-08T16:05:43",
            "name": "Add resampling support for polynomial LSC data",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/5697/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/25705/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/25705/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 62335BE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  8 Jan 2026 16:07:11 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 27B2861FBB;\n\tThu,  8 Jan 2026 17:07:11 +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 BA1FC61FDA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  8 Jan 2026 17:07:09 +0100 (CET)",
            "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:90af:8957:b721:10d4])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 49FDF19D0; \n\tThu,  8 Jan 2026 17:06: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=\"pxffyVRb\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1767888407;\n\tbh=/HR/SVEGTjbt6VZVxVy4iJ9xGipIwjEVZ2Gf9+OoblE=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=pxffyVRb3vrir/mF2VfFrTyHL0gs9YhToYJnrYT/4xXO7DNyJBn44zpTdf0vf1zyz\n\ttS9XHbLsHEOSXShxKc/yyr+A1ozwSQ2QAp5GnkkcsTVJxq7Ui2BTedyskS7pqfVDKs\n\tGB3qLVWHNgK4p9nw40wagnysswCNTNt71EU8FLkQ=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "Date": "Thu, 08 Jan 2026 17:05:58 +0100",
        "Subject": "[PATCH v2 15/15] ipa: rkisp1: Implement\n\tLensShadingCorrectionEnable control",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "Message-Id": "<20260108-sklug-lsc-resampling-v2-dev-v2-15-e682ec4b9893@ideasonboard.com>",
        "References": "<20260108-sklug-lsc-resampling-v2-dev-v2-0-e682ec4b9893@ideasonboard.com>",
        "In-Reply-To": "<20260108-sklug-lsc-resampling-v2-dev-v2-0-e682ec4b9893@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "X-Mailer": "b4 0.14.2",
        "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 the LensShadingCorrectionEnable control for rkisp1.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\n---\n\nChanges in v2:\n- Add the control only if LSC is properly configured in the tuning file\n- Introduce enable flag in frame context for per frame control\n---\n src/ipa/rkisp1/algorithms/dpf.cpp |  2 +-\n src/ipa/rkisp1/algorithms/lsc.cpp | 48 ++++++++++++++++++++++++++++++++++-----\n src/ipa/rkisp1/algorithms/lsc.h   |  3 +++\n src/ipa/rkisp1/ipa_context.h      | 13 +++++++----\n 4 files changed, 55 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp\nindex 39f3e461f313dfbf35cb5d6a0daca0540bdf7b6b..83c1e4b7b355041295cbe0498a8dd70877ea6636 100644\n--- a/src/ipa/rkisp1/algorithms/dpf.cpp\n+++ b/src/ipa/rkisp1/algorithms/dpf.cpp\n@@ -233,7 +233,7 @@ void Dpf::prepare(IPAContext &context, const uint32_t frame,\n \t\t*strengthConfig = strengthConfig_;\n \n \t\tconst auto &awb = context.configuration.awb;\n-\t\tconst auto &lsc = context.configuration.lsc;\n+\t\tconst auto &lsc = context.activeState.lsc;\n \n \t\tauto &mode = config->gain.mode;\n \ndiff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\nindex 698f07b85bfa5d3de0c454087bf8e0874d85add7..cb3f8550457eb2e67959ce034d037ac60328d267 100644\n--- a/src/ipa/rkisp1/algorithms/lsc.cpp\n+++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n@@ -416,6 +416,8 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n \tif (ret)\n \t\treturn ret;\n \n+\tcontext.ctrlMap[&controls::LensShadingCorrectionEnable] = ControlInfo(false, true, true);\n+\n \tshadingDescriptors_ = std::move(lscData);\n \n \treturn 0;\n@@ -460,7 +462,7 @@ int LensShadingCorrection::configure(IPAContext &context,\n \n \tsets_.setData(std::move(shadingData));\n \n-\tcontext.configuration.lsc.enabled = true;\n+\tcontext.activeState.lsc.enabled = true;\n \treturn 0;\n }\n \n@@ -481,6 +483,29 @@ void LensShadingCorrection::copyTable(rkisp1_cif_isp_lsc_config &config,\n \tstd::copy(set.b.begin(), set.b.end(), &config.b_data_tbl[0][0]);\n }\n \n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::queueRequest\n+ */\n+void LensShadingCorrection::queueRequest(IPAContext &context,\n+\t\t\t\t\t [[maybe_unused]] const uint32_t frame,\n+\t\t\t\t\t IPAFrameContext &frameContext,\n+\t\t\t\t\t const ControlList &controls)\n+{\n+\tauto &lsc = context.activeState.lsc;\n+\n+\tconst auto &lscEnable = controls.get(controls::LensShadingCorrectionEnable);\n+\tif (lscEnable && *lscEnable != lsc.enabled) {\n+\t\tlsc.enabled = *lscEnable;\n+\n+\t\tLOG(RkISP1Lsc, Debug)\n+\t\t\t<< (*lscEnable ? \"Enabling\" : \"Disabling\") << \" Lsc\";\n+\n+\t\tframeContext.lsc.update = true;\n+\t}\n+\n+\tframeContext.lsc.enabled = lsc.enabled;\n+}\n+\n /**\n  * \\copydoc libcamera::ipa::Algorithm::prepare\n  */\n@@ -493,14 +518,25 @@ void LensShadingCorrection::prepare([[maybe_unused]] IPAContext &context,\n \tunsigned int quantizedCt = quantize(ct, kColourTemperatureChangeThreshhold);\n \tint ctDiff = static_cast<int>(ct) - static_cast<int>(lastAppliedCt_);\n \n-\tif (quantizedCt == lastAppliedQuantizedCt_)\n-\t\treturn;\n \n-\tif (std::abs(ctDiff) < kColourTemperatureChangeThreshhold)\n-\t\treturn;\n+\t/* Check if we can skip the update. */\n+\tif (!frameContext.lsc.update) {\n+\t\tif (!frameContext.lsc.enabled)\n+\t\t\treturn;\n+\n+\t\tif (quantizedCt == lastAppliedQuantizedCt_)\n+\t\t\treturn;\n+\n+\t\tif (std::abs(ctDiff) < kColourTemperatureChangeThreshhold)\n+\t\t\treturn;\n+\t}\n \n \tauto config = params->block<BlockType::Lsc>();\n-\tconfig.setEnabled(true);\n+\tconfig.setEnabled(frameContext.lsc.enabled);\n+\n+\tif (!frameContext.lsc.enabled)\n+\t\treturn;\n+\n \tsetParameters(*config);\n \n \tconst Components &set = sets_.getInterpolated(quantizedCt);\ndiff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h\nindex 3097740a6cb2ce9063a4ba087856987a489b0ab6..ff4e8d91fe87d99b6dae8d611afc23846081bcd5 100644\n--- a/src/ipa/rkisp1/algorithms/lsc.h\n+++ b/src/ipa/rkisp1/algorithms/lsc.h\n@@ -29,6 +29,9 @@ public:\n \tvoid prepare(IPAContext &context, const uint32_t frame,\n \t\t     IPAFrameContext &frameContext,\n \t\t     RkISP1Params *params) override;\n+\tvoid queueRequest(IPAContext &context, const uint32_t frame,\n+\t\t\t  IPAFrameContext &frameContext,\n+\t\t\t  const ControlList &controls) override;\n \n \tstruct Components {\n \t\tstd::vector<uint16_t> r;\ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex b257cee55379ad932b42e613f94eccbe69a939e3..fa748811be743b43ce6ee289408c054c6f9a7046 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -55,10 +55,6 @@ struct IPASessionConfiguration {\n \t\tbool supported;\n \t} compress;\n \n-\tstruct {\n-\t\tbool enabled;\n-\t} lsc;\n-\n \tstruct {\n \t\tutils::Duration minExposureTime;\n \t\tutils::Duration maxExposureTime;\n@@ -143,6 +139,10 @@ struct IPAActiveState {\n \t\tdouble gain;\n \t\tdouble strength;\n \t} wdr;\n+\n+\tstruct {\n+\t\tbool enabled;\n+\t} lsc;\n };\n \n struct IPAFrameContext : public FrameContext {\n@@ -218,6 +218,11 @@ struct IPAFrameContext : public FrameContext {\n \t\tdouble strength;\n \t\tdouble gain;\n \t} wdr;\n+\n+\tstruct {\n+\t\tbool enabled;\n+\t\tbool update;\n+\t} lsc;\n };\n \n struct IPAContext {\n",
    "prefixes": [
        "v2",
        "15/15"
    ]
}