{"id":16228,"url":"https://patchwork.libcamera.org/api/patches/16228/?format=json","web_url":"https://patchwork.libcamera.org/patch/16228/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220616080744.548995-3-fsylvestre@baylibre.com>","date":"2022-06-16T08:07:41","name":"[libcamera-devel,v2,2/5] ipa: libipa: Add init() function to the Algorithm class","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"7c5fa3f439a8c013c0635c73f77619b03de1bd67","submitter":{"id":123,"url":"https://patchwork.libcamera.org/api/people/123/?format=json","name":"Florian Sylvestre","email":"fsylvestre@baylibre.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16228/mbox/","series":[{"id":3177,"url":"https://patchwork.libcamera.org/api/series/3177/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3177","date":"2022-06-16T08:07:39","name":"Add tuning file support for rkisp1 blc algo","version":2,"mbox":"https://patchwork.libcamera.org/series/3177/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16228/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16228/checks/","tags":{},"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 4B094C3274\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 16 Jun 2022 08:07:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E0F416563D;\n\tThu, 16 Jun 2022 10:07:55 +0200 (CEST)","from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com\n\t[IPv6:2a00:1450:4864:20::42f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 28A2A65633\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 16 Jun 2022 10:07:53 +0200 (CEST)","by mail-wr1-x42f.google.com with SMTP id x17so786586wrg.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 16 Jun 2022 01:07:53 -0700 (PDT)","from localhost.localdomain (lfbn-nic-1-76-188.w2-15.abo.wanadoo.fr.\n\t[2.15.166.188]) by smtp.gmail.com with ESMTPSA id\n\tr15-20020adff70f000000b002185d79dc7fsm1098868wrp.75.2022.06.16.01.07.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 16 Jun 2022 01:07:51 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655366875;\n\tbh=mKpHoFfV64VGexcpLK0gb5z1fIXoctrjxcICAwg8FU8=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=AYmM+YAgnVqDi2vkFpLljky/wURET8b/znppXrV7XRgDoYO/6TySRn0YPmqTwrSUD\n\t/tufSedTNGJ3Dd0IUtYh0oQp2uuqwe1IFmaSgN7tWtkS7/OtKyH2gSG2ziFQZ2zE2R\n\tJJxWWIJRrvEXjB1+1DWAEYLZcBm7UrUCH9qamsCKcI9fmVflowItAqYRwOepBI5vYh\n\tnAl/TPwK1eQLgfh+6q/0lN1hyMKhvT9Vssmwt84EiCBd41J1EuSchM8cCors4LQOBz\n\tNQFIO/caSNg4I1fxUyXUnuRCIPYgu4cfNZ0rGivtlW87IwBuHKF8JTHJD4oRvn/ftw\n\t11ZOWIdAsEBVQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20210112.gappssmtp.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=ru/NqCJop3F1vdmAQuOmH9+eNXjRCb0fqLfgUpvBwiY=;\n\tb=fjrIeahPeLVqqi63z6nfczKPr32IHo85F7xp8EdSQHkX0tpGVDxbR6HYi9RUqQ7quO\n\thMlOf0ou365VWQXCj6/omVbnyOTX2ovncoxC+jMU6nlLzjfV+s8t/WB/diY79/OxHyNO\n\tOLCkg4rkS4jSNapb8tNMzhK8OLx1Np3Ouqz99oFGHf8fECPi90eePdPFACRJtc70Ajho\n\t4dcVGwq2J0ejvgaQLObWN6y53gStsmXj9gQg+z9mSmNgePS5TglIaFxlE4qROOYoA8Pm\n\t2r/0k/IE+pSPxQpoQbasTIfmNdXfe9Vx62g/G2c6shqRlDXZcjGHGRsTpYeq7KlfBQ+Z\n\tYj4Q=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=baylibre-com.20210112.gappssmtp.com\n\theader.i=@baylibre-com.20210112.gappssmtp.com header.b=\"fjrIeahP\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=ru/NqCJop3F1vdmAQuOmH9+eNXjRCb0fqLfgUpvBwiY=;\n\tb=VtzKzB3lHKrlSN+KFyBtGayYAGz210Gr8b+WTGErTigrZGFv8AVJOgXOXhC2gu1oE9\n\tyLjBUcbiqOFzJJVcqmA9P/8QBL/lQMfehwaGLug55rfKlQhLBydHH4I/XIUP7Edt/qRK\n\t+SN3nRt5IOVNL+mU7HNBXXGrXrp1309P0OHnxkLaAXVroizCfc3y1k7Vhx7ZMBZGiucM\n\tRYTxuf+wyKALC380ZgddP26HTkxxb08Y9oOgOJjuRUmzvxePq83SVA7BQ3G1PsGNDh1i\n\tPKtvisHqZtX2bUoA126GoGmXGzxE4B6xl8sGcJGwDVgk5/FQIwoQNKEX4T0+tEbKKiSB\n\tb8HA==","X-Gm-Message-State":"AJIora/hQZAAEg138CIazsHqXhd9BMdGpyXeGWFWdmqxnKvpeEUVuW7c\n\t4V8atUzlxsR5xZQ8BTWKnzizH0CCAzCY/A==","X-Google-Smtp-Source":"AGRyM1sN6flOP+sYmvU45y9RUnWlB9wOUrv8kMC47k3diwlJeqy8dL/xo07Y2Z8GJsBOdn5XaNPpYw==","X-Received":"by 2002:a5d:5243:0:b0:216:ca0:58e9 with SMTP id\n\tk3-20020a5d5243000000b002160ca058e9mr3425539wrc.318.1655366872488; \n\tThu, 16 Jun 2022 01:07:52 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 16 Jun 2022 10:07:41 +0200","Message-Id":"<20220616080744.548995-3-fsylvestre@baylibre.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20220616080744.548995-1-fsylvestre@baylibre.com>","References":"<20220616080744.548995-1-fsylvestre@baylibre.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 2/5] ipa: libipa: Add init() function\n\tto the Algorithm class","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>","From":"Florian Sylvestre via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Florian Sylvestre <fsylvestre@baylibre.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add the init() function that will be called during algorithm initialization\nto provide each algorithm the list of algorithms tuning data.\nEach algorithm will be responsible to grab their corresponding parameters.\n\nSigned-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\n---\n src/ipa/ipu3/algorithms/algorithm.h |  4 +++-\n src/ipa/libipa/algorithm.cpp        | 16 ++++++++++++++++\n src/ipa/libipa/algorithm.h          | 10 +++++++++-\n 3 files changed, 28 insertions(+), 2 deletions(-)","diff":"diff --git a/src/ipa/ipu3/algorithms/algorithm.h b/src/ipa/ipu3/algorithms/algorithm.h\nindex d2eecc78..32cdfe52 100644\n--- a/src/ipa/ipu3/algorithms/algorithm.h\n+++ b/src/ipa/ipu3/algorithms/algorithm.h\n@@ -15,9 +15,11 @@\n \n namespace libcamera {\n \n+class YamlObject;\n+\n namespace ipa::ipu3 {\n \n-using Algorithm = libcamera::ipa::Algorithm<IPAContext, IPAConfigInfo, ipu3_uapi_params, ipu3_uapi_stats_3a>;\n+using Algorithm = libcamera::ipa::Algorithm<IPAContext, YamlObject, IPAConfigInfo, ipu3_uapi_params, ipu3_uapi_stats_3a>;\n \n } /* namespace ipa::ipu3 */\n \ndiff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp\nindex 398d5372..3424610b 100644\n--- a/src/ipa/libipa/algorithm.cpp\n+++ b/src/ipa/libipa/algorithm.cpp\n@@ -29,6 +29,22 @@ namespace ipa {\n  * to manage algorithms regardless of their specific type.\n  */\n \n+/**\n+ * \\fn Algorithm::init()\n+ * \\brief Configure the Algorithm with default parameters\n+ * \\param[in] context The shared IPA context\n+ * \\param[in] params The initial parameters used to tune algorithms\n+ *\n+ * This function is called once before the camera is running to get default\n+ * algorithm parameters.\n+ * This function is called once, when the IPA module is initialized, to\n+ * initialize the algorithm. The \\a params YamlObject contains IPA module\n+ * parameters, typically tuning data for all algorithms. The Algorithm is\n+ * responsible for reading the parameters relevant to its configuration.\n+ *\n+ * \\return 0 if successful, an error code otherwise\n+ */\n+\n /**\n  * \\fn Algorithm::configure()\n  * \\brief Configure the Algorithm given an IPAConfigInfo\ndiff --git a/src/ipa/libipa/algorithm.h b/src/ipa/libipa/algorithm.h\nindex 766aee5d..f5be1caf 100644\n--- a/src/ipa/libipa/algorithm.h\n+++ b/src/ipa/libipa/algorithm.h\n@@ -10,12 +10,20 @@ namespace libcamera {\n \n namespace ipa {\n \n-template<typename Context, typename Config, typename Params, typename Stats>\n+template<typename Context, typename TuningData,\n+\t typename Config, typename Params, typename Stats>\n+\n class Algorithm\n {\n public:\n \tvirtual ~Algorithm() {}\n \n+\tvirtual int init([[maybe_unused]] Context &context,\n+\t\t\t [[maybe_unused]] const TuningData *params)\n+\t{\n+\t\treturn 0;\n+\t}\n+\n \tvirtual int configure([[maybe_unused]] Context &context,\n \t\t\t      [[maybe_unused]] const Config &configInfo)\n \t{\n","prefixes":["libcamera-devel","v2","2/5"]}