.. | .. |
---|
6 | 6 | * |
---|
7 | 7 | * Hawkview ISP - isp_rolloff.h module |
---|
8 | 8 | * |
---|
9 | | - * Copyright (c) 2016 by Allwinnertech Co., Ltd. http://www.allwinnertech.com |
---|
| 9 | + * Copyright (c) 2021 by Allwinnertech Co., Ltd. http://www.allwinnertech.com |
---|
10 | 10 | * |
---|
11 | 11 | * Version Author Date Description |
---|
12 | | - * 3.0 Yang Feng 2015/10/22 ISP Tuning Tools Support |
---|
13 | | - * 3.1 Yang Feng 2016/03/29 VIDEO INPUT |
---|
| 12 | + * 4.0 guoqiuwang 2021/09/30 VIDEO INPUT |
---|
14 | 13 | * |
---|
15 | 14 | ***************************************************************************** |
---|
16 | 15 | */ |
---|
.. | .. |
---|
18 | 17 | #ifndef _ISP_3A_ROLLOFF_H_ |
---|
19 | 18 | #define _ISP_3A_ROLLOFF_H_ |
---|
20 | 19 | |
---|
21 | | -#define ISP_LIB_USE_ROLLOFF 0 |
---|
| 20 | +#if (ISP_VERSION == 522) |
---|
| 21 | +#define ISP_LIB_USE_ROLLOFF 1 |
---|
| 22 | +#endif |
---|
| 23 | + |
---|
| 24 | +#define CORRECTFREQ 6 |
---|
| 25 | +#define ROLLOFFSTART (5 * CORRECTFREQ) |
---|
| 26 | + |
---|
| 27 | +#define TH_FROSTEDGLASS 0.018 /* 0.025 */ |
---|
| 28 | +#define TH_LOWLIGHT 35 |
---|
| 29 | +#define TH_COMPLEX 0.55 |
---|
| 30 | +#define TH_HIGHSAT 0.63 |
---|
| 31 | +#define TH_SEMIFLAT 0.045 /* 0.045 */ |
---|
| 32 | +#define TH_MAXPERCENTAGE 0.95 /* 0.95 * 256 */ |
---|
| 33 | +#define TH_THRATIO 0.11 /* 0.11 * 256 */ |
---|
| 34 | +#define TH_DARKPIXEL 20 |
---|
| 35 | +#define TH_BRIGHTPIXEL 240 |
---|
| 36 | +#define TH_AREAOPENNUMBER 60 |
---|
| 37 | +#define TH_FLATGRADRG 0.026 |
---|
| 38 | +#define TH_RGDIFFPEAK 0.18 /* 0.18 */ |
---|
| 39 | +#define TH_AREAOPENNUMBER2 40 |
---|
| 40 | +#define TH_HIGHPERCENTAGE 0.85 /* 0.85 * 256 */ |
---|
| 41 | +#define TH_LOWPERCENTAGE 0.15 /* 0.15 * 256 */ |
---|
| 42 | +#define TH_ERRBASEDIFF 0.1 |
---|
| 43 | +#define TH_FLATSTDY 70 |
---|
| 44 | +#define TH_FLATMEANY 210 |
---|
| 45 | +#define TH_FLATRANGERG 0.24 |
---|
| 46 | +#define TH_DIFFA 15 |
---|
| 47 | +#define TH_DIFFB 10 |
---|
| 48 | +#define TH_SATURATION 0.53 |
---|
| 49 | +#define TH_LOWSATURATION 0.25 |
---|
| 50 | +#define TH_ERRGAINDIFF 0.03 |
---|
| 51 | + |
---|
| 52 | +#define Y_WEIGHT_R 0.299 /* 0.299 * 1024 */ |
---|
| 53 | +#define Y_WEIGHT_G 0.587 /* 0.587 * 1024 */ |
---|
| 54 | +#define Y_WEIGHT_B 0.114 /* 0.114 * 1024 */ |
---|
| 55 | + |
---|
| 56 | +#define TWICE_CORRECT_TABLE_NUM 11 |
---|
| 57 | + |
---|
| 58 | +#define RATIOEDGE 2 |
---|
| 59 | + |
---|
| 60 | +#define ROLLOFF_ROW_SIZE 32 |
---|
| 61 | +#define ROLLOFF_COL_SIZE 32 |
---|
| 62 | +#define ROLLOFF_WIN_SIZE (ROLLOFF_ROW_SIZE * ROLLOFF_COL_SIZE) |
---|
| 63 | + |
---|
| 64 | +#define CENTERX 15 |
---|
| 65 | +#define CENTERY 16 |
---|
| 66 | + |
---|
| 67 | +#define LSCGAINPOOLSIZE 64 |
---|
| 68 | + |
---|
| 69 | + |
---|
| 70 | +typedef struct Point { |
---|
| 71 | + HW_S32 row; |
---|
| 72 | + HW_S32 col; |
---|
| 73 | +} Point_t; |
---|
| 74 | + |
---|
| 75 | +typedef struct Lab { |
---|
| 76 | + float Lab_L; |
---|
| 77 | + float Lab_a; |
---|
| 78 | + float Lab_b; |
---|
| 79 | +} Lab_t; |
---|
| 80 | +typedef struct notFlatPointInfo { |
---|
| 81 | + Lab_t Lab; |
---|
| 82 | + HW_S32 position; |
---|
| 83 | +} notFlatPointInfo_t; |
---|
| 84 | + |
---|
| 85 | +typedef struct flatPointInfo { |
---|
| 86 | + HW_U16 position; |
---|
| 87 | + float _RG; |
---|
| 88 | + float Lab_L; |
---|
| 89 | + float Lab_a; |
---|
| 90 | + float Lab_b; |
---|
| 91 | +} flatPointInfo_t; |
---|
| 92 | + |
---|
| 93 | +typedef struct flatPointDistTOGain { |
---|
| 94 | + HW_U8 dist; |
---|
| 95 | + float gain; |
---|
| 96 | +} flatPointDistToGain_t; |
---|
| 97 | + |
---|
| 98 | +typedef struct flatDistToGain { |
---|
| 99 | + float *gain; |
---|
| 100 | +} flatDistToGain_t; |
---|
| 101 | + |
---|
| 102 | +typedef struct LscGainPool { |
---|
| 103 | + float *LscRGain; |
---|
| 104 | + float *LscGGain; |
---|
| 105 | + float *LscBGain; |
---|
| 106 | +} LscGainPool_t; |
---|
| 107 | + |
---|
| 108 | +typedef enum rolloff_correct_mode { |
---|
| 109 | + RGBChCorrect = 0, |
---|
| 110 | + PreCorrect, |
---|
| 111 | + RChCorrect, |
---|
| 112 | + TwiceCorrect, |
---|
| 113 | +} rolloff_correct_mode_t; |
---|
| 114 | + |
---|
| 115 | +typedef struct FlatPreCorrectInfo { |
---|
| 116 | + float flatPreIndex; |
---|
| 117 | + float flatPreDiff; |
---|
| 118 | +} flatPreCorrectInfo_t; |
---|
| 119 | + |
---|
22 | 120 | |
---|
23 | 121 | typedef enum isp_rolloff_param_type { |
---|
24 | 122 | ISP_ROLLOFF_INI_DATA, |
---|
25 | 123 | ISP_ROLLOFF_PARAM_TYPE_MAX, |
---|
26 | 124 | } rolloff_param_type_t; |
---|
| 125 | + |
---|
27 | 126 | typedef struct isp_rolloff_ini_cfg { |
---|
28 | | - int rolloff_ratio; |
---|
29 | | - unsigned short lens_table_ini[ISP_LENS_TBL_SIZE*3]; |
---|
| 127 | + HW_U16 Rgain[ROLLOFF_WIN_SIZE * 11]; |
---|
30 | 128 | } rolloff_ini_cfg_t; |
---|
| 129 | + |
---|
| 130 | +typedef enum rolloff_triger_type { |
---|
| 131 | + ROLLOFF_TRIGER_BY_LUM_IDX = 0, |
---|
| 132 | + ROLLOFF_TRIGER_BY_GAIN_IDX, |
---|
| 133 | + ROLLOFF_TRIGER_MAX, |
---|
| 134 | +} rolloff_triger_type_t; |
---|
| 135 | + |
---|
| 136 | +typedef struct isp_rolloff_iso_config { |
---|
| 137 | + rolloff_triger_type_t triger_type; |
---|
| 138 | + HW_S32 shading_comp_dynamic_cfg[14]; |
---|
| 139 | +} isp_rolloff_iso_config_t; |
---|
| 140 | + |
---|
| 141 | + |
---|
| 142 | +typedef struct isp_rolloff_setting { |
---|
| 143 | + HW_U16 smooth_pool_size; |
---|
| 144 | + HW_U16 th_tableSwitch; |
---|
| 145 | + HW_U16 frequency; |
---|
| 146 | + HW_U16 start; |
---|
| 147 | + HW_U16 th_lowLight; |
---|
| 148 | + HW_U16 th_complex; |
---|
| 149 | + HW_U16 th_highSat; |
---|
| 150 | + HW_U16 th_maxPercent; |
---|
| 151 | + HW_U16 th_thRatio; |
---|
| 152 | + HW_U16 th_semiFlat; |
---|
| 153 | + isp_rolloff_iso_config_t iso_config; |
---|
| 154 | +} isp_rolloff_setting_t; |
---|
31 | 155 | |
---|
32 | 156 | typedef struct isp_rolloff_param { |
---|
33 | 157 | rolloff_param_type_t type; |
---|
34 | | - int isp_platform_id; |
---|
35 | | - int rolloff_frame_id; |
---|
| 158 | + HW_S32 isp_platform_id; |
---|
| 159 | + HW_S32 rolloff_frame_id; |
---|
36 | 160 | isp_sensor_info_t rolloff_sensor_info; |
---|
37 | | - struct isp_lsc_config lsc_cfg; |
---|
38 | 161 | rolloff_ini_cfg_t rolloff_ini; |
---|
| 162 | + isp_rolloff_setting_t rolloff_ctrl; |
---|
39 | 163 | } rolloff_param_t; |
---|
40 | 164 | |
---|
41 | 165 | typedef struct isp_rolloff_stats { |
---|
.. | .. |
---|
43 | 167 | } rolloff_stats_t; |
---|
44 | 168 | |
---|
45 | 169 | typedef struct isp_rolloff_result { |
---|
46 | | - unsigned short lens_table_output[ISP_LENS_TBL_SIZE*3]; |
---|
| 170 | + float RGainTbl[ISP_LENS_TBL_SIZE]; |
---|
| 171 | + float GGainTbl[ISP_LENS_TBL_SIZE]; |
---|
| 172 | + float BGainTbl[ISP_LENS_TBL_SIZE]; |
---|
| 173 | + rolloff_correct_mode_t correctMode; |
---|
47 | 174 | } rolloff_result_t; |
---|
48 | 175 | |
---|
49 | 176 | typedef struct isp_rolloff_core_ops { |
---|
.. | .. |
---|
52 | 179 | HW_S32 (*isp_rolloff_run)(void *rolloff_core_obj, rolloff_stats_t *stats, rolloff_result_t *result); |
---|
53 | 180 | } isp_rolloff_core_ops_t; |
---|
54 | 181 | |
---|
55 | | -void* rolloff_init(isp_rolloff_core_ops_t **rolloff_core_ops); |
---|
| 182 | +void *rolloff_init(isp_rolloff_core_ops_t **rolloff_core_ops); |
---|
56 | 183 | void rolloff_exit(void *rolloff_core_obj); |
---|
57 | 184 | |
---|
58 | | - |
---|
59 | 185 | #endif /*_ISP_3A_ROLLOFF_H_*/ |
---|
60 | | - |
---|
61 | | - |
---|
62 | 186 | |
---|