[libcamera-devel,3/5] utils: ipu3: Display BNR configuration
diff mbox series

Message ID 20220630101702.45781-4-jeanmichel.hautbois@ideasonboard.com
State New
Headers show
Series
  • [libcamera-devel,1/5] utils: ipu3: Introduce a parameters dump tool
Related show

Commit Message

Jean-Michel Hautbois June 30, 2022, 10:17 a.m. UTC
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 <jeanmichel.hautbois@ideasonboard.com>
---
 utils/ipu3/ipu3-dump-params.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Patch
diff mbox series

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(&params);
+	}
 	if (params.use.acc_awb) {
 		printf("\n**** AWB parameters ****\n");
 		displayGrid(&params.acc_param.awb.config.grid, "awb");