From 721b97692834fe5c2a551e38bd3c7c9772a962ea Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Thu, 30 May 2024 04:42:50 +0900 Subject: libtuning: modules: Add initial CCM module Implement a minimal ccm calibration module. For now it doesn't take the results from lsc into account and supports rkisp1 only. Signed-off-by: Paul Elder Signed-off-by: Stefan Klug Reviewed-by: Laurent Pinchart Reviewed-by: Daniel Scally --- utils/tuning/libtuning/modules/ccm/ccm.py | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 utils/tuning/libtuning/modules/ccm/ccm.py (limited to 'utils/tuning/libtuning/modules/ccm/ccm.py') diff --git a/utils/tuning/libtuning/modules/ccm/ccm.py b/utils/tuning/libtuning/modules/ccm/ccm.py new file mode 100644 index 00000000..18702f8d --- /dev/null +++ b/utils/tuning/libtuning/modules/ccm/ccm.py @@ -0,0 +1,41 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2024, Paul Elder +# Copyright (C) 2024, Ideas on Board +# +# Base Ccm tuning module + +from ..module import Module + +from libtuning.ctt_ccm import ccm +import logging + +logger = logging.getLogger(__name__) + + +class CCM(Module): + type = 'ccm' + hr_name = 'CCM (Base)' + out_name = 'GenericCCM' + + def __init__(self, debug: list): + super().__init__() + + self.debug = debug + + def do_calibration(self, images): + logger.info('Starting CCM calibration') + + imgs = [img for img in images if img.macbeth is not None] + + # todo: Take LSC calibration results into account. + cal_cr_list = None + cal_cb_list = None + + try: + ccms = ccm(imgs, cal_cr_list, cal_cb_list) + except ArithmeticError: + logger.error('CCM calibration failed') + return None + + return ccms -- cgit v1.2.1