{"id":26360,"url":"https://patchwork.libcamera.org/api/1.1/patches/26360/?format=json","web_url":"https://patchwork.libcamera.org/patch/26360/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260325151416.2114564-19-stefan.klug@ideasonboard.com>","date":"2026-03-25T15:13:50","name":"[v2,18/32] libipa: algorithm: Update docs","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"cbc0c18808a44ae619316db0f077cc7f4cf3d07e","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/1.1/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/26360/mbox/","series":[{"id":5849,"url":"https://patchwork.libcamera.org/api/1.1/series/5849/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5849","date":"2026-03-25T15:13:32","name":"rkisp1: pipeline rework for PFC","version":2,"mbox":"https://patchwork.libcamera.org/series/5849/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/26360/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/26360/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 20BCCC3302\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 25 Mar 2026 15:15:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9B0C962C3D;\n\tWed, 25 Mar 2026 16:15:33 +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 A776F6274D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 25 Mar 2026 16:15:31 +0100 (CET)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:b16a:5ed9:4ada:a95a])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id B0A901943; \n\tWed, 25 Mar 2026 16:14:13 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"BBL8VjlX\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1774451653;\n\tbh=EFewKCAt/7JAXms7yDaFl2tWUeG+Y0w4vVz6NT4aA/A=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=BBL8VjlX4prXE/fovZXaBsjasQ5dAc3cLXxHFW9twH6NxvdVg9umPPJCY/Rnsn48Y\n\thrpP7CwfXNmSf711na/4v7uZCHDEp5yt9dPfU6c7NQEDTS96G6I6s8uLzmBjJYxS7O\n\t3u/ga9VpvSB/xNhinNIr0LjJcH/y2xu5nLXQXGWM=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v2 18/32] libipa: algorithm: Update docs","Date":"Wed, 25 Mar 2026 16:13:50 +0100","Message-ID":"<20260325151416.2114564-19-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.51.0","In-Reply-To":"<20260325151416.2114564-1-stefan.klug@ideasonboard.com>","References":"<20260325151416.2114564-1-stefan.klug@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":"Update the algorithm documentation to reflect the changed timing model.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\n---\n\nChanges in v2:\n- Added more documentation\n---\n src/ipa/libipa/algorithm.cpp | 41 ++++++++++++++++++++++--------------\n 1 file changed, 25 insertions(+), 16 deletions(-)","diff":"diff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp\nindex 201efdfdba25..e491cb241442 100644\n--- a/src/ipa/libipa/algorithm.cpp\n+++ b/src/ipa/libipa/algorithm.cpp\n@@ -76,11 +76,13 @@ namespace ipa {\n  *\n  * This function is called for each request queued to the camera. It provides\n  * the controls stored in the request to the algorithm. The \\a frame number\n- * is the Request sequence number and identifies the desired corresponding\n+ * is the sensor sequence number and identifies the desired corresponding\n  * frame to target for the controls to take effect.\n  *\n  * Algorithms shall read the applicable controls and store their value for later\n- * use during frame processing.\n+ * use during frame processing. All values that are already known (like exposure\n+ * time/gain in manual mode) shall be updated in \\a frameContext to support\n+ * cases where prepare() is never called (like in raw mode).\n  */\n \n /**\n@@ -92,20 +94,29 @@ namespace ipa {\n  * \\param[out] params The ISP specific parameters\n  *\n  * This function is called for every frame when the camera is running before it\n- * is processed by the ISP to prepare the ISP processing parameters for that\n- * frame.\n+ * is processed by the ISP to prepare the ISP processing parameters and the\n+ * sensor parameters for that frame.\n  *\n  * Algorithms shall fill in the parameter structure fields appropriately to\n  * configure the ISP processing blocks that they are responsible for. This\n  * includes setting fields and flags that enable those processing blocks.\n+ *\n+ * Additionally \\a frameContext shall be updated with the most up to date values\n+ * necessary to configure the sensor. After prepare() the \\a frameContext for\n+ * this frame shall be treated read only.\n+ *\n+ * \\todo: For offline ISPs there might be use cases where it is beneficial to\n+ * separate the calculation of sensor parameters from the calculation of ISP\n+ * paremeters. This is currently not supported.\n  */\n \n /**\n  * \\fn Algorithm::process()\n  * \\brief Process ISP statistics, and run algorithm operations\n  * \\param[in] context The shared IPA context\n- * \\param[in] frame The frame context sequence number\n- * \\param[in] frameContext The current frame's context\n+ * \\param[in] frame The frame sequence number that produces the stats\n+ * \\param[in] frameContext The frame context for the frame that produced the\n+ * stats\n  * \\param[in] stats The IPA statistics and ISP results\n  * \\param[out] metadata Metadata for the frame, to be filled by the algorithm\n  *\n@@ -118,19 +129,17 @@ namespace ipa {\n  * computationally expensive calculations or operations must be handled\n  * asynchronously in a separate thread.\n  *\n- * Algorithms can store state in their respective IPAFrameContext structures,\n- * and reference state from the IPAFrameContext of other algorithms.\n- *\n- * \\todo Historical data may be required as part of the processing.\n- * Either the previous frame, or the IPAFrameContext state of the frame\n- * that generated the statistics for this operation may be required for\n- * some advanced algorithms to prevent oscillations or support control\n- * loops correctly. Only a single IPAFrameContext is available currently,\n- * and so any data stored may represent the results of the previously\n- * completed operations.\n+ * Care must be taken to ensure that the frameContext is only updated in cases\n+ * where the frame was not processed yet. This usually differs between offline\n+ * and inline ISPs. In an inline ISP the stats are received after processing the\n+ * frame. In this case the frame context *must not* be updated. Algorithms\n+ * typically update the active state which is then picked up in prepare().\n  *\n  * Care shall be taken to ensure the ordering of access to the information\n  * such that the algorithms use up to date state as required.\n+ *\n+ * The \\a stats parameter can be null in which case only the frame metadata\n+ * shall be filled with the data from frameContext.\n  */\n \n /**\n","prefixes":["v2","18/32"]}