Patch Detail
Show a patch.
GET /api/1.1/patches/26524/?format=api
{ "id": 26524, "url": "https://patchwork.libcamera.org/api/1.1/patches/26524/?format=api", "web_url": "https://patchwork.libcamera.org/patch/26524/", "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": "<20260420183949.110548-4-mzamazal@redhat.com>", "date": "2026-04-20T18:39:41", "name": "[RFC,v2,3/8] 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/1.1/people/177/?format=api", "name": "Milan Zamazal", "email": "mzamazal@redhat.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/26524/mbox/", "series": [ { "id": 5883, "url": "https://patchwork.libcamera.org/api/1.1/series/5883/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5883", "date": "2026-04-20T18:39:38", "name": "LSC for SoftISP simple pipeline", "version": 2, "mbox": "https://patchwork.libcamera.org/series/5883/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/26524/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/26524/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 7C642BDCBD\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Apr 2026 18:40:13 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 169A962EEC;\n\tMon, 20 Apr 2026 20:40:13 +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 BF76C62EDE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Apr 2026 20:40:07 +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-611-mYJNx_tHNUK7BsNQJkdImA-1;\n\tMon, 20 Apr 2026 14:40:05 -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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS id B673319560A7; Mon, 20 Apr 2026 18:40:04 +0000 (UTC)", "from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.48.16])\n\tby mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id E282F180047F; Mon, 20 Apr 2026 18:40:02 +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=\"V2Q2pL6z\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1776710406;\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=nT+0moHosv4tRpd4gfW9X5s1r+t8wPBaJAM2u1YjK04=;\n\tb=V2Q2pL6ztmXEeGsoXISwafWV4R0/+hQ3okhRuyO4AnAp1nm7sVcqRj6PkaHWV4o6ErRZvH\n\tAPmR90Ll58ZAm6qLuhD8X0KZEJl2TyaiLzwUTu6dHmh8lvUYjFI4g2bb6RG09I/8eCGfAl\n\tybuW69EaaUgDrW6hQhyxM/btaYa8zWA=", "X-MC-Unique": "mYJNx_tHNUK7BsNQJkdImA-1", "X-Mimecast-MFC-AGG-ID": "mYJNx_tHNUK7BsNQJkdImA_1776710404", "From": "Milan Zamazal <mzamazal@redhat.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Milan Zamazal <mzamazal@redhat.com>,\n\tHans de Goede <johannes.goede@oss.qualcomm.com>", "Subject": "[RFC PATCH v2 3/8] ipa: simple: Introduce default temperature value", "Date": "Mon, 20 Apr 2026 20:39:41 +0200", "Message-ID": "<20260420183949.110548-4-mzamazal@redhat.com>", "In-Reply-To": "<20260420183949.110548-1-mzamazal@redhat.com>", "References": "<20260420183949.110548-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": "k6fgkyyGXVJHst5wCaUYnUgxqFUB-WwC3Kn8lQgbRtI_1776710404", "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 911a5af2c..6bac45006 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 YamlObject &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", "v2", "3/8" ] }