[{"id":39141,"web_url":"https://patchwork.libcamera.org/comment/39141/","msgid":"<178163476501.3598163.912467653931436992@ping.linuxembedded.co.uk>","date":"2026-06-16T18:32:45","subject":"Re: [PATCH 04/10] ipa: ipu3: ccm: Add a Colour Correction Matrix\n\talgorithm","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Daniel Scally (2026-06-16 07:41:38)\n> Add a Colour Correction Matrix algorithm that uses the new libipa\n> implementation. The module isn't well documented in the kernel but\n> the default values from the driver suggest a Q3.13 format.\n> \n> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n> ---\n>  src/ipa/ipu3/algorithms/ccm.cpp     | 116 ++++++++++++++++++++++++++++++++++++\n>  src/ipa/ipu3/algorithms/ccm.h       |  43 +++++++++++++\n>  src/ipa/ipu3/algorithms/meson.build |   1 +\n>  src/ipa/ipu3/ipa_context.cpp        |  10 ++++\n>  src/ipa/ipu3/ipa_context.h          |   3 +\n>  5 files changed, 173 insertions(+)\n> \n> diff --git a/src/ipa/ipu3/algorithms/ccm.cpp b/src/ipa/ipu3/algorithms/ccm.cpp\n> new file mode 100644\n> index 0000000000000000000000000000000000000000..44b8c107b079c544c5afd1fce3cbe355f6dacd76\n> --- /dev/null\n> +++ b/src/ipa/ipu3/algorithms/ccm.cpp\n> @@ -0,0 +1,116 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2026, Ideas On Board\n> + *\n> + * IPU3 Colour correction matrix algorithm\n> + */\n> +\n> +#include \"ccm.h\"\n> +\n> +/**\n> + * \\file ccm.h\n> + */\n> +\n> +namespace libcamera {\n> +\n> +namespace ipa::ipu3::algorithms {\n> +\n> +/**\n> + * \\class Ccm\n> + * \\brief The IPU3 color correction matrix algorithm\n> + */\n> +\n> +LOG_DEFINE_CATEGORY(IPU3Ccm)\n> +\n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::init\n> + */\n> +int Ccm::init(IPAContext &context, const ValueNode &tuningData)\n> +{\n> +       return ccmAlgo_.init(tuningData, context.ctrlMap);\n> +}\n> +\n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::configure\n> + */\n> +int Ccm::configure(IPAContext &context,\n> +                  [[maybe_unused]] const IPAConfigInfo &configInfo)\n> +{\n> +       return ccmAlgo_.configure(context.activeState.ccm,\n> +                                 context.activeState.awb.automatic.temperatureK);\n> +}\n> +\n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::queueRequest\n> + */\n> +void Ccm::queueRequest(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n> +                      IPAFrameContext &frameContext,\n> +                      const ControlList &controls)\n> +{\n> +       /* Nothing to do here, the ccm will be calculated in prepare() */\n> +       if (frameContext.awb.autoEnabled)\n> +               return;\n> +\n> +       ccmAlgo_.queueRequest(context.activeState.ccm, frameContext.ccm, controls);\n> +}\n\nI still think it's awesome seeing how easy the implementations become\nwith the composition patterns here.\n\n\nI got to the bottom of the file with nothing else to add, so I've come\nback up here to say:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nWill be very interesting to see some calibration through the lightbox to\ntest this.\n\n\n\n> +\n> +void Ccm::setParameters(ipu3_uapi_params *params, IPAFrameContext &context)\n> +{\n> +       const Matrix<float, 3, 3> &matrix = context.ccm.ccm;\n> +       const Matrix<int16_t, 3, 1> &offsets = context.ccm.offsets;\n> +\n> +       params->use.acc_ccm = 1;\n> +\n> +       params->acc_param.ccm.coeff_m11 = Q<3, 13>(matrix[0][0]).quantized();\n> +       params->acc_param.ccm.coeff_m12 = Q<3, 13>(matrix[0][1]).quantized();\n> +       params->acc_param.ccm.coeff_m13 = Q<3, 13>(matrix[0][2]).quantized();\n> +       params->acc_param.ccm.coeff_o_r = offsets[0][0];\n> +\n> +       params->acc_param.ccm.coeff_m21 = Q<3, 13>(matrix[1][0]).quantized();\n> +       params->acc_param.ccm.coeff_m22 = Q<3, 13>(matrix[1][1]).quantized();\n> +       params->acc_param.ccm.coeff_m23 = Q<3, 13>(matrix[1][2]).quantized();\n> +       params->acc_param.ccm.coeff_o_g = offsets[1][0];\n> +\n> +       params->acc_param.ccm.coeff_m31 = Q<3, 13>(matrix[2][0]).quantized();\n> +       params->acc_param.ccm.coeff_m32 = Q<3, 13>(matrix[2][1]).quantized();\n> +       params->acc_param.ccm.coeff_m33 = Q<3, 13>(matrix[2][2]).quantized();\n> +       params->acc_param.ccm.coeff_o_b = offsets[2][0];\n> +\n> +       LOG(IPU3Ccm, Debug) << \"Setting matrix \" << matrix;\n> +       LOG(IPU3Ccm, Debug) << \"Setting offsets \" << offsets;\n> +}\n> +\n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::prepare\n> + */\n> +void Ccm::prepare(IPAContext &context, const uint32_t frame,\n> +                 IPAFrameContext &frameContext, ipu3_uapi_params *params)\n> +{\n> +       if (!frameContext.awb.autoEnabled) {\n> +               setParameters(params, frameContext);\n> +               return;\n> +       }\n> +\n> +       ccmAlgo_.prepare(context.activeState.ccm, frameContext.ccm, frame,\n> +                        frameContext.awb.temperatureK);\n> +\n> +       setParameters(params, frameContext);\n> +}\n> +\n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::process\n> + */\n> +void Ccm::process([[maybe_unused]] IPAContext &context,\n> +                 [[maybe_unused]] const uint32_t frame,\n> +                 IPAFrameContext &frameContext,\n> +                 [[maybe_unused]] const ipu3_uapi_stats_3a *stats,\n> +                 ControlList &metadata)\n> +{\n> +       ccmAlgo_.process(frameContext.ccm, metadata);\n> +}\n> +\n> +REGISTER_IPA_ALGORITHM(Ccm, \"Ccm\")\n> +\n> +} /* namespace ipa::ipu3::algorithms */\n> +\n> +} /* namespace libcamera */\n> diff --git a/src/ipa/ipu3/algorithms/ccm.h b/src/ipa/ipu3/algorithms/ccm.h\n> new file mode 100644\n> index 0000000000000000000000000000000000000000..39719c986267aff02e3129aad9dbe4baeec8f8a1\n> --- /dev/null\n> +++ b/src/ipa/ipu3/algorithms/ccm.h\n> @@ -0,0 +1,43 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2026, Ideas On Board\n> + *\n> + * IPU3 Colour correction matrix algorithm\n> + */\n> +\n> +#pragma once\n> +\n> +#include <linux/intel-ipu3.h>\n> +\n> +#include <libipa/ccm.h>\n> +#include <libipa/fixedpoint.h>\n> +\n> +#include \"algorithm.h\"\n> +\n> +namespace libcamera {\n> +\n> +namespace ipa::ipu3::algorithms {\n> +\n> +class Ccm : public Algorithm\n> +{\n> +public:\n> +       int init(IPAContext &context, const ValueNode &tuningData) override;\n> +       int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> +       void queueRequest(IPAContext &context, const uint32_t frame,\n> +                         IPAFrameContext &frameContext,\n> +                         const ControlList &controls) override;\n> +       void prepare(IPAContext &context, const uint32_t frame,\n> +                    IPAFrameContext &frameContext,\n> +                    ipu3_uapi_params *params) override;\n> +       void process(IPAContext &context, const uint32_t frame,\n> +                    IPAFrameContext &frameContext,\n> +                    const ipu3_uapi_stats_3a *stats,\n> +                    ControlList &metadata) override;\n> +\n> +private:\n> +       void setParameters(ipu3_uapi_params *params, IPAFrameContext &context);\n> +       CcmAlgorithm<Q<3, 13>> ccmAlgo_;\n> +};\n> +\n> +} /* namespace ipa::ipu3::algorithms */\n> +} /* namespace libcamera */\n> diff --git a/src/ipa/ipu3/algorithms/meson.build b/src/ipa/ipu3/algorithms/meson.build\n> index b70a551cacf6cbdedf3ab41771a34ddcdae9fd8b..3dafd2fda9897942cf87d9640665c4fcff383859 100644\n> --- a/src/ipa/ipu3/algorithms/meson.build\n> +++ b/src/ipa/ipu3/algorithms/meson.build\n> @@ -5,5 +5,6 @@ ipu3_ipa_algorithms = files([\n>      'agc.cpp',\n>      'awb.cpp',\n>      'blc.cpp',\n> +    'ccm.cpp',\n>      'tone_mapping.cpp',\n>  ])\n> diff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp\n> index b35c925d959027c540257e47944047c238f85571..dc43bc0877ed5c2e7287414e12667374f5ee1c80 100644\n> --- a/src/ipa/ipu3/ipa_context.cpp\n> +++ b/src/ipa/ipu3/ipa_context.cpp\n> @@ -114,6 +114,11 @@ namespace libcamera::ipa::ipu3 {\n>   * \\brief Active auto-white balance parameters for the IPA\n>   */\n>  \n> +/**\n> + * \\var IPAActiveState::ccm\n> + * \\brief Active colour Correction Matrix parameters for the IPA\n> + */\n> +\n>  /**\n>   * \\var IPASessionConfiguration::sensor\n>   * \\brief Sensor-specific configuration of the IPA\n> @@ -182,4 +187,9 @@ namespace libcamera::ipa::ipu3 {\n>   * \\brief Per-frame auto-white balance parameters for the IPA\n>   */\n>  \n> +/**\n> + * \\var IPAFrameContext::ccm\n> + * \\brief Per-frame colour Correction Matrix parameters for the IPA\n> + */\n> +\n>  } /* namespace libcamera::ipa::ipu3 */\n> diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h\n> index 245cf8b50b270a61df863e314128bede40d30541..be626d30d966b1bdaa322e5154f95f745f799976 100644\n> --- a/src/ipa/ipu3/ipa_context.h\n> +++ b/src/ipa/ipu3/ipa_context.h\n> @@ -16,6 +16,7 @@\n>  #include <libcamera/geometry.h>\n>  \n>  #include <libipa/awb.h>\n> +#include <libipa/ccm.h>\n>  #include <libipa/fc_queue.h>\n>  \n>  namespace libcamera {\n> @@ -64,6 +65,7 @@ struct IPAActiveState {\n>         } agc;\n>  \n>         ipa::awb::ActiveState awb;\n> +       ipa::ccm::ActiveState ccm;\n>  \n>         struct {\n>                 double gamma;\n> @@ -78,6 +80,7 @@ struct IPAFrameContext : public FrameContext {\n>         } sensor;\n>  \n>         ipa::awb::FrameContext awb;\n> +       ipa::ccm::FrameContext ccm;\n>  };\n>  \n>  struct IPAContext {\n> \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 E3806C3261\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 16 Jun 2026 18:32:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2CB7C626D7;\n\tTue, 16 Jun 2026 20:32:49 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B698D623CC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Jun 2026 20:32:47 +0200 (CEST)","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 0E9C62EC;\n\tTue, 16 Jun 2026 20:32:13 +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=\"hjAYvEHn\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1781634734;\n\tbh=5bobp9Mq833vRFG5GYYm7CDbNbpPAOPgj777Zkxxqes=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=hjAYvEHnLoZigI8QBApdlsEDc70S/CBopj+i6G02AFkbriArfj0QEgII5ulNpUAKU\n\tHRHE7oGS4GpCU+kKzpTFACOEEEyMhUQV8dNZULffe7BYJRIe4F5DxtcoYSShmkldSm\n\t6PsMGF0DPlcfMyn0d0a984xKzjN77ClF8hGhfqMs=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20260616-ipu3-libipa-rework-v1-4-d4448b54f1d8@ideasonboard.com>","References":"<20260616-ipu3-libipa-rework-v1-0-d4448b54f1d8@ideasonboard.com>\n\t<20260616-ipu3-libipa-rework-v1-4-d4448b54f1d8@ideasonboard.com>","Subject":"Re: [PATCH 04/10] ipa: ipu3: ccm: Add a Colour Correction Matrix\n\talgorithm","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Daniel Scally <dan.scally@ideasonboard.com>","To":"Daniel Scally <dan.scally@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 16 Jun 2026 19:32:45 +0100","Message-ID":"<178163476501.3598163.912467653931436992@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":39150,"web_url":"https://patchwork.libcamera.org/comment/39150/","msgid":"<ajJc3DHrRvCETAN7@zed>","date":"2026-06-17T08:43:24","subject":"Re: [PATCH 04/10] ipa: ipu3: ccm: Add a Colour Correction Matrix\n\talgorithm","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Dan\n\nOn Tue, Jun 16, 2026 at 07:41:38AM +0100, Daniel Scally wrote:\n> Add a Colour Correction Matrix algorithm that uses the new libipa\n> implementation. The module isn't well documented in the kernel but\n> the default values from the driver suggest a Q3.13 format.\n>\n> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n> ---\n>  src/ipa/ipu3/algorithms/ccm.cpp     | 116 ++++++++++++++++++++++++++++++++++++\n>  src/ipa/ipu3/algorithms/ccm.h       |  43 +++++++++++++\n>  src/ipa/ipu3/algorithms/meson.build |   1 +\n>  src/ipa/ipu3/ipa_context.cpp        |  10 ++++\n>  src/ipa/ipu3/ipa_context.h          |   3 +\n>  5 files changed, 173 insertions(+)\n>\n> diff --git a/src/ipa/ipu3/algorithms/ccm.cpp b/src/ipa/ipu3/algorithms/ccm.cpp\n> new file mode 100644\n> index 0000000000000000000000000000000000000000..44b8c107b079c544c5afd1fce3cbe355f6dacd76\n> --- /dev/null\n> +++ b/src/ipa/ipu3/algorithms/ccm.cpp\n> @@ -0,0 +1,116 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2026, Ideas On Board\n> + *\n> + * IPU3 Colour correction matrix algorithm\n> + */\n> +\n> +#include \"ccm.h\"\n> +\n> +/**\n> + * \\file ccm.h\n> + */\n> +\n> +namespace libcamera {\n> +\n> +namespace ipa::ipu3::algorithms {\n> +\n> +/**\n> + * \\class Ccm\n> + * \\brief The IPU3 color correction matrix algorithm\n> + */\n> +\n> +LOG_DEFINE_CATEGORY(IPU3Ccm)\n> +\n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::init\n> + */\n> +int Ccm::init(IPAContext &context, const ValueNode &tuningData)\n> +{\n> +\treturn ccmAlgo_.init(tuningData, context.ctrlMap);\n> +}\n> +\n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::configure\n> + */\n> +int Ccm::configure(IPAContext &context,\n> +\t\t   [[maybe_unused]] const IPAConfigInfo &configInfo)\n> +{\n> +\treturn ccmAlgo_.configure(context.activeState.ccm,\n> +\t\t\t\t  context.activeState.awb.automatic.temperatureK);\n> +}\n> +\n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::queueRequest\n> + */\n> +void Ccm::queueRequest(IPAContext &context, [[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::setParameters(ipu3_uapi_params *params, IPAFrameContext &context)\n> +{\n> +\tconst Matrix<float, 3, 3> &matrix = context.ccm.ccm;\n> +\tconst Matrix<int16_t, 3, 1> &offsets = context.ccm.offsets;\n> +\n> +\tparams->use.acc_ccm = 1;\n> +\n> +\tparams->acc_param.ccm.coeff_m11 = Q<3, 13>(matrix[0][0]).quantized();\n> +\tparams->acc_param.ccm.coeff_m12 = Q<3, 13>(matrix[0][1]).quantized();\n> +\tparams->acc_param.ccm.coeff_m13 = Q<3, 13>(matrix[0][2]).quantized();\n> +\tparams->acc_param.ccm.coeff_o_r = offsets[0][0];\n> +\n> +\tparams->acc_param.ccm.coeff_m21 = Q<3, 13>(matrix[1][0]).quantized();\n> +\tparams->acc_param.ccm.coeff_m22 = Q<3, 13>(matrix[1][1]).quantized();\n> +\tparams->acc_param.ccm.coeff_m23 = Q<3, 13>(matrix[1][2]).quantized();\n> +\tparams->acc_param.ccm.coeff_o_g = offsets[1][0];\n> +\n> +\tparams->acc_param.ccm.coeff_m31 = Q<3, 13>(matrix[2][0]).quantized();\n> +\tparams->acc_param.ccm.coeff_m32 = Q<3, 13>(matrix[2][1]).quantized();\n> +\tparams->acc_param.ccm.coeff_m33 = Q<3, 13>(matrix[2][2]).quantized();\n> +\tparams->acc_param.ccm.coeff_o_b = offsets[2][0];\n> +\n> +\tLOG(IPU3Ccm, Debug) << \"Setting matrix \" << matrix;\n> +\tLOG(IPU3Ccm, Debug) << \"Setting offsets \" << offsets;\n> +}\n> +\n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::prepare\n> + */\n> +void Ccm::prepare(IPAContext &context, const uint32_t frame,\n> +\t\t  IPAFrameContext &frameContext, ipu3_uapi_params *params)\n> +{\n> +\tif (!frameContext.awb.autoEnabled) {\n> +\t\tsetParameters(params, frameContext);\n> +\t\treturn;\n> +\t}\n> +\n> +\tccmAlgo_.prepare(context.activeState.ccm, frameContext.ccm, frame,\n> +\t\t\t frameContext.awb.temperatureK);\n> +\n> +\tsetParameters(params, frameContext);\n> +}\n> +\n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::process\n> + */\n> +void Ccm::process([[maybe_unused]] IPAContext &context,\n> +\t\t  [[maybe_unused]] const uint32_t frame,\n> +\t\t  IPAFrameContext &frameContext,\n> +\t\t  [[maybe_unused]] const ipu3_uapi_stats_3a *stats,\n> +\t\t  ControlList &metadata)\n> +{\n> +\tccmAlgo_.process(frameContext.ccm, metadata);\n> +}\n> +\n> +REGISTER_IPA_ALGORITHM(Ccm, \"Ccm\")\n> +\n> +} /* namespace ipa::ipu3::algorithms */\n> +\n> +} /* namespace libcamera */\n\nsplendid!\n\n> diff --git a/src/ipa/ipu3/algorithms/ccm.h b/src/ipa/ipu3/algorithms/ccm.h\n> new file mode 100644\n> index 0000000000000000000000000000000000000000..39719c986267aff02e3129aad9dbe4baeec8f8a1\n> --- /dev/null\n> +++ b/src/ipa/ipu3/algorithms/ccm.h\n> @@ -0,0 +1,43 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2026, Ideas On Board\n> + *\n> + * IPU3 Colour correction matrix algorithm\n> + */\n> +\n> +#pragma once\n> +\n> +#include <linux/intel-ipu3.h>\n\nMissing includes for ControlList and ValueNode\n\n#include <libcamera/controls.h>\n\n#include \"libcamera/internal/value_node.h\"\n\n> +\n> +#include <libipa/ccm.h>\n> +#include <libipa/fixedpoint.h>\n> +\n> +#include \"algorithm.h\"\n\nMissing include for IPAContext\n\n#include \"ipa_context.h\"\n\nPlease check the same includes are there in awb.h from the previous\npatch\n\n> +\n> +namespace libcamera {\n> +\n> +namespace ipa::ipu3::algorithms {\n> +\n> +class Ccm : public Algorithm\n> +{\n> +public:\n> +\tint init(IPAContext &context, const ValueNode &tuningData) override;\n> +\tint configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> +\tvoid queueRequest(IPAContext &context, const uint32_t frame,\n> +\t\t\t  IPAFrameContext &frameContext,\n> +\t\t\t  const ControlList &controls) override;\n> +\tvoid prepare(IPAContext &context, const uint32_t frame,\n> +\t\t     IPAFrameContext &frameContext,\n> +\t\t     ipu3_uapi_params *params) override;\n> +\tvoid process(IPAContext &context, const uint32_t frame,\n> +\t\t     IPAFrameContext &frameContext,\n> +\t\t     const ipu3_uapi_stats_3a *stats,\n> +\t\t     ControlList &metadata) override;\n> +\n> +private:\n> +\tvoid setParameters(ipu3_uapi_params *params, IPAFrameContext &context);\n> +\tCcmAlgorithm<Q<3, 13>> ccmAlgo_;\n> +};\n> +\n> +} /* namespace ipa::ipu3::algorithms */\n> +} /* namespace libcamera */\n> diff --git a/src/ipa/ipu3/algorithms/meson.build b/src/ipa/ipu3/algorithms/meson.build\n> index b70a551cacf6cbdedf3ab41771a34ddcdae9fd8b..3dafd2fda9897942cf87d9640665c4fcff383859 100644\n> --- a/src/ipa/ipu3/algorithms/meson.build\n> +++ b/src/ipa/ipu3/algorithms/meson.build\n> @@ -5,5 +5,6 @@ ipu3_ipa_algorithms = files([\n>      'agc.cpp',\n>      'awb.cpp',\n>      'blc.cpp',\n> +    'ccm.cpp',\n>      'tone_mapping.cpp',\n>  ])\n> diff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp\n> index b35c925d959027c540257e47944047c238f85571..dc43bc0877ed5c2e7287414e12667374f5ee1c80 100644\n> --- a/src/ipa/ipu3/ipa_context.cpp\n> +++ b/src/ipa/ipu3/ipa_context.cpp\n> @@ -114,6 +114,11 @@ namespace libcamera::ipa::ipu3 {\n>   * \\brief Active auto-white balance parameters for the IPA\n>   */\n>\n> +/**\n> + * \\var IPAActiveState::ccm\n> + * \\brief Active colour Correction Matrix parameters for the IPA\n> + */\n> +\n>  /**\n>   * \\var IPASessionConfiguration::sensor\n>   * \\brief Sensor-specific configuration of the IPA\n> @@ -182,4 +187,9 @@ namespace libcamera::ipa::ipu3 {\n>   * \\brief Per-frame auto-white balance parameters for the IPA\n>   */\n>\n> +/**\n> + * \\var IPAFrameContext::ccm\n> + * \\brief Per-frame colour Correction Matrix parameters for the IPA\n> + */\n> +\n>  } /* namespace libcamera::ipa::ipu3 */\n> diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h\n> index 245cf8b50b270a61df863e314128bede40d30541..be626d30d966b1bdaa322e5154f95f745f799976 100644\n> --- a/src/ipa/ipu3/ipa_context.h\n> +++ b/src/ipa/ipu3/ipa_context.h\n> @@ -16,6 +16,7 @@\n>  #include <libcamera/geometry.h>\n>\n>  #include <libipa/awb.h>\n> +#include <libipa/ccm.h>\n>  #include <libipa/fc_queue.h>\n>\n>  namespace libcamera {\n> @@ -64,6 +65,7 @@ struct IPAActiveState {\n>  \t} agc;\n>\n>  \tipa::awb::ActiveState awb;\n> +\tipa::ccm::ActiveState ccm;\n>\n>  \tstruct {\n>  \t\tdouble gamma;\n> @@ -78,6 +80,7 @@ struct IPAFrameContext : public FrameContext {\n>  \t} sensor;\n>\n>  \tipa::awb::FrameContext awb;\n> +\tipa::ccm::FrameContext ccm;\n>  };\n>\n>  struct IPAContext {\n>\n\nShip it!\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nThanks\n  j\n\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 A9037BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 17 Jun 2026 08:43:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A452962728;\n\tWed, 17 Jun 2026 10:43:29 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9496A60579\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Jun 2026 10:43:28 +0200 (CEST)","from ideasonboard.com (mob-109-113-4-199.net.vodafone.it\n\t[109.113.4.199])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 138D5227;\n\tWed, 17 Jun 2026 10:42:53 +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=\"cKurXL/g\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1781685774;\n\tbh=rjAAEmiBFOnKuTSaMCMcBmCy2pjv0JCo4cYNUbd1dj8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=cKurXL/gV06eLq2dFnBe74Ib6xPeuFdY9YF5W5oxwVjnmfQYfugn+C3vaSFt22WHA\n\tRx8Xwrj9pMxnO5Dkx5eo/Xk5JOpGemd6JjfcL/JkBzVpr9DEM0yaX+BqR+/iZ9+UWB\n\tSB+uMFPiBEYxjKxdZY35E4kX6xESxo2mNNalCp5c=","Date":"Wed, 17 Jun 2026 10:43:24 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Daniel Scally <dan.scally@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH 04/10] ipa: ipu3: ccm: Add a Colour Correction Matrix\n\talgorithm","Message-ID":"<ajJc3DHrRvCETAN7@zed>","References":"<20260616-ipu3-libipa-rework-v1-0-d4448b54f1d8@ideasonboard.com>\n\t<20260616-ipu3-libipa-rework-v1-4-d4448b54f1d8@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20260616-ipu3-libipa-rework-v1-4-d4448b54f1d8@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>"}}]