{"id":20911,"url":"https://patchwork.libcamera.org/api/patches/20911/?format=json","web_url":"https://patchwork.libcamera.org/patch/20911/","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":"<20240814094134.73333-2-stefan.klug@ideasonboard.com>","date":"2024-08-14T09:41:30","name":"[v2,1/2] utils: tuning: rkisp1: Clean up tuner construction","commit_ref":"1dfedac794f2f26d2ee99b4d7316a84757ee643b","pull_url":null,"state":"accepted","archived":false,"hash":"9315ac81d4a4050ec8f82dcd549ed598e0b24c6f","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20911/mbox/","series":[{"id":4519,"url":"https://patchwork.libcamera.org/api/series/4519/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4519","date":"2024-08-14T09:41:29","name":"Two small tuning script cleanups","version":2,"mbox":"https://patchwork.libcamera.org/series/4519/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20911/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20911/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 20E68BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 14 Aug 2024 09:41:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B5648633B5;\n\tWed, 14 Aug 2024 11:41:44 +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 A912E61946\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 14 Aug 2024 11:41:41 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:8a6:aa2:ebee:5ae5])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E660D6B5;\n\tWed, 14 Aug 2024 11:40:43 +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=\"OmaWEguN\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1723628444;\n\tbh=diIMYw8C1KH45MljUmVLfdIZD6+m2AZaBDPPktfGi4Y=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=OmaWEguN7suz7TmWvvLPRA/JLG+STfznAxTEKc9tPc6ZODBSBnbJijN3Tr1uGr7vU\n\tapeFRG4XxTjuD9rlwy0YJ6yJez/p6qY0sItcWrhewZkQBI6gzJ3eE3rGUcfiYCIoxZ\n\t0MBTVk1ePfMdik3XAXNMLQJ1+XB4wF1XhfDmje/c=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>","Subject":"[PATCH v2 1/2] utils: tuning: rkisp1: Clean up tuner construction","Date":"Wed, 14 Aug 2024 11:41:30 +0200","Message-ID":"<20240814094134.73333-2-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20240814094134.73333-1-stefan.klug@ideasonboard.com>","References":"<20240814094134.73333-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>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@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":["v2","1/2"]}