{"id":16456,"url":"https://patchwork.libcamera.org/api/patches/16456/?format=json","web_url":"https://patchwork.libcamera.org/patch/16456/","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":"<20220630101702.45781-6-jeanmichel.hautbois@ideasonboard.com>","date":"2022-06-30T10:17:02","name":"[libcamera-devel,5/5] utils: ipu3: dump lens shading params","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"a56f166fcdb744d1d2e4ec6e226f77dd3e6eef2a","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/?format=json","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16456/mbox/","series":[{"id":3237,"url":"https://patchwork.libcamera.org/api/series/3237/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3237","date":"2022-06-30T10:16:58","name":"[libcamera-devel,1/5] utils: ipu3: Introduce a parameters dump tool","version":1,"mbox":"https://patchwork.libcamera.org/series/3237/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16456/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16456/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 65AABBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 30 Jun 2022 10:17:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EBE7A65659;\n\tThu, 30 Jun 2022 12:17:12 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BD48E65633\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Jun 2022 12:17:07 +0200 (CEST)","from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:4fb3:9c17:e136:8792])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1C73245F;\n\tThu, 30 Jun 2022 12:17:07 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656584233;\n\tbh=2h6ALceQzbTJHtuYKuIZAYtVIuRZgcuzbEHi/ab0DjU=;\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=lzzcNJk6ZMlacZtwlq4xvBKNBXbIBxS8unDE/vDZNQwY8RypDs7XVLW+pYapRa+Li\n\tehD04stUSF4zKuLvNk3pVR+dU1yGUkczdUJEFhYV+EACyKYK+3aOsyRWmK8fcaoM8A\n\t5a7XPpOQuZGL8vMWYwHdChbWP/lTEbh15O9noAbbK5AjAyG4yf9/LPoj3yCKVFoaeU\n\tFxHBXqMuSnj4GrmNXooF6IqfvEzFFfgokOww3ejwdO6NevlWYQPcO+OvjbpaZEXDsU\n\tkF7GU5QPbVe66ifqh1TB9T3sN8VkX3KUQedO0YyRve4LSMf5NC/Tswj4FiHgGT9P6w\n\tBe0rzy8JsLjOA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1656584227;\n\tbh=2h6ALceQzbTJHtuYKuIZAYtVIuRZgcuzbEHi/ab0DjU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ez7hvsQU8RzTX8ML2AE3tPTiDTCrH4OTE+j+OZFYL8ZMaJYxUuXMouhEdZt+q0QeG\n\tIuSWvAIE9bbQpSJKHgYY98PMamidllOFxGVNTJdN7l+UBzyZEC+1zxJ1R10gnJc3De\n\t7y1UQRVmLUv7W4cZ6dUkqkkXm4NAr94LY2mQlGuQ="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ez7hvsQU\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 30 Jun 2022 12:17:02 +0200","Message-Id":"<20220630101702.45781-6-jeanmichel.hautbois@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20220630101702.45781-1-jeanmichel.hautbois@ideasonboard.com>","References":"<20220630101702.45781-1-jeanmichel.hautbois@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 5/5] utils: ipu3: dump lens shading params","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":"Jean-Michel Hautbois via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The sensor lens shading can be corrected, and this is controlled with\nthe ipu3_uapi_shd_config structure. Display the configuration followed\nby the look-up tables for each of the 4 channels.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n utils/ipu3/ipu3-dump-params.c | 98 +++++++++++++++++++++++++++++++++++\n 1 file changed, 98 insertions(+)","diff":"diff --git a/utils/ipu3/ipu3-dump-params.c b/utils/ipu3/ipu3-dump-params.c\nindex e34a7e53..c8a4ae2f 100644\n--- a/utils/ipu3/ipu3-dump-params.c\n+++ b/utils/ipu3/ipu3-dump-params.c\n@@ -75,6 +75,90 @@ static void displayGD(struct ipu3_uapi_bnr_static_config_green_disparity *gd)\n \t\tgd->gd_central_weight);\n }\n \n+static void displayShdGrid(struct ipu3_uapi_shd_grid_config *grid, const char *gridName)\n+{\n+\tfprintf(stderr, \"Configured %s grid [%d,%d]x[%d,%d] starting at (%d, %d)\\n\",\n+\t\tgridName,\n+\t\tgrid->width,\n+\t\tgrid->block_width_log2,\n+\t\tgrid->height,\n+\t\tgrid->block_height_log2,\n+\t\tgrid->x_start,\n+\t\tgrid->y_start & ~IPU3_UAPI_GRID_Y_START_EN);\n+\tfprintf(stderr, \"Grid size is (%d x %d)\\n\",\n+\t\tgrid->width << grid->block_width_log2,\n+\t\tgrid->height << grid->block_height_log2);\n+}\n+\n+static void displayShdConfig(struct ipu3_uapi_params *params)\n+{\n+\tstruct ipu3_uapi_shd_general_config shdConfig = params->acc_param.shd.shd.general;\n+\tfprintf(stderr, \"Shading general config\\n\");\n+\tfprintf(stderr, \"Vertical offset (init_set_vrt_offst_ul): %u\\n\", shdConfig.init_set_vrt_offst_ul);\n+\tfprintf(stderr, \"Shd flag (shd_enable): %s\\n\", shdConfig.shd_enable ? \"enabled\" : \"disabled\");\n+\tfprintf(stderr, \"Gain factor (gain_factor): %u\\n\", shdConfig.gain_factor);\n+}\n+\n+static void displayShdLutGr(struct ipu3_uapi_params *params)\n+{\n+\tstruct ipu3_uapi_shd_lut shdLut = params->acc_param.shd.shd_lut;\n+\tfor (unsigned int height = 0; height < params->acc_param.shd.shd.grid.height / 2; height++) {\n+\t\tfprintf(stderr, \"\\n\");\n+\t\tfor (unsigned int width = 0; width < params->acc_param.shd.shd.grid.width; width++) {\n+\t\t\tfprintf(stderr, \"%d,\", shdLut.sets[height].r_and_gr[width].gr);\n+\t\t}\n+\t\tfprintf(stderr, \"\\n\");\n+\t\tfor (unsigned int width = 0; width < params->acc_param.shd.shd.grid.width; width++) {\n+\t\t\tfprintf(stderr, \"%d,\", shdLut.sets[height].r_and_gr[params->acc_param.shd.shd.grid.width + width].gr);\n+\t\t}\n+\t}\n+}\n+\n+static void displayShdLutR(struct ipu3_uapi_params *params)\n+{\n+\tstruct ipu3_uapi_shd_lut shdLut = params->acc_param.shd.shd_lut;\n+\tfor (unsigned int height = 0; height < params->acc_param.shd.shd.grid.height / 2; height++) {\n+\t\tfprintf(stderr, \"\\n\");\n+\t\tfor (unsigned int width = 0; width < params->acc_param.shd.shd.grid.width; width++) {\n+\t\t\tfprintf(stderr, \"%d,\", shdLut.sets[height].r_and_gr[width].r);\n+\t\t}\n+\t\tfprintf(stderr, \"\\n\");\n+\t\tfor (unsigned int width = 0; width < params->acc_param.shd.shd.grid.width; width++) {\n+\t\t\tfprintf(stderr, \"%d,\", shdLut.sets[height].r_and_gr[params->acc_param.shd.shd.grid.width + width].r);\n+\t\t}\n+\t}\n+}\n+\n+static void displayShdLutGb(struct ipu3_uapi_params *params)\n+{\n+\tstruct ipu3_uapi_shd_lut shdLut = params->acc_param.shd.shd_lut;\n+\tfor (unsigned int height = 0; height < params->acc_param.shd.shd.grid.height / 2; height++) {\n+\t\tfprintf(stderr, \"\\n\");\n+\t\tfor (unsigned int width = 0; width < params->acc_param.shd.shd.grid.width; width++) {\n+\t\t\tfprintf(stderr, \"%d,\", shdLut.sets[height].gb_and_b[width].gb);\n+\t\t}\n+\t\tfprintf(stderr, \"\\n\");\n+\t\tfor (unsigned int width = 0; width < params->acc_param.shd.shd.grid.width; width++) {\n+\t\t\tfprintf(stderr, \"%d,\", shdLut.sets[height].gb_and_b[params->acc_param.shd.shd.grid.width + width].gb);\n+\t\t}\n+\t}\n+}\n+\n+static void displayShdLutB(struct ipu3_uapi_params *params)\n+{\n+\tstruct ipu3_uapi_shd_lut shdLut = params->acc_param.shd.shd_lut;\n+\tfor (unsigned int height = 0; height < params->acc_param.shd.shd.grid.height / 2; height++) {\n+\t\tfprintf(stderr, \"\\n\");\n+\t\tfor (unsigned int width = 0; width < params->acc_param.shd.shd.grid.width; width++) {\n+\t\t\tfprintf(stderr, \"%d,\", shdLut.sets[height].gb_and_b[width].b);\n+\t\t}\n+\t\tfprintf(stderr, \"\\n\");\n+\t\tfor (unsigned int width = 0; width < params->acc_param.shd.shd.grid.width; width++) {\n+\t\t\tfprintf(stderr, \"%d,\", shdLut.sets[height].gb_and_b[params->acc_param.shd.shd.grid.width + width].b);\n+\t\t}\n+\t}\n+}\n+\n int main(int argc, char *argv[])\n {\n \tint in_fd;\n@@ -118,6 +202,20 @@ start:\n \t\tdisplayGD(&params.acc_param.green_disparity);\n \t}\n \n+\tif (params.use.acc_shd) {\n+\t\tfprintf(stderr, \"\\n**** Lens shading parameters ****\\n\");\n+\t\tdisplayShdGrid(&params.acc_param.shd.shd.grid, \"shd\");\n+\t\tdisplayShdConfig(&params);\n+\t\tfprintf(stderr, \"\\n** Lens shading LUT for Gr **\");\n+\t\tdisplayShdLutGr(&params);\n+\t\tfprintf(stderr, \"\\n** Lens shading LUT for R **\");\n+\t\tdisplayShdLutR(&params);\n+\t\tfprintf(stderr, \"\\n** Lens shading LUT for Gb **\");\n+\t\tdisplayShdLutGb(&params);\n+\t\tfprintf(stderr, \"\\n** Lens shading LUT for B **\");\n+\t\tdisplayShdLutB(&params);\n+\t}\n+\n \tclose(in_fd);\n \n \treturn ret ? 1 : 0;\n","prefixes":["libcamera-devel","5/5"]}