pe='application/atom+xml'/>
summaryrefslogtreecommitdiff
path: root/utils/tuning/rkisp1.py
blob: 5d7a69fc4a1365a575143969047820efc1b0dd55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Copyright (C) 2022, Paul Elder <paul.elder@ideasonboard.com>
#
# Tuning script for rkisp1

import coloredlogs
import logging
import sys

import libtuning as lt
from libtuning.parsers import YamlParser
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')

agc = AGCRkISP1(debug=[lt.Debug.Plot])
awb = StaticModule('Awb')
blc = StaticModule('BlackLevelCorrection')
ccm = CCMRkISP1(debug=[lt.Debug.Plot])
color_processing = StaticModule('ColorProcessing')
filter = StaticModule('Filter')
gamma_out = StaticModule('GammaOutCorrection', {'gamma': 2.2})
lsc = 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(),