[libcamera-devel] [PATCH 6/7] [DNI] utils: tuning: Add full libtuning raspberrypi tuning script

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


Add a tuning script for raspberrypi that uses libtuning. This reproduces
what ctt does (albeit with less logging for now), but with common
components factored out into libtuning so that tuning scripts for other
platforms can reuse them.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>

---
This is incomplete, hence the DNI.
---
 utils/tuning/raspberrypi.py | 39 +++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 utils/tuning/raspberrypi.py

diff --git a/utils/tuning/raspberrypi.py b/utils/tuning/raspberrypi.py
new file mode 100644
index 00000000..b1592f0f
--- /dev/null
+++ b/utils/tuning/raspberrypi.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python3
+
+import sys
+
+import libtuning as lt
+from libtuning.modules import AWB
+from libtuning.parsers import RaspberryPiParser
+from libtuning.generators import RaspberryPiOutput
+
+from raspberrypi.alsc import ALSC as RaspberryPiALSC
+
+tuner = lt.Camera('Raspberry Pi')
+
+# These modules can also be custom modules. libtuning will come with utilities
+# for handling stuff like images, so there shouldn't be too much boilerplate
+# involved in creating custom modules, though I don't yet have a concrete
+# vision on how custom implementations of modules would look.
+tuner.add(RaspberryPiALSC)
+
+# Other tuning modules can be added like so.
+# The order that the tuning modules will be executed is determined by the order
+# that they're added.
+# This is kind of an implementation detail, but the "context" is saved
+# internally in lt.Camera, so modules that are added (and therefore executed)
+# later can use the output of the previous modules. I'm thinking that a module
+# that depends on values from another module has two modes of execution, for
+# when those values are available and another for when they're not. Not quite
+# sure concretely how to handle this yet.
+tuner.add(AWB(  # module parameters
+))
+
+tuner.setInputType(RaspberryPiParser)
+tuner.setOutputType(RaspberryPiOutput)
+
+# The order of the output doesn't necessarily have to be the same as the order
+# of input, which is specified by the order of adding the modules above.
+tuner.setOutputOrder([AWB, ALSC])
+
+tuner.run(sys.argv)
-- 
2.30.2



More information about the libcamera-devel mailing list