Show a patch.

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

{
    "id": 15522,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/15522/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15522/",
    "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": "<20220323135614.865252-5-kieran.bingham@ideasonboard.com>",
    "date": "2022-03-23T13:56:13",
    "name": "[libcamera-devel,v2,4/5] ipa: ipu3: af: Use Span for y_table_item_t",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "811ab9655ab996b0b00f280fb9f42138efac20ec",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/15522/mbox/",
    "series": [
        {
            "id": 2989,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2989/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2989",
            "date": "2022-03-23T13:56:09",
            "name": "ipa: ipu3: af: Small improvements",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2989/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15522/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15522/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 821AEC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 23 Mar 2022 13:56:26 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 21B4E61FBC;\n\tWed, 23 Mar 2022 14:56:26 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 697C1604D5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Mar 2022 14:56:21 +0100 (CET)",
            "from Monstersaurus.ksquared.org.uk.beta.tailscale.net\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2094FFFD;\n\tWed, 23 Mar 2022 14:56:21 +0100 (CET)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648043786;\n\tbh=X62HXjRtuLhRG+xiOJG8feXQQi7KB3lw9f4CtrUGNP4=;\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=QmshO7cQDbn/WnypgWXhbH5RHv7nngQw8rgQ6scYp8Ebqmiva3Bc+5CnZtSjIb7pr\n\t8U0eGF55VSAzyJygMMvbQuoSwZLyBORB5kKFuUjTicDMCLt9LtlABL4/ST23XSrG+D\n\twNdMQVT+rPTyVuj/0qcmgaR6iZGXEtYlrMrflHepWcSVZ6RFacGmlCvWg0Qv/vIQY9\n\tEoMHcwvmAuE1Q/ddbFDE29cHjreRjz/xnXnIj42xCrbDTUE/EefAexqJ9B2eGp8szB\n\tNpLKgL+Slfv+C586IuZoDbMmH+PT3lhaAgHU95Yx0m6UcoQ2lSVGP91qDAGITOOqQj\n\tVcTCgsDil0mfg==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1648043781;\n\tbh=X62HXjRtuLhRG+xiOJG8feXQQi7KB3lw9f4CtrUGNP4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=arwI1GASzOWpF13S32ko989qBq9LV+2nEOvAW4l7vc+oq3h2uOPGEHrC54Tfy7BHB\n\tKK+JFNNreBHNBS7JJ4kjin773dpd/NiLoiTVITawVJIK8N/bWwOI4CRUXxW7Bg8Ner\n\tTOg3p7sIpn/RpS1k2keeo/uQwE6g4wQOecJi3TYY="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"arwI1GAS\"; dkim-atps=neutral",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Wed, 23 Mar 2022 13:56:13 +0000",
        "Message-Id": "<20220323135614.865252-5-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20220323135614.865252-1-kieran.bingham@ideasonboard.com>",
        "References": "<20220323135614.865252-1-kieran.bingham@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 4/5] ipa: ipu3: af: Use Span for\n\ty_table_item_t",
        "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": "Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Convert the y_table_item_t to a Span and use that for iteration when\nestimating variance of the table.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/ipu3/algorithms/af.cpp | 34 +++++++++++++++++-----------------\n src/ipa/ipu3/algorithms/af.h   |  4 ++--\n 2 files changed, 19 insertions(+), 19 deletions(-)",
    "diff": "diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp\nindex 68e100fdc504..ff5e9fb5b3c5 100644\n--- a/src/ipa/ipu3/algorithms/af.cpp\n+++ b/src/ipa/ipu3/algorithms/af.cpp\n@@ -336,29 +336,29 @@ void Af::afIgnoreFrameReset()\n  *\n  * \\return The variance of the values in the data set \\a y_item selected by \\a isY1\n  */\n-double Af::afEstimateVariance(const y_table_item_t *y_item, uint32_t len,\n-\t\t\t      bool isY1)\n+double Af::afEstimateVariance(Span<const y_table_item_t> y_items, bool isY1)\n {\n-\tuint32_t z = 0;\n \tuint32_t total = 0;\n \tdouble mean;\n \tdouble var_sum = 0;\n \n-\tfor (z = 0; z < len; z++) {\n+\tfor (auto y : y_items) {\n \t\tif (isY1)\n-\t\t\ttotal += y_item[z].y1_avg;\n+\t\t\ttotal += y.y1_avg;\n \t\telse\n-\t\t\ttotal += y_item[z].y2_avg;\n+\t\t\ttotal += y.y2_avg;\n \t}\n-\tmean = total / len;\n-\tfor (z = 0; z < len; z++) {\n+\n+\tmean = total / y_items.size();\n+\n+\tfor (auto y : y_items) {\n \t\tif (isY1)\n-\t\t\tvar_sum += pow((y_item[z].y1_avg - mean), 2);\n+\t\t\tvar_sum += pow((y.y1_avg - mean), 2);\n \t\telse\n-\t\t\tvar_sum += pow((y_item[z].y2_avg - mean), 2);\n+\t\t\tvar_sum += pow((y.y2_avg - mean), 2);\n \t}\n \n-\treturn var_sum / static_cast<double>(len);\n+\treturn var_sum / static_cast<double>(y_items.size());\n }\n \n /**\n@@ -406,21 +406,21 @@ bool Af::afIsOutOfFocus(IPAContext context)\n  */\n void Af::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)\n {\n-\tconst y_table_item_t *y_item = reinterpret_cast<const y_table_item_t *>(&stats->af_raw_buffer.y_table);\n-\tuint32_t afRawBufferLen;\n-\n \t/* Evaluate the AF buffer length */\n-\tafRawBufferLen = context.configuration.af.afGrid.width *\n-\t\t\t context.configuration.af.afGrid.height;\n+\tuint32_t afRawBufferLen = context.configuration.af.afGrid.width *\n+\t\t\t\t  context.configuration.af.afGrid.height;\n \n \tASSERT(afRawBufferLen < IPU3_UAPI_AF_Y_TABLE_MAX_SIZE);\n \n+\tSpan<const y_table_item_t> y_items(reinterpret_cast<const y_table_item_t *>(&stats->af_raw_buffer.y_table),\n+\t\t\t\t\t   afRawBufferLen);\n+\n \t/*\n \t * Calculate the mean and the variance of AF statistics for a given grid.\n \t * For coarse: y1 are used.\n \t * For fine: y2 results are used.\n \t */\n-\tcurrentVariance_ = afEstimateVariance(y_item, afRawBufferLen, !coarseCompleted_);\n+\tcurrentVariance_ = afEstimateVariance(y_items, !coarseCompleted_);\n \n \tif (!context.frameContext.af.stable) {\n \t\tafCoarseScan(context);\ndiff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h\nindex 3b5758e868ea..b85cf94163ff 100644\n--- a/src/ipa/ipu3/algorithms/af.h\n+++ b/src/ipa/ipu3/algorithms/af.h\n@@ -41,8 +41,8 @@ private:\n \tvoid afReset(IPAContext &context);\n \tbool afNeedIgnoreFrame();\n \tvoid afIgnoreFrameReset();\n-\tdouble afEstimateVariance(const y_table_item_t *y_item, uint32_t len,\n-\t\t\t\t  bool isY1);\n+\tdouble afEstimateVariance(Span<const y_table_item_t> y_items, bool isY1);\n+\n \tbool afIsOutOfFocus(IPAContext context);\n \n \t/* VCM step configuration. It is the current setting of the VCM step. */\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "4/5"
    ]
}