{"id":17774,"url":"https://patchwork.libcamera.org/api/1.1/patches/17774/?format=json","web_url":"https://patchwork.libcamera.org/patch/17774/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20221110173154.488445-4-paul.elder@ideasonboard.com>","date":"2022-11-10T17:31:45","name":"[libcamera-devel,v3,03/12] utils: tuning: libtuning: Implement extensible components of libtuning","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"01516bff9636276edd3e68be1e30c301a620baa1","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17774/mbox/","series":[{"id":3603,"url":"https://patchwork.libcamera.org/api/1.1/series/3603/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3603","date":"2022-11-10T17:31:42","name":"utils: tuning: Add a new tuning infrastructure","version":3,"mbox":"https://patchwork.libcamera.org/series/3603/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17774/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17774/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 E3CBEBD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 10 Nov 2022 17:32:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A7AFC6308D;\n\tThu, 10 Nov 2022 18:32:23 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0A6F163085\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Nov 2022 18:32:22 +0100 (CET)","from pyrite.tail37cf.ts.net (h175-177-042-159.catv02.itscom.jp\n\t[175.177.42.159])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A37D032A;\n\tThu, 10 Nov 2022 18:32:20 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1668101543;\n\tbh=Gzh1OxX/X31k/RYZusu/64//6peFJxOggB+bstxYUfo=;\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=gSziz5QMhEEMPm3Y/ci6YVsFBS1vFGTNKFR+IuDQ01T8iwdelvJeKgpIV192dhV1L\n\tcNB5m9lpjoKLtNFBy/lTktB37Kz0xCcxe2u0HskMkXSrCugau+P6ElDpoy79HPHf9x\n\t7py6En20UM2R5UJQdp4B9d7LMQeNhgCrYrWltuRsfBNP3abGmrgvILfQG8G66/JPky\n\tC1ZXcycqSCDvDpxmHVnL5HXrZd88qb0MKbr9qqUScyNEVnpkrfHkPZFMDH3V+Z/glk\n\tACJYnsRlwtgMjlOHnir8TozDIBib+Di3U1J6TGZX0GFovsTp0oPsKOL2jjwsE9KAxw\n\typT2VAVjnvAoQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1668101541;\n\tbh=Gzh1OxX/X31k/RYZusu/64//6peFJxOggB+bstxYUfo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=V3IWWGv6ZQPlsaNXozN+SXStdvSIcVFgUMY6bnmZ1wRlD/6v/8fw2G9aAeOKUpnkq\n\t0gG9eGfKfckrKl6qlo1SGvp2D9HDsSwnwUHpqspjyFh1Mpfse6uo3/rnACPD9aCKzo\n\t6BvrNS9McNvmkvfjxYfv1qeWc75YgGrHPo/zV83k="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"V3IWWGv6\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 11 Nov 2022 02:31:45 +0900","Message-Id":"<20221110173154.488445-4-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.35.1","In-Reply-To":"<20221110173154.488445-1-paul.elder@ideasonboard.com>","References":"<20221110173154.488445-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 03/12] utils: tuning: libtuning:\n\tImplement extensible components of libtuning","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":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Paul Elder <paul.elder@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Implement the extensible components of libtuning. This includes:\n- Parsers, for supporting different types of input config file formats\n- Generators, for supporting different types of output tuning file\n  formats\n- Modules, for supporting different tuning modules for different\n  algorithms and platforms\n\nNo parsers, generators, or modules are actually implemented. Only the\nbase classes are implemented.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v3:\n- Newly split from the first patch \"utils: tuning: libtuning: Implement\n  the core of libtuning\"\n  - See changelog from that patch\n---\n utils/tuning/libtuning/generators/__init__.py |  0\n .../tuning/libtuning/generators/generator.py  | 15 +++++++++\n utils/tuning/libtuning/modules/__init__.py    |  0\n utils/tuning/libtuning/modules/module.py      | 33 +++++++++++++++++++\n utils/tuning/libtuning/parsers/__init__.py    |  0\n utils/tuning/libtuning/parsers/parser.py      | 21 ++++++++++++\n 6 files changed, 69 insertions(+)\n create mode 100644 utils/tuning/libtuning/generators/__init__.py\n create mode 100644 utils/tuning/libtuning/generators/generator.py\n create mode 100644 utils/tuning/libtuning/modules/__init__.py\n create mode 100644 utils/tuning/libtuning/modules/module.py\n create mode 100644 utils/tuning/libtuning/parsers/__init__.py\n create mode 100644 utils/tuning/libtuning/parsers/parser.py","diff":"diff --git a/utils/tuning/libtuning/generators/__init__.py b/utils/tuning/libtuning/generators/__init__.py\nnew file mode 100644\nindex 00000000..e69de29b\ndiff --git a/utils/tuning/libtuning/generators/generator.py b/utils/tuning/libtuning/generators/generator.py\nnew file mode 100644\nindex 00000000..7c8c9b99\n--- /dev/null\n+++ b/utils/tuning/libtuning/generators/generator.py\n@@ -0,0 +1,15 @@\n+# SPDX-License-Identifier: GPL-2.0-or-later\n+#\n+# Copyright (C) 2022, Paul Elder <paul.elder@ideasonboard.com>\n+#\n+# generator.py - Base class for a generator to convert dict to tuning file\n+\n+from pathlib import Path\n+\n+\n+class Generator(object):\n+    def __init__(self):\n+        pass\n+\n+    def write(self, output_path: Path, output_dict: dict, output_order: list):\n+        raise NotImplementedError\ndiff --git a/utils/tuning/libtuning/modules/__init__.py b/utils/tuning/libtuning/modules/__init__.py\nnew file mode 100644\nindex 00000000..e69de29b\ndiff --git a/utils/tuning/libtuning/modules/module.py b/utils/tuning/libtuning/modules/module.py\nnew file mode 100644\nindex 00000000..cb213154\n--- /dev/null\n+++ b/utils/tuning/libtuning/modules/module.py\n@@ -0,0 +1,33 @@\n+# SPDX-License-Identifier: GPL-2.0-or-later\n+#\n+# Copyright (C) 2022, Paul Elder <paul.elder@ideasonboard.com>\n+#\n+# module.py - Base class for algorithm-specific tuning modules\n+\n+\n+# @var type Type of the module. Defined in the base module.\n+# @var out_name The key that will be used for the algorithm in the algorithms\n+#               dictionary in the tuning output file\n+# @var hr_name Human-readable module name, mostly for debugging\n+class Module(object):\n+    type = 'base'\n+    hr_name = 'Base Module'\n+    out_name = 'GenericAlgorithm'\n+\n+    def __init__(self):\n+        pass\n+\n+    def validate_config(self, config: dict) -> bool:\n+        raise NotImplementedError\n+\n+    # @brief Do the module's processing\n+    # @param args argparse arguments\n+    # @param config Full configuration from the input configuration file\n+    # @param images List of images to process\n+    # @param outputs The outputs of all modules that were executed before this\n+    #                module. Note that this is an input parameter, and the\n+    #                output of this module should be returned directly\n+    # @return Result of the module's processing. It may be empty. None\n+    #         indicates failure and that the result should not be used.\n+    def process(self, args, config: dict, images: list, outputs: dict) -> dict:\n+        raise NotImplementedError\ndiff --git a/utils/tuning/libtuning/parsers/__init__.py b/utils/tuning/libtuning/parsers/__init__.py\nnew file mode 100644\nindex 00000000..e69de29b\ndiff --git a/utils/tuning/libtuning/parsers/parser.py b/utils/tuning/libtuning/parsers/parser.py\nnew file mode 100644\nindex 00000000..a17d8d71\n--- /dev/null\n+++ b/utils/tuning/libtuning/parsers/parser.py\n@@ -0,0 +1,21 @@\n+# SPDX-License-Identifier: GPL-2.0-or-later\n+#\n+# Copyright (C) 2022, Paul Elder <paul.elder@ideasonboard.com>\n+#\n+# parser.py - Base class for a parser for a specific format of config file\n+\n+class Parser(object):\n+    def __init__(self):\n+        pass\n+\n+    # @brief Parse a config file into a config dict\n+    # @details The config dict shall have one key 'general' with a dict value\n+    #          for general configuration options, and all other entries shall\n+    #          have the module as the key with its configuration options (as a\n+    #          dict) as the value. The config dict shall prune entries that are\n+    #          for modules that are not in @a modules.\n+    # @param config (str) Path to config file\n+    # @param modules (list) List of modules\n+    # @return (dict, list) Configuration and list of modules to disable\n+    def parse(self, config_file: str, modules: list) -> (dict, list):\n+        raise NotImplementedError\n","prefixes":["libcamera-devel","v3","03/12"]}