Show a patch.

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

{
    "id": 19790,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19790/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19790/",
    "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": "<20240322131451.3092931-6-dan.scally@ideasonboard.com>",
    "date": "2024-03-22T13:14:46",
    "name": "[05/10] ipa: ipu3: Parse and store Agc stats",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "5998d1acdc4ed7edbcb81baedba8875bdaee39cd",
    "submitter": {
        "id": 156,
        "url": "https://patchwork.libcamera.org/api/1.1/people/156/?format=api",
        "name": "Dan Scally",
        "email": "dan.scally@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19790/mbox/",
    "series": [
        {
            "id": 4236,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4236/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4236",
            "date": "2024-03-22T13:14:41",
            "name": "Centralise Agc into libipa",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4236/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19790/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19790/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 AD52EC32C3\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Mar 2024 13:15:19 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5497F63354;\n\tFri, 22 Mar 2024 14:15:16 +0100 (CET)",
            "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 82BA3632E7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Mar 2024 14:15:09 +0100 (CET)",
            "from mail.ideasonboard.com\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 86991D50;\n\tFri, 22 Mar 2024 14:14:40 +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=\"jMwdG0Qe\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1711113280;\n\tbh=eBnNF8fPnn3dj5kMYozHbwOefdh6RqSKyouYwf3Qs1Y=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=jMwdG0QeI/ox7dlXz7Hwv3ax6NQpDvaP4ESeJR5/n39/V+7uIlXpyWc7loyWn4zd+\n\ti00Sre5/2rNWbhhnmg1qAhQwitdYbKy6xdViXdbS9urfguiCNWlSuYdw4I2k4p3AYk\n\tyRVHGtbKnRVMJwe2dJQ3L/sDaD3jlTgggLXFUHtA=",
        "From": "Daniel Scally <dan.scally@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Daniel Scally <dan.scally@ideasonboard.com>",
        "Subject": "[PATCH 05/10] ipa: ipu3: Parse and store Agc stats",
        "Date": "Fri, 22 Mar 2024 13:14:46 +0000",
        "Message-Id": "<20240322131451.3092931-6-dan.scally@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20240322131451.3092931-1-dan.scally@ideasonboard.com>",
        "References": "<20240322131451.3092931-1-dan.scally@ideasonboard.com>",
        "MIME-Version": "1.0",
        "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>"
    },
    "content": "In preparation for switching to a derivation of MeanLuminanceAgc, add\na function to parse and store the statistics for easy retrieval in an\noverriding estimateLuminance() function.\n\nSigned-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n---\n src/ipa/ipu3/algorithms/agc.cpp | 33 +++++++++++++++++++++++++++++++++\n src/ipa/ipu3/algorithms/agc.h   |  8 ++++++++\n 2 files changed, 41 insertions(+)",
    "diff": "diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\nindex 606a237a..ee9a42cf 100644\n--- a/src/ipa/ipu3/algorithms/agc.cpp\n+++ b/src/ipa/ipu3/algorithms/agc.cpp\n@@ -142,6 +142,39 @@ double Agc::measureBrightness(const ipu3_uapi_stats_3a *stats,\n \treturn Histogram(Span<uint32_t>(hist)).interQuantileMean(0.98, 1.0);\n }\n \n+void Agc::parseStatistics(const ipu3_uapi_stats_3a *stats,\n+\t\t\t  const ipu3_uapi_grid_config &grid)\n+{\n+\tuint32_t hist[knumHistogramBins] = { 0 };\n+\n+\treds_.clear();\n+\tgreens_.clear();\n+\tblues_.clear();\n+\n+\tfor (unsigned int cellY = 0; cellY < grid.height; cellY++) {\n+\t\tfor (unsigned int cellX = 0; cellX < grid.width; cellX++) {\n+\t\t\tuint32_t cellPosition = cellY * stride_ + cellX;\n+\n+\t\t\tconst ipu3_uapi_awb_set_item *cell =\n+\t\t\t\treinterpret_cast<const ipu3_uapi_awb_set_item *>(\n+\t\t\t\t\t&stats->awb_raw_buffer.meta_data[cellPosition]);\n+\n+\t\t\treds_.push_back(cell->R_avg);\n+\t\t\tgreens_.push_back((cell->Gr_avg + cell->Gb_avg) / 2);\n+\t\t\tblues_.push_back(cell->B_avg);\n+\n+\t\t\t/*\n+\t\t\t * Store the average green value to estimate the\n+\t\t\t * brightness. Even the overexposed pixels are\n+\t\t\t * taken into account.\n+\t\t\t */\n+\t\t\thist[(cell->Gr_avg + cell->Gb_avg) / 2]++;\n+\t\t}\n+\t}\n+\n+\thist_ = Histogram(Span<uint32_t>(hist));\n+}\n+\n /**\n  * \\brief Apply a filter on the exposure value to limit the speed of changes\n  * \\param[in] exposureValue The target exposure from the AGC algorithm\ndiff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h\nindex 9d6e3ff1..7ed0ef7a 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 \"libipa/histogram.h\"\n+\n #include \"algorithm.h\"\n \n namespace libcamera {\n@@ -43,6 +45,8 @@ private:\n \t\t\t\t const ipu3_uapi_grid_config &grid,\n \t\t\t\t const ipu3_uapi_stats_3a *stats,\n \t\t\t\t double gain);\n+\tvoid parseStatistics(const ipu3_uapi_stats_3a *stats,\n+\t\t\t     const ipu3_uapi_grid_config &grid);\n \n \tuint64_t frameCount_;\n \n@@ -55,6 +59,10 @@ private:\n \tutils::Duration filteredExposure_;\n \n \tuint32_t stride_;\n+\tstd::vector<uint8_t> reds_;\n+\tstd::vector<uint8_t> blues_;\n+\tstd::vector<uint8_t> greens_;\n+\tHistogram hist_;\n };\n \n } /* namespace ipa::ipu3::algorithms */\n",
    "prefixes": [
        "05/10"
    ]
}