Show a patch.

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

{
    "id": 15553,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/15553/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15553/",
    "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": "<20220325092555.1799897-4-kieran.bingham@ideasonboard.com>",
    "date": "2022-03-25T09:25:53",
    "name": "[libcamera-devel,v3,3/5] ipa: ipu3: af: Remove redundant memcpy",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "cc8d6fe36d7efcd1eb3257541f8dc11c7f5b25ee",
    "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/15553/mbox/",
    "series": [
        {
            "id": 3000,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3000/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3000",
            "date": "2022-03-25T09:25:50",
            "name": "ipa: ipu3: af: Small improvements",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/3000/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15553/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15553/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 11876BD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 25 Mar 2022 09:26:06 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 63DB3604DB;\n\tFri, 25 Mar 2022 10:26:04 +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 45317604D5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Mar 2022 10:26:01 +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 D2097E0D;\n\tFri, 25 Mar 2022 10:26:00 +0100 (CET)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648200364;\n\tbh=PWGZDJJWtHg1tUvVeAnqITvOLIK6XnKsFMOkDhxIta8=;\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=tuNWjt2U1HI186IwUw9h0eZ+9tSGr+xml0a2xK9gr0E1coGwUnF3LXEoOT8t89aig\n\tE+2AFRl/UtWwGonB0bX1krXpUzGS9IQ82y8AkBrVDoERwsfGCGcbfRqcBOt1LZu74j\n\tuhE0AjgFgF1wGoxDutsGnLkzblXTzbXGQWwajiTREfgoVvUX7siAzd8qsLpGiG4qXS\n\tsKVvqwTefhYz60l6YJMejQrEmrJpYNpToFnXOmcCTRjNHx6AxyKPAnJgevQX7UkkzH\n\tAyWHI8bcmrV8Dl2geRbNgzg1SagWFdNPYAL5UNA428kMdG6uD5wnFbdghkakaP46cM\n\ty8SobU+H0duWQ==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1648200361;\n\tbh=PWGZDJJWtHg1tUvVeAnqITvOLIK6XnKsFMOkDhxIta8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=RU/i1nh7EvF8vqxpxXcPCBrfC1kN/Ike9MJahrKN4TqIJPMJglr/OhSLUuqpdOe/4\n\taRNsqoGoI05yaxlUZgBfY2URb2R200EIWQXS/gKLu4eSFgV/SxL8NdawbIPPRRcd+6\n\tp78PK2oxcKEovFe98+6tJ6Q2zvSbgTTuLE8W4vDc="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"RU/i1nh7\"; dkim-atps=neutral",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>,\n\tKate Hsuan <hpa@redhat.com>,\n\tJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>",
        "Date": "Fri, 25 Mar 2022 09:25:53 +0000",
        "Message-Id": "<20220325092555.1799897-4-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20220325092555.1799897-1-kieran.bingham@ideasonboard.com>",
        "References": "<20220325092555.1799897-1-kieran.bingham@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 3/5] ipa: ipu3: af: Remove redundant\n\tmemcpy",
        "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": "The af statistics can be accessed directly from the mapped buffer.\nRemove the redundant memcpy, and simplify the call to\nafEstimateVariance().\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n---\n - Fix ASSERT\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\nindex 4476857fa772..6893a15fdc07 100644\n--- a/src/ipa/ipu3/algorithms/af.cpp\n+++ b/src/ipa/ipu3/algorithms/af.cpp\n@@ -335,7 +335,7 @@ 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(y_table_item_t *y_item, uint32_t len,\n+double Af::afEstimateVariance(const y_table_item_t *y_item, uint32_t len,\n \t\t\t      bool isY1)\n {\n \tuint32_t z = 0;\n@@ -405,25 +405,21 @@ bool Af::afIsOutOfFocus(IPAContext context)\n  */\n void Af::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)\n {\n-\ty_table_item_t y_item[IPU3_UAPI_AF_Y_TABLE_MAX_SIZE / sizeof(y_table_item_t)];\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 \n-\tmemcpy(y_item, stats->af_raw_buffer.y_table,\n-\t       afRawBufferLen * sizeof(y_table_item_t));\n+\tASSERT(afRawBufferLen < IPU3_UAPI_AF_Y_TABLE_MAX_SIZE);\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-\tif (coarseCompleted_)\n-\t\tcurrentVariance_ = afEstimateVariance(y_item, afRawBufferLen, false);\n-\telse\n-\t\tcurrentVariance_ = afEstimateVariance(y_item, afRawBufferLen, true);\n+\tcurrentVariance_ = afEstimateVariance(y_item, afRawBufferLen, !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 906f2843dd49..3b5758e868ea 100644\n--- a/src/ipa/ipu3/algorithms/af.h\n+++ b/src/ipa/ipu3/algorithms/af.h\n@@ -41,7 +41,7 @@ private:\n \tvoid afReset(IPAContext &context);\n \tbool afNeedIgnoreFrame();\n \tvoid afIgnoreFrameReset();\n-\tdouble afEstimateVariance(y_table_item_t *y_item, uint32_t len,\n+\tdouble afEstimateVariance(const y_table_item_t *y_item, uint32_t len,\n \t\t\t\t  bool isY1);\n \tbool afIsOutOfFocus(IPAContext context);\n \n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "3/5"
    ]
}