From patchwork Thu Nov 27 02:37:37 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: 25259 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 D3204C32E7 for ; Thu, 27 Nov 2025 02:38:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8A1EB60C6F; Thu, 27 Nov 2025 03:38:34 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="F+odiLz1"; dkim-atps=neutral Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8C93C60AD0 for ; Thu, 27 Nov 2025 03:38:30 +0100 (CET) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-477632d9326so1689025e9.1 for ; Wed, 26 Nov 2025 18:38:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764211110; x=1764815910; 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=e1pvUqnYS1JGS35UGpDUFqEIzGsf/5dEKRFZ9jpd2jQ=; b=F+odiLz13Sbgj9+yQLaXrZzjCGeT9nREiW20SRth2gyi7FqNPvCUv+KkLMfpaI0bCq ru7hx3QI+MU5K44d8y2Qw/g5O4NOXFyDYvWDbRJWV9UNIz2NIXVp1B70kb4bOmc2jLpA eUSagcWWcDqWb0FMOH2oml90ETE2n2u7Rhox1Ca5agUeb5qB8rdB518fD+RJMlDVmMvh jv55sSbDqNHj6d6MZpIS5ZvtiTbO18a+/FL0OomNrIge2tKSr6wxDWF30QrT5EaTvVaE WogOuPZ94dTiexefcCBJvG733aixkTjxCsT5IvRVv2tBMJ0qQhXSbeiteFBfIibPKU/t dMaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764211110; x=1764815910; 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=e1pvUqnYS1JGS35UGpDUFqEIzGsf/5dEKRFZ9jpd2jQ=; b=O/wmDzkhYrgQeZPiqq70u+Wv3Ps1fR1ae0hh4ZFYlLyNLN5+IkrSXcFJaF6gRR0bfn R1Nh6SE0WliA81/g5klJw4Zg7lS8HR64yDQ6MBeH+Bi+dajXsYXo8UyJuWPzyiJ0/5at mn1ssAonAk3bnur/i0aYfwdBPDfLtus1Y7PEA5YReuzyR6dxPZ9JneoFrxNk+6BSRbq0 dVPniPN/AlsHhHacarnjn6NlAlovzEpjO1VeyJ6NXQqq+ABleJcR9/e/hebyMAIYToWE SEWJCBe6lXA2xBkMzJ/VaqShWX00rwYYHctqVYx7pFwnNngvaSx/Bob3liBMu4q6+Ap2 Oeuw== X-Gm-Message-State: AOJu0YxmGz1FkWGzqCLvgok/vGTqyUplj+vB8XesCXOlSCaAugUzT/ip IrNLSKcS6B+0UBI28rF5YnS6A3mP2lhavPYh6Lj0THqo1ul3wo66zZD4UhZEm6WQ12ngSQ7A6Qe KVZiT7ac= X-Gm-Gg: ASbGnct0vmmSscp905hLihr414zGgqWUsGyMx3Dn/HdoZlbnamry8xRZcq6hqokF2a6 pM+8WV2HLLdGGhJOCOB1Sj5jo95eJFXwFERfe7KpJMvf/ZHqpPZl//x9iZy1g5UMxCXR/c5Z0lH SRKXzMs3znwxY+f+7uX+LzgE3PWUSDLsO0uexqdo56JYE0ntMNjLfzxhU9k5eb0yyigVX8vSJ8s UfcWxLOuiGlfXWEET5GBdlwdhAkb9bn58XZf3pL/jyASRsPIpdDBTxh6B84ZvkFjrDgfGedKS+q 6QbfErwb8F8HqjgjcCi4eYgEKkJMmAgEUbVU99AgTadOiAwnS6kdq+xVDIKK1+YJLeDp+L8wEU5 b1rcCugvA9j3RhyyNmSq/N7TcGgERS2gYbH1Gu9dSaHC3TgKwJSavArx1ShFstsOJcTisMFb2hQ zYHTUag0QcvQ+lict21hIAge3Zjf7k18WPjQ8g0p8rxixvePA47bOBolffgRBRj8hwGvo= X-Google-Smtp-Source: AGHT+IEwcxTZY0Cb0FU6rZAJA0EnNJ0oSzL1UQvMnf/VO67qkvq6wtAEhLAUtkC5xkG6wcgN03yOPA== X-Received: by 2002:a05:600c:3b09:b0:471:13fa:1b84 with SMTP id 5b1f17b1804b1-477c0185bc8mr249392525e9.12.1764211109900; Wed, 26 Nov 2025 18:38:29 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4790552c3c9sm58186345e9.0.2025.11.26.18.38.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Nov 2025 18:38:28 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue Subject: [PATCH v5 22/24] ipa: libipa: module: Add createSelfEnumeratingAlgorithm Date: Thu, 27 Nov 2025 02:37:37 +0000 Message-ID: <20251127023739.179652-23-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251127023739.179652-1-bryan.odonoghue@linaro.org> References: <20251127023739.179652-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" Signed-off-by: Bryan O'Donoghue --- src/ipa/libipa/module.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/ipa/libipa/module.h b/src/ipa/libipa/module.h index c27af7718..f320291e6 100644 --- a/src/ipa/libipa/module.h +++ b/src/ipa/libipa/module.h @@ -70,6 +70,47 @@ 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) + { + std::unique_ptr> algo = createAlgorithm(name); + if (!algo) { + LOG(IPAModuleAlgo, Error) + << "Algorithm '" << name << "' not found"; + return -EINVAL; + } + + int ret = algo->init(context); + 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) {