From patchwork Fri Jun 28 10:47:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 20469 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id CEA5EBD87C for ; Fri, 28 Jun 2024 10:49:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 71685632EA; Fri, 28 Jun 2024 12:49:09 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="lr64xNY3"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9F84A62E20 for ; Fri, 28 Jun 2024 12:49:08 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:82ab:924:d918:cd24]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 25AD9735; Fri, 28 Jun 2024 12:48:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1719571724; bh=vNn5ipoI4v+4xnP8B+znr/LtvQt4FWstcWhx7tT/IN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lr64xNY39ZzO2OeBqDvqMsFxblbfeJUUyDEwJux0FAAFJ1izL7xx9TAZO6E11X663 0uIVI+kGeiqUR0TYMUYLKAA3evbLGVg8Of+FinNewHD85LvDYarjVh/tlLKI6bReUH gS+60CRczWbtNtn+EyFhldRp6dNhVjbbdNhmI+m8= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Paul Elder Subject: [PATCH v2 10/25] libtuning: Implement a minimal yaml parser Date: Fri, 28 Jun 2024 12:47:03 +0200 Message-ID: <20240628104828.2928109-11-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240628104828.2928109-1-stefan.klug@ideasonboard.com> References: <20240628104828.2928109-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" At the moment this just reads the yaml file and returns it verbatim. This needs to evolve further in the near future. Signed-off-by: Stefan Klug Reviewed-by: Paul Elder Reviewed-by: Laurent Pinchart --- utils/tuning/config-example.yaml | 12 ++++++++++++ utils/tuning/libtuning/parsers/yaml_parser.py | 9 ++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 utils/tuning/config-example.yaml diff --git a/utils/tuning/config-example.yaml b/utils/tuning/config-example.yaml new file mode 100644 index 000000000000..1b7f52cd2fff --- /dev/null +++ b/utils/tuning/config-example.yaml @@ -0,0 +1,12 @@ +general: + disable: [] + plot: [] + alsc: + do_alsc_colour: 1 + luminance_strength: 0.5 + awb: + greyworld: 0 + macbeth: + small: 1 + show: 0 +# blacklevel: 32 \ No newline at end of file diff --git a/utils/tuning/libtuning/parsers/yaml_parser.py b/utils/tuning/libtuning/parsers/yaml_parser.py index 244db24daeb1..71c30180d29f 100644 --- a/utils/tuning/libtuning/parsers/yaml_parser.py +++ b/utils/tuning/libtuning/parsers/yaml_parser.py @@ -5,13 +5,16 @@ # Parser for YAML format config file from .parser import Parser +import yaml class YamlParser(Parser): def __init__(self): super().__init__() - # \todo Implement this (it's fine for now as we don't need a config for - # rkisp1 LSC, which is the only user of this so far) def parse(self, config_file: str, modules: list) -> (dict, list): - return {}, [] + # dummy implementation that just reads the file + with open(config_file, 'r') as f: + config = yaml.safe_load(f) + + return config, []