Patch Detail
Show a patch.
GET /api/patches/22154/?format=api
{ "id": 22154, "url": "https://patchwork.libcamera.org/api/patches/22154/?format=api", "web_url": "https://patchwork.libcamera.org/patch/22154/", "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": "<20241203093814.67984-2-mzamazal@redhat.com>", "date": "2024-12-03T09:38:13", "name": "[v2,1/1] libcamera: software_isp: Actually apply black level from tuning data", "commit_ref": "2a9b0b34f8cb2295cd41a5340a9d26231dcd3e4b", "pull_url": null, "state": "accepted", "archived": false, "hash": "ccc7d3267cfc1261cf692395c7489737b9e1b632", "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/22154/mbox/", "series": [ { "id": 4839, "url": "https://patchwork.libcamera.org/api/series/4839/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4839", "date": "2024-12-03T09:38:12", "name": "libcamera: software_isp: Actually apply black level from tuning data", "version": 2, "mbox": "https://patchwork.libcamera.org/series/4839/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/22154/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/22154/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 41F28BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 3 Dec 2024 09:38:31 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ECB2466081;\n\tTue, 3 Dec 2024 10:38:30 +0100 (CET)", "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 F136E66078\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 3 Dec 2024 10:38:26 +0100 (CET)", "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-587-gbenQodLMrGimH7RN6G3bA-1;\n\tTue, 03 Dec 2024 04:38:24 -0500", "from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4])\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 60EA91955DC8; Tue, 3 Dec 2024 09:38:23 +0000 (UTC)", "from nuthatch.brq.redhat.com (unknown [10.43.17.31])\n\tby mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id 00FB230000DF; Tue, 3 Dec 2024 09:38:21 +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=\"i7sxdosm\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1733218705;\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=nOoYMUv+/30pnE+RFHHBwaFJ4WuhvSn+J09Cvm5nJSo=;\n\tb=i7sxdosmyllTq0R/RfbVXTwsvabWQXRRGjK0QfC1/cm+8MTe7LqAHgegy6VrvaXKwiAeR+\n\tkiGcAIbJSnVZOvqWXaANqF7fEBl7dUNT+nkClU0ajgI0aT7BXee5/DJh8N3qqorJmJ9tvx\n\tjKszTQBsrR0dqclsEqCQXOA04oN6FNY=", "X-MC-Unique": "gbenQodLMrGimH7RN6G3bA-1", "X-Mimecast-MFC-AGG-ID": "gbenQodLMrGimH7RN6G3bA", "From": "Milan Zamazal <mzamazal@redhat.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Milan Zamazal <mzamazal@redhat.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tRobert Mader <robert.mader@collabora.com>", "Subject": "[PATCH v2 1/1] libcamera: software_isp: Actually apply black level\n\tfrom tuning data", "Date": "Tue, 3 Dec 2024 10:38:13 +0100", "Message-ID": "<20241203093814.67984-2-mzamazal@redhat.com>", "In-Reply-To": "<20241203093814.67984-1-mzamazal@redhat.com>", "References": "<20241203093814.67984-1-mzamazal@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.4", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "GvFU0FE8T4-LDLe7c2XrqheluqW9kWS_R3-JAeoFUsg_1733218703", "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": "The black level obtained from the tuning file in software ISP is\nretrieved in init (because this is the standard algorithm method with\naccess to tuning data) and stored into context. But the context gets\nreset in configure and the black level is lost and never applied.\n\nLet's store the black level from the tuning file into an algorithm\ninstance variable and put it into the context only later in configure.\nThis is similar to what rkisp1 IPA does with the values obtained from\nthe tuning file.\n\nFixes: 41e3d61c745153779ed5a38634d7266bffd60d61 (\"libcamera: software_isp: Clear IPA context on configure and stop\")\nSigned-off-by: Milan Zamazal <mzamazal@redhat.com>\n---\n src/ipa/simple/algorithms/blc.cpp | 7 +++++--\n src/ipa/simple/algorithms/blc.h | 4 ++++\n src/ipa/simple/soft_simple.cpp | 3 +--\n 3 files changed, 10 insertions(+), 4 deletions(-)", "diff": "diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp\nindex b4e32fe1..1d7d370b 100644\n--- a/src/ipa/simple/algorithms/blc.cpp\n+++ b/src/ipa/simple/algorithms/blc.cpp\n@@ -21,7 +21,8 @@ BlackLevel::BlackLevel()\n {\n }\n \n-int BlackLevel::init(IPAContext &context, const YamlObject &tuningData)\n+int BlackLevel::init([[maybe_unused]] IPAContext &context,\n+\t\t const YamlObject &tuningData)\n {\n \tauto blackLevel = tuningData[\"blackLevel\"].get<int16_t>();\n \tif (blackLevel.has_value()) {\n@@ -29,7 +30,7 @@ int BlackLevel::init(IPAContext &context, const YamlObject &tuningData)\n \t\t * Convert 16 bit values from the tuning file to 8 bit black\n \t\t * level for the SoftISP.\n \t\t */\n-\t\tcontext.configuration.black.level = blackLevel.value() >> 8;\n+\t\tdefinedLevel_ = blackLevel.value() >> 8;\n \t}\n \treturn 0;\n }\n@@ -37,6 +38,8 @@ int BlackLevel::init(IPAContext &context, const YamlObject &tuningData)\n int BlackLevel::configure(IPAContext &context,\n \t\t\t [[maybe_unused]] const IPAConfigInfo &configInfo)\n {\n+\tif (definedLevel_.has_value())\n+\t\tcontext.configuration.black.level = definedLevel_;\n \tcontext.activeState.blc.level =\n \t\tcontext.configuration.black.level.value_or(255);\n \treturn 0;\ndiff --git a/src/ipa/simple/algorithms/blc.h b/src/ipa/simple/algorithms/blc.h\nindex 67c688ae..52d59cab 100644\n--- a/src/ipa/simple/algorithms/blc.h\n+++ b/src/ipa/simple/algorithms/blc.h\n@@ -7,6 +7,9 @@\n \n #pragma once\n \n+#include <optional>\n+#include <stdint.h>\n+\n #include \"algorithm.h\"\n \n namespace libcamera {\n@@ -29,6 +32,7 @@ public:\n private:\n \tint32_t exposure_;\n \tdouble gain_;\n+\tstd::optional<uint8_t> definedLevel_;\n };\n \n } /* namespace ipa::soft::algorithms */\ndiff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\nindex ba3d5265..e1b6d3af 100644\n--- a/src/ipa/simple/soft_simple.cpp\n+++ b/src/ipa/simple/soft_simple.cpp\n@@ -206,8 +206,7 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo)\n \t\t\t(context_.configuration.agc.againMax -\n \t\t\t context_.configuration.agc.againMin) /\n \t\t\t100.0;\n-\t\tif (!context_.configuration.black.level.has_value() &&\n-\t\t camHelper_->blackLevel().has_value()) {\n+\t\tif (camHelper_->blackLevel().has_value()) {\n \t\t\t/*\n \t\t\t * The black level from camHelper_ is a 16 bit value, software ISP\n \t\t\t * works with 8 bit pixel values, both regardless of the actual\n", "prefixes": [ "v2", "1/1" ] }