From patchwork Thu Jun 30 10:16:58 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: 16452 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 70610BE173 for ; Thu, 30 Jun 2022 10:17:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4F99B65654; Thu, 30 Jun 2022 12:17:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656584228; bh=jLJmJyp1BuhktQk/QfbGplJz6qFqCEXCN3+sL6OJX6k=; 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=RwAEhY+npNUGoKkdlbwwlLzlJnwQWkO0R23sWBhRhn1G0Pt1drtQjo1qiVaW7wZL5 WwpcqPQCunEByOxD2cFxrkfI/t8QhcL6ABrye6FAbaU+xM+cBbl0B8DCd6xciYxBYv oqzlk/fVvggUP3DwCW5Nh9Y7efwvl3yeFSyUUb7XilUmJyvbyqUMOe140ZgLr5M5dn jpCjZ5iJhjapCtfYlU5MfSUHkCrnQKMO5IZqydVXUMldnAig3xlY0r6NDgYuvF+ZD+ 3axEqWTCuzKE6xSs7kw24/MEr1ZV0rwj6GSyYpb3lkUefaLwXxQ9I5Hg9MjgS6j4VR xv7haLahca1xw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D381965633 for ; Thu, 30 Jun 2022 12:17:06 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="mOnTLy7H"; 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 6565D59D; Thu, 30 Jun 2022 12:17:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1656584226; bh=jLJmJyp1BuhktQk/QfbGplJz6qFqCEXCN3+sL6OJX6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mOnTLy7Hvrk3T6ahsfKgmqFxdFkFowV5N8Gf8XKDshyQaW2RukDxnB3ZAm1fxKf48 c6w1VgVSxSz41wMeXMay3JJrOckSBiG5RCcU+RgYAN0uzl65txg/W21Uak6evGVzYM TsdZnVStYouI8w8Hp5GbNmxWYaUpyql/yDynDe/Q= To: libcamera-devel@lists.libcamera.org Date: Thu, 30 Jun 2022 12:16:58 +0200 Message-Id: <20220630101702.45781-2-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 1/5] utils: ipu3: Introduce a parameters dump tool 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 parameters buffer for IPU3 contains a lot of structures, and is not very easy to debug. This tool aims to ease the parsing of it, when it has been stored as a binary raw file. This commit introduces the parsing with the support of the AWB grid configuration. Signed-off-by: Jean-Michel Hautbois --- utils/ipu3/ipu3-dump-params.c | 74 +++++++++++++++++++++++++++++++++++ utils/ipu3/meson.build | 5 +++ 2 files changed, 79 insertions(+) create mode 100644 utils/ipu3/ipu3-dump-params.c diff --git a/utils/ipu3/ipu3-dump-params.c b/utils/ipu3/ipu3-dump-params.c new file mode 100644 index 00000000..9bd61593 --- /dev/null +++ b/utils/ipu3/ipu3-dump-params.c @@ -0,0 +1,74 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * ipu3-dump-params - Display IPU3 parameters buffer from a binary dump + * + * Copyright 2021 Jean-Michel Hautbois + */ +#define _GNU_SOURCE + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +static void usage(const char *argv0) +{ + printf("Usage: %s input-file\n", basename(argv0)); + printf("Display the IPU3 parameters buffer\n"); +} + +static void displayGrid(struct ipu3_uapi_grid_config *grid, const char *gridName) +{ + printf("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); + + printf("Grid size is (%d x %d)\n", + grid->width << grid->block_width_log2, + grid->height << grid->block_height_log2); +} + +int main(int argc, char *argv[]) +{ + int in_fd; + int ret = 0; + struct ipu3_uapi_params params; + + if (argc != 2) { + usage(argv[0]); + return 1; + } + + in_fd = open(argv[1], O_RDONLY); + if (in_fd == -1) { + fprintf(stderr, "Failed to open input file '%s': %s\n", + argv[1], strerror(errno)); + return 1; + } + +start: + ret = read(in_fd, ¶ms, sizeof(params)); + if (ret == -1 && errno == EINTR) + goto start; + + printf("Read parameters buffer of size %d\n", ret); + + printf("\n**** AWB parameters ****\n"); + displayGrid(¶ms.acc_param.awb.config.grid, "awb"); + displayGrid(¶ms.acc_param.awb_fr.grid_cfg, "awb_fr"); + + close(in_fd); + + return ret ? 1 : 0; +} diff --git a/utils/ipu3/meson.build b/utils/ipu3/meson.build index 88049f58..b2d5577e 100644 --- a/utils/ipu3/meson.build +++ b/utils/ipu3/meson.build @@ -1,3 +1,8 @@ # SPDX-License-Identifier: CC0-1.0 +includes = [ + libcamera_includes, +] + ipu3_unpack = executable('ipu3-unpack', 'ipu3-unpack.c') +ipu3_dump_params = executable('ipu3-dump-params', 'ipu3-dump-params.c', include_directories : libcamera_includes) From patchwork Thu Jun 30 10:16:59 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: 16455 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 89609BE173 for ; Thu, 30 Jun 2022 10:17:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DD2026565D; Thu, 30 Jun 2022 12:17:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656584231; bh=XOv3JWqDc/SO3b/OalIQktDmEKkOwObBfif0/XcT41M=; 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=gnuXxcPDKLJNIGeBhK7p8ajVZO1Ybjz9/56ZLBaj8Ih1tM4e91RBJoAl+Lgt65JIq ImLB1fAYYIoJcG6rT5duEssPp+TTBPd0ASyAWdEO00ge1mqBsIr5eBXHVPtX7b8q1M +t5lQJWdRmSw57vjaIFA4aGE3LVJMyoQkRkRH6L2YlYQ0sfpbpCMJESSNj9gHwJ4Q3 kFbC6McPe/nNgBCcV61Vf1d3z2wGGk7T7boujUJQVROiVPTgAjP7FyboSEayMP0BFe rNWuwpm4oXKQD7zMYxFDrQICQ01cPRaMT6DJJmAvICgBWWgf9fnrihaQdJFfZXL58a ui6R2ab45bDQA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9C03A65650 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="mmWHVJvo"; 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 90F4D6BB; Thu, 30 Jun 2022 12:17:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1656584226; bh=XOv3JWqDc/SO3b/OalIQktDmEKkOwObBfif0/XcT41M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mmWHVJvoIQoCfW1tDnCiif5m6V0TTqSGTIUjl9aElGIEWMYLIH1Qe7P875CL0jAPv s/rgdCU+OA2/im2rV4xxyAcNwhzzODnUVEe4pJR7Wtc/WJO/13KlajPV2w6dEA6vTG qYJh3zniRxJyS9OHUXXJHfGTC5lHSjAGagxxe9g4= To: libcamera-devel@lists.libcamera.org Date: Thu, 30 Jun 2022 12:16:59 +0200 Message-Id: <20220630101702.45781-3-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 2/5] utils: ipu3: Display only if it is modified by userspace 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 ImgU is configured by passing a parameters buffer which is parsed on the kernel side to test if a processing block needs to be configured from the userspace structure or from the default ones. This is controled by the ipu3_uapi_flags field. Use this field to display only the structures modified by the userspace. Signed-off-by: Jean-Michel Hautbois --- utils/ipu3/ipu3-dump-params.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/utils/ipu3/ipu3-dump-params.c b/utils/ipu3/ipu3-dump-params.c index 9bd61593..37cf2e6f 100644 --- a/utils/ipu3/ipu3-dump-params.c +++ b/utils/ipu3/ipu3-dump-params.c @@ -64,9 +64,14 @@ start: printf("Read parameters buffer of size %d\n", ret); - printf("\n**** AWB parameters ****\n"); - displayGrid(¶ms.acc_param.awb.config.grid, "awb"); - displayGrid(¶ms.acc_param.awb_fr.grid_cfg, "awb_fr"); + if (params.use.acc_awb) { + printf("\n**** AWB parameters ****\n"); + displayGrid(¶ms.acc_param.awb.config.grid, "awb"); + } + if (params.use.acc_awb_fr) { + printf("\n**** AWB filter response parameters ****\n"); + displayGrid(¶ms.acc_param.awb_fr.grid_cfg, "awb_fr"); + } close(in_fd); From patchwork Thu Jun 30 10:17:00 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: 16454 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 754CFBE173 for ; Thu, 30 Jun 2022 10:17:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5C77D65652; Thu, 30 Jun 2022 12:17:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656584231; bh=Yg5sa1AqVVlgjTpOSBRX1gkku0YI3CInhPOvLn5bSIk=; 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=hNid5btnWkZBwsObX5fPTXoQ21HP3Nl1D89KodQswDPk09x98bGNmOjJTO4wmk2SX +wKzRkUFNhZETNSdikbLNg0hQvnr2uuHyzTxW5zWAzbYpBhyYmyUivqPiMFTiI/aPl GuOaT6kc1M2jFc5sEk9t3kSDMvEEw5lXsVgUCHr8WTJ85ToTRZiZFVFft00ufDXqh8 nrJefcnlTxOQoNqzyZyd93G6dOWATlj2V8McZLihKrZ7TcDtvtypm4sSeKNYp77SlJ Dmx4Pf9NLgnMRcalxfxJoUZizYYKsqPsA/Gn+7mgIeVb0/rWN+aBGYCwXQtJewAE1a TgYdLsdZmjURA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5CBBF6564C 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="BKxAy+ut"; 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 BC9A6832; Thu, 30 Jun 2022 12:17:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1656584226; bh=Yg5sa1AqVVlgjTpOSBRX1gkku0YI3CInhPOvLn5bSIk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BKxAy+utOrArZ/TeES4xrdpsow4GeoBqdwbnbN3SEmmi5tnhE3yP5TKOxIPG3zwaG aABo3e7QaLty0KVf5bNrUv6DCIqQmZEF9IUR7O6Amq/56HzbitiE0x8gDCYmnYH0q1 p+a/XNDOQ6OxOx2XSdiAAr6sUClnYIDXR8X8GTDU= To: libcamera-devel@lists.libcamera.org Date: Thu, 30 Jun 2022 12:17:00 +0200 Message-Id: <20220630101702.45781-4-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 3/5] utils: ipu3: Display BNR configuration 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" Bayer Noise Reduction is a processing block which contains optical correction parameters for the ImgU. Display the configured parameters. Signed-off-by: Jean-Michel Hautbois --- utils/ipu3/ipu3-dump-params.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/utils/ipu3/ipu3-dump-params.c b/utils/ipu3/ipu3-dump-params.c index 37cf2e6f..257f2205 100644 --- a/utils/ipu3/ipu3-dump-params.c +++ b/utils/ipu3/ipu3-dump-params.c @@ -39,6 +39,27 @@ static void displayGrid(struct ipu3_uapi_grid_config *grid, const char *gridName grid->height << grid->block_height_log2); } +static void displayBNR(struct ipu3_uapi_params *params) +{ + struct ipu3_uapi_bnr_static_config bnr = params->acc_param.bnr; + printf("WB gains: (gr: %u, r: %u, gb: %u, b: %u)\n", + bnr.wb_gains.gr, bnr.wb_gains.r, + bnr.wb_gains.gb, bnr.wb_gains.b); + printf("WB gains thresholds: (gr: %u, r: %u, gb: %u, b: %u)\n", + bnr.wb_gains_thr.gr, bnr.wb_gains_thr.r, + bnr.wb_gains_thr.gb, bnr.wb_gains_thr.b); + printf("Optical window center: (%d, %d) column size is %u\n", + bnr.opt_center.x_reset, bnr.opt_center.y_reset, bnr.column_size); + printf("Noise model coefficients that controls noise threshold:\n"); + printf("Free coefficient (cf): %u, Gain coefficient(cg): %u\n", + bnr.thr_coeffs.cf, bnr.thr_coeffs.cg); + printf("Intensity coefficient(ci): %u, Normalization shift value for r^2 calculation(r_nf): %u\n", + bnr.thr_coeffs.ci, bnr.thr_coeffs.r_nf); + printf("Lens shading gain approximations: (gr: %u, r: %u, gb: %u, b: %u)\n", + bnr.thr_ctrl_shd.gr, bnr.thr_ctrl_shd.r, + bnr.thr_ctrl_shd.gb, bnr.thr_ctrl_shd.b); +} + int main(int argc, char *argv[]) { int in_fd; @@ -64,6 +85,10 @@ start: printf("Read parameters buffer of size %d\n", ret); + if (params.use.acc_bnr) { + printf("\n**** Bayer noise reduction parameters ****\n"); + displayBNR(¶ms); + } if (params.use.acc_awb) { printf("\n**** AWB parameters ****\n"); displayGrid(¶ms.acc_param.awb.config.grid, "awb"); From patchwork Thu Jun 30 10:17:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 16457 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 4A42ABE173 for ; Thu, 30 Jun 2022 10:17:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5414E65658; Thu, 30 Jun 2022 12:17:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656584234; bh=JUorfA7CE7JKlP6v+ZG3Tzg7kT5i6dRMwZg8I7Pn1OA=; 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=gMBk5DFK4lmEdzNGhHsaftLSAK6NT5Xjaky8xfmF6kqHjy2/kxwg3NmBwuGxBJUcY XSUQCjWtCZ6HkAzMURZfaCO9d3VoL4fOAA1m/u99T/pt5TDfdZ34q8YfBdFbmtkjpF ahSwJtseuPx3cD+LGzUj++7K9bPtNyEjfGcnu4VnyAIkhlV+JO9KCNdnxn6x+ZZ4MU CGUrSWS5+aOGCznXOikBnW8qHEwYbeqqBKydX/JYPhJYpgtkFxor5YwYm0P4pwNVGx 0QOxETPXPt1g8KrvZ+j9vmYdWXK3900Aer2pQuMXpr8NodzXQWQLNUp5v5rfXA9urk Rg6eHR4+sH1Kw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8E8A56564E 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="tF6lNQW4"; 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 E6D689B1; Thu, 30 Jun 2022 12:17:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1656584227; bh=JUorfA7CE7JKlP6v+ZG3Tzg7kT5i6dRMwZg8I7Pn1OA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tF6lNQW405FtzF4I85UQisYK/uVUMKk02BoNRSfw7Q64kCrNhmiAMs1oi0OMgDlUH xKe3pQ8sDA36jbBK9CEhDNmhBXF2ap7srkA1cglZ/lS6YLc2stTruuo185GHb6wq5r jCkq6H8HHAFQGEFCy3xQgNM0FJw+kK/QZJqwlH5s= To: libcamera-devel@lists.libcamera.org Date: Thu, 30 Jun 2022 12:17:01 +0200 Message-Id: <20220630101702.45781-5-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 4/5] utils: ipu3: display green disparity 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" Display the shading gain coeff of red, green, blue and black. Those are used to calculate threshold given a pixel’s color value and its coordinates in the image. --- utils/ipu3/ipu3-dump-params.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/utils/ipu3/ipu3-dump-params.c b/utils/ipu3/ipu3-dump-params.c index 257f2205..e34a7e53 100644 --- a/utils/ipu3/ipu3-dump-params.c +++ b/utils/ipu3/ipu3-dump-params.c @@ -60,6 +60,21 @@ static void displayBNR(struct ipu3_uapi_params *params) bnr.thr_ctrl_shd.gb, bnr.thr_ctrl_shd.b); } +static void displayGD(struct ipu3_uapi_bnr_static_config_green_disparity *gd) +{ + printf("red: %u, green: %u, blue: %u, black: %u\n", + gd->gd_red, + gd->gd_green, + gd->gd_blue, + gd->gd_black); + + printf("shading: %u, support: %u, clip: %u, central weight: %u\n", + gd->gd_shading, + gd->gd_support, + gd->gd_clip, + gd->gd_central_weight); +} + int main(int argc, char *argv[]) { int in_fd; @@ -98,6 +113,11 @@ start: displayGrid(¶ms.acc_param.awb_fr.grid_cfg, "awb_fr"); } + if (params.use.acc_green_disparity) { + printf("\n**** Green disparity parameters ****\n"); + displayGD(¶ms.acc_param.green_disparity); + } + close(in_fd); return ret ? 1 : 0; 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;