{"id":20764,"url":"https://patchwork.libcamera.org/api/1.1/patches/20764/?format=json","web_url":"https://patchwork.libcamera.org/patch/20764/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20240805070644.1536232-2-stefan.klug@ideasonboard.com>","date":"2024-08-05T07:06:32","name":"[v1,1/2] utils: tuning: rkisp1: Clean up tuner construction","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"9315ac81d4a4050ec8f82dcd549ed598e0b24c6f","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/1.1/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20764/mbox/","series":[{"id":4484,"url":"https://patchwork.libcamera.org/api/1.1/series/4484/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4484","date":"2024-08-05T07:06:31","name":"Two small tuning script cleanups","version":1,"mbox":"https://patchwork.libcamera.org/series/4484/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20764/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20764/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 7394EBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  5 Aug 2024 07:06:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2795163385;\n\tMon,  5 Aug 2024 09:06:55 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D6F6863384\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  5 Aug 2024 09:06:52 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:30ff:e7b4:349c:44ce])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5620C1A2;\n\tMon,  5 Aug 2024 09:06:01 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"uATgoNgm\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1722841561;\n\tbh=ihSPB3tgeuEnj3LC1Yf6mjdTc2pY67dWI9L+r73YH/E=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=uATgoNgmP0rVxIFxgmXDdeuG4kijXoWhZcgNLy/dk9NhI2oEEAd/l/qS7V4/FDVbd\n\tnxhYkCwM4N7S8OkK2nQXbXiKvFM8Zbhsd6fETrz9Lo6eAaV5r+kluRtrkNMSLYqRdI\n\tcpjT1608gGPZZtD9MgIUgHMQ1Al73oUo0FiyYgEU=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v1 1/2] utils: tuning: rkisp1: Clean up tuner construction","Date":"Mon,  5 Aug 2024 09:06:32 +0200","Message-ID":"<20240805070644.1536232-2-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20240805070644.1536232-1-stefan.klug@ideasonboard.com>","References":"<20240805070644.1536232-1-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The instances of the static modules need to be passed to\ntuner.set_output_order() instead of the class.  This is the reason for\nthe intermediate variables. To keep the code tidy, apply the same\npattern to the other modules.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n utils/tuning/rkisp1.py | 47 +++++++++++++++++++++---------------------\n 1 file changed, 24 insertions(+), 23 deletions(-)","diff":"diff --git a/utils/tuning/rkisp1.py b/utils/tuning/rkisp1.py\nindex 0d279a39ab1b..5d7a69fc4a13 100755\n--- a/utils/tuning/rkisp1.py\n+++ b/utils/tuning/rkisp1.py\n@@ -19,44 +19,45 @@ from libtuning.modules.static import StaticModule\n \n coloredlogs.install(level=logging.INFO, fmt='%(name)s %(levelname)s %(message)s')\n \n+agc = AGCRkISP1(debug=[lt.Debug.Plot])\n awb = StaticModule('Awb')\n blc = StaticModule('BlackLevelCorrection')\n+ccm = CCMRkISP1(debug=[lt.Debug.Plot])\n color_processing = StaticModule('ColorProcessing')\n filter = StaticModule('Filter')\n gamma_out = StaticModule('GammaOutCorrection', {'gamma': 2.2})\n+lsc = LSCRkISP1(debug=[lt.Debug.Plot],\n+                # This is for the actual LSC tuning, and is part of the base LSC\n+                # module. rkisp1's table sector sizes (16x16 programmed as mirrored\n+                # 8x8) are separate, and is hardcoded in its specific LSC 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 = lt.Tuner('RkISP1')\n-tuner.add(AGCRkISP1(debug=[lt.Debug.Plot]))\n+tuner.add(agc)\n tuner.add(awb)\n tuner.add(blc)\n-tuner.add(CCMRkISP1(debug=[lt.Debug.Plot]))\n+tuner.add(ccm)\n tuner.add(color_processing)\n tuner.add(filter)\n tuner.add(gamma_out)\n-tuner.add(LSCRkISP1(\n-          debug=[lt.Debug.Plot],\n-          # This is for the actual LSC tuning, and is part of the base LSC\n-          # module. rkisp1's table sector sizes (16x16 programmed as mirrored\n-          # 8x8) are separate, and is hardcoded in its specific LSC 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.add(lsc)\n \n tuner.set_input_parser(YamlParser())\n tuner.set_output_formatter(YamlOutput())\n-tuner.set_output_order([AGCRkISP1, awb, blc, CCMRkISP1, color_processing,\n-                        filter, gamma_out, LSCRkISP1])\n+tuner.set_output_order([agc, awb, blc, ccm, color_processing,\n+                        filter, gamma_out, lsc])\n \n if __name__ == '__main__':\n     sys.exit(tuner.run(sys.argv))\n","prefixes":["v1","1/2"]}