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.
Showing the changes to include/uapi (1 of 4 files). Show all
Unified · Split
| @@ -88,6 +88,8 @@ enum rppx1_meas_chan { · 87 unmodified lines | |||
| 88 | * @RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE1: PRE1 pipe Black Level Subtraction | 88 | * @RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE1: PRE1 pipe Black Level Subtraction |
| 89 | * @RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE2: PRE2 pipe Black Level Subtraction | 89 | * @RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE2: PRE2 pipe Black Level Subtraction |
| 90 | * @RPPX1_PARAMS_BLOCK_TYPE_CCOR_POST: POST pipe Color Correction | 90 | * @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 | ||
| 91 | */ | 93 | */ |
| 92 | enum rppx1_params_block_type { | 94 | enum rppx1_params_block_type { |
| 93 | RPPX1_PARAMS_BLOCK_TYPE_WBMEAS_POST, | 95 | RPPX1_PARAMS_BLOCK_TYPE_WBMEAS_POST, |
| @@ -102,6 +104,8 @@ enum rppx1_params_block_type { · 8 unmodified lines | |||
| 102 | RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE1, | 104 | RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE1, |
| 103 | RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE2, | 105 | RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE2, |
| 104 | RPPX1_PARAMS_BLOCK_TYPE_CCOR_POST, | 106 | RPPX1_PARAMS_BLOCK_TYPE_CCOR_POST, |
| 107 | RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE1, | ||
| 108 | RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE2, | ||
| 105 | }; | 109 | }; |
| 106 | 110 | ||
| 107 | /** | 111 | /** |
| @@ -460,6 +464,52 @@ struct rppx1_ccor_params { · 352 unmodified lines | |||
| 460 | __u32 offset[3]; | 464 | __u32 offset[3]; |
| 461 | }; | 465 | }; |
| 462 | 466 | ||
| 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 | |||
| 463 | /** | 513 | /** |
| 464 | * RPPX1_PARAMS_MAX_SIZE - Maximum size of all RPP-X1 parameter blocks | 514 | * RPPX1_PARAMS_MAX_SIZE - Maximum size of all RPP-X1 parameter blocks |
| 465 | * | 515 | * |
| @@ -478,7 +528,9 @@ struct rppx1_ccor_params { · 12 unmodified lines | |||
| 478 | sizeof(struct rppx1_hist_params) + \ | 528 | sizeof(struct rppx1_hist_params) + \ |
| 479 | sizeof(struct rppx1_bls_params) + \ | 529 | sizeof(struct rppx1_bls_params) + \ |
| 480 | sizeof(struct rppx1_bls_params) + \ | 530 | 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)) | ||
| 482 | 534 | ||
| 483 | /* --------------------------------------------------------------------------- | 535 | /* --------------------------------------------------------------------------- |
| 484 | * Statistics Structures | 536 | * Statistics Structures |