[v2,20/25] tuning: rkisp1: Add some static modules
diff mbox series

Message ID 20240628104828.2928109-21-stefan.klug@ideasonboard.com
State Superseded
Headers show
Series
  • Add ccm calibration to libtuning
Related show

Commit Message

Stefan Klug June 28, 2024, 10:47 a.m. UTC
Add awb, gamma, cproc and filter by default to the tuning file. These
don't need any configuration.

While at it, sort the modules alphabetically.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
---
 utils/tuning/rkisp1.py | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

Comments

Laurent Pinchart June 29, 2024, 12:08 a.m. UTC | #1
Hi Stefan,

Thank you for the patch.

On Fri, Jun 28, 2024 at 12:47:13PM +0200, Stefan Klug wrote:
> Add awb, gamma, cproc and filter by default to the tuning file. These
> don't need any configuration.
> 
> While at it, sort the modules alphabetically.

Is alphabetical order right ? The CCM, for instance, should eventually
depend on LSC, and I would expect AWB to possibly depend on LSC too. Can
we already prepare for that ? Or should we add a mechanism in the future
for modules to declare dependencies ?

> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> ---
>  utils/tuning/rkisp1.py | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/utils/tuning/rkisp1.py b/utils/tuning/rkisp1.py
> index fae35783c656..c5036c65557b 100755
> --- a/utils/tuning/rkisp1.py
> +++ b/utils/tuning/rkisp1.py
> @@ -15,11 +15,22 @@ from libtuning.generators import YamlOutput
>  from libtuning.modules.lsc import LSCRkISP1
>  from libtuning.modules.agc import AGCRkISP1
>  from libtuning.modules.ccm import CCMRkISP1
> -
> +from libtuning.modules.static import StaticModule
>  
>  coloredlogs.install(level=logging.INFO, fmt='%(name)s %(levelname)s %(message)s')
>  
> +awb = StaticModule('Awb')
> +color_processing = StaticModule('ColorProcessing')
> +filter = StaticModule('Filter')
> +gamma_out = StaticModule('GammaOutCorrection', {'gamma': 2.2})
> +
>  tuner = lt.Tuner('RkISP1')
> +tuner.add(AGCRkISP1(debug=[lt.Debug.Plot]))
> +tuner.add(awb)
> +tuner.add(CCMRkISP1(debug=[lt.Debug.Plot]))
> +tuner.add(color_processing)
> +tuner.add(filter)
> +tuner.add(gamma_out)
>  tuner.add(LSCRkISP1(
>            debug=[lt.Debug.Plot],
>            # This is for the actual LSC tuning, and is part of the base LSC
> @@ -39,11 +50,10 @@ tuner.add(LSCRkISP1(
>            # values.  This can also be a custom function.
>            smoothing_function=lt.smoothing.MedianBlur(3),
>            ))
> -tuner.add(AGCRkISP1(debug=[lt.Debug.Plot]))
> -tuner.add(CCMRkISP1(debug=[lt.Debug.Plot]))
> +
>  tuner.set_input_parser(YamlParser())
>  tuner.set_output_formatter(YamlOutput())
> -tuner.set_output_order([AGCRkISP1, CCMRkISP1, LSCRkISP1])
> +tuner.set_output_order([AGCRkISP1, awb, CCMRkISP1, color_processing, filter, gamma_out, LSCRkISP1])
>  
>  if __name__ == '__main__':
>      sys.exit(tuner.run(sys.argv))
Stefan Klug July 2, 2024, 10:08 a.m. UTC | #2
Hi Laurent,

On Sat, Jun 29, 2024 at 03:08:12AM +0300, Laurent Pinchart wrote:
> Hi Stefan,
> 
> Thank you for the patch.
> 
> On Fri, Jun 28, 2024 at 12:47:13PM +0200, Stefan Klug wrote:
> > Add awb, gamma, cproc and filter by default to the tuning file. These
> > don't need any configuration.
> > 
> > While at it, sort the modules alphabetically.
> 
> Is alphabetical order right ? The CCM, for instance, should eventually
> depend on LSC, and I would expect AWB to possibly depend on LSC too. Can
> we already prepare for that ? Or should we add a mechanism in the future
> for modules to declare dependencies ?

I'd like to keep it sorted for now. We don't have dependencies at the
moment. As soon as we add the first dependency (ccm -> lsc) the issue
will pop up and needs to be solved (and I'd like to introduce some kind
of dependency mechanism instead of a knowing the order beforehand)

Best regards,
Stefan

> 
> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> > ---
> >  utils/tuning/rkisp1.py | 18 ++++++++++++++----
> >  1 file changed, 14 insertions(+), 4 deletions(-)
> > 
> > diff --git a/utils/tuning/rkisp1.py b/utils/tuning/rkisp1.py
> > index fae35783c656..c5036c65557b 100755
> > --- a/utils/tuning/rkisp1.py
> > +++ b/utils/tuning/rkisp1.py
> > @@ -15,11 +15,22 @@ from libtuning.generators import YamlOutput
> >  from libtuning.modules.lsc import LSCRkISP1
> >  from libtuning.modules.agc import AGCRkISP1
> >  from libtuning.modules.ccm import CCMRkISP1
> > -
> > +from libtuning.modules.static import StaticModule
> >  
> >  coloredlogs.install(level=logging.INFO, fmt='%(name)s %(levelname)s %(message)s')
> >  
> > +awb = StaticModule('Awb')
> > +color_processing = StaticModule('ColorProcessing')
> > +filter = StaticModule('Filter')
> > +gamma_out = StaticModule('GammaOutCorrection', {'gamma': 2.2})
> > +
> >  tuner = lt.Tuner('RkISP1')
> > +tuner.add(AGCRkISP1(debug=[lt.Debug.Plot]))
> > +tuner.add(awb)
> > +tuner.add(CCMRkISP1(debug=[lt.Debug.Plot]))
> > +tuner.add(color_processing)
> > +tuner.add(filter)
> > +tuner.add(gamma_out)
> >  tuner.add(LSCRkISP1(
> >            debug=[lt.Debug.Plot],
> >            # This is for the actual LSC tuning, and is part of the base LSC
> > @@ -39,11 +50,10 @@ tuner.add(LSCRkISP1(
> >            # values.  This can also be a custom function.
> >            smoothing_function=lt.smoothing.MedianBlur(3),
> >            ))
> > -tuner.add(AGCRkISP1(debug=[lt.Debug.Plot]))
> > -tuner.add(CCMRkISP1(debug=[lt.Debug.Plot]))
> > +
> >  tuner.set_input_parser(YamlParser())
> >  tuner.set_output_formatter(YamlOutput())
> > -tuner.set_output_order([AGCRkISP1, CCMRkISP1, LSCRkISP1])
> > +tuner.set_output_order([AGCRkISP1, awb, CCMRkISP1, color_processing, filter, gamma_out, LSCRkISP1])
> >  
> >  if __name__ == '__main__':
> >      sys.exit(tuner.run(sys.argv))
> 
> -- 
> Regards,
> 
> Laurent Pinchart

Patch
diff mbox series

diff --git a/utils/tuning/rkisp1.py b/utils/tuning/rkisp1.py
index fae35783c656..c5036c65557b 100755
--- a/utils/tuning/rkisp1.py
+++ b/utils/tuning/rkisp1.py
@@ -15,11 +15,22 @@  from libtuning.generators import YamlOutput
 from libtuning.modules.lsc import LSCRkISP1
 from libtuning.modules.agc import AGCRkISP1
 from libtuning.modules.ccm import CCMRkISP1
-
+from libtuning.modules.static import StaticModule
 
 coloredlogs.install(level=logging.INFO, fmt='%(name)s %(levelname)s %(message)s')
 
+awb = StaticModule('Awb')
+color_processing = StaticModule('ColorProcessing')
+filter = StaticModule('Filter')
+gamma_out = StaticModule('GammaOutCorrection', {'gamma': 2.2})
+
 tuner = lt.Tuner('RkISP1')
+tuner.add(AGCRkISP1(debug=[lt.Debug.Plot]))
+tuner.add(awb)
+tuner.add(CCMRkISP1(debug=[lt.Debug.Plot]))
+tuner.add(color_processing)
+tuner.add(filter)
+tuner.add(gamma_out)
 tuner.add(LSCRkISP1(
           debug=[lt.Debug.Plot],
           # This is for the actual LSC tuning, and is part of the base LSC
@@ -39,11 +50,10 @@  tuner.add(LSCRkISP1(
           # values.  This can also be a custom function.
           smoothing_function=lt.smoothing.MedianBlur(3),
           ))
-tuner.add(AGCRkISP1(debug=[lt.Debug.Plot]))
-tuner.add(CCMRkISP1(debug=[lt.Debug.Plot]))
+
 tuner.set_input_parser(YamlParser())
 tuner.set_output_formatter(YamlOutput())
-tuner.set_output_order([AGCRkISP1, CCMRkISP1, LSCRkISP1])
+tuner.set_output_order([AGCRkISP1, awb, CCMRkISP1, color_processing, filter, gamma_out, LSCRkISP1])
 
 if __name__ == '__main__':
     sys.exit(tuner.run(sys.argv))