From patchwork Thu Jun 16 08:07:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Sylvestre X-Patchwork-Id: 16228 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 4B094C3274 for ; Thu, 16 Jun 2022 08:07:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E0F416563D; Thu, 16 Jun 2022 10:07:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655366875; bh=mKpHoFfV64VGexcpLK0gb5z1fIXoctrjxcICAwg8FU8=; 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=AYmM+YAgnVqDi2vkFpLljky/wURET8b/znppXrV7XRgDoYO/6TySRn0YPmqTwrSUD /tufSedTNGJ3Dd0IUtYh0oQp2uuqwe1IFmaSgN7tWtkS7/OtKyH2gSG2ziFQZ2zE2R JJxWWIJRrvEXjB1+1DWAEYLZcBm7UrUCH9qamsCKcI9fmVflowItAqYRwOepBI5vYh nAl/TPwK1eQLgfh+6q/0lN1hyMKhvT9Vssmwt84EiCBd41J1EuSchM8cCors4LQOBz NQFIO/caSNg4I1fxUyXUnuRCIPYgu4cfNZ0rGivtlW87IwBuHKF8JTHJD4oRvn/ftw 11ZOWIdAsEBVQ== Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 28A2A65633 for ; Thu, 16 Jun 2022 10:07:53 +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="fjrIeahP"; dkim-atps=neutral Received: by mail-wr1-x42f.google.com with SMTP id x17so786586wrg.6 for ; Thu, 16 Jun 2022 01:07:53 -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=ru/NqCJop3F1vdmAQuOmH9+eNXjRCb0fqLfgUpvBwiY=; b=fjrIeahPeLVqqi63z6nfczKPr32IHo85F7xp8EdSQHkX0tpGVDxbR6HYi9RUqQ7quO hMlOf0ou365VWQXCj6/omVbnyOTX2ovncoxC+jMU6nlLzjfV+s8t/WB/diY79/OxHyNO OLCkg4rkS4jSNapb8tNMzhK8OLx1Np3Ouqz99oFGHf8fECPi90eePdPFACRJtc70Ajho 4dcVGwq2J0ejvgaQLObWN6y53gStsmXj9gQg+z9mSmNgePS5TglIaFxlE4qROOYoA8Pm 2r/0k/IE+pSPxQpoQbasTIfmNdXfe9Vx62g/G2c6shqRlDXZcjGHGRsTpYeq7KlfBQ+Z Yj4Q== 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=ru/NqCJop3F1vdmAQuOmH9+eNXjRCb0fqLfgUpvBwiY=; b=VtzKzB3lHKrlSN+KFyBtGayYAGz210Gr8b+WTGErTigrZGFv8AVJOgXOXhC2gu1oE9 yLjBUcbiqOFzJJVcqmA9P/8QBL/lQMfehwaGLug55rfKlQhLBydHH4I/XIUP7Edt/qRK +SN3nRt5IOVNL+mU7HNBXXGrXrp1309P0OHnxkLaAXVroizCfc3y1k7Vhx7ZMBZGiucM RYTxuf+wyKALC380ZgddP26HTkxxb08Y9oOgOJjuRUmzvxePq83SVA7BQ3G1PsGNDh1i PKtvisHqZtX2bUoA126GoGmXGzxE4B6xl8sGcJGwDVgk5/FQIwoQNKEX4T0+tEbKKiSB b8HA== X-Gm-Message-State: AJIora/hQZAAEg138CIazsHqXhd9BMdGpyXeGWFWdmqxnKvpeEUVuW7c 4V8atUzlxsR5xZQ8BTWKnzizH0CCAzCY/A== X-Google-Smtp-Source: AGRyM1sN6flOP+sYmvU45y9RUnWlB9wOUrv8kMC47k3diwlJeqy8dL/xo07Y2Z8GJsBOdn5XaNPpYw== X-Received: by 2002:a5d:5243:0:b0:216:ca0:58e9 with SMTP id k3-20020a5d5243000000b002160ca058e9mr3425539wrc.318.1655366872488; Thu, 16 Jun 2022 01:07:52 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-76-188.w2-15.abo.wanadoo.fr. [2.15.166.188]) by smtp.gmail.com with ESMTPSA id r15-20020adff70f000000b002185d79dc7fsm1098868wrp.75.2022.06.16.01.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 01:07:51 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 16 Jun 2022 10:07:41 +0200 Message-Id: <20220616080744.548995-3-fsylvestre@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220616080744.548995-1-fsylvestre@baylibre.com> References: <20220616080744.548995-1-fsylvestre@baylibre.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 --- src/ipa/ipu3/algorithms/algorithm.h | 4 +++- src/ipa/libipa/algorithm.cpp | 16 ++++++++++++++++ src/ipa/libipa/algorithm.h | 10 +++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/ipa/ipu3/algorithms/algorithm.h b/src/ipa/ipu3/algorithms/algorithm.h index d2eecc78..32cdfe52 100644 --- a/src/ipa/ipu3/algorithms/algorithm.h +++ b/src/ipa/ipu3/algorithms/algorithm.h @@ -15,9 +15,11 @@ 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 398d5372..3424610b 100644 --- a/src/ipa/libipa/algorithm.cpp +++ b/src/ipa/libipa/algorithm.cpp @@ -29,6 +29,22 @@ 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 before the camera is running to get default + * algorithm parameters. + * 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 766aee5d..f5be1caf 100644 --- a/src/ipa/libipa/algorithm.h +++ b/src/ipa/libipa/algorithm.h @@ -10,12 +10,20 @@ namespace libcamera { namespace ipa { -template +template + class Algorithm { public: virtual ~Algorithm() {} + virtual int init([[maybe_unused]] Context &context, + [[maybe_unused]] const TuningData *params) + { + return 0; + } + virtual int configure([[maybe_unused]] Context &context, [[maybe_unused]] const Config &configInfo) {