[{"id":38170,"web_url":"https://patchwork.libcamera.org/comment/38170/","msgid":"<2a275fb1-ac57-4338-9ff4-4d0b6eb81705@linaro.org>","date":"2026-02-11T13:26:49","subject":"Re: [PATCH 1/2] ipa: simple: Limit the black level value","submitter":{"id":175,"url":"https://patchwork.libcamera.org/api/people/175/","name":"Bryan O'Donoghue","email":"bryan.odonoghue@linaro.org"},"content":"On 11/02/2026 13:17, Milan Zamazal wrote:\n> The black level value is passed to image processing, where it's used in\n> pixel value computations.  To avoid troubles with weird black level\n> values (which are mostly theoretical but we should be still safe against\n> e.g. crazy values in testing tuning files) like division by zero, let's\n> make sure the black level passed to the image processing is lower than\n> the maximum pixel value.\n> \n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> ---\n>   src/ipa/simple/algorithms/blc.cpp | 7 ++++---\n>   1 file changed, 4 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp\n> index 464e43c27..b318d0354 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,\nReviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>","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 CE6E2BD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 11 Feb 2026 13:26:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2D42B621AB;\n\tWed, 11 Feb 2026 14:26:55 +0100 (CET)","from mail-wr1-x429.google.com (mail-wr1-x429.google.com\n\t[IPv6:2a00:1450:4864:20::429])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1FC77620C9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 11 Feb 2026 14:26:53 +0100 (CET)","by mail-wr1-x429.google.com with SMTP id\n\tffacd0b85a97d-4362507f396so1734290f8f.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 11 Feb 2026 05:26:53 -0800 (PST)","from [192.168.0.40] (188-141-3-146.dynamic.upc.ie. [188.141.3.146])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-43783e5c93asm4052434f8f.39.2026.02.11.05.26.50\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tWed, 11 Feb 2026 05:26:52 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"vhb88JZd\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1770816412; x=1771421212;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:in-reply-to:content-language:from\n\t:references:cc:to:subject:user-agent:mime-version:date:message-id\n\t:from:to:cc:subject:date:message-id:reply-to;\n\tbh=sqDEfBBexEw1fr1mndljL34mcDJauC6i/ia7hRzMdLQ=;\n\tb=vhb88JZdto67K5D/b9JEgjq5v7uFE0BeZgVjv5OpJhRAAM7AKaMnwCfcsR39TPod67\n\t52ygRM+MHiX7XzNHDvLuewD3/4jAH+TNz8tP2FjkFJV6xk2kGZbO4VddAO7crhhBr5Nf\n\t8x5eazaq+0VyK+XyZChZH0ygsol/tU/3bV8EBPNLcEflJlLpJMRxNP6svwVJ9TSh5UQm\n\tFxZAZrwQHXYzzsVN138gLEDQZOG13oUQtQSvdEdlGXkI0EPDrSfh+WQJcgvzUUSIo1Ls\n\tvJv3qmXzvJOB/JgnywL7d0kp8w8nDCw9bQKr+M6v4FAKY2UozlCdTA97u0P+8JACJKTf\n\t6//w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1770816412; x=1771421212;\n\th=content-transfer-encoding:in-reply-to:content-language:from\n\t:references:cc:to:subject:user-agent:mime-version:date:message-id\n\t:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=sqDEfBBexEw1fr1mndljL34mcDJauC6i/ia7hRzMdLQ=;\n\tb=J6J/ICEDVka+Goba07ivGybE48ETaB34uTLZNoa8X9w0n+KNBeyngbnfSGglM26NAL\n\tZuC00I/rLroU1+mBfiD/Cwsrjw8cQXprMYpC2ue/BVTn9JZqo0iMGFTk9co3DG96XDZf\n\te9H/AOzBcG0Ux0aiQnICEDAf1mn5USa8taxpO6v1VTCWUZJ3rlpnT71GQRcqxrkb3agG\n\tjMMtyU96kJA4YIqFort5NSykqncxbXMS7/5NkLqanbJy61rjgLc6AvVN8Tc0YzolJ5uH\n\tddchIsyivuDWpU8wV9qcRdrelTWpuSRaThgj+ADPKF5dDlEPDl4VZSTHfZMVHYlnuju5\n\t3nWA==","X-Forwarded-Encrypted":"i=1;\n\tAJvYcCXhbSrcO38r6XEiTMvgeB88CLwjg0I+FLD8h6lCaU8BD/yTlFhTmW3J/DLWID/M1P5J/t0CGti6pWoBLtVCKPo=@lists.libcamera.org","X-Gm-Message-State":"AOJu0Yx/aHFCXoD/G5Tz4niJm8puoQHlfWQ5qlXsOBbXVqBY879a03aL\n\tGeaF+jTSVXFW2JHRqJGUSkQUlsuN3rf4wDu3+iFgvRYJfRFAgI0Lz59rqzQVY1m//Y3M1yV7WSr\n\tlFZzj/sg=","X-Gm-Gg":"AZuq6aLeGId7XzbYiTo2+/hlXSQEsqV0kGMLvTCnz61CDi52kEHgllembTCu1J6OcKd\n\tMF1rRMYf/2zg2+H5Pg/gTmxMsLp3agQk1oHdcfa2W/RiiGO0JdmHBD5aeYaWEKzw65bdxkG4CGo\n\tbY85kqxa9F+yxWRd/4Oh/dYp9V1oKEfl3ziUVibDcp0pr2d6QT2o0dzHJIvNRtJixfCRMMC1BJN\n\t//WzSyHFb8JiqoVTB2DibaLjMbMz/6GZdShbqKxgzqDtnqhjv0Bd6L6liG9UO63lGhGZmNTBgC3\n\tZKsMdazgmlYttqWyylYzZH5wnGbSthurnH4e3RD8uajwnDUEBS2O047stdKST0XqwFTI62zjasK\n\tZ5JOOYNwBO8e0oVy7y5CEXt8SwxV4gsKoBPmLlHvisduD0GC/jtQ8vAYhiridY/xybvj5onrqP9\n\tZhQ+SaUo2/Tniv3Njh5ItZzw9z5mhdMU4Gq8w7qVesqYkUEN089PXg/P4SksVRm9Zd9Ewl+v/T8\n\txY=","X-Received":"by 2002:a05:6000:2583:b0:437:6c41:e10e with SMTP id\n\tffacd0b85a97d-4376c41e25dmr16932225f8f.32.1770816412467; \n\tWed, 11 Feb 2026 05:26:52 -0800 (PST)","Message-ID":"<2a275fb1-ac57-4338-9ff4-4d0b6eb81705@linaro.org>","Date":"Wed, 11 Feb 2026 13:26:49 +0000","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 1/2] ipa: simple: Limit the black level value","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>","References":"<20260211131728.96413-1-mzamazal@redhat.com>\n\t<20260211131728.96413-2-mzamazal@redhat.com>","From":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","Content-Language":"en-US","In-Reply-To":"<20260211131728.96413-2-mzamazal@redhat.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>"}}]