[{"id":37186,"web_url":"https://patchwork.libcamera.org/comment/37186/","msgid":"<85o6of3aju.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-12-03T14:27:33","subject":"Re: [PATCH v3 20/22] libcamera: software_isp: blacklevel: Make\n\tblack level available in debayer params","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes:\n\n> Populate black level gain in blacklevel::prepare(). A copy is made of the gain\n> value in the DebayerParams structure.\n>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n\n> ---\n>  include/libcamera/internal/software_isp/debayer_params.h | 2 ++\n>  src/ipa/simple/algorithms/blc.cpp                        | 9 +++++++++\n>  src/ipa/simple/algorithms/blc.h                          | 4 ++++\n>  src/libcamera/software_isp/debayer.cpp                   | 5 +++++\n>  4 files changed, 20 insertions(+)\n>\n> diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h\n> index 4b203e211..5a0d9438f 100644\n> --- a/include/libcamera/internal/software_isp/debayer_params.h\n> +++ b/include/libcamera/internal/software_isp/debayer_params.h\n> @@ -14,6 +14,7 @@\n>  #include <stdint.h>\n>  \n>  #include \"libcamera/internal/matrix.h\"\n> +#include \"libcamera/internal/vector.h\"\n>  \n>  namespace libcamera {\n>  \n> @@ -56,6 +57,7 @@ struct DebayerParams {\n>  \t * Per frame corrections as calculated by the IPA\n>  \t */\n>  \tMatrix<float, 3, 3> ccm;\n> +\tRGB<float> blackLevel;\n>  };\n>  \n>  } /* namespace libcamera */\n> diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp\n> index 370385afc..464e43c27 100644\n> --- a/src/ipa/simple/algorithms/blc.cpp\n> +++ b/src/ipa/simple/algorithms/blc.cpp\n> @@ -47,6 +47,15 @@ int BlackLevel::configure(IPAContext &context,\n>  \treturn 0;\n>  }\n>  \n> +void BlackLevel::prepare(IPAContext &context,\n> +\t\t\t [[maybe_unused]] const uint32_t frame,\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> +}\n> +\n>  void BlackLevel::process(IPAContext &context,\n>  \t\t\t [[maybe_unused]] const uint32_t frame,\n>  \t\t\t IPAFrameContext &frameContext,\n> diff --git a/src/ipa/simple/algorithms/blc.h b/src/ipa/simple/algorithms/blc.h\n> index db9e6d639..a5592d087 100644\n> --- a/src/ipa/simple/algorithms/blc.h\n> +++ b/src/ipa/simple/algorithms/blc.h\n> @@ -24,6 +24,10 @@ public:\n>  \n>  \tint init(IPAContext &context, const YamlObject &tuningData) override;\n>  \tint configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> +\tvoid prepare(IPAContext &context,\n> +\t\t     const uint32_t frame,\n> +\t\t     IPAFrameContext &frameContext,\n> +\t\t     DebayerParams *params) override;\n>  \tvoid process(IPAContext &context, const uint32_t frame,\n>  \t\t     IPAFrameContext &frameContext,\n>  \t\t     const SwIspStats *stats,\n> diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp\n> index f5c94bb8c..16bf7a218 100644\n> --- a/src/libcamera/software_isp/debayer.cpp\n> +++ b/src/libcamera/software_isp/debayer.cpp\n> @@ -105,6 +105,11 @@ namespace libcamera {\n>   * \\brief Per frame colour correction matrix for GPUISP\n>   */\n>  \n> +/**\n> + * \\var DebayerParams::blackLevel\n> + * \\brief Blacklevel gains for the GPUISP\n> + */\n> +\n>  /**\n>   * \\class Debayer\n>   * \\brief Base debayering class","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 18BBFBD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Dec 2025 14:27:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4EA7D609D8;\n\tWed,  3 Dec 2025 15:27:43 +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 58418609D8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Dec 2025 15:27:41 +0100 (CET)","from mail-wr1-f70.google.com (mail-wr1-f70.google.com\n\t[209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-347-rp90eGfDOBCgrThAtS6eIQ-1; Wed, 03 Dec 2025 09:27:38 -0500","by mail-wr1-f70.google.com with SMTP id\n\tffacd0b85a97d-42b2ad2a58cso3244116f8f.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 03 Dec 2025 06:27:36 -0800 (PST)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-42e1ca1a38bsm40528402f8f.24.2025.12.03.06.27.34\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 03 Dec 2025 06:27:34 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"OPY3tFnl\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1764772060;\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\tin-reply-to:in-reply-to:references:references;\n\tbh=qWm7bvDQOYaWNNg2eshK+gG7WhWzAaJVPJNk1OUbEjQ=;\n\tb=OPY3tFnlELV5S4eCi1Qyea0LfhcX/ED9xJ++6BCkqFTaSLrY4uoaLLGPsiy2z30e5MxVG3\n\tfPYY3n1v7MBiET0sZst6cFRuPsNMO1PssL1J5DK1HFXDks4N2A08toxziKMmaIB14Iub4s\n\tFLJahOifJF+ksgnKxLD8epLfZVXsSHI=","X-MC-Unique":"rp90eGfDOBCgrThAtS6eIQ-1","X-Mimecast-MFC-AGG-ID":"rp90eGfDOBCgrThAtS6eIQ_1764772056","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1764772055; x=1765376855;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject\n\t:date:message-id:reply-to;\n\tbh=qWm7bvDQOYaWNNg2eshK+gG7WhWzAaJVPJNk1OUbEjQ=;\n\tb=U8gIZ+XbmBwzQipjKMqZCwYsKIYA6ZGfO897Vg2gwnwmdQ6ocwsubzVRuwg31s2C1q\n\tXXW6Rs9vVa/1JwA5e4nCfw/PeEdTkir2KG6+eDD4xAyf0RipTh2VmKWOkfLnII8cWGpP\n\tgasdBGRbVnJzE320EzBjs2JoKoXElKtScksjiCmZtpKjG+JNtnggDTsnhHo08d3vlXdh\n\tsQhxLcHpP+0q7NHA9rrtmvVqu0YZE7dk7+ZeqIrS7muLiWrHP8HqnGZS46A9QWW9oLIq\n\tN3LdMgQ2n/Rnl/WWn1KxKF4UKZGtZxsgGqYxafOU2HGmNug093wTA1hfuDRS5bHlAw5o\n\tMo4w==","X-Gm-Message-State":"AOJu0Yy1Yb/SXb6Vhs+VcFW3ShdV4rAZ+EtdVqNVOE9aoaNGSGHWL3WN\n\tdfwgXLQy1djahCRrLB/MlNk9sLsuBTE4Dz1hitsfmmTeHaQ9OWRx4mpOsDoO13LyH7HrtZcEk4G\n\t0rP3oeuisin4mmX8Rv+33WhLPSZphgLOJPM8t7x/v64UZOvPQ4JKNi9BCmFCFAbwaimZUsPBjHz\n\tsLy8sPhUc=","X-Gm-Gg":"ASbGncs0f93P3U6zoh/raExQPDzQiZ17JkiHbvTn84gvb1Wa8VdjxOI+Y+aPNneNKy+\n\tm5YhGXl0JCi0YBe14zT/9GwrG/0dY8dBAuJJB3Q8ECS5CKekjF14wT1LVeKruABwBrcVkVSBU5x\n\tLRdS9JyWe3q/YlbfRVl/2Pk5ZW2cUdTitgfJyiagjYtGZYU5PED53X/ZNPdOfgt8i/iKPT74mkV\n\t5UigCgXsOeT6jYwN7m8G7GC/fcpr8ftOHfuAjyKDWzDlpbkcuJve4ORiZAcNVHJ2QmPUXQchB1a\n\t0ABv/W8NTkF9lo6lvp/NBfy5tApVQ2EY9I6XHvUc6xaRVdNPDunsxe7R+2IvF73cGQEZ+IaqlYH\n\t1bzsAL5pE2oHyW0QvAMP1cz/o0JWN+WMFsWRpijNQQMEEwpxq/QqSTfxS4hW1Lhs=","X-Received":["by 2002:a5d:5f43:0:b0:42b:2e1c:6341 with SMTP id\n\tffacd0b85a97d-42f73174480mr2819857f8f.9.1764772055413; \n\tWed, 03 Dec 2025 06:27:35 -0800 (PST)","by 2002:a5d:5f43:0:b0:42b:2e1c:6341 with SMTP id\n\tffacd0b85a97d-42f73174480mr2819821f8f.9.1764772055022; \n\tWed, 03 Dec 2025 06:27:35 -0800 (PST)"],"X-Google-Smtp-Source":"AGHT+IG6tU9x+j+i60SH3NlB/Dt30V2YtmzTfPdD29HhGmNxFop5qqyhyeL2bTgB1mcTdOgcoqXBaw==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","Cc":"libcamera-devel@lists.libcamera.org,  pavel@ucw.cz,  Kieran Bingham\n\t<kieran.bingham@ideasonboard.com>","Subject":"Re: [PATCH v3 20/22] libcamera: software_isp: blacklevel: Make\n\tblack level available in debayer params","In-Reply-To":"<20251202133157.661407-21-bryan.odonoghue@linaro.org> (Bryan\n\tO'Donoghue's message of \"Tue, 2 Dec 2025 13:31:51 +0000\")","References":"<20251202133157.661407-1-bryan.odonoghue@linaro.org>\n\t<20251202133157.661407-21-bryan.odonoghue@linaro.org>","Date":"Wed, 03 Dec 2025 15:27:33 +0100","Message-ID":"<85o6of3aju.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"KnrpnpBIudSQmDcXicISRMH9us5Qa8F_y2lH9Yrg9zI_1764772056","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","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>"}}]