[{"id":37001,"web_url":"https://patchwork.libcamera.org/comment/37001/","msgid":"<85a50f9y3y.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-11-21T15:58:09","subject":"Re: [PATCH 20/22] libcamera: software_isp: blacklevel: Make black\n\tlevel 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> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n> ---\n>  .../internal/software_isp/debayer_params.h          |  6 ++++++\n>  src/ipa/simple/algorithms/blc.cpp                   | 13 +++++++++++++\n>  src/ipa/simple/algorithms/blc.h                     |  4 ++++\n>  3 files changed, 23 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 019df2048..1a319833c 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,11 @@ struct DebayerParams {\n>  \t * Per frame CCM values as calcualted by the IPA\n>  \t */\n>  \tMatrix<float, 3, 3> ccm;\t/**< Per frame colour correction matrix for GPUISP */\n> +\n> +\t/*\n> +\t * Per frame blacklevel gains calculated by the IPA\n> +\t */\n> +\tRGB<float> blackLevel;\t\t/**< Blacklevel gains for GPUISP */\n\n/**< Blacklevel ... -> /* Blacklevel ...\n\nSimilarly above for ccm in the corresponding patch.\n\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..4569ded48 100644\n> --- a/src/ipa/simple/algorithms/blc.cpp\n> +++ b/src/ipa/simple/algorithms/blc.cpp\n> @@ -47,6 +47,19 @@ 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> +\tconst std::array<float, 3> blackLevel { context.activeState.blc.level / 255.0f,\n> +\t\t\t\t\t\tcontext.activeState.blc.level / 255.0f,\n> +\t\t\t\t\t\tcontext.activeState.blc.level / 255.0f };\n> +\n> +\t/* Latch the blacklevel gain so GPUISP can apply. */\n> +\tparams->blackLevel = RGB<float>(blackLevel);\n\nWould something like the following work?\n\n  params->blackLevel = RGB<float>{ context.activeState.blc.level / 255.0f };\n\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,","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 822A6C3335\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 21 Nov 2025 15:58:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C04E360A81;\n\tFri, 21 Nov 2025 16:58:16 +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 5796160805\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Nov 2025 16:58:15 +0100 (CET)","from mail-wr1-f69.google.com (mail-wr1-f69.google.com\n\t[209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-582-0WDzZqcnMRarSiE8NGxa1A-1; Fri, 21 Nov 2025 10:58:12 -0500","by mail-wr1-f69.google.com with SMTP id\n\tffacd0b85a97d-42b2c8fb84fso1223010f8f.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Nov 2025 07:58:12 -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-42cb7fd8c47sm12334344f8f.38.2025.11.21.07.58.10\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 21 Nov 2025 07:58:10 -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=\"cmY8RV+2\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1763740694;\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=ymW/Qyl45FbFAzNohb2D9GweVRNgjDWvQ/wgcoT3/zk=;\n\tb=cmY8RV+2j7XRQCJab2AsxuewxyLvuUGLrOlKpNKjqd+UFPirLkSh4NzAK/kruRkK3byBLC\n\tv0mM/A6TftNgFtcbzC5Ky32ll7uh7tYHgACkX6WGFVOBO0radmEApL69TuV+ou2s+fVFBE\n\tlJI6OZBQTaN28jATaZgA+eLSlK+9vas=","X-MC-Unique":"0WDzZqcnMRarSiE8NGxa1A-1","X-Mimecast-MFC-AGG-ID":"0WDzZqcnMRarSiE8NGxa1A_1763740692","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1763740691; x=1764345491;\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=ymW/Qyl45FbFAzNohb2D9GweVRNgjDWvQ/wgcoT3/zk=;\n\tb=rSFeNZZEm+vMeNkBL0j4TCSa5kCiKH41l/SQXYGnOpzc0kdTTLwjIMQDo0XgugjMVU\n\tUYGDCBtoMtVNu5NX/+RwzQuQr5wuIYriBwFR407zJRJQ5Vr9ZG82ubOHtNNOUONR88VM\n\tIDi3fh7BfUcGqWrRMht6vXAKJ4trCBSp+S6AtJwJyb3YhYTTl6U/yyBrJH6kRYP2aFpo\n\trPla7u3Mk17dsR31bnfvOVibceB+JrrpNMmdXV34ufWlPT1PI68CxpZyMhPDAKnhVty0\n\tOkAWt073YvJYpC4tXgwntDre2J9dYAo0pXfjmPKBjoVcBvhc+RZfpZZC+DbpVg4+sMhA\n\tV3Wg==","X-Gm-Message-State":"AOJu0YxHNA7bAmd/k9UOZfZ9Y2jTR1OheX9jq8WEQix3xwRcvuI/Z7SK\n\tf4O5iLyWOhwNucrvMizdgeAR9OcJ+pDZZMbUWVlSnfA9n7t4N3cOQP2zAI967R01zq1bkOzqYrF\n\tzUBqw9M9BTQ1BYQP59Q1uMwU2k8d8cB8VqTiRoRUE0/E+OC57GHEyAtkDNr83jtZ1jnWYDOpBDh\n\txVJA+zWNw=","X-Gm-Gg":"ASbGncss5n2gYqIG6gVW64sjSGhDvOLZXGAI7ckIetyWlPkgt7rYzug3fIuUO7SEbR+\n\t6nziBQtzmOudW/xc7L+y7a1UCZxfPLhn2bpWtpqDsrnWBMdF0sK4aH8Ax1+XRXCXk9NcUkiKtOM\n\txo8t8CTeKL41EaK+2HI2PtfTu4mXmW4UMIFgsJPYu69+APTH/pSMiW19wHNktvbj3YeLIuqikmE\n\tPhsG7x5yjqT8+6ut5HjzIJq6VEK3dIAnUH3i5hKuSw7cJ9s9WY8qsTb4Fr2hlpdzsBkzVdvdE49\n\tWJBh8lTrlzZYWyPH+UnJ7xPhWgf1R5zlN+wNsfv8HYZ9lt9hMD91iFW1A7AMEzKSaYNEdoo4y02\n\t96TTCzp1MyszBtsCK/qi9VH5jV65KDeX0MzUlCCmB+rIABalw9xGQNiLSH+l1f3s=","X-Received":["by 2002:a05:6000:26ca:b0:42c:b8fd:21b4 with SMTP id\n\tffacd0b85a97d-42cc1d2111dmr3205808f8f.57.1763740691335; \n\tFri, 21 Nov 2025 07:58:11 -0800 (PST)","by 2002:a05:6000:26ca:b0:42c:b8fd:21b4 with SMTP id\n\tffacd0b85a97d-42cc1d2111dmr3205787f8f.57.1763740690935; \n\tFri, 21 Nov 2025 07:58:10 -0800 (PST)"],"X-Google-Smtp-Source":"AGHT+IGx96RnrvLbm/EOBMnGOuI53XNKrL+sncE1L/lSR7BnEDa/ylm0jFV9hW1L8tqaQIQ1FYNSgQ==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","Cc":"libcamera-devel@lists.libcamera.org,  pavel@ucw.cz","Subject":"Re: [PATCH 20/22] libcamera: software_isp: blacklevel: Make black\n\tlevel available in debayer params","In-Reply-To":"<20251120232019.3590-21-bryan.odonoghue@linaro.org> (Bryan\n\tO'Donoghue's message of \"Thu, 20 Nov 2025 23:20:17 +0000\")","References":"<20251120232019.3590-1-bryan.odonoghue@linaro.org>\n\t<20251120232019.3590-21-bryan.odonoghue@linaro.org>","Date":"Fri, 21 Nov 2025 16:58:09 +0100","Message-ID":"<85a50f9y3y.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":"BCvXCDVNqjBsg7zQ0vPnNmzsk3JFxcsv0ItD_SmCS48_1763740692","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>"}}]