Show a patch.

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

{
    "id": 25961,
    "url": "https://patchwork.libcamera.org/api/patches/25961/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/25961/",
    "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": "<20260126104256.119697-4-rick.w.ten.wolde@gmail.com>",
    "date": "2026-01-26T10:42:51",
    "name": "[3/7] ipa: simple: Add LSC algorithm",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "a10f342c85be2add12262005d2a6a52f06e4fdde",
    "submitter": {
        "id": 257,
        "url": "https://patchwork.libcamera.org/api/people/257/?format=api",
        "name": "Rick ten Wolde",
        "email": "rick.w.ten.wolde@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/25961/mbox/",
    "series": [
        {
            "id": 5739,
            "url": "https://patchwork.libcamera.org/api/series/5739/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5739",
            "date": "2026-01-26T10:42:48",
            "name": "LSC for SoftISP simple pipeline",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5739/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/25961/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/25961/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 3AEA5C328D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 26 Jan 2026 10:48:15 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CF78D61FD6;\n\tMon, 26 Jan 2026 11:48:11 +0100 (CET)",
            "from mail-ej1-x634.google.com (mail-ej1-x634.google.com\n\t[IPv6:2a00:1450:4864:20::634])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 87E3061FCB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Jan 2026 11:43:05 +0100 (CET)",
            "by mail-ej1-x634.google.com with SMTP id\n\ta640c23a62f3a-b885e8c6700so504149366b.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Jan 2026 02:43:05 -0800 (PST)",
            "from castortop.wolde.loc (195-240-110-192.fixed.kpn.net.\n\t[195.240.110.192]) by smtp.gmail.com with ESMTPSA id\n\ta640c23a62f3a-b885b7661f7sm599220366b.54.2026.01.26.02.43.03\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 26 Jan 2026 02:43:03 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"UY0b3RIO\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20230601; t=1769424185; x=1770028985;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=BuGJ6GBXuA/foj3gVZf4nP7l068XJowglMv0fhOWjtQ=;\n\tb=UY0b3RIO+IG52Cg/rNTLsMTfeLbFH3aRqt/vVFGwNVftjmF+9VXAO25NHB/bD9Vp8u\n\t2uRwdLwn7UyB/gX/kp/qlUwuUN6q+43Kw/z9co4QBJOvCykTEtZEq/q29RJcM+1MhA7t\n\tkSsV5CHQaxLxXwkx4031SBSrrOU4Go5EMDKiPvCtJIYJPqWqtiAKp27v1RYehv0MlShJ\n\tBa6+x7PY2d6gwxADGbZne3wHta6DdP4Pxe3Cis9izEbEbUADnXTjSq+kiZVOW1QywCC5\n\t2hcDpMM7uAknCTA9P/zeT61RdsskCB+s0j1YbyYu766nvCxHHY1u3dJYUQsJ58/ZrT6o\n\tCRjA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1769424185; x=1770028985;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=BuGJ6GBXuA/foj3gVZf4nP7l068XJowglMv0fhOWjtQ=;\n\tb=lRCe9NcB/v9U/e4NAaqsxsePPWOxU/Zscl0DlEVSw2Bf+hZOnRWyxA9qMf5po5fnwn\n\tz0sO892g4z2WH8KUoNGqS7XeTt+zFgpA/uWSHVScI1zNDpUP6v4xBxUKY6ekX61navaq\n\tPgEZ67QyD+KDMkEGEdFQhIyvCMsUKhx5OKtcmTdqdA16Pead6ek+NLpCnbLZ9D2J1xUX\n\to4aGR2VlCkq5n193aNUQARzJ/qkdra4XJViTXjV2td/y3WCckxiF0QJyBnLqH42IpMES\n\tgNcrAL7VxCz1xakGW84MzCaVMZcFhOcLkTpFJMBytoRHZ43qiXWUuuPGDNbY7Y6V+J92\n\taHrA==",
        "X-Gm-Message-State": "AOJu0YwaJNT452I6mEjfO8jUA9CxRrmMIa/bCae6lVDM7jazVW66n6iT\n\t2FpJysO5NekQ9zhvscAXbfBwQIBOFuQHvqTOjLt8R/MY82dntavnbFvgZ2zPPw==",
        "X-Gm-Gg": "AZuq6aJVPf2s0jpI/KDssnQtbOAUwEyRQLkoa1MJH4xfdOItDmpfume4V+IkpBfOzlZ\n\twxDK59jIq1udXzAQlPLzmkP79COPkwm4UehjjVTw1BaIQgMMMqw9bfavG3rIJI5tlbZjv+fqGvQ\n\t+c7MdhsU85nX+msGhWnp7Zstfyu/Ho44TruL4UuZYC/dHsyRkb6SwswqdNXvHMivxH3jMx0gaz5\n\tVsklqVXd3Cyu5qB4t/euEGD/uNjjxgeKVB7qkuoUvgKR9JhN3rGWp801ZEVUrxW7OFcneUE7EL5\n\t8A96YjhXKwUHJu0PMnXmQMgGPIICTXqK4x9o9PBiFbBDJzMvS6tsIsQajc6vxaW7RLZAIhBOTzT\n\tm42dhxrClLMRvKyEiscW5Nnu8YAy5aI6WRTGbxrjOmD0/0oTxxsw+tQGXpxpLRikbKjKPY87BmE\n\tyEjETPUI6vwdB6kIfAT8rK5D6RSKURzp4YDWGGxNhIZv0PLrcAU+OtGTvby3Y2660=",
        "X-Received": "by 2002:a17:907:1c15:b0:b88:5957:2d65 with SMTP id\n\ta640c23a62f3a-b8d20e49d2dmr287851366b.37.1769424184303; \n\tMon, 26 Jan 2026 02:43:04 -0800 (PST)",
        "From": "Rick ten Wolde <rick.w.ten.wolde@gmail.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "xander.c.pronk@gmail.com, derekgielen@outlook.com,\n\t22012540@student.hhs.nl, \n\trick.w.ten.wolde@gmail.com, johannes.goede@oss.qualcomm.com,\n\tRick ten Wolde <rick_libcamera@wolde.info>",
        "Subject": "[PATCH 3/7] ipa: simple: Add LSC algorithm",
        "Date": "Mon, 26 Jan 2026 11:42:51 +0100",
        "Message-ID": "<20260126104256.119697-4-rick.w.ten.wolde@gmail.com>",
        "X-Mailer": "git-send-email 2.51.0",
        "In-Reply-To": "<20260126104256.119697-1-rick.w.ten.wolde@gmail.com>",
        "References": "<20260126104256.119697-1-rick.w.ten.wolde@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Mailman-Approved-At": "Mon, 26 Jan 2026 11:48:05 +0100",
        "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": "From: Xander Pronk <xander.c.pronk@gmail.com>\n\nAdd LSC algorithm module.\n\nCo-authored-by: Rick ten Wolde <rick_libcamera@wolde.info>\nSigned-off-by: Rick ten Wolde <rick_libcamera@wolde.info>\nSigned-off-by: Xander Pronk <xander.c.pronk@gmail.com>\n---\n src/ipa/simple/algorithms/lsc.cpp     | 69 +++++++++++++++++++++++++++\n src/ipa/simple/algorithms/lsc.h       | 49 +++++++++++++++++++\n src/ipa/simple/algorithms/meson.build |  1 +\n 3 files changed, 119 insertions(+)\n create mode 100644 src/ipa/simple/algorithms/lsc.cpp\n create mode 100644 src/ipa/simple/algorithms/lsc.h",
    "diff": "diff --git a/src/ipa/simple/algorithms/lsc.cpp b/src/ipa/simple/algorithms/lsc.cpp\nnew file mode 100644\nindex 00000000..95783e4e\n--- /dev/null\n+++ b/src/ipa/simple/algorithms/lsc.cpp\n@@ -0,0 +1,69 @@\n+#include \"lsc.h\"\n+\n+#include <iostream>\n+\n+#include <libcamera/base/log.h>\n+#include <libcamera/base/utils.h>\n+\n+#include <libcamera/control_ids.h>\n+\n+#include \"libcamera/internal/matrix.h\"\n+\n+\n+namespace libcamera {\n+\n+namespace ipa::soft::algorithms {\n+\n+LOG_DEFINE_CATEGORY(IPASoftLsc)\n+int Lsc::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData)\n+{\n+\tint ret_r = lsc_r.readYaml(tuningData[\"grids\"], \"ct\", \"r\");\n+\tint ret_g = lsc_r.readYaml(tuningData[\"grids\"], \"ct\", \"g\");\n+\tint ret_b = lsc_r.readYaml(tuningData[\"grids\"], \"ct\", \"b\");\n+\n+\tif (ret_r < 0 || ret_g < 0 || ret_b < 0) {\n+\t\tLOG(IPASoftLsc, Error)\n+\t\t\t<< \"Failed to parse 'lsc' parameter from tuning file.\";\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int Lsc::configure([[maybe_unused]] IPAContext &context,\n+\t\t   [[maybe_unused]] const IPAConfigInfo &configInfo)\n+{\n+\treturn 0;\n+}\n+\n+\n+void Lsc::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n+\t\t  [[maybe_unused]] IPAFrameContext &frameContext, [[maybe_unused]] DebayerParams *params)\n+{\n+\tunsigned int ct = context.activeState.awb.temperatureK;\n+\tif (ct == 0)\n+\t\tct = 2700;\n+\tconst Matrix<uint8_t, 16, 16> matrix_r = lsc_r.getInterpolated(ct);\n+\tconst Matrix<uint8_t, 16, 16> matrix_g = lsc_r.getInterpolated(ct);\n+\tconst Matrix<uint8_t, 16, 16> matrix_b = lsc_r.getInterpolated(ct);\n+\n+\tfor (unsigned long i = 0;  i < matrix_r.data().size(); ++i) {\n+\t\tparams->LSC_red[i] = matrix_r.data()[i];\n+\t\tparams->LSC_green[i] = matrix_g.data()[i];\n+\t\tparams->LSC_blue[i] = matrix_b.data()[i];\n+\t}\n+}\n+\n+void Lsc::process([[maybe_unused]] IPAContext &context,\n+\t\t  [[maybe_unused]] const uint32_t frame,\n+\t\t  [[maybe_unused]] IPAFrameContext &frameContext,\n+\t\t  [[maybe_unused]] const SwIspStats *stats,\n+\t\t  [[maybe_unused]] ControlList &metadata)\n+{\n+}\n+\n+REGISTER_IPA_ALGORITHM(Lsc, \"Lsc\")\n+\n+} /* namespace ipa::soft::algorithms */\n+\n+} /* namespace libcamera */\ndiff --git a/src/ipa/simple/algorithms/lsc.h b/src/ipa/simple/algorithms/lsc.h\nnew file mode 100644\nindex 00000000..8a3123ad\n--- /dev/null\n+++ b/src/ipa/simple/algorithms/lsc.h\n@@ -0,0 +1,49 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2024-2025, Red Hat Inc.\n+ *\n+ * Color correction matrix\n+ */\n+\n+#pragma once\n+\n+#include <optional>\n+\n+#include \"libcamera/internal/matrix.h\"\n+\n+#include <libipa/interpolator.h>\n+\n+#include \"algorithm.h\"\n+\n+namespace libcamera {\n+\n+namespace ipa::soft::algorithms {\n+\n+\n+class Lsc : public Algorithm\n+{\n+public:\n+\tLsc() = default;\n+\t~Lsc() = default;\n+\n+\tint init(IPAContext &context, const YamlObject &tuningData) override;\n+\tint configure(IPAContext &context,\n+\t\t      const IPAConfigInfo &configInfo) override;\n+\tvoid prepare(IPAContext &context,\n+\t\t     const uint32_t frame,\n+\t\t     IPAFrameContext &frameContext,\n+\t\t     DebayerParams *params) override;\n+\tvoid process(IPAContext &context, const uint32_t frame,\n+\t\t     IPAFrameContext &frameContext,\n+\t\t     const SwIspStats *stats,\n+\t\t     ControlList &metadata) override;\n+\n+private:\n+\tInterpolator<Matrix<uint8_t, 16, 16>> lsc_r;\n+\tInterpolator<Matrix<uint8_t, 16, 16>> lsc_g;\n+\tInterpolator<Matrix<uint8_t, 16, 16>> lsc_b;\n+};\n+\n+} /* namespace ipa::soft::algorithms */\n+\n+} /* namespace libcamera */\ndiff --git a/src/ipa/simple/algorithms/meson.build b/src/ipa/simple/algorithms/meson.build\nindex 2d0adb05..9cfc8030 100644\n--- a/src/ipa/simple/algorithms/meson.build\n+++ b/src/ipa/simple/algorithms/meson.build\n@@ -6,4 +6,5 @@ soft_simple_ipa_algorithms = files([\n     'blc.cpp',\n     'ccm.cpp',\n     'lut.cpp',\n+    'lsc.cpp',\n ])\n",
    "prefixes": [
        "3/7"
    ]
}