From patchwork Fri Jul 3 12:25:22 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 27175 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 4FD6BC328C for ; Fri, 3 Jul 2026 12:26:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 02EA365FF0; Fri, 3 Jul 2026 14:26:59 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="jE8GAeBf"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 195FB65FC2 for ; Fri, 3 Jul 2026 14:26:57 +0200 (CEST) Received: from neptunite.hamster-moth.ts.net (unknown [IPv6:2404:7a81:160:2100:a2cc:2f45:3bd7:2589]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 371051121; Fri, 3 Jul 2026 14:26:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1783081571; bh=Zlm0egukM4G+0+A8YxhawoYkXbpnOYicQACr04edykw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jE8GAeBfH3V8TkuJpyOZ3WCe/+PqxpnmZIilyUUNdqxM0U3uG9OPFU245EDSZKARS OrFVtmm0REkbdmW3KSsI7Jq23Uu5f0xiPKW0nMqU1+FZLSMdeTefMfpDb/kUW5Yu4g XiWrVe2FAxgBDr6ISn2ONLgYpsogccIBAxwuvDyg= From: Paul Elder To: laurent.pinchart@ideasonboard.com Cc: Paul Elder , michael.riesch@collabora.com, xuhf@rock-chips.com, stefan.klug@ideasonboard.com, kieran.bingham@ideasonboard.com, dan.scally@ideasonboard.com, jacopo.mondi@ideasonboard.com, nicolas.dufresne@collabora.com, libcamera-devel@lists.libcamera.org Subject: [RFC PATCH 16/19] utils: tuning: rkisp2.py: Add tuning script for rkisp2 Date: Fri, 3 Jul 2026 21:25:22 +0900 Message-ID: <20260703122543.1991189-17-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20260703122543.1991189-1-paul.elder@ideasonboard.com> References: <20260703122543.1991189-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a tuning script for the rkisp2. It is based on the rkisp1 tuning script. Signed-off-by: Paul Elder --- lsc is not output currently as it needs a bit more investigation. --- utils/tuning/rkisp2.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 utils/tuning/rkisp2.py diff --git a/utils/tuning/rkisp2.py b/utils/tuning/rkisp2.py new file mode 100755 index 000000000000..13feff03e6cc --- /dev/null +++ b/utils/tuning/rkisp2.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2026, Paul Elder +# Copyright (C) 2026, Ideas On Board +# +# Tuning script for rkisp2, based on rkisp1 + +import logging +import sys + +import coloredlogs +import libtuning as lt +from libtuning.generators import YamlOutput +from libtuning.modules.agc import AGCRkISP1 +from libtuning.modules.awb import AWBRkISP1 +from libtuning.modules.ccm import CCMRkISP1 +from libtuning.modules.lsc import LSCRkISP1 +from libtuning.modules.lux import LuxRkISP1 +from libtuning.modules.static import StaticModule +from libtuning.parsers import YamlParser + +coloredlogs.install(level=logging.INFO, fmt='%(name)s %(levelname)s %(message)s') + +csm = StaticModule('ColorSpaceConversion') +agc = AGCRkISP1(debug=[lt.Debug.Plot]) +awb = AWBRkISP1(debug=[lt.Debug.Plot]) +bls = StaticModule('BlackLevelSubtraction') +ccm = CCMRkISP1(debug=[lt.Debug.Plot]) +goc = StaticModule('GammaOutCorrection', {'gamma': 2.2}) + +tuner = lt.Tuner('RkISP2') +tuner.add([csm, agc, awb, bls, ccm, goc]) +tuner.set_input_parser(YamlParser()) +tuner.set_output_formatter(YamlOutput()) + +# Bayesian AWB uses the lux value, so insert the lux algorithm before AWB. +# Compress is parameterized by others, so add it at the end. +tuner.set_output_order([csm, agc, awb, bls, ccm, goc]) + +if __name__ == '__main__': + sys.exit(tuner.run(sys.argv))