From d9927380ed7c8366f762049be9f3fee225860833 Mon Sep 17 00:00:00 2001 From: liyujie <2352380935@qq.com> Date: Thu, 28 Aug 2025 12:04:16 +0000 Subject: [PATCH] [2/4]解决USB摄像头打开相机预览界面绿屏 --- android/hardware/aw/camera/3_4/allwinnertech/libAWIspApi/libisp_new/include/isp_rolloff.h | 152 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 138 insertions(+), 14 deletions(-) diff --git a/android/hardware/aw/camera/3_4/allwinnertech/libAWIspApi/libisp_new/include/isp_rolloff.h b/android/hardware/aw/camera/3_4/allwinnertech/libAWIspApi/libisp_new/include/isp_rolloff.h index 405dd3b..03acf26 100755 --- a/android/hardware/aw/camera/3_4/allwinnertech/libAWIspApi/libisp_new/include/isp_rolloff.h +++ b/android/hardware/aw/camera/3_4/allwinnertech/libAWIspApi/libisp_new/include/isp_rolloff.h @@ -6,11 +6,10 @@ * * Hawkview ISP - isp_rolloff.h module * - * Copyright (c) 2016 by Allwinnertech Co., Ltd. http://www.allwinnertech.com + * Copyright (c) 2021 by Allwinnertech Co., Ltd. http://www.allwinnertech.com * * Version Author Date Description - * 3.0 Yang Feng 2015/10/22 ISP Tuning Tools Support - * 3.1 Yang Feng 2016/03/29 VIDEO INPUT + * 4.0 guoqiuwang 2021/09/30 VIDEO INPUT * ***************************************************************************** */ @@ -18,24 +17,149 @@ #ifndef _ISP_3A_ROLLOFF_H_ #define _ISP_3A_ROLLOFF_H_ -#define ISP_LIB_USE_ROLLOFF 0 +#if (ISP_VERSION == 522) +#define ISP_LIB_USE_ROLLOFF 1 +#endif + +#define CORRECTFREQ 6 +#define ROLLOFFSTART (5 * CORRECTFREQ) + +#define TH_FROSTEDGLASS 0.018 /* 0.025 */ +#define TH_LOWLIGHT 35 +#define TH_COMPLEX 0.55 +#define TH_HIGHSAT 0.63 +#define TH_SEMIFLAT 0.045 /* 0.045 */ +#define TH_MAXPERCENTAGE 0.95 /* 0.95 * 256 */ +#define TH_THRATIO 0.11 /* 0.11 * 256 */ +#define TH_DARKPIXEL 20 +#define TH_BRIGHTPIXEL 240 +#define TH_AREAOPENNUMBER 60 +#define TH_FLATGRADRG 0.026 +#define TH_RGDIFFPEAK 0.18 /* 0.18 */ +#define TH_AREAOPENNUMBER2 40 +#define TH_HIGHPERCENTAGE 0.85 /* 0.85 * 256 */ +#define TH_LOWPERCENTAGE 0.15 /* 0.15 * 256 */ +#define TH_ERRBASEDIFF 0.1 +#define TH_FLATSTDY 70 +#define TH_FLATMEANY 210 +#define TH_FLATRANGERG 0.24 +#define TH_DIFFA 15 +#define TH_DIFFB 10 +#define TH_SATURATION 0.53 +#define TH_LOWSATURATION 0.25 +#define TH_ERRGAINDIFF 0.03 + +#define Y_WEIGHT_R 0.299 /* 0.299 * 1024 */ +#define Y_WEIGHT_G 0.587 /* 0.587 * 1024 */ +#define Y_WEIGHT_B 0.114 /* 0.114 * 1024 */ + +#define TWICE_CORRECT_TABLE_NUM 11 + +#define RATIOEDGE 2 + +#define ROLLOFF_ROW_SIZE 32 +#define ROLLOFF_COL_SIZE 32 +#define ROLLOFF_WIN_SIZE (ROLLOFF_ROW_SIZE * ROLLOFF_COL_SIZE) + +#define CENTERX 15 +#define CENTERY 16 + +#define LSCGAINPOOLSIZE 64 + + +typedef struct Point { + HW_S32 row; + HW_S32 col; +} Point_t; + +typedef struct Lab { + float Lab_L; + float Lab_a; + float Lab_b; +} Lab_t; +typedef struct notFlatPointInfo { + Lab_t Lab; + HW_S32 position; +} notFlatPointInfo_t; + +typedef struct flatPointInfo { + HW_U16 position; + float _RG; + float Lab_L; + float Lab_a; + float Lab_b; +} flatPointInfo_t; + +typedef struct flatPointDistTOGain { + HW_U8 dist; + float gain; +} flatPointDistToGain_t; + +typedef struct flatDistToGain { + float *gain; +} flatDistToGain_t; + +typedef struct LscGainPool { + float *LscRGain; + float *LscGGain; + float *LscBGain; +} LscGainPool_t; + +typedef enum rolloff_correct_mode { + RGBChCorrect = 0, + PreCorrect, + RChCorrect, + TwiceCorrect, +} rolloff_correct_mode_t; + +typedef struct FlatPreCorrectInfo { + float flatPreIndex; + float flatPreDiff; +} flatPreCorrectInfo_t; + typedef enum isp_rolloff_param_type { ISP_ROLLOFF_INI_DATA, ISP_ROLLOFF_PARAM_TYPE_MAX, } rolloff_param_type_t; + typedef struct isp_rolloff_ini_cfg { - int rolloff_ratio; - unsigned short lens_table_ini[ISP_LENS_TBL_SIZE*3]; + HW_U16 Rgain[ROLLOFF_WIN_SIZE * 11]; } rolloff_ini_cfg_t; + +typedef enum rolloff_triger_type { + ROLLOFF_TRIGER_BY_LUM_IDX = 0, + ROLLOFF_TRIGER_BY_GAIN_IDX, + ROLLOFF_TRIGER_MAX, +} rolloff_triger_type_t; + +typedef struct isp_rolloff_iso_config { + rolloff_triger_type_t triger_type; + HW_S32 shading_comp_dynamic_cfg[14]; +} isp_rolloff_iso_config_t; + + +typedef struct isp_rolloff_setting { + HW_U16 smooth_pool_size; + HW_U16 th_tableSwitch; + HW_U16 frequency; + HW_U16 start; + HW_U16 th_lowLight; + HW_U16 th_complex; + HW_U16 th_highSat; + HW_U16 th_maxPercent; + HW_U16 th_thRatio; + HW_U16 th_semiFlat; + isp_rolloff_iso_config_t iso_config; +} isp_rolloff_setting_t; typedef struct isp_rolloff_param { rolloff_param_type_t type; - int isp_platform_id; - int rolloff_frame_id; + HW_S32 isp_platform_id; + HW_S32 rolloff_frame_id; isp_sensor_info_t rolloff_sensor_info; - struct isp_lsc_config lsc_cfg; rolloff_ini_cfg_t rolloff_ini; + isp_rolloff_setting_t rolloff_ctrl; } rolloff_param_t; typedef struct isp_rolloff_stats { @@ -43,7 +167,10 @@ } rolloff_stats_t; typedef struct isp_rolloff_result { - unsigned short lens_table_output[ISP_LENS_TBL_SIZE*3]; + float RGainTbl[ISP_LENS_TBL_SIZE]; + float GGainTbl[ISP_LENS_TBL_SIZE]; + float BGainTbl[ISP_LENS_TBL_SIZE]; + rolloff_correct_mode_t correctMode; } rolloff_result_t; typedef struct isp_rolloff_core_ops { @@ -52,11 +179,8 @@ HW_S32 (*isp_rolloff_run)(void *rolloff_core_obj, rolloff_stats_t *stats, rolloff_result_t *result); } isp_rolloff_core_ops_t; -void* rolloff_init(isp_rolloff_core_ops_t **rolloff_core_ops); +void *rolloff_init(isp_rolloff_core_ops_t **rolloff_core_ops); void rolloff_exit(void *rolloff_core_obj); - #endif /*_ISP_3A_ROLLOFF_H_*/ - - -- Gitblit v1.6.2