[{"id":31422,"web_url":"https://patchwork.libcamera.org/comment/31422/","msgid":"<acd86357-29ae-465c-b3a4-6a5eb6c44f86@ideasonboard.com>","date":"2024-09-26T19:27:52","subject":"Re: [PATCH v7 18/18] libcamera: software_isp: Update black level\n\tonly on exposure changes","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Milan\n\nThank you for the patch\n\nOn 21/09/24 12:01 am, Milan Zamazal wrote:\n> The black level is likely to get updated, if ever, only after exposure\n> or gain changes.  Don't compute its possible updates if exposure and\n> gain are unchanged.\n>\n> It's probably not worth trying to implement something more\n> sophisticated.  Better to spend the effort on supporting tuning files.\n>\n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n> ---\n>   src/ipa/simple/algorithms/blc.cpp | 9 ++++++++-\n>   src/ipa/simple/algorithms/blc.h   | 4 ++++\n>   2 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 755108b0..b9f2aaa6 100644\n> --- a/src/ipa/simple/algorithms/blc.cpp\n> +++ b/src/ipa/simple/algorithms/blc.cpp\n> @@ -30,10 +30,15 @@ int BlackLevel::configure(IPAContext &context,\n>   \n>   void BlackLevel::process(IPAContext &context,\n>   \t\t\t [[maybe_unused]] const uint32_t frame,\n> -\t\t\t [[maybe_unused]] IPAFrameContext &frameContext,\n> +\t\t\t IPAFrameContext &frameContext,\n>   \t\t\t const SwIspStats *stats,\n>   \t\t\t [[maybe_unused]] ControlList &metadata)\n>   {\n> +\tif (frameContext.sensor.exposure == exposure_ &&\n> +\t    frameContext.sensor.gain == gain_) {\n> +\t\treturn;\n> +\t}\n> +\n>   \tconst SwIspStats::Histogram &histogram = stats->yHistogram;\n>   \n>   \t/*\n> @@ -54,6 +59,8 @@ void BlackLevel::process(IPAContext &context,\n>   \t\tseen += histogram[i];\n>   \t\tif (seen >= pixelThreshold) {\n>   \t\t\tcontext.activeState.blc.level = i * histogramRatio;\n> +\t\t\texposure_ = frameContext.sensor.exposure;\n> +\t\t\tgain_ = frameContext.sensor.gain;\n>   \t\t\tLOG(IPASoftBL, Debug)\n>   \t\t\t\t<< \"Auto-set black level: \"\n>   \t\t\t\t<< i << \"/\" << SwIspStats::kYHistogramSize\n> diff --git a/src/ipa/simple/algorithms/blc.h b/src/ipa/simple/algorithms/blc.h\n> index 49bdcc61..828ad8b1 100644\n> --- a/src/ipa/simple/algorithms/blc.h\n> +++ b/src/ipa/simple/algorithms/blc.h\n> @@ -24,6 +24,10 @@ public:\n>   \t\t     IPAFrameContext &frameContext,\n>   \t\t     const SwIspStats *stats,\n>   \t\t     ControlList &metadata) override;\n> +\n> +private:\n> +\tuint32_t exposure_;\n> +\tdouble gain_;\n>   };\n>   \n>   } /* namespace ipa::soft::algorithms */","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 815A7C3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Sep 2024 19:28:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6F30863513;\n\tThu, 26 Sep 2024 21:27:59 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 672E163502\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Sep 2024 21:27:57 +0200 (CEST)","from [IPV6:2405:201:2015:f873:c173:4b:4a04:3a21] (unknown\n\t[IPv6:2405:201:2015:f873:c173:4b:4a04:3a21])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3C41F8D4;\n\tThu, 26 Sep 2024 21:26:28 +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=\"bV6YYLGJ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1727378789;\n\tbh=CKvmPXF8TeH3RrJ12CLtYanJDHWyOsiRWnbgAmqIciU=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=bV6YYLGJJljQCHh+T0De5DKyq+ML1F9zZakm8eBdd3n35taJLWQ/mlRt6RHoqQF7R\n\tWv90Cc1hPmlW0WM5p3Mq2MN4EsN+JwpTrw5qL8KftvAzVX82mizBMP39lpcBpT3XwS\n\tYriDHJxLhCSD6uA0pGcsALwco/qsUBtV6rV1OSfk=","Message-ID":"<acd86357-29ae-465c-b3a4-6a5eb6c44f86@ideasonboard.com>","Date":"Fri, 27 Sep 2024 00:57:52 +0530","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v7 18/18] libcamera: software_isp: Update black level\n\tonly on exposure changes","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Cc":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tDaniel Scally <dan.scally@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","References":"<20240920183143.1674117-1-mzamazal@redhat.com>\n\t<20240920183143.1674117-19-mzamazal@redhat.com>","Content-Language":"en-US","From":"Umang Jain <umang.jain@ideasonboard.com>","In-Reply-To":"<20240920183143.1674117-19-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>"}}]