Show a patch.

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

{
    "id": 14996,
    "url": "https://patchwork.libcamera.org/api/patches/14996/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14996/",
    "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": "<20211202180410.518232-3-jeanmichel.hautbois@ideasonboard.com>",
    "date": "2021-12-02T18:04:06",
    "name": "[libcamera-devel,v1,2/6] ipa: rkisp1: Use frame index",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "69af1059b016cb2db21b9b9c138760108a7e26c0",
    "submitter": {
        "id": 75,
        "url": "https://patchwork.libcamera.org/api/people/75/?format=api",
        "name": "Jean-Michel Hautbois",
        "email": "jeanmichel.hautbois@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/14996/mbox/",
    "series": [
        {
            "id": 2805,
            "url": "https://patchwork.libcamera.org/api/series/2805/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2805",
            "date": "2021-12-02T18:04:04",
            "name": "IPA RkISP1 awb and misc improvements",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2805/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14996/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14996/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 78267C3250\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Dec 2021 18:04:21 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A77196082A;\n\tThu,  2 Dec 2021 19:04:20 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EB10A605B8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Dec 2021 19:04:15 +0100 (CET)",
            "from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:7fc3:78ca:aeee:c4f2])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A7971D8B;\n\tThu,  2 Dec 2021 19:04:15 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"nuJ4kmLG\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1638468255;\n\tbh=8CcndOuDFTUXh7bslJGTOs8AaAYoZQ2ALtVSt+Hbsy4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=nuJ4kmLGnkbjAYfShfv9tjTu6wV7WNlimDYAMn+T4mUiAsfP/KrJkESkp6dr6vi6E\n\tJ5szczCMt3+WjNUITYuHFdcb6gpbwrAiQWw71b3U7LCEd+QkGQrgFtDU2nR1fELS8+\n\tAJFZzbZrmYOZGvTFiWjkc/lQ7rMGQzwLPRCBSsIc=",
        "From": "Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu,  2 Dec 2021 19:04:06 +0100",
        "Message-Id": "<20211202180410.518232-3-jeanmichel.hautbois@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20211202180410.518232-1-jeanmichel.hautbois@ideasonboard.com>",
        "References": "<20211202180410.518232-1-jeanmichel.hautbois@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v1 2/6] ipa: rkisp1: Use frame index",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Instead of incrementing the frameCount manually, use the frame index on\nthe EventStatReay event and store it in a new IPAFrameContext variable\nnamed frameId.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/agc.cpp |  5 ++---\n src/ipa/rkisp1/ipa_context.cpp    |  5 +++++\n src/ipa/rkisp1/ipa_context.h      |  2 ++\n src/ipa/rkisp1/rkisp1.cpp         | 11 +++++------\n 4 files changed, 14 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex d6abdc310..f95ecfde5 100644\n--- a/src/ipa/rkisp1/algorithms/agc.cpp\n+++ b/src/ipa/rkisp1/algorithms/agc.cpp\n@@ -81,8 +81,6 @@ int Agc::configure(IPAContext &context,\n \telse\n \t\tnumCells_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V12;\n \n-\t/* \\todo Use actual frame index by populating it in the frameContext. */\n-\tframeCount_ = 0;\n \treturn 0;\n }\n \n@@ -254,6 +252,8 @@ void Agc::process(IPAContext &context, const rkisp1_stat_buffer *stats)\n \n \tconst rkisp1_cif_isp_ae_stat *ae = &params->ae;\n \n+\tframeCount_ = context.frameContext.frameId;\n+\n \t/*\n \t * Estimate the gain needed to achieve a relative luminance target. To\n \t * account for non-linearity caused by saturation, the value needs to be\n@@ -277,7 +277,6 @@ void Agc::process(IPAContext &context, const rkisp1_stat_buffer *stats)\n \t}\n \n \tcomputeExposure(context, yGain);\n-\tframeCount_++;\n }\n \n void Agc::prepare([[maybe_unused]] IPAContext &context,\ndiff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\nindex 9cb2a9fda..992c92256 100644\n--- a/src/ipa/rkisp1/ipa_context.cpp\n+++ b/src/ipa/rkisp1/ipa_context.cpp\n@@ -113,4 +113,9 @@ namespace libcamera::ipa::rkisp1 {\n  * \\brief Analogue gain multiplier\n  */\n \n+/**\n+ * \\var IPAFrameContext::frameId\n+ * \\brief Frame number for this frame context\n+ */\n+\n } /* namespace libcamera::ipa::rkisp1 */\ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex b94ade0c5..c447369f3 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -43,6 +43,8 @@ struct IPAFrameContext {\n \t\tuint32_t exposure;\n \t\tdouble gain;\n \t} sensor;\n+\n+\tunsigned int frameId;\n };\n \n struct IPAContext {\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 07f1f1c87..cd425a2e1 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -57,8 +57,7 @@ public:\n private:\n \tvoid queueRequest(unsigned int frame, rkisp1_params_cfg *params,\n \t\t\t  const ControlList &controls);\n-\tvoid updateStatistics(unsigned int frame,\n-\t\t\t      const rkisp1_stat_buffer *stats);\n+\tvoid updateStatistics(const rkisp1_stat_buffer *stats);\n \n \tvoid setControls(unsigned int frame);\n \tvoid metadataReady(unsigned int frame, unsigned int aeState);\n@@ -241,7 +240,6 @@ void IPARkISP1::processEvent(const RkISP1Event &event)\n {\n \tswitch (event.op) {\n \tcase EventSignalStatBuffer: {\n-\t\tunsigned int frame = event.frame;\n \t\tunsigned int bufferId = event.bufferId;\n \n \t\tconst rkisp1_stat_buffer *stats =\n@@ -252,8 +250,9 @@ void IPARkISP1::processEvent(const RkISP1Event &event)\n \t\t\tevent.sensorControls.get(V4L2_CID_EXPOSURE).get<int32_t>();\n \t\tcontext_.frameContext.sensor.gain =\n \t\t\tcamHelper_->gain(event.sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get<int32_t>());\n+\t\tcontext_.frameContext.frameId = event.frame;\n \n-\t\tupdateStatistics(frame, stats);\n+\t\tupdateStatistics(stats);\n \t\tbreak;\n \t}\n \tcase EventQueueRequest: {\n@@ -288,10 +287,10 @@ void IPARkISP1::queueRequest(unsigned int frame, rkisp1_params_cfg *params,\n \tqueueFrameAction.emit(frame, op);\n }\n \n-void IPARkISP1::updateStatistics(unsigned int frame,\n-\t\t\t\t const rkisp1_stat_buffer *stats)\n+void IPARkISP1::updateStatistics(const rkisp1_stat_buffer *stats)\n {\n \tunsigned int aeState = 0;\n+\tunsigned int frame = context_.frameContext.frameId;\n \n \tfor (auto const &algo : algorithms_)\n \t\talgo->process(context_, stats);\n",
    "prefixes": [
        "libcamera-devel",
        "v1",
        "2/6"
    ]
}