[{"id":37205,"web_url":"https://patchwork.libcamera.org/comment/37205/","msgid":"<85zf7zz2y8.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-12-03T21:10:39","subject":"Re: [PATCH v6 17/24] ipa: Add a new Algorithm::init() to support\n\tself-initalising algorithms","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes:\n\n> Add in an algorithm init() routine which can be called in the absence of a\n> Yaml input. Do this to allow an algorithm to set up a default set of\n> parameters.\n\nThis requires more explanation.  I can see in 21/24 \"Call\ncreateSelfEnumeratingAlgorithm() to statically instantiate CCM algo\"\nthat the selection between the two versions is based on examining a\ncondition.  Why not to put the condition value as a flag to context_ and\nthen examine that context_ flag in the original init(), without the need\nto add the overloaded method?\n\n> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n> ---\n>  src/ipa/libipa/algorithm.cpp | 13 ++++++++++++-\n>  src/ipa/libipa/algorithm.h   |  5 +++++\n>  2 files changed, 17 insertions(+), 1 deletion(-)\n>\n> diff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp\n> index 201efdfdb..da44c77ca 100644\n> --- a/src/ipa/libipa/algorithm.cpp\n> +++ b/src/ipa/libipa/algorithm.cpp\n> @@ -38,7 +38,7 @@ namespace ipa {\n>   */\n>  \n>  /**\n> - * \\fn Algorithm::init()\n> + * \\fn Algorithm::init(typename Module::Context &context, const YamlObject &tuningData)\n>   * \\brief Initialize the Algorithm with tuning data\n>   * \\param[in] context The shared IPA context\n>   * \\param[in] tuningData The tuning data for the algorithm\n> @@ -50,6 +50,17 @@ namespace ipa {\n>   * \\return 0 if successful, an error code otherwise\n>   */\n>  \n> +/**\n> + * \\fn Algorithm::init(typename Module::Context &context)\n> + * \\brief Initialize the algorithm with default parameters\n> + *\n> + * This method is called when no tuning data is available. The algorithm\n> + * should initialize with sensible default values.\n> + *\n> + * \\param context The IPA context containing algorithm state\n> + * \\return 0 on success, negative error code on failure\n> + */\n> +\n>  /**\n>   * \\fn Algorithm::configure()\n>   * \\brief Configure the Algorithm given an IPAConfigInfo\n> diff --git a/src/ipa/libipa/algorithm.h b/src/ipa/libipa/algorithm.h\n> index 9a19dbd61..9fcbe23a9 100644\n> --- a/src/ipa/libipa/algorithm.h\n> +++ b/src/ipa/libipa/algorithm.h\n> @@ -32,6 +32,11 @@ public:\n>  \t\treturn 0;\n>  \t}\n>  \n> +\tvirtual int init([[maybe_unused]] typename Module::Context &context)\n> +\t{\n> +\t\treturn 0;\n> +\t}\n> +\n>  \tvirtual int configure([[maybe_unused]] typename Module::Context &context,\n>  \t\t\t      [[maybe_unused]] const typename Module::Config &configInfo)\n>  \t{","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 05499C3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Dec 2025 21:10:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3C0DD61022;\n\tWed,  3 Dec 2025 22:10:47 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EC35C609D8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Dec 2025 22:10:44 +0100 (CET)","from mail-wr1-f69.google.com (mail-wr1-f69.google.com\n\t[209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-636-6mrCWpYyN1WMtbfAogVMiQ-1; Wed, 03 Dec 2025 16:10:42 -0500","by mail-wr1-f69.google.com with SMTP id\n\tffacd0b85a97d-42b2e448bd9so138469f8f.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 03 Dec 2025 13:10:42 -0800 (PST)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-42f760b775asm4129818f8f.37.2025.12.03.13.10.39\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 03 Dec 2025 13:10:40 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"BqnBd2P3\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1764796243;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=aDHEZXG0d5pbCg9/Wu7glDGALbIdrxZ97hFHb9FKGFE=;\n\tb=BqnBd2P3mqVpTlXttNspr+SxpChtj5ZKTp8r40vPWaogpWz9ctq9ZO6zf8sqQY2uW8o8vr\n\tkKBFeZIMPjmE44yXyPgA7M3zcSp5CyZTVXACivKZy7d/6sXmKAzE/n+EjoMPo0zMY2hfo2\n\tiv0eWKFceexENqTo0jPGbr9HapHFKok=","X-MC-Unique":"6mrCWpYyN1WMtbfAogVMiQ-1","X-Mimecast-MFC-AGG-ID":"6mrCWpYyN1WMtbfAogVMiQ_1764796241","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1764796241; x=1765401041;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to: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qi8eZq\n\t/lMalE0/gS3xI3I+EefFbWozA4xdU4xWvqiEUHu/3n4LQ7+RHkVLWKVH0zXtncvc=","X-Received":["by 2002:a05:6000:2893:b0:42f:7601:899c with SMTP id\n\tffacd0b85a97d-42f7985e948mr357210f8f.50.1764796241271; \n\tWed, 03 Dec 2025 13:10:41 -0800 (PST)","by 2002:a05:6000:2893:b0:42f:7601:899c with SMTP id\n\tffacd0b85a97d-42f7985e948mr357189f8f.50.1764796240819; \n\tWed, 03 Dec 2025 13:10:40 -0800 (PST)"],"X-Google-Smtp-Source":"AGHT+IF43Lu9j9XzIdwIp5jrS5E/nMokKp976CeChl43dCHZiLPSMjuHWmYg2eOb0ay09c4UZuHhUA==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","Cc":"libcamera-devel@lists.libcamera.org,  pavel@ucw.cz","Subject":"Re: [PATCH v6 17/24] ipa: Add a new Algorithm::init() to support\n\tself-initalising algorithms","In-Reply-To":"<20251202134544.662446-18-bryan.odonoghue@linaro.org> (Bryan\n\tO'Donoghue's message of \"Tue, 2 Dec 2025 13:45:37 +0000\")","References":"<20251202134544.662446-1-bryan.odonoghue@linaro.org>\n\t<20251202134544.662446-18-bryan.odonoghue@linaro.org>","Date":"Wed, 03 Dec 2025 22:10:39 +0100","Message-ID":"<85zf7zz2y8.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"FLRADR3PaWiiU6oQOYTFbw-eWiMjNT10fKNMW7GE1FU_1764796241","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","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>"}}]