[{"id":38042,"web_url":"https://patchwork.libcamera.org/comment/38042/","msgid":"<177006051315.1871504.2689733228438125263@ping.linuxembedded.co.uk>","date":"2026-02-02T19:28:33","subject":"Re: [PATCH 2/3] ipa: simple: Fix Ccm matrix multiplication","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Kieran Bingham (2026-02-02 19:25:04)\n> The CCM should be applied to the current combined Matrix. Fix the\n> multiplication ordering.\n\nArgh, I rewrote this commit message but messing with b4 I've lost the\nupdated commit.. but now I can b4 send ... \\o/\n\nI'd reword this to :\n\n    ipa: simple: Fix Ccm matrix multiplication\n\n    The CCM should be applied to the current combined Matrix. Fix the\n    composition order to apply the CCM after the previous combined colour\n    transformations of the colour pipeline.\n\n\n> \n> Fixes: 82ed6c19c2b3 (\"libcamera: ipa: simple: Initialise the general correction matrix\")\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  src/ipa/simple/algorithms/ccm.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/simple/algorithms/ccm.cpp b/src/ipa/simple/algorithms/ccm.cpp\n> index 911a5af2c90b55187f0d98519f3c29b8e0804567..90ea97b7f37ec78c747d355d7ba7ab517970b29d 100644\n> --- a/src/ipa/simple/algorithms/ccm.cpp\n> +++ b/src/ipa/simple/algorithms/ccm.cpp\n> @@ -54,7 +54,7 @@ void Ccm::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n>         }\n>  \n>         context.activeState.combinedMatrix =\n> -               currentCcm_.value() * context.activeState.combinedMatrix;\n> +               context.activeState.combinedMatrix * currentCcm_.value();\n>         frameContext.ccm = currentCcm_.value();\n>  }\n>  \n> \n> -- \n> 2.52.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 23E6ABD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  2 Feb 2026 19:28:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7A71B61FF7;\n\tMon,  2 Feb 2026 20:28:37 +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 CDCA761FEE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  2 Feb 2026 20:28:35 +0100 (CET)","from monstersaurus.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 EC97266B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  2 Feb 2026 20:27:54 +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=\"oTMu/pXa\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1770060475;\n\tbh=YhVIh0QsQmJCx6Aq5aO6yc6/CmBnY6vOybkesZCnnrI=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=oTMu/pXa2PNSnDx6hJtDG6s1tdoA6L6p+9V3TrJUM1NW5JozuvBKS6WcRzjjlE/ag\n\tqfVwvgbZfJTx1sGS+9CvTi9GgyjFfinbDhOEOmsDD4ySCUdAk0a0n1KqGQr2I0ibEJ\n\tyl8ivnyyM2bqwi/BR/5fWr+XrCT0sHL8l6dHRMxM=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20260202-kbingham-fixups-v1-2-7d7dd4b2a27b@ideasonboard.com>","References":"<20260202-kbingham-fixups-v1-0-7d7dd4b2a27b@ideasonboard.com>\n\t<20260202-kbingham-fixups-v1-2-7d7dd4b2a27b@ideasonboard.com>","Subject":"Re: [PATCH 2/3] ipa: simple: Fix Ccm matrix multiplication","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 02 Feb 2026 19:28:33 +0000","Message-ID":"<177006051315.1871504.2689733228438125263@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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":38046,"web_url":"https://patchwork.libcamera.org/comment/38046/","msgid":"<85cy2m6gbr.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2026-02-02T20:28:08","subject":"Re: [PATCH 2/3] ipa: simple: Fix Ccm matrix multiplication","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Kieran,\n\nKieran Bingham <kieran.bingham@ideasonboard.com> writes:\n\n> Quoting Kieran Bingham (2026-02-02 19:25:04)\n>> The CCM should be applied to the current combined Matrix. Fix the\n>> multiplication ordering.\n>\n> Argh, I rewrote this commit message but messing with b4 I've lost the\n> updated commit.. but now I can b4 send ... \\o/\n>\n> I'd reword this to :\n>\n>     ipa: simple: Fix Ccm matrix multiplication\n>\n>     The CCM should be applied to the current combined Matrix. Fix the\n>     composition order to apply the CCM after the previous combined colour\n>     transformations of the colour pipeline.\n\nIt's a bit counter-intuitive, but the left-most matrix corresponds to\nthe last operation to be applied.  See\nhttps://git.libcamera.org/libcamera/libcamera.git/commit/?id=026ed6273969d931d38876345e01de626def8b07\nfor explanation.\n\nSo I don't think this change is correct.  There are other opportunities\nto mess the matrix operations.  One of them is GPU ISP but I believe it\nwas correct at least at the time when I reviewed it.\n\nThe multiplication order is swapped in simple/algorithms/awb.cpp, which\nshould be fixed, but since combinedMatrix is an identity matrix there,\nit cannot be the cause.  When applying saturation in adjust.cpp, the\norder is correct.\n\nDo you get different results with GPU ISP and CPU ISP (with CCM\nenabled)?  If yes then let's look into GPU ISP.  If not then the problem\nmight be outside of the matrix operations.\n\n>> \n>> Fixes: 82ed6c19c2b3 (\"libcamera: ipa: simple: Initialise the general correction matrix\")\n>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>> ---\n>>  src/ipa/simple/algorithms/ccm.cpp | 2 +-\n>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>> \n>> diff --git a/src/ipa/simple/algorithms/ccm.cpp b/src/ipa/simple/algorithms/ccm.cpp\n>> index 911a5af2c90b55187f0d98519f3c29b8e0804567..90ea97b7f37ec78c747d355d7ba7ab517970b29d 100644\n>> --- a/src/ipa/simple/algorithms/ccm.cpp\n>> +++ b/src/ipa/simple/algorithms/ccm.cpp\n>> @@ -54,7 +54,7 @@ void Ccm::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n>>         }\n>>  \n>>         context.activeState.combinedMatrix =\n>> -               currentCcm_.value() * context.activeState.combinedMatrix;\n>> +               context.activeState.combinedMatrix * currentCcm_.value();\n>>         frameContext.ccm = currentCcm_.value();\n>>  }\n>>  \n>> \n>> -- \n>> 2.52.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 78EBAC3226\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  2 Feb 2026 20:28:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A54C06200C;\n\tMon,  2 Feb 2026 21:28:16 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1DA0A61FEE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  2 Feb 2026 21:28:14 +0100 (CET)","from mail-wm1-f72.google.com (mail-wm1-f72.google.com\n\t[209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-553-wZf1vdXlMn2FkwgSFxBSYg-1; Mon, 02 Feb 2026 15:28:12 -0500","by mail-wm1-f72.google.com with SMTP id\n\t5b1f17b1804b1-482ef3af991so571445e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 02 Feb 2026 12:28:12 -0800 (PST)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-483051287cfsm21828325e9.6.2026.02.02.12.28.09\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 02 Feb 2026 12:28:09 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"gUbZOj/6\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1770064093;\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=Koe48Rs4Qv+uXbIKnI8PT+pkZdvrbk9WcbyjIetAEYc=;\n\tb=gUbZOj/6lX40ekv7VaDFypOWpaml98/uzdmiaM561uymxpX/6xaShjQFpQSZwrKYQS+rAe\n\tYrLxyhzlQMv2T9p0irfRqa16YifSPKJcyWdy4GnTaZXIGXgfli44hQ99/H/AWDHR56AKNV\n\t21TZSk7zXfgwxD8evWrAaauUrTesA8w=","X-MC-Unique":"wZf1vdXlMn2FkwgSFxBSYg-1","X-Mimecast-MFC-AGG-ID":"wZf1vdXlMn2FkwgSFxBSYg_1770064091","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1770064091; x=1770668891;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject\n\t:date:message-id:reply-to;\n\tbh=Koe48Rs4Qv+uXbIKnI8PT+pkZdvrbk9WcbyjIetAEYc=;\n\tb=Qof/8chCA6l+VVvNF0rg/2FVJ9MMPc394RITTeHBJJ9MVJ4NOtwSX3PP25tOENvZhU\n\tADNIAwncDrwoc9jujz+kdhJbWUtAAPgRskl8uceDYM7yGMQpkbVRfsy/Kq1u2qz+R9tX\n\t22CGNkl1qR8SMe25zCIlBXURt8lgpxOW3W4G/2pdoPu8add82X0kJZR18xJThLAuRHgp\n\tvFX8/8Gzob6D2slYwqaklWD5t2uedPuGRY8fADQ+irVZIuPXM37YyoGW75gldD0ZN5ff\n\t2Y/6BgLf2QKR2VfRvapWXhKULrFaI2dXDTKHDxFxvBX0k6ZITjpexOgstw28brPesu/R\n\t24wQ==","X-Gm-Message-State":"AOJu0YwnFkPGHEjiJkBVh9FH75NH89A0UvtI0vbLzJKsOF4bv36wdI89\n\tcPiTM3O05CMR0pu44tvVW+gyqJFaVFX4JXH6ZUadwj0MBOulbQNKyl9vT/67hKcQded9aXI4y17\n\tTrfgLavT4KajM3NxU1c701JS8/4iuJfrbvSmvF2UXEaZAUwkqnhTnpqqnMbwobt4Zl514GtrZ35\n\tJ6SE4jqV59VWPzRn8KjqeLHtWEBqifzf4bXUErp+H6TiJnrAg9MfhI6hDKIQM=","X-Gm-Gg":"AZuq6aJpDhgtjRFokCFYNsq2UnpL274FmgmRKZGV03TiDzJKyuX4KG4W1A56qCYVX49\n\tYsul3IiMOSGDSXALBZ+hNxlaLYHxOtGFcYeUCj86l2+NE1jIvy+wVKt3iDzV9FBoBjGU90kxWQ8\n\tBUlaKy2ptZxMRwZH7uc89KDC2CuJkIVeUlMDN7SdRebAyO19SSxo+vHHWV9RBPb1KjFl/iqvbm6\n\tZj9H/kGTrAwtsqvQ/MgZmloYyQf+zxMA8PuFCecZUEk1gfRiPCogJnqQq5r8TToIU90eAKvS2GM\n\tKdYCYr9sUd9qslggQbJ5R+U+1a3wz0TmXc5kw8dhOruRQqrvwS2jCosVADyakrTCeobRz8v79Si\n\tJsgNQtIl4B+MtRgmN54G0JVcfWQ9Ml2wokAtnxl6D8NAuyglPNgTaQ+M0q0dKpUk=","X-Received":["by 2002:a7b:ce8d:0:b0:477:a71c:d200 with SMTP id\n\t5b1f17b1804b1-48305164e85mr7951425e9.11.1770064090680; \n\tMon, 02 Feb 2026 12:28:10 -0800 (PST)","by 2002:a7b:ce8d:0:b0:477:a71c:d200 with SMTP id\n\t5b1f17b1804b1-48305164e85mr7951125e9.11.1770064090130; \n\tMon, 02 Feb 2026 12:28:10 -0800 (PST)"],"From":"Milan Zamazal <mzamazal@redhat.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH 2/3] ipa: simple: Fix Ccm matrix multiplication","In-Reply-To":"<177006051315.1871504.2689733228438125263@ping.linuxembedded.co.uk>\n\t(Kieran Bingham's message of \"Mon, 02 Feb 2026 19:28:33 +0000\")","References":"<20260202-kbingham-fixups-v1-0-7d7dd4b2a27b@ideasonboard.com>\n\t<20260202-kbingham-fixups-v1-2-7d7dd4b2a27b@ideasonboard.com>\n\t<177006051315.1871504.2689733228438125263@ping.linuxembedded.co.uk>","Date":"Mon, 02 Feb 2026 21:28:08 +0100","Message-ID":"<85cy2m6gbr.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"ixXlJe0r5q9B1ppZcMTg33PncgUy0aGKUnKIJqFWHlc_1770064091","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":38049,"web_url":"https://patchwork.libcamera.org/comment/38049/","msgid":"<851pj26dp5.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2026-02-02T21:24:54","subject":"Re: [PATCH 2/3] ipa: simple: Fix Ccm matrix multiplication","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Milan Zamazal <mzamazal@redhat.com> writes:\n\n> Hi Kieran,\n>\n> Kieran Bingham <kieran.bingham@ideasonboard.com> writes:\n>\n>> Quoting Kieran Bingham (2026-02-02 19:25:04)\n>>> The CCM should be applied to the current combined Matrix. Fix the\n>>> multiplication ordering.\n>>\n>> Argh, I rewrote this commit message but messing with b4 I've lost the\n>> updated commit.. but now I can b4 send ... \\o/\n>>\n>> I'd reword this to :\n>>\n>>     ipa: simple: Fix Ccm matrix multiplication\n>>\n>>     The CCM should be applied to the current combined Matrix. Fix the\n>>     composition order to apply the CCM after the previous combined colour\n>>     transformations of the colour pipeline.\n>\n> It's a bit counter-intuitive, but the left-most matrix corresponds to\n> the last operation to be applied.  See\n> https://git.libcamera.org/libcamera/libcamera.git/commit/?id=026ed6273969d931d38876345e01de626def8b07\n> for explanation.\n>\n> So I don't think this change is correct.  There are other opportunities\n> to mess the matrix operations.  One of them is GPU ISP but I believe it\n> was correct at least at the time when I reviewed it.\n>\n> The multiplication order is swapped in simple/algorithms/awb.cpp, which\n> should be fixed, but since combinedMatrix is an identity matrix there,\n> it cannot be the cause.  When applying saturation in adjust.cpp, the\n> order is correct.\n>\n> Do you get different results with GPU ISP and CPU ISP (with CCM\n> enabled)? \n\nHmm, I do under a warm light (i.e. when the AWB gains are significantly\ndifferent to each other).  I'll look at it.\n\n> If yes then let's look into GPU ISP.  If not then the problem might be\n> outside of the matrix operations.\n>\n>>> \n>>> Fixes: 82ed6c19c2b3 (\"libcamera: ipa: simple: Initialise the general correction matrix\")\n>>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>>> ---\n>>>  src/ipa/simple/algorithms/ccm.cpp | 2 +-\n>>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>>> \n>>> diff --git a/src/ipa/simple/algorithms/ccm.cpp b/src/ipa/simple/algorithms/ccm.cpp\n>>> index 911a5af2c90b55187f0d98519f3c29b8e0804567..90ea97b7f37ec78c747d355d7ba7ab517970b29d 100644\n>>> --- a/src/ipa/simple/algorithms/ccm.cpp\n>>> +++ b/src/ipa/simple/algorithms/ccm.cpp\n>>> @@ -54,7 +54,7 @@ void Ccm::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n>>>         }\n>>>  \n>>>         context.activeState.combinedMatrix =\n>>> -               currentCcm_.value() * context.activeState.combinedMatrix;\n>>> +               context.activeState.combinedMatrix * currentCcm_.value();\n>>>         frameContext.ccm = currentCcm_.value();\n>>>  }\n>>>  \n>>> \n>>> -- \n>>> 2.52.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 245C8C3226\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  2 Feb 2026 21:25:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 23BDC6200A;\n\tMon,  2 Feb 2026 22:25:02 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4E5EE61FEE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  2 Feb 2026 22:25:00 +0100 (CET)","from mail-wr1-f71.google.com (mail-wr1-f71.google.com\n\t[209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-107-amExhnZiNz62EBJJX866GQ-1; Mon, 02 Feb 2026 16:24:57 -0500","by mail-wr1-f71.google.com with SMTP id\n\tffacd0b85a97d-4325b182e3cso3341395f8f.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 02 Feb 2026 13:24:57 -0800 (PST)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-4830511bfc6sm29787325e9.2.2026.02.02.13.24.54\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 02 Feb 2026 13:24:54 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"XXgHyySg\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1770067499;\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=iiCNGA+BggAK0+0dI+3j2mKJ6LmPJI1HGV1dNiBj+H0=;\n\tb=XXgHyySgydQo69deAdQCJXxrzrfXVhULBHNAHqscBin9Lmc6IHdVAlolEgMSGc0TTFSeNN\n\t5904CltPBl/snFsSsS62VlVFCCJ8EwbCiXw+O+Dk6qLQrmTGClafMjQrgntHvUfXLT8o2j\n\t1zejweCLo2e8Zt2XNoDDorjQncRIF9k=","X-MC-Unique":"amExhnZiNz62EBJJX866GQ-1","X-Mimecast-MFC-AGG-ID":"amExhnZiNz62EBJJX866GQ_1770067496","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1770067496; x=1770672296;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject\n\t:date:message-id:reply-to;\n\tbh=iiCNGA+BggAK0+0dI+3j2mKJ6LmPJI1HGV1dNiBj+H0=;\n\tb=QOKHOK7+ZUDAGQ1cvkV2LtADJ/QHf6rGLs2wNhzY5i0XjvysVKGbaLcSWJH7HaRknk\n\t18FIz6KKdl/BWYC2ACteYXT0hzrbK9BqKKC/tvn/LfqO9ZvOOv6rw+OaMeztePjbRxmF\n\tkRH9dDOVv7rz6Jw7D/VjegSw5Sc9+y0hw7d6a0LIcBDX76yO1eExpOwooCNYNyjoB7uz\n\tZ3tOeqCxMmBT/Bt9IuxWNc7wVXPcpZxQBmfjj7de8PYMCXzArWmHIenuhdQKokqZXgq+\n\tfs0SILlNhQCzFf43vRU/o4PmeZ99i4yM1gFhg5tIolhFP0DVAOR/tko+Bl6ZqJnBkLuO\n\txejg==","X-Gm-Message-State":"AOJu0Ywh03WsmmBCnqYCuiC9jx3qQlk4VfDVsp960eHyZK7JcpucReBl\n\t/Lm1IdTGHeUKNuJjnUIk9IGiojCcDBDPfz/v8g+GidkpnbyJJv/hB6AAEnsr9mJSZrNkO4iNF+6\n\tLLigiIQqjN/tJVAQccrQ0EucVQEg7Gvhhcrc5B5NMp4GZhG80pdLGey6NLyFQOiYe0ISSjtKmSB\n\tbUI7sCczht5H3xtHxq7+p2VilA7yk0IWxeLiRciQ2jUBfDwhoc7y/Jpgou4EQ=","X-Gm-Gg":"AZuq6aLOcCDoCEonP4T9MmFpAa7hrEmOWwjLya9LZ094TuC1tsvJtDO2mu9Wsw+n1b6\n\tLwizC1FnpcrBHG3YPvEiJNrsSFfEA/eSqPL8sVZxxCneDLVb/NwkhJU0yKvpOiWxGo0oRK9EY4P\n\tDAkDTnH5/SdcbS4SF7xWaQqqCsN9f9kI/NhD6sGlRZqENAXRklSGyKSY97YfzeELDm/iHiKt8G7\n\tKgmI8DDRsdc57V2TTykcEQzKzPFutzLvJZ4gb57wqGQxcJ7UbAJM91QgpQ0gDgDtKgh0S1Mt9m3\n\tQN86Bgkkqcj9aTtYaBwozuiQP63EXycNxKYENjzXkqruKAmfrV/hWvuvR02aCHd7ly8z4LautOO\n\t2F9rwNbxXaDOVCeQWCt6c8YKg9LW5XZGV9FEidvOEeNs33GNUygN4J2gNYinFG1c=","X-Received":["by 2002:a05:600c:8b0a:b0:477:b48d:ba7a with SMTP id\n\t5b1f17b1804b1-482db495b79mr175102605e9.32.1770067495718; \n\tMon, 02 Feb 2026 13:24:55 -0800 (PST)","by 2002:a05:600c:8b0a:b0:477:b48d:ba7a with SMTP id\n\t5b1f17b1804b1-482db495b79mr175102355e9.32.1770067495309; \n\tMon, 02 Feb 2026 13:24:55 -0800 (PST)"],"From":"Milan Zamazal <mzamazal@redhat.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH 2/3] ipa: simple: Fix Ccm matrix multiplication","In-Reply-To":"<85cy2m6gbr.fsf@mzamazal-thinkpadp1gen7.tpbc.csb> (Milan\n\tZamazal's message of \"Mon, 02 Feb 2026 21:28:08 +0100\")","References":"<20260202-kbingham-fixups-v1-0-7d7dd4b2a27b@ideasonboard.com>\n\t<20260202-kbingham-fixups-v1-2-7d7dd4b2a27b@ideasonboard.com>\n\t<177006051315.1871504.2689733228438125263@ping.linuxembedded.co.uk>\n\t<85cy2m6gbr.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","Date":"Mon, 02 Feb 2026 22:24:54 +0100","Message-ID":"<851pj26dp5.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"KZf84OjrFVbvEnyhPHigmUYOxDi6x02cfz6VeQBUpEc_1770067496","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":38060,"web_url":"https://patchwork.libcamera.org/comment/38060/","msgid":"<85pl6l28nb.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2026-02-03T14:39:52","subject":"Re: [PATCH 2/3] ipa: simple: Fix Ccm matrix multiplication","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Milan Zamazal <mzamazal@redhat.com> writes:\n\n> Milan Zamazal <mzamazal@redhat.com> writes:\n>\n>> Hi Kieran,\n>>\n>> Kieran Bingham <kieran.bingham@ideasonboard.com> writes:\n>>\n>>> Quoting Kieran Bingham (2026-02-02 19:25:04)\n>>>> The CCM should be applied to the current combined Matrix. Fix the\n>>>> multiplication ordering.\n>>>\n>>> Argh, I rewrote this commit message but messing with b4 I've lost the\n>>> updated commit.. but now I can b4 send ... \\o/\n>>>\n>>> I'd reword this to :\n>>>\n>>>     ipa: simple: Fix Ccm matrix multiplication\n>>>\n>>>     The CCM should be applied to the current combined Matrix. Fix the\n>>>     composition order to apply the CCM after the previous combined colour\n>>>     transformations of the colour pipeline.\n>>\n>> It's a bit counter-intuitive, but the left-most matrix corresponds to\n>> the last operation to be applied.  See\n>> https://git.libcamera.org/libcamera/libcamera.git/commit/?id=026ed6273969d931d38876345e01de626def8b07\n>> for explanation.\n>>\n>> So I don't think this change is correct.  There are other opportunities\n>> to mess the matrix operations.  One of them is GPU ISP but I believe it\n>> was correct at least at the time when I reviewed it.\n>>\n>> The multiplication order is swapped in simple/algorithms/awb.cpp, which\n>> should be fixed, but since combinedMatrix is an identity matrix there,\n>> it cannot be the cause.  When applying saturation in adjust.cpp, the\n>> order is correct.\n>>\n>> Do you get different results with GPU ISP and CPU ISP (with CCM\n>> enabled)? \n>\n> Hmm, I do under a warm light (i.e. when the AWB gains are significantly\n> different to each other).  I'll look at it.\n\nIt's apparently the problem, already mentioned elsewhere, with the black\nlevel being applied wrong in CPU ISP.  GPU ISP is not affected.  After\nfixing that, I can't see obvious differences.\n\nNo further idea from my side at the moment.\n\n>> If yes then let's look into GPU ISP.  If not then the problem might be\n>> outside of the matrix operations.\n>>\n>>>> \n>>>> Fixes: 82ed6c19c2b3 (\"libcamera: ipa: simple: Initialise the general correction matrix\")\n>>>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>>>> ---\n>>>>  src/ipa/simple/algorithms/ccm.cpp | 2 +-\n>>>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>>>> \n>>>> diff --git a/src/ipa/simple/algorithms/ccm.cpp b/src/ipa/simple/algorithms/ccm.cpp\n>>>> index 911a5af2c90b55187f0d98519f3c29b8e0804567..90ea97b7f37ec78c747d355d7ba7ab517970b29d 100644\n>>>> --- a/src/ipa/simple/algorithms/ccm.cpp\n>>>> +++ b/src/ipa/simple/algorithms/ccm.cpp\n>>>> @@ -54,7 +54,7 @@ void Ccm::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n>>>>         }\n>>>>  \n>>>>         context.activeState.combinedMatrix =\n>>>> -               currentCcm_.value() * context.activeState.combinedMatrix;\n>>>> +               context.activeState.combinedMatrix * currentCcm_.value();\n>>>>         frameContext.ccm = currentCcm_.value();\n>>>>  }\n>>>>  \n>>>> \n>>>> -- \n>>>> 2.52.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 112EBBD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  3 Feb 2026 14:40:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E22BC61A35;\n\tTue,  3 Feb 2026 15:40:04 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B8AA361A35\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  3 Feb 2026 15:40:02 +0100 (CET)","from mail-wm1-f71.google.com (mail-wm1-f71.google.com\n\t[209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-157-OuG4k_rQOoyMDVFKhq6CSg-1; Tue, 03 Feb 2026 09:40:00 -0500","by mail-wm1-f71.google.com with SMTP id\n\t5b1f17b1804b1-480717a8e05so56958195e9.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 03 Feb 2026 06:39:56 -0800 (PST)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-482e267aad1sm118571165e9.15.2026.02.03.06.39.53\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 03 Feb 2026 06:39:53 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"CtVCPAo1\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1770129601;\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=ntpXnMfEmmVCGguCuSTFiUYgduYvt9gfS9DqRKuW14w=;\n\tb=CtVCPAo1fJFWfqVO2u+C5dFfswI5CC2AZpL4X1XjlMiUlVO7W3tNoMjLpTi7V6L56vfmGN\n\tp7lKIOztVd5b244+B+AVsFsSeT4p90rcMjBpgT0k4k/EexheA6CmwpcnbypERGHtgxqtaM\n\tXUzfwisPLq6BdlI3fLdOdgT7A3erlSI=","X-MC-Unique":"OuG4k_rQOoyMDVFKhq6CSg-1","X-Mimecast-MFC-AGG-ID":"OuG4k_rQOoyMDVFKhq6CSg_1770129596","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1770129595; x=1770734395;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject\n\t:date:message-id:reply-to;\n\tbh=ntpXnMfEmmVCGguCuSTFiUYgduYvt9gfS9DqRKuW14w=;\n\tb=MBv7IfTv4ZzjiCSmcF/8nyeUItt8YhxNX3Ho7JiiLptjUKopoIQwv7L+fYiH1FzJyg\n\tFilf7rGAgAITG5yKH7cEjyQ5qpRZeXZqEzJ58avR/OJyt7nLt77wtx1gq2v9Uc+ziAk4\n\tK/eBPqubY8eGAVGcn9h2fv14yapO3kRgqEy9LKKAYOhiwNfvyhiEw18AyP0B547zBM7g\n\tQXYpszyqEXzd0vEYLXwicDLnNXYAx8q5XitS1cA5Xs7vTYr6C6ZMY8f8+fvmLP+NCM+8\n\tCoSS6TSHspyQfbgneCvdwBRhvAGeECEzUISYJgu89NmJnfvPHe8Ywo7MyM6zwJOYW28Z\n\tNplw==","X-Gm-Message-State":"AOJu0YwSO3rXMiAcjkg3l/KqEHvREXn374EpD4KtM4459jznEMn6v+JS\n\tvxwsFyn7Mr1gFKxSjkzaIvrEFkgUEPwpOLY8HB/4bgIzSaVESVhy2mVP5ojGgk2XbryM7jUIXdb\n\tBWOpNjWhm/T+aO+w37aTokCWXy8wQe9R8hrBLZO+clgRPuBdv/J/3FNAxixajNSe+RtCWr/aZlz\n\tUmenIUAfecBd5ragvP6i8wGSN8sIvG59Tb72rVp45a5MPGpXhLnSbAQma5Frg=","X-Gm-Gg":"AZuq6aLC3Q2h9OUI5yNqMyLltmVKbi0+99t+FJp5g32K7CCqX9XD8xnszG5VEXcLNoq\n\t3HCInX/FMKxjmEWDrYois8BTbitmvLaXlZB76nCT5ymhFiVWr3YgQnuNkAUYCJups+cMtz6lWQ7\n\tn2qwmZlDOQlSK9oIH3pnARR0yhLqCzmyUNwcaploa5jtMQr/8qa+gdEFdK62Wks/JFvvlOV8Mq3\n\t93NeBYnKaGax13KUvbognAh/w36c6fejW37UmcNKKzkOVUDiYeXd5QIqtdcvVhRdk1Rp6q+6fwV\n\t4ts61bfW991hokDTv5TH+vHBDeScxnRhx8ltzS2LCy8Aob9iCWvNc76/FH+4v+wJaHUtQXtWjBu\n\tRu3jFlVFpifl6bI6fD/I8AsCmBCTIj4CraC/kBJghHOwrEcNCZrbHAP9n1/x6hMw=","X-Received":["by 2002:a05:600c:8b61:b0:477:a36f:1a57 with SMTP id\n\t5b1f17b1804b1-482db456a60mr216587185e9.3.1770129595122; \n\tTue, 03 Feb 2026 06:39:55 -0800 (PST)","by 2002:a05:600c:8b61:b0:477:a36f:1a57 with SMTP id\n\t5b1f17b1804b1-482db456a60mr216586895e9.3.1770129594689; \n\tTue, 03 Feb 2026 06:39:54 -0800 (PST)"],"From":"Milan Zamazal <mzamazal@redhat.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH 2/3] ipa: simple: Fix Ccm matrix multiplication","In-Reply-To":"<851pj26dp5.fsf@mzamazal-thinkpadp1gen7.tpbc.csb> (Milan\n\tZamazal's message of \"Mon, 02 Feb 2026 22:24:54 +0100\")","References":"<20260202-kbingham-fixups-v1-0-7d7dd4b2a27b@ideasonboard.com>\n\t<20260202-kbingham-fixups-v1-2-7d7dd4b2a27b@ideasonboard.com>\n\t<177006051315.1871504.2689733228438125263@ping.linuxembedded.co.uk>\n\t<85cy2m6gbr.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>\n\t<851pj26dp5.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","Date":"Tue, 03 Feb 2026 15:39:52 +0100","Message-ID":"<85pl6l28nb.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"LnV6xyn6ZiNppQZBu_7A-YCJn-nedckCOqbmkPY6n8w_1770129596","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>"}}]