[{"id":30358,"web_url":"https://patchwork.libcamera.org/comment/30358/","msgid":"<aup2zb62djfalb6d6taxujcir7ghms2tw5ev3yrson5hur6z4t@yobjdfy4nwgo>","date":"2024-07-05T13:41:43","subject":"Re: [PATCH v2 11/11] ipa: rkisp1: blc: Add support for BLS in\n\tcompand","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi Paul, hi Laurent,\n\nThank you for the patch.\n\nOn Thu, Jul 04, 2024 at 07:20:35PM +0300, Laurent Pinchart wrote:\n> From: Paul Elder <paul.elder@ideasonboard.com>\n> \n> Extend the RkISP1 BLC algorithm to use the ISP 'companding' block for\n> versions of the ISP (such as the one on the i.MX8MP) that lack the\n> dedicated BLS block but implement BLS as part of the companding block.\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nLooks good to me.\n\nReviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\nCheers,\nStefan\n\n\n> ---\n>  src/ipa/rkisp1/algorithms/blc.cpp | 33 ++++++++++++++++++++++---------\n>  1 file changed, 24 insertions(+), 9 deletions(-)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/blc.cpp b/src/ipa/rkisp1/algorithms/blc.cpp\n> index df1a91a413db..9bc10f4ad07f 100644\n> --- a/src/ipa/rkisp1/algorithms/blc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/blc.cpp\n> @@ -110,7 +110,7 @@ int BlackLevelCorrection::init(IPAContext &context, const YamlObject &tuningData\n>  /**\n>   * \\copydoc libcamera::ipa::Algorithm::prepare\n>   */\n> -void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,\n> +void BlackLevelCorrection::prepare(IPAContext &context,\n>  \t\t\t\t   const uint32_t frame,\n>  \t\t\t\t   [[maybe_unused]] IPAFrameContext &frameContext,\n>  \t\t\t\t   RkISP1Params *params)\n> @@ -124,15 +124,30 @@ void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,\n>  \tif (!tuningParameters_)\n>  \t\treturn;\n>  \n> -\tauto config = params->block<Block::Bls>();\n> -\tconfig.setEnabled(true);\n> +\tif (context.hw->compand) {\n> +\t\tauto config = params->block<Block::CompandBls>();\n> +\t\tconfig.setEnabled(true);\n>  \n> -\tconfig->enable_auto = 0;\n> -\t/* The rkisp1 uses 12bit based black levels. Scale down accordingly. */\n> -\tconfig->fixed_val.r = blackLevelRed_ >> 4;\n> -\tconfig->fixed_val.gr = blackLevelGreenR_ >> 4;\n> -\tconfig->fixed_val.gb = blackLevelGreenB_ >> 4;\n> -\tconfig->fixed_val.b = blackLevelBlue_ >> 4;\n> +\t\t/*\n> +\t\t * Scale up to the 20-bit black levels used by the companding\n> +\t\t * block.\n> +\t\t */\n> +\t\tconfig->r = blackLevelRed_ << 4;\n> +\t\tconfig->gr = blackLevelGreenR_ << 4;\n> +\t\tconfig->gb = blackLevelGreenB_ << 4;\n> +\t\tconfig->b = blackLevelBlue_ << 4;\n> +\t} else {\n> +\t\tauto config = params->block<Block::Bls>();\n> +\t\tconfig.setEnabled(true);\n> +\n> +\t\tconfig->enable_auto = 0;\n> +\n> +\t\t/* Scale down to the 12-bit black levels used by the BLS block. */\n> +\t\tconfig->fixed_val.r = blackLevelRed_ >> 4;\n> +\t\tconfig->fixed_val.gr = blackLevelGreenR_ >> 4;\n> +\t\tconfig->fixed_val.gb = blackLevelGreenB_ >> 4;\n> +\t\tconfig->fixed_val.b = blackLevelBlue_ >> 4;\n> +\t}\n>  }\n>  \n>  /**\n> -- \n> Regards,\n> \n> Laurent Pinchart\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 C5C33BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  5 Jul 2024 13:41:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C733062E23;\n\tFri,  5 Jul 2024 15:41:47 +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 9DE0A619BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  5 Jul 2024 15:41:46 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:60b6:33a3:3a20:6030])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D4EA4541;\n\tFri,  5 Jul 2024 15:41:16 +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=\"R+I0Zd1Z\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1720186876;\n\tbh=lKkC3j7yjHW6BIq5NjP0FzU+mgUx4Y5Ozk1zfUVZ/wY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=R+I0Zd1ZLxjg1gPGcxS9pLKGls9A6cnVEIDGC/xC+452u/6tvHjwMpx41zk8YJgkj\n\tijfLdkIYa+ZqQdY+aaJczzoe7PNilDDFfU/CQdSNwCOcMJ0PSju7JPqWitahUYb5Kt\n\t8c1iRDRiU5WtRlujgxr9EMLrFqlM8/Qu6nxUuTBc=","Date":"Fri, 5 Jul 2024 15:41:43 +0200","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, \n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>","Subject":"Re: [PATCH v2 11/11] ipa: rkisp1: blc: Add support for BLS in\n\tcompand","Message-ID":"<aup2zb62djfalb6d6taxujcir7ghms2tw5ev3yrson5hur6z4t@yobjdfy4nwgo>","References":"<20240704162035.15074-1-laurent.pinchart@ideasonboard.com>\n\t<20240704162035.15074-12-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240704162035.15074-12-laurent.pinchart@ideasonboard.com>","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>"}}]