From patchwork Fri Jul 5 14:41:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 20599 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 4BCF2BD87C for ; Fri, 5 Jul 2024 14:42:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0340C63367; Fri, 5 Jul 2024 16:42:42 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="dmE05vrN"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DE84B619C7 for ; Fri, 5 Jul 2024 16:42:38 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:60b6:33a3:3a20:6030]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5899E4CC; Fri, 5 Jul 2024 16:42:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1720190529; bh=QLzmsrZJD4p2yyDrdaopL/53SEkuwl5v9CLDaSjQzWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dmE05vrNaaSTHSSTqDIPwd9F6Xdtlncx7rh1NBRDdB4lYPf6nApvUJ0DTiPFms6fF dphko4G6uK8go+UQA62YsIEMz7HDmEHlsv0jRpaDEC6Jfcaeb+Xa6PxCfoSUPtRRTa 5nh+6ozasAkReWW+csMOdoQkR1/niOqABL3g5dhA= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Paul Elder , Laurent Pinchart Subject: [PATCH v4 10/23] libtuning: Implement a minimal yaml parser Date: Fri, 5 Jul 2024 16:41:46 +0200 Message-ID: <20240705144209.418906-11-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240705144209.418906-1-stefan.klug@ideasonboard.com> References: <20240705144209.418906-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..1fa6b7a86ddd 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, []