Show a patch.

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

{
    "id": 26618,
    "url": "https://patchwork.libcamera.org/api/patches/26618/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26618/",
    "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": "<20260504182658.590233-4-mzamazal@redhat.com>",
    "date": "2026-05-04T18:26:52",
    "name": "[RFC,v4,3/7] ipa: simple: Introduce default temperature value",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "9f6d474d7f41c94e47a5f9783f3f0def59aa61e1",
    "submitter": {
        "id": 177,
        "url": "https://patchwork.libcamera.org/api/people/177/?format=api",
        "name": "Milan Zamazal",
        "email": "mzamazal@redhat.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/26618/mbox/",
    "series": [
        {
            "id": 5903,
            "url": "https://patchwork.libcamera.org/api/series/5903/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5903",
            "date": "2026-05-04T18:26:49",
            "name": "LSC for SoftISP simple pipeline",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/5903/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26618/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26618/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 E7FF6C32F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  4 May 2026 18:27:24 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8857263025;\n\tMon,  4 May 2026 20:27:24 +0200 (CEST)",
            "from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F1CF063025\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  4 May 2026 20:27:22 +0200 (CEST)",
            "from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com\n\t(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63])\n\tby relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n\tcipher=TLS_AES_256_GCM_SHA384) id us-mta-465-ZSUQ5-VRO9upOYyD71qj0A-1;\n\tMon, 04 May 2026 14:27:18 -0400",
            "from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.93])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (2048 bits)\n\tserver-digest SHA256) (No client certificate requested)\n\tby mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS id 36A20195605E; Mon,  4 May 2026 18:27:17 +0000 (UTC)",
            "from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.32.69])\n\tby mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id EC64A1800480; Mon,  4 May 2026 18:27:14 +0000 (UTC)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"jOX9oLI6\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1777919241;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=/4SRSFW2CabW6xnK7ScaXSfCdyrKnii9ObIH+MGlG4o=;\n\tb=jOX9oLI6eL4Yeg1vCqDIu/Jx0Cdyh+lOEVCvjMt9JqIjjaco6RqvS7pOEqX5Uh/jRLot6y\n\tLfsC5pDD52GwX0II3MtHHS5xeT5W/J5o5uzoAXsqz7mrgWXTrWBqtHqhR1m+JEVs7lsuQy\n\tOXIosSmEtTpUI33GpwMPOQC4HlbSO2A=",
        "X-MC-Unique": "ZSUQ5-VRO9upOYyD71qj0A-1",
        "X-Mimecast-MFC-AGG-ID": "ZSUQ5-VRO9upOYyD71qj0A_1777919237",
        "From": "Milan Zamazal <mzamazal@redhat.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Milan Zamazal <mzamazal@redhat.com>, Bryan O'Donoghue <bod.linux@nxsw.ie>,\n\tHans de Goede <johannes.goede@oss.qualcomm.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "Subject": "[RFC PATCH v4 3/7] ipa: simple: Introduce default temperature value",
        "Date": "Mon,  4 May 2026 20:26:52 +0200",
        "Message-ID": "<20260504182658.590233-4-mzamazal@redhat.com>",
        "In-Reply-To": "<20260504182658.590233-1-mzamazal@redhat.com>",
        "References": "<20260504182658.590233-1-mzamazal@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.93",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-MFC-PROC-ID": "hVZbTnd6uD2BuYUyQ_H3FpkG5AiVvk8EpM2f1q5DArk_1777919237",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "content-type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "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": "Some algorithms use interpolated values based on temperature.\nTemperature is computed in the AWB algorithm.  Technically, the AWB\nalgorithm can be disabled and then no temperature is computed.  Let's\navoid implicit assumptions and introduce a constant for a default\ntemperature value and make the temperature value optional.\n\nThis is currently used by the CCM algorithm.  It will be used also by\nthe LSC algorithm in the followup patch.\n\nThe default temperature value of 6500 is just a common value, there is\nno special reason to use this or another value.\n\nSigned-off-by: Milan Zamazal <mzamazal@redhat.com>\n---\n src/ipa/simple/algorithms/awb.cpp | 4 ++--\n src/ipa/simple/algorithms/awb.h   | 4 +++-\n src/ipa/simple/algorithms/ccm.cpp | 5 ++++-\n src/ipa/simple/ipa_context.h      | 2 +-\n 4 files changed, 10 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/src/ipa/simple/algorithms/awb.cpp b/src/ipa/simple/algorithms/awb.cpp\nindex f5c88ea6f..961126c0d 100644\n--- a/src/ipa/simple/algorithms/awb.cpp\n+++ b/src/ipa/simple/algorithms/awb.cpp\n@@ -96,11 +96,11 @@ void Awb::process(IPAContext &context,\n \n \tRGB<double> rgbGains{ { 1 / gains.r(), 1 / gains.g(), 1 / gains.b() } };\n \tcontext.activeState.awb.temperatureK = estimateCCT(rgbGains);\n-\tmetadata.set(controls::ColourTemperature, context.activeState.awb.temperatureK);\n+\tmetadata.set(controls::ColourTemperature, context.activeState.awb.temperatureK.value_or(0));\n \n \tLOG(IPASoftAwb, Debug)\n \t\t<< \"gain R/B: \" << gains << \"; temperature: \"\n-\t\t<< context.activeState.awb.temperatureK;\n+\t\t<< context.activeState.awb.temperatureK.value_or(0);\n }\n \n REGISTER_IPA_ALGORITHM(Awb, \"Awb\")\ndiff --git a/src/ipa/simple/algorithms/awb.h b/src/ipa/simple/algorithms/awb.h\nindex ad993f39c..df46baee4 100644\n--- a/src/ipa/simple/algorithms/awb.h\n+++ b/src/ipa/simple/algorithms/awb.h\n@@ -1,6 +1,6 @@\n /* SPDX-License-Identifier: LGPL-2.1-or-later */\n /*\n- * Copyright (C) 2024-2025 Red Hat Inc.\n+ * Copyright (C) 2024-2026 Red Hat Inc.\n  *\n  * Auto white balance\n  */\n@@ -13,6 +13,8 @@ namespace libcamera {\n \n namespace ipa::soft::algorithms {\n \n+constexpr unsigned int kDefaultTemperature = 6500;\n+\n class Awb : public Algorithm\n {\n public:\ndiff --git a/src/ipa/simple/algorithms/ccm.cpp b/src/ipa/simple/algorithms/ccm.cpp\nindex ace9c35dc..6f566ccdc 100644\n--- a/src/ipa/simple/algorithms/ccm.cpp\n+++ b/src/ipa/simple/algorithms/ccm.cpp\n@@ -15,6 +15,8 @@\n \n #include \"libcamera/internal/matrix.h\"\n \n+#include \"awb.h\"\n+\n namespace {\n \n constexpr unsigned int kTemperatureThreshold = 100;\n@@ -44,7 +46,8 @@ int Ccm::init([[maybe_unused]] IPAContext &context, const ValueNode &tuningData)\n void Ccm::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \t\t  IPAFrameContext &frameContext, [[maybe_unused]] DebayerParams *params)\n {\n-\tconst unsigned int ct = context.activeState.awb.temperatureK;\n+\tconst unsigned int ct =\n+\t\tcontext.activeState.awb.temperatureK.value_or(kDefaultTemperature);\n \n \t/* Change CCM only on bigger temperature changes. */\n \tif (!currentCcm_ ||\ndiff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\nindex 34f7403a4..c4bd91bb0 100644\n--- a/src/ipa/simple/ipa_context.h\n+++ b/src/ipa/simple/ipa_context.h\n@@ -50,7 +50,7 @@ struct IPAActiveState {\n \n \tstruct {\n \t\tRGB<float> gains;\n-\t\tunsigned int temperatureK;\n+\t\tstd::optional<unsigned int> temperatureK;\n \t} awb;\n \n \tMatrix<float, 3, 3> combinedMatrix;\n",
    "prefixes": [
        "RFC",
        "v4",
        "3/7"
    ]
}