Patch Detail
Show a patch.
GET /api/patches/21865/?format=api
{ "id": 21865, "url": "https://patchwork.libcamera.org/api/patches/21865/?format=api", "web_url": "https://patchwork.libcamera.org/patch/21865/", "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": "<20241108094333.332643-2-mzamazal@redhat.com>", "date": "2024-11-08T09:43:31", "name": "[1/1] libcamera: software_isp: Actually apply black level from tuning data", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "bc561ae5979f617cc8f23810fecfaab90f907d42", "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/21865/mbox/", "series": [ { "id": 4782, "url": "https://patchwork.libcamera.org/api/series/4782/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4782", "date": "2024-11-08T09:43:30", "name": "libcamera: software_isp: Actually apply black level from tuning data", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4782/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/21865/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/21865/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 B5F4FBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 8 Nov 2024 09:43:50 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3846465495;\n\tFri, 8 Nov 2024 10:43:48 +0100 (CET)", "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 9BEBB60589\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 8 Nov 2024 10:43:46 +0100 (CET)", "from mx-prod-mc-05.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-320-nKShMiWHOquBwZeWrjIsIg-1;\n\tFri, 08 Nov 2024 04:43:44 -0500", "from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.40])\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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS id 5098E1955F08; Fri, 8 Nov 2024 09:43:43 +0000 (UTC)", "from nuthatch.redhat.com (unknown [10.45.225.119])\n\tby mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id C31EF1956054; Fri, 8 Nov 2024 09:43:41 +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=\"R1hPdXdE\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1731059025;\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=yOIczj8XPNkj7mIiAMKt+zFHMoycvLT9D5Qboyvd/xc=;\n\tb=R1hPdXdEpy+W0QHch19cCxnbwDVV6IKp6Ng7bU2462wv+s4gQE3Nee9jjtUiHt2hpQb/XC\n\tQXOcmFAugIUMti4R/TDbrtYYoOeqA+iaKA3Ky7nv091W0CaBBu83rgrexBNhvOTiQTFu5V\n\twDafwufyQ5Xr42BJJ+Q0KjZF4JbUHGE=", "X-MC-Unique": "nKShMiWHOquBwZeWrjIsIg-1", "X-Mimecast-MFC-AGG-ID": "nKShMiWHOquBwZeWrjIsIg", "From": "Milan Zamazal <mzamazal@redhat.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Milan Zamazal <mzamazal@redhat.com>,\n\tRobert Mader <robert.mader@collabora.com>", "Subject": "[PATCH 1/1] libcamera: software_isp: Actually apply black level from\n\ttuning data", "Date": "Fri, 8 Nov 2024 10:43:31 +0100", "Message-ID": "<20241108094333.332643-2-mzamazal@redhat.com>", "In-Reply-To": "<20241108094333.332643-1-mzamazal@redhat.com>", "References": "<20241108094333.332643-1-mzamazal@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.40", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "tiKovTFeRVY_zcX7h06moTGPgLGlTFdm18Mi5dz9ecA_1731059023", "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 b4e32fe1c..1d7d370b5 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 2cf2a8774..453123d27 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 \tuint32_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 c8ad55a21..825c06757 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": [ "1/1" ] }