History

media: rockchip: rkisp1: Add support for Wide Dynamic Range

RKISP supports a basic Wide Dynamic Range (WDR) module since the first iteration (v1.0) of the ISP. Add support for enabling and configuring it using extensible parameters. Also, to ease programming, switch to using macro variables for defining the tonemapping curve register addresses.

Jai Luthra committed 1 year ago

Commit cd403e81 parent 7c8c9573 files · +212 −75Browse files

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

Unified · Split

include/uapi/linux/rkisp1-config.h+94−1
@@ -169,6 +169,13 @@ · 168 unmodified lines
169 */169 */
170#define RKISP1_CIF_ISP_COMPAND_NUM_POINTS 64170#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 types180 * 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 */
912struct 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 */
931struct 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 */
953struct 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 block1132 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS: BLS in the compand block
1060 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND: Companding expand curve1133 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND: Companding expand curve
1061 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS: Companding compress curve1134 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS: Companding compress curve
1135 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR: Wide dynamic range
1062 */1136 */
1063enum rkisp1_ext_params_block_type {1137enum rkisp1_ext_params_block_type {
1064 RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS,1138 RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS,
@@ -1081,6 +1155,7 @@ 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)
@@ -1463,6 +1538,23 @@ struct rkisp1_ext_params_compand_curve_config { · 376 unmodified lines
1463 struct rkisp1_cif_isp_compand_curve_config config;1538 struct rkisp1_cif_isp_compand_curve_config config;
1464} __attribute__((aligned(8)));1539} __attribute__((aligned(8)));
1465 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 */
1553struct 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
1466/*1558/*
1467 * The rkisp1_ext_params_compand_curve_config structure is counted twice as it1559 * The rkisp1_ext_params_compand_curve_config structure is counted twice as it
1468 * 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.
@@ -1487,7 +1579,8 @@ struct rkisp1_ext_params_compand_curve_config { · 18 unmodified lines
1487 sizeof(struct rkisp1_ext_params_afc_config) +\1579 sizeof(struct rkisp1_ext_params_afc_config) +\
1488 sizeof(struct rkisp1_ext_params_compand_bls_config) +\1580 sizeof(struct rkisp1_ext_params_compand_bls_config) +\
1489 sizeof(struct rkisp1_ext_params_compand_curve_config) +\1581 sizeof(struct rkisp1_ext_params_compand_curve_config) +\
1490 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))
1491 1584
1492/**1585/**
1493 * enum rksip1_ext_param_buffer_version - RkISP1 extensible parameters version1586 * enum rksip1_ext_param_buffer_version - RkISP1 extensible parameters version

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