Show a patch.

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

{
    "id": 15455,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/15455/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15455/",
    "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": "<20220315175345.479951-4-kieran.bingham@ideasonboard.com>",
    "date": "2022-03-15T17:53:45",
    "name": "[libcamera-devel,3/3] ipa: ipu3: af: Remove redundant memcpy",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "055c3d78e918705e3bba442766477945f537b039",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": {
        "id": 11,
        "url": "https://patchwork.libcamera.org/api/1.1/users/11/?format=api",
        "username": "kbingham",
        "first_name": "Kieran",
        "last_name": "Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/15455/mbox/",
    "series": [
        {
            "id": 2964,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2964/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2964",
            "date": "2022-03-15T17:53:42",
            "name": "ipa: ipu3: af: Small improvements",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2964/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15455/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15455/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\r\n\t[92.243.16.209])\r\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 514CFC3263\r\n\tfor <parsemail@patchwork.libcamera.org>;\r\n\tTue, 15 Mar 2022 17:53:58 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\r\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CC5A161FBC;\r\n\tTue, 15 Mar 2022 18:53:56 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\r\n\t[213.167.242.64])\r\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4BD776118A\r\n\tfor <libcamera-devel@lists.libcamera.org>;\r\n\tTue, 15 Mar 2022 18:53:54 +0100 (CET)",
            "from Monstersaurus.ksquared.org.uk.beta.tailscale.net\r\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\r\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EBD0C1C6D;\r\n\tTue, 15 Mar 2022 18:53:53 +0100 (CET)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\r\n\ts=mail; t=1647366836;\r\n\tbh=CGzjh9tM+VIsTg401TThvU12GfgXHHpsOkPLGx57dn0=;\r\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\r\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\r\n\tFrom;\r\n\tb=a8CORCX9hRIz6k7tQNxnypMspIgIuUo9uhGgdvWvKK/5vEjWUJQV4Rn7FmAPnUXPy\r\n\tPokMnPlr9boNMuj9mOkFLmpWMlqbCfk5q82U3gpbWlE2rEGJT10NoPjLz96X8j1z1i\r\n\t27qitxtTjj08RLhOk8+2QK80gOipCQLN5+xmOzdHtUEfi0fdvMnehFfnY7Z3H/CKiz\r\n\tCPZ/OqIkO2VKJzTgHbA0VixSZqMX79s4YFImKtGwl+kQKuNwLksNsY1oeOyuRx0y9O\r\n\t4jf4dF6nWxwXfy2eWQg8rAfTQgdRaI60kDogBYpItFU/oIqkrF8yWDt3QQBdbF3krv\r\n\t6B6xiRGQGRtqA==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\r\n\ts=mail; t=1647366834;\r\n\tbh=CGzjh9tM+VIsTg401TThvU12GfgXHHpsOkPLGx57dn0=;\r\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\r\n\tb=YcQVPciGw4hj/YYmb60/fpygEyL1tgrUoMyYiLwRDCn6m1HEHXUjbw4bmVnp/psTC\r\n\tck9kN2xMUq45bPH97rPb/9ejGH9QY6BICoXVfDePTgNttx2ZWBxE4WC24ODagRFsSF\r\n\t+5tDnAllUj/3K1u21OqlxdbnPo/4om8RwsXYkLr0="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \r\n\tunprotected) header.d=ideasonboard.com\r\n\theader.i=@ideasonboard.com\r\n\theader.b=\"YcQVPciG\"; dkim-atps=neutral",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Tue, 15 Mar 2022 17:53:45 +0000",
        "Message-Id": "<20220315175345.479951-4-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20220315175345.479951-1-kieran.bingham@ideasonboard.com>",
        "References": "<20220315175345.479951-1-kieran.bingham@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 3/3] ipa: ipu3: af: Remove redundant memcpy",
        "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>,\r\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>,\r\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "From": "Kieran Bingham via libcamera-devel\r\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": "The af statistics can be accessed directly from the mapped buffer.\nRemove the redundant memcpy, and simplify the call to\nafEstimateVariance().\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/ipu3/algorithms/af.cpp | 12 ++++--------\n src/ipa/ipu3/algorithms/af.h   |  2 +-\n 2 files changed, 5 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp\r\nindex 469762a29937..e10cff968895 100644\r\n--- a/src/ipa/ipu3/algorithms/af.cpp\r\n+++ b/src/ipa/ipu3/algorithms/af.cpp\r\n@@ -336,7 +336,7 @@ void Af::afIgnoreFrameReset()\r\n  *\r\n  * \\return The variance of the values in the data set \\a y_item selected by \\a isY1\r\n  */\r\n-double Af::afEstimateVariance(y_table_item_t *y_item, uint32_t len,\r\n+double Af::afEstimateVariance(const y_table_item_t *y_item, uint32_t len,\r\n \t\t\t      bool isY1)\r\n {\r\n \tuint32_t z = 0;\r\n@@ -406,25 +406,21 @@ bool Af::afIsOutOfFocus(IPAContext context)\r\n  */\r\n void Af::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)\r\n {\r\n-\ty_table_item_t y_item[IPU3_UAPI_AF_Y_TABLE_MAX_SIZE / sizeof(y_table_item_t)];\r\n+\tconst y_table_item_t *y_item = reinterpret_cast<const y_table_item_t *>(&stats->af_raw_buffer.y_table);\r\n \tuint32_t afRawBufferLen;\r\n \r\n \t/* Evaluate the AF buffer length */\r\n \tafRawBufferLen = context.configuration.af.afGrid.width *\r\n \t\t\t context.configuration.af.afGrid.height;\r\n \r\n-\tmemcpy(y_item, stats->af_raw_buffer.y_table,\r\n-\t       afRawBufferLen * sizeof(y_table_item_t));\r\n+\tASSERT(afRawBufferLen / sizeof(y_table_item_t) < IPU3_UAPI_AF_Y_TABLE_MAX_SIZE);\r\n \r\n \t/*\r\n \t * Calculate the mean and the variance of AF statistics for a given grid.\r\n \t * For coarse: y1 are used.\r\n \t * For fine: y2 results are used.\r\n \t */\r\n-\tif (coarseCompleted_)\r\n-\t\tcurrentVariance_ = afEstimateVariance(y_item, afRawBufferLen, false);\r\n-\telse\r\n-\t\tcurrentVariance_ = afEstimateVariance(y_item, afRawBufferLen, true);\r\n+\tcurrentVariance_ = afEstimateVariance(y_item, afRawBufferLen, !coarseCompleted_);\r\n \r\n \tif (!context.frameContext.af.stable) {\r\n \t\tafCoarseScan(context);\r\ndiff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h\r\nindex 906f2843dd49..3b5758e868ea 100644\r\n--- a/src/ipa/ipu3/algorithms/af.h\r\n+++ b/src/ipa/ipu3/algorithms/af.h\r\n@@ -41,7 +41,7 @@ private:\r\n \tvoid afReset(IPAContext &context);\r\n \tbool afNeedIgnoreFrame();\r\n \tvoid afIgnoreFrameReset();\r\n-\tdouble afEstimateVariance(y_table_item_t *y_item, uint32_t len,\r\n+\tdouble afEstimateVariance(const y_table_item_t *y_item, uint32_t len,\r\n \t\t\t\t  bool isY1);\r\n \tbool afIsOutOfFocus(IPAContext context);",
    "prefixes": [
        "libcamera-devel",
        "3/3"
    ]
}