[{"id":31792,"web_url":"https://patchwork.libcamera.org/comment/31792/","msgid":"<172925912986.877857.17938188962142335045@ping.linuxembedded.co.uk>","date":"2024-10-18T13:45:29","subject":"Re: [PATCH v5 2/2] libcamera: software_isp: Black level from tuning\n\tfile","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Milan Zamazal (2024-10-18 10:26:28)\n> This patch allows obtaining a black level from a tuning file in addition\n> to the camera sensor helper.  If both of them define a black level, the\n> one from the tuning file takes precedence.\n> \n> The use cases are:\n> \n> - A user wants to use a different black level, for whatever reason.\n> \n> - There is a sensor without known gains but with a known black level.\n>   Because a camera sensor helper cannot be defined without specifying\n>   gains, the only way to specify the black level is using the tuning\n>   file.  Software ISP uses its fallback gain handling in such a case.\n> \n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> ---\n>  src/ipa/simple/algorithms/blc.cpp | 9 +++++++++\n>  src/ipa/simple/algorithms/blc.h   | 1 +\n>  src/ipa/simple/soft_simple.cpp    | 3 ++-\n>  3 files changed, 12 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp\n> index a7af2e12c..8516c4335 100644\n> --- a/src/ipa/simple/algorithms/blc.cpp\n> +++ b/src/ipa/simple/algorithms/blc.cpp\n> @@ -21,11 +21,20 @@ BlackLevel::BlackLevel()\n>  {\n>  }\n>  \n> +int BlackLevel::init(IPAContext &context, const YamlObject &tuningData)\n> +{\n> +       auto blackLevel = tuningData[\"blackLevel\"].get<int16_t>();\n> +       if (blackLevel.has_value())\n> +               context.configuration.black.level = blackLevel.value() / 256;\n\nIt's not essential - but for converting between bit depths - I would\nthink using bit shifting would be clearer (keep this however you prefer\nthough).\n\n\t/*\n\t * Convert 16 bit values from the tuning file to 8 bit black\n\t * level for the SoftISP.\n\t */\n\t.... = blackLevel.value() >> 8;\n\nmight be more clear than\n\t.... = blackLevel.value() / 256;\n\n> +       return 0;\n> +}\n> +\n>  int BlackLevel::configure(IPAContext &context,\n>                           [[maybe_unused]] const IPAConfigInfo &configInfo)\n>  {\n>         context.activeState.blc.level =\n>                 context.configuration.black.level.value_or(255);\n> +       LOG(IPASoftBL, Info) << \"pdm: blll: \" << context.activeState.blc.level;\n\nWhat's pdm: blll? Should this be removed? or changed to be Debug level ?\n\n\nFor the update itself with those handled, I think having the Tuning File\nable to specify the black level is helpful:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n>         return 0;\n>  }\n>  \n> diff --git a/src/ipa/simple/algorithms/blc.h b/src/ipa/simple/algorithms/blc.h\n> index 828ad8b18..2cf2a8774 100644\n> --- a/src/ipa/simple/algorithms/blc.h\n> +++ b/src/ipa/simple/algorithms/blc.h\n> @@ -19,6 +19,7 @@ public:\n>         BlackLevel();\n>         ~BlackLevel() = default;\n>  \n> +       int init(IPAContext &context, const YamlObject &tuningData) override;\n>         int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n>         void process(IPAContext &context, const uint32_t frame,\n>                      IPAFrameContext &frameContext,\n> diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\n> index e96e65bd1..03525b2f2 100644\n> --- a/src/ipa/simple/soft_simple.cpp\n> +++ b/src/ipa/simple/soft_simple.cpp\n> @@ -201,7 +201,8 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo)\n>                         (context_.configuration.agc.againMax -\n>                          context_.configuration.agc.againMin) /\n>                         100.0;\n> -               if (camHelper_->blackLevel().has_value()) {\n> +               if (!context_.configuration.black.level.has_value() &&\n> +                   camHelper_->blackLevel().has_value()) {\n>                         /*\n>                          * The black level from camHelper_ is a 16 bit value, software ISP\n>                          * works with 8 bit pixel values, both regardless of the actual\n> -- \n> 2.44.1\n>","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 51EFDC32FE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Oct 2024 13:45:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 306FD6538A;\n\tFri, 18 Oct 2024 15:45:34 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 004C6633C6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Oct 2024 15:45:32 +0200 (CEST)","from pendragon.ideasonboard.com\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 F3E8521C;\n\tFri, 18 Oct 2024 15:43:48 +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=\"GMl95bf3\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1729259029;\n\tbh=SKjJ/WIAaIgBfW55cVVzyhTpjvtaVpvC4UlISa9csUE=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=GMl95bf3cLx6hahCV1ji6BxX7IVVDP3nj4+MzCwwrgRP69IjJkRBuAW8HJm/R+Jc3\n\tVN73GMUZuj0zXh4x1StEN92xkxNr5uqLmpa9SvoH+8TUt7K/rj7GSxGtsokXXY3WFs\n\tHi6sXBxxpCD2JZh+CrAhUkaaNOcP8mt/5oiO17i0=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20241018092628.293586-3-mzamazal@redhat.com>","References":"<20241018092628.293586-1-mzamazal@redhat.com>\n\t<20241018092628.293586-3-mzamazal@redhat.com>","Subject":"Re: [PATCH v5 2/2] libcamera: software_isp: Black level from tuning\n\tfile","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Milan Zamazal <mzamazal@redhat.com>,\n\tDaniel Scally <dan.scally@ideasonboard.com>,\n\tRobert Mader <robert.mader@collabora.com>","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Date":"Fri, 18 Oct 2024 14:45:29 +0100","Message-ID":"<172925912986.877857.17938188962142335045@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>"}},{"id":31793,"web_url":"https://patchwork.libcamera.org/comment/31793/","msgid":"<87bjzhqzjl.fsf@redhat.com>","date":"2024-10-18T14:02:54","subject":"Re: [PATCH v5 2/2] libcamera: software_isp: Black level from tuning\n\tfile","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Kieran,\n\nthank you for review.\n\nKieran Bingham <kieran.bingham@ideasonboard.com> writes:\n\n> Quoting Milan Zamazal (2024-10-18 10:26:28)\n>> This patch allows obtaining a black level from a tuning file in addition\n>> to the camera sensor helper.  If both of them define a black level, the\n>\n>> one from the tuning file takes precedence.\n>> \n>> The use cases are:\n>> \n>> - A user wants to use a different black level, for whatever reason.\n>> \n>> - There is a sensor without known gains but with a known black level.\n>>   Because a camera sensor helper cannot be defined without specifying\n>>   gains, the only way to specify the black level is using the tuning\n>>   file.  Software ISP uses its fallback gain handling in such a case.\n>> \n>> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n>> ---\n>>  src/ipa/simple/algorithms/blc.cpp | 9 +++++++++\n>>  src/ipa/simple/algorithms/blc.h   | 1 +\n>>  src/ipa/simple/soft_simple.cpp    | 3 ++-\n>>  3 files changed, 12 insertions(+), 1 deletion(-)\n>> \n>> diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp\n>> index a7af2e12c..8516c4335 100644\n>> --- a/src/ipa/simple/algorithms/blc.cpp\n>> +++ b/src/ipa/simple/algorithms/blc.cpp\n>> @@ -21,11 +21,20 @@ BlackLevel::BlackLevel()\n>>  {\n>>  }\n>>  \n>> +int BlackLevel::init(IPAContext &context, const YamlObject &tuningData)\n>> +{\n>> +       auto blackLevel = tuningData[\"blackLevel\"].get<int16_t>();\n>> +       if (blackLevel.has_value())\n>> +               context.configuration.black.level = blackLevel.value() / 256;\n>\n> It's not essential - but for converting between bit depths - I would\n> think using bit shifting would be clearer (keep this however you prefer\n> though).\n>\n> \t/*\n> \t * Convert 16 bit values from the tuning file to 8 bit black\n> \t * level for the SoftISP.\n> \t */\n> \t.... = blackLevel.value() >> 8;\n>\n> might be more clear than\n> \t.... = blackLevel.value() / 256;\n\nOK.\n\n>> +       return 0;\n>> +}\n>> +\n>>  int BlackLevel::configure(IPAContext &context,\n>>                           [[maybe_unused]] const IPAConfigInfo &configInfo)\n>>  {\n>>         context.activeState.blc.level =\n>>                 context.configuration.black.level.value_or(255);\n>> +       LOG(IPASoftBL, Info) << \"pdm: blll: \" << context.activeState.blc.level;\n>\n> What's pdm: blll? Should this be removed? or changed to be Debug level ?\n\nA forgotten statement for checking the value, should be removed.\n\n> For the update itself with those handled, I think having the Tuning File\n> able to specify the black level is helpful:\n>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>\n>>         return 0;\n>>  }\n>>  \n>> diff --git a/src/ipa/simple/algorithms/blc.h b/src/ipa/simple/algorithms/blc.h\n>> index 828ad8b18..2cf2a8774 100644\n>> --- a/src/ipa/simple/algorithms/blc.h\n>> +++ b/src/ipa/simple/algorithms/blc.h\n>> @@ -19,6 +19,7 @@ public:\n>>         BlackLevel();\n>>         ~BlackLevel() = default;\n>>  \n>> +       int init(IPAContext &context, const YamlObject &tuningData) override;\n>>         int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n>>         void process(IPAContext &context, const uint32_t frame,\n>>                      IPAFrameContext &frameContext,\n>> diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\n>> index e96e65bd1..03525b2f2 100644\n>> --- a/src/ipa/simple/soft_simple.cpp\n>> +++ b/src/ipa/simple/soft_simple.cpp\n>> @@ -201,7 +201,8 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo)\n>>                         (context_.configuration.agc.againMax -\n>>                          context_.configuration.agc.againMin) /\n>>                         100.0;\n>> -               if (camHelper_->blackLevel().has_value()) {\n>> +               if (!context_.configuration.black.level.has_value() &&\n>> +                   camHelper_->blackLevel().has_value()) {\n>>                         /*\n>>                          * The black level from camHelper_ is a 16 bit value, software ISP\n>>                          * works with 8 bit pixel values, both regardless of the actual\n>> -- \n>> 2.44.1\n>>","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 AC5A7C32AF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Oct 2024 14:03:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 572866538A;\n\tFri, 18 Oct 2024 16:03:03 +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 E6C38633C6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Oct 2024 16:03:00 +0200 (CEST)","from mail-wm1-f69.google.com (mail-wm1-f69.google.com\n\t[209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-52-KxHod76KP--UkrV318ZK0A-1; Fri, 18 Oct 2024 10:02:58 -0400","by mail-wm1-f69.google.com with SMTP id\n\t5b1f17b1804b1-431518ae047so15509905e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Oct 2024 07:02:58 -0700 (PDT)","from nuthatch (ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-37ecf027c54sm2026349f8f.14.2024.10.18.07.02.55\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 18 Oct 2024 07:02:55 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"XpnRw19J\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1729260179;\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=/bEZdftVVszz7yTpgyi/ZiNd6g3A9CH9t0BCSUbYL04=;\n\tb=XpnRw19J7ekK85LD3yveJoyj7dS3BkBxdW5do8MJ6GnXyTw7dFrl6aLmYP/Fu6sDE36Eox\n\tsok3I1omorg6GpbLEr2K2pdmNqGTWLOHqegl3lyjvG3DxagNf5Tx1NMu9ghgLzCb4NvnOj\n\tpsYDjzfqfXHLf0RWenFKIBMjVay96k0=","X-MC-Unique":"KxHod76KP--UkrV318ZK0A-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1729260177; x=1729864977;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=/bEZdftVVszz7yTpgyi/ZiNd6g3A9CH9t0BCSUbYL04=;\n\tb=pY3vdJa1xQ3isnwCWEno2ijwWHAEflY7OBZajapz1VgUgLHN0qeWUeUtc5k2mrNpep\n\tp5ejdjBSgQShb3VommJj57NwBxPCSFTBWFnwuNSMCjhZz0c6cdYQnZXjMtOyp0l8Qjsa\n\tCaBYR9B0co9ZkYbAsztofUiUc7Q2G5nizdT6Njbt6U30bNepZwOZLGJi4SdlS51edEBs\n\tDsqyLCzEqAyfxuL/zOmCjMZPdgrmVO2svE1du6KTr9dSWWR6E7jmDEO/RcC5qn7JzVX/\n\tcVwAQxmT/wNHaO5It+gL4gH3eU/VmymuXgTO2jQfgnwimvDagqmjYa9Jx/qf65zAuO3q\n\t40pg==","X-Gm-Message-State":"AOJu0YwW+Z7MIlS5O/Fz890qU0tIInZl4xVIWv9vriQXoC/tiDD8VDPN\n\tHea5CDpLR44NNDJW7oVub7YjRyogEA7a3niUYRR8dXI7mMPjeilnVwqXhYePPfFA1kJJZmhGCSN\n\t/nnxrc3R5ggo2ySbYbmhAQcNyElCxVDJCzUXVTJChPSQmP1Uh9hTSmbzt4nUgzppcx0Vk7Ns=","X-Received":["by 2002:adf:f64c:0:b0:37d:2d6f:3284 with SMTP id\n\tffacd0b85a97d-37ecef82e20mr1542673f8f.9.1729260177007; \n\tFri, 18 Oct 2024 07:02:57 -0700 (PDT)","by 2002:adf:f64c:0:b0:37d:2d6f:3284 with SMTP id\n\tffacd0b85a97d-37ecef82e20mr1542600f8f.9.1729260176341; \n\tFri, 18 Oct 2024 07:02:56 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IEzXwe5zqeg7yml633duBg0PABo3myv7PH+31V0BfNZ8NggFJGx2wnHmVqKl3WHsI4VGoyGNQ==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,  Daniel Scally\n\t<dan.scally@ideasonboard.com>, Robert Mader <robert.mader@collabora.com>","Subject":"Re: [PATCH v5 2/2] libcamera: software_isp: Black level from tuning\n\tfile","In-Reply-To":"<172925912986.877857.17938188962142335045@ping.linuxembedded.co.uk>\n\t(Kieran Bingham's message of \"Fri, 18 Oct 2024 14:45:29 +0100\")","References":"<20241018092628.293586-1-mzamazal@redhat.com>\n\t<20241018092628.293586-3-mzamazal@redhat.com>\n\t<172925912986.877857.17938188962142335045@ping.linuxembedded.co.uk>","Date":"Fri, 18 Oct 2024 16:02:54 +0200","Message-ID":"<87bjzhqzjl.fsf@redhat.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","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>"}},{"id":31794,"web_url":"https://patchwork.libcamera.org/comment/31794/","msgid":"<172926038694.877857.4882614312035355346@ping.linuxembedded.co.uk>","date":"2024-10-18T14:06:26","subject":"Re: [PATCH v5 2/2] libcamera: software_isp: Black level from tuning\n\tfile","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Milan Zamazal (2024-10-18 15:02:54)\n> Hi Kieran,\n> \n> thank you for review.\n> \n> Kieran Bingham <kieran.bingham@ideasonboard.com> writes:\n> \n> > Quoting Milan Zamazal (2024-10-18 10:26:28)\n> >> This patch allows obtaining a black level from a tuning file in addition\n> >> to the camera sensor helper.  If both of them define a black level, the\n> >\n> >> one from the tuning file takes precedence.\n> >> \n> >> The use cases are:\n> >> \n> >> - A user wants to use a different black level, for whatever reason.\n> >> \n> >> - There is a sensor without known gains but with a known black level.\n> >>   Because a camera sensor helper cannot be defined without specifying\n> >>   gains, the only way to specify the black level is using the tuning\n> >>   file.  Software ISP uses its fallback gain handling in such a case.\n> >> \n> >> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> >> ---\n> >>  src/ipa/simple/algorithms/blc.cpp | 9 +++++++++\n> >>  src/ipa/simple/algorithms/blc.h   | 1 +\n> >>  src/ipa/simple/soft_simple.cpp    | 3 ++-\n> >>  3 files changed, 12 insertions(+), 1 deletion(-)\n> >> \n> >> diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp\n> >> index a7af2e12c..8516c4335 100644\n> >> --- a/src/ipa/simple/algorithms/blc.cpp\n> >> +++ b/src/ipa/simple/algorithms/blc.cpp\n> >> @@ -21,11 +21,20 @@ BlackLevel::BlackLevel()\n> >>  {\n> >>  }\n> >>  \n> >> +int BlackLevel::init(IPAContext &context, const YamlObject &tuningData)\n> >> +{\n> >> +       auto blackLevel = tuningData[\"blackLevel\"].get<int16_t>();\n> >> +       if (blackLevel.has_value())\n> >> +               context.configuration.black.level = blackLevel.value() / 256;\n> >\n> > It's not essential - but for converting between bit depths - I would\n> > think using bit shifting would be clearer (keep this however you prefer\n> > though).\n> >\n> >       /*\n> >        * Convert 16 bit values from the tuning file to 8 bit black\n> >        * level for the SoftISP.\n> >        */\n> >       .... = blackLevel.value() >> 8;\n> >\n> > might be more clear than\n> >       .... = blackLevel.value() / 256;\n> \n> OK.\n> \n> >> +       return 0;\n> >> +}\n> >> +\n> >>  int BlackLevel::configure(IPAContext &context,\n> >>                           [[maybe_unused]] const IPAConfigInfo &configInfo)\n> >>  {\n> >>         context.activeState.blc.level =\n> >>                 context.configuration.black.level.value_or(255);\n> >> +       LOG(IPASoftBL, Info) << \"pdm: blll: \" << context.activeState.blc.level;\n> >\n> > What's pdm: blll? Should this be removed? or changed to be Debug level ?\n> \n> A forgotten statement for checking the value, should be removed.\n\nAck, so with that removed, CI is clear - so we can merge the next\nversion!\n\nhttps://gitlab.freedesktop.org/camera/libcamera/-/pipelines/1292807\n\n> \n> > For the update itself with those handled, I think having the Tuning File\n> > able to specify the black level is helpful:\n> >\n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> >\n> >>         return 0;\n> >>  }\n> >>  \n> >> diff --git a/src/ipa/simple/algorithms/blc.h b/src/ipa/simple/algorithms/blc.h\n> >> index 828ad8b18..2cf2a8774 100644\n> >> --- a/src/ipa/simple/algorithms/blc.h\n> >> +++ b/src/ipa/simple/algorithms/blc.h\n> >> @@ -19,6 +19,7 @@ public:\n> >>         BlackLevel();\n> >>         ~BlackLevel() = default;\n> >>  \n> >> +       int init(IPAContext &context, const YamlObject &tuningData) override;\n> >>         int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> >>         void process(IPAContext &context, const uint32_t frame,\n> >>                      IPAFrameContext &frameContext,\n> >> diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\n> >> index e96e65bd1..03525b2f2 100644\n> >> --- a/src/ipa/simple/soft_simple.cpp\n> >> +++ b/src/ipa/simple/soft_simple.cpp\n> >> @@ -201,7 +201,8 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo)\n> >>                         (context_.configuration.agc.againMax -\n> >>                          context_.configuration.agc.againMin) /\n> >>                         100.0;\n> >> -               if (camHelper_->blackLevel().has_value()) {\n> >> +               if (!context_.configuration.black.level.has_value() &&\n> >> +                   camHelper_->blackLevel().has_value()) {\n> >>                         /*\n> >>                          * The black level from camHelper_ is a 16 bit value, software ISP\n> >>                          * works with 8 bit pixel values, both regardless of the actual\n> >> -- \n> >> 2.44.1\n> >>\n>","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 ADFFEC32FE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Oct 2024 14:06:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B0DB56538A;\n\tFri, 18 Oct 2024 16:06:32 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5237265380\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Oct 2024 16:06:30 +0200 (CEST)","from pendragon.ideasonboard.com\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 8ED18514;\n\tFri, 18 Oct 2024 16:04:46 +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=\"sAt+vFkd\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1729260286;\n\tbh=m7T9QmK8/rNJnpeRX9Zf7F0itCCy/DSWHdwKQSNFgK0=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=sAt+vFkd8MuM77qUKEHthsWUZrvgnzcDahfvwkQXRLCFpbBsfzojtXFNzxWZTKQWH\n\trWvDoIpt7se/oXARFpyIQXSQ9VGNzTLAAJtKbUOTCERhcr1ntcq0nTPEVkYjiW431U\n\teAU7L6O4AY+7eOMLxbDnRjcyi2WPPGXlqCPdvqk4=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<87bjzhqzjl.fsf@redhat.com>","References":"<20241018092628.293586-1-mzamazal@redhat.com>\n\t<20241018092628.293586-3-mzamazal@redhat.com>\n\t<172925912986.877857.17938188962142335045@ping.linuxembedded.co.uk>\n\t<87bjzhqzjl.fsf@redhat.com>","Subject":"Re: [PATCH v5 2/2] libcamera: software_isp: Black level from tuning\n\tfile","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tDaniel Scally <dan.scally@ideasonboard.com>,\n\tRobert Mader <robert.mader@collabora.com>","To":"Milan Zamazal <mzamazal@redhat.com>","Date":"Fri, 18 Oct 2024 15:06:26 +0100","Message-ID":"<172926038694.877857.4882614312035355346@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>"}}]