History

media: rppx1: lsc: Add support for lens shade correction

Extend the RPPX1 driver to allow setting the lens shade correction configuration parameters. It uses the RPPX1 framework for parameters and its writer abstraction to allow the user to control how, and when, configuration is applied to the RPPX1.

Niklas Söderlund committed 3 months ago

Commit b39656e1 parent aaeee9b4 files · +178 −1Browse files

Showing the changes to include/uapi (1 of 4 files). Show all

Unified · Split

include/uapi/linux/media/dreamchip/rppx1-config.h+53−1
@@ -88,6 +88,8 @@ enum rppx1_meas_chan { · 87 unmodified lines
8888 * @RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE1: PRE1 pipe Black Level Subtraction
8989 * @RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE2: PRE2 pipe Black Level Subtraction
9090 * @RPPX1_PARAMS_BLOCK_TYPE_CCOR_POST: POST pipe Color Correction
91+ * @RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE1: PRE1 pipe Lens Shading Correction
92+ * @RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE2: PRE2 pipe Lens Shading Correction
9193 */
9294 enum rppx1_params_block_type {
9395 RPPX1_PARAMS_BLOCK_TYPE_WBMEAS_POST,
@@ -102,6 +104,8 @@ enum rppx1_params_block_type { · 8 unmodified lines
102104 RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE1,
103105 RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE2,
104106 RPPX1_PARAMS_BLOCK_TYPE_CCOR_POST,
107+ RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE1,
108+ RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE2,
105109 };
106110
107111 /**
@@ -460,6 +464,52 @@ struct rppx1_ccor_params { · 352 unmodified lines
460464 __u32 offset[3];
461465 };
462466
467+/* Lens Shade Correction */
468+#define RPPX1_LSC_SAMPLES_MAX 17
469+#define RPPX1_LSC_NUM_SECTORS 16
470+
471+/**
472+ * struct rppx1_lsc_params - Lens Shading Correction configuration
473+ *
474+ * The RPP-X1 Lens shading correction module is available on the PRE1 and PRE2
475+ * pre-fusion pipes. Userspace selects which pipe to operate by setting the
476+ * @header.type field to RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE1 or
477+ * RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE2.
478+ *
479+ * The module applies per-color channel correction factors @r_data, @gr_data,
480+ * @gb_data and @b_data as a 16x16 grid mapped on the image. The size of each
481+ * grid segment is expressed by the @x_sect_size and @y_sect_size arrays. Each
482+ * segment shall be at least 8 pixels in size and the sum of all horizontal
483+ * segments @x_sect_size shall match the input frame size width.
484+ *
485+ * The correction factors values are expressed as unsigned Q2.10 integers
486+ * ranging from 1 to 3.999.
487+ *
488+ * Pre-calculated interpolation factors shall be provided in the @x_grad
489+ * and @y_grad fields, expressed as 12 bits integer values.
490+ *
491+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_LSC)
492+ * @r_data: correction factors for the red channel in Q2.10 format
493+ * @gr_data: correction factors for the green (red) channel in Q2.10 format
494+ * @gb_data: correction factors for the green (blue) channel in Q2.10 format
495+ * @b_data: correction factors for the blue channel in Q2.10 format
496+ * @x_grad: Interpolation gradients for each horizontal sector (12 bits)
497+ * @y_grad: Interpolation gradients for each vertical sector (12 bits)
498+ * @x_sect_size: Horizontal sectors sizes
499+ * @y_sect_size: Vertical sectors sizes
500+ */
501+struct rppx1_lsc_params {
502+ struct v4l2_isp_params_block_header header;
503+ __u16 r_data[RPPX1_LSC_SAMPLES_MAX][RPPX1_LSC_SAMPLES_MAX];
504+ __u16 gr_data[RPPX1_LSC_SAMPLES_MAX][RPPX1_LSC_SAMPLES_MAX];
505+ __u16 gb_data[RPPX1_LSC_SAMPLES_MAX][RPPX1_LSC_SAMPLES_MAX];
506+ __u16 b_data[RPPX1_LSC_SAMPLES_MAX][RPPX1_LSC_SAMPLES_MAX];
507+ __u16 x_grad[RPPX1_LSC_NUM_SECTORS];
508+ __u16 y_grad[RPPX1_LSC_NUM_SECTORS];
509+ __u16 x_sect_size[RPPX1_LSC_NUM_SECTORS];
510+ __u16 y_sect_size[RPPX1_LSC_NUM_SECTORS];
511+};
512+
463513 /**
464514 * RPPX1_PARAMS_MAX_SIZE - Maximum size of all RPP-X1 parameter blocks
465515 *
@@ -478,7 +528,9 @@ struct rppx1_ccor_params { · 12 unmodified lines
478528 sizeof(struct rppx1_hist_params) + \
479529 sizeof(struct rppx1_bls_params) + \
480530 sizeof(struct rppx1_bls_params) + \
481− sizeof(struct rppx1_ccor_params))
531+ sizeof(struct rppx1_ccor_params) + \
532+ sizeof(struct rppx1_lsc_params) + \
533+ sizeof(struct rppx1_lsc_params))
482534
483535 /* ---------------------------------------------------------------------------
484536 * Statistics Structures

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t