[{"id":34153,"web_url":"https://patchwork.libcamera.org/comment/34153/","msgid":"<aBuZVYEozmwwoidh@pyrite.rasen.tech>","date":"2025-05-07T17:33:09","subject":"Re: [PATCH v3 15/16] ipa: rkisp1: awb: Take the CCM into account for\n\tthe AWB gains calculation","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Thu, Apr 03, 2025 at 05:49:20PM +0200, Stefan Klug wrote:\n> The AWB measurements are taken after the CCM. This can be seen by\n> enabling debug logging on AWB, disabling AWB (stats will still be\n> processed) and manually chaning the CCM.\n> \n> This means that the estimated colour temperature and the corresponding\n> CCM also lead to changed rgbMeans which in turn leads to oscillations.\n> Fix that by applying the inverse transform on the rgbMeans.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> \n> ---\n> \n> Changes in v2:\n> - Improved commit message\n> - Added comment in the code\n> \n> Changes in v3:\n> - Fixed typo in comment\n> ---\n>  src/ipa/rkisp1/algorithms/awb.cpp | 6 ++++++\n>  1 file changed, 6 insertions(+)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\n> index 47b29725af51..03449e87e1a0 100644\n> --- a/src/ipa/rkisp1/algorithms/awb.cpp\n> +++ b/src/ipa/rkisp1/algorithms/awb.cpp\n> @@ -397,6 +397,12 @@ RGB<double> Awb::calculateRgbMeans(const IPAFrameContext &frameContext, const rk\n>  \t\trgbMeans = rgbMeans.max(0.0);\n>  \t}\n>  \n> +\t/*\n> +\t * The ISP computes the AWB means after applying the CCM. Apply the\n> +\t * inverse as we want to get the raw means before the colour gains.\n> +\t */\n> +\trgbMeans = frameContext.ccm.ccm.inverse() * rgbMeans;\n> +\n>  \t/*\n>  \t * The ISP computes the AWB means after applying the colour gains,\n>  \t * divide by the gains that were used to get the raw means from the\n> -- \n> 2.43.0\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 8E3C4C3226\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  7 May 2025 17:33:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BACE868B30;\n\tWed,  7 May 2025 19:33:15 +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 5E4C868B30\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 May 2025 19:33:14 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2001:861:3a80:3300:4f2f:8c2c:b3ef:17d4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8CC1EE92;\n\tWed,  7 May 2025 19:33:02 +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=\"S9vB3OZO\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1746639182;\n\tbh=tTzDjKh7Qoyk1lp7nji0ieDYx4zeqteTrT+P1BM1bYw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=S9vB3OZOvVwNVB0HozdZ/Ll7Yu0qcR+dx24BLe013/kSLCKUEwByjNcchIuJvD0TL\n\tH3sfAGb5T+5uDcsbNU0PGV5rwMp6eOjNydGfZOGQl43hqpxwj7ZNwYgUxGi4Y2xMQv\n\tkh5iNv3DhIZE3Ldi6ItKNouO8xSyyU2/9epwuTQg=","Date":"Wed, 7 May 2025 19:33:09 +0200","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"Re: [PATCH v3 15/16] ipa: rkisp1: awb: Take the CCM into account for\n\tthe AWB gains calculation","Message-ID":"<aBuZVYEozmwwoidh@pyrite.rasen.tech>","References":"<20250403154925.382973-1-stefan.klug@ideasonboard.com>\n\t<20250403154925.382973-16-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20250403154925.382973-16-stefan.klug@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>"}}]