Show a patch.

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

{
    "id": 21648,
    "url": "https://patchwork.libcamera.org/api/patches/21648/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21648/",
    "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": "<20241016170348.715993-5-jacopo.mondi@ideasonboard.com>",
    "date": "2024-10-16T17:03:45",
    "name": "[4/4] ipa: rkisp1: Initialize FrameContext.agc.meteringMode",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "7a7096c0ab9a204b7cdf28af75912240f2e35b04",
    "submitter": {
        "id": 143,
        "url": "https://patchwork.libcamera.org/api/people/143/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo.mondi@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/21648/mbox/",
    "series": [
        {
            "id": 4708,
            "url": "https://patchwork.libcamera.org/api/series/4708/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4708",
            "date": "2024-10-16T17:03:41",
            "name": "libipa: Initialize FrameContext with ActiveState",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4708/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21648/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21648/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 298FFC32FA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 16 Oct 2024 17:04:15 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8356265390;\n\tWed, 16 Oct 2024 19:04:14 +0200 (CEST)",
            "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 12D7065387\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 16 Oct 2024 19:04:02 +0200 (CEST)",
            "from ideasonboard.com (unknown [5.179.178.254])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 146BCA57;\n\tWed, 16 Oct 2024 19:02:18 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"oRGfja8u\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1729098139;\n\tbh=WdPsga3bUrrKjDFEvYjrkFAbfuqXjMX3ciPAAERo/f4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=oRGfja8uExYE/NAVb1p5IH5AVgrQRJOsJKy3S892iQrgCD9VhOp7SvM5GeGrsCr17\n\t3PQ1zsAfPbi0APqA85xgQiOOamm0pm+0JKAx1RqQj6c//ARRFCGqMZrfUmNEf0nujl\n\t7DhUECNlZvy8EpSeOy65FyU9RhgIQE4YqWXh74ns=",
        "From": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>",
        "Subject": "[PATCH 4/4] ipa: rkisp1: Initialize FrameContext.agc.meteringMode",
        "Date": "Wed, 16 Oct 2024 19:03:45 +0200",
        "Message-ID": "<20241016170348.715993-5-jacopo.mondi@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.47.0",
        "In-Reply-To": "<20241016170348.715993-1-jacopo.mondi@ideasonboard.com>",
        "References": "<20241016170348.715993-1-jacopo.mondi@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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": "The RkISP1 AGC algorithms assumes the metering mode to be\n\"MeteringMatrix\" and pre-fill an array of weights associated\nwith it stored in meteringModes_[MeteringMatrix] when intializing\nthe algorithm in parseMeteringModes().\n\nIt laters fetches the weights when computing parameters using the\nFrameContext.agc.meteringMode as index of the meteringModes_ array.\n\nWhen a Request gets queued to the algorithm, the\nFrameContext.agc.meteringMode index is populated from the algorithm's\nactive state, and optionally updated if the application has specified\na different metering mode.\n\nIn case of Request underrun however, a non-initialized FrameContext\ngets provided to the algorithm, causing an (unhandled) exception when\naccessing the meteringModes_ array.\n\nFix this by intializing the AGC metering mode to a supported value\ncoming from the ActiveState in IPAFrameContext::init().\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/agc.cpp | 2 ++\n src/ipa/rkisp1/ipa_context.cpp    | 5 +++++\n 2 files changed, 7 insertions(+)",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex 17d074d9c03e..dd7e9468741e 100644\n--- a/src/ipa/rkisp1/algorithms/agc.cpp\n+++ b/src/ipa/rkisp1/algorithms/agc.cpp\n@@ -175,6 +175,8 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n \t\tstatic_cast<controls::AeConstraintModeEnum>(constraintModes().begin()->first);\n \tcontext.activeState.agc.exposureMode =\n \t\tstatic_cast<controls::AeExposureModeEnum>(exposureModeHelpers().begin()->first);\n+\n+\t/* Use the metering matrix mode by default. */\n \tcontext.activeState.agc.meteringMode =\n \t\tstatic_cast<controls::AeMeteringModeEnum>(meteringModes_.begin()->first);\n \ndiff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\nindex 2dad42b3154f..e88609137345 100644\n--- a/src/ipa/rkisp1/ipa_context.cpp\n+++ b/src/ipa/rkisp1/ipa_context.cpp\n@@ -421,6 +421,11 @@ void IPAFrameContext::init(const uint32_t frameNum,\n \t\t\t   const ActiveState &activeState)\n {\n \tFrameContext::init(frameNum, activeState);\n+\n+\tconst IPAActiveState *rkisp1ActiveState =\n+\t\treinterpret_cast<const IPAActiveState *>(&activeState);\n+\n+\tagc.meteringMode = rkisp1ActiveState->agc.meteringMode;\n }\n \n /**\n",
    "prefixes": [
        "4/4"
    ]
}