Show a patch.

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

{
    "id": 26491,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/26491/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26491/",
    "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": "<20260407-kbingham-awb-split-v1-7-a39af3f4dc20@ideasonboard.com>",
    "date": "2026-04-07T22:01:10",
    "name": "[07/13] ipa: simple: Add lux algorithm to the SoftIPA",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "73c00587c58ba887f32e2658c0ecfff23ca6cedb",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/26491/mbox/",
    "series": [
        {
            "id": 5874,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5874/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5874",
            "date": "2026-04-07T22:01:03",
            "name": "ipa: simple: Convert to libipa AWB implementation",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5874/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26491/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26491/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 97132C32F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  7 Apr 2026 22:03:00 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0D9C062D4E;\n\tWed,  8 Apr 2026 00:02:53 +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 67FBA62D9C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Apr 2026 00:02:42 +0200 (CEST)",
            "from [192.168.0.204] (ams.linuxembedded.co.uk [209.38.108.23])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BA9402443;\n\tWed,  8 Apr 2026 00:01:14 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"gNsNm7zZ\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1775599274;\n\tbh=ZAvcYWuGTp2ILpHWc5OXx7gFaN9n1H2xKSndLRp6N8w=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=gNsNm7zZCcidMG0JRkB5Wg4yr+eWoVThem2hzOJWp2rIWpuLDEgQbuIR3SBbh5gQz\n\ta6SuEvQVIXIjZLhtWqTj1FY1pFWzHFH6fvfDNNpz+KTOjNupPnFnr3uCqNE336QxM1\n\tR8maoW+pniHzeK7PUw47QS/OPIaqy0iV2BvFHxa4=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "Date": "Tue, 07 Apr 2026 23:01:10 +0100",
        "Subject": "[PATCH 07/13] ipa: simple: Add lux algorithm to the SoftIPA",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "Message-Id": "<20260407-kbingham-awb-split-v1-7-a39af3f4dc20@ideasonboard.com>",
        "References": "<20260407-kbingham-awb-split-v1-0-a39af3f4dc20@ideasonboard.com>",
        "In-Reply-To": "<20260407-kbingham-awb-split-v1-0-a39af3f4dc20@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "X-Mailer": "b4 0.14.2",
        "X-Developer-Signature": "v=1; a=ed25519-sha256; t=1775599360; l=5240;\n\ti=kieran.bingham@ideasonboard.com; s=20260204;\n\th=from:subject:message-id; \n\tbh=ZAvcYWuGTp2ILpHWc5OXx7gFaN9n1H2xKSndLRp6N8w=;\n\tb=0Wa2cG+9ySiJ/oXn6dJAsufAMA2MJZSGg9F0nMRLbZ9Yaf8szKp1O3gcz0bYXalS1aTDSvfqf\n\tMOl2YliwjomDt4dfkajOGWmyUz8jcwIHwdQe4TLUlNjrsFfdFapAmZS",
        "X-Developer-Key": "i=kieran.bingham@ideasonboard.com; a=ed25519;\n\tpk=IOxS2C6nWHNjLfkDR71Iesk904i6wJDfEERqV7hDBdY=",
        "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": "Utilise the lux component of libipa to map in the lux estimate\nprocess using the yHistgram of the Soft ISP statistics.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/simple/algorithms/lux.cpp     | 93 +++++++++++++++++++++++++++++++++++\n src/ipa/simple/algorithms/lux.h       | 39 +++++++++++++++\n src/ipa/simple/algorithms/meson.build |  1 +\n src/ipa/simple/ipa_context.h          |  5 ++\n 4 files changed, 138 insertions(+)",
    "diff": "diff --git a/src/ipa/simple/algorithms/lux.cpp b/src/ipa/simple/algorithms/lux.cpp\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..03b44ac584ae141509e79954159272504cdba17d\n--- /dev/null\n+++ b/src/ipa/simple/algorithms/lux.cpp\n@@ -0,0 +1,93 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2024, Ideas On Board\n+ *\n+ * Simple Lux control\n+ */\n+\n+#include \"lux.h\"\n+\n+#include <libcamera/base/log.h>\n+\n+#include <libcamera/control_ids.h>\n+\n+#include \"libipa/histogram.h\"\n+#include \"libipa/lux.h\"\n+\n+/**\n+ * \\file lux.h\n+ */\n+\n+namespace libcamera {\n+\n+namespace ipa::soft::algorithms {\n+\n+/**\n+ * \\class Lux\n+ * \\brief SoftISP Lux control\n+ *\n+ * The Lux algorithm is responsible for estimating the lux level of the image.\n+ * It doesn't take or generate any controls, but it provides a lux level for\n+ * other algorithms (such as AGC) to use.\n+ */\n+\n+/**\n+ * \\brief Construct a SoftISP Lux algo module\n+ */\n+Lux::Lux()\n+{\n+}\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::init\n+ */\n+int Lux::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData)\n+{\n+\treturn lux_.parseTuningData(tuningData);\n+}\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::prepare\n+ */\n+void Lux::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n+\t\t  IPAFrameContext &frameContext,\n+\t\t  [[maybe_unused]] DebayerParams *params)\n+{\n+\tframeContext.lux.lux = context.activeState.lux.lux;\n+}\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::process\n+ */\n+void Lux::process(IPAContext &context,\n+\t\t  [[maybe_unused]] const uint32_t frame,\n+\t\t  IPAFrameContext &frameContext,\n+\t\t  const SwIspStats *stats,\n+\t\t  ControlList &metadata)\n+{\n+\t/*\n+\t * Report the lux level used by algorithms to prepare this frame\n+\t * not the lux level *of* this frame.\n+\t */\n+\tmetadata.set(controls::Lux, frameContext.lux.lux);\n+\n+\tif (!stats)\n+\t\treturn;\n+\n+\t/* Todo: Sensor configuration should move out of AGC */\n+\tutils::Duration exposureTime = context.configuration.agc.lineDuration *\n+\t\t\t\t       frameContext.sensor.exposure;\n+\tdouble gain = frameContext.sensor.gain;\n+\tdouble digitalGain = 1.0;\n+\n+\tHistogram yHist(stats->yHistogram);\n+\n+\tcontext.activeState.lux.lux =\n+\t\tlux_.estimateLux(exposureTime, gain, digitalGain, yHist);\n+}\n+\n+REGISTER_IPA_ALGORITHM(Lux, \"Lux\")\n+\n+} /* namespace ipa::soft::algorithms */\n+\n+} /* namespace libcamera */\ndiff --git a/src/ipa/simple/algorithms/lux.h b/src/ipa/simple/algorithms/lux.h\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..04ec4c163ede422369977017cca70d12a8d361fb\n--- /dev/null\n+++ b/src/ipa/simple/algorithms/lux.h\n@@ -0,0 +1,39 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2024, Ideas On Board\n+ *\n+ * Simple Lux control\n+ */\n+\n+#pragma once\n+\n+#include <sys/types.h>\n+\n+#include \"libipa/lux.h\"\n+\n+#include \"algorithm.h\"\n+\n+namespace libcamera {\n+\n+namespace ipa::soft::algorithms {\n+\n+class Lux : public Algorithm\n+{\n+public:\n+\tLux();\n+\n+\tint init(IPAContext &context, const YamlObject &tuningData) override;\n+\tvoid prepare(IPAContext &context, 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+\tipa::Lux lux_;\n+};\n+\n+} /* namespace ipa::soft::algorithms */\n+} /* namespace libcamera */\ndiff --git a/src/ipa/simple/algorithms/meson.build b/src/ipa/simple/algorithms/meson.build\nindex 73c63722083ff92147253c6b10440ce50743988d..27e73c9a0eea2241cc4a4cefd1594c976fb59318 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     'agc.cpp',\n     'blc.cpp',\n     'ccm.cpp',\n+    'lux.cpp',\n ])\ndiff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\nindex 8ccfacb46a59cedb5a0ad051d67f7c1f40af4b52..2bd7c4642b118d7bb94b1b16cdf4ede5fb2554b5 100644\n--- a/src/ipa/simple/ipa_context.h\n+++ b/src/ipa/simple/ipa_context.h\n@@ -17,6 +17,7 @@\n #include \"libcamera/internal/vector.h\"\n \n #include <libipa/fc_queue.h>\n+#include <libipa/lux.h>\n \n #include \"core_ipa_interface.h\"\n \n@@ -36,6 +37,8 @@ struct IPASessionConfiguration {\n };\n \n struct IPAActiveState {\n+\tipa::lux::ActiveState lux;\n+\n \tstruct {\n \t\tint32_t exposure;\n \t\tdouble again;\n@@ -64,6 +67,8 @@ struct IPAActiveState {\n };\n \n struct IPAFrameContext : public FrameContext {\n+\tipa::lux::FrameContext lux;\n+\n \tMatrix<float, 3, 3> ccm;\n \n \tstruct {\n",
    "prefixes": [
        "07/13"
    ]
}