{"id":17436,"url":"https://patchwork.libcamera.org/api/patches/17436/?format=json","web_url":"https://patchwork.libcamera.org/patch/17436/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20220927023642.12341-26-laurent.pinchart@ideasonboard.com>","date":"2022-09-27T02:36:34","name":"[libcamera-devel,v5,25/33] ipa: rkisp1: Document the active state and frame context","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"300a9254a9ebc75825af3a7751c146028323ca66","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17436/mbox/","series":[{"id":3506,"url":"https://patchwork.libcamera.org/api/series/3506/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3506","date":"2022-09-27T02:36:09","name":"ipa: Frame context queue, IPU3 & RkISP consolidation, and RkISP1 improvements","version":5,"mbox":"https://patchwork.libcamera.org/series/3506/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17436/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17436/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 44E29C327E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 27 Sep 2022 02:37:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F26D962278;\n\tTue, 27 Sep 2022 04:37:41 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 310AF62273\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Sep 2022 04:37:39 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AAD93E5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Sep 2022 04:37:38 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664246262;\n\tbh=DAKwY6U4JDfQRn2KCymAmlS4p4TPatrnAha6ECJUbm8=;\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=MYIFvzovhJfzLjSOx2awnevS1+ue1AW2tJHk97LEO2rqFlFLJejhDHpJUyxjMh2py\n\tpuVWbg+clih0DEAh2SX6I8v1vMk7KLlBwg/gnmUfVmIUUjAm8VpAJchZKNYiBDuqiy\n\tQXEpwEpURIl3kRrmsPBWlj1Y1tDWogbdcABSuqrLwf/ZrSAu3G8VzUNYvVuQ2m79R0\n\tkRPb39lx5s96sul/lfdBCAX1tFvMzr2PKC/fdzybBkF7aH8HDoeXyetM6u1XgZsjj5\n\tgVt0rVe8/dKdPQ6CJg6NuvXSZFfiGexa76bSDhaau8MAa7ghvW/nh0ooMyfbgr53GP\n\tdFS20tmOrxoPQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1664246258;\n\tbh=DAKwY6U4JDfQRn2KCymAmlS4p4TPatrnAha6ECJUbm8=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=k93u81/M2YrrvSlA18C2caruA3w8jvFvSar2LYEzseZ3wtybs8rZQpIeBzSGtnseY\n\tqUGwT9aPkN/u+HlNU+zng7OS733/nqkwlWn1s+VvPphP+Gdh3aJsB+ueE14EHVHire\n\t7aA6f8qzYm/+VcBhnGKIOHOjOJogH2r2zI9BN370="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"k93u81/M\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 27 Sep 2022 05:36:34 +0300","Message-Id":"<20220927023642.12341-26-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.35.1","In-Reply-To":"<20220927023642.12341-1-laurent.pinchart@ideasonboard.com>","References":"<20220927023642.12341-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 25/33] ipa: rkisp1: Document the active\n\tstate and frame context","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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Now that data used by algorithms has been partitioned between the active\nstate and frame context, we have a better view of the role of each of\nthose structures. Document them appropriately.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\nChanges since v4:\n\n- Fix typo in documentation\n---\n src/ipa/rkisp1/ipa_context.cpp | 55 ++++++++++++++++++++++++++++------\n 1 file changed, 46 insertions(+), 9 deletions(-)","diff":"diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\nindex 4380634e272d..2126ed1d0acb 100644\n--- a/src/ipa/rkisp1/ipa_context.cpp\n+++ b/src/ipa/rkisp1/ipa_context.cpp\n@@ -88,16 +88,28 @@ namespace libcamera::ipa::rkisp1 {\n  * \\struct IPAActiveState\n  * \\brief Active state for algorithms\n  *\n- * The active state stores algorithm-specific data that needs to be shared\n- * between multiple algorithms and the IPA module. It is accessible through the\n- * IPAContext structure.\n+ * The active state contains all algorithm-specific data that needs to be\n+ * maintained by algorithms across frames. Unlike the session configuration,\n+ * the active state is mutable and constantly updated by algorithms. The active\n+ * state is accessible through the IPAContext structure.\n  *\n- * \\todo Split the data contained in this structure between the active state\n- * and the frame contexts.\n+ * The active state stores two distinct categories of information:\n  *\n- * Each of the fields in the active state belongs to either a specific\n- * algorithm, or to the top-level IPA module. A field may be read by any\n- * algorithm, but should only be written by its owner.\n+ *  - The consolidated value of all algorithm controls. Requests passed to\n+ *    the queueRequest() function store values for controls that the\n+ *    application wants to modify for that particular frame, and the\n+ *    queueRequest() function updates the active state with those values.\n+ *    The active state thus contains a consolidated view of the value of all\n+ *    controls handled by the algorithm.\n+ *\n+ *  - The value of parameters computed by the algorithm when running in auto\n+ *    mode. Algorithms running in auto mode compute new parameters every\n+ *    time statistics buffers are received (either synchronously, or\n+ *    possibly in a background thread). The latest computed value of those\n+ *    parameters is stored in the active state in the process() function.\n+ *\n+ * Each of the members in the active state belongs to a specific algorithm. A\n+ * member may be read by any algorithm, but shall only be written by its owner.\n  */\n \n /**\n@@ -185,7 +197,32 @@ namespace libcamera::ipa::rkisp1 {\n  * \\struct IPAFrameContext\n  * \\brief Per-frame context for algorithms\n  *\n- * \\todo Populate the frame context for all algorithms\n+ * The frame context stores two distinct categories of information:\n+ *\n+ * - The value of the controls to be applied to the frame. These values are\n+ *   typically set in the queueRequest() function, from the consolidated\n+ *   control values stored in the active state. The frame context thus stores\n+ *   values for all controls related to the algorithm, not limited to the\n+ *   controls specified in the corresponding request, but consolidated from all\n+ *   requests that have been queued so far.\n+ *\n+ *   For controls that can be set manually or computed by an algorithm\n+ *   (depending on the algorithm operation mode), such as for instance the\n+ *   colour gains for the AWB algorithm, the control value will be stored in\n+ *   the frame context in the queueRequest() function only when operating in\n+ *   manual mode. When operating in auto mode, the values are computed by the\n+ *   algorithm in process(), stored in the active state, and copied to the\n+ *   frame context in prepare(), just before being stored in the ISP parameters\n+ *   buffer.\n+ *\n+ *   The queueRequest() function can also store ancillary data in the frame\n+ *   context, such as flags to indicate if (and what) control values have\n+ *   changed compared to the previous request.\n+ *\n+ * - Status information computed by the algorithm for a frame. For instance,\n+ *   the colour temperature estimated by the AWB algorithm from ISP statistics\n+ *   calculated on a frame is stored in the frame context for that frame in\n+ *   the process() function.\n  */\n \n /**\n","prefixes":["libcamera-devel","v5","25/33"]}