Show a patch.

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

{
    "id": 27063,
    "url": "https://patchwork.libcamera.org/api/patches/27063/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/27063/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20260626-ipu3-libipa-rework-v2-3-41546e23de3e@ideasonboard.com>",
    "date": "2026-06-26T13:05:50",
    "name": "[v2,03/12] ipa: ipu3: Convert from separate gains to RGB<double> in AGC",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "37aa114df4e43aeb5a43289907af0668676974d2",
    "submitter": {
        "id": 156,
        "url": "https://patchwork.libcamera.org/api/people/156/?format=api",
        "name": "Dan Scally",
        "email": "dan.scally@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/27063/mbox/",
    "series": [
        {
            "id": 6022,
            "url": "https://patchwork.libcamera.org/api/series/6022/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6022",
            "date": "2026-06-26T13:05:47",
            "name": "libipa: Re-work IPU3 IPA to use libipa algorithms",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/6022/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/27063/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/27063/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 4E6CFBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 26 Jun 2026 13:06:17 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 03D1565F07;\n\tFri, 26 Jun 2026 15:06:10 +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 5E814658FA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Jun 2026 15:06:05 +0200 (CEST)",
            "from [127.0.1.1]\n\t(chfd-03-b2-v4wan-176392-cust229.vm15.cable.virginm.net\n\t[82.19.20.230])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7BF5E19EC;\n\tFri, 26 Jun 2026 15:05:24 +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=\"vnuDMNtq\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1782479124;\n\tbh=cPbSJkOCWsDRjI/shTMr9ESWFrPH86HAjyeuXWQiXmU=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=vnuDMNtqkCvUrOle/fJ9YzX/hiakUELx2suIaXUxBt73bQwpTUcfT6Q0q1tBAcK54\n\tdIYCB7OSvL3QuxR1Bg8PyGV1YZ3zVs5eooSSDbcKz70L1ZW6zu68Oj0Zi9aRia8om6\n\tHdTrGFPdxPOdONJPpnNq7dC7PA3zgQUdc7PVzF+I=",
        "From": "Daniel Scally <dan.scally@ideasonboard.com>",
        "Date": "Fri, 26 Jun 2026 14:05:50 +0100",
        "Subject": "[PATCH v2 03/12] ipa: ipu3: Convert from separate gains to\n\tRGB<double> in AGC",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "Message-Id": "<20260626-ipu3-libipa-rework-v2-3-41546e23de3e@ideasonboard.com>",
        "References": "<20260626-ipu3-libipa-rework-v2-0-41546e23de3e@ideasonboard.com>",
        "In-Reply-To": "<20260626-ipu3-libipa-rework-v2-0-41546e23de3e@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Daniel Scally <dan.scally@ideasonboard.com>",
        "X-Mailer": "b4 0.14.2",
        "X-Developer-Signature": "v=1; a=openpgp-sha256; l=2356;\n\ti=dan.scally@ideasonboard.com; h=from:subject:message-id;\n\tbh=cPbSJkOCWsDRjI/shTMr9ESWFrPH86HAjyeuXWQiXmU=;\n\tb=owEBbQKS/ZANAwAKAchJV3psRXUyAcsmYgBqPnk5+jfijVknwt+44YYtRE0Zq6LUf3vDItggJ\n\tYZp1gRMuwyJAjMEAAEKAB0WIQQqyuwyDnZdb+mxmm/ISVd6bEV1MgUCaj55OQAKCRDISVd6bEV1\n\tMs9/D/0dMZ9ZMkVIPNZ6Z0MSwf8po67A0RbVLKjoVFpAKEZhtobajSYRf+FMolFPYb/FeM3+nEr\n\tfF3czmusZn9Jq0Sh7A4zpDlyynkkPf6pIMMBsFWJwFswpizi8Bufj91uc9ulrMomXLBUMRmRx03\n\tTEwgLJwT8FoCKPul5EZ3QEnMCuJhk5WzIva5XTM43ZSFOj+nOq4mOod6HhZgP5WPZkFjnQqVfKI\n\t1YUDk2MOmf1P/lTSVyXrx36jXK1UBk1dRMblihLd1GKoncWexn352HBgMe74lENwVSmAOJljxri\n\tT+v+iC1FNHcuY1TTHbxhFRBWErSvkWXye5cKiaMcyuEX67rWmGZ4U/Xy7Y5EB5e/0+bol/xC714\n\tiwUs9SDMViPqGc+4/uHwEVE8AJqcj44U43hkqMkMw6jGkJiSWGUmSY7Y/gqycCANmyTxMZWBSfb\n\tiXRZBcpApRCKL3h6ueEm4P44Gqc682xQnuHWWYfAqXvr0m/qpQIpcf2UodrlnXFE1SPlzt5JOdO\n\tk48tjKWS/RrmfB2ztbIzZKxnk48HiAoAA9daQ5nQQG5oCROmxxNSkH+qnb7ASTSuhTUtMnt2bmI\n\tITppoZwbctAghP3xRG0JO01bmGWUU53m+n63aV209SwopsQ2oxU7oNi+IBWLSbkmhNfvYXBDBh5\n\t0SeBmx8j4awUvww==",
        "X-Developer-Key": "i=dan.scally@ideasonboard.com; a=openpgp;\n\tfpr=EEC699ACA1B7CB5D31330C0BBD501C2A3546CCF6",
        "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": "The AGC algorithm stores red, blue and green gains as type double\nclass members. Switch to using a single member of type RGB<double>\ninstead to simplify the code.\n\nSigned-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n---\nChanges in v2:\n\n        - New patch\n---\n src/ipa/ipu3/algorithms/agc.cpp | 9 ++++-----\n src/ipa/ipu3/algorithms/agc.h   | 6 +++---\n 2 files changed, 7 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\nindex d6a7036c6504acb106f5c773b529ad80b8349f85..b8b880b357a4770efd6810a3bdf616dd25ce93e4 100644\n--- a/src/ipa/ipu3/algorithms/agc.cpp\n+++ b/src/ipa/ipu3/algorithms/agc.cpp\n@@ -186,8 +186,7 @@ double Agc::estimateLuminance(double gain) const\n \t\tsum.b() += std::min(std::get<2>(rgbTriples_[i]) * gain, 255.0);\n \t}\n \n-\tRGB<double> gains{{ rGain_, gGain_, bGain_ }};\n-\tdouble ySum = rec601LuminanceFromRGB(sum * gains);\n+\tdouble ySum = rec601LuminanceFromRGB(sum * gains_);\n \treturn ySum / (bdsGrid_.height * bdsGrid_.width) / 255;\n }\n \n@@ -208,9 +207,9 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \t\t  ControlList &metadata)\n {\n \tHistogram hist = parseStatistics(stats, context.configuration.grid.bdsGrid);\n-\trGain_ = context.activeState.awb.gains.red;\n-\tgGain_ = context.activeState.awb.gains.blue;\n-\tbGain_ = context.activeState.awb.gains.green;\n+\tgains_ = RGB<double>({ context.activeState.awb.gains.red,\n+\t\t\t       context.activeState.awb.gains.blue,\n+\t\t\t       context.activeState.awb.gains.green });\n \n \t/*\n \t * The Agc algorithm needs to know the effective exposure value that was\ndiff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h\nindex d274a2350485f8f9a3870b24ceb29927cb9c2bec..12ddb173ff89b7de68dd544a194292f4d14efdbb 100644\n--- a/src/ipa/ipu3/algorithms/agc.h\n+++ b/src/ipa/ipu3/algorithms/agc.h\n@@ -13,6 +13,8 @@\n \n #include <libcamera/geometry.h>\n \n+#include \"libcamera/internal/vector.h\"\n+\n #include \"libipa/agc_mean_luminance.h\"\n #include \"libipa/histogram.h\"\n \n@@ -49,9 +51,7 @@ private:\n \tdouble maxAnalogueGain_;\n \n \tuint32_t stride_;\n-\tdouble rGain_;\n-\tdouble gGain_;\n-\tdouble bGain_;\n+\tRGB<double> gains_;\n \tipu3_uapi_grid_config bdsGrid_;\n \tstd::vector<std::tuple<uint8_t, uint8_t, uint8_t>> rgbTriples_;\n };\n",
    "prefixes": [
        "v2",
        "03/12"
    ]
}