Show a patch.

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

{
    "id": 26494,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/26494/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26494/",
    "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-12-a39af3f4dc20@ideasonboard.com>",
    "date": "2026-04-07T22:01:15",
    "name": "[12/13] ipa: libipa: awb: convert to common queueRequest",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "3cd405d2cbe65aeec22a0f5d02d345f822de1584",
    "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/26494/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/26494/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26494/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 F0985C32F9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  7 Apr 2026 22:03:01 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4183562DEF;\n\tWed,  8 Apr 2026 00:02:56 +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 E79FD62DAD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Apr 2026 00:02:43 +0200 (CEST)",
            "from [192.168.0.204] (ams.linuxembedded.co.uk [209.38.108.23])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 11A151C4D;\n\tWed,  8 Apr 2026 00:01:16 +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=\"FB4iUJkg\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1775599276;\n\tbh=BEhM5gmAYP5zsWL3XAYTLQ3/oVZz6IBL19P9xUhlFLk=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=FB4iUJkg9vQU0Jl9+RQxYZ5RPT5R5fvCI2Pfs8lFUCJd+V4ugP99KXOnwYchYofEV\n\t6guYRwj8LYhhweDWcfiQKH2DlB5FLggaC+xXD/csRToIu1sT/dfVnjpTqCiYTuYZ5t\n\t1vxENm6Q5WFAxD+ynrx0uLcGSqFoXYjfUS0TJjUc=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "Date": "Tue, 07 Apr 2026 23:01:15 +0100",
        "Subject": "[PATCH 12/13] ipa: libipa: awb: convert to common queueRequest",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "Message-Id": "<20260407-kbingham-awb-split-v1-12-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=8073;\n\ti=kieran.bingham@ideasonboard.com; s=20260204;\n\th=from:subject:message-id; \n\tbh=BEhM5gmAYP5zsWL3XAYTLQ3/oVZz6IBL19P9xUhlFLk=;\n\tb=9yx8t0PgTjf80Ar8+BmoYFl9IlEx/LuUBf7dQWuHqL2mrHz9pxqfOGZAAeHmaLrlQCz0FGxBe\n\tc/cmeZbO5rZBvTaqcM4iOVl52mvyifrCYJd42Shkt7IBXrW6vDV5NFz",
        "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": "Move the now duplicated implementation for both soft IPA and rkisp1 IPA\nfor managing requests at queue time into the common libipa AWB implementation.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/libipa/awb.cpp            | 59 +++++++++++++++++++++++++++++++++++++++\n src/ipa/libipa/awb.h              |  5 ++++\n src/ipa/rkisp1/algorithms/awb.cpp | 49 ++------------------------------\n src/ipa/simple/algorithms/awb.cpp | 52 ++++------------------------------\n 4 files changed, 72 insertions(+), 93 deletions(-)",
    "diff": "diff --git a/src/ipa/libipa/awb.cpp b/src/ipa/libipa/awb.cpp\nindex d0c577958caebc0b7e24fe58506da964df2200fe..cac6b4bd206faa4f32680e16c7522685cfd30cac 100644\n--- a/src/ipa/libipa/awb.cpp\n+++ b/src/ipa/libipa/awb.cpp\n@@ -168,6 +168,65 @@ int AwbAlgorithm::configure(awb::ActiveState &state, awb::Session &session)\n \treturn 0;\n }\n \n+/**\n+ * \\brief Provide control values to the algorithm\n+ * \\param[in] state The AWB specific active state shared across frames\n+ * \\param[in] frame The frame number to apply the control values\n+ * \\param[in] frameContext The current frame's AWB specific context\n+ * \\param[in] controls The list of user controls\n+ */\n+void AwbAlgorithm::queueRequest(awb::ActiveState &state,\n+\t\t\t\t[[maybe_unused]] const uint32_t frame,\n+\t\t\t\tawb::FrameContext &frameContext,\n+\t\t\t\tconst ControlList &controls)\n+{\n+\tconst auto &awbEnable = controls.get(controls::AwbEnable);\n+\tif (awbEnable && *awbEnable != state.autoEnabled) {\n+\t\tstate.autoEnabled = *awbEnable;\n+\n+\t\tLOG(Awb, Debug)\n+\t\t\t<< (*awbEnable ? \"Enabling\" : \"Disabling\") << \" AWB\";\n+\t}\n+\n+\t/* Handle controls from subclass algo (Grey or Bayes) */\n+\thandleControls(controls);\n+\n+\tframeContext.autoEnabled = state.autoEnabled;\n+\n+\t/* Todo: Check to see if we should always parse the following controls */\n+\tif (frameContext.autoEnabled)\n+\t\treturn;\n+\n+\tconst auto &colourGains = controls.get(controls::ColourGains);\n+\tconst auto &colourTemperature = controls.get(controls::ColourTemperature);\n+\tbool update = false;\n+\tif (colourGains) {\n+\t\tstate.manual.gains.r() = (*colourGains)[0];\n+\t\tstate.manual.gains.b() = (*colourGains)[1];\n+\t\t/*\n+\t\t * \\todo Colour temperature reported in metadata is now\n+\t\t * incorrect, as we can't deduce the temperature from the gains.\n+\t\t * This will be fixed with the bayes AWB algorithm.\n+\t\t */\n+\t\tupdate = true;\n+\t} else if (colourTemperature) {\n+\t\tstate.manual.temperatureK = *colourTemperature;\n+\t\tconst auto &gains = gainsFromColourTemperature(*colourTemperature);\n+\t\tif (gains) {\n+\t\t\tstate.manual.gains.r() = gains->r();\n+\t\t\tstate.manual.gains.b() = gains->b();\n+\t\t\tupdate = true;\n+\t\t}\n+\t}\n+\n+\tif (update)\n+\t\tLOG(Awb, Debug)\n+\t\t\t<< \"Set colour gains to \" << state.manual.gains;\n+\n+\tframeContext.gains = state.manual.gains;\n+\tframeContext.temperatureK = state.manual.temperatureK;\n+}\n+\n /**\n  * \\fn AwbAlgorithm::calculateAwb()\n  * \\brief Calculate AWB data from the given statistics\ndiff --git a/src/ipa/libipa/awb.h b/src/ipa/libipa/awb.h\nindex 4ceae537686f8f4c93686fab4b9efbc06e112b1d..0256ff8ca3429288c317d3ee940255c4a5391357 100644\n--- a/src/ipa/libipa/awb.h\n+++ b/src/ipa/libipa/awb.h\n@@ -68,6 +68,11 @@ public:\n \n \tint configure(awb::ActiveState &state, awb::Session &session);\n \n+\tvoid queueRequest(awb::ActiveState &state,\n+\t\t\t  [[maybe_unused]] const uint32_t frame,\n+\t\t\t  awb::FrameContext &frameContext,\n+\t\t\t  const ControlList &controls);\n+\n \tvirtual AwbResult calculateAwb(const AwbStats &stats, unsigned int lux) = 0;\n \tvirtual std::optional<RGB<double>> gainsFromColourTemperature(double colourTemperature) = 0;\n \ndiff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\nindex 86d5dfed3e1c2bb587705f05362229db3cdadafd..b91132fc6177650b9338867359583bf5429ea7e5 100644\n--- a/src/ipa/rkisp1/algorithms/awb.cpp\n+++ b/src/ipa/rkisp1/algorithms/awb.cpp\n@@ -146,55 +146,12 @@ int Awb::configure(IPAContext &context,\n  * \\copydoc libcamera::ipa::Algorithm::queueRequest\n  */\n void Awb::queueRequest(IPAContext &context,\n-\t\t       [[maybe_unused]] const uint32_t frame,\n+\t\t       const uint32_t frame,\n \t\t       IPAFrameContext &frameContext,\n \t\t       const ControlList &controls)\n {\n-\tauto &awb = context.activeState.awb;\n-\n-\tconst auto &awbEnable = controls.get(controls::AwbEnable);\n-\tif (awbEnable && *awbEnable != awb.autoEnabled) {\n-\t\tawb.autoEnabled = *awbEnable;\n-\n-\t\tLOG(RkISP1Awb, Debug)\n-\t\t\t<< (*awbEnable ? \"Enabling\" : \"Disabling\") << \" AWB\";\n-\t}\n-\n-\tawbAlgo_->handleControls(controls);\n-\n-\tframeContext.awb.autoEnabled = awb.autoEnabled;\n-\n-\tif (awb.autoEnabled)\n-\t\treturn;\n-\n-\tconst auto &colourGains = controls.get(controls::ColourGains);\n-\tconst auto &colourTemperature = controls.get(controls::ColourTemperature);\n-\tbool update = false;\n-\tif (colourGains) {\n-\t\tawb.manual.gains.r() = (*colourGains)[0];\n-\t\tawb.manual.gains.b() = (*colourGains)[1];\n-\t\t/*\n-\t\t * \\todo Colour temperature reported in metadata is now\n-\t\t * incorrect, as we can't deduce the temperature from the gains.\n-\t\t * This will be fixed with the bayes AWB algorithm.\n-\t\t */\n-\t\tupdate = true;\n-\t} else if (colourTemperature) {\n-\t\tawb.manual.temperatureK = *colourTemperature;\n-\t\tconst auto &gains = awbAlgo_->gainsFromColourTemperature(*colourTemperature);\n-\t\tif (gains) {\n-\t\t\tawb.manual.gains.r() = gains->r();\n-\t\t\tawb.manual.gains.b() = gains->b();\n-\t\t\tupdate = true;\n-\t\t}\n-\t}\n-\n-\tif (update)\n-\t\tLOG(RkISP1Awb, Debug)\n-\t\t\t<< \"Set colour gains to \" << awb.manual.gains;\n-\n-\tframeContext.awb.gains = awb.manual.gains;\n-\tframeContext.awb.temperatureK = awb.manual.temperatureK;\n+\tawbAlgo_->queueRequest(context.activeState.awb, frame, frameContext.awb,\n+\t\t\t       controls);\n }\n \n /**\ndiff --git a/src/ipa/simple/algorithms/awb.cpp b/src/ipa/simple/algorithms/awb.cpp\nindex 230b7807075941f086911549066e39c0a04dff5c..d8516871562724fc65ffbb67161ff4fd988c4b1c 100644\n--- a/src/ipa/simple/algorithms/awb.cpp\n+++ b/src/ipa/simple/algorithms/awb.cpp\n@@ -114,55 +114,13 @@ int Awb::configure(IPAContext &context,\n  * \\copydoc libcamera::ipa::Algorithm::queueRequest\n  */\n void Awb::queueRequest(IPAContext &context,\n-\t\t       [[maybe_unused]] const uint32_t frame,\n-\t\t       [[maybe_unused]] IPAFrameContext &frameContext,\n+\t\t       const uint32_t frame,\n+\t\t       IPAFrameContext &frameContext,\n \t\t       const ControlList &controls)\n {\n-\tauto &awb = context.activeState.awb;\n-\n-\tconst auto &awbEnable = controls.get(controls::AwbEnable);\n-\tif (awbEnable && *awbEnable != awb.autoEnabled) {\n-\t\tawb.autoEnabled = *awbEnable;\n-\n-\t\tLOG(IPASoftAwb, Debug)\n-\t\t\t<< (*awbEnable ? \"Enabling\" : \"Disabling\") << \" AWB\";\n-\t}\n-\n-\tawbAlgo_->handleControls(controls);\n-\n-\tframeContext.awb.autoEnabled = awb.autoEnabled;\n-\n-\tif (awb.autoEnabled)\n-\t\treturn;\n-\n-\tconst auto &colourGains = controls.get(controls::ColourGains);\n-\tconst auto &colourTemperature = controls.get(controls::ColourTemperature);\n-\tbool update = false;\n-\tif (colourGains) {\n-\t\tawb.manual.gains.r() = (*colourGains)[0];\n-\t\tawb.manual.gains.b() = (*colourGains)[1];\n-\t\t/*\n-\t\t * \\todo Colour temperature reported in metadata is now\n-\t\t * incorrect, as we can't deduce the temperature from the gains.\n-\t\t * This will be fixed with the bayes AWB algorithm.\n-\t\t */\n-\t\tupdate = true;\n-\t} else if (colourTemperature) {\n-\t\tawb.manual.temperatureK = *colourTemperature;\n-\t\tconst auto &gains = awbAlgo_->gainsFromColourTemperature(*colourTemperature);\n-\t\tif (gains) {\n-\t\t\tawb.manual.gains.r() = gains->r();\n-\t\t\tawb.manual.gains.b() = gains->b();\n-\t\t\tupdate = true;\n-\t\t}\n-\t}\n-\n-\tif (update)\n-\t\tLOG(IPASoftAwb, Debug)\n-\t\t\t<< \"Set colour gains to \" << awb.manual.gains;\n-\n-\tframeContext.awb.gains = awb.manual.gains;\n-\tframeContext.awb.temperatureK = awb.manual.temperatureK;\n+\tawbAlgo_->queueRequest(context.activeState.awb,\n+\t\t\t       frame, frameContext.awb,\n+\t\t\t       controls);\n }\n \n void Awb::prepare(IPAContext &context,\n",
    "prefixes": [
        "12/13"
    ]
}