{"id":26999,"url":"https://patchwork.libcamera.org/api/1.1/patches/26999/?format=json","web_url":"https://patchwork.libcamera.org/patch/26999/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260621-kbingham-awb-saturation-v1-3-b91ea59c6cfb@ideasonboard.com>","date":"2026-06-20T23:00:30","name":"[3/7] ipa: simple: Limit the black level value","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"98828599bb83138d17bb0cff1c107ea7a0444e5d","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/26999/mbox/","series":[{"id":6009,"url":"https://patchwork.libcamera.org/api/1.1/series/6009/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6009","date":"2026-06-20T23:00:27","name":"softisp: Fix Saturation and Black level handling","version":1,"mbox":"https://patchwork.libcamera.org/series/6009/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/26999/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/26999/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 33053C3302\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 20 Jun 2026 23:00:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 85747656FC;\n\tSun, 21 Jun 2026 01:00:41 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4739A656DE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 21 Jun 2026 01:00:36 +0200 (CEST)","from [192.168.0.240]\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 331551049;\n\tSun, 21 Jun 2026 00:59:59 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Am1Qqrew\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1781996399;\n\tbh=yNNkQomgjsnwQWfaoyVI0qozibfNlMv3i9Yw8PwVAwo=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=Am1QqrewIMMacxkxAr8NdE5WVMizI4yJGTmk+WRcS4Lem/NHxKX6FEoygdlLIMJNs\n\tw+Zh5EmgsZjVYhjGTIVn4J9dUDrAWSLHsuIFroF6Q82Hp0ES9THj+sFY3EwltGK2C3\n\tjd2YL66+474gRCkvBq3K+e2Do3H14GXqq2BTyBaw=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Date":"Sun, 21 Jun 2026 00:00:30 +0100","Subject":"[PATCH 3/7] ipa: simple: Limit the black level value","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","Message-Id":"<20260621-kbingham-awb-saturation-v1-3-b91ea59c6cfb@ideasonboard.com>","References":"<20260621-kbingham-awb-saturation-v1-0-b91ea59c6cfb@ideasonboard.com>","In-Reply-To":"<20260621-kbingham-awb-saturation-v1-0-b91ea59c6cfb@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>, \n\tMilan Zamazal <mzamazal@redhat.com>, \n\tBryan O'Donoghue <bryan.odonoghue@linaro.org>","X-Mailer":"b4 0.14.2","X-Developer-Signature":"v=1; a=ed25519-sha256; t=1781996434; l=1658;\n\ti=kieran.bingham@ideasonboard.com; s=20260204;\n\th=from:subject:message-id; \n\tbh=gmewv5noS55Y81VtEu3iVbH9ai00n6FV99WE4gKDKjQ=;\n\tb=8AAomWBRkQt327OI902Jv9DJ2Twfrw3PuKn3EOqSZ9e2/BuUdVD7DX6a9LRRW7cG9ehJbLbS1\n\tjNTFuALfVPAAKvD5jYzSydU77GamHHgqJezRbg2BsZjJWC8d91x/ojx","X-Developer-Key":"i=kieran.bingham@ideasonboard.com; a=ed25519;\n\tpk=IOxS2C6nWHNjLfkDR71Iesk904i6wJDfEERqV7hDBdY=","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":"From: Milan Zamazal <mzamazal@redhat.com>\n\nThe black level value is passed to image processing, where it's used in\npixel value computations.  To avoid troubles with weird black level\nvalues (which are mostly theoretical but we should be still safe against\ne.g. crazy values in testing tuning files) like division by zero, let's\nmake sure the black level passed to the image processing is lower than\nthe maximum pixel value.\n\nSigned-off-by: Milan Zamazal <mzamazal@redhat.com>\nReviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/simple/algorithms/blc.cpp | 7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)","diff":"diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp\nindex 677be56ed6699ae8aaa8a786ab16f7299a82eb46..058cb372620134cb15a0655d3553b3b767b47f0e 100644\n--- a/src/ipa/simple/algorithms/blc.cpp\n+++ b/src/ipa/simple/algorithms/blc.cpp\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  * Black level handling\n  */\n@@ -52,8 +52,9 @@ void BlackLevel::prepare(IPAContext &context,\n \t\t\t [[maybe_unused]] IPAFrameContext &frameContext,\n \t\t\t DebayerParams *params)\n {\n-\t/* Latch the blacklevel gain so GPUISP can apply. */\n-\tparams->blackLevel = RGB<float>(context.activeState.blc.level / 255.0f);\n+\t/* Make sure the black level is sane, i.e. below maximum pixel value. */\n+\tparams->blackLevel = RGB<float>(context.activeState.blc.level / 255.0f)\n+\t\t\t\t     .min(0.99);\n }\n \n void BlackLevel::process(IPAContext &context,\n","prefixes":["3/7"]}