From patchwork Tue Dec 2 13:45:40 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: 25329 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 BC789C3257 for ; Tue, 2 Dec 2025 13:46:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 39A8660D35; Tue, 2 Dec 2025 14:46:29 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="yW2xyyeH"; 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 0A8C560F30 for ; Tue, 2 Dec 2025 14:46:22 +0100 (CET) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-47775fb6cb4so40127675e9.0 for ; Tue, 02 Dec 2025 05:46:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764683181; x=1765287981; 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=TQsZfDaoGFUl4eFxvv+cU20DJlcn/08chTcEqRf6U74=; b=yW2xyyeHgjo6U/99gkWfm1I/pAfyd0ENZ71QcwNiRm2CooApXyCwZdDfFC4qye5cYP 873gKLFiBZnZcfDd1bndSe804h1NZ/pHD9lVmEWMf9rWht7Buxq6D4pPmkrC9qmZvo9B AO7T5cK6xNDWrCCLz8rZjJ2piaR0CSKSVLNaldD9z4KFWEmzyNNYxlcuzQteUn8lPbB8 L1quhpc3Tu35dS/+F0VtKezemSlRN1ss0ftR0Eskw/Bj5XfSfXn/ZkAUGhj3vNYIGKES XaP23UntQf8DGFc+zveYnDEF0rACjyVyqgmKnziex7VuZm2v0f1AzfSwAlt4KTEPJcC/ 1ntw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764683181; x=1765287981; 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=TQsZfDaoGFUl4eFxvv+cU20DJlcn/08chTcEqRf6U74=; b=tyz2kk/90eY31qU15BFzE/4JWDfLc8+XeyKfa0fQ/K0TW4dCWWgtUuAFNoqUjDeyo7 85GAdrwnPuSEEY7RrdWXNuajfMrHGMC8PIJdgaQ3GhrjPMS6+vsAl/fbkT/rSFD4Ldvj fIGPdQcMVPURPgytst2mXU8I9w5r3d62CGHr4BCg5pOhNoZFrvZIXSv4ZsRmkh+z+gR1 uTZ8GHjTgyqA3cHdkm/m/nWsQ3okjSz3tyWIpfBZQCkUd1Ev+/MnX+/PuQu/cGaI5/oL fBYBJ5WOHvyQdo/R1mgiP045tRZqO/Wx8ZL0lsGGurjAghM8WW/x3bhlkE1RA7s21gML THcQ== X-Gm-Message-State: AOJu0Yw39+OuF5A4IX5Js2GVob70axt+P0n030epjhwsNSk5wQ2oRMMa RkuqQ7fsj5H1+V9gdYXsG56FbrfvuCLs6YF2XAVd0CYYHT6SUObYONrGxxveMYTfWDZpyBi1y3h I8mCr X-Gm-Gg: ASbGncuBJOHMiSUTGv6Fzm2aGFJgQX5AqS7YHFzCgkRlffMr3QrTvxNGrUFGvujVKOM 23kR5RDLrEtgmCCCCV6VyDbg+hwrEeQYmkaDQD/fnjwxM40H9ZrHZOsSoNVin2x89uOEfi0w2ik raM2HxeJcY9Oy5Ri09MKU+mmvXteN7UYdFaUncCO4s16QKI/2VRCD1m+KqkZGDghzmGgbHoaBEK KmEn0gGKugDw5cvNXb18XydBe7Fuhf1DecJc8pxaqtEcwaXsqC98srg3WMznjSsI4FUrP9u0rkM xhpq4kj0E27R8QEeXmtFWtI++OjL0B+96syriGTvWQ5dqeTUXwVNxZJQz7jiQ/p/G2vX365o8HN NK+DcFeOhp9UWJWjzS/iMSE8IPRVspBOg7FtTmqHreX8uw++Twb4s+X5SXXgaSeWu4x4YpNS1wx H3J7PKhJyNLEF2U2hceiMvjWe0zUwzmGPrJPxZa8NDMclCPxTXnDNc2y4u+3iVDY+klDI= X-Google-Smtp-Source: AGHT+IH0EDLtxCyLLH1V0ghyKKxzG1pxyNUqLIoOrmKfbr0ADTcj5enXfmu2oeKwZ8dShPKXZyhpLg== X-Received: by 2002:a05:600c:4591:b0:477:7925:f7f3 with SMTP id 5b1f17b1804b1-477c10e1cacmr414142025e9.14.1764683181314; Tue, 02 Dec 2025 05:46:21 -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-47926f0ec69sm19383375e9.1.2025.12.02.05.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:46:20 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue Subject: [PATCH v6 20/24] ipa: libipa: module: Add createSelfEnumeratingAlgorithm Date: Tue, 2 Dec 2025 13:45:40 +0000 Message-ID: <20251202134544.662446-21-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202134544.662446-1-bryan.odonoghue@linaro.org> References: <20251202134544.662446-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) {