From patchwork Mon Jun 20 01:42:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 16274 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 4C427BE173 for ; Mon, 20 Jun 2022 01:43:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9349D65633; Mon, 20 Jun 2022 03:43:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655689412; bh=Xxl+STqEGupZEhYQYUvsvYDr2vDwbtwqtSyAbTNUD/U=; 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=vAcYR3HgPbQBudJozWnD4aC/dF09kkezX4AzCvGSELxqp+0GyANthN4lJXb9aYzDF spPAKLYbFud5fjjE36bDRoXkmXcFAJ53kbUNfacC+c4fNzGTih63SNy6xYolOaIEfS lcBM/cVjLN5cQFC09JfoF5cwssT2+/JxTpfOB4sAjvRcY60oGg3vZ+z8R5RHDjgr8q CjnYAwUOjxUMy1RFMJyHgfA7wqlxjS2NXdVmWlYrCjNhstIkBeV8VnF8z7SicLnhRs bcQGHIQQiab46QtXh2DtPg+Hdqke8EWOtWo0yWF3e+0/yuG193gNLbC7IcvQpTX5UM P98V9eQmVmXvQ== 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 DD9B865639 for ; Mon, 20 Jun 2022 03:43:26 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="FkMWohu1"; dkim-atps=neutral Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 520FD883; Mon, 20 Jun 2022 03:43:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1655689406; bh=Xxl+STqEGupZEhYQYUvsvYDr2vDwbtwqtSyAbTNUD/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FkMWohu1GQVxO1xKwH+kz7nGH23pOxKMzt46FP6JK1hXeLJ3VLK307O/JOAKHqpLV WPFpofBxDbIg3XwDhY58RVdNg1cn73ZBGO7ZO0Km189hXtrb2UYhYPB/TDxf4OFeWg Iv+biqjy3MV7VMfbu3i6ePvsXT/57CnK7EIMVnPE= To: libcamera-devel@lists.libcamera.org Date: Mon, 20 Jun 2022 04:42:57 +0300 Message-Id: <20220620014305.26778-5-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220620014305.26778-1-laurent.pinchart@ideasonboard.com> References: <20220620014305.26778-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 04/12] ipa: libipa: algorithm: Add init() function to the Algorithm class 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" From: Florian Sylvestre Add the init() function that will be called during algorithm initialization to provide each algorithm the list of algorithms tuning data. Signed-off-by: Florian Sylvestre Reviewed-by: Laurent Pinchart Reviewed-by: Paul Elder Signed-off-by: Laurent Pinchart --- Changes since v3: - Hardcode YamlObject as the data type of tuning data - Reword the Algorithm::init() documentation - Pass the algorithm-specific data to the init() function instead of the global tuning data --- src/ipa/libipa/algorithm.cpp | 13 +++++++++++++ src/ipa/libipa/algorithm.h | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp index 6e0bba56ecb2..1b1fd80fb7b0 100644 --- a/src/ipa/libipa/algorithm.cpp +++ b/src/ipa/libipa/algorithm.cpp @@ -37,6 +37,19 @@ namespace ipa { * \brief The IPA module type for this class of algorithms */ +/** + * \fn Algorithm::init() + * \brief Initialize the Algorithm with tuning data + * \param[in] context The shared IPA context + * \param[in] tuningData The tuning data for the algorithm + * + * This function is called once, when the IPA module is initialized, to + * initialize the algorithm. The \a tuningData YamlObject contains the tuning + * data for algorithm. + * + * \return 0 if successful, an error code otherwise + */ + /** * \fn Algorithm::configure() * \brief Configure the Algorithm given an IPAConfigInfo diff --git a/src/ipa/libipa/algorithm.h b/src/ipa/libipa/algorithm.h index 356c094976d4..47cb3c01d2ce 100644 --- a/src/ipa/libipa/algorithm.h +++ b/src/ipa/libipa/algorithm.h @@ -11,6 +11,8 @@ namespace libcamera { +class YamlObject; + namespace ipa { template @@ -21,6 +23,12 @@ public: virtual ~Algorithm() {} + virtual int init([[maybe_unused]] typename Module::Context &context, + [[maybe_unused]] const YamlObject &tuningData) + { + return 0; + } + virtual int configure([[maybe_unused]] typename Module::Context &context, [[maybe_unused]] const typename Module::Config &configInfo) {