| @@ -169,6 +169,13 @@ · 168 unmodified lines |
| 169 | */ | 169 | */ |
| 170 | #define RKISP1_CIF_ISP_COMPAND_NUM_POINTS 64 | 170 | #define RKISP1_CIF_ISP_COMPAND_NUM_POINTS 64 |
| 171 | | 171 | |
| | 172 | /* |
| | 173 | * Wide Dynamic Range |
| | 174 | */ |
| | 175 | #define RKISP1_CIF_ISP_WDR_CURVE_NUM_INTERV 32 |
| | 176 | #define RKISP1_CIF_ISP_WDR_CURVE_NUM_COEFF (RKISP1_CIF_ISP_WDR_CURVE_NUM_INTERV + 1) |
| | 177 | #define RKISP1_CIF_ISP_WDR_CURVE_NUM_DY_REGS 4 |
| | 178 | |
| 172 | /* | 179 | /* |
| 173 | * Measurement types | 180 | * Measurement types |
| 174 | */ | 181 | */ |
| @@ -889,6 +896,72 @@ struct rkisp1_cif_isp_compand_curve_config { · 714 unmodified lines |
| 889 | __u32 y[RKISP1_CIF_ISP_COMPAND_NUM_POINTS]; | 896 | __u32 y[RKISP1_CIF_ISP_COMPAND_NUM_POINTS]; |
| 890 | }; | 897 | }; |
| 891 | | 898 | |
| | 899 | /** |
| | 900 | * struct rkisp1_cif_isp_wdr_tone_curve - Tone mapping curve definition for WDR. |
| | 901 | * |
| | 902 | * @dY: the dYn increments for horizontal (input) axis of the tone curve. |
| | 903 | * each 3-bit dY value represents an increment of 2**(value+3). |
| | 904 | * dY[0] bits 0:2 is increment dY1, bit 3 unused |
| | 905 | * dY[0] bits 4:6 is increment dY2, bit 7 unused |
| | 906 | * ... |
| | 907 | * dY[0] bits 28:30 is increment dY8, bit 31 unused |
| | 908 | * ... and so on till dY[3] bits 28:30 is increment dY32, bit 31 unused. |
| | 909 | * @ym: the Ym values for the vertical (output) axis of the tone curve. |
| | 910 | * each value is 13 bit. |
| | 911 | */ |
| | 912 | struct rkisp1_cif_isp_wdr_tone_curve { |
| | 913 | __u32 dY[RKISP1_CIF_ISP_WDR_CURVE_NUM_DY_REGS]; |
| | 914 | __u16 ym[RKISP1_CIF_ISP_WDR_CURVE_NUM_COEFF]; |
| | 915 | }; |
| | 916 | |
| | 917 | /** |
| | 918 | * struct rkisp1_cif_isp_wdr_iref_config - Illumination reference config for WDR. |
| | 919 | * |
| | 920 | * Use illumination reference value as described below, instead of only the |
| | 921 | * luminance (Y) value for tone mapping and gain calculations: |
| | 922 | * IRef = (rgb_factor * RGBMax_tr + (8 - rgb_factor) * Y)/8 |
| | 923 | * |
| | 924 | * @rgb_factor: defines how much influence the RGBmax approach has in |
| | 925 | * comparison to Y (valid values are 0..8). |
| | 926 | * @use_y9_8: use Y*9/8 for maximum value calculation along with the |
| | 927 | * default of R, G, B for noise reduction. |
| | 928 | * @use_rgb7_8: decrease RGBMax by 7/8 for noise reduction. |
| | 929 | * @disable_transient: disable transient calculation between Y and RGBY_max. |
| | 930 | */ |
| | 931 | struct rkisp1_cif_isp_wdr_iref_config { |
| | 932 | __u8 rgb_factor; |
| | 933 | __u8 use_y9_8; |
| | 934 | __u8 use_rgb7_8; |
| | 935 | __u8 disable_transient; |
| | 936 | }; |
| | 937 | |
| | 938 | /** |
| | 939 | * struct rkisp1_cif_isp_wdr_config - Configuration for wide dynamic range. |
| | 940 | * |
| | 941 | * @tone_curve: tone mapping curve. |
| | 942 | * @iref_config: illumination reference configuration. (when use_iref is true) |
| | 943 | * @rgb_offset: RGB offset value for RGB operation mode. (12 bits) |
| | 944 | * @luma_offset: luminance offset value for RGB operation mode. (12 bits) |
| | 945 | * @dmin_thresh: lower threshold for deltaMin value. (12 bits) |
| | 946 | * @dmin_strength: strength factor for deltaMin. (valid range is 0x00..0x10) |
| | 947 | * @use_rgb_colorspace: use RGB instead of luminance/chrominance colorspace. |
| | 948 | * @bypass_chroma_mapping: disable chrominance mapping (only valid if |
| | 949 | * use_rgb_colorspace = 0) |
| | 950 | * @use_iref: use illumination reference instead of Y for tone mapping |
| | 951 | * and gain calculations. |
| | 952 | */ |
| | 953 | struct rkisp1_cif_isp_wdr_config { |
| | 954 | struct rkisp1_cif_isp_wdr_tone_curve tone_curve; |
| | 955 | struct rkisp1_cif_isp_wdr_iref_config iref_config; |
| | 956 | __u16 rgb_offset; |
| | 957 | __u16 luma_offset; |
| | 958 | __u16 dmin_thresh; |
| | 959 | __u8 dmin_strength; |
| | 960 | __u8 use_rgb_colorspace; |
| | 961 | __u8 bypass_chroma_mapping; |
| | 962 | __u8 use_iref; |
| | 963 | }; |
| | 964 | |
| 892 | /*---------- PART2: Measurement Statistics ------------*/ | 965 | /*---------- PART2: Measurement Statistics ------------*/ |
| 893 | | 966 | |
| 894 | /** | 967 | /** |
| @@ -1059,6 +1132,7 @@ struct rkisp1_stat_buffer { · 164 unmodified lines |
| 1059 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS: BLS in the compand block | 1132 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS: BLS in the compand block |
| 1060 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND: Companding expand curve | 1133 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND: Companding expand curve |
| 1061 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS: Companding compress curve | 1134 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS: Companding compress curve |
| | 1135 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR: Wide dynamic range |
| 1062 | */ | 1136 | */ |
| 1063 | enum rkisp1_ext_params_block_type { | 1137 | enum rkisp1_ext_params_block_type { |
| 1064 | RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS, | 1138 | RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS, |
| @@ -1081,11 +1155,15 @@ enum rkisp1_ext_params_block_type { · 16 unmodified lines |
| 1081 | RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS, | 1155 | RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS, |
| 1082 | RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND, | 1156 | RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND, |
| 1083 | RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS, | 1157 | RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS, |
| | 1158 | RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR, |
| 1084 | }; | 1159 | }; |
| 1085 | | 1160 | |
| 1086 | #define RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE (1U << 0) | 1161 | #define RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE (1U << 0) |
| 1087 | #define RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE (1U << 1) | 1162 | #define RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE (1U << 1) |
| 1088 | | 1163 | |
| | 1164 | /* A bitmask of parameters blocks supported on the current hardware. */ |
| | 1165 | #define RKISP1_CID_SUPPORTED_PARAMS_BLOCKS (V4L2_CID_USER_RKISP1_BASE + 0x01) |
| | 1166 | |
| 1089 | /** | 1167 | /** |
| 1090 | * struct rkisp1_ext_params_block_header - RkISP1 extensible parameters block | 1168 | * struct rkisp1_ext_params_block_header - RkISP1 extensible parameters block |
| 1091 | * header | 1169 | * header |
| @@ -1460,6 +1538,23 @@ struct rkisp1_ext_params_compand_curve_config { · 368 unmodified lines |
| 1460 | struct rkisp1_cif_isp_compand_curve_config config; | 1538 | struct rkisp1_cif_isp_compand_curve_config config; |
| 1461 | } __attribute__((aligned(8))); | 1539 | } __attribute__((aligned(8))); |
| 1462 | | 1540 | |
| | 1541 | /** |
| | 1542 | * struct rkisp1_ext_params_wdr_config - RkISP1 extensible params |
| | 1543 | * Wide dynamic range config |
| | 1544 | * |
| | 1545 | * RkISP1 extensible parameters WDR block. |
| | 1546 | * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR` |
| | 1547 | * |
| | 1548 | * @header: The RkISP1 extensible parameters header, see |
| | 1549 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1550 | * @config: WDR configuration, see |
| | 1551 | * :c:type:`rkisp1_cif_isp_wdr_config` |
| | 1552 | */ |
| | 1553 | struct rkisp1_ext_params_wdr_config { |
| | 1554 | struct rkisp1_ext_params_block_header header; |
| | 1555 | struct rkisp1_cif_isp_wdr_config config; |
| | 1556 | } __attribute__((aligned(8))); |
| | 1557 | |
| 1463 | /* | 1558 | /* |
| 1464 | * The rkisp1_ext_params_compand_curve_config structure is counted twice as it | 1559 | * The rkisp1_ext_params_compand_curve_config structure is counted twice as it |
| 1465 | * is used for both the COMPAND_EXPAND and COMPAND_COMPRESS block types. | 1560 | * is used for both the COMPAND_EXPAND and COMPAND_COMPRESS block types. |
| @@ -1484,7 +1579,8 @@ struct rkisp1_ext_params_compand_curve_config { · 18 unmodified lines |
| 1484 | sizeof(struct rkisp1_ext_params_afc_config) +\ | 1579 | sizeof(struct rkisp1_ext_params_afc_config) +\ |
| 1485 | sizeof(struct rkisp1_ext_params_compand_bls_config) +\ | 1580 | sizeof(struct rkisp1_ext_params_compand_bls_config) +\ |
| 1486 | sizeof(struct rkisp1_ext_params_compand_curve_config) +\ | 1581 | sizeof(struct rkisp1_ext_params_compand_curve_config) +\ |
| 1487 | sizeof(struct rkisp1_ext_params_compand_curve_config)) | 1582 | sizeof(struct rkisp1_ext_params_compand_curve_config) +\ |
| | 1583 | sizeof(struct rkisp1_ext_params_wdr_config)) |
| 1488 | | 1584 | |
| 1489 | /** | 1585 | /** |
| 1490 | * enum rksip1_ext_param_buffer_version - RkISP1 extensible parameters version | 1586 | * enum rksip1_ext_param_buffer_version - RkISP1 extensible parameters version |
| @@ -1520,6 +1616,14 @@ enum rksip1_ext_param_buffer_version { · 29 unmodified lines |
| 1520 | * V4L2 control. If such control is not available, userspace should assume only | 1616 | * V4L2 control. If such control is not available, userspace should assume only |
| 1521 | * RKISP1_EXT_PARAM_BUFFER_V1 is supported by the driver. | 1617 | * RKISP1_EXT_PARAM_BUFFER_V1 is supported by the driver. |
| 1522 | * | 1618 | * |
| | 1619 | * The read-only V4L2 control ``RKISP1_CID_SUPPORTED_PARAMS_BLOCKS`` can be used |
| | 1620 | * to query the blocks supported by the device. It contains a bitmask where each |
| | 1621 | * bit represents the availability of the corresponding entry from the |
| | 1622 | * :c:type:`rkisp1_ext_params_block_type` enum. The current and default values |
| | 1623 | * of the control represents the blocks supported by the device instance, while |
| | 1624 | * the maximum value represents the blocks supported by the kernel driver, |
| | 1625 | * independently of the device instance. |
| | 1626 | * |
| 1523 | * For each ISP block that userspace wants to configure, a block-specific | 1627 | * For each ISP block that userspace wants to configure, a block-specific |
| 1524 | * structure is appended to the @data buffer, one after the other without gaps | 1628 | * structure is appended to the @data buffer, one after the other without gaps |
| 1525 | * in between nor overlaps. Userspace shall populate the @data_size field with | 1629 | * in between nor overlaps. Userspace shall populate the @data_size field with |