Show a patch.

GET /api/1.1/patches/27267/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 27267,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/27267/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/27267/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20260708-libipa-algorithms-v4-2-f0e99f035294@ideasonboard.com>",
    "date": "2026-07-08T09:24:49",
    "name": "[v4,02/35] ipa: mali-c55: awb: Port to use libipa AwbAlgorithm",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "2e98c4a36ddb41d8aa950eb972381b57d9747863",
    "submitter": {
        "id": 143,
        "url": "https://patchwork.libcamera.org/api/1.1/people/143/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo.mondi@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/27267/mbox/",
    "series": [
        {
            "id": 6046,
            "url": "https://patchwork.libcamera.org/api/1.1/series/6046/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6046",
            "date": "2026-07-08T09:24:47",
            "name": "ipa: libipa: Introduce libipa algorithms",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/6046/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/27267/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/27267/checks/",
    "tags": {},
    "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 337BBC3301\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  8 Jul 2026 09:25:16 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 60F886608E;\n\tWed,  8 Jul 2026 11:25:08 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D80B866074\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Jul 2026 11:25:05 +0200 (CEST)",
            "from [192.168.1.182] (93-46-82-201.ip106.fastwebnet.it\n\t[93.46.82.201])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0BD701AC5;\n\tWed,  8 Jul 2026 11:24:16 +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=\"q4Np5vmO\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783502656;\n\tbh=dhl5gblzCqtHc/mQBW5GOxetdk2axICofVb774mO1ss=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=q4Np5vmOkx7FYsleGiAQpDXJg3RZ1GHl/OADFVjehNADLpCIgz0BiEZgN0P+iMGcw\n\tQPdMFkt9283AzCTzaa2nBreuTiJisJmi/jhJmEm9IUziT756RTEjo4zhQ79jNy53SY\n\to8/gQz3AqFXC1tNE4Y7ldW3u2ri7/JXLl0DZkEI8=",
        "From": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>",
        "Date": "Wed, 08 Jul 2026 11:24:49 +0200",
        "Subject": "[PATCH v4 02/35] ipa: mali-c55: awb: Port to use libipa AwbAlgorithm",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "Message-Id": "<20260708-libipa-algorithms-v4-2-f0e99f035294@ideasonboard.com>",
        "References": "<20260708-libipa-algorithms-v4-0-f0e99f035294@ideasonboard.com>",
        "In-Reply-To": "<20260708-libipa-algorithms-v4-0-f0e99f035294@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org, \n\tStefan Klug <stefan.klug@ideasonboard.com>",
        "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>, \n\tKieran Bingham <kieran.bingham@ideasonboard.com>, \n\tDaniel Scally <dan.scally@ideasonboard.com>",
        "X-Mailer": "b4 0.14.3",
        "X-Developer-Signature": "v=1; a=openpgp-sha256; l=13303;\n\ti=jacopo.mondi@ideasonboard.com; h=from:subject:message-id;\n\tbh=dhl5gblzCqtHc/mQBW5GOxetdk2axICofVb774mO1ss=;\n\tb=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqThdsWFkM2wWLrvyLkyigqojFmaXnG+ANOEKMw\n\txYC8uB64qqJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCak4XbAAKCRByNAaPFqFW\n\tPBmmEAC/TrsB6CLJhVQx7Kef5tlNP4/H3hgXgP1LST3lhqLOzz3MmXwndm8XeStWnRFnvV98AQ1\n\twDBnW7nW/M4fKRfTKIzXoxVD3PbgpY0mM/s/6kZ2jy7iUtEvVhfpIEyEWgEcx90NSrEl5eGXAAe\n\tYTTnCAfCI62Yo6o/SXpbCFIbRyYbRMbBKELUCNc1IX/Zfv6CAEN6uXTo3oCm3zuzVEHWs0W1lHX\n\tCoJMKufeY1LgfPxS7iPdkSO1zmpihnIyn5g9JlsWTCWSbz2OjiUoEqaAaV3jhS7KFteRCspOU1U\n\tAUCUlh+o2eG0Y3fUovToOnQ7mU1Ez2Ht1BxeUnFcXNMeVO2AHMRhpEeDzKH7oz5sIH7BTGwZioD\n\tWHD3yhhjooHi16Q6jUXEWWs3nZlLiUns5rRwLeqjzI+/kNUtoVNy1gBpv0Tj7gVpBSon/CTPyrY\n\tsU3zGLUP2Oudlg3Rba2uv8+wVdaIG/zETHCjBfNIRLcOTMcFc9cpzDMkPC7Z7xUlHhT0/twYy+x\n\toAHF19O8mP8Vj0qnQnliB5Z18pteogrFdlv6jaF9fPkmaZ6+9OrMElJk5wOtPxxPZ91vtFB7JYE\n\tOpKk+AZmzytkZL54b7CvNhDKZYCMI6Zg/WVBOkOysIxsqmadIaMFDKA3vXlheYhGQeDyOAdSDEd\n\tTbauGq7lT36Cbjw==",
        "X-Developer-Key": "i=jacopo.mondi@ideasonboard.com; a=openpgp;\n\tfpr=72392EDC88144A65C701EA9BA5826A2587AD026B",
        "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>"
    },
    "content": "Port the Mali-C55 Awb algorithm to use the new libipa implementation\nof AwbAlgorithm.\n\nThe awbAlgo_ class member is initialized with the Q<4, 8> type that\nrepresents the register format and the MaliC55AwbStats type handles\nthe WB statistics format as produced by the Mali-C55 which already\ncalculates the mean values as R/G and B/G values.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\nTested-by: Daniel Scally <dan.scally@ideasonboard.com>\n---\n src/ipa/mali-c55/algorithms/awb.cpp | 223 +++++++++++++++++++++---------------\n src/ipa/mali-c55/algorithms/awb.h   |  28 ++++-\n src/ipa/mali-c55/ipa_context.cpp    |   3 +\n src/ipa/mali-c55/ipa_context.h      |  11 +-\n 4 files changed, 157 insertions(+), 108 deletions(-)",
    "diff": "diff --git a/src/ipa/mali-c55/algorithms/awb.cpp b/src/ipa/mali-c55/algorithms/awb.cpp\nindex 8a671b52be59..353a9f0d3f97 100644\n--- a/src/ipa/mali-c55/algorithms/awb.cpp\n+++ b/src/ipa/mali-c55/algorithms/awb.cpp\n@@ -2,7 +2,7 @@\n /*\n  * Copyright (C) 2024, Ideas On Board Oy\n  *\n- * Mali C55 grey world auto white balance algorithm\n+ * Mali C55 auto white balance algorithm\n  */\n \n #include \"awb.h\"\n@@ -14,60 +14,91 @@\n \n #include <libcamera/control_ids.h>\n \n-#include \"libipa/fixedpoint.h\"\n-\n namespace libcamera {\n \n namespace ipa::mali_c55::algorithms {\n \n LOG_DEFINE_CATEGORY(MaliC55Awb)\n \n-/* Number of frames at which we should run AWB at full speed */\n-static constexpr uint32_t kNumStartupFrames = 4;\n+/* \\todo Mali-C55 doesn't support the Lux algorithm. */\n+static constexpr unsigned int kDefaultLux = 500;\n \n-Awb::Awb()\n+class MaliC55AwbStats final : public AwbStats\n {\n+public:\n+\tMaliC55AwbStats() = default;\n+\tMaliC55AwbStats(const RGB<double> &rgbMeans)\n+\t{\n+\t\t/* The Mali-C55 ISP already provides stats as R/G and B/G ratios. */\n+\n+\t\trgbMeans_[0] = rgbMeans.r() * rgbMeans.g();\n+\t\trgbMeans_[1] = 1.0;\n+\t\trgbMeans_[2] = rgbMeans.b() * rgbMeans.g();\n+\n+\t\trg_ = rgbMeans_.r();\n+\t\tbg_ = rgbMeans_.b();\n+\t}\n+\n+\tdouble computeColourError(const RGB<double> &gains) const override\n+\t{\n+\t\t/*\n+\t\t * Compute the sum of the squared colour error (non-greyness) as\n+\t\t * it appears in the log likelihood equation.\n+\t\t */\n+\t\tdouble deltaR = gains.r() * rg_ - 1.0;\n+\t\tdouble deltaB = gains.b() * bg_ - 1.0;\n+\t\tdouble delta2 = deltaR * deltaR + deltaB * deltaB;\n+\n+\t\treturn delta2;\n+\t}\n+\n+\tRGB<double> rgbMeans() const override\n+\t{\n+\t\treturn rgbMeans_;\n+\t}\n+\n+\tbool valid() const override\n+\t{\n+\t\t/* Minimum mean value below which AWB can't operate. */\n+\t\tconstexpr double minValue = 0.2;\n+\n+\t\treturn rgbMeans_.r() > minValue || rgbMeans_.g() > minValue ||\n+\t\t       rgbMeans_.b() > minValue;\n+\t}\n+\n+private:\n+\tRGB<double> rgbMeans_;\n+\tdouble rg_;\n+\tdouble bg_;\n+};\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::init\n+ */\n+int Awb::init(IPAContext &context, const ValueNode &tuningData)\n+{\n+\treturn awbAlgo_.init(tuningData, context.ctrlMap);\n }\n \n-int Awb::configure([[maybe_unused]] IPAContext &context,\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::configure\n+ */\n+int Awb::configure(IPAContext &context,\n \t\t   [[maybe_unused]] const IPACameraSensorInfo &configInfo)\n {\n-\t/*\n-\t * Initially we have no idea what the colour balance will be like, so\n-\t * for the first frame we will make no assumptions and leave the R/B\n-\t * channels unmodified.\n-\t */\n-\tcontext.activeState.awb.rGain = 1.0f;\n-\tcontext.activeState.awb.bGain = 1.0f;\n-\n-\treturn 0;\n+\treturn awbAlgo_.configure(context.activeState.awb);\n }\n \n-void Awb::fillGainsParamBlock(MaliC55Params *params, IPAContext &context,\n-\t\t\t\tIPAFrameContext &frameContext)\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::queueRequest\n+ */\n+void Awb::queueRequest(IPAContext &context,\n+\t\t       const uint32_t frame,\n+\t\t       IPAFrameContext &frameContext,\n+\t\t       const ControlList &controls)\n {\n-\tUQ<4, 8> rGain = context.activeState.awb.rGain;\n-\tUQ<4, 8> bGain = context.activeState.awb.bGain;\n-\n-\t/*\n-\t * The gains here map as follows:\n-\t *\tgain00 = R\n-\t *\tgain01 = Gr\n-\t *\tgain10 = Gb\n-\t *\tgain11 = B\n-\t *\n-\t * This holds true regardless of the bayer order of the input data, as\n-\t * the mapping is done internally in the ISP.\n-\t */\n-\tauto block = params->block<MaliC55Blocks::AwbGains>();\n-\n-\tblock->gain00 = rGain.quantized();\n-\tblock->gain01 = UQ<4, 8>(1.0f).quantized();\n-\tblock->gain10 = UQ<4, 8>(1.0f).quantized();\n-\tblock->gain11 = bGain.quantized();\n-\n-\tframeContext.awb.rGain = rGain;\n-\tframeContext.awb.bGain = bGain;\n+\tawbAlgo_.queueRequest(context.activeState.awb, frame, frameContext.awb,\n+\t\t\t      controls);\n }\n \n void Awb::fillConfigParamBlock(MaliC55Params *params)\n@@ -117,10 +148,33 @@ void Awb::fillConfigParamBlock(MaliC55Params *params)\n \tblock->cb_low = 64;\n }\n \n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::prepare\n+ */\n void Awb::prepare(IPAContext &context, const uint32_t frame,\n \t\t  IPAFrameContext &frameContext, MaliC55Params *params)\n {\n-\tfillGainsParamBlock(params, context, frameContext);\n+\tawbAlgo_.prepare(context.activeState.awb, frameContext.awb);\n+\n+\t/*\n+\t * The gains here map as follows:\n+\t *\tgain00 = R\n+\t *\tgain01 = Gr\n+\t *\tgain10 = Gb\n+\t *\tgain11 = B\n+\t *\n+\t * This holds true regardless of the bayer order of the input data, as\n+\t * the mapping is done internally in the ISP.\n+\t */\n+\tauto block = params->block<MaliC55Blocks::AwbGains>();\n+\tblock.setEnabled(true);\n+\n+\tblock->gain00 = UQ<4, 8>(static_cast<float>(frameContext.awb.gains.r()))\n+\t\t\t\t.quantized();\n+\tblock->gain01 = UQ<4, 8>(1.0f).quantized();\n+\tblock->gain10 = UQ<4, 8>(1.0f).quantized();\n+\tblock->gain11 = UQ<4, 8>(static_cast<float>(frameContext.awb.gains.b()))\n+\t\t\t\t.quantized();\n \n \tif (frame > 0)\n \t\treturn;\n@@ -128,45 +182,43 @@ void Awb::prepare(IPAContext &context, const uint32_t frame,\n \tfillConfigParamBlock(params);\n }\n \n-void Awb::process(IPAContext &context, const uint32_t frame,\n-\t\t  IPAFrameContext &frameContext, const mali_c55_stats_buffer *stats,\n-\t\t  [[maybe_unused]] ControlList &metadata)\n+MaliC55AwbStats Awb::calculateRgbMeans(const IPAFrameContext &frameContext,\n+\t\t\t\t       const mali_c55_stats_buffer *stats) const\n {\n-\tconst struct mali_c55_awb_average_ratios *awb_ratios = stats->awb_ratios;\n+\tconst struct mali_c55_awb_average_ratios *awb = stats->awb_ratios;\n \n \t/*\n \t * The ISP produces average R:G and B:G ratios for zones. We take the\n-\t * average of all the zones with data and simply invert them to provide\n-\t * gain figures that we can apply to approximate a grey world.\n+\t * average of all the zones with data and calculate the mean values.\n \t */\n-\tunsigned int counted_zones = 0;\n-\tfloat rgSum = 0, bgSum = 0;\n+\tunsigned int active_zones = 0;\n+\tdouble rgSum = 0, bgSum = 0;\n \n \tfor (unsigned int i = 0; i < 225; i++) {\n-\t\tif (!awb_ratios[i].num_pixels)\n+\t\tif (!awb[i].num_pixels)\n \t\t\tcontinue;\n \n \t\t/*\n-\t\t * The statistics are in Q4.8 format, so we convert to float\n+\t\t * The statistics are in Q4.8 format, so we convert to double\n \t\t * here.\n \t\t */\n-\t\trgSum += UQ<4, 8>(awb_ratios[i].avg_rg_gr).value();\n-\t\tbgSum += UQ<4, 8>(awb_ratios[i].avg_bg_br).value();\n-\t\tcounted_zones++;\n+\t\trgSum += UQ<4, 8>(awb[i].avg_rg_gr).value();\n+\t\tbgSum += UQ<4, 8>(awb[i].avg_bg_br).value();\n+\t\tactive_zones++;\n \t}\n \n \t/*\n \t * Sometimes the first frame's statistics have no valid pixels, in which\n \t * case we'll just assume a grey world until they say otherwise.\n \t */\n-\tfloat rgAvg, bgAvg;\n-\tif (!counted_zones) {\n-\t\trgAvg = 1.0;\n-\t\tbgAvg = 1.0;\n-\t} else {\n-\t\trgAvg = rgSum / counted_zones;\n-\t\tbgAvg = bgSum / counted_zones;\n-\t}\n+\tif (!active_zones)\n+\t\treturn {};\n+\n+\tRGB<double> rgbMeans = { {\n+\t\trgSum / active_zones,\n+\t\t1.0,\n+\t\tbgSum / active_zones,\n+\t} };\n \n \t/*\n \t * The statistics are generated _after_ white balancing is performed in\n@@ -174,41 +226,22 @@ void Awb::process(IPAContext &context, const uint32_t frame,\n \t * figure by the gains that were applied when the statistics for this\n \t * frame were generated.\n \t */\n-\tfloat rRatio = rgAvg / frameContext.awb.rGain.value();\n-\tfloat bRatio = bgAvg / frameContext.awb.bGain.value();\n+\trgbMeans /= frameContext.awb.gains.max(0.01);\n \n-\t/*\n-\t * And then we can simply invert the ratio to find the gain we should\n-\t * apply.\n-\t */\n-\tfloat rGain = 1 / rRatio;\n-\tfloat bGain = 1 / bRatio;\n+\treturn MaliC55AwbStats(rgbMeans);\n+}\n \n-\t/*\n-\t * Running at full speed, this algorithm results in oscillations in the\n-\t * colour balance. To remove those we dampen the speed at which it makes\n-\t * changes in gain, unless we're in the startup phase in which case we\n-\t * want to fix the miscolouring as quickly as possible.\n-\t */\n-\tfloat speed = frame < kNumStartupFrames ? 1.0f : 0.2f;\n-\trGain = speed * rGain + context.activeState.awb.rGain.value() * (1.0f - speed);\n-\tbGain = speed * bGain + context.activeState.awb.bGain.value() * (1.0f - speed);\n-\n-\tcontext.activeState.awb.rGain = rGain;\n-\tcontext.activeState.awb.bGain = bGain;\n-\n-\tmetadata.set(controls::ColourGains, {\n-\t\tframeContext.awb.rGain.value(),\n-\t\tframeContext.awb.bGain.value(),\n-\t});\n-\n-\tLOG(MaliC55Awb, Debug) << \"For frame number \" << frame << \": \"\n-\t\t<< \"Average R/G Ratio: \" << rgAvg\n-\t\t<< \", Average B/G Ratio: \" << bgAvg\n-\t\t<< \"\\nrGain applied to this frame: \" << frameContext.awb.rGain\n-\t\t<< \", bGain applied to this frame: \" << frameContext.awb.bGain\n-\t\t<< \"\\nrGain to apply: \" << context.activeState.awb.rGain\n-\t\t<< \", bGain to apply: \" << context.activeState.awb.bGain;\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::process\n+ */\n+void Awb::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n+\t\t  IPAFrameContext &frameContext, const mali_c55_stats_buffer *stats,\n+\t\t  ControlList &metadata)\n+{\n+\tMaliC55AwbStats awbStats = calculateRgbMeans(frameContext, stats);\n+\n+\tawbAlgo_.process(context.activeState.awb, frameContext.awb, awbStats,\n+\t\t\t kDefaultLux, metadata);\n }\n \n REGISTER_IPA_ALGORITHM(Awb, \"Awb\")\ndiff --git a/src/ipa/mali-c55/algorithms/awb.h b/src/ipa/mali-c55/algorithms/awb.h\nindex 683a62af263a..4be7a5917ac5 100644\n--- a/src/ipa/mali-c55/algorithms/awb.h\n+++ b/src/ipa/mali-c55/algorithms/awb.h\n@@ -2,24 +2,41 @@\n /*\n  * Copyright (C) 2024, Ideas on Board Oy\n  *\n- * Mali C55 grey world auto white balance algorithm\n+ * Mali C55 auto white balance algorithm\n  */\n \n+#pragma once\n+\n+#include <linux/media/arm/mali-c55-config.h>\n+\n+#include <libcamera/controls.h>\n+\n+#include \"libcamera/internal/value_node.h\"\n+\n+#include \"libipa/awb.h\"\n+#include \"libipa/fixedpoint.h\"\n+\n #include \"algorithm.h\"\n #include \"ipa_context.h\"\n+#include \"params.h\"\n \n namespace libcamera {\n \n namespace ipa::mali_c55::algorithms {\n \n+class MaliC55AwbStats;\n+\n class Awb : public Algorithm\n {\n public:\n-\tAwb();\n \t~Awb() = default;\n \n+\tint init(IPAContext &context, const ValueNode &tuningData) override;\n \tint configure(IPAContext &context,\n \t\t      const IPACameraSensorInfo &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     MaliC55Params *params) override;\n@@ -29,10 +46,11 @@ public:\n \t\t     ControlList &metadata) override;\n \n private:\n-\tvoid fillGainsParamBlock(MaliC55Params *params,\n-\t\t\t\t IPAContext &context,\n-\t\t\t\t IPAFrameContext &frameContext);\n \tvoid fillConfigParamBlock(MaliC55Params *params);\n+\tMaliC55AwbStats calculateRgbMeans(const IPAFrameContext &frameContext,\n+\t\t\t\t\t  const mali_c55_stats_buffer *stats) const;\n+\n+\tAwbAlgorithm<UQ<4, 8>> awbAlgo_;\n };\n \n } /* namespace ipa::mali_c55::algorithms */\ndiff --git a/src/ipa/mali-c55/ipa_context.cpp b/src/ipa/mali-c55/ipa_context.cpp\nindex 1b203e2b2605..74f1bd5323de 100644\n--- a/src/ipa/mali-c55/ipa_context.cpp\n+++ b/src/ipa/mali-c55/ipa_context.cpp\n@@ -96,6 +96,9 @@ namespace libcamera::ipa::mali_c55 {\n  *\n  * \\var IPAContext::frameContexts\n  * \\brief Ring buffer of per-frame contexts\n+ *\n+ * \\var IPAContext::ctrlMap\n+ * \\brief A ControlInfoMap::Map of controls populated by the algorithms\n  */\n \n } /* namespace libcamera::ipa::mali_c55 */\ndiff --git a/src/ipa/mali-c55/ipa_context.h b/src/ipa/mali-c55/ipa_context.h\nindex ac4b83773803..7dc765a3542b 100644\n--- a/src/ipa/mali-c55/ipa_context.h\n+++ b/src/ipa/mali-c55/ipa_context.h\n@@ -14,6 +14,7 @@\n \n #include <libipa/fc_queue.h>\n \n+#include \"libipa/awb.h\"\n #include \"libipa/fixedpoint.h\"\n \n namespace libcamera {\n@@ -54,10 +55,7 @@ struct IPAActiveState {\n \t\tuint32_t temperatureK;\n \t} agc;\n \n-\tstruct {\n-\t\tUQ<4, 8> rGain;\n-\t\tUQ<4, 8> bGain;\n-\t} awb;\n+\tipa::awb::ActiveState awb;\n };\n \n struct IPAFrameContext : public FrameContext {\n@@ -67,10 +65,7 @@ struct IPAFrameContext : public FrameContext {\n \t\tUQ<5, 8> ispGain;\n \t} agc;\n \n-\tstruct {\n-\t\tUQ<4, 8> rGain;\n-\t\tUQ<4, 8> bGain;\n-\t} awb;\n+\tipa::awb::FrameContext awb;\n };\n \n struct IPAContext {\n",
    "prefixes": [
        "v4",
        "02/35"
    ]
}