From patchwork Thu Jun 30 10:17:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 16456 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 65AABBE173 for ; Thu, 30 Jun 2022 10:17:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EBE7A65659; Thu, 30 Jun 2022 12:17:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656584233; bh=2h6ALceQzbTJHtuYKuIZAYtVIuRZgcuzbEHi/ab0DjU=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=lzzcNJk6ZMlacZtwlq4xvBKNBXbIBxS8unDE/vDZNQwY8RypDs7XVLW+pYapRa+Li ehD04stUSF4zKuLvNk3pVR+dU1yGUkczdUJEFhYV+EACyKYK+3aOsyRWmK8fcaoM8A 5a7XPpOQuZGL8vMWYwHdChbWP/lTEbh15O9noAbbK5AjAyG4yf9/LPoj3yCKVFoaeU FxHBXqMuSnj4GrmNXooF6IqfvEzFFfgokOww3ejwdO6NevlWYQPcO+OvjbpaZEXDsU kF7GU5QPbVe66ifqh1TB9T3sN8VkX3KUQedO0YyRve4LSMf5NC/Tswj4FiHgGT9P6w Be0rzy8JsLjOA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BD48E65633 for ; Thu, 30 Jun 2022 12:17:07 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ez7hvsQU"; dkim-atps=neutral Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:4fb3:9c17:e136:8792]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1C73245F; Thu, 30 Jun 2022 12:17:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1656584227; bh=2h6ALceQzbTJHtuYKuIZAYtVIuRZgcuzbEHi/ab0DjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ez7hvsQU8RzTX8ML2AE3tPTiDTCrH4OTE+j+OZFYL8ZMaJYxUuXMouhEdZt+q0QeG IuSWvAIE9bbQpSJKHgYY98PMamidllOFxGVNTJdN7l+UBzyZEC+1zxJ1R10gnJc3De 7y1UQRVmLUv7W4cZ6dUkqkkXm4NAr94LY2mQlGuQ= 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jean-Michel Hautbois via libcamera-devel From: Jean-Michel Hautbois Reply-To: Jean-Michel Hautbois Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The sensor lens shading can be corrected, and this is controlled with the ipu3_uapi_shd_config structure. Display the configuration followed by the look-up tables for each of the 4 channels. Signed-off-by: Jean-Michel Hautbois --- utils/ipu3/ipu3-dump-params.c | 98 +++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/utils/ipu3/ipu3-dump-params.c b/utils/ipu3/ipu3-dump-params.c index e34a7e53..c8a4ae2f 100644 --- a/utils/ipu3/ipu3-dump-params.c +++ b/utils/ipu3/ipu3-dump-params.c @@ -75,6 +75,90 @@ static void displayGD(struct ipu3_uapi_bnr_static_config_green_disparity *gd) gd->gd_central_weight); } +static void displayShdGrid(struct ipu3_uapi_shd_grid_config *grid, const char *gridName) +{ + fprintf(stderr, "Configured %s grid [%d,%d]x[%d,%d] starting at (%d, %d)\n", + gridName, + grid->width, + grid->block_width_log2, + grid->height, + grid->block_height_log2, + grid->x_start, + grid->y_start & ~IPU3_UAPI_GRID_Y_START_EN); + fprintf(stderr, "Grid size is (%d x %d)\n", + grid->width << grid->block_width_log2, + grid->height << grid->block_height_log2); +} + +static void displayShdConfig(struct ipu3_uapi_params *params) +{ + struct ipu3_uapi_shd_general_config shdConfig = params->acc_param.shd.shd.general; + fprintf(stderr, "Shading general config\n"); + fprintf(stderr, "Vertical offset (init_set_vrt_offst_ul): %u\n", shdConfig.init_set_vrt_offst_ul); + fprintf(stderr, "Shd flag (shd_enable): %s\n", shdConfig.shd_enable ? "enabled" : "disabled"); + fprintf(stderr, "Gain factor (gain_factor): %u\n", shdConfig.gain_factor); +} + +static void displayShdLutGr(struct ipu3_uapi_params *params) +{ + struct ipu3_uapi_shd_lut shdLut = params->acc_param.shd.shd_lut; + for (unsigned int height = 0; height < params->acc_param.shd.shd.grid.height / 2; height++) { + fprintf(stderr, "\n"); + for (unsigned int width = 0; width < params->acc_param.shd.shd.grid.width; width++) { + fprintf(stderr, "%d,", shdLut.sets[height].r_and_gr[width].gr); + } + fprintf(stderr, "\n"); + for (unsigned int width = 0; width < params->acc_param.shd.shd.grid.width; width++) { + fprintf(stderr, "%d,", shdLut.sets[height].r_and_gr[params->acc_param.shd.shd.grid.width + width].gr); + } + } +} + +static void displayShdLutR(struct ipu3_uapi_params *params) +{ + struct ipu3_uapi_shd_lut shdLut = params->acc_param.shd.shd_lut; + for (unsigned int height = 0; height < params->acc_param.shd.shd.grid.height / 2; height++) { + fprintf(stderr, "\n"); + for (unsigned int width = 0; width < params->acc_param.shd.shd.grid.width; width++) { + fprintf(stderr, "%d,", shdLut.sets[height].r_and_gr[width].r); + } + fprintf(stderr, "\n"); + for (unsigned int width = 0; width < params->acc_param.shd.shd.grid.width; width++) { + fprintf(stderr, "%d,", shdLut.sets[height].r_and_gr[params->acc_param.shd.shd.grid.width + width].r); + } + } +} + +static void displayShdLutGb(struct ipu3_uapi_params *params) +{ + struct ipu3_uapi_shd_lut shdLut = params->acc_param.shd.shd_lut; + for (unsigned int height = 0; height < params->acc_param.shd.shd.grid.height / 2; height++) { + fprintf(stderr, "\n"); + for (unsigned int width = 0; width < params->acc_param.shd.shd.grid.width; width++) { + fprintf(stderr, "%d,", shdLut.sets[height].gb_and_b[width].gb); + } + fprintf(stderr, "\n"); + for (unsigned int width = 0; width < params->acc_param.shd.shd.grid.width; width++) { + fprintf(stderr, "%d,", shdLut.sets[height].gb_and_b[params->acc_param.shd.shd.grid.width + width].gb); + } + } +} + +static void displayShdLutB(struct ipu3_uapi_params *params) +{ + struct ipu3_uapi_shd_lut shdLut = params->acc_param.shd.shd_lut; + for (unsigned int height = 0; height < params->acc_param.shd.shd.grid.height / 2; height++) { + fprintf(stderr, "\n"); + for (unsigned int width = 0; width < params->acc_param.shd.shd.grid.width; width++) { + fprintf(stderr, "%d,", shdLut.sets[height].gb_and_b[width].b); + } + fprintf(stderr, "\n"); + for (unsigned int width = 0; width < params->acc_param.shd.shd.grid.width; width++) { + fprintf(stderr, "%d,", shdLut.sets[height].gb_and_b[params->acc_param.shd.shd.grid.width + width].b); + } + } +} + int main(int argc, char *argv[]) { int in_fd; @@ -118,6 +202,20 @@ start: displayGD(¶ms.acc_param.green_disparity); } + if (params.use.acc_shd) { + fprintf(stderr, "\n**** Lens shading parameters ****\n"); + displayShdGrid(¶ms.acc_param.shd.shd.grid, "shd"); + displayShdConfig(¶ms); + fprintf(stderr, "\n** Lens shading LUT for Gr **"); + displayShdLutGr(¶ms); + fprintf(stderr, "\n** Lens shading LUT for R **"); + displayShdLutR(¶ms); + fprintf(stderr, "\n** Lens shading LUT for Gb **"); + displayShdLutGb(¶ms); + fprintf(stderr, "\n** Lens shading LUT for B **"); + displayShdLutB(¶ms); + } + close(in_fd); return ret ? 1 : 0;