[{"id":37707,"web_url":"https://patchwork.libcamera.org/comment/37707/","msgid":"<d0cc0685-3482-46c7-814e-629522f5a4aa@nxsw.ie>","date":"2026-01-16T22:34:23","subject":"Re: [PATCH v3 03/14] libcamera: ipa: simple: Generalise tracking\n\tmatrix changes","submitter":{"id":226,"url":"https://patchwork.libcamera.org/api/people/226/","name":"Bryan O'Donoghue","email":"bod.linux@nxsw.ie"},"content":"On 14/01/2026 11:30, Milan Zamazal wrote:\n> -\tcontext.activeState.ccm.ccm = ccm;\n> +\tcontext.activeState.ccm = ccm;\n\nThis code looks obviously nicer, also, Generalise > Generalize +1\n\nReviewed-by: Bryan O'Donoghue <bod.linux@nxsw.ie>\n\n---\nbod","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 187E1BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 16 Jan 2026 22:34:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3D63461FBF;\n\tFri, 16 Jan 2026 23:34:29 +0100 (CET)","from tor.source.kernel.org (tor.source.kernel.org\n\t[IPv6:2600:3c04:e001:324:0:1991:8:25])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 90C4861FA3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 16 Jan 2026 23:34:27 +0100 (CET)","from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n\tby tor.source.kernel.org (Postfix) with ESMTP id B266460160;\n\tFri, 16 Jan 2026 22:34:26 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 7C26AC116C6;\n\tFri, 16 Jan 2026 22:34:25 +0000 (UTC)"],"Message-ID":"<d0cc0685-3482-46c7-814e-629522f5a4aa@nxsw.ie>","Date":"Fri, 16 Jan 2026 22:34:23 +0000","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3 03/14] libcamera: ipa: simple: Generalise tracking\n\tmatrix changes","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>, =?utf-8?q?Barnab?=\n\t=?utf-8?b?w6FzIFDFkWN6ZQ==?= <barnabas.pocze@ideasonboard.com>","References":"<20260114113016.25162-1-mzamazal@redhat.com>\n\t<KnKZ5ikfdpvs_RgsbfYIqC5Z8OwLDpCey2Ye_IEzSQo3UFEJu35BsKbldmBthVAVg2J4QuJB0fCYBRz9iUQorA==@protonmail.internalid>\n\t<20260114113016.25162-4-mzamazal@redhat.com>","From":"Bryan O'Donoghue <bod.linux@nxsw.ie>","Content-Language":"en-US","In-Reply-To":"<20260114113016.25162-4-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>"}},{"id":37810,"web_url":"https://patchwork.libcamera.org/comment/37810/","msgid":"<05fe833d-1400-4a43-bc62-1514060dd938@ideasonboard.com>","date":"2026-01-21T16:17:34","subject":"Re: [PATCH v3 03/14] libcamera: ipa: simple: Generalise tracking\n\tmatrix changes","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"2026. 01. 14. 12:30 keltezéssel, Milan Zamazal írta:\n> IPAActiveState::ccm stores the colour correction matrix (CCM) and\n> whether it has been changed.  The change flag is later used when\n> recomputing or not the lookup tables.\n> \n> But the CCM may include other corrections than just the sensor colour\n> correction, for example white balance and saturation adjustments.  These\n> things should be separated and IPAActiveState::ccm should represent just\n> the CCM itself.\n> \n> As the first step towards that cleanup, let's separate the change flag\n> from the CCM.  And wrap the only remaining member of\n> IPAActiveState::ccm.\n> \n> Also, let's reset the separated change flag in the lookup tables; it'll\n> be no longer tied to just CCM handling.\n> \n> This patch doesn't change actual behaviour and it still reports the\n> combined matrix as CCM in metadata.  This is addressed in the followup\n> patches.\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/ccm.cpp | 7 +++----\n>   src/ipa/simple/algorithms/lut.cpp | 5 +++--\n>   src/ipa/simple/ipa_context.h      | 6 ++----\n>   3 files changed, 8 insertions(+), 10 deletions(-)\n> \n> diff --git a/src/ipa/simple/algorithms/ccm.cpp b/src/ipa/simple/algorithms/ccm.cpp\n> index d7d3dda76..e05e5bc28 100644\n> --- a/src/ipa/simple/algorithms/ccm.cpp\n> +++ b/src/ipa/simple/algorithms/ccm.cpp\n> @@ -94,8 +94,7 @@ void Ccm::prepare(IPAContext &context, const uint32_t frame,\n>   \tif (frame > 0 &&\n>   \t    utils::abs_diff(ct, lastCt_) < kTemperatureThreshold &&\n>   \t    saturation == lastSaturation_) {\n> -\t\tframeContext.ccm = context.activeState.ccm.ccm;\n> -\t\tcontext.activeState.ccm.changed = false;\n> +\t\tframeContext.ccm = context.activeState.ccm;\n>   \t\treturn;\n>   \t}\n>   \n> @@ -105,9 +104,9 @@ void Ccm::prepare(IPAContext &context, const uint32_t frame,\n>   \tif (saturation)\n>   \t\tapplySaturation(ccm, saturation.value());\n>   \n> -\tcontext.activeState.ccm.ccm = ccm;\n> +\tcontext.activeState.ccm = ccm;\n>   \tframeContext.saturation = saturation;\n> -\tcontext.activeState.ccm.changed = true;\n> +\tcontext.activeState.matrixChanged = true;\n>   \tframeContext.ccm = ccm;\n>   }\n>   \n> diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp\n> index 54cb804e7..c19b34482 100644\n> --- a/src/ipa/simple/algorithms/lut.cpp\n> +++ b/src/ipa/simple/algorithms/lut.cpp\n> @@ -127,11 +127,11 @@ void Lut::prepare(IPAContext &context,\n>   \t\t\tparams->green[i] = gammaTable[static_cast<unsigned int>(lutGains.g())];\n>   \t\t\tparams->blue[i] = gammaTable[static_cast<unsigned int>(lutGains.b())];\n>   \t\t}\n> -\t} else if (context.activeState.ccm.changed || gammaUpdateNeeded) {\n> +\t} else if (context.activeState.matrixChanged || gammaUpdateNeeded) {\n>   \t\tMatrix<float, 3, 3> gainCcm = { { gains.r(), 0, 0,\n>   \t\t\t\t\t\t  0, gains.g(), 0,\n>   \t\t\t\t\t\t  0, 0, gains.b() } };\n> -\t\tauto ccm = context.activeState.ccm.ccm * gainCcm;\n> +\t\tauto ccm = context.activeState.ccm * gainCcm;\n>   \t\tauto &red = params->redCcm;\n>   \t\tauto &green = params->greenCcm;\n>   \t\tauto &blue = params->blueCcm;\n> @@ -150,6 +150,7 @@ void Lut::prepare(IPAContext &context,\n>   \t\t\t\tparams->gammaLut[i] = gammaTable[i / div];\n>   \t\t\t}\n>   \t\t}\n> +\t\tcontext.activeState.matrixChanged = false;\n>   \t}\n>   \n>   \tparams->gamma = context.configuration.gamma;\n> diff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\n> index 74e77c841..ea1852cd4 100644\n> --- a/src/ipa/simple/ipa_context.h\n> +++ b/src/ipa/simple/ipa_context.h\n> @@ -62,10 +62,8 @@ struct IPAActiveState {\n>   \t\tdouble contrastExp;\n>   \t} gamma;\n>   \n> -\tstruct {\n> -\t\tMatrix<float, 3, 3> ccm;\n> -\t\tbool changed;\n> -\t} ccm;\n> +\tMatrix<float, 3, 3> ccm;\n> +\tbool matrixChanged = false;\n>   \n>   \tstruct {\n>   \t\t/* 0..2 range, 1.0 = normal */","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 B8897BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 21 Jan 2026 16:17:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EF36D61FCC;\n\tWed, 21 Jan 2026 17:17:38 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 76ECD61FBB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Jan 2026 17:17:37 +0100 (CET)","from [192.168.33.24] (185.221.143.114.nat.pool.zt.hu\n\t[185.221.143.114])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3C986A06;\n\tWed, 21 Jan 2026 17:17: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=\"XMXN/q74\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1769012225;\n\tbh=V8+wKPKdCgf1fHcBkXYy29oG3FjD/Y2E85Ue5ZxqRec=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=XMXN/q74M6IXxXVcW4+PWR4ymV6N9UKIVlE6RgmKHpbSth3R9Qb4JR2Uv1+ICymi+\n\tVgX387YdbZi1sxCQs8yTEUy+tSjHl4j1bCydFtn6rg1QxmsVk95A7cYgYsCvwmQLpl\n\t1Tl1AXJQrmSRiICAEgVTG0akWwnXs+nbTAHX3+Ak=","Message-ID":"<05fe833d-1400-4a43-bc62-1514060dd938@ideasonboard.com>","Date":"Wed, 21 Jan 2026 17:17:34 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3 03/14] libcamera: ipa: simple: Generalise tracking\n\tmatrix changes","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>","References":"<20260114113016.25162-1-mzamazal@redhat.com>\n\t<20260114113016.25162-4-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":"<20260114113016.25162-4-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>"}}]