Show a patch.

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

{
    "id": 17862,
    "url": "https://patchwork.libcamera.org/api/patches/17862/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17862/",
    "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": "<20221124103832.6172-2-naush@raspberrypi.com>",
    "date": "2022-11-24T10:38:28",
    "name": "[libcamera-devel,v2,1/5] ipa: raspberrypi: Generalise statistics",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "82408ecd3a724d09b9e2c13f5fcd096c9929ce6d",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/17862/mbox/",
    "series": [
        {
            "id": 3635,
            "url": "https://patchwork.libcamera.org/api/series/3635/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3635",
            "date": "2022-11-24T10:38:27",
            "name": "Raspberry Pi: Generalise statistics",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3635/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17862/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17862/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 410D7BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Nov 2022 10:38:45 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A36526330A;\n\tThu, 24 Nov 2022 11:38:43 +0100 (CET)",
            "from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com\n\t[IPv6:2a00:1450:4864:20::42d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C860B6330A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Nov 2022 11:38:40 +0100 (CET)",
            "by mail-wr1-x42d.google.com with SMTP id g12so1821488wrs.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Nov 2022 02:38:40 -0800 (PST)",
            "from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\ts16-20020adff810000000b002368a6deaf8sm995103wrp.57.2022.11.24.02.38.39\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 24 Nov 2022 02:38:39 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669286323;\n\tbh=NOrgDIPDWhC3tzOO598pHppsdGT5KpshNbARfH0Eg20=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=rAHp4QBB3Ac1GjloCxaP0gGzwzTpzr9tzWQ3BKuELbMhKBy8OVBnKoLakrPWDuZwZ\n\tex/jS8UYO2mwBVkLKwiXpazAPG+82jr8AoEYdILgvq4GHxK4jDTfL2Va5be+Hr/E+9\n\tL4BmxKH0WBKR1H1R2t46+QbSjXuqXy1G0GHrlShtuMix5Hk7Ep4Qa2da5B3Qd+QEKY\n\tg2eh6Ik8l9IK+bZtvi+TRNlIUUhkENYzXCgo8LNEaSnrt+Atop4+Gv37nHGIAeDmP4\n\teJ0gHH0Kraidx767MYQwwIxhqvhRSUTJHyKu9F8pyOTaFL8SVENPwGHRIklZYJhv1x\n\tf+pX8jUKHOo8Q==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=TgY1XqtE04Zqn2QHeFSJfKHeETJOVH8v2DU+dZ7yV4Y=;\n\tb=VuD4r0v6GFdSe3zV6tXNyYqOlkICbE5bTdvT4GWPml4+6b3k0I0f7NcU9U84dbxRhq\n\tBBiAQ15Gnjf74VT0e0cIu7+dnTAG/Xgyc0ajjOBMrYeGPd3fgzthzQsao3DT1kxyw/Ch\n\tRTmlpi+EeWOZr/x1WPWzV1y5hTyq0OvIcADRhWIqr06PAxWG07HQJCcLS3Qd0QwEy6Jp\n\tICNhzgP71bi3xPBfgX0I5pKOwd66Me5mpjfsQIMKnSfFxK9OYb5glVBb8jEPa1zUGbpm\n\ta3M4Fn5ZkNPBL4EoR39etm3Gxkqum1nb4gavEmR0wkte0/SsfcqRpE3ahni4VXft/08M\n\twVPw=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"VuD4r0v6\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=TgY1XqtE04Zqn2QHeFSJfKHeETJOVH8v2DU+dZ7yV4Y=;\n\tb=VNI7PMlwVCyRS2BdBqYX9DXqyVCqEbdfrpXgdbOaotV+JueNW+5kzgOxZVqUnT2xsJ\n\t5TwDzsMo1Hnhrs41+rSn/pqS++HgJzPYBiCWydWxjKGDnnua3/7mGk6cGVpxi2aEIwLX\n\tZHEg+OTYLfHTppxdJR53pZ12Dw+llU8wfjHn9LEo20FP+WyWOrT9yk+7SDlD/+K9rdw4\n\tUDDMcbyvuSZG4/9YGCoId2+jbJyS3fX3a7C70eFQ4KKzckys5hAZMgxiQxIoZKfLGYz+\n\tl1+rbWFVanHYNQ2I82zi1GphqxwKNU/QoakDYRMcqk/xKlihQRuWizCF40ET9ATy1qnt\n\twIjg==",
        "X-Gm-Message-State": "ANoB5pnPmTx7y2OuUT59idMKo0Uvl4KmUou4NNDSBuwxOkqiMB6Xg+AU\n\t0L0xspe/H8Si9XIY6SA1R+Z7xUvGi9yarQ==",
        "X-Google-Smtp-Source": "AA0mqf5O/xuMfFm6nnqCh7Uiq5K/+4fYQ6xg7vrZD2g/nCZ2zzp0tFCInBd9MdAYwD1NEY7ne9LHyw==",
        "X-Received": "by 2002:a5d:6244:0:b0:236:73b2:f026 with SMTP id\n\tm4-20020a5d6244000000b0023673b2f026mr19914801wrv.396.1669286320172; \n\tThu, 24 Nov 2022 02:38:40 -0800 (PST)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 24 Nov 2022 10:38:28 +0000",
        "Message-Id": "<20221124103832.6172-2-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20221124103832.6172-1-naush@raspberrypi.com>",
        "References": "<20221124103832.6172-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 1/5] ipa: raspberrypi: Generalise\n\tstatistics",
        "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>",
        "From": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Naushir Patuck <naush@raspberrypi.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "At present, the controller algorithms access the bcm2835_isp_stats structure,\nwhich is hardware specific. It would be desirable to abstract out the statistics\nstructure to remove hardware specific headers from the algorithms source files.\n\nDefine a new templated RegionStats class that encompasses region based\nstatistics generated by the ISP. For the VC4 ISP, this can be used to hold\nRGB sums and focus FoM values.\n\nDefine a new Statistics structure that holds all the VC4 ISP statistics output.\nThis includes AGC hostograms, AGC/AWB region sums and focus FoM regions.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/raspberrypi/controller/region_stats.h | 123 ++++++++++++++++++\n src/ipa/raspberrypi/statistics.h              |  70 ++++++++++\n 2 files changed, 193 insertions(+)\n create mode 100644 src/ipa/raspberrypi/controller/region_stats.h\n create mode 100644 src/ipa/raspberrypi/statistics.h",
    "diff": "diff --git a/src/ipa/raspberrypi/controller/region_stats.h b/src/ipa/raspberrypi/controller/region_stats.h\nnew file mode 100644\nindex 000000000000..9aaf3a58a6f7\n--- /dev/null\n+++ b/src/ipa/raspberrypi/controller/region_stats.h\n@@ -0,0 +1,123 @@\n+/* SPDX-License-Identifier: BSD-2-Clause */\n+/*\n+ * Copyright (C) 2022, Raspberry Pi Ltd\n+ *\n+ * region_stats.h - Raspberry Pi region based statistics container\n+ */\n+#pragma once\n+\n+#include <array>\n+#include <stdint.h>\n+#include <vector>\n+\n+#include <libcamera/geometry.h>\n+\n+namespace RPiController {\n+\n+template<typename T>\n+class RegionStats\n+{\n+public:\n+\tstruct Region {\n+\t\tT val;\n+\t\tuint32_t counted;\n+\t\tuint32_t uncounted;\n+\t};\n+\n+\tRegionStats()\n+\t\t: size_({}), numFloating_(0), default_({})\n+\t{\n+\t}\n+\n+\tvoid init(const libcamera::Size &size, unsigned int numFloating = 0)\n+\t{\n+\t\tsize_ = size;\n+\t\tnumFloating_ = numFloating;\n+\t\tregions_.clear();\n+\t\tregions_.resize(size_.width * size_.height + numFloating_);\n+\t}\n+\n+\tvoid init(unsigned int num)\n+\t{\n+\t\tsize_ = libcamera::Size(num, 1);\n+\t\tnumFloating_ = 0;\n+\t\tregions_.clear();\n+\t\tregions_.resize(num);\n+\t}\n+\n+\tunsigned int numRegions() const\n+\t{\n+\t\treturn size_.width * size_.height;\n+\t}\n+\n+\tunsigned int numFloatingRegions() const\n+\t{\n+\t\treturn numFloating_;\n+\t}\n+\n+\tlibcamera::Size size() const\n+\t{\n+\t\treturn size_;\n+\t}\n+\n+\tvoid set(unsigned int index, const Region &region)\n+\t{\n+\t\tif (index >= numRegions())\n+\t\t\treturn;\n+\t\tset_(index, region);\n+\t}\n+\n+\tvoid set(const libcamera::Point &pos, const Region &region)\n+\t{\n+\t\tset(pos.y * size_.width + pos.x, region);\n+\t}\n+\n+\tvoid setFloating(unsigned int index, const Region &region)\n+\t{\n+\t\tif (index >= numFloatingRegions())\n+\t\t\treturn;\n+\t\tset(numRegions() + index, region);\n+\t}\n+\n+\tconst Region &get(unsigned int index) const\n+\t{\n+\t\tif (index >= numRegions())\n+\t\t\treturn default_;\n+\t\treturn get_(index);\n+\t}\n+\n+\tconst T &get(const libcamera::Point &pos) const\n+\t{\n+\t\treturn get(pos.y * size_.width + pos.x);\n+\t}\n+\n+\tconst T &getFloating(unsigned int index) const\n+\t{\n+\t\tif (index >= numFloatingRegions())\n+\t\t\treturn default_;\n+\t\treturn get_(numRegions() + index);\n+\t}\n+\n+\ttypename std::vector<Region>::iterator begin() { return regions_.begin(); }\n+\ttypename std::vector<Region>::iterator end() { return regions_.end(); }\n+\ttypename std::vector<Region>::const_iterator begin() const { return regions_.begin(); }\n+\ttypename std::vector<Region>::const_iterator end() const { return regions_.end(); }\n+\n+private:\n+\tvoid set_(unsigned int index, const Region &region)\n+\t{\n+\t\tregions_[index] = region;\n+\t}\n+\n+\tconst Region &get_(unsigned int index) const\n+\t{\n+\t\treturn regions_[index];\n+\t}\n+\n+\tlibcamera::Size size_;\n+\tunsigned int numFloating_;\n+\tstd::vector<Region> regions_;\n+\tRegion default_;\n+};\n+\n+} /* namespace RPiController */\ndiff --git a/src/ipa/raspberrypi/statistics.h b/src/ipa/raspberrypi/statistics.h\nnew file mode 100644\nindex 000000000000..a762bf3d41aa\n--- /dev/null\n+++ b/src/ipa/raspberrypi/statistics.h\n@@ -0,0 +1,70 @@\n+/* SPDX-License-Identifier: BSD-2-Clause */\n+/*\n+ * Copyright (C) 2022, Raspberry Pi Ltd\n+ *\n+ * statistics.h - Raspberry Pi generic statistics structure\n+ */\n+#pragma once\n+\n+#include <memory>\n+#include <stdint.h>\n+#include <vector>\n+\n+#include \"histogram.h\"\n+#include \"region_stats.h\"\n+\n+namespace RPiController {\n+\n+struct RgbySums {\n+\tRgbySums(uint64_t _rSum = 0, uint64_t _gSum = 0, uint64_t _bSum = 0, uint64_t _ySum = 0)\n+\t\t: rSum(_rSum), gSum(_gSum), bSum(_bSum), ySum(_ySum)\n+\t{\n+\t}\n+\tuint64_t rSum;\n+\tuint64_t gSum;\n+\tuint64_t bSum;\n+\tuint64_t ySum;\n+};\n+\n+using RgbyRegions = RegionStats<RgbySums>;\n+using FocusRegions = RegionStats<uint64_t>;\n+\n+struct Statistics {\n+\t/*\n+\t * Positioning of the AGC statistics gathering in the pipeline:\n+\t * Pre-WB correction or post-WB correction.\n+\t * Assume this is post-LSC.\n+\t */\n+\tenum class AgcStatsPos { PreWb, PostWb };\n+\tconst AgcStatsPos agcStatsPos;\n+\n+\t/*\n+\t * Positioning of the AWB/ALSC statistics gathering in the pipeline:\n+\t * Pre-LSC or post-LSC.\n+\t */\n+\tenum class ColourStatsPos { PreLsc, PostLsc };\n+\tconst ColourStatsPos colourStatsPos;\n+\n+\tStatistics(AgcStatsPos a, ColourStatsPos c)\n+\t\t: agcStatsPos(a), colourStatsPos(c)\n+\t{\n+\t}\n+\n+\t/* Histogram statistics. Not all histograms may be populated! */\n+\tHistogram rHist;\n+\tHistogram gHist;\n+\tHistogram bHist;\n+\tHistogram yHist;\n+\n+\t/* Row sums for flicker avoidance. */\n+\tstd::vector<RgbySums> rowSums;\n+\n+\t/* Region based colour sums. */\n+\tRgbyRegions agcRegions;\n+\tRgbyRegions awbRegions;\n+\n+\t/* Region based focus FoM. */\n+\tFocusRegions focusRegions;\n+};\n+\n+} /* namespace RPiController */\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "1/5"
    ]
}