Patch Detail
Show a patch.
GET /api/patches/21645/?format=api
{ "id": 21645, "url": "https://patchwork.libcamera.org/api/patches/21645/?format=api", "web_url": "https://patchwork.libcamera.org/patch/21645/", "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-2-jacopo.mondi@ideasonboard.com>", "date": "2024-10-16T17:03:42", "name": "[1/4] libipa: FrameContext: Move init() to FrameContext", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "d26448fb4e1b67ad9423427ed2b9418262565dae", "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/21645/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/21645/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/21645/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 1D03DC32FA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 16 Oct 2024 17:04:08 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7317365389;\n\tWed, 16 Oct 2024 19:04:03 +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 132506537F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 16 Oct 2024 19:03:59 +0200 (CEST)", "from ideasonboard.com (unknown [5.179.178.254])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 13727E0D;\n\tWed, 16 Oct 2024 19:02:15 +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=\"hYKYK936\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1729098136;\n\tbh=nvoR9zgb+OWw1hBzlRG1xkn55L/XGOsohzyykG+tyXo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=hYKYK936PAGmJu8SgTwqRSj6XFZjxpHHDDjMhQyJNcz41BrXE+fMqP+/DfmM6kANQ\n\tSSWCGz6k5kOrRfNrZ2cNrMMOl2sph0wYD/Oj7gbNS8f2sCcWP/rBxGhT6aqPAxV+31\n\tq5noeldeXvqn+x1JQYHGjxGpbwbFY4upw7yMnpoQ=", "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 1/4] libipa: FrameContext: Move init() to FrameContext", "Date": "Wed, 16 Oct 2024 19:03:42 +0200", "Message-ID": "<20241016170348.715993-2-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 FCtQueue structure initializes a new FrameContext using its init()\nfunction. In case of request underrun, where a FrameContext is\ninitialized without application's controls being supplied, the\nFrameContext needs to be initialized to default values.\n\nIn order to allow the single IPAs to initialize a FrameContext to\nthe desired default values, move the init() function to the FrameContext\nstructure, which each IPA derives to a per-IPA type.\n\nIn this way each IPA can override the FrameContext::init() function\nand initialize the FrameContext to the desired default values.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n src/ipa/libipa/fc_queue.cpp | 10 ++++++++++\n src/ipa/libipa/fc_queue.h | 16 ++++++++--------\n src/ipa/rkisp1/ipa_context.cpp | 5 +++++\n src/ipa/rkisp1/ipa_context.h | 2 ++\n 4 files changed, 25 insertions(+), 8 deletions(-)", "diff": "diff --git a/src/ipa/libipa/fc_queue.cpp b/src/ipa/libipa/fc_queue.cpp\nindex 0365e9197748..fa2454fd5706 100644\n--- a/src/ipa/libipa/fc_queue.cpp\n+++ b/src/ipa/libipa/fc_queue.cpp\n@@ -38,6 +38,16 @@ namespace ipa {\n * \\brief The frame number\n */\n \n+/**\n+ * \\fn FrameContext::init()\n+ * \\brief Initialize a frame context\n+ * \\param[in] frameNum The frame number to assign to this FrameContext\n+ *\n+ * This function initializes a frame context by assigning it a frame number.\n+ * The single IPA modules are expected to override this function to initialize\n+ * their derived FrameContext implementation to their desired default values.\n+ */\n+\n /**\n * \\class FCQueue\n * \\brief A support class for managing FrameContext instances in IPA modules\ndiff --git a/src/ipa/libipa/fc_queue.h b/src/ipa/libipa/fc_queue.h\nindex 24d9e82b727d..b1e8bc1485d4 100644\n--- a/src/ipa/libipa/fc_queue.h\n+++ b/src/ipa/libipa/fc_queue.h\n@@ -22,6 +22,12 @@ template<typename FrameContext>\n class FCQueue;\n \n struct FrameContext {\n+protected:\n+\tvirtual void init(const uint32_t frameNum)\n+\t{\n+\t\tframe = frameNum;\n+\t}\n+\n private:\n \ttemplate<typename T> friend class FCQueue;\n \tuint32_t frame;\n@@ -61,7 +67,7 @@ public:\n \t\t\tLOG(FCQueue, Warning)\n \t\t\t\t<< \"Frame \" << frame << \" already initialised\";\n \t\telse\n-\t\t\tinit(frameContext, frame);\n+\t\t\tframeContext.init(frame);\n \n \t\treturn frameContext;\n \t}\n@@ -98,18 +104,12 @@ public:\n \t\tLOG(FCQueue, Warning)\n \t\t\t<< \"Obtained an uninitialised FrameContext for \" << frame;\n \n-\t\tinit(frameContext, frame);\n+\t\tframeContext.init(frame);\n \n \t\treturn frameContext;\n \t}\n \n private:\n-\tvoid init(FrameContext &frameContext, const uint32_t frame)\n-\t{\n-\t\tframeContext = {};\n-\t\tframeContext.frame = frame;\n-\t}\n-\n \tstd::vector<FrameContext> contexts_;\n };\n \ndiff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\nindex 14d0c02a2b32..4e4fe5f4ae96 100644\n--- a/src/ipa/rkisp1/ipa_context.cpp\n+++ b/src/ipa/rkisp1/ipa_context.cpp\n@@ -417,6 +417,11 @@ namespace libcamera::ipa::rkisp1 {\n * \\brief Analogue gain multiplier\n */\n \n+void IPAFrameContext::init(const uint32_t frameNum)\n+{\n+\tFrameContext::init(frameNum);\n+}\n+\n /**\n * \\struct IPAContext\n * \\brief Global IPA context data shared between all algorithms\ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex e274d9b01e1c..51e04bc30627 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -177,6 +177,8 @@ struct IPAFrameContext : public FrameContext {\n \tstruct {\n \t\tMatrix<float, 3, 3> ccm;\n \t} ccm;\n+\n+\tvoid init(const uint32_t frame) override;\n };\n \n struct IPAContext {\n", "prefixes": [ "1/4" ] }