[{"id":37006,"web_url":"https://patchwork.libcamera.org/comment/37006/","msgid":"<176374638845.567526.3956381285944123608@ping.linuxembedded.co.uk>","date":"2025-11-21T17:33:08","subject":"Re: [PATCH v4] libipa: module: Allow algorithms to be disabled via\n\tthe tuning file","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Isaac Scott (2025-11-21 17:31:24)\n> It is beneficial to have the option during development to disable and\n> enable algorithms via the tuning file without having to delete their\n> entries.\n> \n> Add support for an optional \"enabled\" parameter to accomplish this.\n> \n> Usage example:\n> version: 1\n> algorithms:\n>   - Agc:\n>       enabled: true\n>   - Awb:\n>       enabled: false\n> \n> This will enable AGC, and disable AWB. If the enabled flag is not\n> present, the algorithm will be enabled.\n> \n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> Signed-off-by: Isaac Scott <isaac.scott@ideasonboard.com>\n> \n> ---\n> \n> v1 of this patch can be found here:\n> \n> https://patchwork.libcamera.org/patch/23299/\n> \n> Changelog:\n> \n> v3 -> v4:\n> - Made DEBUG logging into INFO\n> - Checked whether enabled exists before attempting to create the\n>   algorithm.\n> \n> v2 -> v3:\n> - Moved parsing back to createAlgorithm().\n> - Added documentation to module.cpp.\n> - Ensured the 'enabled' flag is part of the algoData for an\n>   algorithm to help avoid ambiguity.\n> \n> v1 -> v2:\n> - Moved parsing to createAlgorithms() instead of createAlgorithm()\n> - Changed \"disabled\" flag to \"enabled: [boolean]\"\n> ---\n>  src/ipa/libipa/module.cpp |  8 ++++++++\n>  src/ipa/libipa/module.h   | 12 ++++++++++++\n>  2 files changed, 20 insertions(+)\n> \n> diff --git a/src/ipa/libipa/module.cpp b/src/ipa/libipa/module.cpp\n> index 64ca91419..f142c5257 100644\n> --- a/src/ipa/libipa/module.cpp\n> +++ b/src/ipa/libipa/module.cpp\n> @@ -94,6 +94,14 @@ namespace ipa {\n>   * algorithms. The configuration data is expected to be correct, any error\n>   * causes the function to fail and return immediately.\n>   *\n> + * Algorithms can optionally be disabled via the tuning file of the camera module\n> + * as shown here, with AGC being used as an example:\n> + *\n> + * - Agc:\n> + *     enabled: false\n> + *\n> + * If this is the case, the algorithm will not be instantiated.\n> + *\n>   * \\return 0 on success, or a negative error code on failure\n>   */\n>  \n> diff --git a/src/ipa/libipa/module.h b/src/ipa/libipa/module.h\n> index 0fb51916f..826b34dab 100644\n> --- a/src/ipa/libipa/module.h\n> +++ b/src/ipa/libipa/module.h\n> @@ -74,6 +74,18 @@ private:\n>         int createAlgorithm(Context &context, const YamlObject &data)\n>         {\n>                 const auto &[name, algoData] = *data.asDict().begin();\n> +\n> +               /*\n> +                * Optionally, algorithms can be disabled via the tuning file by including\n> +                * enabled: false as a parameter within the algorithm tuning data.\n> +                * This is not an error, so we return 0.\n> +                */\n> +               if (!algoData[\"enabled\"].get<bool>(true)) {\n> +                       LOG(IPAModuleAlgo, Info)\n> +                               << \"Algorithm '\" << name << \"' disabled via tuning file\";\n> +                       return 0;\n> +               }\n> +\n>                 std::unique_ptr<Algorithm<Module>> algo = createAlgorithm(name);\n>                 if (!algo) {\n>                         LOG(IPAModuleAlgo, Error)\n> -- \n> 2.43.0\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B34AAC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 21 Nov 2025 17:33:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5BB3360805;\n\tFri, 21 Nov 2025 18:33:13 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BA3AF60805\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Nov 2025 18:33:11 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A069A6A6;\n\tFri, 21 Nov 2025 18:31:05 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"lyB1IFCR\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1763746265;\n\tbh=o1EiCoRLh/7IeVXVhsfI7kUFBkwEQj2JEhKDcFTnus0=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=lyB1IFCRBrpEtT72MP7A5IuM9xmB/YUkT0JQhJRz8ejYemhlNhUxWl/AGNkUTutCL\n\t96CVqCCXKKr8QeqVkvUCXhqQXr05ZMVFodO7ogAYg6bIOqkkCqSBrKrUIaJGE3/N+V\n\t3POB3hEmlvND23A4u3oHSRMUFin1uRtsTdG2+hqU=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20251121173124.178430-1-isaac.scott@ideasonboard.com>","References":"<20251121173124.178430-1-isaac.scott@ideasonboard.com>","Subject":"Re: [PATCH v4] libipa: module: Allow algorithms to be disabled via\n\tthe tuning file","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Isaac Scott <isaac.scott@ideasonboard.com>","To":"Isaac Scott <isaac.scott@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Fri, 21 Nov 2025 17:33:08 +0000","Message-ID":"<176374638845.567526.3956381285944123608@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":37007,"web_url":"https://patchwork.libcamera.org/comment/37007/","msgid":"<20251121222944.GD10298@pendragon.ideasonboard.com>","date":"2025-11-21T22:29:44","subject":"Re: [PATCH v4] libipa: module: Allow algorithms to be disabled via\n\tthe tuning file","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Fri, Nov 21, 2025 at 05:31:24PM +0000, Isaac Scott wrote:\n> It is beneficial to have the option during development to disable and\n> enable algorithms via the tuning file without having to delete their\n> entries.\n> \n> Add support for an optional \"enabled\" parameter to accomplish this.\n> \n> Usage example:\n> version: 1\n> algorithms:\n>   - Agc:\n>       enabled: true\n>   - Awb:\n>       enabled: false\n> \n> This will enable AGC, and disable AWB. If the enabled flag is not\n> present, the algorithm will be enabled.\n> \n> Signed-off-by: Isaac Scott <isaac.scott@ideasonboard.com>\n> \n> ---\n> \n> v1 of this patch can be found here:\n> \n> https://patchwork.libcamera.org/patch/23299/\n> \n> Changelog:\n> \n> v3 -> v4:\n> - Made DEBUG logging into INFO\n> - Checked whether enabled exists before attempting to create the\n>   algorithm.\n> \n> v2 -> v3:\n> - Moved parsing back to createAlgorithm().\n> - Added documentation to module.cpp.\n> - Ensured the 'enabled' flag is part of the algoData for an\n>   algorithm to help avoid ambiguity.\n> \n> v1 -> v2:\n> - Moved parsing to createAlgorithms() instead of createAlgorithm()\n> - Changed \"disabled\" flag to \"enabled: [boolean]\"\n> ---\n>  src/ipa/libipa/module.cpp |  8 ++++++++\n>  src/ipa/libipa/module.h   | 12 ++++++++++++\n>  2 files changed, 20 insertions(+)\n> \n> diff --git a/src/ipa/libipa/module.cpp b/src/ipa/libipa/module.cpp\n> index 64ca91419..f142c5257 100644\n> --- a/src/ipa/libipa/module.cpp\n> +++ b/src/ipa/libipa/module.cpp\n> @@ -94,6 +94,14 @@ namespace ipa {\n>   * algorithms. The configuration data is expected to be correct, any error\n>   * causes the function to fail and return immediately.\n>   *\n> + * Algorithms can optionally be disabled via the tuning file of the camera module\n> + * as shown here, with AGC being used as an example:\n> + *\n> + * - Agc:\n> + *     enabled: false\n> + *\n> + * If this is the case, the algorithm will not be instantiated.\n> + *\n>   * \\return 0 on success, or a negative error code on failure\n>   */\n>  \n> diff --git a/src/ipa/libipa/module.h b/src/ipa/libipa/module.h\n> index 0fb51916f..826b34dab 100644\n> --- a/src/ipa/libipa/module.h\n> +++ b/src/ipa/libipa/module.h\n> @@ -74,6 +74,18 @@ private:\n>  \tint createAlgorithm(Context &context, const YamlObject &data)\n>  \t{\n>  \t\tconst auto &[name, algoData] = *data.asDict().begin();\n> +\n> +\t\t/*\n> +\t\t * Optionally, algorithms can be disabled via the tuning file by including\n> +\t\t * enabled: false as a parameter within the algorithm tuning data.\n> +\t\t * This is not an error, so we return 0.\n> +\t\t */\n\nWith the comment reflowed to 80 columns,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\t\tif (!algoData[\"enabled\"].get<bool>(true)) {\n> +\t\t\tLOG(IPAModuleAlgo, Info)\n> +\t\t\t\t<< \"Algorithm '\" << name << \"' disabled via tuning file\";\n> +\t\t\treturn 0;\n> +\t\t}\n> +\n>  \t\tstd::unique_ptr<Algorithm<Module>> algo = createAlgorithm(name);\n>  \t\tif (!algo) {\n>  \t\t\tLOG(IPAModuleAlgo, Error)","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 1CF93C3330\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 21 Nov 2025 22:30:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 66E8F609D8;\n\tFri, 21 Nov 2025 23:30:18 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9151860805\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Nov 2025 23:30:16 +0100 (CET)","from pendragon.ideasonboard.com (fs276ed015.tkyc509.ap.nuro.jp\n\t[39.110.208.21])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 4081E66B;\n\tFri, 21 Nov 2025 23:28:05 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"hKRc35Lv\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1763764089;\n\tbh=3sxHmg0vlWRWo5JqGUZy95i5vRLk9Ye2ev8WeO4E7+M=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=hKRc35LvtAQFZgVvdzPDGYu90MuoZ34NIj+6Khko6r6xf4DQDvLYUiCZIoAEzSlZa\n\tbMRAsqvYmuYD6ZOaW3p07yQAmY23hckXma0QxGRC1DtfnJLr+HfgaUJUMOFyCS0fF8\n\t/YHhSQWtDk5oz2XvUaf0e4S2gSheC+1lkh8UvUHE=","Date":"Sat, 22 Nov 2025 07:29:44 +0900","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Isaac Scott <isaac.scott@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v4] libipa: module: Allow algorithms to be disabled via\n\tthe tuning file","Message-ID":"<20251121222944.GD10298@pendragon.ideasonboard.com>","References":"<20251121173124.178430-1-isaac.scott@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20251121173124.178430-1-isaac.scott@ideasonboard.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]