From patchwork Fri Jun 17 09:23:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Sylvestre X-Patchwork-Id: 16259 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 725B0C3274 for ; Fri, 17 Jun 2022 09:23:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C05C16563E; Fri, 17 Jun 2022 11:23:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655457832; bh=p4e33/jkM7aiRpDEeh6t1mYzMnKJsgaj6toEOgRI9uM=; 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=3/ys//NwsvkKuKYp4LxFis+5KXlNBzkLP3sRBA4SD2+6cN/yXWyPBtXG+/7ccC6Mi KTgovzQftG5AFc/z3gsGA8GZxDe/YyBiU7zzRfpDWOlGCObEptsE9kLqa/3rDKlwpF 9wZ7d4ikv55MaqlCOxN1lbWN1BCYQXA2TNbnX+BlzID9witiiBn/7H42e9nrY8W24I HXquh+8iF/0O34vdEp9qMgW2JYZ1cwsQuDRHpElzy/lF9GNz4vGJ7Vxf839AjaRW5d rgUFqIY9sNT42weNqNfT/60dcGz2ng3kKp7N1Wwyc8aOtcjC1no6lDJfDmZmpc4SEg 8q3614hr5R/qA== Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0740B60471 for ; Fri, 17 Jun 2022 11:23:50 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="7K2ManLD"; dkim-atps=neutral Received: by mail-wm1-x331.google.com with SMTP id s21-20020a1cf215000000b0039ee8149524so568051wmc.5 for ; Fri, 17 Jun 2022 02:23:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TMYZjips5Lixyu5lyPtw51kzFlykmKB07P7srPkyV6c=; b=7K2ManLDvqZ+AVZT67uvi1B2q/rmyt0dRkVD2HPHH0d94YOy9vzdLoT84OdQtJUBwe 7QOleAySGb4ksFxCa3bDXpqEb39q8ogGtsbLMbGU3U4L7BWlWVW5vm1L6o4+cBP5UgCu mv5dBQvvpNFhQbqTd8EEe+jdcwg6F+9C1GZ4vjXTxR71lEyIu5Y6ni6dwYiB+TlYyUMn 5XOZN8NBLe1mWWm8FCKA6AUb7uVVCUqThJrpnUfXEeMfv77n0/7XCHiZ8SORCXEgIQz5 MxQDr0LKyOc5CuYQrZ3mAYg6Wl5xnU+yV1tND8EAERIPvVNRieup4kpXoNHLaQEgdCRu Ol1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TMYZjips5Lixyu5lyPtw51kzFlykmKB07P7srPkyV6c=; b=OHsz8S9oRu6hNYc0L+sL4Gr5aFgCjjNy6IgOdxkfzjbwn+xbfV+xR4XZ4B4V3Ji7gh Je/W2Ehlud52OvWpLk9Huz5e78rAAp6yWxDlCELCfMnekP67wRIfA4xgDX0SDkTI6GGt xMUy5Z9fTPijuaoE5C9chyk3vOIWqXm4ENd1W1bohV9FnPJc8DgbzRVhlFu1yWsgIX7j 2slcr460PA46wKss47khquD4oHzrHIpaG6khqqYPdYL8unj914oPrZU+9kNbgXnQ8gQh 4Nop4LtSDco1oxd39rRS9Cx4RbWtEstraMp2igHmeu0X7m3XpEqJnuBet9hCZ7RanQZm X8Tw== X-Gm-Message-State: AJIora/Y6Y5v69/pd3hot8wyt70I2dPM3DsVFXbMEDmQvfzmGoSGDjPR 9qc2e9SPEQh4eQTDFVWs4yr0mWnd4UVHFQ== X-Google-Smtp-Source: AGRyM1sUqDg8Ptwg8SJH0HLLUWQLrkFvavoFlQsgIcsg+M3Q84LCpxxkIGae4fLUVuuk8Tr663hVlg== X-Received: by 2002:a05:600c:358d:b0:39c:7aea:e20f with SMTP id p13-20020a05600c358d00b0039c7aeae20fmr9171587wmq.64.1655457829351; Fri, 17 Jun 2022 02:23:49 -0700 (PDT) Received: from BL087.. ([2a01:e34:eea9:e630:4718:73b:d035:3786]) by smtp.gmail.com with ESMTPSA id h81-20020a1c2154000000b0039c41686421sm7962328wmh.17.2022.06.17.02.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jun 2022 02:23:48 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 17 Jun 2022 11:23:12 +0200 Message-Id: <20220617092315.120781-3-fsylvestre@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220617092315.120781-1-fsylvestre@baylibre.com> References: <20220617092315.120781-1-fsylvestre@baylibre.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 2/5] ipa: libipa: 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: Florian Sylvestre via libcamera-devel From: Florian Sylvestre Reply-To: Florian Sylvestre Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add the init() function that will be called during algorithm initialization to provide each algorithm the list of algorithms tuning data. Each algorithm will be responsible to grab their corresponding parameters. Signed-off-by: Florian Sylvestre Reviewed-by: Laurent Pinchart Reviewed-by: Paul Elder --- src/ipa/ipu3/algorithms/algorithm.h | 8 +++++--- src/ipa/libipa/algorithm.cpp | 14 ++++++++++++++ src/ipa/libipa/algorithm.h | 11 +++++++++-- src/ipa/rkisp1/algorithms/algorithm.h | 8 +++++--- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/ipa/ipu3/algorithms/algorithm.h b/src/ipa/ipu3/algorithms/algorithm.h index 234b2bd7..8b562e5b 100644 --- a/src/ipa/ipu3/algorithms/algorithm.h +++ b/src/ipa/ipu3/algorithms/algorithm.h @@ -15,11 +15,13 @@ namespace libcamera { +class YamlObject; + namespace ipa::ipu3 { -using Algorithm = libcamera::ipa::Algorithm; +using Algorithm = libcamera::ipa::Algorithm; } /* namespace ipa::ipu3 */ diff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp index cce2ed62..f1b04160 100644 --- a/src/ipa/libipa/algorithm.cpp +++ b/src/ipa/libipa/algorithm.cpp @@ -29,6 +29,20 @@ namespace ipa { * to manage algorithms regardless of their specific type. */ +/** + * \fn Algorithm::init() + * \brief Configure the Algorithm with default parameters + * \param[in] context The shared IPA context + * \param[in] params The initial parameters used to tune algorithms + * + * This function is called once, when the IPA module is initialized, to + * initialize the algorithm. The \a params YamlObject contains IPA module + * parameters, typically tuning data for all algorithms. The Algorithm is + * responsible for reading the parameters relevant to its configuration. + * + * \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 032a05b5..2945719e 100644 --- a/src/ipa/libipa/algorithm.h +++ b/src/ipa/libipa/algorithm.h @@ -10,13 +10,20 @@ namespace libcamera { namespace ipa { -template +template + class Algorithm { public: virtual ~Algorithm() {} + virtual int init([[maybe_unused]] Context &context, + [[maybe_unused]] const TuningData ¶ms) + { + return 0; + } + virtual int configure([[maybe_unused]] Context &context, [[maybe_unused]] const Config &configInfo) { diff --git a/src/ipa/rkisp1/algorithms/algorithm.h b/src/ipa/rkisp1/algorithms/algorithm.h index 68e3a44e..e813756d 100644 --- a/src/ipa/rkisp1/algorithms/algorithm.h +++ b/src/ipa/rkisp1/algorithms/algorithm.h @@ -17,11 +17,13 @@ namespace libcamera { +class YamlObject; + namespace ipa::rkisp1 { -using Algorithm = libcamera::ipa::Algorithm; +using Algorithm = libcamera::ipa::Algorithm; } /* namespace ipa::rkisp1 */