[{"id":25856,"web_url":"https://patchwork.libcamera.org/comment/25856/","msgid":"<Y31q6+lai6aqyUQw@pendragon.ideasonboard.com>","date":"2022-11-23T00:35:55","subject":"Re: [libcamera-devel] [PATCH v3 12/12] utils: tuning: Add tuning\n\tscript for rkisp1","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the patch.\n\nOn Fri, Nov 11, 2022 at 02:31:54AM +0900, Paul Elder via libcamera-devel wrote:\n> Add a tuning script for rkisp1 that uses libtuning. So far it only\n> supports LSC.\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> \n> ---\n> Changes in v3:\n> - cosmetic changes / fix style\n> - add __main__ guard\n> - rename ALSC to LSC\n> \n> Changes in v2:\n> - add SPDX and copyright\n> - s/average_functions/average/\n> - update the script to work with the new rkisp1 alsc module\n> \n> v1:\n> This won't run as we're missing the necessary parser and generator for\n> yaml, parabolic gradient support, and multiple green support in the LSC\n> module, hence the DNI. As soon as those are added though, this *should*\n> work.\n> ---\n>  utils/tuning/rkisp1.py | 43 ++++++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 43 insertions(+)\n>  create mode 100755 utils/tuning/rkisp1.py\n> \n> diff --git a/utils/tuning/rkisp1.py b/utils/tuning/rkisp1.py\n> new file mode 100755\n> index 00000000..a8cb0c39\n> --- /dev/null\n> +++ b/utils/tuning/rkisp1.py\n> @@ -0,0 +1,43 @@\n> +#!/usr/bin/env python3\n> +# SPDX-License-Identifier: GPL-2.0-or-later\n> +#\n> +# Copyright (C) 2022, Paul Elder <paul.elder@ideasonboard.com>\n> +#\n> +# rkisp1.py - Tuning script for rkisp1\n> +\n> +import sys\n> +\n> +import libtuning as lt\n> +from libtuning.parsers import YamlParser\n> +from libtuning.generators import YamlOutput\n> +from libtuning.modules.lsc import LSCRkISP1\n> +\n> +tuner = lt.Tuner('RkISP1')\n> +tuner.add(LSCRkISP1(\n> +          # This can support other debug options (I can't think of any right\n> +          # now, but for future-proofing).\n> +          debug=[lt.Debug.Plot],\n> +\n> +          # This is for the actual LSC tuning, and is part of the base ALSC\n\ns/ALSC/LSC/. Same below.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +          # module. rkisp1's table sector sizes (16x16 programmed as mirrored\n> +          # 8x8) are separate, and is hardcoded in its specific ALSC tuning\n> +          # module.\n> +          sector_shape=(17, 17),\n> +\n> +          sector_x_gradient=lt.gradient.Linear(lt.Remainder.DistributeFront),\n> +          sector_y_gradient=lt.gradient.Linear(lt.Remainder.DistributeFront),\n> +\n> +          # This is the function that will be used to average the pixels in\n> +          # each sector. This can also be a custom function.\n> +          sector_average_function=lt.average.Mean(),\n> +\n> +          # This is the function that will be used to smooth the color ratio\n> +          # values.  This can also be a custom function.\n> +          smoothing_function=lt.smoothing.MedianBlur(3),\n> +          ))\n> +tuner.set_input_parser(YamlParser())\n> +tuner.set_output_formatter(YamlOutput())\n> +tuner.set_output_order([LSCRkISP1])\n> +\n> +if __name__ == '__main__':\n> +    sys.exit(tuner.run(sys.argv))","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 551E5BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 23 Nov 2022 00:36:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C6C9C63314;\n\tWed, 23 Nov 2022 01:36:12 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7C2DA61F2B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Nov 2022 01:36:11 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CF390890;\n\tWed, 23 Nov 2022 01:36:10 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669163772;\n\tbh=1OVD/23zJB0Dju7OAxZFGCroHhk/a50PQzlgT7tiQZ4=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=lqQ6vedIujbfnwDBg8R50X0pZxgeL7fWllStjxf48rGnfCovYSPqqy94+ObcZ31/2\n\t3oqvbFSJuNKeY4lE40ID+2coNSaF6DlFA6PTtXasz/O3XPSGu/JmJzTDj/RglxhXhL\n\tH7TMoa9EOmpjNB44Z6Kgd9SJHYAMla+/9rP7i8Vm7wEvDJEQE0IWpxaGCoZVGuiiNu\n\t2GYEVdIsCQsp3eEGVtuuMT5aSEfETv8Atvc47RAihm3KyjUxpI5vRdZXr4/8yHy2x0\n\tuU6oUQ+8UJNZssk2IA/KGZcPEmkAPD9mXb+dS57nqnz1SVFLJOSm6an/ohqq45I/VW\n\tkiyzj2PggZ1/g==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1669163771;\n\tbh=1OVD/23zJB0Dju7OAxZFGCroHhk/a50PQzlgT7tiQZ4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Fwq8iuw/3+VjOrOC1s7gjJZ6wD2nja7qjUipwlGPvwThno8XhrkgkUFiwqR0MPIud\n\tpPcuaNy8QY8f35sGejFE+A4GC7xYbbliXBZomlYhx7kWyCBbmcfq0D92nyug2g/v2W\n\tqTSBl4CAswXpVVF+XIvqyP5fiYfifKjlzktHDXZA="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Fwq8iuw/\"; dkim-atps=neutral","Date":"Wed, 23 Nov 2022 02:35:55 +0200","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<Y31q6+lai6aqyUQw@pendragon.ideasonboard.com>","References":"<20221110173154.488445-1-paul.elder@ideasonboard.com>\n\t<20221110173154.488445-13-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20221110173154.488445-13-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 12/12] utils: tuning: Add tuning\n\tscript for rkisp1","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]