[{"id":38088,"web_url":"https://patchwork.libcamera.org/comment/38088/","msgid":"<0bee5784-f04f-43c8-a81f-de9ba57e7656@ideasonboard.com>","date":"2026-02-05T10:29:45","subject":"Re: [PATCH v2] libcamera: ipa: simple: Fix multiplication order in\n\tAwb","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"2026. 02. 03. 12:53 keltezéssel, Milan Zamazal írta:\n> The matrix multiplication in Awb is swapped: the gains should be applied\n> after combinedMatrix, i.e. on the left side.  The mistake happened when\n> `ccm' was replaced with combinedMatrix and gainMatrix multiplication was\n> moved to Awb.  While CCM must be applied after gains, the gains must be\n> applied after the combined matrix, which no longer corresponds to CCM in\n> Awb.\n> \n> Since there is currently no algorithm modifying combinedMatrix before\n> Awb, combinedMatrix is an identity matrix there and the wrong order\n> doesn't influence the output at the moment.\n> \n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> ---\n\nLooks ok to me.\n\nReviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\n\n>   src/ipa/simple/algorithms/awb.cpp | 2 +-\n>   1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/simple/algorithms/awb.cpp b/src/ipa/simple/algorithms/awb.cpp\n> index 6fdaacaba..4ed1be289 100644\n> --- a/src/ipa/simple/algorithms/awb.cpp\n> +++ b/src/ipa/simple/algorithms/awb.cpp\n> @@ -44,7 +44,7 @@ void Awb::prepare(IPAContext &context,\n>   \t\t\t\t\t     0, gains.g(), 0,\n>   \t\t\t\t\t     0, 0, gains.b() } };\n>   \tcontext.activeState.combinedMatrix =\n> -\t\tcontext.activeState.combinedMatrix * gainMatrix;\n> +\t\tgainMatrix * context.activeState.combinedMatrix;\n>   \n>   \tframeContext.gains.red = gains.r();\n>   \tframeContext.gains.blue = gains.b();","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 47E03C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  5 Feb 2026 10:29:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 74AA562055;\n\tThu,  5 Feb 2026 11:29:49 +0100 (CET)","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 602BD61F84\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  5 Feb 2026 11:29:48 +0100 (CET)","from [192.168.33.53] (185.221.141.206.nat.pool.zt.hu\n\t[185.221.141.206])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 89710227;\n\tThu,  5 Feb 2026 11:29:05 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"lip/Bweo\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1770287345;\n\tbh=9jAESqojw3T6oHVVzMMyUecCV2fsySp86QKvCZMtsxo=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=lip/BweoSaLDUPoZXjLtzVQUpQDinCyNko3biAtbWINhiBR8FBxUTaz/ueFUypAes\n\tcOV4G31fIqtMnCPOuSe7ivED3zx0ZD1qxZ/iaKFd2HX4RQYxW4lCiLWz/TqLTb21Wr\n\t8ygofTlxN5EX0wCl3v7wWDx0RehJWSI4eBTk9TPk=","Message-ID":"<0bee5784-f04f-43c8-a81f-de9ba57e7656@ideasonboard.com>","Date":"Thu, 5 Feb 2026 11:29:45 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v2] libcamera: ipa: simple: Fix multiplication order in\n\tAwb","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>","References":"<20260203115326.10421-1-mzamazal@redhat.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20260203115326.10421-1-mzamazal@redhat.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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":38102,"web_url":"https://patchwork.libcamera.org/comment/38102/","msgid":"<20260205222524.GE170964@killaraus>","date":"2026-02-05T22:25:24","subject":"Re: [PATCH v2] libcamera: ipa: simple: Fix multiplication order in\n\tAwb","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Thu, Feb 05, 2026 at 11:29:45AM +0100, Barnabás Pőcze wrote:\n> 2026. 02. 03. 12:53 keltezéssel, Milan Zamazal írta:\n> > The matrix multiplication in Awb is swapped: the gains should be applied\n> > after combinedMatrix, i.e. on the left side.  The mistake happened when\n> > `ccm' was replaced with combinedMatrix and gainMatrix multiplication was\n> > moved to Awb.  While CCM must be applied after gains, the gains must be\n> > applied after the combined matrix, which no longer corresponds to CCM in\n> > Awb.\n> > \n> > Since there is currently no algorithm modifying combinedMatrix before\n> > Awb, combinedMatrix is an identity matrix there and the wrong order\n> > doesn't influence the output at the moment.\n> > \n> > Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> > ---\n> \n> Looks ok to me.\n> \n> Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> >   src/ipa/simple/algorithms/awb.cpp | 2 +-\n> >   1 file changed, 1 insertion(+), 1 deletion(-)\n> > \n> > diff --git a/src/ipa/simple/algorithms/awb.cpp b/src/ipa/simple/algorithms/awb.cpp\n> > index 6fdaacaba..4ed1be289 100644\n> > --- a/src/ipa/simple/algorithms/awb.cpp\n> > +++ b/src/ipa/simple/algorithms/awb.cpp\n> > @@ -44,7 +44,7 @@ void Awb::prepare(IPAContext &context,\n> >   \t\t\t\t\t     0, gains.g(), 0,\n> >   \t\t\t\t\t     0, 0, gains.b() } };\n> >   \tcontext.activeState.combinedMatrix =\n> > -\t\tcontext.activeState.combinedMatrix * gainMatrix;\n> > +\t\tgainMatrix * context.activeState.combinedMatrix;\n> >   \n> >   \tframeContext.gains.red = gains.r();\n> >   \tframeContext.gains.blue = gains.b();","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 C197ABD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  5 Feb 2026 22:25:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9A4AB62069;\n\tThu,  5 Feb 2026 23:25:27 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2107D62010\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  5 Feb 2026 23:25:26 +0100 (CET)","from killaraus.ideasonboard.com\n\t(2001-14ba-703d-e500--2a1.rev.dnainternet.fi\n\t[IPv6:2001:14ba:703d:e500::2a1])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 989DCD0;\n\tThu,  5 Feb 2026 23:24:42 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"n/D48zsp\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1770330282;\n\tbh=zeiJXRzsP0sxNgYPdy8/pLAVDmZBx2cFFgOXd3G9XWQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=n/D48zspKat3swneGBD5UiZHXz8eI9ateYkJENZudhB8GXmlbfzAe4Msgi/cuNZO2\n\tAP2S+fXfux6GS0R7/lh8e/zS7AUPYycevptFkktz75WD/nTJNIkOv0xdHl2ve5T6/a\n\tFS4DhZRrYtfk0revPR6hpJXEBu12jKheNuH5eOU8=","Date":"Fri, 6 Feb 2026 00:25:24 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"Re: [PATCH v2] libcamera: ipa: simple: Fix multiplication order in\n\tAwb","Message-ID":"<20260205222524.GE170964@killaraus>","References":"<20260203115326.10421-1-mzamazal@redhat.com>\n\t<0bee5784-f04f-43c8-a81f-de9ba57e7656@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<0bee5784-f04f-43c8-a81f-de9ba57e7656@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>"}}]