Patch Detail
Show a patch.
GET /api/1.1/patches/21678/?format=api
{ "id": 21678, "url": "https://patchwork.libcamera.org/api/1.1/patches/21678/?format=api", "web_url": "https://patchwork.libcamera.org/patch/21678/", "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": "<20241018141241.948698-2-mzamazal@redhat.com>", "date": "2024-10-18T14:12:36", "name": "[v6,1/2] libcamera: software_isp: Get black level from the camera helper", "commit_ref": "7bbe26bbc47625dedf7703338a31bf351c560b0d", "pull_url": null, "state": "accepted", "archived": false, "hash": "22b2ead57600529908bf8e2a0a5b56db3b642c9a", "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/21678/mbox/", "series": [ { "id": 4718, "url": "https://patchwork.libcamera.org/api/1.1/series/4718/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4718", "date": "2024-10-18T14:12:35", "name": "Get black level from the camera helper", "version": 6, "mbox": "https://patchwork.libcamera.org/series/4718/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/21678/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/21678/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 5F142C32AF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Oct 2024 14:12:57 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E82DF65390;\n\tFri, 18 Oct 2024 16:12:56 +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 780A1633C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Oct 2024 16:12:54 +0200 (CEST)", "from mx-prod-mc-02.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-686-V_lvWWSvO2SrRC6jCpjZtw-1;\n\tFri, 18 Oct 2024 10:12:52 -0400", "from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.12])\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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS id E460919560A7; Fri, 18 Oct 2024 14:12:50 +0000 (UTC)", "from nuthatch.redhat.com (unknown [10.45.225.61])\n\tby mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id 995BC1955EAB; Fri, 18 Oct 2024 14:12:48 +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=\"UnedXMl6\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1729260773;\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=3hZJJLmYTWm1UwQqDZvSjDIm8JP9eB9aG7yKCReA0xc=;\n\tb=UnedXMl6hPQ2TROY4X9+YhSPn2vu3C6Rvuc+OnzWKhi7IrHUdmNd+dXM5wWe+jPG5BRCKp\n\tyj8/lglqlsCKV7B4jjaGTa/t5DwTPR2fre3yCWoeEmMF8zxUzkcHVFVKcZ9aVJnOWIcofm\n\tJj5LGRExfLVVXzgqkmZ6bCAkzifRDcs=", "X-MC-Unique": "V_lvWWSvO2SrRC6jCpjZtw-1", "From": "Milan Zamazal <mzamazal@redhat.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Milan Zamazal <mzamazal@redhat.com>,\n\tDaniel Scally <dan.scally@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tRobert Mader <robert.mader@collabora.com>", "Subject": "[PATCH v6 1/2] libcamera: software_isp: Get black level from the\n\tcamera helper", "Date": "Fri, 18 Oct 2024 16:12:36 +0200", "Message-ID": "<20241018141241.948698-2-mzamazal@redhat.com>", "In-Reply-To": "<20241018141241.948698-1-mzamazal@redhat.com>", "References": "<20241018141241.948698-1-mzamazal@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.12", "X-Mimecast-Spam-Score": "0", "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 in software ISP is unconditionally guessed from the\nobtained frames. CameraSensorHelper optionally provides the black level\nfrom camera specifications now. Let's use the value if available.\n\nIf the black level is not available from the given CameraSensorHelper\ninstance, it's still determined on the fly.\n\nSigned-off-by: Milan Zamazal <mzamazal@redhat.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nTested-by: Robert Mader <robert.mader@collabora.com>\n---\n src/ipa/simple/algorithms/blc.cpp | 6 +++++-\n src/ipa/simple/ipa_context.h | 4 ++++\n src/ipa/simple/soft_simple.cpp | 10 ++++++++++\n 3 files changed, 19 insertions(+), 1 deletion(-)", "diff": "diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp\nindex b9f2aaa6d..a7af2e12c 100644\n--- a/src/ipa/simple/algorithms/blc.cpp\n+++ b/src/ipa/simple/algorithms/blc.cpp\n@@ -24,7 +24,8 @@ BlackLevel::BlackLevel()\n int BlackLevel::configure(IPAContext &context,\n \t\t\t [[maybe_unused]] const IPAConfigInfo &configInfo)\n {\n-\tcontext.activeState.blc.level = 255;\n+\tcontext.activeState.blc.level =\n+\t\tcontext.configuration.black.level.value_or(255);\n \treturn 0;\n }\n \n@@ -34,6 +35,9 @@ void BlackLevel::process(IPAContext &context,\n \t\t\t const SwIspStats *stats,\n \t\t\t [[maybe_unused]] ControlList &metadata)\n {\n+\tif (context.configuration.black.level.has_value())\n+\t\treturn;\n+\n \tif (frameContext.sensor.exposure == exposure_ &&\n \t frameContext.sensor.gain == gain_) {\n \t\treturn;\ndiff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\nindex 3519f20f6..fd121eebe 100644\n--- a/src/ipa/simple/ipa_context.h\n+++ b/src/ipa/simple/ipa_context.h\n@@ -8,6 +8,7 @@\n #pragma once\n \n #include <array>\n+#include <optional>\n #include <stdint.h>\n \n #include <libipa/fc_queue.h>\n@@ -22,6 +23,9 @@ struct IPASessionConfiguration {\n \t\tint32_t exposureMin, exposureMax;\n \t\tdouble againMin, againMax, againMinStep;\n \t} agc;\n+\tstruct {\n+\t\tstd::optional<uint8_t> level;\n+\t} black;\n };\n \n struct IPAActiveState {\ndiff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\nindex b28c7039f..e96e65bd1 100644\n--- a/src/ipa/simple/soft_simple.cpp\n+++ b/src/ipa/simple/soft_simple.cpp\n@@ -201,6 +201,16 @@ 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 (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+\t\t\t * sensor pixel width. Hence we obtain the pixel-based black value\n+\t\t\t * by dividing the value from the helper by 256.\n+\t\t\t */\n+\t\t\tcontext_.configuration.black.level =\n+\t\t\t\tcamHelper_->blackLevel().value() / 256;\n+\t\t}\n \t} else {\n \t\t/*\n \t\t * The camera sensor gain (g) is usually not equal to the value written\n", "prefixes": [ "v6", "1/2" ] }