Patch Detail
Show a patch.
GET /api/patches/26726/?format=api
{ "id": 26726, "url": "https://patchwork.libcamera.org/api/patches/26726/?format=api", "web_url": "https://patchwork.libcamera.org/patch/26726/", "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": "<20260512123619.120068-4-mzamazal@redhat.com>", "date": "2026-05-12T12:36:07", "name": "[RFC,v5,03/10] ipa: simple: Introduce default temperature value", "commit_ref": null, "pull_url": null, "state": "new", "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/26726/mbox/", "series": [ { "id": 5936, "url": "https://patchwork.libcamera.org/api/series/5936/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5936", "date": "2026-05-12T12:36:04", "name": "LSC for SoftISP simple pipeline", "version": 5, "mbox": "https://patchwork.libcamera.org/series/5936/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/26726/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/26726/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 E32CEBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 12 May 2026 12:36:47 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8685663030;\n\tTue, 12 May 2026 14:36:47 +0200 (CEST)", "from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EBD3463030\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 May 2026 14:36:45 +0200 (CEST)", "from mx-prod-mc-01.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-650-knNr2oPJNGC0Tw2cH2DxAQ-1;\n\tTue, 12 May 2026 08:36:41 -0400", "from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.17])\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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS id 5EA0D195609D; Tue, 12 May 2026 12:36:40 +0000 (UTC)", "from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.50.44])\n\tby mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id DC8B81955D84; Tue, 12 May 2026 12:36:37 +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=\"clN1yStH\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1778589404;\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=clN1yStHJqtyjjrZkWKglMC04EptXXd5WtsfoumGUk/bmKNANWrac6q/TTzU9+ZlI4TsBl\n\tLfrfUnVRhrL07vkQGIPeMpbuMEHPG3/Ihc4oE2ZDvKWRb2slaHbxQJWvAbkkrUwCWfnRCm\n\tjCHilL5H3rDDPXk3cGPyfB91zJuiY9w=", "X-MC-Unique": "knNr2oPJNGC0Tw2cH2DxAQ-1", "X-Mimecast-MFC-AGG-ID": "knNr2oPJNGC0Tw2cH2DxAQ_1778589400", "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 v5 03/10] ipa: simple: Introduce default temperature\n\tvalue", "Date": "Tue, 12 May 2026 14:36:07 +0200", "Message-ID": "<20260512123619.120068-4-mzamazal@redhat.com>", "In-Reply-To": "<20260512123619.120068-1-mzamazal@redhat.com>", "References": "<20260512123619.120068-1-mzamazal@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.17", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "8dqgAjfxNKNJIuzvttsWRofT2381h1EhRmKdq8cl6J4_1778589400", "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", "v5", "03/10" ] }