Show a patch.

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

{
    "id": 15804,
    "url": "https://patchwork.libcamera.org/api/patches/15804/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15804/",
    "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": "<20220506051841.70792-2-hpa@redhat.com>",
    "date": "2022-05-06T05:18:39",
    "name": "[libcamera-devel,v2,1/3] ipa: ipu3: agc: AGC exposure stability test",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "565c0c55e54662393353bace4c6fdb43979d1b23",
    "submitter": {
        "id": 105,
        "url": "https://patchwork.libcamera.org/api/people/105/?format=api",
        "name": "Kate Hsuan",
        "email": "hpa@redhat.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/15804/mbox/",
    "series": [
        {
            "id": 3096,
            "url": "https://patchwork.libcamera.org/api/series/3096/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3096",
            "date": "2022-05-06T05:18:38",
            "name": "ipa: ipu3: af: Temporarily suspend AWB during AF scanning",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3096/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15804/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15804/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 61B78C326C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  6 May 2022 05:19:25 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2EE6C6564B;\n\tFri,  6 May 2022 07:19:24 +0200 (CEST)",
            "from us-smtp-delivery-74.mimecast.com\n\t(us-smtp-delivery-74.mimecast.com [170.10.133.74])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2CADD6563F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 May 2022 07:19:20 +0200 (CEST)",
            "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n\t[66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n\tus-mta-206-OlBpATyHN2uXM9U1M9iWdA-1; Fri, 06 May 2022 01:19:16 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mimecast-mx02.redhat.com (Postfix) with ESMTPS id 851C6800B21;\n\tFri,  6 May 2022 05:19:16 +0000 (UTC)",
            "from fedora.redhat.com (unknown [10.39.192.101])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 117782166B17;\n\tFri,  6 May 2022 05:19:13 +0000 (UTC)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1651814364;\n\tbh=PrnElUlrXByTDH+8FOVKAfnnBLgnt5I5IVpGBLLSkpA=;\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=lau1G3wTgt9GTw5V19v0Afmx9Z1/gpMhNyfJMSKiH95bnUt7gA6uqfEHzf6O0jktW\n\tyQws+cNoLtZ9xiDEJahdBS7HeolzNUioSg5Pd6GxodS4ns3QFuRubHQcQ+wFNiDldw\n\tQ/1EFTCeQkFHCzDtFUk9g/WKMItkeRyjo34zXC4wI8lrSwXE+ai88gemjX3pN/6egF\n\tWcuprRqGva93WrJ/B7DVdbxk85rf8oLCJyl6/nBU6DlBKxcT4evfON1XnCir5V/4nV\n\tIIWTWoJShBrtt7Vdbvad60hJhwbHQ6D6i8X7Jgsg3RwvDZQtp/UTvBBBE9Pyqkl/LI\n\tl1VRAyTpxnm6g==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1651814359;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=bvBQL51J0KorVN3sj4FomrergGz9rjyduVp/Kvi3Tcw=;\n\tb=e4zLU3RFxsN8qPDEDXOacdmcBpdJ01EgejEvtyndUkwDG/4R/ex+0++xxmteU4RIeAMUae\n\tzUeQqeK2MWZUljaArU2i5O0y8cxmwR1fO5XyT5d6mWPK55A1wgaBIlwZgf9NCpBakapyOo\n\turX/xJqnJ0tyMjxjOyi2vMTz27nsz7I="
        ],
        "Authentication-Results": [
            "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=redhat.com\n\theader.i=@redhat.com header.b=\"e4zLU3RF\"; \n\tdkim-atps=neutral",
            "relay.mimecast.com;\n\tauth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hpa@redhat.com"
        ],
        "X-MC-Unique": "OlBpATyHN2uXM9U1M9iWdA-1",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>,\n\tJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>,\n\tHans De Goede <hdegoede@redhat.com>",
        "Date": "Fri,  6 May 2022 13:18:39 +0800",
        "Message-Id": "<20220506051841.70792-2-hpa@redhat.com>",
        "In-Reply-To": "<20220506051841.70792-1-hpa@redhat.com>",
        "References": "<20220506051841.70792-1-hpa@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.78 on 10.11.54.6",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "Subject": "[libcamera-devel] [PATCH v2 1/3] ipa: ipu3: agc: AGC exposure\n\tstability test",
        "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": "Kate Hsuan via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Kate Hsuan <hpa@redhat.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The average exposure value is determined to be a baseline for the\nstability testing and is formed by the moving average. If the latest\nestimated exposure value is in the 90% confidence interval of average\nexposure, the stable status will be set to true.\n\nSigned-off-by: Kate Hsuan<hpa@redhat.com>\n---\n src/ipa/ipu3/algorithms/agc.cpp | 22 +++++++++++++++++++++-\n src/ipa/ipu3/algorithms/agc.h   |  3 +++\n src/ipa/ipu3/ipa_context.h      |  1 +\n 3 files changed, 25 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\nindex 7d4b3503..c115f3bc 100644\n--- a/src/ipa/ipu3/algorithms/agc.cpp\n+++ b/src/ipa/ipu3/algorithms/agc.cpp\n@@ -72,7 +72,7 @@ static constexpr double kRelativeLuminanceTarget = 0.16;\n \n Agc::Agc()\n \t: frameCount_(0), minShutterSpeed_(0s),\n-\t  maxShutterSpeed_(0s), filteredExposure_(0s)\n+\t  maxShutterSpeed_(0s), filteredExposure_(0s), avgExposure_(0)\n {\n }\n \n@@ -102,6 +102,8 @@ int Agc::configure(IPAContext &context,\n \tframeContext.agc.gain = std::max(minAnalogueGain_, kMinAnalogueGain);\n \tframeContext.agc.exposure = 10ms / configuration.sensor.lineDuration;\n \n+\tframeContext.agc.stable = false;\n+\n \tframeCount_ = 0;\n \treturn 0;\n }\n@@ -314,6 +316,23 @@ double Agc::estimateLuminance(IPAFrameContext &frameContext,\n \treturn ySum / (grid.height * grid.width) / 255;\n }\n \n+void Agc::evaluateStable(IPAContext &context)\n+{\n+\tuint32_t latestExposure = context.frameContext.agc.exposure;\n+\tuint32_t upperEx = avgExposure_ + (avgExposure_ * 0.1);\n+\tuint32_t lowerEx = avgExposure_ - (avgExposure_ * 0.1);\n+\n+\tif (context.frameContext.af.stable) {\n+\t\tavgExposure_ = (0.2 * avgExposure_) + ((1 - 0.2) * latestExposure);\n+\t\tif (latestExposure > lowerEx && latestExposure < upperEx)\n+\t\t\tcontext.frameContext.agc.stable = true;\n+\t\telse {\n+\t\t\tif (context.frameContext.af.stable)\n+\t\t\t\tcontext.frameContext.agc.stable = false;\n+\t\t}\n+\t}\n+}\n+\n /**\n  * \\brief Process IPU3 statistics, and run AGC operations\n  * \\param[in] context The shared IPA context\n@@ -359,6 +378,7 @@ void Agc::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)\n \n \tcomputeExposure(context, yGain, iqMeanGain);\n \tframeCount_++;\n+\tevaluateStable(context);\n }\n \n } /* namespace ipa::ipu3::algorithms */\ndiff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h\nindex ad705605..56ef2c10 100644\n--- a/src/ipa/ipu3/algorithms/agc.h\n+++ b/src/ipa/ipu3/algorithms/agc.h\n@@ -40,6 +40,7 @@ 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 evaluateStable(IPAContext &context);\n \n \tuint64_t frameCount_;\n \n@@ -51,6 +52,8 @@ private:\n \n \tutils::Duration filteredExposure_;\n \n+\tuint32_t avgExposure_;\n+\n \tuint32_t stride_;\n };\n \ndiff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h\nindex 103498ef..ddef4e74 100644\n--- a/src/ipa/ipu3/ipa_context.h\n+++ b/src/ipa/ipu3/ipa_context.h\n@@ -52,6 +52,7 @@ struct IPAFrameContext {\n \tstruct {\n \t\tuint32_t exposure;\n \t\tdouble gain;\n+\t\tbool stable;\n \t} agc;\n \n \tstruct {\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "1/3"
    ]
}