[libcamera-devel,1/6] utils: libtuning: module: Prepare per-module debugging infrastructure
diff mbox series

Message ID 20221124113849.2193579-2-paul.elder@ideasonboard.com
State New
Headers show
Series
  • utils: tuning: Add per-module debugging
Related show

Commit Message

Paul Elder Nov. 24, 2022, 11:38 a.m. UTC
Prepare for per-module debugging infrastructure in the base Module
class. The debug parameter will be provided from a command line argument
as opposed to from the tuning script as was originally planned.

Remove the debug parameter from the LSC constructor (it is the only
module that we have so far). As the debug parameter currently does not
do anything, no regression is introduced.

Update the tuning scripts accordingly.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
 utils/tuning/libtuning/modules/lsc/lsc.py | 3 ---
 utils/tuning/libtuning/modules/module.py  | 6 ++++++
 utils/tuning/raspberrypi/alsc.py          | 1 -
 utils/tuning/rkisp1.py                    | 1 -
 4 files changed, 6 insertions(+), 5 deletions(-)

Patch
diff mbox series

diff --git a/utils/tuning/libtuning/modules/lsc/lsc.py b/utils/tuning/libtuning/modules/lsc/lsc.py
index 344a07a3..f54ca8be 100644
--- a/utils/tuning/libtuning/modules/lsc/lsc.py
+++ b/utils/tuning/libtuning/modules/lsc/lsc.py
@@ -17,7 +17,6 @@  class LSC(Module):
     out_name = 'GenericLSC'
 
     def __init__(self, *,
-                 debug: list,
                  sector_shape: tuple,
                  sector_x_gradient: lt.Gradient,
                  sector_y_gradient: lt.Gradient,
@@ -25,8 +24,6 @@  class LSC(Module):
                  smoothing_function: lt.Smoothing):
         super().__init__()
 
-        self.debug = debug
-
         self.sector_shape = sector_shape
         self.sector_x_gradient = sector_x_gradient
         self.sector_y_gradient = sector_y_gradient
diff --git a/utils/tuning/libtuning/modules/module.py b/utils/tuning/libtuning/modules/module.py
index 12e2fc7c..b4ad0625 100644
--- a/utils/tuning/libtuning/modules/module.py
+++ b/utils/tuning/libtuning/modules/module.py
@@ -4,6 +4,8 @@ 
 #
 # module.py - Base class for algorithm-specific tuning modules
 
+from pathlib import Path
+
 
 # @var type Type of the module. Defined in the base module.
 # @var out_name The key that will be used for the algorithm in the algorithms
@@ -15,8 +17,12 @@  class Module(object):
     out_name = 'GenericAlgorithm'
 
     def __init__(self):
+        self.debug = None
         pass
 
+    def enable_debug(self, output_dir: Path):
+        self.debug = output_dir
+
     def validate_config(self, config: dict) -> bool:
         raise NotImplementedError
 
diff --git a/utils/tuning/raspberrypi/alsc.py b/utils/tuning/raspberrypi/alsc.py
index 024eb5a3..4dc5f5ba 100644
--- a/utils/tuning/raspberrypi/alsc.py
+++ b/utils/tuning/raspberrypi/alsc.py
@@ -10,7 +10,6 @@  from libtuning.modules.lsc import ALSCRaspberryPi
 ALSC = \
     ALSCRaspberryPi(do_color=lt.Param('do_alsc_colour', lt.Param.Mode.Optional, True),
                     luminance_strength=lt.Param('luminance_strength', lt.Param.Mode.Optional, 0.5),
-                    debug=[lt.Debug.Plot],
                     sector_shape=(16, 12),
                     sector_x_gradient=lt.gradient.Linear(lt.Remainder.DistributeFront),
                     sector_y_gradient=lt.gradient.Linear(lt.Remainder.DistributeFront),
diff --git a/utils/tuning/rkisp1.py b/utils/tuning/rkisp1.py
index 1cea6ddb..43b4b190 100755
--- a/utils/tuning/rkisp1.py
+++ b/utils/tuning/rkisp1.py
@@ -14,7 +14,6 @@  from libtuning.modules.lsc import LSCRkISP1
 
 tuner = lt.Tuner('RkISP1')
 tuner.add(LSCRkISP1(
-          debug=[lt.Debug.Plot],
           # This is for the actual LSC tuning, and is part of the base LSC
           # module. rkisp1's table sector sizes (16x16 programmed as mirrored
           # 8x8) are separate, and is hardcoded in its specific LSC tuning