[libcamera-devel,5/7] utils: tuning: Add alsc-only libtuning raspberrypi tuning script
diff mbox series

Message ID 20221006120105.3861831-6-paul.elder@ideasonboard.com
State Superseded
Headers show
Series
  • utils: tuning: Add a new tuning infrastructure
Related show

Commit Message

Paul Elder Oct. 6, 2022, 12:01 p.m. UTC
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@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

Patch
diff mbox series

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)