From patchwork Thu Sep 8 01:41:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 17333 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 371D4C3272 for ; Thu, 8 Sep 2022 01:42:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DD0FF620F1; Thu, 8 Sep 2022 03:42:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662601373; bh=lir+T+wpRYOiNU4TK0RI1MEqMh5BYXbnxK6geybiTVY=; 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=jc+4xEArCV/4xv9yH+1aCUaG8+WSSfPDlYF2pQxZJtgDgMUbuvTwEXGNTfbk1DUxs ogK6sYBMeUq+Wc4xZfkDqgfHH/U0rNortSz6HWdBbANTUD0uioLZk12nfGaI2gblv6 XPnI3zyxhUX/oIuNj31p73Xo/KVdfxGhYHuzgpwstIqAMeM9pxbpYScDmeh0Acshwc MOBGFvoicVtKZkA5O7DyLHt8R6gswECwryoa+/Te2DbvlG1ZXMsstiBMhZ3SdtHUye xMIjrGqY4YYBwfNI4HttGkpCPTUpR+0yCXaT/YXtqAzKykfYLiB0Qi6ONFTxm5tCza 7w3u9nbJVoy7g== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5C6C562094 for ; Thu, 8 Sep 2022 03:42:51 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="rhiugPjO"; 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 E0C046CC for ; Thu, 8 Sep 2022 03:42:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1662601371; bh=lir+T+wpRYOiNU4TK0RI1MEqMh5BYXbnxK6geybiTVY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rhiugPjO9K8+o956ntxyYtszgIZ2C+1gJZymcOjY/3VQS/LvksbTQYZ4jLKFxj+mU /93w3LMnP4SgqxDfw0UjUO3jrWKM6U8gq5+FhiS3fiTt4kCeeXbgscLtlUNOh/zPqj SFbQxc98wzvGISPgvHODpuQiLb+AWi5CKGjgB5Yg= To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 04:41:52 +0300 Message-Id: <20220908014200.28728-25-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220908014200.28728-1-laurent.pinchart@ideasonboard.com> References: <20220908014200.28728-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 24/32] 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 --- 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 b2628ef73d49..335cb32c538d 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 need 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 RkISP1FrameContext * \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. */ /**