From patchwork Thu Nov 24 11:35:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 17878 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 F29F0BDE6B for ; Thu, 24 Nov 2022 11:36:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AD4ED63322; Thu, 24 Nov 2022 12:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1669289785; bh=sX8mqhqZGt5ApFAlfUHXTapjnnHZN8j4u59BaOF0gqc=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=4fYApYPWhZYfXkUUStRWDsnECQUMVtzTCLKRVi6CWdG7VvqEE9JuUsnoScccwvC5g osot28hCWuyRQk43FVZ8DepXSfnyoxdNmJbCSedDd/6qE/FyR4WxCOK0d4GnA88QlR Xqy/XhWL5RkwHTftutUXMGJBtvTniMfDy1jKcEq/hw9pmi5J96HYQGHYHLsoRqNbGM Sdus54vMrtyxI9UOAzORKCNfJ5ZqVQpuyjcKl9fpuEA5/HCNPma5m7+1X1kEclx7bk Eqs6i+xj0vymTmnGe4PcIilE/ZNia6tyhuqowQWbq2aVyFS6mS8BoD8tvTTco+7rhQ Y7Ety1Ncy+jvg== 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 378BA63325 for ; Thu, 24 Nov 2022 12:36:24 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="WZVMuhtt"; dkim-atps=neutral Received: from pyrite.tail37cf.ts.net (h175-177-042-159.catv02.itscom.jp [175.177.42.159]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B1AF4496; Thu, 24 Nov 2022 12:36:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1669289784; bh=sX8mqhqZGt5ApFAlfUHXTapjnnHZN8j4u59BaOF0gqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WZVMuhttapETcOjeOOg1Z5CZY+UzjB9Pij6ad7WrPbSnQRmh28FHPN/ZXWxb/ANWP /UCsZAXFd4mRKPNgiKQJD7qg5khJpTQO3Qz6wbde8jE7nrunnK5HzQ9+d37Q7K29b8 GYVgdB59lJRBWSwUIoYU4vNsXFFld5n71ohcaSbo= To: libcamera-devel@lists.libcamera.org Date: Thu, 24 Nov 2022 20:35:50 +0900 Message-Id: <20221124113550.2182342-13-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221124113550.2182342-1-paul.elder@ideasonboard.com> References: <20221124113550.2182342-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 12/12] utils: tuning: Add tuning script for rkisp1 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: , X-Patchwork-Original-From: Paul Elder via libcamera-devel From: Paul Elder Reply-To: Paul Elder Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a tuning script for rkisp1 that uses libtuning. So far it only supports LSC. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- Changes in v4: - s/ALSC/LSC/ - Remove the debug parameter from the tuning script, as it will be moved to cli argument Changes in v3: - cosmetic changes / fix style - add __main__ guard - rename ALSC to LSC Changes in v2: - add SPDX and copyright - s/average_functions/average/ - update the script to work with the new rkisp1 alsc module v1: This won't run as we're missing the necessary parser and generator for yaml, parabolic gradient support, and multiple green support in the LSC module, hence the DNI. As soon as those are added though, this *should* work. --- utils/tuning/rkisp1.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 utils/tuning/rkisp1.py 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 +# +# 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))