{"id":16259,"url":"https://patchwork.libcamera.org/api/patches/16259/?format=json","web_url":"https://patchwork.libcamera.org/patch/16259/","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":"<20220617092315.120781-3-fsylvestre@baylibre.com>","date":"2022-06-17T09:23:12","name":"[libcamera-devel,v3,2/5] ipa: libipa: Add init() function to the Algorithm class","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"15987ab9f7fde025a303b2d409a0bbaa84bb62e7","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/16259/mbox/","series":[{"id":3186,"url":"https://patchwork.libcamera.org/api/series/3186/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3186","date":"2022-06-17T09:23:10","name":"Add tuning file support for rkisp1 blc algo","version":3,"mbox":"https://patchwork.libcamera.org/series/3186/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16259/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16259/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 725B0C3274\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 17 Jun 2022 09:23:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C05C16563E;\n\tFri, 17 Jun 2022 11:23:52 +0200 (CEST)","from mail-wm1-x331.google.com (mail-wm1-x331.google.com\n\t[IPv6:2a00:1450:4864:20::331])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0740B60471\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jun 2022 11:23:50 +0200 (CEST)","by mail-wm1-x331.google.com with SMTP id\n\ts21-20020a1cf215000000b0039ee8149524so568051wmc.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jun 2022 02:23:50 -0700 (PDT)","from BL087.. ([2a01:e34:eea9:e630:4718:73b:d035:3786])\n\tby smtp.gmail.com with ESMTPSA id\n\th81-20020a1c2154000000b0039c41686421sm7962328wmh.17.2022.06.17.02.23.48\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 17 Jun 2022 02:23:48 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655457832;\n\tbh=p4e33/jkM7aiRpDEeh6t1mYzMnKJsgaj6toEOgRI9uM=;\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=3/ys//NwsvkKuKYp4LxFis+5KXlNBzkLP3sRBA4SD2+6cN/yXWyPBtXG+/7ccC6Mi\n\tKTgovzQftG5AFc/z3gsGA8GZxDe/YyBiU7zzRfpDWOlGCObEptsE9kLqa/3rDKlwpF\n\t9wZ7d4ikv55MaqlCOxN1lbWN1BCYQXA2TNbnX+BlzID9witiiBn/7H42e9nrY8W24I\n\tHXquh+8iF/0O34vdEp9qMgW2JYZ1cwsQuDRHpElzy/lF9GNz4vGJ7Vxf839AjaRW5d\n\trgUFqIY9sNT42weNqNfT/60dcGz2ng3kKp7N1Wwyc8aOtcjC1no6lDJfDmZmpc4SEg\n\t8q3614hr5R/qA==","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=TMYZjips5Lixyu5lyPtw51kzFlykmKB07P7srPkyV6c=;\n\tb=7K2ManLDvqZ+AVZT67uvi1B2q/rmyt0dRkVD2HPHH0d94YOy9vzdLoT84OdQtJUBwe\n\t7QOleAySGb4ksFxCa3bDXpqEb39q8ogGtsbLMbGU3U4L7BWlWVW5vm1L6o4+cBP5UgCu\n\tmv5dBQvvpNFhQbqTd8EEe+jdcwg6F+9C1GZ4vjXTxR71lEyIu5Y6ni6dwYiB+TlYyUMn\n\t5XOZN8NBLe1mWWm8FCKA6AUb7uVVCUqThJrpnUfXEeMfv77n0/7XCHiZ8SORCXEgIQz5\n\tMxQDr0LKyOc5CuYQrZ3mAYg6Wl5xnU+yV1tND8EAERIPvVNRieup4kpXoNHLaQEgdCRu\n\tOl1A=="],"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=\"7K2ManLD\"; \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=TMYZjips5Lixyu5lyPtw51kzFlykmKB07P7srPkyV6c=;\n\tb=OHsz8S9oRu6hNYc0L+sL4Gr5aFgCjjNy6IgOdxkfzjbwn+xbfV+xR4XZ4B4V3Ji7gh\n\tJe/W2Ehlud52OvWpLk9Huz5e78rAAp6yWxDlCELCfMnekP67wRIfA4xgDX0SDkTI6GGt\n\txMUy5Z9fTPijuaoE5C9chyk3vOIWqXm4ENd1W1bohV9FnPJc8DgbzRVhlFu1yWsgIX7j\n\t2slcr460PA46wKss47khquD4oHzrHIpaG6khqqYPdYL8unj914oPrZU+9kNbgXnQ8gQh\n\t4Nop4LtSDco1oxd39rRS9Cx4RbWtEstraMp2igHmeu0X7m3XpEqJnuBet9hCZ7RanQZm\n\tX8Tw==","X-Gm-Message-State":"AJIora/Y6Y5v69/pd3hot8wyt70I2dPM3DsVFXbMEDmQvfzmGoSGDjPR\n\t9qc2e9SPEQh4eQTDFVWs4yr0mWnd4UVHFQ==","X-Google-Smtp-Source":"AGRyM1sUqDg8Ptwg8SJH0HLLUWQLrkFvavoFlQsgIcsg+M3Q84LCpxxkIGae4fLUVuuk8Tr663hVlg==","X-Received":"by 2002:a05:600c:358d:b0:39c:7aea:e20f with SMTP id\n\tp13-20020a05600c358d00b0039c7aeae20fmr9171587wmq.64.1655457829351; \n\tFri, 17 Jun 2022 02:23:49 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 17 Jun 2022 11:23:12 +0200","Message-Id":"<20220617092315.120781-3-fsylvestre@baylibre.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20220617092315.120781-1-fsylvestre@baylibre.com>","References":"<20220617092315.120781-1-fsylvestre@baylibre.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 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>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n src/ipa/ipu3/algorithms/algorithm.h   |  8 +++++---\n src/ipa/libipa/algorithm.cpp          | 14 ++++++++++++++\n src/ipa/libipa/algorithm.h            | 11 +++++++++--\n src/ipa/rkisp1/algorithms/algorithm.h |  8 +++++---\n 4 files changed, 33 insertions(+), 8 deletions(-)","diff":"diff --git a/src/ipa/ipu3/algorithms/algorithm.h b/src/ipa/ipu3/algorithms/algorithm.h\nindex 234b2bd7..8b562e5b 100644\n--- a/src/ipa/ipu3/algorithms/algorithm.h\n+++ b/src/ipa/ipu3/algorithms/algorithm.h\n@@ -15,11 +15,13 @@\n \n namespace libcamera {\n \n+class YamlObject;\n+\n namespace ipa::ipu3 {\n \n-using Algorithm = libcamera::ipa::Algorithm<IPAContext, IPAFrameContext,\n-\t\t\t\t\t    IPAConfigInfo, ipu3_uapi_params,\n-\t\t\t\t\t    ipu3_uapi_stats_3a>;\n+using Algorithm = libcamera::ipa::Algorithm<IPAContext, YamlObject,\n+\t\t\t\t\t    IPAFrameContext, IPAConfigInfo,\n+\t\t\t\t\t    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 cce2ed62..f1b04160 100644\n--- a/src/ipa/libipa/algorithm.cpp\n+++ b/src/ipa/libipa/algorithm.cpp\n@@ -29,6 +29,20 @@ 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, 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 032a05b5..2945719e 100644\n--- a/src/ipa/libipa/algorithm.h\n+++ b/src/ipa/libipa/algorithm.h\n@@ -10,13 +10,20 @@ namespace libcamera {\n \n namespace ipa {\n \n-template<typename Context, typename FrameContext, typename Config,\n-\t typename Params, typename Stats>\n+template<typename Context, typename TuningData, typename FrameContext,\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{\ndiff --git a/src/ipa/rkisp1/algorithms/algorithm.h b/src/ipa/rkisp1/algorithms/algorithm.h\nindex 68e3a44e..e813756d 100644\n--- a/src/ipa/rkisp1/algorithms/algorithm.h\n+++ b/src/ipa/rkisp1/algorithms/algorithm.h\n@@ -17,11 +17,13 @@\n \n namespace libcamera {\n \n+class YamlObject;\n+\n namespace ipa::rkisp1 {\n \n-using Algorithm = libcamera::ipa::Algorithm<IPAContext, IPAFrameContext,\n-\t\t\t\t\t    IPACameraSensorInfo, rkisp1_params_cfg,\n-\t\t\t\t\t    rkisp1_stat_buffer>;\n+using Algorithm = libcamera::ipa::Algorithm<IPAContext, YamlObject,\n+\t\t\t\t\t    IPAFrameContext, IPACameraSensorInfo,\n+\t\t\t\t\t    rkisp1_params_cfg, rkisp1_stat_buffer>;\n \n } /* namespace ipa::rkisp1 */\n \n","prefixes":["libcamera-devel","v3","2/5"]}