[libcamera-devel] [PATCH v3 00/12] utils: tuning: Add a new tuning infrastructure

Paul Elder paul.elder at ideasonboard.com
Thu Nov 10 18:31:42 CET 2022


This patch series adds a new tuning infrastructure called libtuning,
inspired by ctt.

Main non-cosmetic changes in v3:
- remove full raspberry pi tuning script
- split core libtuning implementation into three patches

The design modularizes common components of tuning tools such that
new tuning scripts for new platforms can be created easily, as show in
patches 11/12 to 12/12 (v3: the full Raspberry Pi tuning script was
removed because it is DNI and clearly incomplete).

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 patches 1/12 to 3/12 (split from one to three patches
as of v3).

The input configuration file and output tuning file could have different
formats as well, hence why these have their own classes. As of v1, only
the raspberrypi's formats were implemented, in patches 7/12 and 8/12
respectively. As of v2, output for yaml was added in patch 10/12. A
skeleton for yaml input is added as well in patch 9/12, though it is not
implemented yet as there is no specification for the yaml input
configuration format, and the only existing user of it doesn't actually
need a configuration file.

As of v2, it became apparent that it was infeasible to create an ALSC
module (that's what we're starting with) that could completely support
different platforms with configuration options alone. So, the ALSC
module was split into a base one (patch 4/12), with variations for
raspberrypi and rkisp1 implemented on top of it in patches 5/12 and 6/12
respectively. I think they came out quite nice, and they are still more
manageable than an entirely new tuning module per platform.

v2:
I have also since managed to get test images and so this entire thing
runs! Even though the rkisp1 tuning script (patch 12/12) says "WIP", it
does run and outputs a valid tuning file. I haven't tried using the
tuning file with libcamera though, as it is missng the /other/ algorithm
tuning results.

The output from the libtuning-based alsc-only raspberrypi tuning script
(patch 11/12) has been confirmed to be character-for-character exactly
the same as the output from ctt's alsc-only tuning script.

(P.S. I'll be uncontactable by IRC for a while because of DNS.)

Paul Elder (12):
  utils: tuning: libtuning: Implement the core of libtuning
  utils: tuning: libtuning: Implement math helpers
  utils: tuning: libtuning: Implement extensible components of libtuning
  utils: libtuning: modules: Add base LSC module
  utils: libtuning: modules: alsc: Add raspberrypi ALSC module
  utils: libtuning: modules: alsc: Add rkisp1 LSC module
  utils: libtuning: parsers: Add raspberrypi parser
  utils: libtuning: generators: Add raspberrypi output
  utils: libtuning: parsers: Add yaml parser
  utils: libtuning: generators: Add yaml output
  utils: tuning: Add alsc-only libtuning raspberrypi tuning script
  utils: tuning: Add tuning script for rkisp1

 utils/tuning/README.rst                       |  11 +
 utils/tuning/libtuning/__init__.py            |  13 +
 utils/tuning/libtuning/average.py             |  21 +
 utils/tuning/libtuning/generators/__init__.py |   6 +
 .../tuning/libtuning/generators/generator.py  |  15 +
 .../generators/raspberrypi_output.py          | 114 ++++
 .../libtuning/generators/yaml_output.py       | 123 +++++
 utils/tuning/libtuning/gradient.py            |  75 +++
 utils/tuning/libtuning/image.py               | 133 +++++
 utils/tuning/libtuning/libtuning.py           | 203 +++++++
 utils/tuning/libtuning/macbeth.py             | 516 ++++++++++++++++++
 utils/tuning/libtuning/macbeth_ref.pgm        |   6 +
 utils/tuning/libtuning/modules/__init__.py    |   0
 .../tuning/libtuning/modules/lsc/__init__.py  |   7 +
 utils/tuning/libtuning/modules/lsc/lsc.py     |  72 +++
 .../libtuning/modules/lsc/raspberrypi.py      | 250 +++++++++
 utils/tuning/libtuning/modules/lsc/rkisp1.py  | 114 ++++
 utils/tuning/libtuning/modules/module.py      |  33 ++
 utils/tuning/libtuning/parsers/__init__.py    |   6 +
 utils/tuning/libtuning/parsers/parser.py      |  21 +
 .../libtuning/parsers/raspberrypi_parser.py   |  93 ++++
 utils/tuning/libtuning/parsers/yaml_parser.py |  17 +
 utils/tuning/libtuning/smoothing.py           |  24 +
 utils/tuning/libtuning/utils.py               | 152 ++++++
 utils/tuning/raspberrypi/__init__.py          |   0
 utils/tuning/raspberrypi/alsc.py              |  19 +
 utils/tuning/raspberrypi_alsc_only.py         |  23 +
 utils/tuning/rkisp1.py                        |  43 ++
 28 files changed, 2110 insertions(+)
 create mode 100644 utils/tuning/README.rst
 create mode 100644 utils/tuning/libtuning/__init__.py
 create mode 100644 utils/tuning/libtuning/average.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/generators/yaml_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/lsc/__init__.py
 create mode 100644 utils/tuning/libtuning/modules/lsc/lsc.py
 create mode 100644 utils/tuning/libtuning/modules/lsc/raspberrypi.py
 create mode 100644 utils/tuning/libtuning/modules/lsc/rkisp1.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/parsers/yaml_parser.py
 create mode 100644 utils/tuning/libtuning/smoothing.py
 create mode 100644 utils/tuning/libtuning/utils.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 100755 utils/tuning/rkisp1.py

-- 
2.35.1



More information about the libcamera-devel mailing list