1 /****************************************************************************** 2 * 3 * Copyright 2019, Fuzhou Rockchip Electronics Co.Ltd . All rights reserved. 4 * No part of this work may be reproduced, modified, distributed, transmitted, 5 * transcribed, or translated into any language or computer format, in any form 6 * or by any means without written permission of: 7 * Fuzhou Rockchip Electronics Co.Ltd . 8 * 9 * 10 *****************************************************************************/ 11 #ifndef __RK_AIQ_TYPES_ATMO_ALGO_INT_H__ 12 #define __RK_AIQ_TYPES_ATMO_ALGO_INT_H__ 13 14 #include "RkAiqCalibDbTypes.h" 15 #include "atmo_head.h" 16 17 typedef struct globalLuma_s 18 { 19 GlobalLumaMode_t globalLumaMode; 20 float* EnvLv; 21 int len; 22 float* ISO; 23 float Tolerance; 24 float* GlobeLuma; 25 } globalLuma_t ; 26 27 typedef struct detailsHighLight_s 28 { 29 DetailsHighLightMode_t DetailsHighLightMode; 30 float* OEPdf; 31 int len; 32 float* EnvLv; 33 float Tolerance; 34 float* DetailsHighLight; 35 36 } detailsHighLight_t ; 37 38 typedef struct detailsLowLight_s 39 { 40 DetailsLowLightMode_t DetailsLowLightMode; 41 float* FocusLuma; 42 int len; 43 float* DarkPdf; 44 float* ISO;//use long frame 45 float Tolerance; 46 float* DetailsLowLight; 47 48 } detailsLowLight_t ; 49 50 typedef struct localtmo_s 51 { 52 TmoTypeMode_t localtmoMode; 53 float* DynamicRange; 54 int len; 55 float* EnvLv; 56 float Tolerance; 57 float* LocalTmoStrength; 58 } localtmo_t ; 59 60 typedef struct globaltmo_s 61 { 62 bool isHdrGlobalTmo; 63 TmoTypeMode_t mode; 64 float iir; 65 float* DynamicRange; 66 int len; 67 float* EnvLv; 68 float Tolerance; 69 float* GlobalTmoStrength; 70 } globaltmo_t; 71 72 typedef struct AtmoConfig_s { 73 bool bTmoEn; 74 bool isLinearTmo; 75 globalLuma_t Luma; 76 detailsHighLight_t DtsHiLit; 77 detailsLowLight_t DtsLoLit; 78 globaltmo_t global; 79 localtmo_t local; 80 float damp; 81 } AtmoConfig_t; 82 83 typedef struct tmoCtrlData_s 84 { 85 float stCoef; 86 float stCoefMax; 87 float stCoefMin; 88 int stMax; 89 int stMin; 90 } tmoCtrlData_t; 91 92 typedef struct AGlobalTmoData_s 93 { 94 bool en; 95 float stCoef; 96 float stCoefMax; 97 float stCoefMin; 98 int stMax; 99 int stMin; 100 } AGlobalTmoData_t; 101 102 typedef struct atmoAttr_s 103 { 104 tmoCtrlData_t stGlobeLuma; 105 tmoCtrlData_t stDtlsLL; 106 tmoCtrlData_t stDtlsHL; 107 tmoCtrlData_t stLocalTMO; 108 AGlobalTmoData_t stGlobalTMO; 109 } atmoAttr_t; 110 111 typedef struct mtmoAttr_s 112 { 113 bool Enable; 114 float stGlobeLuma; 115 float stDtlsHL; 116 float stDtlsLL; 117 float stLocalTMOStrength; 118 float stGlobalTMOStrength; 119 float damp; 120 } mtmoAttr_t; 121 122 typedef struct atmoAttr_V2_s 123 { 124 bool bUpdateTmo; 125 atmoAttr_t stTmoAuto; 126 } atmoAttr_V2_t; 127 128 typedef struct mtmoAttr_V2_s 129 { 130 bool bUpdateTmo; 131 mtmoAttr_t stTmoManual; 132 } mtmoAttr_V2_t; 133 134 typedef enum tmo_OpMode_s { 135 TMO_OPMODE_API_OFF = 0, // run IQ ahdr 136 TMO_OPMODE_AUTO = 1, //run api auto ahdr 137 TMO_OPMODE_MANU = 2, //run api manual ahdr 138 TMO_OPMODE_SET_LEVEL = 3, // its prevously fast mode, run api set level 139 TMO_OPMODE_DARKAREA = 4, // for dark area luma inprove, no matter the scene is night, normal, or hdr 140 TMO_OPMODE_TOOL = 5, // for dark area luma inprove, no matter the scene is night, normal, or hdr 141 } tmo_OpMode_t; 142 143 typedef struct TmoCurrCtlData_s 144 { 145 GlobalLumaMode_t GlobalLumaMode; 146 DetailsHighLightMode_t DetailsHighLightMode; 147 DetailsLowLightMode_t DetailsLowLightMode; 148 TmoTypeMode_t GlobalTmoMode; 149 TmoTypeMode_t LocalTMOMode; 150 float Envlv; 151 float ISO; 152 float OEPdf; 153 float FocusLuma; 154 float DarkPdf; 155 float DynamicRange; 156 } TmoCurrCtlData_t; 157 158 typedef struct TmoCurrRegData_s 159 { 160 float GlobalLuma; 161 float DetailsLowlight; 162 float DetailsHighlight; 163 float LocalTmoStrength; 164 float GlobaltmoStrength; 165 } TmoCurrRegData_t; 166 167 typedef struct DarkArea_s 168 { 169 int level; 170 } DarkArea_t; 171 172 typedef struct FastMode_s 173 { 174 int level; 175 } FastMode_t; 176 177 typedef struct tmoAttr_s 178 { 179 tmo_OpMode_t opMode; 180 atmoAttr_V2_t stAuto; 181 mtmoAttr_V2_t stManual; 182 FastMode_t stSetLevel; 183 DarkArea_t stDarkArea; 184 TmoCurrCtlData_t CtlInfo; 185 TmoCurrRegData_t RegInfo; 186 CalibDbV2_tmo_t stTool; 187 } tmoAttr_t; 188 189 typedef struct TmoProcRes_s 190 { 191 unsigned short sw_hdrtmo_cnt_vsize; 192 unsigned char sw_hdrtmo_gain_ld_off2; 193 unsigned char sw_hdrtmo_gain_ld_off1; 194 unsigned char sw_hdrtmo_big_en; 195 unsigned char sw_hdrtmo_nobig_en; 196 unsigned char sw_hdrtmo_newhist_en; 197 unsigned char sw_hdrtmo_cnt_mode; 198 unsigned short sw_hdrtmo_expl_lgratio; 199 unsigned char sw_hdrtmo_lgscl_ratio; 200 unsigned char sw_hdrtmo_cfg_alpha; 201 unsigned short sw_hdrtmo_set_gainoff; 202 unsigned short sw_hdrtmo_set_palpha; 203 unsigned short sw_hdrtmo_set_lgmax; 204 unsigned short sw_hdrtmo_set_lgmin; 205 unsigned char sw_hdrtmo_set_weightkey; 206 unsigned short sw_hdrtmo_set_lgmean; 207 unsigned short sw_hdrtmo_set_lgrange1; 208 unsigned short sw_hdrtmo_set_lgrange0; 209 unsigned short sw_hdrtmo_set_lgavgmax; 210 unsigned char sw_hdrtmo_clipgap1; 211 unsigned char sw_hdrtmo_clipgap0; 212 unsigned char sw_hdrtmo_clipratio1; 213 unsigned char sw_hdrtmo_clipratio0; 214 unsigned char sw_hdrtmo_ratiol; 215 unsigned short sw_hdrtmo_lgscl_inv; 216 unsigned short sw_hdrtmo_lgscl; 217 unsigned short sw_hdrtmo_lgmax; 218 unsigned short sw_hdrtmo_hist_low; 219 unsigned short sw_hdrtmo_hist_min; 220 unsigned char sw_hdrtmo_hist_shift; 221 unsigned short sw_hdrtmo_hist_0p3; 222 unsigned short sw_hdrtmo_hist_high; 223 unsigned short sw_hdrtmo_palpha_lwscl; 224 unsigned short sw_hdrtmo_palpha_lw0p5; 225 unsigned short sw_hdrtmo_palpha_0p18; 226 unsigned short sw_hdrtmo_maxgain; 227 unsigned short sw_hdrtmo_maxpalpha; 228 } TmoProcRes_t; 229 230 typedef struct PredictPara_s 231 { 232 bool Scenestable; 233 int K_Rolgmean; 234 int iir; 235 int iir_max; 236 int global_tmo_strength; 237 int cnt_mode; 238 int cnt_vsize; 239 } PredictPara_t; 240 241 typedef struct PredictKPara_s 242 { 243 float correction_factor; 244 float correction_offset; 245 float Hdr3xLongPercent; 246 float UseLongUpTh; 247 float UseLongLowTh; 248 249 } PredictKPara_t; 250 251 typedef struct TmoFlickerPara_s 252 { 253 int cnt_mode; 254 int cnt_vsize; 255 bool GlobalTmoStrengthDown; 256 float GlobalTmoStrength; 257 float LumaDeviation[3]; 258 float StableThr; 259 int iir; 260 int iirmax; 261 int height; 262 int width; 263 PredictKPara_t PredictK; 264 } TmoFlickerPara_t; 265 266 typedef struct RkAiqAtmoProcResult_s 267 { 268 TmoProcRes_t Res; 269 tmoAttr_t hdrAttr; 270 bool LongFrameMode; 271 bool isHdrGlobalTmo; 272 bool bTmoEn; 273 bool isLinearTmo; 274 TmoFlickerPara_t TmoFlicker; 275 PredictPara_t Predict; 276 } RkAiqAtmoProcResult_t; 277 278 279 #endif 280