[{"id":39667,"web_url":"https://patchwork.libcamera.org/comment/39667/","msgid":"<857bn35fwq.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2026-07-10T09:53:57","subject":"Re: [PATCH v5 06/36] ipa: simple: Use libipa CcmAlgorithm","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Jacopo,\n\nJacopo Mondi <jacopo.mondi@ideasonboard.com> writes:\n\n> From: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>\n> Now that libipa provides a common CCM algorithm implementation,\n> replace the custom handling with the common Ccm.\n>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> Tested-by: Robert Mader <robert.mader@collabora.com>\n> ---\n>  src/ipa/simple/algorithms/ccm.cpp | 72 ++++++++++++++++++++++-----------------\n>  src/ipa/simple/algorithms/ccm.h   | 23 ++++++++-----\n>  src/ipa/simple/ipa_context.h      |  5 +--\n>  3 files changed, 58 insertions(+), 42 deletions(-)\n>\n> diff --git a/src/ipa/simple/algorithms/ccm.cpp b/src/ipa/simple/algorithms/ccm.cpp\n> index 1174784edc7e..c6f270825913 100644\n> --- a/src/ipa/simple/algorithms/ccm.cpp\n> +++ b/src/ipa/simple/algorithms/ccm.cpp\n> @@ -8,54 +8,64 @@\n>  \n>  #include \"ccm.h\"\n>  \n> -#include <libcamera/base/log.h>\n> -#include <libcamera/base/utils.h>\n> -\n> -#include <libcamera/control_ids.h>\n> -\n>  #include \"libcamera/internal/matrix.h\"\n>  \n> -namespace {\n> -\n> -constexpr unsigned int kTemperatureThreshold = 100;\n> -\n> -}\n> -\n>  namespace libcamera {\n>  \n>  namespace ipa::soft::algorithms {\n>  \n>  LOG_DEFINE_CATEGORY(IPASoftCcm)\n>  \n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::init\n> + */\n>  int Ccm::init([[maybe_unused]] IPAContext &context, const ValueNode &tuningData)\n>  {\n> -\tint ret = ccm_.readYaml(tuningData[\"ccms\"], \"ct\", \"ccm\");\n> -\tif (ret < 0) {\n> -\t\tLOG(IPASoftCcm, Error)\n> -\t\t\t<< \"Failed to parse 'ccm' parameter from tuning file.\";\n> -\t\treturn ret;\n> -\t}\n> -\n> +\t/* Informs the 'adjust' component that CCM is available to apply Saturation */\n>  \tcontext.ccmEnabled = true;\n>  \n> -\treturn 0;\n> +\treturn ccmAlgo_.init(tuningData, context.ctrlMap);\n>  }\n>  \n> -void Ccm::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n> -\t\t  IPAFrameContext &frameContext, [[maybe_unused]] DebayerParams *params)\n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::configure\n> + */\n> +int Ccm::configure(IPAContext &context,\n> +\t\t   [[maybe_unused]] const IPAConfigInfo &configInfo)\n>  {\n> -\tconst unsigned int ct = frameContext.awb.colourTemperature;\n> +\treturn ccmAlgo_.configure(context.activeState.ccm,\n> +\t\t\t\t  context.activeState.awb.automatic.colourTemperature);\n> +}\n>  \n> -\t/* Change CCM only on bigger temperature changes. */\n> -\tif (!currentCcm_ ||\n> -\t    utils::abs_diff(ct, lastCt_) >= kTemperatureThreshold) {\n> -\t\tcurrentCcm_ = ccm_.getInterpolated(ct);\n> -\t\tlastCt_ = ct;\n> -\t}\n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::queueRequest\n> + */\n> +void Ccm::queueRequest(IPAContext &context,\n> +\t\t       [[maybe_unused]] const uint32_t frame,\n> +\t\t       IPAFrameContext &frameContext,\n> +\t\t       const ControlList &controls)\n> +{\n> +\t/* Nothing to do here, the ccm will be calculated in prepare() */\n> +\tif (frameContext.awb.autoEnabled)\n> +\t\treturn;\n>  \n> +\tccmAlgo_.queueRequest(context.activeState.ccm, frameContext.ccm, controls);\n> +}\n> +\n> +void Ccm::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n\n`frame' is used.\n\n> +\t\t  IPAFrameContext &frameContext, [[maybe_unused]] DebayerParams *params)\n> +{\n> +\tif (frameContext.awb.autoEnabled)\n> +\t\tccmAlgo_.prepare(context.activeState.ccm, frameContext.ccm,\n> +\t\t\t\t frame, frameContext.awb.colourTemperature);\n> +\n> +\t/*\n> +\t * \\todo: Split out combined matrix into individual parameters in\n> +\t * DebayerParams and perform any pre-multiplication combination in the\n> +\t * SoftISP component directly.\n> +\t */\n>  \tcontext.activeState.combinedMatrix =\n> -\t\tcurrentCcm_.value() * context.activeState.combinedMatrix;\n> -\tframeContext.ccm = currentCcm_.value();\n> +\t\tframeContext.ccm.ccm * context.activeState.combinedMatrix;\n>  }\n>  \n>  void Ccm::process([[maybe_unused]] IPAContext &context,\n> @@ -64,7 +74,7 @@ void Ccm::process([[maybe_unused]] IPAContext &context,\n>  \t\t  [[maybe_unused]] const SwIspStats *stats,\n>  \t\t  ControlList &metadata)\n>  {\n> -\tmetadata.set(controls::ColourCorrectionMatrix, frameContext.ccm.data());\n> +\tccmAlgo_.process(frameContext.ccm, metadata);\n>  }\n>  \n>  REGISTER_IPA_ALGORITHM(Ccm, \"Ccm\")\n> diff --git a/src/ipa/simple/algorithms/ccm.h b/src/ipa/simple/algorithms/ccm.h\n> index b20a7da8aa33..0d35347ea583 100644\n> --- a/src/ipa/simple/algorithms/ccm.h\n> +++ b/src/ipa/simple/algorithms/ccm.h\n> @@ -7,13 +7,15 @@\n>  \n>  #pragma once\n>  \n> -#include <optional>\n> +#include <libcamera/controls.h>\n>  \n> -#include \"libcamera/internal/matrix.h\"\n> +#include \"libcamera/internal/value_node.h\"\n>  \n> -#include <libipa/interpolator.h>\n> +#include \"libipa/ccm.h\"\n> +#include \"libipa/fixedpoint.h\"\n>  \n>  #include \"algorithm.h\"\n> +#include \"ipa_context.h\"\n>  \n>  namespace libcamera {\n>  \n> @@ -22,10 +24,15 @@ namespace ipa::soft::algorithms {\n>  class Ccm : public Algorithm\n>  {\n>  public:\n> -\tCcm() = default;\n> -\t~Ccm() = default;\n> -\n>  \tint init(IPAContext &context, const ValueNode &tuningData) override;\n> +\n> +\tint configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> +\n> +\tvoid queueRequest(IPAContext &context,\n> +\t\t\t  [[maybe_unused]] const uint32_t frame,\n\n[[maybe_unused]] not needed in a header file.\n\nWith the maybe_unused fixes:\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n\n> +\t\t\t  IPAFrameContext &frameContext,\n> +\t\t\t  const ControlList &controls) override;\n> +\n>  \tvoid prepare(IPAContext &context,\n>  \t\t     const uint32_t frame,\n>  \t\t     IPAFrameContext &frameContext,\n> @@ -36,9 +43,7 @@ public:\n>  \t\t     ControlList &metadata) override;\n>  \n>  private:\n> -\tunsigned int lastCt_;\n> -\tInterpolator<Matrix<float, 3, 3>> ccm_;\n> -\tstd::optional<Matrix<float, 3, 3>> currentCcm_;\n> +\tCcmAlgorithm<Q<4, 16>> ccmAlgo_;\n>  };\n>  \n>  } /* namespace ipa::soft::algorithms */\n> diff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\n> index 29643a655ce1..ff312ae8f4e7 100644\n> --- a/src/ipa/simple/ipa_context.h\n> +++ b/src/ipa/simple/ipa_context.h\n> @@ -17,6 +17,7 @@\n>  #include \"libcamera/internal/vector.h\"\n>  \n>  #include <libipa/awb.h>\n> +#include <libipa/ccm.h>\n>  #include <libipa/fc_queue.h>\n>  \n>  #include \"core_ipa_interface.h\"\n> @@ -38,6 +39,7 @@ struct IPASessionConfiguration {\n>  \n>  struct IPAActiveState {\n>  \tipa::awb::ActiveState awb;\n> +\tipa::ccm::ActiveState ccm;\n>  \n>  \tstruct {\n>  \t\tint32_t exposure;\n> @@ -63,8 +65,7 @@ struct IPAActiveState {\n>  \n>  struct IPAFrameContext : public FrameContext {\n>  \tipa::awb::FrameContext awb;\n> -\n> -\tMatrix<float, 3, 3> ccm;\n> +\tipa::ccm::FrameContext ccm;\n>  \n>  \tstruct {\n>  \t\tint32_t exposure;","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 51BF6C3330\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 10 Jul 2026 09:54:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 546C266105;\n\tFri, 10 Jul 2026 11:54:05 +0200 (CEST)","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 483E065F7C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 10 Jul 2026 11:54:03 +0200 (CEST)","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-43-CocBztlPPuqzquhFgPrTRw-1; Fri, 10 Jul 2026 05:54:00 -0400","by mail-wr1-f71.google.com with SMTP id\n\tffacd0b85a97d-473f4a48e9aso443668f8f.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 10 Jul 2026 02:54:00 -0700 (PDT)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-4.net.vodafone.cz. [77.48.47.4])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-47a9e4d843csm57702102f8f.14.2026.07.10.02.53.57\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 10 Jul 2026 02:53:58 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"FBRHTAv9\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1783677242;\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=+7MLJs4FtSLKBtgekAIzpDdE2iEqKI3HvrXjEzFnXJY=;\n\tb=FBRHTAv9Ol/oBnmQcvms15Rwhj8KvU8tP/5CyxSLg+leKkc3UfF3rSNgEMxI3yfT2Dr5jk\n\tBjAn3yCKspcFOaHNuelrC74zIBZqRb0y7swOfI9Hm+kKEe4yS+4Rk5BiZ1NOhn7VUDDpD0\n\tt2L99i1rCKp+rSrpanZDdBWJpHOMgRA=","X-MC-Unique":"CocBztlPPuqzquhFgPrTRw-1","X-Mimecast-MFC-AGG-ID":"CocBztlPPuqzquhFgPrTRw_1783677239","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1783677239; x=1784282039;\n\th=content-type:mime-version:user-agent:message-id:date:references\n\t:in-reply-to:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to\n\t:cc:subject:date:message-id:reply-to:content-type;\n\tbh=+7MLJs4FtSLKBtgekAIzpDdE2iEqKI3HvrXjEzFnXJY=;\n\tb=l1H9uzkHYLb4whsdhSaZ8RL37wlTOBR+7FVNILRXG4Owj2r3UN/q8l2ovlMhN+W62t\n\tXmRc+Ze6l6xesrmK1PIaFcs2jl7yH7/OeV0YErLGfoRQuBDfl61PDybc7TpZ0dV4RNPS\n\tzpEjjoxIWGbRGJtLClxv9Q9XV82n/x9fZJi1njUtlyZ9zMhWug5ZSAl0SaF0hZNAoSnD\n\tcCzgLpCu0prFAtF7Gd8hzDTUstSs1MdsgEbWvMkAweIm98G3YUFdzFiExVQfzpn00M1L\n\ti2DCu8EfadFHXF2AjrO2dVcmJigNorYV2cl49YE+h0OJL7D6g8yKWbx5TLyFAu7iaJwb\n\ts6yw==","X-Gm-Message-State":"AOJu0YzzJFbJM8SQtvW29mbKo1wRkyUgnbuPSUp6yyMY9izqEXrWKe6y\n\t48u+5wHV8HiHd0rAv6U530Auqka67K4/U+/usmp/P41x9rQ4aM4iLmuT6IBXcHiCpBMV7jkEMKS\n\t6EramVEa2T0YnXYXcaLcHU5b0krpfcZ+0Aj7cXbLKeYzMj/PuB0LdEsxpJ7btbVPLCCzUECa3Dy\n\tY=","X-Gm-Gg":"AfdE7cnGA3YPd0j5oJiF/PlAneybWVX7P1FdzHiuZk/JQBRd26BKMS0VykWV6F2oRPk\n\tied0YwwTBP4Q8lHUjZ2Ud6hYachUcYASxC8+3Uw8j08ID6ZJHe9GzltBNS7fNYEyiL1gfBZMfzX\n\tlmJhzfPO0/PkpY9DsFi3K9dEFyMKOf+4u2oEBf2heGhDIDBMFItzTfsnzVyrug1JbNQ4ymqb/9Y\n\tbnFg7zCdnTsxv1QJzq8Oaznf4Mt9b/6Rx4R2fSa6s3rhc5Zj1WhL3bN6z92EpPO3Y4qGwyT9X/J\n\t2ODTe+HG5pgtqF73DR8fuvl5+BrXMa6aRUQvi/8zIXUyEAQ0igF3/ajFoZzrDqM4KeZnq6WnMoI\n\t/Vx+UMhy0n0S5hLVYC6m0AeteZsX9OCqCwic9IExkbLd1pzs1YTTHi70h2kplAJ34","X-Received":["by 2002:a05:6000:1a86:b0:47d:ec60:658e with SMTP id\n\tffacd0b85a97d-47df0730155mr12585502f8f.25.1783677239245; \n\tFri, 10 Jul 2026 02:53:59 -0700 (PDT)","by 2002:a05:6000:1a86:b0:47d:ec60:658e with SMTP id\n\tffacd0b85a97d-47df0730155mr12585486f8f.25.1783677238875; \n\tFri, 10 Jul 2026 02:53:58 -0700 (PDT)"],"From":"Milan Zamazal <mzamazal@redhat.com>","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,  Stefan Klug\n\t<stefan.klug@ideasonboard.com>,  Kieran Bingham\n\t<kieran.bingham@ideasonboard.com>,  Robert Mader\n\t<robert.mader@collabora.com>","Subject":"Re: [PATCH v5 06/36] ipa: simple: Use libipa CcmAlgorithm","In-Reply-To":"<20260708-libipa-algorithms-v5-6-0759d0359f52@ideasonboard.com>\n\t(Jacopo Mondi's message of \"Wed, 08 Jul 2026 17:50:48 +0200\")","References":"<20260708-libipa-algorithms-v5-0-0759d0359f52@ideasonboard.com>\n\t<20260708-libipa-algorithms-v5-6-0759d0359f52@ideasonboard.com>","Date":"Fri, 10 Jul 2026 11:53:57 +0200","Message-ID":"<857bn35fwq.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":"ppOoEETm-sgCV4JWgkb0IMc06Oi5SA-Cx7Nujuu-Sgo_1783677239","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":39669,"web_url":"https://patchwork.libcamera.org/comment/39669/","msgid":"<alDsr028x7-75X5L@zed>","date":"2026-07-10T13:29:18","subject":"Re: [PATCH v5 06/36] ipa: simple: Use libipa CcmAlgorithm","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Milan\n\nOn Fri, Jul 10, 2026 at 11:53:57AM +0200, Milan Zamazal wrote:\n> Hi Jacopo,\n>\n> Jacopo Mondi <jacopo.mondi@ideasonboard.com> writes:\n>\n> > From: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> >\n> > Now that libipa provides a common CCM algorithm implementation,\n> > replace the custom handling with the common Ccm.\n> >\n> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> > Tested-by: Robert Mader <robert.mader@collabora.com>\n> > ---\n> >  src/ipa/simple/algorithms/ccm.cpp | 72 ++++++++++++++++++++++-----------------\n> >  src/ipa/simple/algorithms/ccm.h   | 23 ++++++++-----\n> >  src/ipa/simple/ipa_context.h      |  5 +--\n> >  3 files changed, 58 insertions(+), 42 deletions(-)\n> >\n> > diff --git a/src/ipa/simple/algorithms/ccm.cpp b/src/ipa/simple/algorithms/ccm.cpp\n> > index 1174784edc7e..c6f270825913 100644\n> > --- a/src/ipa/simple/algorithms/ccm.cpp\n> > +++ b/src/ipa/simple/algorithms/ccm.cpp\n> > @@ -8,54 +8,64 @@\n> >\n> >  #include \"ccm.h\"\n> >\n> > -#include <libcamera/base/log.h>\n> > -#include <libcamera/base/utils.h>\n> > -\n> > -#include <libcamera/control_ids.h>\n> > -\n> >  #include \"libcamera/internal/matrix.h\"\n> >\n> > -namespace {\n> > -\n> > -constexpr unsigned int kTemperatureThreshold = 100;\n> > -\n> > -}\n> > -\n> >  namespace libcamera {\n> >\n> >  namespace ipa::soft::algorithms {\n> >\n> >  LOG_DEFINE_CATEGORY(IPASoftCcm)\n> >\n> > +/**\n> > + * \\copydoc libcamera::ipa::Algorithm::init\n> > + */\n> >  int Ccm::init([[maybe_unused]] IPAContext &context, const ValueNode &tuningData)\n> >  {\n> > -\tint ret = ccm_.readYaml(tuningData[\"ccms\"], \"ct\", \"ccm\");\n> > -\tif (ret < 0) {\n> > -\t\tLOG(IPASoftCcm, Error)\n> > -\t\t\t<< \"Failed to parse 'ccm' parameter from tuning file.\";\n> > -\t\treturn ret;\n> > -\t}\n> > -\n> > +\t/* Informs the 'adjust' component that CCM is available to apply Saturation */\n> >  \tcontext.ccmEnabled = true;\n> >\n> > -\treturn 0;\n> > +\treturn ccmAlgo_.init(tuningData, context.ctrlMap);\n> >  }\n> >\n> > -void Ccm::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n> > -\t\t  IPAFrameContext &frameContext, [[maybe_unused]] DebayerParams *params)\n> > +/**\n> > + * \\copydoc libcamera::ipa::Algorithm::configure\n> > + */\n> > +int Ccm::configure(IPAContext &context,\n> > +\t\t   [[maybe_unused]] const IPAConfigInfo &configInfo)\n> >  {\n> > -\tconst unsigned int ct = frameContext.awb.colourTemperature;\n> > +\treturn ccmAlgo_.configure(context.activeState.ccm,\n> > +\t\t\t\t  context.activeState.awb.automatic.colourTemperature);\n> > +}\n> >\n> > -\t/* Change CCM only on bigger temperature changes. */\n> > -\tif (!currentCcm_ ||\n> > -\t    utils::abs_diff(ct, lastCt_) >= kTemperatureThreshold) {\n> > -\t\tcurrentCcm_ = ccm_.getInterpolated(ct);\n> > -\t\tlastCt_ = ct;\n> > -\t}\n> > +/**\n> > + * \\copydoc libcamera::ipa::Algorithm::queueRequest\n> > + */\n> > +void Ccm::queueRequest(IPAContext &context,\n> > +\t\t       [[maybe_unused]] const uint32_t frame,\n> > +\t\t       IPAFrameContext &frameContext,\n> > +\t\t       const ControlList &controls)\n> > +{\n> > +\t/* Nothing to do here, the ccm will be calculated in prepare() */\n> > +\tif (frameContext.awb.autoEnabled)\n> > +\t\treturn;\n> >\n> > +\tccmAlgo_.queueRequest(context.activeState.ccm, frameContext.ccm, controls);\n> > +}\n> > +\n> > +void Ccm::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n>\n> `frame' is used.\n>\n\nRight, as 'context' is in init() and I should as well drop\n[[maybe_unused]] from the header\n\n> > +\t\t  IPAFrameContext &frameContext, [[maybe_unused]] DebayerParams *params)\n> > +{\n> > +\tif (frameContext.awb.autoEnabled)\n> > +\t\tccmAlgo_.prepare(context.activeState.ccm, frameContext.ccm,\n> > +\t\t\t\t frame, frameContext.awb.colourTemperature);\n> > +\n> > +\t/*\n> > +\t * \\todo: Split out combined matrix into individual parameters in\n> > +\t * DebayerParams and perform any pre-multiplication combination in the\n> > +\t * SoftISP component directly.\n> > +\t */\n> >  \tcontext.activeState.combinedMatrix =\n> > -\t\tcurrentCcm_.value() * context.activeState.combinedMatrix;\n> > -\tframeContext.ccm = currentCcm_.value();\n> > +\t\tframeContext.ccm.ccm * context.activeState.combinedMatrix;\n> >  }\n> >\n> >  void Ccm::process([[maybe_unused]] IPAContext &context,\n> > @@ -64,7 +74,7 @@ void Ccm::process([[maybe_unused]] IPAContext &context,\n> >  \t\t  [[maybe_unused]] const SwIspStats *stats,\n> >  \t\t  ControlList &metadata)\n> >  {\n> > -\tmetadata.set(controls::ColourCorrectionMatrix, frameContext.ccm.data());\n> > +\tccmAlgo_.process(frameContext.ccm, metadata);\n> >  }\n> >\n> >  REGISTER_IPA_ALGORITHM(Ccm, \"Ccm\")\n> > diff --git a/src/ipa/simple/algorithms/ccm.h b/src/ipa/simple/algorithms/ccm.h\n> > index b20a7da8aa33..0d35347ea583 100644\n> > --- a/src/ipa/simple/algorithms/ccm.h\n> > +++ b/src/ipa/simple/algorithms/ccm.h\n> > @@ -7,13 +7,15 @@\n> >\n> >  #pragma once\n> >\n> > -#include <optional>\n> > +#include <libcamera/controls.h>\n> >\n> > -#include \"libcamera/internal/matrix.h\"\n> > +#include \"libcamera/internal/value_node.h\"\n> >\n> > -#include <libipa/interpolator.h>\n> > +#include \"libipa/ccm.h\"\n> > +#include \"libipa/fixedpoint.h\"\n> >\n> >  #include \"algorithm.h\"\n> > +#include \"ipa_context.h\"\n> >\n> >  namespace libcamera {\n> >\n> > @@ -22,10 +24,15 @@ namespace ipa::soft::algorithms {\n> >  class Ccm : public Algorithm\n> >  {\n> >  public:\n> > -\tCcm() = default;\n> > -\t~Ccm() = default;\n> > -\n> >  \tint init(IPAContext &context, const ValueNode &tuningData) override;\n> > +\n> > +\tint configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> > +\n> > +\tvoid queueRequest(IPAContext &context,\n> > +\t\t\t  [[maybe_unused]] const uint32_t frame,\n>\n> [[maybe_unused]] not needed in a header file.\n>\n> With the maybe_unused fixes:\n>\n> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>\n\nI'll also change the commit title to\n\"ipa: simple: Port to use libipa CcmAlgorithm\"\nto match the other patches\n\nThanks\n   j\n\n>\n> > +\t\t\t  IPAFrameContext &frameContext,\n> > +\t\t\t  const ControlList &controls) override;\n> > +\n> >  \tvoid prepare(IPAContext &context,\n> >  \t\t     const uint32_t frame,\n> >  \t\t     IPAFrameContext &frameContext,\n> > @@ -36,9 +43,7 @@ public:\n> >  \t\t     ControlList &metadata) override;\n> >\n> >  private:\n> > -\tunsigned int lastCt_;\n> > -\tInterpolator<Matrix<float, 3, 3>> ccm_;\n> > -\tstd::optional<Matrix<float, 3, 3>> currentCcm_;\n> > +\tCcmAlgorithm<Q<4, 16>> ccmAlgo_;\n> >  };\n> >\n> >  } /* namespace ipa::soft::algorithms */\n> > diff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\n> > index 29643a655ce1..ff312ae8f4e7 100644\n> > --- a/src/ipa/simple/ipa_context.h\n> > +++ b/src/ipa/simple/ipa_context.h\n> > @@ -17,6 +17,7 @@\n> >  #include \"libcamera/internal/vector.h\"\n> >\n> >  #include <libipa/awb.h>\n> > +#include <libipa/ccm.h>\n> >  #include <libipa/fc_queue.h>\n> >\n> >  #include \"core_ipa_interface.h\"\n> > @@ -38,6 +39,7 @@ struct IPASessionConfiguration {\n> >\n> >  struct IPAActiveState {\n> >  \tipa::awb::ActiveState awb;\n> > +\tipa::ccm::ActiveState ccm;\n> >\n> >  \tstruct {\n> >  \t\tint32_t exposure;\n> > @@ -63,8 +65,7 @@ struct IPAActiveState {\n> >\n> >  struct IPAFrameContext : public FrameContext {\n> >  \tipa::awb::FrameContext awb;\n> > -\n> > -\tMatrix<float, 3, 3> ccm;\n> > +\tipa::ccm::FrameContext ccm;\n> >\n> >  \tstruct {\n> >  \t\tint32_t exposure;\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 BAE4EC3332\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 10 Jul 2026 13:29:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B24E166107;\n\tFri, 10 Jul 2026 15:29:25 +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 36D1565F7C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 10 Jul 2026 15:29:24 +0200 (CEST)","from ideasonboard.com (mob-109-113-15-151.net.vodafone.it\n\t[109.113.15.151])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DCCD012F;\n\tFri, 10 Jul 2026 15:28:31 +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=\"JyDAb4F+\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783690112;\n\tbh=gDa7f5pXfuYhswZEzfEIcTSlcxWD1Zf81m6Pu6qijaI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=JyDAb4F+u7p11YdLoES9TVyyofK4zN55IjbOXR1wnIsYr4w++wLasuQ7C6/6Gor9p\n\tI7mKLmimms/sDE4+j73x+hKGtNYBRisDlBn02h1PZFlBsY5k9aToTbpQWufKeZOagF\n\trUalqT8Rvy7BpeE/1OGHVqpbDcPooyMTY+apZNuo=","Date":"Fri, 10 Jul 2026 15:29:18 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>, \n\tlibcamera-devel@lists.libcamera.org,\n\tStefan Klug <stefan.klug@ideasonboard.com>, \n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tRobert Mader <robert.mader@collabora.com>","Subject":"Re: [PATCH v5 06/36] ipa: simple: Use libipa CcmAlgorithm","Message-ID":"<alDsr028x7-75X5L@zed>","References":"<20260708-libipa-algorithms-v5-0-0759d0359f52@ideasonboard.com>\n\t<20260708-libipa-algorithms-v5-6-0759d0359f52@ideasonboard.com>\n\t<857bn35fwq.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<857bn35fwq.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","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>"}}]