From patchwork Thu Oct 6 12:00:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 17534 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 50AEDC0DA4 for ; Thu, 6 Oct 2022 12:01:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AD11362CEC; Thu, 6 Oct 2022 14:01:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1665057679; bh=mF3wfFIkveLHaiNvkvJNBXoycjVWEPfqQxPVVI+vQsM=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=1eJtid7owOdGVs8HSKEMbh3+TjVOdRQR8B2zRv3+hVZsRudtV0Df/wdnm2eYlCAg/ 23qSGx8qiuhOMe8huZLT/aiHxxQGVtINpsl8d+Ht8/GgqmqfXFuw89I/ZPoyj9fmUF ZVIxPzyhLRgwA/kaBxgR0ytb7zT1ZrmRxQIYafiAKmmuCzam8KdOpfdZJtNkc+gdlg ZkeSXAzbbiGE3Mai4YkEgEuEyJgSHVCtwztHAMaB727eNmuGzS4HFj4IEXzlGWQI2G Fu6UAftBDMR3SjMThgzdNplkal5xYAtpE5Yc5htwKobBn+O8UmMlcF/+RMpsB7VWVp YsfD9loPCY8Jg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F007560AA2 for ; Thu, 6 Oct 2022 14:01:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="fPrHumWG"; dkim-atps=neutral Received: from pyrite.rasen.tech (h175-177-042-159.catv02.itscom.jp [175.177.42.159]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4A34D4DD; Thu, 6 Oct 2022 14:01:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1665057677; bh=mF3wfFIkveLHaiNvkvJNBXoycjVWEPfqQxPVVI+vQsM=; h=From:To:Cc:Subject:Date:From; b=fPrHumWGZPgM82QR6DQ7tFbObPPcdlUTmsfCqP0KvE2e+XMfioUb7SB4JUM6dEvAW ThZSIJ3kEA1bJKzWy4pcrdaHNH8eKq6wApj2/54dsX2lh2t1Zoarrn91YLiqDRdMcL uBdhn5C8x2fNjuwxrB++Yd+IFoFS9zjda/dGcz6c= To: libcamera-devel@lists.libcamera.org Date: Thu, 6 Oct 2022 21:00:58 +0900 Message-Id: <20221006120105.3861831-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 0/7] utils: tuning: Add a new tuning infrastructure 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: , X-Patchwork-Original-From: Paul Elder via libcamera-devel From: Paul Elder Reply-To: Paul Elder Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This patch series adds a new tuning infrastructure called libtuning, inspired by ctt. The design modularizes common components of tuning tools such that new tuning scripts for new platforms can be created easily, as show in patches 5/7 to 7/7. The common "core" components include file management, argument parsing, image loading and validation, and macbeth chart detection, as well as miscellaneous (but tedious) math utilities. It connects everything together such that a platform's tuning script can very easily customize tuning modules in a variety of ways, even including the format of the input configuration file and the output tuning file. These are all implemented in patch 1/7, as they are all interconnected. The input configuration file and output tuning file could have different formats as well, hence why these have their own classes. For now, only the raspberrypi's formats are implemented, in patches 3/7 and 4/7 respectively. The main point of libtuning is that tuning modules can be used for different platforms while only changing the configuration of the tuning modules. A simple example is the lens shading table size. Patch 2/7 implements an ALSC tuning module based on ctt's ALSC, with all the values that were hardcoded for raspberrypi to take values that can be configured by platform-specific tuning scripts. (I haven't actually tested/ran this yet, as I'm missing calibration images) Paul Elder (7): utils: tuning: libtuning: Implement the core of libtuning utils: libtuning: modules: Add ALSC module utils: libtuning: parsers: Add raspberrypi parser utils: libtuning: generators: Add raspberrypi output utils: tuning: Add alsc-only libtuning raspberrypi tuning script [DNI] utils: tuning: Add full libtuning raspberrypi tuning script [DNI] utils: tuning: Add tuning script for rkisp1 utils/tuning/libtuning/__init__.py | 9 + utils/tuning/libtuning/average_functions.py | 21 + utils/tuning/libtuning/generators/__init__.py | 1 + .../tuning/libtuning/generators/generator.py | 12 + .../generators/raspberrypi_output.py | 115 +++ utils/tuning/libtuning/gradient.py | 111 +++ utils/tuning/libtuning/image.py | 272 ++++++++ utils/tuning/libtuning/libtuning.py | 191 +++++ utils/tuning/libtuning/macbeth.py | 654 ++++++++++++++++++ utils/tuning/libtuning/macbeth_ref.pgm | 5 + utils/tuning/libtuning/modules/__init__.py | 1 + utils/tuning/libtuning/modules/alsc.py | 321 +++++++++ utils/tuning/libtuning/modules/module.py | 41 ++ utils/tuning/libtuning/parsers/__init__.py | 1 + utils/tuning/libtuning/parsers/parser.py | 18 + .../libtuning/parsers/raspberrypi_parser.py | 82 +++ utils/tuning/libtuning/smoothing.py | 21 + utils/tuning/libtuning/utils.py | 198 ++++++ utils/tuning/raspberrypi.py | 39 ++ utils/tuning/raspberrypi/__init__.py | 0 utils/tuning/raspberrypi/alsc.py | 18 + utils/tuning/raspberrypi_alsc_only.py | 18 + utils/tuning/rkisp1.py | 69 ++ 23 files changed, 2218 insertions(+) create mode 100644 utils/tuning/libtuning/__init__.py create mode 100644 utils/tuning/libtuning/average_functions.py create mode 100644 utils/tuning/libtuning/generators/__init__.py create mode 100644 utils/tuning/libtuning/generators/generator.py create mode 100644 utils/tuning/libtuning/generators/raspberrypi_output.py create mode 100644 utils/tuning/libtuning/gradient.py create mode 100644 utils/tuning/libtuning/image.py create mode 100644 utils/tuning/libtuning/libtuning.py create mode 100644 utils/tuning/libtuning/macbeth.py create mode 100644 utils/tuning/libtuning/macbeth_ref.pgm create mode 100644 utils/tuning/libtuning/modules/__init__.py create mode 100644 utils/tuning/libtuning/modules/alsc.py create mode 100644 utils/tuning/libtuning/modules/module.py create mode 100644 utils/tuning/libtuning/parsers/__init__.py create mode 100644 utils/tuning/libtuning/parsers/parser.py create mode 100644 utils/tuning/libtuning/parsers/raspberrypi_parser.py create mode 100644 utils/tuning/libtuning/smoothing.py create mode 100644 utils/tuning/libtuning/utils.py create mode 100644 utils/tuning/raspberrypi.py create mode 100644 utils/tuning/raspberrypi/__init__.py create mode 100644 utils/tuning/raspberrypi/alsc.py create mode 100755 utils/tuning/raspberrypi_alsc_only.py create mode 100644 utils/tuning/rkisp1.py