From patchwork Mon Aug 24 09:06:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 28028 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 D0784C3339 for ; Mon, 24 Aug 2026 09:07:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8A0FB683DC; Mon, 24 Aug 2026 11:07:56 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="uO754VqI"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4D1736838A for ; Mon, 24 Aug 2026 11:07:55 +0200 (CEST) Received: from neptunite.hamster-moth.ts.net (unknown [IPv6:2400:2411:160:2f00:e616:f172:fe90:f1b5]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id F3FDEC25; Mon, 24 Aug 2026 11:06:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1787562391; bh=F/Y/d2aaUo/KjEVQEBSfZBGUTXdyBMfYDvcP8qtFxsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uO754VqInlo7A6RpmkYdVOreUCRzHEe/vFz2isIQEk5RoqvgU+1ACrWvGXV2LNLKf 3wo30L+bvZXfrBgi0hb+fk0evIlR5eFE/1oLxCRxjsY2afIPqjV3X27MNBEe6udr0c xefpyqNBll28t3OOmG74YPo/DV5Aq7QMjEn8xejQ= 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, mehdi.djait@linux.intel.com, libcamera-devel@lists.libcamera.org Subject: [PATCH v2 17/20] utils: tuning: rkisp2.py: Add tuning script for rkisp2 Date: Mon, 24 Aug 2026 18:06:34 +0900 Message-ID: <20260824090641.3705246-18-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20260824090641.3705246-1-paul.elder@ideasonboard.com> References: <20260824090641.3705246-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. No change in v2 --- 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))