From patchwork Tue Sep 27 02:36:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 17436 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 44E29C327E for ; Tue, 27 Sep 2022 02:37:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F26D962278; Tue, 27 Sep 2022 04:37:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1664246262; bh=DAKwY6U4JDfQRn2KCymAmlS4p4TPatrnAha6ECJUbm8=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=MYIFvzovhJfzLjSOx2awnevS1+ue1AW2tJHk97LEO2rqFlFLJejhDHpJUyxjMh2py puVWbg+clih0DEAh2SX6I8v1vMk7KLlBwg/gnmUfVmIUUjAm8VpAJchZKNYiBDuqiy QXEpwEpURIl3kRrmsPBWlj1Y1tDWogbdcABSuqrLwf/ZrSAu3G8VzUNYvVuQ2m79R0 kRPb39lx5s96sul/lfdBCAX1tFvMzr2PKC/fdzybBkF7aH8HDoeXyetM6u1XgZsjj5 gVt0rVe8/dKdPQ6CJg6NuvXSZFfiGexa76bSDhaau8MAa7ghvW/nh0ooMyfbgr53GP dFS20tmOrxoPQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 310AF62273 for ; Tue, 27 Sep 2022 04:37:39 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="k93u81/M"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AAD93E5 for ; Tue, 27 Sep 2022 04:37:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1664246258; bh=DAKwY6U4JDfQRn2KCymAmlS4p4TPatrnAha6ECJUbm8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=k93u81/M2YrrvSlA18C2caruA3w8jvFvSar2LYEzseZ3wtybs8rZQpIeBzSGtnseY qUGwT9aPkN/u+HlNU+zng7OS733/nqkwlWn1s+VvPphP+Gdh3aJsB+ueE14EHVHire 7aA6f8qzYm/+VcBhnGKIOHOjOJogH2r2zI9BN370= 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 Subject: [libcamera-devel] [PATCH v5 25/33] ipa: rkisp1: Document the active state and frame context X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Now that data used by algorithms has been partitioned between the active state and frame context, we have a better view of the role of each of those structures. Document them appropriately. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- Changes since v4: - Fix typo in documentation --- src/ipa/rkisp1/ipa_context.cpp | 55 ++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp index 4380634e272d..2126ed1d0acb 100644 --- a/src/ipa/rkisp1/ipa_context.cpp +++ b/src/ipa/rkisp1/ipa_context.cpp @@ -88,16 +88,28 @@ namespace libcamera::ipa::rkisp1 { * \struct IPAActiveState * \brief Active state for algorithms * - * The active state stores algorithm-specific data that needs to be shared - * between multiple algorithms and the IPA module. It is accessible through the - * IPAContext structure. + * The active state contains all algorithm-specific data that needs to be + * maintained by algorithms across frames. Unlike the session configuration, + * the active state is mutable and constantly updated by algorithms. The active + * state is accessible through the IPAContext structure. * - * \todo Split the data contained in this structure between the active state - * and the frame contexts. + * The active state stores two distinct categories of information: * - * Each of the fields in the active state belongs to either a specific - * algorithm, or to the top-level IPA module. A field may be read by any - * algorithm, but should only be written by its owner. + * - The consolidated value of all algorithm controls. Requests passed to + * the queueRequest() function store values for controls that the + * application wants to modify for that particular frame, and the + * queueRequest() function updates the active state with those values. + * The active state thus contains a consolidated view of the value of all + * controls handled by the algorithm. + * + * - The value of parameters computed by the algorithm when running in auto + * mode. Algorithms running in auto mode compute new parameters every + * time statistics buffers are received (either synchronously, or + * possibly in a background thread). The latest computed value of those + * parameters is stored in the active state in the process() function. + * + * Each of the members in the active state belongs to a specific algorithm. A + * member may be read by any algorithm, but shall only be written by its owner. */ /** @@ -185,7 +197,32 @@ namespace libcamera::ipa::rkisp1 { * \struct IPAFrameContext * \brief Per-frame context for algorithms * - * \todo Populate the frame context for all algorithms + * The frame context stores two distinct categories of information: + * + * - The value of the controls to be applied to the frame. These values are + * typically set in the queueRequest() function, from the consolidated + * control values stored in the active state. The frame context thus stores + * values for all controls related to the algorithm, not limited to the + * controls specified in the corresponding request, but consolidated from all + * requests that have been queued so far. + * + * For controls that can be set manually or computed by an algorithm + * (depending on the algorithm operation mode), such as for instance the + * colour gains for the AWB algorithm, the control value will be stored in + * the frame context in the queueRequest() function only when operating in + * manual mode. When operating in auto mode, the values are computed by the + * algorithm in process(), stored in the active state, and copied to the + * frame context in prepare(), just before being stored in the ISP parameters + * buffer. + * + * The queueRequest() function can also store ancillary data in the frame + * context, such as flags to indicate if (and what) control values have + * changed compared to the previous request. + * + * - Status information computed by the algorithm for a frame. For instance, + * the colour temperature estimated by the AWB algorithm from ISP statistics + * calculated on a frame is stored in the frame context for that frame in + * the process() function. */ /**