diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2022-10-06 20:26:35 +0900 |
---|---|---|
committer | Paul Elder <paul.elder@ideasonboard.com> | 2022-11-25 15:38:17 +0900 |
commit | c7bbe0ca3a015f9b4d59724d8489ff90b6be2e81 (patch) | |
tree | b21f03aef58690c1a5dc6d69ab6e60644bc05299 | |
parent | 4af9f81802a9b58b028222385520e8c26a991d62 (diff) |
utils: tuning: Add tuning script for rkisp1
Add a tuning script for rkisp1 that uses libtuning. So far it only
supports LSC.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rwxr-xr-x | utils/tuning/rkisp1.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/utils/tuning/rkisp1.py b/utils/tuning/rkisp1.py new file mode 100755 index 00000000..1cea6ddb --- /dev/null +++ b/utils/tuning/rkisp1.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2022, Paul Elder <paul.elder@ideasonboard.com> +# +# rkisp1.py - Tuning script for rkisp1 + +import sys + +import libtuning as lt +from libtuning.parsers import YamlParser +from libtuning.generators import YamlOutput +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 + # module. + sector_shape=(17, 17), + + sector_x_gradient=lt.gradient.Linear(lt.Remainder.DistributeFront), + sector_y_gradient=lt.gradient.Linear(lt.Remainder.DistributeFront), + + # This is the function that will be used to average the pixels in + # each sector. This can also be a custom function. + sector_average_function=lt.average.Mean(), + + # This is the function that will be used to smooth the color ratio + # values. This can also be a custom function. + smoothing_function=lt.smoothing.MedianBlur(3), + )) +tuner.set_input_parser(YamlParser()) +tuner.set_output_formatter(YamlOutput()) +tuner.set_output_order([LSCRkISP1]) + +if __name__ == '__main__': + sys.exit(tuner.run(sys.argv)) |