From patchwork Wed Dec 10 00:53:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 25438 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 59B6CC3257 for ; Wed, 10 Dec 2025 00:55:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1436761491; Wed, 10 Dec 2025 01:55:09 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="sHwID5L6"; dkim-atps=neutral Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D871B6149C for ; Wed, 10 Dec 2025 01:55:07 +0100 (CET) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-7bc248dc16aso5250025b3a.0 for ; Tue, 09 Dec 2025 16:55:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765328106; x=1765932906; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4uTWF13ovZ62aTw8eKAGAg1ulpVTnbTayTqfUI1rApw=; b=sHwID5L6eVsP8ABmZ6lTq27qVKT4EuuRwgtJloHHb+FD1b0TvQ1hvr/vjqO9m0S3cn HYw47NZK4Z1ZzxnU32fBbYQeFfdFM8k+28rvAO5u6HoDElZg0rbExYpxK1kfAvuJ1Pne jAV7JhWZ4EN5thDs0Rvoz7EDfs1ncqNNGuNhs38WdxGnX10uU/txLwfiEWN1bHKmAbNy vCXAtWBOmTMubt5Z7YcB+7RhNIg/Y5ktcDXXCeFoQKbrREL6mMfqbHqhekR7ItF4jsF/ QrGDJpCJ75OQkU36PawEWe8mzLWhRUoeCq4HpHvyxxLPEK06qHvDpomzhzze/FCXVSKu Wo7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765328106; x=1765932906; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=4uTWF13ovZ62aTw8eKAGAg1ulpVTnbTayTqfUI1rApw=; b=Jdlrv5faE/IwDzsOzG9m+VGBrke5LfaFX7oy1k30feJCIbj7N2ctAykGnNBVB64DSe ExbLZDucOg8Tas+w78TeWA3Zc+K3UoW0MGuXTU6njeeaSuTesLDpRrZVL2ZG9ifgbkdA D4fgBJrnk5+JPuAmhYbuvoO6F2h0m//LpUKKJpvOKmaD8BhG0LOH2hokA3wK9fv1vhqn dqgDUQusm+896XVtWSZaSgFruBNWE5Ik6qLRFTN/yfkPjUmdZ3ck7oE+rcIDGNyaUJ5+ h6jvCuYW1WCd+XtWsjxVuk5BpeitIa+376078H+XDInADOm8p3Jg+f2RB8b0kNMUZGFw FxfQ== X-Gm-Message-State: AOJu0YxdJA5Dew/uoufCdViXt3i7TJ+2runvo5IFK51sGy5xkrNn6Ngm 49EjGW1nCPJC1WgnZm8ud2iYRwXs+/nrEqdWFffI8QyayrdusR7aiIA11VHLuIKfhTJyCVZv8Ik PgVUA X-Gm-Gg: ASbGncuxbeaspC9r3Sc921ro5jkBdcvCh6SbWiaqKyrDm1LZfs77/zgErVDxLKiv8TX LgZwQaoxJzeLIDzqOgXiFtN+E1o05/YH66ephM+9Y3VfaRYbI2cavM3hgMnkRWeGXTl4sxT43qR +5edeBxqEVnCHmfjr9vtyNk1IwutTebTNdKXjzA4dtXdYytvkvgXxnENSmcwRqpsrUL2Hja6CM3 NyLQCGPMVkcg5CBCmHgED77Uwf0kAoYM4evbW/T8+S9PqvGucC4Tc4Ri+jQZ4GumI7egNqpQIin rBCZTTaaOh6KmPzU64XmFpw4hsrc8LJBWVcGQ84EBeRrsqSAt+WvkWs7bkKdZ1k3dcPGocQj5jb t6GmxyfgHsapvMTSf13bvRxCIyF29F7hh2edtFwND89YvhbGB1PZAXR8o0WA2g+QMmgRXqsYEzK egGzBz0bOSlB78aJaDcQ7xBWJ6bOgf/r6d5/6uXsdid2EOioWYqz6eSiy8vLlvm7Cu X-Google-Smtp-Source: AGHT+IE8Z+Wb1GRgaDF4g22WcxBQPsVvkNQvsYqfRqc1j4om1GWiQFh/HGLtISQhjrt3AKyHQ1iIuw== X-Received: by 2002:a05:6a20:430d:b0:355:1add:c291 with SMTP id adf61e73a8af0-366e0ae858amr467038637.10.1765328106078; Tue, 09 Dec 2025 16:55:06 -0800 (PST) Received: from inspiron14p-linux (p96936b06.osaknt01.ap.so-net.ne.jp. [150.147.107.6]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-bf6875cc8eesm16057762a12.16.2025.12.09.16.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Dec 2025 16:55:05 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue Subject: [PATCH v7 21/26] ipa: libipa: module: Add createSelfEnumeratingAlgorithm Date: Wed, 10 Dec 2025 00:53:49 +0000 Message-ID: <20251210005354.44726-22-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251210005354.44726-1-bryan.odonoghue@linaro.org> References: <20251210005354.44726-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Create an algorithm without having YAML data input. Signed-off-by: Bryan O'Donoghue --- src/ipa/libipa/module.h | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/ipa/libipa/module.h b/src/ipa/libipa/module.h index c27af7718..c5767c6f3 100644 --- a/src/ipa/libipa/module.h +++ b/src/ipa/libipa/module.h @@ -70,6 +70,51 @@ public: factories().push_back(factory); } + /** + * \fn int Module::createSelfEnumeratingAlgorithm(Context &context, const std::string &name) + * \brief Create and initialise a self-enumerating algorithm by name + * + * This function creates an algorithm instance from the registered algorithm + * factories using only the algorithm name, without requiring YAML configuration + * data. + * + * This is useful for algorithms that don't require external configuration + * parameters and can self-configure or use default values. + * + * \param[in] context The IPA context to pass to the algorithm's init function + * \param[in] name The name of the algorithm to instantiate + * + * \return 0 on success, negative errno value on failure: + * -EINVAL if the algorithm is not found in the factory registry + * Other negative values if algorithm initialisation fails + */ + int createSelfEnumeratingAlgorithm(Context &context, const std::string &name) + { + YamlObject dummy; + + std::unique_ptr> algo = createAlgorithm(name); + if (!algo) { + LOG(IPAModuleAlgo, Error) + << "Algorithm '" << name << "' not found"; + return -EINVAL; + } + + context.selfInitialising = true; + + int ret = algo->init(context, dummy); + if (ret) { + LOG(IPAModuleAlgo, Error) + << "Algorithm '" << name << "' failed to initialize"; + return ret; + } + + LOG(IPAModuleAlgo, Debug) + << "Instantiated algorithm '" << name << "'"; + + algorithms_.push_back(std::move(algo)); + return 0; + } + private: int createAlgorithm(Context &context, const YamlObject &data) {