{"id":17540,"url":"https://patchwork.libcamera.org/api/patches/17540/?format=json","web_url":"https://patchwork.libcamera.org/patch/17540/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20221006120105.3861831-8-paul.elder@ideasonboard.com>","date":"2022-10-06T12:01:05","name":"[libcamera-devel,7/7,DNI] utils: tuning: Add tuning script for rkisp1","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"9fd89de27a9c6d21b59b155544103891fb768d88","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17540/mbox/","series":[{"id":3536,"url":"https://patchwork.libcamera.org/api/series/3536/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3536","date":"2022-10-06T12:00:58","name":"utils: tuning: Add a new tuning infrastructure","version":1,"mbox":"https://patchwork.libcamera.org/series/3536/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17540/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17540/checks/","tags":{},"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 748A3C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 Oct 2022 12:01:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2798662D01;\n\tThu,  6 Oct 2022 14:01:33 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5970162CFE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 Oct 2022 14:01:31 +0200 (CEST)","from pyrite.rasen.tech (h175-177-042-159.catv02.itscom.jp\n\t[175.177.42.159])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EBA624DD;\n\tThu,  6 Oct 2022 14:01:29 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1665057693;\n\tbh=MsJfSHZA+x99EnG652uupmIyLe/hzEKsaP1x+7Nlgfk=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=X4Ol/wxi7c0osJgxpuF3+Z/j0e3dk7UmzvXw4E3gEAfBa0u8IR2LtNxIPGGGAcEpq\n\tnBtRY6jOAnhA81zRqSMBADE7gdjTo+R/REoGXGiRXPEBVl/MkrrOmqPtrwJ6r2SJ8d\n\t9W7l+wTtBjQQTKGUN4fd3VrZ9xTwzX0Hpy2K9dxQz47cMkIOneGFtfhSKisHVNfix4\n\tzInV4KRcjvAfmYUG0GJchTcdlh7gG0DjbO64T9ZFrWgNwNdEqHGqKL/LBVd27+40el\n\tbqoI4O6KiV9aYQs79kmckh8wrX1en/8jWH+GoNDVIqU0dTYovdkqbhb/52y4Usdv2a\n\tJVG0htAWfP09w==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1665057691;\n\tbh=MsJfSHZA+x99EnG652uupmIyLe/hzEKsaP1x+7Nlgfk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ok1GZZLrnGD9uGMrG/RH8d7/ftttz9lO5ddyPPL+rsikyIzm/j6bxpBFa8PItTtPK\n\tgKcDSVqC9HWn3kDPE7LLXZZVusjqICYqv5LDbkJtbgftvl0nYHto8yfQGYhA/78suN\n\tbp5DNlRa8lEMjYjQ22wStkGLOukobl3YYcxu9l70="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ok1GZZLr\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  6 Oct 2022 21:01:05 +0900","Message-Id":"<20221006120105.3861831-8-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.30.2","In-Reply-To":"<20221006120105.3861831-1-paul.elder@ideasonboard.com>","References":"<20221006120105.3861831-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 7/7] [DNI] 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":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Paul Elder <paul.elder@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add a tuning script for rkisp1 that uses libtuning.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nThis won't run as we're missing the necessary parser and generator for\nyaml, parabolic gradient support, and multiple green support in the ALSC\nmodule, hence the DNI. As soon as those are added though, this *should*\nwork.\n---\n utils/tuning/rkisp1.py | 69 ++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 69 insertions(+)\n create mode 100644 utils/tuning/rkisp1.py","diff":"diff --git a/utils/tuning/rkisp1.py b/utils/tuning/rkisp1.py\nnew file mode 100644\nindex 00000000..6ccd8ceb\n--- /dev/null\n+++ b/utils/tuning/rkisp1.py\n@@ -0,0 +1,69 @@\n+#!/usr/bin/env python3\n+\n+import sys\n+\n+import libtuning as lt\n+from libtuning.modules import ALSC\n+from libtuning.parsers import YamlParser\n+from libtuning.generators import YamlOutput\n+\n+tuner = lt.Camera('RkISP1')\n+tuner.add(ALSC(do_color=lt.param('do_alsc_colour', lt.param.mode.Optional, True),\n+\n+               # This can support other debug options (I can't think of any rn\n+               # but for future-proofing)\n+               debug=[lt.debug.Plot],\n+\n+               # The name of IfUnSet can obviously be changed, but really I\n+               # just want something that says \"it must be specified in the\n+               # configuration, and get the value from there\" or \"if the value\n+               # is not in the configuration, use this\"\n+               luminance_strength=lt.param('luminance_strength', lt.param.mode.Optional, 0.5),\n+\n+               sector_shape=(16, 16),\n+\n+               # Other functions might include Circular, Hyperbolic, Gaussian,\n+               # Linear, Exponential, Logarithmic, etc\n+               # Of course, both need not be the same function\n+               # Some functions would need a sector_x_parameter (eg. sigma for Gaussian)\n+               # Alternatively: sector_x_sizes = [] ? I don't think it would work tho\n+               sector_x_gradient=lt.gradient.Parabolic,\n+               sector_y_gradient=lt.gradient.Parabolic,\n+\n+               # This is the function that will be used to average the pixels in each sector\n+               # This can also be a custom function.\n+               sector_average_function=lt.average_functions.Mean,\n+\n+               # This is the function that will be used to smooth the color ratio values\n+               # This can also be a custom function.\n+               smoothing_function=lt.smoothing.MedianBlur,\n+               smoothing_parameters=[3],\n+\n+               # Are there any platforms that use integer values for their lsc table?\n+               output_type=lt.type.Float,\n+\n+               # Required if and only if do_color can be or is True\n+               output_color_channels=[lt.color.R, lt.color.GR, lt.color.GB, lt.color.B],\n+\n+               # Required if and only if do_color can be or is False\n+               output_luminance_channels=[lt.color.GR, lt.color.GB],\n+\n+               # Automatically get the precision from this\n+               output_range=(0, 3.999)\n+\n+               # Do we need a flag to enable/disable calculating sigmas? afaik\n+               # the rkisp1 IPA doesn't use it? But we could output it anyway\n+               # and algorithms can decide whether or not if they want to use\n+               # it. Oh well, no flag for now, we can always add it later if\n+               # there's a big demand, plus it's only two to three values and\n+               # not an entire table.\n+               ))\n+tuner.setInputType(YamlParser)\n+tuner.setOutputType(YamlOutput)\n+tuner.setOutputOrder([ALSC])\n+\n+# Maybe this should be wrapped in an if __main__ = '__main__' ? That way the\n+# developer can control which tuner they want to be executed based on another\n+# layer of arguments? But I was thinking that this would handle *all* arguments\n+# based on the modules' and the input/output configurations.\n+tuner.run(sys.argv)\n","prefixes":["libcamera-devel","7/7","DNI"]}