[{"id":36982,"web_url":"https://patchwork.libcamera.org/comment/36982/","msgid":"<176372608368.2176992.6726024871776694739@localhost>","date":"2025-11-21T11:54:43","subject":"Re: [PATCH v3] libipa: module: Allow algorithms to be disabled via\n\tthe tuning file","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi Isaac,\n\nThank you for the patch.\n\nQuoting Isaac Scott (2025-11-21 12:34:11)\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> 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   | 11 +++++++++++\n>  2 files changed, 19 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 116cb8968..0b3b84219 100644\n> --- a/src/ipa/libipa/module.h\n> +++ b/src/ipa/libipa/module.h\n> @@ -82,6 +82,17 @@ private:\n>                         return -EINVAL;\n>                 }\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, Debug)\n\nI think this could even be Info level?\n\n> +                               << \"Algorithm '\" << name << \"' disabled via tuning file\";\n> +                       return 0;\n> +               }\n> +\n\nUnfortunately this doesn't solve my main use case :-). I often switch\nbetween different libcamera versions that support different algorithms.\nSo it would be great if IPA loading would continue on algorithms that\nfailed to load but are marked as disabled. Something like\n\nstd::unique_ptr<Algorithm<Module>> algo = createAlgorithm(name);\nbool enabled = algoData[\"enabled\"].get<bool>(true);\nif (!algo) {\n\tLOG(IPAModuleAlgo, Error)\n\t\t\t<< \"Algorithm '\" << name << \"' not found\";\n\tif (enabled)\n\t\treturn -EINVAL;\n}\n\nif (!enabled) {\n\tLOG(IPAModuleAlgo, Debug)\n               << \"Algorithm '\" << name << \"' disabled via tuning file\";\n        return 0;\n}\n\nWhat do you think?\n\nBest regards,\nStefan\n\n>                 int ret = algo->init(context, algoData);\n>                 if (ret) {\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 B8974C3335\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 21 Nov 2025 11:54:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F29FF60A85;\n\tFri, 21 Nov 2025 12:54:48 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8F2C260805\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Nov 2025 12:54:47 +0100 (CET)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:5cfa:32ee:2ce5:d89f])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 1FB0666B;\n\tFri, 21 Nov 2025 12:52:40 +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=\"M6QS1mao\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1763725961;\n\tbh=tzfOX26RHVTEDZmjcSx8cC1NWNmAuaWXdPXQAC6wsiY=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=M6QS1maoXRz9gXr+ACpEqnGtEyjPK0m+bE8nVxsNajWfVSv561CcKt+8K6jcvOQ7K\n\t+ZMSxw+C1cBXW+WHgg1yyKV4onwpyhYBbp7nlvYguxOMyWD05uQ19l26u2wxcUvmDh\n\tLFh7DjPhY9mVX5olieh5CBpSAdnBHJ6rQh1WiehE=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20251121113411.111096-1-isaac.scott@ideasonboard.com>","References":"<20251121113411.111096-1-isaac.scott@ideasonboard.com>","Subject":"Re: [PATCH v3] libipa: module: Allow algorithms to be disabled via\n\tthe tuning file","From":"Stefan Klug <stefan.klug@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 12:54:43 +0100","Message-ID":"<176372608368.2176992.6726024871776694739@localhost>","User-Agent":"alot/0.12.dev8+g2c003385c862.d20250602","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":36983,"web_url":"https://patchwork.libcamera.org/comment/36983/","msgid":"<25ca0a69-f919-4af9-90e5-0152ac30ac1b@ideasonboard.com>","date":"2025-11-21T12:39:33","subject":"Re: [PATCH v3] libipa: module: Allow algorithms to be disabled via\n\tthe tuning file","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"2025. 11. 21. 12:54 keltezéssel, Stefan Klug írta:\n> Hi Isaac,\n> \n> Thank you for the patch.\n> \n> Quoting Isaac Scott (2025-11-21 12:34:11)\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>> 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   | 11 +++++++++++\n>>   2 files changed, 19 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 116cb8968..0b3b84219 100644\n>> --- a/src/ipa/libipa/module.h\n>> +++ b/src/ipa/libipa/module.h\n>> @@ -82,6 +82,17 @@ private:\n>>                          return -EINVAL;\n>>                  }\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, Debug)\n> \n> I think this could even be Info level?\n> \n>> +                               << \"Algorithm '\" << name << \"' disabled via tuning file\";\n>> +                       return 0;\n>> +               }\n>> +\n> \n> Unfortunately this doesn't solve my main use case :-). I often switch\n> between different libcamera versions that support different algorithms.\n> So it would be great if IPA loading would continue on algorithms that\n> failed to load but are marked as disabled. Something like\n> \n> std::unique_ptr<Algorithm<Module>> algo = createAlgorithm(name);\n> bool enabled = algoData[\"enabled\"].get<bool>(true);\n> if (!algo) {\n> \tLOG(IPAModuleAlgo, Error)\n> \t\t\t<< \"Algorithm '\" << name << \"' not found\";\n> \tif (enabled)\n> \t\treturn -EINVAL;\n> }\n> \n> if (!enabled) {\n> \tLOG(IPAModuleAlgo, Debug)\n>                 << \"Algorithm '\" << name << \"' disabled via tuning file\";\n>          return 0;\n> }\n> \n> What do you think?\n\nCan't we add something like `state: enabled (default) / disabled / optional` ?\nWould this \"optional\" solve your use case?\n\n\n> \n> Best regards,\n> Stefan\n> \n>>                  int ret = algo->init(context, algoData);\n>>                  if (ret) {\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 E9796C3330\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 21 Nov 2025 12:39:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D4AA3609D8;\n\tFri, 21 Nov 2025 13:39:38 +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 BF8C060805\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Nov 2025 13:39:36 +0100 (CET)","from [192.168.33.39] (185.221.143.100.nat.pool.zt.hu\n\t[185.221.143.100])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5C7CB6A6;\n\tFri, 21 Nov 2025 13:37:30 +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=\"wLWq/df/\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1763728650;\n\tbh=IaUdp2xosX94U/dwhTTVAOVO4ZDLpqiTV9NYzOzaGAM=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=wLWq/df/N8TSb5TV0fi4g9uSG6pxIcEDw0ZyfMj8zBuI7vgz+YcrWpHRR+juW4adY\n\tYRWNJtIFbb/+N9075Gys1yHBTf+UFy7QaQtBxWlvvH7QLF5iB+2VSlb4xNrxQJ9Gsu\n\tJYz+lsBkpoTiaJCCrb+Ow4Nld8+GjnTgmpX7eCyw=","Message-ID":"<25ca0a69-f919-4af9-90e5-0152ac30ac1b@ideasonboard.com>","Date":"Fri, 21 Nov 2025 13:39:33 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3] libipa: module: Allow algorithms to be disabled via\n\tthe tuning file","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tIsaac Scott <isaac.scott@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20251121113411.111096-1-isaac.scott@ideasonboard.com>\n\t<176372608368.2176992.6726024871776694739@localhost>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<176372608368.2176992.6726024871776694739@localhost>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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":36984,"web_url":"https://patchwork.libcamera.org/comment/36984/","msgid":"<176372909256.127215.4949318719238397725@isaac-ThinkPad-T16-Gen-2>","date":"2025-11-21T12:44:52","subject":"Re: [PATCH v3] libipa: module: Allow algorithms to be disabled via\n\tthe tuning file","submitter":{"id":215,"url":"https://patchwork.libcamera.org/api/people/215/","name":"Isaac Scott","email":"isaac.scott@ideasonboard.com"},"content":"Hi All,\n\nQuoting Barnabás Pőcze (2025-11-21 12:39:33)\n> 2025. 11. 21. 12:54 keltezéssel, Stefan Klug írta:\n> > Hi Isaac,\n> > \n> > Thank you for the patch.\n> > \n> > Quoting Isaac Scott (2025-11-21 12:34:11)\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> >> 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   | 11 +++++++++++\n> >>   2 files changed, 19 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 116cb8968..0b3b84219 100644\n> >> --- a/src/ipa/libipa/module.h\n> >> +++ b/src/ipa/libipa/module.h\n> >> @@ -82,6 +82,17 @@ private:\n> >>                          return -EINVAL;\n> >>                  }\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, Debug)\n> > \n> > I think this could even be Info level?\n> > \n> >> +                               << \"Algorithm '\" << name << \"' disabled via tuning file\";\n> >> +                       return 0;\n> >> +               }\n> >> +\n> > \n> > Unfortunately this doesn't solve my main use case :-). I often switch\n> > between different libcamera versions that support different algorithms.\n> > So it would be great if IPA loading would continue on algorithms that\n> > failed to load but are marked as disabled. Something like\n> > \n> > std::unique_ptr<Algorithm<Module>> algo = createAlgorithm(name);\n> > bool enabled = algoData[\"enabled\"].get<bool>(true);\n> > if (!algo) {\n> >       LOG(IPAModuleAlgo, Error)\n> >                       << \"Algorithm '\" << name << \"' not found\";\n> >       if (enabled)\n> >               return -EINVAL;\n> > }\n> > \n> > if (!enabled) {\n> >       LOG(IPAModuleAlgo, Debug)\n> >                 << \"Algorithm '\" << name << \"' disabled via tuning file\";\n> >          return 0;\n> > }\n> > \n> > What do you think?\n> \n> Can't we add something like `state: enabled (default) / disabled / optional` ?\n> Would this \"optional\" solve your use case?\n> \n\nI think just moving it to before the first createAlgorithm() instead of\nafterwards would probably also solve it?\n\nBest wishes,\nIsaac\n\n> \n> > \n> > Best regards,\n> > Stefan\n> > \n> >>                  int ret = algo->init(context, algoData);\n> >>                  if (ret) {\n> >>                          LOG(IPAModuleAlgo, Error)\n> >> -- \n> >> 2.43.0\n> >>\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 7BEDFC3333\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 21 Nov 2025 12:44:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C7BDC60A81;\n\tFri, 21 Nov 2025 13:44:56 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3005E60805\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Nov 2025 13:44:55 +0100 (CET)","from thinkpad.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 259496A6;\n\tFri, 21 Nov 2025 13:42:49 +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=\"PP7AqmAb\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1763728969;\n\tbh=aPlfUuG2tA9yutzdKpMvpFHTzN5UQRP0GYIxR3y9imM=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=PP7AqmAbgVmk0+87x4yJXhist4C+OpO1MrcQrSF88uBpewt7mQhs5v19JeUQnG3IT\n\tJazLTiJK8mpWu6/gfSxO2QknHbJrl9OxwH7dMtVhoJI+rIGLX5b7GzU02dbyqbDrQn\n\tWuUAnBaD2E/uo/fCtDuV5VV7OR0YS+vQNHuImdIY=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<25ca0a69-f919-4af9-90e5-0152ac30ac1b@ideasonboard.com>","References":"<20251121113411.111096-1-isaac.scott@ideasonboard.com>\n\t<176372608368.2176992.6726024871776694739@localhost>\n\t<25ca0a69-f919-4af9-90e5-0152ac30ac1b@ideasonboard.com>","Subject":"Re: [PATCH v3] libipa: module: Allow algorithms to be disabled via\n\tthe tuning file","From":"Isaac Scott <isaac.scott@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tStefan Klug <stefan.klug@ideasonboard.com>, \n\tlibcamera-devel@lists.libcamera.org","Date":"Fri, 21 Nov 2025 12:44:52 +0000","Message-ID":"<176372909256.127215.4949318719238397725@isaac-ThinkPad-T16-Gen-2>","User-Agent":"alot/0.10","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":36995,"web_url":"https://patchwork.libcamera.org/comment/36995/","msgid":"<176373414015.567526.1556754160695075144@ping.linuxembedded.co.uk>","date":"2025-11-21T14:09:00","subject":"Re: [PATCH v3] 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 12:44:52)\n> Hi All,\n> \n> Quoting Barnabás Pőcze (2025-11-21 12:39:33)\n> > 2025. 11. 21. 12:54 keltezéssel, Stefan Klug írta:\n> > > Hi Isaac,\n> > > \n> > > Thank you for the patch.\n> > > \n> > > Quoting Isaac Scott (2025-11-21 12:34:11)\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> > >> 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   | 11 +++++++++++\n> > >>   2 files changed, 19 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 116cb8968..0b3b84219 100644\n> > >> --- a/src/ipa/libipa/module.h\n> > >> +++ b/src/ipa/libipa/module.h\n> > >> @@ -82,6 +82,17 @@ private:\n> > >>                          return -EINVAL;\n> > >>                  }\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, Debug)\n> > > \n> > > I think this could even be Info level?\n> > > \n> > >> +                               << \"Algorithm '\" << name << \"' disabled via tuning file\";\n> > >> +                       return 0;\n> > >> +               }\n> > >> +\n> > > \n> > > Unfortunately this doesn't solve my main use case :-). I often switch\n> > > between different libcamera versions that support different algorithms.\n> > > So it would be great if IPA loading would continue on algorithms that\n> > > failed to load but are marked as disabled. Something like\n> > > \n> > > std::unique_ptr<Algorithm<Module>> algo = createAlgorithm(name);\n> > > bool enabled = algoData[\"enabled\"].get<bool>(true);\n> > > if (!algo) {\n> > >       LOG(IPAModuleAlgo, Error)\n> > >                       << \"Algorithm '\" << name << \"' not found\";\n> > >       if (enabled)\n> > >               return -EINVAL;\n> > > }\n> > > \n> > > if (!enabled) {\n> > >       LOG(IPAModuleAlgo, Debug)\n> > >                 << \"Algorithm '\" << name << \"' disabled via tuning file\";\n> > >          return 0;\n> > > }\n> > > \n> > > What do you think?\n> > \n> > Can't we add something like `state: enabled (default) / disabled / optional` ?\n> > Would this \"optional\" solve your use case?\n> > \n> \n> I think just moving it to before the first createAlgorithm() instead of\n> afterwards would probably also solve it?\n> \n\nYes, I think this is best - we shouldn't /create/ an algorithm just to\nthen identify that it's disabled and then destroy it.\n\n--\nKieran\n\n> Best wishes,\n> Isaac\n> \n> > \n> > > \n> > > Best regards,\n> > > Stefan\n> > > \n> > >>                  int ret = algo->init(context, algoData);\n> > >>                  if (ret) {\n> > >>                          LOG(IPAModuleAlgo, Error)\n> > >> -- \n> > >> 2.43.0\n> > >>\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 03FFBC3333\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 21 Nov 2025 14:09:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A808C60A80;\n\tFri, 21 Nov 2025 15:09:04 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 452C460805\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Nov 2025 15:09:03 +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 4BCEF9CA;\n\tFri, 21 Nov 2025 15:06:57 +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=\"Z5u73xvj\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1763734017;\n\tbh=jYjPNk2oBJbHET39wtlPtX6H+AnoKrKqglgfei5360Q=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=Z5u73xvjVbwdUmQ36Axb/LMF42XHuhKu4Adq1pTWtOLdxT2c1b+BB5OgIBUl6oNnw\n\tq913ITx2Zj3CwZgiLnLxSzrjz/k7lgBel+0EfKPQ7X4JYFafYbmCZpAbUvCaWwSsR/\n\tA20g4iRhxfk3TyXdwGZmz+rHgkjR4whtjuJCihNI=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<176372909256.127215.4949318719238397725@isaac-ThinkPad-T16-Gen-2>","References":"<20251121113411.111096-1-isaac.scott@ideasonboard.com>\n\t<176372608368.2176992.6726024871776694739@localhost>\n\t<25ca0a69-f919-4af9-90e5-0152ac30ac1b@ideasonboard.com>\n\t<176372909256.127215.4949318719238397725@isaac-ThinkPad-T16-Gen-2>","Subject":"Re: [PATCH v3] libipa: module: Allow algorithms to be disabled via\n\tthe tuning file","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tIsaac Scott <isaac.scott@ideasonboard.com>, Stefan Klug\n\t<stefan.klug@ideasonboard.com>,  libcamera-devel@lists.libcamera.org","Date":"Fri, 21 Nov 2025 14:09:00 +0000","Message-ID":"<176373414015.567526.1556754160695075144@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>"}}]