[libcamera-devel] [PATCH 5/7] utils: tuning: Add alsc-only libtuning raspberrypi tuning script

Paul Elder paul.elder at ideasonboard.com
Thu Oct 6 14:01:03 CEST 2022


Add a tuning script for raspberrypi for alsc only, that uses libtuning.
Since there will also be a tuning script for raspberrypi that has more
modules, put the libtuning alsc module definition in a separate file so
that it can be reused later.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
---
 utils/tuning/raspberrypi/__init__.py  |  0
 utils/tuning/raspberrypi/alsc.py      | 18 ++++++++++++++++++
 utils/tuning/raspberrypi_alsc_only.py | 18 ++++++++++++++++++
 3 files changed, 36 insertions(+)
 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

diff --git a/utils/tuning/raspberrypi/__init__.py b/utils/tuning/raspberrypi/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/utils/tuning/raspberrypi/alsc.py b/utils/tuning/raspberrypi/alsc.py
new file mode 100644
index 00000000..dd92cb8b
--- /dev/null
+++ b/utils/tuning/raspberrypi/alsc.py
@@ -0,0 +1,18 @@
+import libtuning as lt
+from libtuning.modules import ALSC
+
+RaspberryPiALSC = \
+    ALSC(do_color=lt.param('do_alsc_colour', lt.param.mode.Optional, True),
+         debug=[lt.debug.Plot],
+         luminance_strength=lt.param('luminance_strength', lt.param.mode.Optional, 0.5),
+         sector_shape=(16, 12),
+         sector_x_gradient=lt.gradient.Linear,
+         sector_y_gradient=lt.gradient.Linear,
+         sector_x_remainder=lt.remainder.DistributeFront,
+         sector_y_remainder=lt.remainder.DistributeFront,
+         sector_average_function=lt.average_functions.Mean,
+         smoothing_function=lt.smoothing.MedianBlur,
+         output_type=float,
+         output_color_channels=[lt.color.R, lt.color.G, lt.color.B],
+         output_range=(0, 3.999)
+         )
diff --git a/utils/tuning/raspberrypi_alsc_only.py b/utils/tuning/raspberrypi_alsc_only.py
new file mode 100755
index 00000000..e1e7b6e3
--- /dev/null
+++ b/utils/tuning/raspberrypi_alsc_only.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+
+import sys
+
+import libtuning as lt
+from libtuning.modules import ALSC
+from libtuning.parsers import RaspberryPiParser
+from libtuning.generators import RaspberryPiOutput
+
+from raspberrypi.alsc import ALSC as RaspberryPiALSC
+
+tuner = lt.Camera('Raspberry Pi (ALSC only)')
+tuner.add(RaspberryPiALSC)
+tuner.setInputType(RaspberryPiParser)
+tuner.setOutputType(RaspberryPiOutput)
+tuner.setOutputOrder([ALSC])
+
+tuner.run(sys.argv)
-- 
2.30.2



More information about the libcamera-devel mailing list