diff --git a/libraries/sensor/hi3516ev200/bt656/bt656_sensor_ctl.c b/libraries/sensor/hi3516ev200/bt656/bt656_sensor_ctl.c index a927d26..2bd2ada 100644 --- a/libraries/sensor/hi3516ev200/bt656/bt656_sensor_ctl.c +++ b/libraries/sensor/hi3516ev200/bt656/bt656_sensor_ctl.c @@ -202,7 +202,8 @@ void bt656_restart(VI_PIPE ViPipe) { return; } void bt656_init(VI_PIPE ViPipe) { sensor_i2c_init(ViPipe); - tp9950_720p30_init(ViPipe); + tp9950_960h25_init(ViPipe); + //tp9950_720p30_init(ViPipe); // tp9950_1080p30_init(ViPipe); g_pastBT656[ViPipe]->bInit = GK_TRUE; @@ -216,6 +217,187 @@ void bt656_exit(VI_PIPE ViPipe) { return; } + +void tp9950_960h25_init(VI_PIPE ViPipe) { + sensor_write_register(ViPipe, 0x02, 0xCE); + sensor_write_register(ViPipe, 0x05, 0x00); + sensor_write_register(ViPipe, 0x06, 0x32); + sensor_write_register(ViPipe, 0x07, 0xC0); + sensor_write_register(ViPipe, 0x08, 0x00); + sensor_write_register(ViPipe, 0x09, 0x24); + sensor_write_register(ViPipe, 0x0A, 0x48); + sensor_write_register(ViPipe, 0x0B, 0xC0); + sensor_write_register(ViPipe, 0x0C, 0x13); + sensor_write_register(ViPipe, 0x0D, 0x51); + sensor_write_register(ViPipe, 0x0E, 0x00); + sensor_write_register(ViPipe, 0x0F, 0x00); + sensor_write_register(ViPipe, 0x10, 0xF8); + sensor_write_register(ViPipe, 0x11, 0x40); + sensor_write_register(ViPipe, 0x12, 0x60); + sensor_write_register(ViPipe, 0x13, 0x00); + sensor_write_register(ViPipe, 0x14, 0x00); + sensor_write_register(ViPipe, 0x15, 0x13); + sensor_write_register(ViPipe, 0x16, 0x70); + sensor_write_register(ViPipe, 0x17, 0xBC); + sensor_write_register(ViPipe, 0x18, 0x17); + sensor_write_register(ViPipe, 0x19, 0x20); + sensor_write_register(ViPipe, 0x1A, 0x17); + sensor_write_register(ViPipe, 0x1B, 0x01); + sensor_write_register(ViPipe, 0x1C, 0x09); + sensor_write_register(ViPipe, 0x1D, 0x48); + sensor_write_register(ViPipe, 0x1E, 0x80); + sensor_write_register(ViPipe, 0x1F, 0x80); + sensor_write_register(ViPipe, 0x20, 0x48); + sensor_write_register(ViPipe, 0x21, 0x84); + sensor_write_register(ViPipe, 0x22, 0x37); + sensor_write_register(ViPipe, 0x23, 0x3F); + sensor_write_register(ViPipe, 0x24, 0x04); + sensor_write_register(ViPipe, 0x25, 0xFF); + sensor_write_register(ViPipe, 0x26, 0x05); + sensor_write_register(ViPipe, 0x27, 0x2D); + sensor_write_register(ViPipe, 0x28, 0x00); + sensor_write_register(ViPipe, 0x29, 0x48); + sensor_write_register(ViPipe, 0x2A, 0x30); + sensor_write_register(ViPipe, 0x2B, 0x70); + sensor_write_register(ViPipe, 0x2C, 0x2A); + sensor_write_register(ViPipe, 0x2D, 0x64); + sensor_write_register(ViPipe, 0x2E, 0x56); + sensor_write_register(ViPipe, 0x2F, 0x00); + sensor_write_register(ViPipe, 0x30, 0x7A); + sensor_write_register(ViPipe, 0x31, 0x4A); + sensor_write_register(ViPipe, 0x32, 0x4D); + sensor_write_register(ViPipe, 0x33, 0xF0); + sensor_write_register(ViPipe, 0x34, 0x00); + sensor_write_register(ViPipe, 0x35, 0x65); + sensor_write_register(ViPipe, 0x36, 0xDC); + sensor_write_register(ViPipe, 0x37, 0x00); + sensor_write_register(ViPipe, 0x38, 0x00); + sensor_write_register(ViPipe, 0x39, 0x04); + sensor_write_register(ViPipe, 0x3A, 0x32); + sensor_write_register(ViPipe, 0x3B, 0x26); + sensor_write_register(ViPipe, 0x3C, 0x00); + sensor_write_register(ViPipe, 0x3D, 0x60); + sensor_write_register(ViPipe, 0x3E, 0x00); + sensor_write_register(ViPipe, 0x3F, 0x00); + sensor_write_register(ViPipe, 0x40, 0x00); + sensor_write_register(ViPipe, 0x41, 0x00); + sensor_write_register(ViPipe, 0x42, 0x00); + sensor_write_register(ViPipe, 0x43, 0x00); + sensor_write_register(ViPipe, 0x44, 0x00); + sensor_write_register(ViPipe, 0x45, 0x00); + sensor_write_register(ViPipe, 0x46, 0x00); + sensor_write_register(ViPipe, 0x47, 0x00); + sensor_write_register(ViPipe, 0x48, 0x00); + sensor_write_register(ViPipe, 0x49, 0x00); + sensor_write_register(ViPipe, 0x4A, 0x00); + sensor_write_register(ViPipe, 0x4B, 0x00); + sensor_write_register(ViPipe, 0x4C, 0x43); + sensor_write_register(ViPipe, 0x4D, 0x00); + sensor_write_register(ViPipe, 0x4E, 0x17); + sensor_write_register(ViPipe, 0x4F, 0x00); + sensor_write_register(ViPipe, 0x50, 0x00); + sensor_write_register(ViPipe, 0x51, 0x00); + sensor_write_register(ViPipe, 0x52, 0x00); + sensor_write_register(ViPipe, 0x53, 0x00); + sensor_write_register(ViPipe, 0x54, 0x00); + + sensor_write_register(ViPipe, 0xB3, 0xFA); + sensor_write_register(ViPipe, 0xB4, 0x00); + sensor_write_register(ViPipe, 0xB5, 0x00); + sensor_write_register(ViPipe, 0xB6, 0x00); + sensor_write_register(ViPipe, 0xB7, 0x00); + sensor_write_register(ViPipe, 0xB8, 0x00); + sensor_write_register(ViPipe, 0xB9, 0x00); + sensor_write_register(ViPipe, 0xBA, 0x00); + sensor_write_register(ViPipe, 0xBB, 0x00); + sensor_write_register(ViPipe, 0xBC, 0x00); + sensor_write_register(ViPipe, 0xBD, 0x00); + sensor_write_register(ViPipe, 0xBE, 0x00); + sensor_write_register(ViPipe, 0xBF, 0x00); + sensor_write_register(ViPipe, 0xC0, 0x00); + sensor_write_register(ViPipe, 0xC1, 0x00); + sensor_write_register(ViPipe, 0xC2, 0x0B); + sensor_write_register(ViPipe, 0xC3, 0x0C); + sensor_write_register(ViPipe, 0xC4, 0x00); + sensor_write_register(ViPipe, 0xC5, 0x00); + sensor_write_register(ViPipe, 0xC6, 0x1F); + sensor_write_register(ViPipe, 0xC7, 0x78); + sensor_write_register(ViPipe, 0xC8, 0x27); + sensor_write_register(ViPipe, 0xC9, 0x00); + sensor_write_register(ViPipe, 0xCA, 0x00); + sensor_write_register(ViPipe, 0xCB, 0x07); + sensor_write_register(ViPipe, 0xCC, 0x08); + sensor_write_register(ViPipe, 0xCD, 0x00); + sensor_write_register(ViPipe, 0xCE, 0x00); + sensor_write_register(ViPipe, 0xCF, 0x04); + sensor_write_register(ViPipe, 0xD0, 0x00); + sensor_write_register(ViPipe, 0xD1, 0x00); + sensor_write_register(ViPipe, 0xD2, 0x60); + sensor_write_register(ViPipe, 0xD3, 0x10); + sensor_write_register(ViPipe, 0xD4, 0x06); + sensor_write_register(ViPipe, 0xD5, 0xBE); + sensor_write_register(ViPipe, 0xD6, 0x39); + sensor_write_register(ViPipe, 0xD7, 0x27); + sensor_write_register(ViPipe, 0xD8, 0x00); + sensor_write_register(ViPipe, 0xD9, 0x00); + sensor_write_register(ViPipe, 0xDA, 0x00); + sensor_write_register(ViPipe, 0xDB, 0x00); + sensor_write_register(ViPipe, 0xDC, 0x00); + sensor_write_register(ViPipe, 0xDD, 0x00); + sensor_write_register(ViPipe, 0xDE, 0x00); + sensor_write_register(ViPipe, 0xDF, 0x00); + sensor_write_register(ViPipe, 0xE0, 0x00); + sensor_write_register(ViPipe, 0xE1, 0x00); + sensor_write_register(ViPipe, 0xE2, 0x00); + sensor_write_register(ViPipe, 0xE3, 0x00); + sensor_write_register(ViPipe, 0xE4, 0x00); + sensor_write_register(ViPipe, 0xE5, 0x00); + sensor_write_register(ViPipe, 0xE6, 0x00); + sensor_write_register(ViPipe, 0xE7, 0x13); + sensor_write_register(ViPipe, 0xE8, 0x03); + sensor_write_register(ViPipe, 0xE9, 0x00); + sensor_write_register(ViPipe, 0xEA, 0x00); + sensor_write_register(ViPipe, 0xEB, 0x00); + sensor_write_register(ViPipe, 0xEC, 0x00); + sensor_write_register(ViPipe, 0xED, 0x00); + sensor_write_register(ViPipe, 0xEE, 0x00); + sensor_write_register(ViPipe, 0xEF, 0x00); + sensor_write_register(ViPipe, 0xF0, 0x00); + sensor_write_register(ViPipe, 0xF1, 0x00); + sensor_write_register(ViPipe, 0xF2, 0x00); + sensor_write_register(ViPipe, 0xF3, 0x00); + sensor_write_register(ViPipe, 0xF4, 0x20); + sensor_write_register(ViPipe, 0xF5, 0x10); + sensor_write_register(ViPipe, 0xF6, 0x00); + sensor_write_register(ViPipe, 0xF7, 0x00); + sensor_write_register(ViPipe, 0xF8, 0x00); + sensor_write_register(ViPipe, 0xF9, 0x00); + sensor_write_register(ViPipe, 0xFA, 0x0b); + sensor_write_register(ViPipe, 0xFB, 0x00); + sensor_write_register(ViPipe, 0xFC, 0x00); + + sensor_write_register(ViPipe, 0x40, 0x08); + sensor_write_register(ViPipe, 0x00, 0x00); + sensor_write_register(ViPipe, 0x01, 0xf8); + sensor_write_register(ViPipe, 0x02, 0x01); + sensor_write_register(ViPipe, 0x08, 0xf0); + sensor_write_register(ViPipe, 0x13, 0x24); + sensor_write_register(ViPipe, 0x14, 0x73); + sensor_write_register(ViPipe, 0x15, 0x08); + sensor_write_register(ViPipe, 0x20, 0x12); + sensor_write_register(ViPipe, 0x34, 0x1b); + sensor_write_register(ViPipe, 0x23, 0x02); + sensor_write_register(ViPipe, 0x23, 0x00); + + sensor_write_register(ViPipe, 0x40, 0x00); + + + printf("================================================================\n"); + printf("==== Techpoint TP9950 960H25fps(BT656) init success! ===========\n"); + printf("================================================================\n"); + return; +} + void tp9950_720p30_init(VI_PIPE ViPipe) { sensor_write_register(ViPipe, 0x0, 0x11); sensor_write_register(ViPipe, 0x1, 0x7a); diff --git a/libraries/sensor/hi3516ev200/galaxycore_gc5603/Makefile b/libraries/sensor/hi3516ev200/galaxycore_gc5603/Makefile new file mode 100755 index 0000000..b30b458 --- /dev/null +++ b/libraries/sensor/hi3516ev200/galaxycore_gc5603/Makefile @@ -0,0 +1,17 @@ +LIB_NAME := libsns_gc5603 + +override CFLAGS += -DSDK_CODE=$(SDK_CODE) -fPIC -I$(CURDIR)/../../../../include + +SRCS := $(wildcard *.c) +OBJS := $(SRCS:%.c=%.o) $(ASM_SRCS:%.S=%.o) + +all: $(LIB_NAME).so $(LIB_NAME).a + +$(LIB_NAME).so: $(OBJS) + $(CC) -shared -o $@ $(OBJS) + +$(LIB_NAME).a: $(OBJS) + $(AR) -rcs $(LIB_NAME).a $(OBJS) + +clean: + -rm $(OBJS) $(LIB_NAME).so diff --git a/libraries/sensor/hi3516ev200/galaxycore_gc5603/gc5603_cmos.c b/libraries/sensor/hi3516ev200/galaxycore_gc5603/gc5603_cmos.c new file mode 100755 index 0000000..3171038 --- /dev/null +++ b/libraries/sensor/hi3516ev200/galaxycore_gc5603/gc5603_cmos.c @@ -0,0 +1,1086 @@ +/* + * Copyright (c) GK. All rights reserved. + */ + +#include "gc5603_cmos.h" +#include "gc5603_cmos_ex.h" +#include +#include +#include +#include "gk_api_isp.h" +#include "gk_api_ae.h" +#include "gk_api_awb.h" + +#define GC5603_ID 5603 + +#define HIGH_8BITS(x) (((x) & 0xFF00) >> 8) +#define LOW_8BITS(x) ((x) & 0x00FF) +#define LOWER_4BITS(x) ((x) & 0x000F) +#define HIGHER_4BITS(x) (((x) & 0xF000) >> 12) +#define HIGHER_8BITS(x) (((x) & 0x0FF0) >> 4) +#define ISO_LUT_NUM 8 + +#ifndef MAX +#define MAX(a, b) (((a) < (b)) ? (b) : (a)) +#endif + +#ifndef MIN +#define MIN(a, b) (((a) > (b)) ? (b) : (a)) +#endif + +ISP_SNS_STATE_S *g_pastGc5603[ISP_MAX_PIPE_NUM] = {GK_NULL}; + +#define GC5603_SENSOR_SET_CTX(dev, pstCtx) ((g_pastGc5603[dev]) = (pstCtx)) +#define GC5603_SENSOR_RESET_CTX(dev) (g_pastGc5603[dev] = GK_NULL) + +ISP_SNS_COMMBUS_U g_aunGc5603BusInfo[ISP_MAX_PIPE_NUM] = { + [0] = { .s8I2cDev = 0 }, + [1 ... ISP_MAX_PIPE_NUM - 1] = { .s8I2cDev = -1 } +}; + +ISP_SNS_COMMBUS_U *gc5603_get_bus_Info(VI_PIPE ViPipe) +{ + return &g_aunGc5603BusInfo[ViPipe]; +} + +ISP_SNS_STATE_S *gc5603_get_ctx(VI_PIPE ViPipe) +{ + return g_pastGc5603[ViPipe]; +} + +static ISP_FSWDR_MODE_E g_genFSWDRMode[ISP_MAX_PIPE_NUM] = { + [0 ... ISP_MAX_PIPE_NUM - 1] = ISP_FSWDR_NORMAL_MODE +}; + +static GK_U32 g_au32MaxTimeGetCnt[ISP_MAX_PIPE_NUM] = {0}; +static GK_U32 g_au32InitExposure[ISP_MAX_PIPE_NUM] = {0}; +static GK_U32 g_au32LinesPer500ms[ISP_MAX_PIPE_NUM] = {0}; +static GK_U32 g_au32InitIso[ISP_MAX_PIPE_NUM] = {[0 ... (ISP_MAX_PIPE_NUM - 1)] = 100}; /* init iso 100 */ + +static GK_U16 g_au16InitWBGain[ISP_MAX_PIPE_NUM][3] = {{0}}; +static GK_U16 g_au16SampleRgain[ISP_MAX_PIPE_NUM] = {0}; +static GK_U16 g_au16SampleBgain[ISP_MAX_PIPE_NUM] = {0}; +static GK_U16 g_au16InitCCM[ISP_MAX_PIPE_NUM][CCM_MATRIX_SIZE] = {{0}}; +static GK_BOOL g_abIsIrMode[ISP_MAX_PIPE_NUM] = {GK_FALSE}; +static const GK_U32 g_au32IsoLut[ISO_LUT_NUM] = {100, 200, 400, 800, 1600, 3200, 6400, 12800}; + +static GK_BOOL g_abAERouteExValid[ISP_MAX_PIPE_NUM] = {0}; +static ISP_AE_ROUTE_S g_astInitAERoute[ISP_MAX_PIPE_NUM] = {{0}}; +static ISP_AE_ROUTE_EX_S g_astInitAERouteEx[ISP_MAX_PIPE_NUM] = {{0}}; + +#define GC5603_FULL_LINES_MAX 0x3FFF +#define GC5603_INCREASE_LINES 0 /* make real fps less than stand fps because NVR require */ +#define GC5603_VMAX_2880x1620_LINEAR (1750 + GC5603_INCREASE_LINES) +#define GC5603_SENSOR_FPS_MAX 30 +#define GC5603_SENSOR_FPS_MIN 8 +/* sensor fps mode */ +#define GC5603_SENSOR_2880x1620_30FPS_LINEAR_MODE 0 + +static GK_VOID cmos_get_ae_comm_default(VI_PIPE ViPipe, AE_SENSOR_DEFAULT_S *pstAeSnsDft, + ISP_SNS_STATE_S *pstSnsState) +{ + (gk_void)memset_s(&pstAeSnsDft->stAERouteAttr, sizeof(ISP_AE_ROUTE_S), 0, sizeof(ISP_AE_ROUTE_S)); + + pstAeSnsDft->u32FullLinesStd = pstSnsState->u32FLStd; + pstAeSnsDft->u32FlickerFreq = 50 * 256; /* light flicker freq: 50Hz, accuracy: 256 */ + pstAeSnsDft->u32FullLinesMax = GC5603_FULL_LINES_MAX; + + pstAeSnsDft->stIntTimeAccu.enAccuType = AE_ACCURACY_LINEAR; + pstAeSnsDft->stIntTimeAccu.f32Accuracy = 1; + pstAeSnsDft->stIntTimeAccu.f32Offset = 0; + + pstAeSnsDft->stAgainAccu.enAccuType = AE_ACCURACY_TABLE; + pstAeSnsDft->stAgainAccu.f32Accuracy = 1; + + pstAeSnsDft->stDgainAccu.enAccuType = AE_ACCURACY_LINEAR; + pstAeSnsDft->stDgainAccu.f32Accuracy = 0.015625; /* accuracy 0.015625 */ + + pstAeSnsDft->u32ISPDgainShift = 8; /* accuracy: 8 */ + pstAeSnsDft->u32MinISPDgainTarget = 1 << pstAeSnsDft->u32ISPDgainShift; + pstAeSnsDft->u32MaxISPDgainTarget = 2 << pstAeSnsDft->u32ISPDgainShift; /* max 2 */ + + pstAeSnsDft->enMaxIrisFNO = ISP_IRIS_F_NO_1_0; + pstAeSnsDft->enMinIrisFNO = ISP_IRIS_F_NO_32_0; + + pstAeSnsDft->bAERouteExValid = GK_FALSE; + pstAeSnsDft->stAERouteAttr.u32TotalNum = 0; + pstAeSnsDft->stAERouteAttrEx.u32TotalNum = 0; + + if (g_au32LinesPer500ms[ViPipe] == 0) { + pstAeSnsDft->u32LinesPer500ms = pstSnsState->u32FLStd * 30 / 2; /* 30fps, div 2 */ + } else { + pstAeSnsDft->u32LinesPer500ms = g_au32LinesPer500ms[ViPipe]; + } + + return; +} + +static GK_VOID cmos_get_ae_linear_default(VI_PIPE ViPipe, AE_SENSOR_DEFAULT_S *pstAeSnsDft, + ISP_SNS_STATE_S *pstSnsState) +{ + pstAeSnsDft->au8HistThresh[0] = 0x0D; + pstAeSnsDft->au8HistThresh[1] = 0x28; + pstAeSnsDft->au8HistThresh[2] = 0x60; /* index 2 */ + pstAeSnsDft->au8HistThresh[3] = 0x80; /* index 3 */ + + pstAeSnsDft->u32MaxAgain = 65536; /* max 113168 */ + pstAeSnsDft->u32MinAgain = 1024; /* min 1024 */ + pstAeSnsDft->u32MaxAgainTarget = pstAeSnsDft->u32MaxAgain; + pstAeSnsDft->u32MinAgainTarget = pstAeSnsDft->u32MinAgain; + + pstAeSnsDft->u32MaxDgain = 512; /* max 512 */ + pstAeSnsDft->u32MinDgain = 64; /* min 64 */ + pstAeSnsDft->u32MaxDgainTarget = pstAeSnsDft->u32MaxDgain; + pstAeSnsDft->u32MinDgainTarget = pstAeSnsDft->u32MinDgain; + + pstAeSnsDft->u8AeCompensation = 0x38; + pstAeSnsDft->enAeExpMode = AE_EXP_HIGHLIGHT_PRIOR; + + pstAeSnsDft->u32InitExposure = g_au32InitExposure[ViPipe] ? g_au32InitExposure[ViPipe] : 148859; /* init 148859 */ + pstAeSnsDft->u32MaxIntTime = pstSnsState->u32FLStd - 2; /* sub 2 */ + pstAeSnsDft->u32MinIntTime = 1; + pstAeSnsDft->u32MaxIntTimeTarget = 65535; /* max 65535 */ + pstAeSnsDft->u32MinIntTimeTarget = 1; + pstAeSnsDft->bAERouteExValid = g_abAERouteExValid[ViPipe]; + (gk_void)memcpy_s(&pstAeSnsDft->stAERouteAttr, sizeof(ISP_AE_ROUTE_S), &g_astInitAERoute[ViPipe], + sizeof(ISP_AE_ROUTE_S)); + (gk_void)memcpy_s(&pstAeSnsDft->stAERouteAttrEx, sizeof(ISP_AE_ROUTE_EX_S), &g_astInitAERouteEx[ViPipe], + sizeof(ISP_AE_ROUTE_EX_S)); + return; +} + +static GK_S32 cmos_get_ae_default(VI_PIPE ViPipe, AE_SENSOR_DEFAULT_S *pstAeSnsDft) +{ + ISP_SNS_STATE_S *pstSnsState = GK_NULL; + + CMOS_CHECK_POINTER(pstAeSnsDft); + GC5603_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + + cmos_get_ae_comm_default(ViPipe, pstAeSnsDft, pstSnsState); + + switch (pstSnsState->enWDRMode) { + case WDR_MODE_NONE: + cmos_get_ae_linear_default(ViPipe, pstAeSnsDft, pstSnsState); + break; + default: + printf("cmos_get_ae_default_Sensor Mode is error!\n"); + break; + } + + return 0; +} + +/* the function of sensor set fps */ +static GK_VOID cmos_fps_set(VI_PIPE ViPipe, GK_FLOAT f32Fps, AE_SENSOR_DEFAULT_S *pstAeSnsDft) +{ + GK_U32 u32FullLines; + GK_U32 u32VMAX = GC5603_VMAX_2880x1620_LINEAR; + ISP_SNS_STATE_S *pstSnsState = GK_NULL; + + CMOS_CHECK_POINTER_VOID(pstAeSnsDft); + GC5603_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + + switch (pstSnsState->u8ImgMode) { + case GC5603_SENSOR_2880x1620_30FPS_LINEAR_MODE: + + if ((f32Fps <= 30) && (f32Fps > GC5603_SENSOR_FPS_MIN)) { /* fps range [2.06, 30] */ + u32VMAX = GC5603_VMAX_2880x1620_LINEAR * 30 / DIV_0_TO_1_FLOAT(f32Fps); /* 30 fps */ + } else { + ISP_TRACE(MODULE_DBG_ERR, "Not support Fps: %f\n", f32Fps); + return; + } + pstAeSnsDft->u32LinesPer500ms = GC5603_VMAX_2880x1620_LINEAR * 15 * 2; /* 15: 30fps / 2 */ + break; + default: + break; + } + u32VMAX = (u32VMAX > GC5603_FULL_LINES_MAX) ? GC5603_FULL_LINES_MAX : u32VMAX; + //pstSnsState->u32FLStd = u32VMAX; + pstSnsState->astRegsInfo[0].astI2cData[16].u32Data = ((u32VMAX & 0xFF00) >> 8); //340 + pstSnsState->astRegsInfo[0].astI2cData[17].u32Data = (u32VMAX & 0xFF); //341 + + u32FullLines = u32VMAX << 1; + pstSnsState->u32FLStd = (u32FullLines > GC5603_FULL_LINES_MAX) ? GC5603_FULL_LINES_MAX : u32FullLines; + pstAeSnsDft->f32Fps = f32Fps; + + pstAeSnsDft->u32FullLinesStd = pstSnsState->u32FLStd; + pstAeSnsDft->u32MaxIntTime = pstSnsState->u32FLStd - 2; /* sub 2 */ + pstSnsState->au32FL[0] = pstSnsState->u32FLStd; + pstAeSnsDft->u32FullLines = pstSnsState->au32FL[0]; + + return; +} + +static GK_VOID cmos_slow_framerate_set(VI_PIPE ViPipe, GK_U32 u32FullLines, + AE_SENSOR_DEFAULT_S *pstAeSnsDft) +{ + ISP_SNS_STATE_S *pstSnsState = GK_NULL; + + CMOS_CHECK_POINTER_VOID(pstAeSnsDft); + GC5603_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + u32FullLines = (u32FullLines > GC5603_FULL_LINES_MAX) ? GC5603_FULL_LINES_MAX : u32FullLines; + pstSnsState->au32FL[0] = u32FullLines; + + + pstSnsState->astRegsInfo[0].astI2cData[16].u32Data = ((u32FullLines & 0xFF00) >> 8); //340 + pstSnsState->astRegsInfo[0].astI2cData[17].u32Data = (u32FullLines & 0xFF); //341 + + pstAeSnsDft->u32FullLines = pstSnsState->au32FL[0]; + pstAeSnsDft->u32MaxIntTime = pstSnsState->au32FL[0] - 2; /* sub 2 */ + + return; +} + +/* while isp notify ae to update sensor regs, ae call these funcs. */ +static GK_VOID cmos_inttime_update(VI_PIPE ViPipe, GK_U32 u32IntTime) +{ + GK_U32 u32Val; + ISP_SNS_STATE_S *pstSnsState = GK_NULL; + GC5603_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + + u32Val = (u32IntTime > GC5603_FULL_LINES_MAX) ? GC5603_FULL_LINES_MAX : u32IntTime; + pstSnsState->astRegsInfo[0].astI2cData[0].u32Data = ((u32Val & 0xFF00) >> 8); /* 202 */ + pstSnsState->astRegsInfo[0].astI2cData[1].u32Data = (u32Val & 0xFF); /* 203 */ + + return; +} + +#define GC5603_REG_VAL_TAB_ROW 35 +#define GC5603_REG_VAL_TAB_COL 9 + +static GK_U32 g_regValTable[GC5603_REG_VAL_TAB_ROW][GC5603_REG_VAL_TAB_COL] = { + // 0614, 0615, 0225, 1447 1466, 1467, 1468, 00b8, 00b9 + { 0x00, 0x00, 0x00, 0x03, 0x18, 0x19, 0x19, 0x01, 0x00}, + { 0x90, 0x02, 0x00, 0x03, 0x18, 0x1b, 0x1b, 0x01, 0x0A}, + { 0x00, 0x00, 0x00, 0x01, 0x18, 0x19, 0x19, 0x01, 0x12}, + { 0x90, 0x02, 0x00, 0x01, 0x18, 0x1b, 0x1b, 0x01, 0x20}, + { 0x01, 0x00, 0x00, 0x01, 0x18, 0x19, 0x19, 0x01, 0x30}, + { 0x91, 0x02, 0x00, 0x01, 0x18, 0x1b, 0x1b, 0x02, 0x05}, + { 0x02, 0x00, 0x00, 0x01, 0x18, 0x1a, 0x1a, 0x02, 0x19}, + { 0x92, 0x02, 0x00, 0x01, 0x18, 0x1c, 0x1c, 0x02, 0x3F}, + { 0x03, 0x00, 0x00, 0x01, 0x18, 0x1a, 0x1a, 0x03, 0x20}, + { 0x93, 0x02, 0x00, 0x01, 0x18, 0x1d, 0x1d, 0x04, 0x0A}, //000 + { 0x00, 0x00, 0x01, 0x01, 0x18, 0x1d, 0x1d, 0x05, 0x02}, // + { 0x90, 0x02, 0x01, 0x01, 0x18, 0x20, 0x20, 0x05, 0x39}, + { 0x01, 0x00, 0x01, 0x01, 0x18, 0x1e, 0x1e, 0x06, 0x3C}, // + { 0x91, 0x02, 0x01, 0x01, 0x18, 0x20, 0x20, 0x08, 0x0D}, + { 0x02, 0x00, 0x01, 0x01, 0x18, 0x20, 0x20, 0x09, 0x21}, + { 0x92, 0x02, 0x01, 0x01, 0x18, 0x22, 0x22, 0x0B, 0x0F}, + { 0x03, 0x00, 0x01, 0x01, 0x18, 0x21, 0x21, 0x0D, 0x17}, + { 0x93, 0x02, 0x01, 0x01, 0x18, 0x23, 0x23, 0x0F, 0x33}, + { 0x04, 0x00, 0x01, 0x01, 0x18, 0x23, 0x23, 0x12, 0x30}, + { 0x94, 0x02, 0x01, 0x01, 0x18, 0x25, 0x25, 0x16, 0x10}, + { 0x05, 0x00, 0x01, 0x01, 0x18, 0x24, 0x24, 0x1A, 0x19}, + { 0x95, 0x02, 0x01, 0x01, 0x18, 0x26, 0x26, 0x1F, 0x13}, + { 0x06, 0x00, 0x01, 0x01, 0x18, 0x26, 0x26, 0x25, 0x08}, + { 0x96, 0x02, 0x01, 0x01, 0x18, 0x28, 0x28, 0x2C, 0x03}, + { 0xb6, 0x04, 0x01, 0x01, 0x18, 0x28, 0x28, 0x34, 0x0F}, + { 0x86, 0x06, 0x01, 0x01, 0x18, 0x2a, 0x2a, 0x3D, 0x3D}, + { 0x06, 0x08, 0x01, 0x01, 0x18, 0x2b, 0x2b, 0x49, 0x1F}, + { 0x4e, 0x09, 0x01, 0x01, 0x18, 0x2d, 0x2d, 0x57, 0x0A}, + { 0x5e, 0x0a, 0x01, 0x01, 0x18, 0x2f, 0x2f, 0x67, 0x19}, + { 0x3e, 0x0b, 0x01, 0x01, 0x18, 0x31, 0x31, 0x7A, 0x28}, + { 0x06, 0x0c, 0x01, 0x01, 0x18, 0x34, 0x34, 0x91, 0x1C}, + { 0xae, 0x0c, 0x01, 0x01, 0x18, 0x38, 0x38, 0xAC, 0x20}, + { 0x2e, 0x0d, 0x01, 0x01, 0x18, 0x3c, 0x3c, 0xCC, 0x26}, + { 0x9e, 0x0d, 0x01, 0x01, 0x18, 0x41, 0x41, 0xFF, 0x3F}, + { 0x06, 0x0e, 0x01, 0x01, 0x18, 0x47, 0x47, 0xFF, 0x3F}, +}; + +#define GC5603_ANALOG_GAIN_TAB_RANGE 35 +static GK_U32 g_analog_gain_table[GC5603_ANALOG_GAIN_TAB_RANGE] = { + 1024, + 1184, + 1312, + 1536, + 1792, + 2128, + 2448, + 3056, + 3584, + 4256, + 5152, + 6032, + 7104, + 8400, + 9744, + 11504, + 13680, + 16176, + 19200, + 22784, + 27024, + 32048, + 38016, + 45104, + 53488, + 63440, + 75248, + 89248, + 105872, + 125568, + 148928, + 176640, + 209504, + 248480, + 294704, +}; + +#define GC5603_ANALOG_GAIN_LUT_SIZE 35 +static GK_VOID cmos_again_calc_table(VI_PIPE ViPipe, GK_U32 *pu32AgainLin, GK_U32 *pu32AgainDb) +{ + gk_u32 again; + int i; + static GK_U8 againmax = 28; /* adgain max 28 */ + + CMOS_CHECK_POINTER_VOID(pu32AgainLin); + CMOS_CHECK_POINTER_VOID(pu32AgainDb); + + again = *pu32AgainLin; + + if (again >= g_analog_gain_table[againmax]) { + *pu32AgainLin = g_analog_gain_table[GC5603_ANALOG_GAIN_LUT_SIZE - 1]; + *pu32AgainDb = againmax; + } else { + for (i = 1; i < GC5603_ANALOG_GAIN_LUT_SIZE; i++) { + if (again < g_analog_gain_table[i]) { + *pu32AgainLin = g_analog_gain_table[i - 1]; + *pu32AgainDb = i - 1; + break; + } + } + } + + return; +} + +static GK_VOID cmos_gains_update(VI_PIPE ViPipe, GK_U32 u32Again, GK_U32 u32Dgain) +{ + GK_U8 u8DgainHigh, u8DgainLow; + + ISP_SNS_STATE_S *pstSnsState = GK_NULL; + + GC5603_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + + u8DgainHigh = (u32Dgain >> 6) & 0x0f; /* shift 6 */ + u8DgainLow = (u32Dgain & 0x3f) << 2; /* shift 2 */ + + pstSnsState->astRegsInfo[0].astI2cData[2].u32Data = 0x2d; //31d + pstSnsState->astRegsInfo[0].astI2cData[3].u32Data = g_regValTable[u32Again][0]; //0614 3 //0x93, 0x02, 0x01, 0x01, 0x18, 0x23, 0x23, 0x11, 0x1F + pstSnsState->astRegsInfo[0].astI2cData[4].u32Data = g_regValTable[u32Again][1]; //0615 4 + pstSnsState->astRegsInfo[0].astI2cData[5].u32Data = g_regValTable[u32Again][2]; //0225 5 + pstSnsState->astRegsInfo[0].astI2cData[6].u32Data = 0x2e; //31d 6 + pstSnsState->astRegsInfo[0].astI2cData[7].u32Data = g_regValTable[u32Again][3]; //1447 7 + pstSnsState->astRegsInfo[0].astI2cData[8].u32Data = 0x28; //31d 8 + pstSnsState->astRegsInfo[0].astI2cData[9].u32Data = g_regValTable[u32Again][4]; //1466 9 + pstSnsState->astRegsInfo[0].astI2cData[10].u32Data = g_regValTable[u32Again][5]; //1467 10 + pstSnsState->astRegsInfo[0].astI2cData[11].u32Data = g_regValTable[u32Again][6]; //1468 11 + + pstSnsState->astRegsInfo[0].astI2cData[12].u32Data = g_regValTable[u32Again][7]; //00b8 //12 + pstSnsState->astRegsInfo[0].astI2cData[13].u32Data = g_regValTable[u32Again][8]; //00b9 //13 + + pstSnsState->astRegsInfo[0].astI2cData[14].u32Data = u8DgainHigh; //0064 //14 + pstSnsState->astRegsInfo[0].astI2cData[15].u32Data = u8DgainLow; //0065 //15 + return; +} + +static GK_VOID cmos_get_inttime_max(VI_PIPE ViPipe, GK_U16 u16ManRatioEnable, + GK_U32 *au32Ratio, GK_U32 *au32IntTimeMax, GK_U32 *au32IntTimeMin, GK_U32 *pu32LFMaxIntTime) +{ + return; +} + +/* Only used in LINE_WDR mode */ +static GK_VOID cmos_ae_fswdr_attr_set(VI_PIPE ViPipe, AE_FSWDR_ATTR_S *pstAeFSWDRAttr) +{ + CMOS_CHECK_POINTER_VOID(pstAeFSWDRAttr); + + g_genFSWDRMode[ViPipe] = pstAeFSWDRAttr->enFSWDRMode; + g_au32MaxTimeGetCnt[ViPipe] = 0; + + return; +} + +static GK_S32 cmos_init_ae_exp_function(AE_SENSOR_EXP_FUNC_S *pstExpFuncs) +{ + CMOS_CHECK_POINTER(pstExpFuncs); + + (gk_void)memset_s(pstExpFuncs, sizeof(AE_SENSOR_EXP_FUNC_S), 0, sizeof(AE_SENSOR_EXP_FUNC_S)); + pstExpFuncs->pfn_cmos_get_ae_default = cmos_get_ae_default; + pstExpFuncs->pfn_cmos_fps_set = cmos_fps_set; + pstExpFuncs->pfn_cmos_slow_framerate_set = cmos_slow_framerate_set; + pstExpFuncs->pfn_cmos_inttime_update = cmos_inttime_update; + pstExpFuncs->pfn_cmos_gains_update = cmos_gains_update; + pstExpFuncs->pfn_cmos_again_calc_table = cmos_again_calc_table; + pstExpFuncs->pfn_cmos_dgain_calc_table = GK_NULL; + pstExpFuncs->pfn_cmos_get_inttime_max = cmos_get_inttime_max; + pstExpFuncs->pfn_cmos_ae_fswdr_attr_set = cmos_ae_fswdr_attr_set; + + return GK_SUCCESS; +} + +/* awb static param */ +#define CALIBRATE_STATIC_TEMP 5082 +#define CALIBRATE_STATIC_WB_R_GAIN 350//404 +#define CALIBRATE_STATIC_WB_GR_GAIN 256 +#define CALIBRATE_STATIC_WB_GB_GAIN 256 +#define CALIBRATE_STATIC_WB_B_GAIN 607//509 + +/* Calibration results for Auto WB Planck */ +#define CALIBRATE_AWB_P1 (-51)//13 +#define CALIBRATE_AWB_P2 293//213 +#define CALIBRATE_AWB_Q1 (-15)//(-30) +#define CALIBRATE_AWB_A1 182819//186383 +#define CALIBRATE_AWB_B1 128 +#define CALIBRATE_AWB_C1 (-112549)//(-131654) +/* Rgain and Bgain of the golden sample */ +#define GOLDEN_RGAIN 0 +#define GOLDEN_BGAIN 0 + +static GK_S32 cmos_get_awb_default(VI_PIPE ViPipe, AWB_SENSOR_DEFAULT_S *pstAwbSnsDft) +{ + GK_S32 i; + + ISP_SNS_STATE_S *pstSnsState = GK_NULL; + + CMOS_CHECK_POINTER(pstAwbSnsDft); + GC5603_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + + (gk_void)memset_s(pstAwbSnsDft, sizeof(AWB_SENSOR_DEFAULT_S), 0, sizeof(AWB_SENSOR_DEFAULT_S)); + pstAwbSnsDft->u16WbRefTemp = CALIBRATE_STATIC_TEMP; + + pstAwbSnsDft->au16GainOffset[0] = CALIBRATE_STATIC_WB_R_GAIN; /* 0: R channel 404 */ + pstAwbSnsDft->au16GainOffset[1] = CALIBRATE_STATIC_WB_GR_GAIN; /* 1: Gr channel 256 */ + pstAwbSnsDft->au16GainOffset[2] = CALIBRATE_STATIC_WB_GB_GAIN; /* 2: Gb channel 256 */ + pstAwbSnsDft->au16GainOffset[3] = CALIBRATE_STATIC_WB_B_GAIN; /* 3: B channel 509 */ + + pstAwbSnsDft->as32WbPara[0] = CALIBRATE_AWB_P1; /* index0: p1 39 */ + pstAwbSnsDft->as32WbPara[1] = CALIBRATE_AWB_P2; /* index1: p2 152 */ + pstAwbSnsDft->as32WbPara[2] = CALIBRATE_AWB_Q1; /* index2: q1 -65 */ + pstAwbSnsDft->as32WbPara[3] = CALIBRATE_AWB_A1; /* index3: a1 201612 */ + pstAwbSnsDft->as32WbPara[4] = CALIBRATE_AWB_B1; /* index4: b1 128 */ + pstAwbSnsDft->as32WbPara[5] = CALIBRATE_AWB_C1; /* index5: c1 -147924 */ + pstAwbSnsDft->u16GoldenRgain = GOLDEN_RGAIN; + pstAwbSnsDft->u16GoldenBgain = GOLDEN_BGAIN; + switch (pstSnsState->enWDRMode) { + default: + case WDR_MODE_NONE: + (gk_void)memcpy_s(&pstAwbSnsDft->stCcm, sizeof(AWB_CCM_S), &g_stAwbCcm, sizeof(AWB_CCM_S)); + if (g_abIsIrMode[ViPipe] == GK_TRUE) { + (gk_void)memcpy_s(&pstAwbSnsDft->stAgcTbl, sizeof(AWB_AGC_TABLE_S), + &g_stAwbAgcTableIr, sizeof(AWB_AGC_TABLE_S)); + } else { + (gk_void)memcpy_s(&pstAwbSnsDft->stAgcTbl, sizeof(AWB_AGC_TABLE_S), + &g_stAwbAgcTable, sizeof(AWB_AGC_TABLE_S)); + } + break; + } + pstAwbSnsDft->u16SampleRgain = g_au16SampleRgain[ViPipe]; + pstAwbSnsDft->u16SampleBgain = g_au16SampleBgain[ViPipe]; + pstAwbSnsDft->u16InitRgain = g_au16InitWBGain[ViPipe][0]; /* 0: Rgain */ + pstAwbSnsDft->u16InitGgain = g_au16InitWBGain[ViPipe][1]; /* 1: Ggain */ + pstAwbSnsDft->u16InitBgain = g_au16InitWBGain[ViPipe][2]; /* 2: Bgain */ + pstAwbSnsDft->u8AWBRunInterval = 4; /* RunInterval 4 */ + + for (i = 0; i < CCM_MATRIX_SIZE; i++) { + pstAwbSnsDft->au16InitCCM[i] = g_au16InitCCM[ViPipe][i]; + } + + return GK_SUCCESS; +} + +static GK_S32 cmos_init_awb_exp_function(AWB_SENSOR_EXP_FUNC_S *pstExpFuncs) +{ + CMOS_CHECK_POINTER(pstExpFuncs); + + (gk_void)memset_s(pstExpFuncs, sizeof(AWB_SENSOR_EXP_FUNC_S), 0, sizeof(AWB_SENSOR_EXP_FUNC_S)); + pstExpFuncs->pfn_cmos_get_awb_default = cmos_get_awb_default; + return GK_SUCCESS; +} + +static ISP_CMOS_DNG_COLORPARAM_S g_stDngColorParam = { + {378, 256, 430}, + {439, 256, 439} +}; + +static GK_U32 Interpulate(GK_U32 u32Mid, GK_U32 u32Left, GK_U32 u32LValue, GK_U32 u32Right, GK_U32 u32RValue) +{ + GK_U32 u32Value; + GK_U32 k; + + if (u32Mid <= u32Left) { + u32Value = u32LValue; + return u32Value; + } + + if (u32Mid >= u32Right) { + u32Value = u32RValue; + return u32Value; + } + + k = (u32Right - u32Left); + u32Value = (((u32Right - u32Mid) * u32LValue + (u32Mid - u32Left) * u32RValue + (k >> 1)) / k); + + return u32Value; +} + +static GK_VOID cmos_set_drc_init_str(VI_PIPE ViPipe) +{ + GK_U32 u32Level; + GK_U32 au32DrcInitStr0[ISO_LUT_NUM] = { DRC_INIT_STR_NA }; + GK_U32 au32DrcInitStr1[ISO_LUT_NUM] = { DRC_INIT_STR_IR }; + + for (u32Level = 0; u32Level < ISO_LUT_NUM; u32Level++) { + if (g_au32InitIso[ViPipe] <= g_au32IsoLut[u32Level]) { + break; + } + } + + if (u32Level == ISO_LUT_NUM) { + u32Level = ISO_LUT_NUM - 1; + } + + if (g_abIsIrMode[ViPipe] == GK_TRUE) { + if ((u32Level == 0) || (u32Level == ISO_LUT_NUM - 1)) { + g_stIspDRC.u16ManualStrength = au32DrcInitStr1[u32Level]; + } else { + g_stIspDRC.u16ManualStrength = Interpulate(g_au32InitIso[ViPipe], + g_au32IsoLut[u32Level - 1], au32DrcInitStr1[u32Level - 1], + g_au32IsoLut[u32Level], au32DrcInitStr1[u32Level]); + } + } else { + if ((u32Level == 0) || (u32Level == ISO_LUT_NUM - 1)) { + g_stIspDRC.u16ManualStrength = au32DrcInitStr0[u32Level]; + } else { + g_stIspDRC.u16ManualStrength = Interpulate(g_au32InitIso[ViPipe], + g_au32IsoLut[u32Level - 1], au32DrcInitStr0[u32Level - 1], + g_au32IsoLut[u32Level], au32DrcInitStr0[u32Level]); + } + } +} + +static GK_VOID cmos_get_isp_dng_default(ISP_SNS_STATE_S *pstSnsState, ISP_CMOS_DEFAULT_S *pstDef) +{ + (gk_void)memcpy_s(&pstDef->stDngColorParam, sizeof(ISP_CMOS_DNG_COLORPARAM_S), + &g_stDngColorParam, sizeof(ISP_CMOS_DNG_COLORPARAM_S)); + + switch (pstSnsState->u8ImgMode) { + default: + case GC5603_SENSOR_2880x1620_30FPS_LINEAR_MODE: + pstDef->stSensorMode.stDngRawFormat.u8BitsPerSample = 10; /* 10 bit */ + pstDef->stSensorMode.stDngRawFormat.u32WhiteLevel = 1023; /* max 1023 */ + break; + } + + pstDef->stSensorMode.stDngRawFormat.stDefaultScale.stDefaultScaleH.u32Denominator = 1; + pstDef->stSensorMode.stDngRawFormat.stDefaultScale.stDefaultScaleH.u32Numerator = 1; + pstDef->stSensorMode.stDngRawFormat.stDefaultScale.stDefaultScaleV.u32Denominator = 1; + pstDef->stSensorMode.stDngRawFormat.stDefaultScale.stDefaultScaleV.u32Numerator = 1; + pstDef->stSensorMode.stDngRawFormat.stCfaRepeatPatternDim.u16RepeatPatternDimRows = 2; /* pattern 2 */ + pstDef->stSensorMode.stDngRawFormat.stCfaRepeatPatternDim.u16RepeatPatternDimCols = 2; /* pattern 2 */ + pstDef->stSensorMode.stDngRawFormat.stBlcRepeatDim.u16BlcRepeatRows = 2; /* pattern 2 */ + pstDef->stSensorMode.stDngRawFormat.stBlcRepeatDim.u16BlcRepeatCols = 2; /* pattern 2 */ + pstDef->stSensorMode.stDngRawFormat.enCfaLayout = CFALAYOUT_TYPE_RECTANGULAR; + pstDef->stSensorMode.stDngRawFormat.au8CfaPlaneColor[0] = 0; + pstDef->stSensorMode.stDngRawFormat.au8CfaPlaneColor[1] = 1; + pstDef->stSensorMode.stDngRawFormat.au8CfaPlaneColor[2] = 2; /* index 2, CfaPlaneColor 2 */ + pstDef->stSensorMode.stDngRawFormat.au8CfaPattern[0] = 0; + pstDef->stSensorMode.stDngRawFormat.au8CfaPattern[1] = 1; + pstDef->stSensorMode.stDngRawFormat.au8CfaPattern[2] = 1; /* index 2, CfaPattern 1 */ + pstDef->stSensorMode.stDngRawFormat.au8CfaPattern[3] = 2; /* index 3, CfaPattern 2 */ + pstDef->stSensorMode.bValidDngRawFormat = GK_TRUE; + return; +} + +static void cmos_get_isp_linear_default(VI_PIPE ViPipe, ISP_CMOS_DEFAULT_S *pstDef) +{ + pstDef->unKey.bit1Demosaic = 1; + pstDef->pstDemosaic = &g_stIspDemosaic; + pstDef->unKey.bit1Sharpen = 1; + pstDef->pstSharpen = &g_stIspYuvSharpen; + pstDef->unKey.bit1Drc = 1; + if (g_abIsIrMode[ViPipe] == GK_TRUE) { + pstDef->pstDrc = &g_stIspDRCIr; + } else { + pstDef->pstDrc = &g_stIspDRC; + } + pstDef->unKey.bit1BayerNr = 1; + pstDef->pstBayerNr = &g_stIspBayerNr; + pstDef->unKey.bit1AntiFalseColor = 1; + pstDef->pstAntiFalseColor = &g_stIspAntiFalseColor; + pstDef->unKey.bit1Ldci = 1; + pstDef->pstLdci = &g_stIspLdci; + pstDef->unKey.bit1Gamma = 1; + if (g_abIsIrMode[ViPipe] == GK_TRUE) { + pstDef->pstGamma = &g_stIspGammaIr; + } else { + pstDef->pstGamma = &g_stIspGamma; + } + pstDef->unKey.bit1Ge = 1; + pstDef->pstGe = &g_stIspGe; + pstDef->unKey.bit1Dehaze = 1; + if (g_abIsIrMode[ViPipe] == GK_TRUE) { + pstDef->pstDehaze = &g_stIspDehazeIr; + } else { + pstDef->pstDehaze = &g_stIspDehaze; + } + pstDef->unKey.bit1Lcac = 1; + pstDef->pstLcac = &g_stIspLCac; + pstDef->unKey.bit1Rgbir = 0; + + (gk_void)memcpy_s(&pstDef->stNoiseCalibration, sizeof(ISP_CMOS_NOISE_CALIBRATION_S), + &g_stIspNoiseCalibration, sizeof(ISP_CMOS_NOISE_CALIBRATION_S)); + return; +} + +static GK_S32 cmos_get_isp_default(VI_PIPE ViPipe, ISP_CMOS_DEFAULT_S *pstDef) +{ + ISP_SNS_STATE_S *pstSnsState = GK_NULL; + + CMOS_CHECK_POINTER(pstDef); + GC5603_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + cmos_set_drc_init_str(ViPipe); + (gk_void)memset_s(pstDef, sizeof(ISP_CMOS_DEFAULT_S), 0, sizeof(ISP_CMOS_DEFAULT_S)); + + pstDef->unKey.bit1Ca = 1; + pstDef->pstCa = &g_stIspCA; + pstDef->unKey.bit1Dpc = 1; + pstDef->pstDpc = &g_stCmosDpc; + pstDef->unKey.bit1Wdr = 1; + pstDef->pstWdr = &g_stIspWDR; + pstDef->unKey.bit1Lsc = 0; + pstDef->pstLsc = &g_stCmosLsc; + pstDef->unKey.bit1PreGamma = 0; + pstDef->pstPreGamma = &g_stPreGamma; + + switch (pstSnsState->enWDRMode) { + default: + case WDR_MODE_NONE: + cmos_get_isp_linear_default(ViPipe, pstDef); + break; + + } + + pstDef->stSensorMode.u32SensorID = GC5603_ID; + pstDef->stSensorMode.u8SensorMode = pstSnsState->u8ImgMode; + cmos_get_isp_dng_default(pstSnsState, pstDef); + + return GK_SUCCESS; +} + +static GK_S32 cmos_get_isp_black_level(VI_PIPE ViPipe, ISP_CMOS_BLACK_LEVEL_S *pstBlackLevel) +{ + ISP_SNS_STATE_S *pstSnsState = GK_NULL; + + CMOS_CHECK_POINTER(pstBlackLevel); + GC5603_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + + /* Don't need to update black level when iso change */ + pstBlackLevel->bUpdate = GK_FALSE; + pstBlackLevel->au16BlackLevel[0] = 256; /* index 0 vaule 256 */ + pstBlackLevel->au16BlackLevel[1] = 256; /* index 1 vaule 256 */ + pstBlackLevel->au16BlackLevel[2] = 256; /* index 2 vaule256 */ + pstBlackLevel->au16BlackLevel[3] = 256; /* index 3 vaule 256 */ + + + return GK_SUCCESS; +} + +static GK_VOID cmos_set_pixel_detect(VI_PIPE ViPipe, GK_BOOL bEnable) +{ + ISP_SNS_STATE_S *pstSnsState = GK_NULL; + + GC5603_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + return; +} + +static GK_S32 cmos_set_wdr_mode(VI_PIPE ViPipe, GK_U8 u8Mode) +{ + ISP_SNS_STATE_S *pstSnsState = GK_NULL; + + GC5603_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + pstSnsState->bSyncInit = GK_FALSE; + + switch (u8Mode) { + case WDR_MODE_NONE: + pstSnsState->enWDRMode = WDR_MODE_NONE; + printf("GC5603_SENSOR_5M_30FPS_LINEAR_MODE\n"); + break; + + default: + ISP_TRACE(MODULE_DBG_ERR, "cmos_set_wdr_mode_NOT support this mode!\n"); + return GK_FAILURE; + } + + (gk_void)memset_s(pstSnsState->au32WDRIntTime, + sizeof(pstSnsState->au32WDRIntTime), 0, sizeof(pstSnsState->au32WDRIntTime)); + + return GK_SUCCESS; +} + +static GK_VOID cmos_comm_sns_reg_info_init(VI_PIPE ViPipe, ISP_SNS_STATE_S *pstSnsState) +{ + gk_u32 i; + + pstSnsState->astRegsInfo[0].enSnsType = ISP_SNS_I2C_TYPE; + pstSnsState->astRegsInfo[0].unComBus.s8I2cDev = g_aunGc5603BusInfo[ViPipe].s8I2cDev; + pstSnsState->astRegsInfo[0].u8Cfg2ValidDelayMax = 2; /* u8Cfg2ValidDelayMax 3 */ + pstSnsState->astRegsInfo[0].u32RegNum = 18; /* RegNum 11 */ + + for (i = 0; i < pstSnsState->astRegsInfo[0].u32RegNum; i++) { + pstSnsState->astRegsInfo[0].astI2cData[i].bUpdate = GK_TRUE; + pstSnsState->astRegsInfo[0].astI2cData[i].u8DevAddr = GC5603_I2C_ADDR; + pstSnsState->astRegsInfo[0].astI2cData[i].u32AddrByteNum = GC5603_ADDR_BYTE; + pstSnsState->astRegsInfo[0].astI2cData[i].u32DataByteNum = GC5603_DATA_BYTE; + } + // Linear Mode Regs + pstSnsState->astRegsInfo[0].astI2cData[0].u8DelayFrmNum = 1; + pstSnsState->astRegsInfo[0].astI2cData[0].u32RegAddr = 0x0202; //0 + + pstSnsState->astRegsInfo[0].astI2cData[1].u8DelayFrmNum = 1; + pstSnsState->astRegsInfo[0].astI2cData[1].u32RegAddr = 0x0203;//1 + + pstSnsState->astRegsInfo[0].astI2cData[2].u8DelayFrmNum = 1; + pstSnsState->astRegsInfo[0].astI2cData[2].u32RegAddr = 0x031d;//2 //2d //1 frame + + pstSnsState->astRegsInfo[0].astI2cData[3].u8DelayFrmNum = 1; + pstSnsState->astRegsInfo[0].astI2cData[3].u32RegAddr = 0x0614; //614//3 + + pstSnsState->astRegsInfo[0].astI2cData[4].u8DelayFrmNum = 1; + pstSnsState->astRegsInfo[0].astI2cData[4].u32RegAddr = 0x0615; //615//4 + + pstSnsState->astRegsInfo[0].astI2cData[5].u8DelayFrmNum = 1; + pstSnsState->astRegsInfo[0].astI2cData[5].u32RegAddr = 0x0225;//5 + + pstSnsState->astRegsInfo[0].astI2cData[6].u8DelayFrmNum = 1; + pstSnsState->astRegsInfo[0].astI2cData[6].u32RegAddr = 0x031d;//6 //2e //2 frame + + pstSnsState->astRegsInfo[0].astI2cData[7].u8DelayFrmNum = 1; + pstSnsState->astRegsInfo[0].astI2cData[7].u32RegAddr = 0x1447;//7 + + pstSnsState->astRegsInfo[0].astI2cData[8].u8DelayFrmNum = 1; + pstSnsState->astRegsInfo[0].astI2cData[8].u32RegAddr = 0x031d;//8 //28 //liji + + pstSnsState->astRegsInfo[0].astI2cData[9].u8DelayFrmNum = 1; + pstSnsState->astRegsInfo[0].astI2cData[9].u32RegAddr = 0x1466;//9 + + pstSnsState->astRegsInfo[0].astI2cData[10].u8DelayFrmNum = 1; + pstSnsState->astRegsInfo[0].astI2cData[10].u32RegAddr = 0x1467;//10 + + pstSnsState->astRegsInfo[0].astI2cData[11].u8DelayFrmNum = 1; + pstSnsState->astRegsInfo[0].astI2cData[11].u32RegAddr = 0x1468;//11 + + pstSnsState->astRegsInfo[0].astI2cData[12].u8DelayFrmNum = 1; + pstSnsState->astRegsInfo[0].astI2cData[12].u32RegAddr = 0x00b8;//12 + + pstSnsState->astRegsInfo[0].astI2cData[13].u8DelayFrmNum = 1; + pstSnsState->astRegsInfo[0].astI2cData[13].u32RegAddr = 0x00b9;//13 + + pstSnsState->astRegsInfo[0].astI2cData[14].u8DelayFrmNum = 1; + pstSnsState->astRegsInfo[0].astI2cData[14].u32RegAddr = 0x0064; //64//14 + + pstSnsState->astRegsInfo[0].astI2cData[15].u8DelayFrmNum = 1; + pstSnsState->astRegsInfo[0].astI2cData[15].u32RegAddr = 0x0065; //65//15 + //vmax + + pstSnsState->astRegsInfo[0].astI2cData[16].u8DelayFrmNum = 0; + pstSnsState->astRegsInfo[0].astI2cData[16].u32RegAddr = 0x0340;//16 + + pstSnsState->astRegsInfo[0].astI2cData[17].u8DelayFrmNum = 0; + pstSnsState->astRegsInfo[0].astI2cData[17].u32RegAddr = 0x0341;//17 + return; +} + +static GK_VOID cmos_sns_reg_info_update(VI_PIPE ViPipe, ISP_SNS_STATE_S *pstSnsState) +{ + GK_U32 i; + + for (i = 0; i < pstSnsState->astRegsInfo[0].u32RegNum; i++) { + if (pstSnsState->astRegsInfo[0].astI2cData[i].u32Data == + pstSnsState->astRegsInfo[1].astI2cData[i].u32Data) { + pstSnsState->astRegsInfo[0].astI2cData[i].bUpdate = GK_FALSE; + } else { + pstSnsState->astRegsInfo[0].astI2cData[i].bUpdate = GK_TRUE; + } + } + + return; +} + +static GK_S32 cmos_get_sns_regs_info(VI_PIPE ViPipe, ISP_SNS_REGS_INFO_S *pstSnsRegsInfo) +{ + ISP_SNS_STATE_S *pstSnsState = GK_NULL; + + CMOS_CHECK_POINTER(pstSnsRegsInfo); + GC5603_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + + if ((pstSnsState->bSyncInit == GK_FALSE) || (pstSnsRegsInfo->bConfig == GK_FALSE)) { + cmos_comm_sns_reg_info_init(ViPipe, pstSnsState); + + pstSnsState->bSyncInit = GK_TRUE; + } else { + cmos_sns_reg_info_update(ViPipe, pstSnsState); + } + pstSnsRegsInfo->bConfig = GK_FALSE; + (gk_void)memcpy_s(pstSnsRegsInfo, sizeof(ISP_SNS_REGS_INFO_S), + &pstSnsState->astRegsInfo[0], sizeof(ISP_SNS_REGS_INFO_S)); + (gk_void)memcpy_s(&pstSnsState->astRegsInfo[1], sizeof(ISP_SNS_REGS_INFO_S), + &pstSnsState->astRegsInfo[0], sizeof(ISP_SNS_REGS_INFO_S)); + + pstSnsState->au32FL[1] = pstSnsState->au32FL[0]; + + return GK_SUCCESS; +} + +static GK_S32 cmos_set_image_mode(VI_PIPE ViPipe, ISP_CMOS_SENSOR_IMAGE_MODE_S *pstSensorImageMode) +{ + GK_U8 u8SensorImageMode; + ISP_SNS_STATE_S *pstSnsState = GK_NULL; + + CMOS_CHECK_POINTER(pstSensorImageMode); + GC5603_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER(pstSnsState); + + u8SensorImageMode = pstSnsState->u8ImgMode; + pstSnsState->bSyncInit = GK_FALSE; + + if ((pstSensorImageMode->u16Width <= 2960) && (pstSensorImageMode->u16Height <= 1664)) { /* w 1920 h 1080 */ + if (pstSensorImageMode->f32Fps > 30) { /* 30fps */ + ISP_TRACE(MODULE_DBG_ERR, "Not support! Width:%d, Height:%d, Fps:%f\n", + pstSensorImageMode->u16Width, + pstSensorImageMode->u16Height, + pstSensorImageMode->f32Fps); + return GK_FAILURE; + } + + if (pstSnsState->enWDRMode == WDR_MODE_NONE) { + u8SensorImageMode = GC5603_SENSOR_2880x1620_30FPS_LINEAR_MODE; + pstSnsState->u32FLStd = GC5603_VMAX_2880x1620_LINEAR; + } else { + ISP_TRACE(MODULE_DBG_ERR, "Not support! \n"); + } + } else { + ISP_TRACE(MODULE_DBG_ERR, "Not support! Width:%d, Height:%d, Fps:%f\n", + pstSensorImageMode->u16Width, + pstSensorImageMode->u16Height, + pstSensorImageMode->f32Fps); + return GK_FAILURE; + } + + if ((pstSnsState->bInit == GK_TRUE) && (u8SensorImageMode == pstSnsState->u8ImgMode)) { + /* Don't need to switch SensorImageMode */ + return ISP_DO_NOT_NEED_SWITCH_IMAGEMODE; + } + pstSnsState->u8ImgMode = u8SensorImageMode; + pstSnsState->au32FL[0] = pstSnsState->u32FLStd; + pstSnsState->au32FL[1] = pstSnsState->au32FL[0]; + + return GK_SUCCESS; +} + +static GK_VOID sensor_global_init(VI_PIPE ViPipe) +{ + ISP_SNS_STATE_S *pstSnsState = GK_NULL; + + GC5603_SENSOR_GET_CTX(ViPipe, pstSnsState); + CMOS_CHECK_POINTER_VOID(pstSnsState); + + pstSnsState->bInit = GK_FALSE; + pstSnsState->bSyncInit = GK_FALSE; + pstSnsState->u8ImgMode = GC5603_SENSOR_2880x1620_30FPS_LINEAR_MODE; + pstSnsState->enWDRMode = WDR_MODE_NONE; + pstSnsState->u32FLStd = GC5603_VMAX_2880x1620_LINEAR * 2; + pstSnsState->au32FL[0] = GC5603_VMAX_2880x1620_LINEAR * 2; + pstSnsState->au32FL[1] = GC5603_VMAX_2880x1620_LINEAR * 2; + + (gk_void)memset_s(&pstSnsState->astRegsInfo[0], sizeof(ISP_SNS_REGS_INFO_S), 0, sizeof(ISP_SNS_REGS_INFO_S)); + (gk_void)memset_s(&pstSnsState->astRegsInfo[1], sizeof(ISP_SNS_REGS_INFO_S), 0, sizeof(ISP_SNS_REGS_INFO_S)); + return; +} + +static GK_S32 cmos_init_sensor_exp_function(ISP_SENSOR_EXP_FUNC_S *pstSensorExpFunc) +{ + CMOS_CHECK_POINTER(pstSensorExpFunc); + (gk_void)memset_s(pstSensorExpFunc, sizeof(ISP_SENSOR_EXP_FUNC_S), 0, sizeof(ISP_SENSOR_EXP_FUNC_S)); + pstSensorExpFunc->pfn_cmos_sensor_init = gc5603_init; + pstSensorExpFunc->pfn_cmos_sensor_exit = gc5603_exit; + pstSensorExpFunc->pfn_cmos_sensor_global_init = sensor_global_init; + pstSensorExpFunc->pfn_cmos_set_image_mode = cmos_set_image_mode; + pstSensorExpFunc->pfn_cmos_set_wdr_mode = cmos_set_wdr_mode; + + pstSensorExpFunc->pfn_cmos_get_isp_default = cmos_get_isp_default; + pstSensorExpFunc->pfn_cmos_get_isp_black_level = cmos_get_isp_black_level; + pstSensorExpFunc->pfn_cmos_set_pixel_detect = cmos_set_pixel_detect; + pstSensorExpFunc->pfn_cmos_get_sns_reg_info = cmos_get_sns_regs_info; + + return GK_SUCCESS; +} + +static GK_S32 gc5603_set_bus_info(VI_PIPE ViPipe, ISP_SNS_COMMBUS_U unSNSBusInfo) +{ + g_aunGc5603BusInfo[ViPipe].s8I2cDev = unSNSBusInfo.s8I2cDev; + + return GK_SUCCESS; +} + +static GK_S32 sensor_ctx_init(VI_PIPE ViPipe) +{ + ISP_SNS_STATE_S *pastSnsStateCtx = GK_NULL; + + GC5603_SENSOR_GET_CTX(ViPipe, pastSnsStateCtx); + + if (pastSnsStateCtx == GK_NULL) { + pastSnsStateCtx = (ISP_SNS_STATE_S *)malloc(sizeof(ISP_SNS_STATE_S)); + if (pastSnsStateCtx == GK_NULL) { + ISP_TRACE(MODULE_DBG_ERR, "Isp[%d] SnsCtx malloc memory failed!\n", ViPipe); + return ERR_CODE_ISP_NOMEM; + } + } + + (gk_void)memset_s(pastSnsStateCtx, sizeof(ISP_SNS_STATE_S), 0, sizeof(ISP_SNS_STATE_S)); + + GC5603_SENSOR_SET_CTX(ViPipe, pastSnsStateCtx); + + return GK_SUCCESS; +} + +static GK_VOID sensor_ctx_exit(VI_PIPE ViPipe) +{ + ISP_SNS_STATE_S *pastSnsStateCtx = GK_NULL; + + GC5603_SENSOR_GET_CTX(ViPipe, pastSnsStateCtx); + SENSOR_FREE(pastSnsStateCtx); + GC5603_SENSOR_RESET_CTX(ViPipe); +} + +static GK_S32 sensor_register_callback(VI_PIPE ViPipe, ALG_LIB_S *pstAeLib, ALG_LIB_S *pstAwbLib) +{ + GK_S32 s32Ret; + ISP_SENSOR_REGISTER_S stIspRegister; + AE_SENSOR_REGISTER_S stAeRegister; + AWB_SENSOR_REGISTER_S stAwbRegister; + ISP_SNS_ATTR_INFO_S stSnsAttrInfo; + + CMOS_CHECK_POINTER(pstAeLib); + CMOS_CHECK_POINTER(pstAwbLib); + + s32Ret = sensor_ctx_init(ViPipe); + if (s32Ret != GK_SUCCESS) { + return GK_FAILURE; + } + + stSnsAttrInfo.eSensorId = GC5603_ID; + s32Ret = cmos_init_sensor_exp_function(&stIspRegister.stSnsExp); + if (s32Ret != GK_SUCCESS) { + ISP_TRACE(MODULE_DBG_ERR, "cmos init exp function failed!\n"); + return GK_FAILURE; + } + s32Ret = GK_API_ISP_SensorRegCallBack(ViPipe, &stSnsAttrInfo, &stIspRegister); + if (s32Ret != GK_SUCCESS) { + ISP_TRACE(MODULE_DBG_ERR, "sensor register callback function failed!\n"); + return s32Ret; + } + + s32Ret = cmos_init_ae_exp_function(&stAeRegister.stSnsExp); + if (s32Ret != GK_SUCCESS) { + ISP_TRACE(MODULE_DBG_ERR, "cmos init ae exp function failed!\n"); + return GK_FAILURE; + } + s32Ret = GK_API_AE_SensorRegCallBack(ViPipe, pstAeLib, &stSnsAttrInfo, &stAeRegister); + if (s32Ret != GK_SUCCESS) { + ISP_TRACE(MODULE_DBG_ERR, "sensor register callback function to ae lib failed!\n"); + return s32Ret; + } + + s32Ret = cmos_init_awb_exp_function(&stAwbRegister.stSnsExp); + if (s32Ret != GK_SUCCESS) { + ISP_TRACE(MODULE_DBG_ERR, "cmos init awb exp function failed!\n"); + return GK_FAILURE; + } + s32Ret = GK_API_AWB_SensorRegCallBack(ViPipe, pstAwbLib, &stSnsAttrInfo, &stAwbRegister); + if (s32Ret != GK_SUCCESS) { + ISP_TRACE(MODULE_DBG_ERR, "sensor register callback function to awb lib failed!\n"); + return s32Ret; + } + + return GK_SUCCESS; +} + +static GK_S32 sensor_unregister_callback(VI_PIPE ViPipe, ALG_LIB_S *pstAeLib, ALG_LIB_S *pstAwbLib) +{ + GK_S32 s32Ret; + + CMOS_CHECK_POINTER(pstAeLib); + CMOS_CHECK_POINTER(pstAwbLib); + + s32Ret = GK_API_ISP_SensorUnRegCallBack(ViPipe, GC5603_ID); + if (s32Ret != GK_SUCCESS) { + ISP_TRACE(MODULE_DBG_ERR, "sensor unregister callback function failed!\n"); + return s32Ret; + } + + s32Ret = GK_API_AE_SensorUnRegCallBack(ViPipe, pstAeLib, GC5603_ID); + if (s32Ret != GK_SUCCESS) { + ISP_TRACE(MODULE_DBG_ERR, "sensor unregister callback function to ae lib failed!\n"); + return s32Ret; + } + + s32Ret = GK_API_AWB_SensorUnRegCallBack(ViPipe, pstAwbLib, GC5603_ID); + if (s32Ret != GK_SUCCESS) { + ISP_TRACE(MODULE_DBG_ERR, "sensor unregister callback function to awb lib failed!\n"); + return s32Ret; + } + + sensor_ctx_exit(ViPipe); + + return GK_SUCCESS; +} + +static GK_S32 sensor_set_init(VI_PIPE ViPipe, ISP_INIT_ATTR_S *pstInitAttr) +{ + GK_S32 i; + + CMOS_CHECK_POINTER(pstInitAttr); + + if (pstInitAttr->u32InitIso) { + g_au32InitIso[ViPipe] = pstInitAttr->u32InitIso; + } + g_au32InitExposure[ViPipe] = pstInitAttr->u32Exposure; + g_au32LinesPer500ms[ViPipe] = pstInitAttr->u32LinesPer500ms; + g_au16InitWBGain[ViPipe][0] = pstInitAttr->u16WBRgain; /* 0: Rgain */ + g_au16InitWBGain[ViPipe][1] = pstInitAttr->u16WBGgain; /* 1: Ggain */ + g_au16InitWBGain[ViPipe][2] = pstInitAttr->u16WBBgain; /* 2: Bgain */ + g_au16SampleRgain[ViPipe] = pstInitAttr->u16SampleRgain; + g_au16SampleBgain[ViPipe] = pstInitAttr->u16SampleBgain; + g_abIsIrMode[ViPipe] = pstInitAttr->bIsIrMode; + + for (i = 0; i < CCM_MATRIX_SIZE; i++) { + g_au16InitCCM[ViPipe][i] = pstInitAttr->au16CCM[i]; + } + + return GK_SUCCESS; +} + +ISP_SNS_OBJ_S stSnsGc5603Obj = { + .pfnRegisterCallback = sensor_register_callback, + .pfnUnRegisterCallback = sensor_unregister_callback, + .pfnStandby = gc5603_standby, + .pfnRestart = gc5603_restart, + .pfnMirrorFlip = gc5603_mirror_flip, + .pfnWriteReg = gc5603_write_register, + .pfnReadReg = gc5603_read_register, + .pfnSetBusInfo = gc5603_set_bus_info, + .pfnSetInit = sensor_set_init +}; + diff --git a/libraries/sensor/hi3516ev200/galaxycore_gc5603/gc5603_cmos.h b/libraries/sensor/hi3516ev200/galaxycore_gc5603/gc5603_cmos.h new file mode 100755 index 0000000..f945fe6 --- /dev/null +++ b/libraries/sensor/hi3516ev200/galaxycore_gc5603/gc5603_cmos.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) GK. All rights reserved. + */ + +#ifndef __GC5603_CMOS_H_ +#define __GC5603_CMOS_H_ + +#include "comm_isp.h" +#include "sns_ctrl.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +#define GC5603_I2C_ADDR 0x62 +#define GC5603_ADDR_BYTE 2 +#define GC5603_DATA_BYTE 1 + +#define GC5603_SENSOR_GET_CTX(dev, pstCtx) ((pstCtx) = gc5603_get_ctx(dev)) + +ISP_SNS_STATE_S *gc5603_get_ctx(VI_PIPE ViPipe); +ISP_SNS_COMMBUS_U *gc5603_get_bus_Info(VI_PIPE ViPipe); + +void gc5603_init(VI_PIPE ViPipe); +void gc5603_exit(VI_PIPE ViPipe); +void gc5603_standby(VI_PIPE ViPipe); +void gc5603_restart(VI_PIPE ViPipe); +void gc5603_mirror_flip(VI_PIPE ViPipe, ISP_SNS_MIRRORFLIP_TYPE_E eSnsMirrorFlip); +int gc5603_write_register(VI_PIPE ViPipe, GK_S32 addr, GK_S32 data); +int gc5603_read_register(VI_PIPE ViPipe, GK_S32 addr); + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ +#endif /* __gc5603_CMOS_H_ */ + diff --git a/libraries/sensor/hi3516ev200/galaxycore_gc5603/gc5603_cmos_ex.h b/libraries/sensor/hi3516ev200/galaxycore_gc5603/gc5603_cmos_ex.h new file mode 100755 index 0000000..e45b9b0 --- /dev/null +++ b/libraries/sensor/hi3516ev200/galaxycore_gc5603/gc5603_cmos_ex.h @@ -0,0 +1,1559 @@ +/* + * Copyright (c) GK. All rights reserved. + */ + +#ifndef __gc5603_CMOS_EX_H_ +#define __gc5603_CMOS_EX_H_ + +#include "awb_comm.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +static const ISP_CMOS_DPC_S g_stCmosDpc = { + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 0, 0, 0, 152, 220, 220, 220, 220, 220, 220, 152, 152, 152, 152, 152, 152 }, /* au16Strength[16] */ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50 }, /* au16BlendRatio[16] */ + 0, /* 0 for after drc, 1 for before wdr */ +}; + +static const ISP_CMOS_GE_S g_stIspGe = { + /* For GE */ + 1, /* bEnable */ + 13, /* u8Slope */ + 13, /* u8SensiSlope */ + 4800, /* u16SensiThr */ + /* ISO */ + /* 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 */ + { 4800, 4800, 4800, 4800, 4960, 4960, 4960, 4960, 5120, 5120, 5120, 5120, 5280, 5280, 5280, 5280 }, + { 128, 128, 128, 128, 129, 129, 129, 129, 130, 130, 130, 130, 131, 131, 131, 131 }, + { + 16384, 16384, 16384, 16384, 16384, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, + 32768 + } +}; + +static const ISP_CMOS_GE_S g_stIspWdrGe = { + /* For GE */ + 1, /* bEnable */ + 13, /* u8Slope */ + 13, /* u8SensiSlope */ + 4800, /* u16SensiThr */ + + /* ISO */ + /* 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192,16384, 32768 */ + { 4800, 4800, 4800, 4800, 4960, 4960, 4960, 4960, 5120, 5120, 5120, 5120, 5280, 5280, 5280, 5280 }, + { 128, 128, 128, 128, 129, 129, 129, 129, 130, 130, 130, 130, 131, 131, 131, 131 }, + { + 16384, 16384, 16384, 16384, 16384, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, + 32768 + } +}; + +static const ISP_CMOS_DEMOSAIC_S g_stIspDemosaic = { + 1, /* bEnable */ + /* au8NonDirStr */ + /* 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 */ + { 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 }, + /* au8NonDirLFDetailEhc */ + { 32, 32, 30, 28, 16, 16, 16, 22, 20, 18, 18, 18, 18, 18, 18, 18 }, + /* au8NonDirHFDetailEhc */ + { 3, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7 }, + /* au8DetailSmoothRange */ + { 1, 2, 2, 3, 6, 6, 7, 4, 5, 5, 7, 7, 7, 7, 7, 7 }, +}; + +static const ISP_CMOS_DEMOSAIC_S g_stIspDemosaicWdr = { + 1, /* bEnable */ + /* au8NonDirStr */ + /* 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 */ + { 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 }, + /* au8NonDirLFDetailEhc */ + { 32, 32, 30, 28, 16, 16, 16, 22, 20, 18, 18, 18, 18, 18, 18, 18 }, + /* au8NonDirHFDetailEhc */ + { 3, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7 }, + /* au8DetailSmoothRange */ + { 3, 3, 2, 3, 6, 6, 7, 4, 5, 5, 7, 7, 7, 7, 7, 7 }, +}; + +static const ISP_CMOS_ANTIFALSECOLOR_S g_stIspAntiFalseColor = { + 1, /* bEnable */ + /* 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 */ + { 8, 8, 10, 12, 18, 20, 22, 22, 20, 20, 18, 4, 3, 2, 1, 0 }, /* au8AntiFalseColorThreshold */ + { 10, 10, 12, 14, 16, 22, 22, 20, 20, 20, 18, 4, 3, 2, 1, 0 }, /* au8AntiFalseColorStrength */ +}; + +static const ISP_CMOS_ANTIFALSECOLOR_S g_stIspWdrAntiFalseColor = { + 1, /* bEnable */ + /* 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 */ + { 9, 14, 14, 14, 10, 14, 16, 4, 4, 4, 4, 4, 3, 2, 1, 0 }, /* au8AntiFalseColorThreshold */ + { 9, 14, 14, 14, 9, 12, 14, 4, 4, 4, 4, 4, 3, 2, 1, 0 }, /* au8AntiFalseColorStrength */ +}; + +/* **BAYER NR* */ +static ISP_CMOS_NOISE_CALIBRATION_S g_stIspNoiseCalibration = { + 9, /* Calibration Lut Num */ + { + { 100.000000f, 0.055957f, 0.015088f }, + { 200.000000f, 0.110436f, 0.000000f }, + { 400.000000f, 0.208753f, 0.000000f }, + { 800.000000f, 0.430601f, 0.000000f }, + { 1600.000000f, 0.868605f, 0.000000f }, + { 3200.000000f, 1.698758f, 0.741997f }, + { 6400.000000f, 3.370965f, 4.415539f }, + { 12800.000000f, 6.607119f, 15.181902f }, + { 25600.000000f, 12.530797f, 58.288128f }, + } +}; + +static const ISP_CMOS_BAYERNR_S g_stIspBayerNr = { + 1, /* bEnable */ + 0, /* bBnrMonoSensorEn */ + 0, /* bNrLscEnable */ + 96, /* u8BnrLscMaxGain */ + 256, /* u16BnrLscCmpStrength */ + { 64, 72, 75, 75, 80, 80, 80, 80, 75, 70, 60, 60, 55, 55, 50, 50 }, /* FineStr */ + { + { 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, /* ChromaStrR */ + { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, /* ChromaStrGr */ + { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, /* ChromaStrGb */ + { 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3 } /* ChromaStrB */ + }, + { 0, 0, 0, 0 }, /* WDRFrameStr */ + { 0, 0, 0, 0 }, /* FusionFrameStr */ + { + { 80, 100, 110, 110, 110, 120, 130, 150, 160, 170, 170, 170, 170, 170, 170, 170 }, /* CoarseStrR */ + { 80, 100, 110, 110, 110, 120, 130, 150, 160, 170, 170, 170, 170, 170, 170, 170 }, /* CoarseStrGR */ + { 80, 100, 110, 110, 110, 120, 130, 150, 160, 170, 170, 170, 170, 170, 170, 170 }, /* CoarseStrGB */ + { 80, 100, 110, 110, 110, 120, 130, 150, 160, 170, 170, 170, 170, 170, 170, 170 } /* CoarseStrB */ + }, + { 22, 22, 20, 18, 18, 16, 16, 14, 14, 12, 12, 12, 12, 10, 10, 10 }, /* lutCoringWeight */ + { + 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, /* CoringRatio */ + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 100, 100, 100, 100, 100, 100, 100 + }, +}; + +static const ISP_CMOS_BAYERNR_S g_stIspBayerNrWdr2To1 = { + 1, /* bEnable */ + 0, /* bBnrMonoSensorEn */ + 0, /* bNrLscEnable */ + 96, /* u8BnrLscMaxGain */ + 256, /* u16BnrLscCmpStrength */ + { 70, 80, 85, 90, 95, 75, 70, 65, 60, 55, 50, 40, 40, 30, 30, 30 }, /* FineStr */ + { + { 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, /* ChromaStrR */ + { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, /* ChromaStrGr */ + { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, /* ChromaStrGb */ + { 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3 } /* ChromaStrB */ + }, + { 9, 7, 5, 0 }, /* WDRFrameStr */ + { 26, 10, 0, 0 }, /* FusionCoarseStr */ + { + { 100, 110, 110, 110, 110, 110, 110, 140, 160, 160, 180, 200, 200, 200, 200, 200 }, /* CoarseStrR */ + { 100, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110 }, /* CoarseStrGR */ + { 100, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110 }, /* CoarseStrGB */ + { 100, 110, 110, 110, 110, 120, 120, 140, 160, 160, 180, 200, 200, 200, 200, 200 } /* CoarseStrB */ + }, + { 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50 }, /* lutCoringWeight */ + { + 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 100, 100, 100, 100, 100, 100, 100 + }, /* coring ratio */ +}; + +static const ISP_CMOS_LDCI_S g_stIspLdci = { + /* bEnable */ + 1, + /* u8GaussLPFSigma */ + 16, + /* 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 */ + /* au8HePosWgt */ + { 64, 64, 30, 50, 40, 40, 40, 20, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* au8HePosSigma */ + { 40, 40, 40, 60, 80, 40, 50, 90, 80, 8, 6, 2, 1, 1, 1, 1 }, + /* au8HePosMean */ + { 80, 80, 100, 132, 120, 160, 190, 94, 80, 0, 0, 0, 0, 0, 0, 0 }, + /* au8HeNegWgt */ + { 30, 30, 30, 50, 64, 64, 64, 64, 64, 0, 0, 0, 0, 0, 0, 0 }, + /* au8HeNegSigma */ + { 40, 40, 40, 80, 80, 80, 80, 80, 80, 8, 6, 2, 1, 1, 1, 1 }, + /* au8HeNegMean */ + { 120, 120, 80, 80, 80, 80, 60, 30, 30, 0, 0, 0, 0, 0, 0, 0 }, + /* au16BlcCtrl */ + { 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 } +}; + +static const ISP_CMOS_LDCI_S g_stIspLdciIr = { + /* bEnable */ + 1, + /* u8GaussLPFSigma */ + 16, + /* 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 */ + /* au8HePosWgt */ + { 99, 99, 99, 80, 120, 120, 120, 78, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* au8HePosSigma */ + { 66, 66, 66, 60, 60, 40, 50, 30, 30, 8, 6, 2, 1, 1, 1, 1 }, + /* au8HePosMean */ + { 132, 132, 132, 132, 180, 160, 190, 134, 80, 0, 0, 0, 0, 0, 0, 0 }, + /* au8HeNegWgt */ + { 100, 100, 110, 110, 150, 150, 144, 100, 100, 0, 0, 0, 0, 0, 0, 0 }, + /* au8HeNegSigma */ + { 80, 80, 80, 80, 80, 80, 80, 80, 80, 8, 6, 2, 1, 1, 1, 1 }, + /* au8HeNegMean */ + { 160, 160, 180, 190, 200, 80, 90, 30, 30, 0, 0, 0, 0, 0, 0, 0 }, + /* au16BlcCtrl */ + { 30, 30, 30, 100, 200, 200, 200, 30, 30, 30, 30, 30, 30, 30, 30, 30 } +}; + +static const ISP_CMOS_LDCI_S g_stIspWdrLdci = { + /* bEnable */ + 1, + /* u8GaussLPFSigma */ + 15, + /* 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 */ + /* au8HePosWgt */ + { 30, 40, 30, 20, 10, 0, 0, 60, 60, 0, 0, 0, 0, 0, 0, 0 }, + /* au8HePosSigma */ + { 40, 40, 40, 40, 40, 40, 40, 40, 40, 8, 6, 2, 1, 1, 1, 1 }, + /* au8HePosMean */ + { 120, 120, 120, 120, 120, 120, 120, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* au8HeNegWgt */ + { 30, 30, 40, 40, 60, 60, 60, 60, 6, 0, 0, 0, 0, 0, 0, 0 }, + /* au8HeNegSigma */ + { 40, 40, 40, 40, 40, 40, 40, 40, 36, 8, 6, 2, 1, 1, 1, 1 }, + /* au8HeNegMean */ + { 135, 135, 135, 135, 135, 135, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* au16BlcCtrl */ + { 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 5, 5, 5, 5, 5 } +}; + +static const ISP_CMOS_GAMMA_S g_stIspGamma = { + { + 0, 11, 23, 34, 45, 57, 68, 80, 91, 102, 114, 125, 137, 148, + 160, 171, 183, 194, 205, 217, 228, 240, 251, 263, 274, + 286, 297, 309, 320, 332, 343, 354, 366, 377, 389, 400, 412, 423, 434, 446, 457, 468, 480, 491, 503, 514, 525, + 536, 548, 559, 570, 581, 593, 604, 615, 626, 637, 649, 660, 671, 682, 693, 704, 715, 726, 737, 748, 759, 770, + 781, 793, 804, 815, 826, 837, 849, 860, 871, 882, 894, 905, 916, 928, 939, 950, 961, 973, 984, 995, 1006, 1018, + 1029, 1040, 1051, 1062, 1073, 1084, 1095, 1106, 1117, 1128, 1139, 1150, 1160, 1171, 1182, 1192, 1203, 1213, + 1224, 1234, 1244, 1254, 1264, 1275, 1284, 1294, 1304, 1314, 1324, 1333, 1343, 1352, 1361, 1370, 1379, 1388, + 1397, 1406, 1415, 1423, 1432, 1440, 1448, 1457, 1465, 1473, 1481, 1489, 1496, 1504, 1512, 1519, 1527, 1534, + 1542, 1549, 1556, 1563, 1571, 1578, 1585, 1592, 1598, 1605, 1612, 1619, 1626, 1632, 1639, 1645, 1652, 1658, + 1665, 1671, 1677, 1684, 1690, 1696, 1702, 1708, 1715, 1721, 1727, 1733, 1739, 1745, 1751, 1757, 1763, 1769, + 1775, 1781, 1787, 1793, 1799, 1805, 1810, 1816, 1822, 1828, 1834, 1840, 1846, 1852, 1858, 1863, 1869, 1875, + 1880, 1886, 1892, 1897, 1903, 1908, 1914, 1919, 1925, 1930, 1935, 1941, 1946, 1951, 1956, 1962, 1967, 1972, + 1977, 1982, 1987, 1992, 1997, 2002, 2007, 2012, 2017, 2022, 2027, 2032, 2037, 2041, 2046, 2051, 2056, 2061, + 2066, 2070, 2075, 2080, 2085, 2089, 2094, 2099, 2103, 2108, 2113, 2117, 2122, 2127, 2131, 2136, 2141, 2145, + 2150, 2155, 2159, 2164, 2168, 2173, 2177, 2182, 2187, 2191, 2196, 2200, 2205, 2210, 2214, 2219, 2223, 2228, + 2232, 2237, 2241, 2246, 2250, 2254, 2259, 2263, 2268, 2272, 2276, 2281, 2285, 2289, 2294, 2298, 2302, 2307, + 2311, 2315, 2319, 2324, 2328, 2332, 2336, 2340, 2344, 2349, 2353, 2357, 2361, 2365, 2369, 2373, 2377, 2381, + 2385, 2389, 2393, 2397, 2401, 2405, 2409, 2413, 2416, 2420, 2424, 2428, 2432, 2436, 2439, 2443, 2447, 2450, + 2454, 2458, 2461, 2465, 2468, 2472, 2475, 2479, 2482, 2486, 2489, 2493, 2496, 2500, 2503, 2506, 2510, 2513, + 2516, 2520, 2523, 2526, 2529, 2533, 2536, 2539, 2542, 2546, 2549, 2552, 2555, 2558, 2561, 2565, 2568, 2571, + 2574, 2577, 2580, 2583, 2586, 2590, 2593, 2596, 2599, 2602, 2605, 2608, 2611, 2614, 2617, 2621, 2624, 2627, + 2630, 2633, 2636, 2639, 2642, 2646, 2649, 2652, 2656, 2659, 2662, 2665, 2668, 2671, 2674, 2677, 2680, 2683, + 2686, 2690, 2693, 2696, 2699, 2702, 2705, 2708, 2711, 2714, 2717, 2720, 2723, 2726, 2729, 2732, 2735, 2738, + 2741, 2744, 2747, 2750, 2753, 2756, 2759, 2762, 2764, 2767, 2770, 2773, 2776, 2779, 2782, 2785, 2788, 2791, + 2794, 2796, 2799, 2802, 2805, 2808, 2811, 2814, 2817, 2820, 2822, 2825, 2828, 2831, 2834, 2837, 2840, 2843, + 2845, 2848, 2851, 2853, 2856, 2859, 2862, 2865, 2868, 2871, 2874, 2877, 2879, 2882, 2885, 2887, 2890, 2893, + 2896, 2899, 2901, 2904, 2907, 2909, 2912, 2915, 2918, 2920, 2923, 2926, 2929, 2932, 2934, 2937, 2940, 2942, + 2945, 2948, 2951, 2954, 2956, 2959, 2962, 2964, 2966, 2969, 2972, 2974, 2977, 2980, 2983, 2986, 2988, 2991, + 2994, 2996, 2998, 3001, 3004, 3006, 3009, 3012, 3015, 3018, 3020, 3023, 3026, 3028, 3031, 3033, 3035, 3038, + 3040, 3043, 3046, 3048, 3051, 3054, 3057, 3059, 3062, 3064, 3066, 3069, 3071, 3074, 3077, 3080, 3082, 3085, + 3088, 3090, 3093, 3095, 3097, 3100, 3102, 3105, 3108, 3110, 3113, 3115, 3117, 3120, 3122, 3125, 3128, 3130, + 3133, 3135, 3138, 3140, 3143, 3145, 3147, 3150, 3152, 3155, 3158, 3160, 3163, 3165, 3167, 3170, 3172, 3175, + 3178, 3180, 3183, 3185, 3187, 3189, 3192, 3194, 3196, 3199, 3201, 3204, 3207, 3209, 3211, 3214, 3217, 3219, + 3222, 3224, 3226, 3228, 3231, 3233, 3235, 3238, 3241, 3243, 3245, 3247, 3250, 3252, 3254, 3257, 3260, 3262, + 3264, 3267, 3269, 3271, 3273, 3276, 3279, 3281, 3283, 3286, 3288, 3290, 3292, 3295, 3298, 3300, 3302, 3305, + 3307, 3309, 3311, 3313, 3316, 3318, 3320, 3322, 3325, 3327, 3329, 3332, 3335, 3337, 3339, 3342, 3344, 3346, + 3348, 3350, 3353, 3355, 3357, 3360, 3362, 3364, 3366, 3368, 3371, 3373, 3375, 3378, 3380, 3382, 3384, 3386, + 3389, 3391, 3393, 3396, 3398, 3400, 3402, 3405, 3407, 3409, 3411, 3413, 3416, 3418, 3420, 3423, 3425, 3427, + 3429, 3431, 3434, 3436, 3438, 3441, 3443, 3445, 3447, 3449, 3452, 3454, 3456, 3459, 3461, 3463, 3465, 3467, + 3469, 3471, 3473, 3475, 3478, 3480, 3482, 3484, 3487, 3489, 3491, 3494, 3496, 3498, 3500, 3502, 3504, 3506, + 3508, 3511, 3513, 3515, 3517, 3519, 3521, 3523, 3525, 3528, 3530, 3532, 3534, 3536, 3538, 3540, 3542, 3545, + 3547, 3549, 3551, 3553, 3555, 3557, 3559, 3561, 3564, 3566, 3568, 3570, 3572, 3574, 3576, 3578, 3581, 3583, + 3585, 3587, 3589, 3591, 3593, 3595, 3598, 3600, 3602, 3604, 3606, 3608, 3610, 3612, 3614, 3616, 3618, 3620, + 3622, 3624, 3626, 3628, 3631, 3633, 3635, 3637, 3639, 3641, 3643, 3645, 3647, 3649, 3651, 3653, 3655, 3657, + 3659, 3661, 3663, 3665, 3667, 3670, 3672, 3674, 3676, 3678, 3680, 3682, 3684, 3686, 3688, 3690, 3692, 3694, + 3696, 3698, 3700, 3702, 3704, 3706, 3708, 3710, 3712, 3714, 3716, 3718, 3720, 3722, 3724, 3726, 3728, 3730, + 3732, 3734, 3736, 3738, 3740, 3742, 3744, 3746, 3748, 3750, 3752, 3754, 3756, 3758, 3760, 3762, 3764, 3766, + 3767, 3769, 3771, 3773, 3775, 3777, 3779, 3781, 3783, 3785, 3787, 3789, 3791, 3793, 3795, 3797, 3799, 3801, + 3803, 3804, 3806, 3808, 3810, 3812, 3814, 3816, 3818, 3820, 3822, 3824, 3826, 3828, 3830, 3832, 3834, 3836, + 3837, 3839, 3841, 3843, 3845, 3847, 3849, 3851, 3853, 3855, 3857, 3858, 3860, 3862, 3864, 3866, 3868, 3870, + 3872, 3873, 3875, 3877, 3879, 3881, 3883, 3885, 3887, 3888, 3890, 3892, 3894, 3896, 3898, 3900, 3902, 3904, + 3905, 3907, 3909, 3911, 3913, 3915, 3917, 3919, 3920, 3922, 3924, 3926, 3928, 3930, 3932, 3934, 3935, 3937, + 3939, 3941, 3943, 3945, 3947, 3949, 3950, 3952, 3954, 3955, 3957, 3959, 3961, 3963, 3965, 3967, 3969, 3971, + 3972, 3974, 3976, 3977, 3979, 3981, 3983, 3985, 3987, 3989, 3991, 3993, 3994, 3996, 3998, 4000, 4001, 4003, + 4005, 4006, 4008, 4010, 4012, 4014, 4016, 4018, 4020, 4022, 4023, 4025, 4027, 4028, 4030, 4032, 4034, 4036, + 4037, 4039, 4041, 4042, 4044, 4046, 4048, 4050, 4052, 4054, 4056, 4058, 4059, 4061, 4063, 4064, 4066, 4068, + 4070, 4072, 4073, 4075, 4077, 4078, 4080, 4082, 4084, 4086, 4087, 4089, 4091, 4092, 4094, 4095 + } +}; + +static const ISP_CMOS_GAMMA_S g_stIspGammaIr = { + { + 0, 11, 23, 34, 45, 57, 68, 80, 91, 102, 114, 125, 137, 148, 160, 171, + 183, 194, 205, 217, 228, 240, 251, 263, 274, 286, 297, 309, 320, 332, + 343, 354, 366, 377, 389, 400, 412, 423, 434, 446, 457, 468, 480, 491, 503, 514, 525, + 536, 548, 559, 570, 581, 593, 604, 615, 626, 637, 649, 660, 671, 682, 693, 704, 715, 726, 737, 748, 759, 770, + 781, 793, 804, 815, 826, 837, 849, 860, 871, 882, 894, 905, 916, 928, 939, 950, 961, 973, 984, 995, 1006, 1018, + 1029, 1040, 1051, 1062, 1073, 1084, 1095, 1106, 1117, 1128, 1139, 1150, 1160, 1171, 1182, 1192, 1203, 1213, + 1224, 1234, 1244, 1254, 1264, 1275, 1284, 1294, 1304, 1314, 1324, 1333, 1343, 1352, 1361, 1370, 1379, 1388, + 1397, 1406, 1415, 1423, 1432, 1440, 1448, 1457, 1465, 1473, 1481, 1489, 1496, 1504, 1512, 1519, 1527, 1534, + 1542, 1549, 1556, 1563, 1571, 1578, 1585, 1592, 1598, 1605, 1612, 1619, 1626, 1632, 1639, 1645, 1652, 1658, + 1665, 1671, 1677, 1684, 1690, 1696, 1702, 1708, 1715, 1721, 1727, 1733, 1739, 1745, 1751, 1757, 1763, 1769, + 1775, 1781, 1787, 1793, 1799, 1805, 1810, 1816, 1822, 1828, 1834, 1840, 1846, 1852, 1858, 1863, 1869, 1875, + 1880, 1886, 1892, 1897, 1903, 1908, 1914, 1919, 1925, 1930, 1935, 1941, 1946, 1951, 1956, 1962, 1967, 1972, + 1977, 1982, 1987, 1992, 1997, 2002, 2007, 2012, 2017, 2022, 2027, 2032, 2037, 2041, 2046, 2051, 2056, 2061, + 2066, 2070, 2075, 2080, 2085, 2089, 2094, 2099, 2103, 2108, 2113, 2117, 2122, 2127, 2131, 2136, 2141, 2145, + 2150, 2155, 2159, 2164, 2168, 2173, 2177, 2182, 2187, 2191, 2196, 2200, 2205, 2210, 2214, 2219, 2223, 2228, + 2232, 2237, 2241, 2246, 2250, 2254, 2259, 2263, 2268, 2272, 2276, 2281, 2285, 2289, 2294, 2298, 2302, 2307, + 2311, 2315, 2319, 2324, 2328, 2332, 2336, 2340, 2344, 2349, 2353, 2357, 2361, 2365, 2369, 2373, 2377, 2381, + 2385, 2389, 2393, 2397, 2401, 2405, 2409, 2413, 2416, 2420, 2424, 2428, 2432, 2436, 2439, 2443, 2447, 2450, + 2454, 2458, 2461, 2465, 2468, 2472, 2475, 2479, 2482, 2486, 2489, 2493, 2496, 2500, 2503, 2506, 2510, 2513, + 2516, 2520, 2523, 2526, 2529, 2533, 2536, 2539, 2542, 2546, 2549, 2552, 2555, 2558, 2561, 2565, 2568, 2571, + 2574, 2577, 2580, 2583, 2586, 2590, 2593, 2596, 2599, 2602, 2605, 2608, 2611, 2614, 2617, 2621, 2624, 2627, + 2630, 2633, 2636, 2639, 2642, 2646, 2649, 2652, 2656, 2659, 2662, 2665, 2668, 2671, 2674, 2677, 2680, 2683, + 2686, 2690, 2693, 2696, 2699, 2702, 2705, 2708, 2711, 2714, 2717, 2720, 2723, 2726, 2729, 2732, 2735, 2738, + 2741, 2744, 2747, 2750, 2753, 2756, 2759, 2762, 2764, 2767, 2770, 2773, 2776, 2779, 2782, 2785, 2788, 2791, + 2794, 2796, 2799, 2802, 2805, 2808, 2811, 2814, 2817, 2820, 2822, 2825, 2828, 2831, 2834, 2837, 2840, 2843, + 2845, 2848, 2851, 2853, 2856, 2859, 2862, 2865, 2868, 2871, 2874, 2877, 2879, 2882, 2885, 2887, 2890, 2893, + 2896, 2899, 2901, 2904, 2907, 2909, 2912, 2915, 2918, 2920, 2923, 2926, 2929, 2932, 2934, 2937, 2940, 2942, + 2945, 2948, 2951, 2954, 2956, 2959, 2962, 2964, 2966, 2969, 2972, 2974, 2977, 2980, 2983, 2986, 2988, 2991, + 2994, 2996, 2998, 3001, 3004, 3006, 3009, 3012, 3015, 3018, 3020, 3023, 3026, 3028, 3031, 3033, 3035, 3038, + 3040, 3043, 3046, 3048, 3051, 3054, 3057, 3059, 3062, 3064, 3066, 3069, 3071, 3074, 3077, 3080, 3082, 3085, + 3088, 3090, 3093, 3095, 3097, 3100, 3102, 3105, 3108, 3110, 3113, 3115, 3117, 3120, 3122, 3125, 3128, 3130, + 3133, 3135, 3138, 3140, 3143, 3145, 3147, 3150, 3152, 3155, 3158, 3160, 3163, 3165, 3167, 3170, 3172, 3175, + 3178, 3180, 3183, 3185, 3187, 3189, 3192, 3194, 3196, 3199, 3201, 3204, 3207, 3209, 3211, 3214, 3217, 3219, + 3222, 3224, 3226, 3228, 3231, 3233, 3235, 3238, 3241, 3243, 3245, 3247, 3250, 3252, 3254, 3257, 3260, 3262, + 3264, 3267, 3269, 3271, 3273, 3276, 3279, 3281, 3283, 3286, 3288, 3290, 3292, 3295, 3298, 3300, 3302, 3305, + 3307, 3309, 3311, 3313, 3316, 3318, 3320, 3322, 3325, 3327, 3329, 3332, 3335, 3337, 3339, 3342, 3344, 3346, + 3348, 3350, 3353, 3355, 3357, 3360, 3362, 3364, 3366, 3368, 3371, 3373, 3375, 3378, 3380, 3382, 3384, 3386, + 3389, 3391, 3393, 3396, 3398, 3400, 3402, 3405, 3407, 3409, 3411, 3413, 3416, 3418, 3420, 3423, 3425, 3427, + 3429, 3431, 3434, 3436, 3438, 3441, 3443, 3445, 3447, 3449, 3452, 3454, 3456, 3459, 3461, 3463, 3465, 3467, + 3469, 3471, 3473, 3475, 3478, 3480, 3482, 3484, 3487, 3489, 3491, 3494, 3496, 3498, 3500, 3502, 3504, 3506, + 3508, 3511, 3513, 3515, 3517, 3519, 3521, 3523, 3525, 3528, 3530, 3532, 3534, 3536, 3538, 3540, 3542, 3545, + 3547, 3549, 3551, 3553, 3555, 3557, 3559, 3561, 3564, 3566, 3568, 3570, 3572, 3574, 3576, 3578, 3581, 3583, + 3585, 3587, 3589, 3591, 3593, 3595, 3598, 3600, 3602, 3604, 3606, 3608, 3610, 3612, 3614, 3616, 3618, 3620, + 3622, 3624, 3626, 3628, 3631, 3633, 3635, 3637, 3639, 3641, 3643, 3645, 3647, 3649, 3651, 3653, 3655, 3657, + 3659, 3661, 3663, 3665, 3667, 3670, 3672, 3674, 3676, 3678, 3680, 3682, 3684, 3686, 3688, 3690, 3692, 3694, + 3696, 3698, 3700, 3702, 3704, 3706, 3708, 3710, 3712, 3714, 3716, 3718, 3720, 3722, 3724, 3726, 3728, 3730, + 3732, 3734, 3736, 3738, 3740, 3742, 3744, 3746, 3748, 3750, 3752, 3754, 3756, 3758, 3760, 3762, 3764, 3766, + 3767, 3769, 3771, 3773, 3775, 3777, 3779, 3781, 3783, 3785, 3787, 3789, 3791, 3793, 3795, 3797, 3799, 3801, + 3803, 3804, 3806, 3808, 3810, 3812, 3814, 3816, 3818, 3820, 3822, 3824, 3826, 3828, 3830, 3832, 3834, 3836, + 3837, 3839, 3841, 3843, 3845, 3847, 3849, 3851, 3853, 3855, 3857, 3858, 3860, 3862, 3864, 3866, 3868, 3870, + 3872, 3873, 3875, 3877, 3879, 3881, 3883, 3885, 3887, 3888, 3890, 3892, 3894, 3896, 3898, 3900, 3902, 3904, + 3905, 3907, 3909, 3911, 3913, 3915, 3917, 3919, 3920, 3922, 3924, 3926, 3928, 3930, 3932, 3934, 3935, 3937, + 3939, 3941, 3943, 3945, 3947, 3949, 3950, 3952, 3954, 3955, 3957, 3959, 3961, 3963, 3965, 3967, 3969, 3971, + 3972, 3974, 3976, 3977, 3979, 3981, 3983, 3985, 3987, 3989, 3991, 3993, 3994, 3996, 3998, 4000, 4001, 4003, + 4005, 4006, 4008, 4010, 4012, 4014, 4016, 4018, 4020, 4022, 4023, 4025, 4027, 4028, 4030, 4032, 4034, 4036, + 4037, 4039, 4041, 4042, 4044, 4046, 4048, 4050, 4052, 4054, 4056, 4058, 4059, 4061, 4063, 4064, 4066, 4068, + 4070, 4072, 4073, 4075, 4077, 4078, 4080, 4082, 4084, 4086, 4087, 4089, 4091, 4092, 4094, 4095 + } +}; + +static const ISP_CMOS_GAMMA_S g_stIspGammaFSWDR = { + { + 0, 5, 10, 15, 20, 25, 30, 35, 40, 44, 49, 54, 59, 64, 69, 74, 79, 84, 89, 94, 99, 103, 108, 113, 118, 123, + 128, 133, 138, 142, 147, 152, 157, 162, 167, 171, 176, 181, 186, 191, 196, 200, 205, 210, 215, 220, 224, 229, + 234, 239, 244, 249, 253, 258, 263, 268, 273, 278, 283, 287, 292, 297, 302, 307, 312, 317, 321, 326, 331, 336, + 341, 346, 351, 356, 361, 366, 371, 376, 381, 386, 391, 396, 401, 406, 411, 416, 421, 426, 431, 436, 441, 446, + 451, 456, 461, 466, 472, 477, 482, 487, 492, 498, 503, 508, 513, 519, 524, 529, 535, 540, 545, 551, 556, 561, + 567, 572, 578, 583, 589, 594, 600, 605, 611, 616, 622, 628, 633, 639, 645, 650, 656, 662, 667, 673, 679, 685, + 691, 697, 702, 708, 714, 720, 726, 732, 738, 744, 750, 756, 762, 768, 774, 780, 787, 793, 799, 805, 811, 817, + 824, 830, 836, 842, 849, 855, 861, 867, 874, 880, 886, 893, 899, 905, 912, 918, 925, 931, 937, 944, 950, 957, + 963, 970, 976, 982, 989, 995, 1002, 1008, 1015, 1021, 1028, 1034, 1041, 1047, 1054, 1060, 1067, 1074, 1080, + 1087, 1093, 1100, 1106, 1113, 1119, 1126, 1132, 1139, 1145, 1152, 1159, 1165, 1172, 1178, 1185, 1191, 1198, + 1204, 1211, 1217, 1224, 1230, 1237, 1244, 1250, 1257, 1263, 1270, 1276, 1283, 1289, 1295, 1302, 1308, 1315, + 1321, 1328, 1334, 1341, 1347, 1353, 1360, 1366, 1373, 1379, 1385, 1392, 1398, 1404, 1411, 1417, 1423, 1430, + 1436, 1442, 1448, 1455, 1461, 1467, 1473, 1479, 1486, 1492, 1498, 1505, 1511, 1517, 1524, 1530, 1536, 1543, + 1549, 1555, 1562, 1568, 1575, 1581, 1587, 1594, 1600, 1607, 1613, 1620, 1626, 1632, 1639, 1645, 1652, 1658, + 1665, 1671, 1678, 1684, 1690, 1697, 1703, 1710, 1716, 1723, 1729, 1736, 1742, 1749, 1755, 1761, 1768, 1774, + 1781, 1787, 1794, 1800, 1806, 1813, 1819, 1826, 1832, 1838, 1845, 1851, 1857, 1864, 1870, 1876, 1883, 1889, + 1895, 1902, 1908, 1914, 1920, 1927, 1933, 1939, 1945, 1952, 1958, 1964, 1970, 1976, 1982, 1988, 1995, 2001, + 2007, 2013, 2019, 2025, 2031, 2037, 2043, 2049, 2055, 2060, 2066, 2072, 2078, 2084, 2090, 2095, 2101, 2107, + 2113, 2118, 2124, 2130, 2135, 2141, 2147, 2152, 2158, 2163, 2169, 2174, 2180, 2185, 2190, 2196, 2201, 2206, + 2212, 2217, 2222, 2227, 2232, 2238, 2243, 2248, 2253, 2258, 2263, 2268, 2273, 2278, 2283, 2287, 2292, 2297, + 2302, 2307, 2312, 2316, 2321, 2326, 2330, 2335, 2340, 2344, 2349, 2354, 2358, 2363, 2367, 2372, 2376, 2381, + 2385, 2390, 2394, 2398, 2403, 2407, 2411, 2416, 2420, 2424, 2429, 2433, 2437, 2441, 2446, 2450, 2454, 2458, + 2462, 2467, 2471, 2475, 2479, 2483, 2487, 2491, 2495, 2499, 2503, 2507, 2511, 2515, 2519, 2523, 2527, 2531, + 2535, 2539, 2543, 2547, 2551, 2555, 2558, 2562, 2566, 2570, 2574, 2578, 2582, 2585, 2589, 2593, 2597, 2601, + 2604, 2608, 2612, 2616, 2619, 2623, 2627, 2631, 2634, 2638, 2642, 2646, 2649, 2653, 2657, 2660, 2664, 2668, + 2671, 2675, 2679, 2683, 2686, 2690, 2694, 2697, 2701, 2705, 2708, 2712, 2716, 2719, 2723, 2727, 2730, 2734, + 2738, 2741, 2745, 2749, 2752, 2756, 2760, 2764, 2768, 2771, 2775, 2779, 2782, 2786, 2789, 2793, 2796, 2800, + 2804, 2807, 2811, 2814, 2818, 2821, 2825, 2828, 2832, 2835, 2839, 2842, 2846, 2849, 2853, 2856, 2860, 2863, + 2867, 2870, 2873, 2877, 2880, 2884, 2887, 2891, 2894, 2897, 2901, 2904, 2908, 2911, 2914, 2918, 2921, 2924, + 2928, 2931, 2934, 2938, 2941, 2944, 2948, 2951, 2954, 2958, 2961, 2964, 2967, 2971, 2974, 2977, 2981, 2984, + 2987, 2990, 2994, 2997, 3000, 3003, 3006, 3010, 3013, 3016, 3019, 3023, 3026, 3029, 3032, 3035, 3038, 3042, + 3045, 3048, 3051, 3054, 3057, 3061, 3064, 3067, 3070, 3073, 3076, 3079, 3082, 3086, 3089, 3092, 3095, 3098, + 3101, 3104, 3107, 3110, 3113, 3116, 3119, 3122, 3125, 3129, 3132, 3135, 3138, 3141, 3144, 3147, 3150, 3153, + 3156, 3159, 3162, 3165, 3168, 3171, 3174, 3177, 3180, 3183, 3185, 3188, 3191, 3194, 3197, 3200, 3203, 3206, + 3209, 3212, 3215, 3218, 3221, 3224, 3227, 3229, 3232, 3235, 3238, 3241, 3244, 3247, 3250, 3252, 3255, 3258, + 3261, 3264, 3267, 3270, 3272, 3275, 3278, 3281, 3284, 3287, 3289, 3292, 3295, 3298, 3301, 3303, 3306, 3309, + 3312, 3315, 3317, 3320, 3323, 3326, 3328, 3331, 3334, 3337, 3339, 3342, 3345, 3348, 3350, 3353, 3356, 3359, + 3361, 3364, 3367, 3370, 3372, 3375, 3378, 3380, 3383, 3386, 3388, 3391, 3394, 3396, 3399, 3402, 3405, 3407, + 3410, 3413, 3415, 3418, 3420, 3423, 3426, 3428, 3431, 3434, 3436, 3439, 3442, 3444, 3447, 3449, 3452, 3455, + 3457, 3460, 3462, 3465, 3468, 3470, 3473, 3475, 3478, 3481, 3483, 3486, 3488, 3491, 3493, 3496, 3498, 3501, + 3504, 3506, 3509, 3511, 3514, 3516, 3519, 3521, 3524, 3526, 3529, 3531, 3534, 3536, 3539, 3541, 3544, 3546, + 3549, 3551, 3554, 3556, 3559, 3561, 3564, 3566, 3569, 3571, 3574, 3576, 3579, 3581, 3584, 3586, 3588, 3591, + 3593, 3596, 3598, 3601, 3603, 3606, 3608, 3610, 3613, 3615, 3618, 3620, 3622, 3625, 3627, 3630, 3632, 3634, + 3637, 3639, 3642, 3644, 3646, 3649, 3651, 3654, 3656, 3658, 3661, 3663, 3665, 3668, 3670, 3673, 3675, 3677, + 3680, 3682, 3684, 3687, 3689, 3691, 3694, 3696, 3698, 3701, 3703, 3705, 3708, 3710, 3712, 3714, 3717, 3719, + 3721, 3724, 3726, 3728, 3731, 3733, 3735, 3737, 3740, 3742, 3744, 3747, 3749, 3751, 3753, 3756, 3758, 3760, + 3762, 3765, 3767, 3769, 3771, 3774, 3776, 3778, 3780, 3783, 3785, 3787, 3789, 3792, 3794, 3796, 3798, 3801, + 3803, 3805, 3807, 3809, 3812, 3814, 3816, 3818, 3820, 3823, 3825, 3827, 3829, 3831, 3834, 3836, 3838, 3840, + 3842, 3844, 3847, 3849, 3851, 3853, 3855, 3857, 3860, 3862, 3864, 3866, 3868, 3870, 3873, 3875, 3877, 3879, + 3881, 3883, 3885, 3888, 3890, 3892, 3894, 3896, 3898, 3900, 3902, 3905, 3907, 3909, 3911, 3913, 3915, 3917, + 3919, 3921, 3924, 3926, 3928, 3930, 3932, 3934, 3936, 3938, 3940, 3942, 3944, 3946, 3949, 3951, 3953, 3955, + 3957, 3959, 3961, 3963, 3965, 3967, 3969, 3971, 3973, 3975, 3977, 3979, 3981, 3984, 3986, 3988, 3990, 3992, + 3994, 3996, 3998, 4000, 4002, 4004, 4006, 4008, 4010, 4012, 4014, 4016, 4018, 4020, 4022, 4024, 4026, 4028, + 4030, 4032, 4034, 4036, 4038, 4040, 4042, 4044, 4046, 4048, 4050, 4052, 4054, 4056, 4058, 4060, 4062, 4064, + 4066, 4068, 4070, 4072, 4074, 4075, 4077, 4079, 4081, 4083, 4085, 4087, 4089, 4091, 4093, 4095 + } +}; + +static const ISP_CMOS_PREGAMMA_S g_stPreGamma = { + 0, + { + 3821, 7131, 9741, 11691, 13307, 14713, 15971, 17118, + 18179, 20099, 21818, 23385, 24833, 26185, 27456, 28659, + 29804, 30897, 31945, 32952, 33923, 35770, 37506, 39150, + 40713, 42207, 43638, 45014, 46340, 47622, 48863, 50066, + 51235, 52373, 53481, 54561, 55616, 57656, 59611, 61491, + 63303, 65054, 66749, 68393, 69990, 71543, 73057, 74533, + 75974, 77383, 78761, 80110, 81432, 83999, 86475, 88866, + 91182, 93428, 95609, 97731, 99799, 101815, 103784, 105708, + 107590, 109433, 111239, 113010, 114747, 118128, 121395, 124558, + 127626, 130606, 133505, 136330, 139084, 141773, 144402, 146973, + 149491, 151957, 154376, 156749, 159079, 161368, 163618, 165831, + 168008, 170152, 172263, 174342, 176392, 178413, 180407, 182374, + 184315, 186232, 188125, 189995, 191842, 193668, 197259, 200771, + 204210, 207580, 210884, 214126, 217308, 220435, 223509, 226532, + 229506, 232434, 235318, 238159, 240959, 243720, 246443, 249130, + 251782, 254400, 256986, 259540, 262064, 264559, 267025, 269464, + 271876, 274262, 276623, 278960, 281273, 283562, 288076, 292504, + 296852, 301124, 305323, 309452, 313515, 317515, 321454, 325335, + 329160, 332931, 336651, 340322, 343945, 347521, 351054, 354543, + 357991, 361399, 364767, 368099, 371394, 374653, 377878, 381070, + 384230, 387358, 390456, 393523, 396562, 399573, 405512, 411348, + 417083, 422724, 428274, 433738, 439119, 444420, 449646, 454798, + 459880, 464894, 469842, 474728, 479554, 484320, 489030, 493685, + 498287, 502838, 507339, 511791, 516197, 520557, 524874, 529147, + 533378, 537569, 541720, 545833, 549908, 553946, 557949, 561917, + 565852, 569753, 577458, 585040, 592504, 599854, 607096, 614234, + 621272, 628214, 635064, 641824, 648498, 655090, 661601, 668035, + 674394, 680681, 686897, 693045, 699128, 705146, 711103, 716999, + 722836, 728616, 734341, 740012, 745630, 751197, 756713, 762181, + 767602, 778305, 788831, 799189, 809384, 819425, 829318, 839069, + 848683, 858166, 867523, 876757, 885875, 894879, 903774, 912563, + 921249, 938329, 955037, 971395, 987423, 1003139, 1018560, 1033701, + 1048575 + } +}; + +static const ISP_CMOS_SHARPEN_S g_stIspYuvSharpenWdr = { + /* u8SkinUmin */ + 110, + /* u8SkinVmin */ + 128, + /* u8SkinUmax */ + 128, + /* u8SkinVmax */ + 149, + { + { + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 + }, + { + 420, 420, 390, 390, 390, 390, 390, 370, 350, 330, 310, 290, 270, 270, 270, 270, + 270, 270, 266, 260, 244, 230, 230, 230, 230, 230, 230, 210, 190, 190, 170, 150 + }, + { + 120, 123, 125, 128, 130, 135, 140, 148, 160, 168, 180, 190, 200, 210, 210, 210, + 210, 210, 200, 190, 185, 175, 165, 160, 146, 136, 130, 128, 125, 123, 120, 120 + }, + /* u16TextureFreq */ + 160, + /* u16EdgeFreq */ + 100, + /* u8OverShoot */ + 55, + /* u8UnderShoot */ + 70, + /* u8shootSupStr */ + 10, + /* u8shootSupAdj */ + 9, + /* u8DetailCtrl */ + 128, + /* u8DetailCtrlThr */ + 180, + /* u8EdgeFiltStr */ + 60, + /* u8EdgeFiltMaxCap */ + 18, + /* u8RGain */ + 28, + /* u8GGain */ + 32, + /* u8BGain */ + 31, + /* u8SkinGain */ + 23, + /* u8MaxSharpGain */ + 67, + /* u8WeakDetailGain */ + 6 + + }, + { + /* au16LumaWgt */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, + 819200,1638400,3276800 */ + { + { 31, 31, 20, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 1, 1, 1 }, + { 31, 31, 20, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 2, 2, 2 }, + { 31, 31, 20, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 4, 4, 4 }, + { 31, 31, 20, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 5, 5, 5 }, + { 31, 31, 20, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 7, 7, 7 }, + { 31, 31, 20, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 8, 8, 8 }, + { 31, 31, 20, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 9, 9, 9 }, + { 31, 31, 23, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 10, 10, 10 }, + { 31, 31, 25, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 12, 12, 12 }, + { 31, 31, 28, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 13, 13, 13 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 14, 14, 14 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 15, 15, 15 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 17, 17, 17 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 18, 18, 18 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 19, 19, 19 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 20, 20, 20 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 22, 22, 22 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 23, 23, 23 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 24, 24, 24 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 26, 26, 26 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 26, 26, 26 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 26, 26, 26 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 26, 26, 26 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 27, 27, 27 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 27, 27, 27 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 27, 27, 27 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 27, 27, 27 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 28, 28, 28 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 28, 28, 28 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 28, 28, 28 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 28, 28, 28 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 28, 28, 28 } + }, + { + { 201, 201, 250, 260, 196, 170, 132, 111, 77, 60, 9, 9, 0, 0, 0, 0 }, + { 205, 205, 250, 269, 196, 170, 132, 111, 77, 60, 9, 9, 0, 0, 0, 0 }, + { 210, 210, 250, 281, 209, 170, 132, 111, 77, 60, 9, 9, 0, 0, 0, 0 }, + { 215, 215, 250, 295, 196, 170, 132, 111, 77, 60, 9, 9, 0, 0, 0, 0 }, + { 222, 222, 250, 311, 196, 170, 132, 111, 77, 60, 9, 9, 0, 0, 0, 0 }, + { 228, 228, 250, 326, 196, 170, 132, 111, 77, 60, 9, 9, 0, 0, 0, 0 }, + { 234, 234, 230, 340, 196, 170, 132, 111, 77, 60, 9, 9, 0, 0, 0, 0 }, + { 240, 240, 226, 351, 209, 184, 154, 120, 85, 60, 17, 17, 0, 0, 0, 0 }, + { 245, 245, 231, 360, 219, 189, 163, 120, 94, 60, 17, 17, 0, 0, 0, 0 }, + { 252, 252, 236, 370, 219, 189, 163, 120, 95, 60, 17, 17, 2, 2, 2, 2 }, + { 259, 259, 246, 379, 228, 190, 172, 125, 95, 60, 26, 26, 5, 5, 5, 5 }, + { 266, 266, 246, 387, 229, 199, 182, 125, 95, 69, 26, 26, 9, 9, 9, 9 }, + { 272, 272, 251, 394, 234, 199, 199, 139, 95, 69, 26, 26, 12, 12, 12, 12 }, + { 276, 276, 256, 397, 235, 200, 200, 139, 96, 70, 35, 35, 14, 14, 14, 14 }, + { 277, 277, 261, 397, 240, 200, 209, 139, 96, 70, 35, 35, 17, 17, 17, 17 }, + { 275, 275, 262, 392, 240, 201, 210, 87, 96, 70, 44, 44, 17, 17, 17, 17 }, + { 269, 269, 271, 381, 245, 210, 210, 140, 96, 70, 44, 44, 18, 18, 18, 18 }, + { 259, 259, 271, 364, 245, 210, 210, 140, 96, 70, 53, 53, 18, 18, 18, 18 }, + { 246, 246, 271, 343, 244, 210, 210, 140, 96, 70, 52, 52, 17, 17, 17, 17 }, + { 232, 232, 266, 320, 244, 209, 209, 139, 96, 70, 61, 61, 16, 16, 16, 16 }, + { 216, 216, 261, 295, 243, 209, 209, 113, 96, 61, 61, 61, 10, 10, 10, 10 }, + { 202, 202, 256, 271, 230, 191, 156, 87, 69, 61, 69, 69, 9, 9, 9, 9 }, + { 189, 189, 251, 249, 229, 190, 130, 86, 69, 61, 69, 69, 7, 7, 7, 7 }, + { 179, 179, 236, 231, 219, 184, 103, 86, 69, 60, 69, 69, 5, 5, 5, 5 }, + { 171, 171, 226, 217, 213, 183, 85, 85, 68, 60, 68, 68, 3, 3, 3, 3 }, + { 165, 165, 221, 204, 212, 153, 85, 85, 68, 59, 68, 68, 2, 2, 2, 2 }, + { 159, 159, 211, 193, 194, 152, 84, 76, 59, 59, 59, 59, 2, 2, 2, 2 }, + { 154, 154, 201, 183, 184, 117, 84, 75, 59, 59, 59, 59, 2, 2, 2, 2 }, + { 150, 150, 191, 173, 174, 100, 80, 75, 58, 58, 58, 58, 2, 2, 2, 2 }, + { 147, 147, 173, 164, 156, 100, 80, 74, 49, 49, 49, 49, 2, 2, 2, 2 }, + { 144, 144, 171, 154, 155, 100, 80, 73, 49, 49, 49, 49, 2, 2, 2, 2 }, + { 141, 141, 152, 144, 140, 100, 80, 72, 48, 48, 48, 48, 2, 2, 2, 2 } + }, + { + { 180, 180, 171, 171, 120, 110, 100, 108, 99, 90, 90, 90, 90, 45, 45, 45 }, + { 180, 180, 178, 178, 130, 130, 130, 108, 99, 90, 90, 90, 90, 45, 45, 45 }, + { 180, 180, 187, 187, 167, 158, 153, 108, 99, 90, 90, 90, 90, 45, 45, 45 }, + { 180, 180, 198, 198, 167, 158, 153, 108, 99, 90, 90, 90, 90, 45, 45, 45 }, + { 180, 180, 210, 210, 167, 158, 153, 108, 99, 90, 90, 90, 90, 45, 45, 45 }, + { 182, 182, 221, 221, 171, 162, 158, 117, 108, 99, 99, 99, 99, 45, 45, 45 }, + { 182, 182, 232, 232, 171, 162, 158, 117, 108, 99, 99, 99, 99, 45, 45, 45 }, + { 190, 190, 240, 240, 172, 163, 158, 127, 127, 118, 118, 118, 118, 45, 45, 45 }, + { 199, 199, 247, 247, 182, 173, 164, 127, 127, 118, 118, 118, 118, 45, 45, 45 }, + { 212, 212, 254, 254, 192, 183, 173, 128, 146, 137, 137, 137, 137, 46, 46, 46 }, + { 223, 223, 261, 261, 202, 193, 179, 165, 165, 165, 147, 147, 147, 46, 46, 46 }, + { 230, 230, 267, 267, 212, 202, 189, 166, 166, 166, 147, 147, 147, 46, 46, 46 }, + { 231, 231, 272, 272, 222, 212, 194, 166, 166, 166, 148, 148, 148, 46, 46, 46 }, + { 228, 228, 274, 274, 231, 222, 199, 176, 176, 176, 157, 157, 157, 46, 46, 46 }, + { 222, 222, 272, 272, 241, 232, 204, 176, 176, 176, 158, 158, 158, 46, 46, 46 }, + { 212, 212, 267, 267, 251, 242, 209, 168, 168, 168, 149, 149, 149, 47, 47, 47 }, + { 197, 197, 256, 256, 261, 252, 215, 168, 168, 168, 149, 149, 149, 47, 47, 47 }, + { 178, 178, 240, 240, 251, 242, 209, 177, 177, 177, 149, 149, 149, 47, 47, 47 }, + { 157, 157, 219, 219, 241, 232, 204, 176, 176, 176, 149, 149, 149, 46, 46, 46 }, + { 140, 140, 197, 197, 231, 222, 194, 176, 176, 176, 148, 148, 148, 46, 46, 46 }, + { 126, 126, 174, 174, 222, 212, 189, 166, 166, 166, 148, 148, 148, 46, 46, 46 }, + { 113, 113, 151, 151, 217, 212, 189, 166, 166, 166, 147, 147, 147, 46, 46, 46 }, + { 102, 102, 132, 132, 216, 207, 184, 156, 156, 156, 138, 138, 138, 46, 46, 46 }, + { 93, 93, 117, 117, 206, 202, 183, 147, 147, 147, 138, 138, 138, 46, 46, 46 }, + { 87, 87, 106, 106, 196, 192, 178, 146, 146, 146, 137, 137, 137, 46, 46, 46 }, + { 83, 83, 97, 97, 186, 182, 173, 145, 145, 145, 136, 136, 136, 45, 45, 45 }, + { 80, 80, 90, 90, 176, 172, 167, 145, 145, 145, 127, 127, 127, 45, 45, 45 }, + { 77, 77, 84, 84, 167, 162, 158, 140, 140, 140, 122, 122, 122, 45, 45, 45 }, + { 73, 73, 79, 79, 166, 162, 157, 135, 135, 135, 121, 121, 121, 36, 36, 36 }, + { 69, 69, 75, 75, 161, 157, 152, 134, 134, 134, 121, 121, 121, 27, 27, 27 }, + { 65, 65, 72, 72, 151, 147, 142, 133, 133, 133, 120, 120, 120, 22, 22, 22 }, + { 63, 63, 69, 69, 151, 147, 142, 133, 133, 133, 120, 120, 120, 18, 18, 18 } + }, + /* au16TextureFreq */ + /* ISO */ + /* 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, + 819200, 1638400, 3276800 */ + { 300, 300, 230, 180, 180, 180, 150, 150, 130, 128, 128, 128, 128, 128, 128, 128 }, + /* au16EdgeFreq */ + { 128, 128, 128, 128, 128, 128, 80, 80, 80, 70, 70, 70, 70, 70, 70, 70 }, + /* au8OverShoot */ + { 40, 40, 40, 40, 50, 45, 60, 60, 70, 80, 90, 90, 90, 90, 90, 90 }, + /* au8UnderShoot */ + { 60, 60, 60, 70, 80, 80, 70, 60, 60, 70, 80, 90, 90, 90, 90, 90 }, + /* au16shootSupStr */ + { 10, 10, 5, 10, 0, 0, 0, 23, 22, 18, 17, 17, 17, 17, 17, 17 }, + /* au8ShootSupAdj */ + { 4, 4, 3, 3, 10, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* au8DetailCtrl */ + { 130, 130, 130, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, + /* au8DetailCtrlThr */ + { 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160 }, + /* au8EdgeFiltStr */ + { 50, 50, 50, 50, 63, 63, 63, 43, 43, 43, 43, 43, 43, 43, 43, 43 }, + /* au8EdgeFiltMaxCap */ + { 20, 20, 20, 22, 26, 31, 35, 18, 18, 18, 18, 18, 18, 18, 18, 18 }, + /* au8RGain */ + { 25, 25, 31, 31, 31, 31, 31, 20, 16, 16, 16, 16, 16, 16, 16, 16 }, + /* au8GGain */ + { 31, 31, 31, 40, 45, 45, 45, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + /* au8BGain */ + { 25, 25, 31, 31, 31, 31, 31, 20, 16, 16, 16, 16, 16, 16, 16, 16 }, + /* au8SkinGain */ + { 31, 31, 31, 31, 31, 31, 31, 20, 16, 16, 16, 16, 16, 16, 16, 16 }, + /* u8MaxSharpGain */ + { 70, 70, 70, 80, 60, 60, 50, 30, 30, 30, 30, 30, 30, 30, 30, 30 }, + /* au8WeakDetailGain */ + { 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + }, +}; + +static const ISP_CMOS_SHARPEN_S g_stIspYuvSharpen = { + /* u8SkinUmin */ + 110, + /* u8SkinVmin */ + 128, + /* u8SkinUmax */ + 128, + /* u8SkinVmax */ + 149, + { + { + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 + }, + { + 250, 420, 390, 390, 390, 390, 390, 370, 350, 330, 310, 290, 270, 270, 270, 270, + 270, 270, 266, 260, 244, 230, 230, 230, 230, 230, 230, 210, 190, 190, 170, 150 + }, + { + 120, 123, 125, 128, 130, 135, 140, 148, 160, 168, 180, 190, 200, 210, 210, 210, + 210, 210, 200, 190, 185, 175, 165, 160, 146, 136, 130, 128, 125, 123, 120, 120 + }, + /* u16TextureFreq */ + 160, + /* u16EdgeFreq */ + 100, + /* u8OverShoot */ + 55, + /* u8UnderShoot */ + 70, + /* u8shootSupStr */ + 10, + /* u8shootSupAdj */ + 9, + /* u8DetailCtrl */ + 128, + /* u8DetailCtrlThr */ + 180, + /* u8EdgeFiltStr */ + 60, + /* u8EdgeFiltMaxCap */ + 18, + /* u8RGain */ + 28, + /* u8GGain */ + 32, + /* u8BGain */ + 31, + /* u8SkinGain */ + 23, + /* u8MaxSharpGain */ + 67, + /* u8WeakDetailGain */ + 6 + }, + { + { + { 31, 31, 31, 31, 24, 21, 21, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 24, 21, 21, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 24, 21, 21, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 24, 21, 21, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 24, 22, 22, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 24, 22, 22, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 24, 22, 22, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 24, 22, 22, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 24, 23, 23, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 24, 23, 23, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 24, 23, 23, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 24, 24, 24, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 24, 24, 24, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 24, 24, 24, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 27, 27, 27, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 27, 27, 27, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 28, 28, 28, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 28, 28, 28, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 29, 29, 29, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 } + }, + { + { 172, 172, 137, 191, 323, 491, 491, 161, 161, 161, 61, 61, 61, 61, 61, 61 }, + { 174, 174, 147, 202, 332, 487, 483, 171, 171, 171, 92, 92, 92, 92, 92, 92 }, + { 177, 177, 158, 213, 340, 482, 475, 183, 183, 183, 124, 124, 124, 124, 124, 124 }, + { 181, 181, 169, 224, 349, 476, 466, 195, 195, 195, 155, 155, 155, 155, 155, 155 }, + { 184, 184, 181, 235, 358, 470, 457, 206, 206, 206, 184, 184, 184, 184, 184, 184 }, + { 188, 188, 191, 246, 366, 463, 449, 217, 217, 217, 210, 210, 210, 210, 210, 210 }, + { 191, 191, 200, 255, 375, 456, 440, 228, 228, 228, 234, 234, 234, 234, 234, 234 }, + { 193, 193, 208, 263, 384, 448, 431, 237, 237, 237, 256, 256, 256, 256, 256, 256 }, + { 194, 194, 214, 269, 393, 440, 423, 245, 245, 245, 275, 275, 275, 275, 275, 275 }, + { 194, 194, 217, 275, 405, 431, 414, 251, 251, 251, 289, 289, 289, 289, 289, 289 }, + { 194, 194, 217, 281, 418, 422, 406, 257, 257, 257, 300, 300, 300, 300, 300, 300 }, + { 193, 193, 215, 286, 430, 413, 399, 261, 261, 261, 309, 309, 309, 309, 309, 309 }, + { 193, 193, 212, 290, 441, 404, 391, 265, 265, 265, 317, 317, 317, 317, 317, 317 }, + { 192, 192, 209, 292, 448, 394, 385, 268, 268, 268, 322, 322, 322, 322, 322, 322 }, + { 191, 191, 205, 292, 450, 384, 379, 270, 270, 270, 326, 326, 326, 326, 326, 326 }, + { 191, 191, 203, 289, 447, 373, 373, 271, 271, 271, 329, 329, 329, 329, 329, 329 }, + { 191, 191, 201, 283, 435, 363, 368, 271, 271, 271, 330, 330, 330, 330, 330, 330 }, + { 191, 191, 199, 275, 417, 351, 364, 268, 268, 268, 328, 328, 328, 328, 328, 328 }, + { 192, 192, 198, 265, 394, 339, 361, 264, 264, 264, 325, 325, 325, 325, 325, 325 }, + { 192, 192, 196, 253, 367, 326, 357, 258, 258, 258, 317, 317, 317, 317, 317, 317 }, + { 193, 193, 194, 239, 340, 312, 354, 251, 251, 251, 308, 308, 308, 308, 308, 308 }, + { 192, 192, 192, 225, 313, 298, 352, 243, 243, 243, 296, 296, 296, 296, 296, 296 }, + { 191, 191, 190, 211, 289, 284, 349, 235, 235, 235, 283, 283, 283, 283, 283, 283 }, + { 189, 189, 188, 197, 269, 269, 347, 229, 229, 229, 267, 267, 267, 267, 267, 267 }, + { 186, 186, 185, 182, 254, 255, 345, 223, 223, 223, 247, 247, 247, 247, 247, 247 }, + { 181, 181, 182, 165, 241, 242, 344, 217, 217, 217, 225, 225, 225, 225, 225, 225 }, + { 176, 176, 179, 147, 229, 229, 342, 211, 211, 211, 201, 201, 201, 201, 201, 201 }, + { 170, 170, 177, 129, 219, 216, 341, 204, 204, 204, 176, 176, 176, 176, 176, 176 }, + { 164, 164, 173, 111, 209, 205, 339, 198, 198, 198, 149, 149, 149, 149, 149, 149 }, + { 159, 159, 170, 95, 200, 195, 338, 192, 192, 192, 121, 121, 121, 121, 121, 121 }, + { 154, 154, 167, 82, 191, 187, 337, 186, 186, 186, 92, 92, 92, 92, 92, 92 }, + { 151, 151, 165, 72, 180, 180, 336, 180, 180, 180, 64, 64, 64, 64, 64, 64 } + }, + { + { 131, 131, 61, 173, 399, 459, 459, 161, 161, 161, 324, 324, 324, 324, 324, 324 }, + { 135, 135, 71, 185, 404, 467, 467, 171, 171, 171, 324, 324, 324, 324, 324, 324 }, + { 140, 140, 82, 197, 412, 479, 479, 183, 183, 183, 324, 324, 324, 324, 324, 324 }, + { 145, 145, 93, 209, 421, 494, 494, 195, 195, 195, 324, 324, 324, 324, 324, 324 }, + { 149, 149, 104, 221, 431, 509, 509, 206, 206, 206, 324, 324, 324, 324, 324, 324 }, + { 154, 154, 114, 232, 439, 522, 522, 217, 217, 217, 324, 324, 324, 324, 324, 324 }, + { 158, 158, 124, 242, 447, 531, 531, 228, 228, 228, 324, 324, 324, 324, 324, 324 }, + { 161, 161, 133, 251, 451, 533, 533, 237, 237, 237, 324, 324, 324, 324, 324, 324 }, + { 164, 164, 140, 257, 453, 529, 529, 245, 245, 245, 324, 324, 324, 324, 324, 324 }, + { 167, 167, 145, 263, 454, 519, 519, 251, 251, 251, 324, 324, 324, 324, 324, 324 }, + { 170, 170, 149, 268, 455, 507, 507, 257, 257, 257, 324, 324, 324, 324, 324, 324 }, + { 172, 172, 152, 273, 454, 492, 492, 261, 261, 261, 324, 324, 324, 324, 324, 324 }, + { 175, 175, 154, 276, 452, 476, 476, 265, 265, 265, 324, 324, 324, 324, 324, 324 }, + { 176, 176, 155, 278, 448, 460, 460, 268, 268, 268, 324, 324, 324, 324, 324, 324 }, + { 176, 176, 156, 280, 443, 446, 446, 270, 270, 270, 324, 324, 324, 324, 324, 324 }, + { 176, 176, 156, 280, 435, 435, 435, 271, 271, 271, 324, 324, 324, 324, 324, 324 }, + { 174, 174, 157, 279, 424, 426, 426, 271, 271, 271, 325, 325, 325, 325, 325, 325 }, + { 171, 171, 156, 277, 410, 418, 418, 268, 268, 268, 325, 325, 325, 325, 325, 325 }, + { 167, 167, 154, 273, 393, 411, 411, 264, 264, 264, 325, 325, 325, 325, 325, 325 }, + { 163, 163, 152, 269, 375, 405, 405, 258, 258, 258, 325, 325, 325, 325, 325, 325 }, + { 158, 158, 149, 264, 357, 399, 399, 251, 251, 251, 325, 325, 325, 325, 325, 325 }, + { 153, 153, 146, 258, 339, 394, 394, 243, 243, 243, 325, 325, 325, 325, 325, 325 }, + { 148, 148, 144, 252, 322, 389, 389, 235, 235, 235, 325, 325, 325, 325, 325, 325 }, + { 143, 143, 142, 245, 308, 384, 384, 229, 229, 229, 325, 325, 325, 325, 325, 325 }, + { 139, 139, 139, 237, 296, 380, 380, 223, 223, 223, 325, 325, 325, 325, 325, 325 }, + { 134, 134, 138, 229, 284, 376, 376, 217, 217, 217, 325, 325, 325, 325, 325, 325 }, + { 129, 129, 136, 219, 273, 373, 373, 211, 211, 211, 325, 325, 325, 325, 325, 325 }, + { 125, 125, 131, 209, 263, 370, 370, 204, 204, 204, 325, 325, 325, 325, 325, 325 }, + { 120, 120, 121, 198, 254, 368, 368, 198, 198, 198, 325, 325, 325, 325, 325, 325 }, + { 115, 115, 110, 188, 247, 366, 366, 192, 192, 192, 325, 325, 325, 325, 325, 325 }, + { 111, 111, 97, 177, 240, 364, 364, 186, 186, 186, 325, 325, 325, 325, 325, 325 }, + { 106, 106, 85, 167, 235, 363, 363, 180, 180, 180, 326, 326, 326, 326, 326, 326 } + }, + /* au16TextureFreq */ + /* ISO */ + /* 100, 200,400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800 */ + { 250, 220, 300, 250, 220, 300, 250, 170, 170, 170, 170, 170, 170, 170, 170, 170 }, + /* au16EdgeFreq */ + { 200, 300, 300, 200, 200, 300, 200, 125, 120, 100, 96, 96, 96, 96, 96, 96 }, + /* au8OverShoot */ + { 30, 30, 30, 30, 40, 30, 30, 40, 40, 40, 40, 40, 10, 10, 10, 10 }, + /* au8UnderShoot */ + { 60, 60, 60, 60, 70, 60, 60, 55, 45, 45, 50, 50, 15, 15, 15, 15 }, + /* au16shootSupStr */ + { 4, 4, 3, 8, 8, 10, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* au8ShootSupAdj */ + { 4, 4, 3, 3, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* au8DetailCtrl */ + { 135, 128, 128, 128, 120, 120, 120, 120, 110, 110, 120, 120, 120, 120, 120, 120 }, + /* au8DetailCtrlThr */ + { 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160 }, + /* au8EdgeFiltStr */ + { 63, 63, 63, 63, 63, 60, 61, 62, 62, 62, 62, 62, 62, 62, 62, 62 }, + /* au8EdgeFiltMaxCap */ + { 12, 18, 18, 18, 18, 18, 26, 35, 18, 18, 18, 18, 18, 18, 18, 18 }, + /* au8RGain */ + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 8, 31, 31, 31, 31, 31, 31 }, + /* au8GGain */ + { 40, 40, 40, 45, 45, 45, 45, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + /* au8BGain */ + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + /* au8SkinGain */ + { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, + /* u8MaxSharpGain */ + { 80, 80, 80, 80, 80, 80, 100, 80, 80, 80, 80, 80, 80, 80, 80, 80 }, + /* au8WeakDetailGain */ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + }, +}; + +static AWB_CCM_S g_stAwbCcm = { + 4, + { + { + 6150, + { + //569, 33198, 117, + //32792, 282, 32770, + //46, 32974, 416 + 0x01E9, 0x80B9, 0x8030, + 0x805D, 0x01B6, 0x8059, + 0x0005, 0x809A, 0x0195 + }, + }, + + { + 4850, + { + 0x025E, 0x81BA, 0x005C, + 0x8011, 0x0117, 0x8006, + 0x001D, 0x8118, 0x01FB + }, + }, + + { + 3650, + { + //523, 33069, 34, + //32833, 343, 32790, + //9, 32990, 469 + 0x01F8, 0x80DF, 0x8019, + 0x8074, 0x019E, 0x802A, + 0x001E, 0x80AC, 0x018E + }, + }, + { + 2650, + { + //594, 33130, 24, + //32892, 353, 27, + //32803, 33246, 769 + 0x01B8, 0x8085, 0x8033, + 0x8099, 0x01B7, 0x801E, + 0x0038, 0x812F, 0x01F7 + }, + }, + + }, +}; + +static AWB_AGC_TABLE_S g_stAwbAgcTable = { + /* bvalid */ + 1, + /* saturation */ + /* 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 */ + { 125, 122, 120, 120, 120, 120, 115, 115, 115, 115, 115, 115, 115, 110, 110, 110 } +}; +static AWB_AGC_TABLE_S g_stAwbAgcTableIr = { + /* bvalid */ + 1, + /* saturation */ + /* 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 */ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +}; + +static const ISP_CMOS_WDR_S g_stIspWDR = { + /* bFusionMode */ + 0, + + /* bMotionComp */ + 1, + + /* u16ShortThr */ + 4032, + + /* u16LongThr */ + 3008, + + /* bForceLong */ + 1, + + /* u16ForceLongLowThr */ + 500, + + /* u16ForceLongHigThr */ + 700, + + /* bShortExpoChk */ + 0, + + /* u16ShortCheckThd */ + 0x8, + + /* au8MdThrLowGain[16] */ + /* 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 */ + { 64, 64, 64, 64, 128, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, + + /* au8MdThrHigGain[16] */ + { 128, 128, 128, 128, 128, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, + + /* au16FusionThr[2] */ + { 3855, 3000 }, + + /* u8MdtStillThd */ + 0x14, + + /* u8MdtLongBlend */ + 0x0 +}; + +static const ISP_CMOS_DEHAZE_S g_stIspDehaze = { + /* bEnable */ + 1, + /* bUserLutEnable */ + 1, + /* enOpType */ + 1, + /* u8AutoStrength */ + 128, + /* u8ManualStrength */ + 90 +}; + + +static const ISP_CMOS_DEHAZE_S g_stIspDehazeIr = { + /* bEnable */ + 1, + /* bUserLutEnable */ + 1, + /* enOpType */ + 1, + /* u8AutoStrength */ + 128, + /* u8ManualStrength */ + 150 +}; + +static const ISP_CMOS_DEHAZE_S g_stIspDehazeWDR = { + /* bEnable */ + 1, + /* bUserLutEnable */ + 1, + /* enOpType */ + 1, + /* u8AutoStrength */ + 100, + /* u8ManualStrength */ + 120 +}; + +#define DRC_INIT_STR_NA 500, 450, 420, 450, 420, 400, 360, 250 +#define DRC_INIT_STR_IR 500, 500, 500, 450, 400, 400, 350, 200 +static ISP_CMOS_DRC_S g_stIspDRC = { + /* bEnable */ + 1, + /* enOpType */ + 1, + /* u16ManualStrength */ + 512, + /* u16AutoStrength */ + 512, + /* u8SpatialFltCoef */ + 1, + /* u8RangeFltCoef */ + 2, + /* u8ContrastControl */ + 9, + /* s8DetailAdjustFactor */ + 6, + /* u8RangeAdaMax */ + 8, + /* u8FltScaleFine */ + 6, + /* u8FltScaleCoarse */ + 6, + /* u8GradRevMax */ + 64, + /* u8GradRevThr */ + 50, + /* u8BrightGainLmt */ + 0, + /* u8BrightGainLmtStep */ + 10, + /* u8DarkGainLmtY */ + 80, + /* u8DarkGainLmtC */ + 0, + /* u8PDStrength */ + 35, + /* u8LocalMixingBrightMax */ + 50, + /* u8LocalMixingBrightMin */ + 20, + /* u8LocalMixingBrightThr */ + 96, + /* s8LocalMixingBrightSlo */ + -3, + /* u8LocalMixingDarkMax */ + 36, + /* u8LocalMixingDarkMin */ + 28, + /* u8LocalMixingDarkThr */ + 200, + /* s8LocalMixingDarkSlo */ + 5, + { + 750, 787, 824, 860, 892, 920, 945, 966, 984, 999, 1010, 1018, 1024, 1024, 1024, + 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024 + }, + { + 0, 97, 202, 321, 443, 585, 737, 897, 1074, 1266, 1474, 1697, 1937, 2191, 2466, 2761, + 3073, 3393, 3730, 4075, 4431, 4779, 5114, 5426, 5696, 5906, 6080, 6264, 6460, 6665, 6880, 7107, + 7344, 7592, 7852, 8123, 8407, 8699, 9002, 9315, 9638, 9966, 10301, 10639, 10978, 11313, 11641, 11957, + 12256, 12527, 12764, 12986, 13220, 13467, 13727, 14001, 14289, 14592, 14910, 15242, 15590, 15953, 16332, 16725, + 17133, 17555, 17989, 18435, 18891, 19355, 19823, 20294, 20762, 21223, 21671, 22099, 22528, 22984, 23470, 23987, + 24537, 25120, 25738, 26393, 27087, 27819, 28591, 29402, 30253, 31143, 32070, 33030, 34019, 35031, 36057, 37086, + 38101, 38597, 39083, 39554, 40007, 40449, 40889, 41328, 41764, 42197, 42626, 43050, 43469, 43883, 44291, 44692, + 45086, 45473, 45852, 46224, 46589, 46947, 47299, 47646, 47989, 48329, 48670, 49014, 49363, 49723, 50085, 50438, + 50781, 51114, 51437, 51750, 52054, 52348, 52635, 52915, 53190, 53327, 53463, 53599, 53735, 53872, 54011, 54152, + 54295, 54441, 54591, 54746, 54906, 55073, 55248, 55423, 55592, 55755, 55913, 56067, 56218, 56366, 56513, 56659, + 56807, 56957, 57111, 57271, 57439, 57617, 57806, 58011, 58232, 58350, 58473, 58603, 58738, 58880, 59029, 59186, + 59352, 59529, 59717, 59915, 60122, 60340, 60566, 60801, 61044, 61294, 61552, 61817, 62087, 62363, 62643, 62927, + 63215, 63505, 63797, 64090, 64383, 64675, 64965, 65252 + }, + /* u8Asymmetry */ + 5, + /* u8SecondPole */ + 150, + /* u8Stretch */ + 50, + /* u8Compress */ + 150, + /* u8CurveSel */ + 2, + /* au16Xpoint */ + { 0, 200, 400, 600, 1000 }, + /* au16Ypoint */ + { 0, 200, 400, 600, 1000 }, + /* au16Slope */ + { 1000, 1000, 1000, 1000, 1000 } +}; + +static ISP_CMOS_DRC_S g_stIspDRCIr = { + /* bEnable */ + 1, + /* enOpType */ + 1, + /* u16ManualStrength */ + 512, + /* u16AutoStrength */ + 512, + /* u8SpatialFltCoef */ + 1, + /* u8RangeFltCoef */ + 2, + /* u8ContrastControl */ + 9, + /* s8DetailAdjustFactor */ + 8, + /* u8RangeAdaMax */ + 8, + /* u8FltScaleFine */ + 6, + /* u8FltScaleCoarse */ + 6, + /* u8GradRevMax */ + 64, + /* u8GradRevThr */ + 50, + /* u8BrightGainLmt */ + 0, + /* u8BrightGainLmtStep */ + 10, + /* u8DarkGainLmtY */ + 90, + /* u8DarkGainLmtC */ + 0, + /* u8PDStrength */ + 35, + /* u8LocalMixingBrightMax */ + 50, + /* u8LocalMixingBrightMin */ + 20, + /* u8LocalMixingBrightThr */ + 96, + /* s8LocalMixingBrightSlo */ + -3, + /* u8LocalMixingDarkMax */ + 36, + /* u8LocalMixingDarkMin */ + 28, + /* u8LocalMixingDarkThr */ + 200, + /* s8LocalMixingDarkSlo */ + 5, + { + 750, 787, 824, 860, 892, 920, 945, 966, 984, 999, 1010, 1018, 1024, 1024, 1024, 1024, 1024, + 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024 + }, + { + 0, 97, 202, 321, 443, 585, 737, 897, 1074, 1266, 1474, 1697, 1937, 2191, 2466, 2761, + 3073, 3393, 3730, 4075, 4431, 4779, 5114, 5426, 5696, 5906, 6080, 6264, 6460, 6665, 6880, 7107, + 7344, 7592, 7852, 8123, 8407, 8699, 9002, 9315, 9638, 9966, 10301, 10639, 10978, 11313, 11641, 11957, + 12256, 12527, 12764, 12986, 13220, 13467, 13727, 14001, 14289, 14592, 14910, 15242, 15590, 15953, 16332, 16725, + 17133, 17555, 17989, 18435, 18891, 19355, 19823, 20294, 20762, 21223, 21671, 22099, 22528, 22984, 23470, 23987, + 24537, 25120, 25738, 26393, 27087, 27819, 28591, 29402, 30253, 31143, 32070, 33030, 34019, 35031, 36057, 37086, + 38101, 38597, 39083, 39554, 40007, 40449, 40889, 41328, 41764, 42197, 42626, 43050, 43469, 43883, 44291, 44692, + 45086, 45473, 45852, 46224, 46589, 46947, 47299, 47646, 47989, 48329, 48670, 49014, 49363, 49723, 50085, 50438, + 50781, 51114, 51437, 51750, 52054, 52348, 52635, 52915, 53190, 53327, 53463, 53599, 53735, 53872, 54011, 54152, + 54295, 54441, 54591, 54746, 54906, 55073, 55248, 55423, 55592, 55755, 55913, 56067, 56218, 56366, 56513, 56659, + 56807, 56957, 57111, 57271, 57439, 57617, 57806, 58011, 58232, 58350, 58473, 58603, 58738, 58880, 59029, 59186, + 59352, 59529, 59717, 59915, 60122, 60340, 60566, 60801, 61044, 61294, 61552, 61817, 62087, 62363, 62643, 62927, + 63215, 63505, 63797, 64090, 64383, 64675, 64965, 65252 + }, + /* u8Asymmetry */ + 30, + /* u8SecondPole */ + 196, + /* u8Stretch */ + 50, + /* u8Compress */ + 121, + /* u8CurveSel */ + 0, + /* au16Xpoint */ + { 0, 200, 400, 600, 1000 }, + /* au16Ypoint */ + { 0, 200, 400, 600, 1000 }, + /* au16Slope */ + { 1000, 1000, 1000, 1000, 1000 } +}; + +static const ISP_CMOS_DRC_S g_stIspDRCWDR = { + /* bEnable */ + 1, + /* enOpType */ + 0, + /* u16ManualStrength */ + 1023, + /* u16AutoStrength */ + 512, + /* u8SpatialFltCoef */ + 0, + /* u8RangeFltCoef */ + 1, + /* u8ContrastControl */ + 9, + /* s8DetailAdjustFactor */ + 8, + /* u8RangeAdaMax */ + 4, + /* u8FltScaleFine */ + 3, + /* u8FltScaleCoarse */ + 3, + /* u8GradRevMax */ + 30, + /* u8GradRevThr */ + 50, + /* u8BrightGainLmt */ + 15, + /* u8BrightGainLmtStep */ + 10, + /* u8DarkGainLmtY */ + 0, + /* u8DarkGainLmtC */ + 0, + /* u8PDStrength */ + 35, + /* u8LocalMixingBrightMax */ + 36, + /* u8LocalMixingBrightMin */ + 24, + /* u8LocalMixingBrightThr */ + 96, + /* s8LocalMixingBrightSlo */ + -3, + /* u8LocalMixingDarkMax */ + 36, + /* u8LocalMixingDarkMin */ + 24, + /* u8LocalMixingDarkThr */ + 200, + /* s8LocalMixingDarkSlo */ + 5, + { + 515, 528, 545, 564, 587, 612, 638, 665, 693, 720, 747, 772, 796, 817, 835, 849, + 859, 866, 868, 868, 865, 860, 853, 845, 835, 825, 815, 804, 795, 786, 778, 772, 768 + }, + { + 8, 8, 16, 24, 31, 39, 48, 56, 65, 75, 85, 95, 106, 118, 130, 143, + 156, 170, 185, 201, 218, 235, 254, 274, 294, 316, 339, 364, 390, 417, 446, 477, + 509, 543, 579, 617, 658, 701, 746, 794, 844, 898, 955, 1015, 1078, 1145, 1216, 1291, + 1370, 1454, 1543, 1637, 1736, 1841, 1952, 2069, 2194, 2325, 2465, 2612, 2767, 2932, 3106, 3290, + 3485, 3691, 3909, 4140, 4384, 4641, 4914, 5202, 5507, 5830, 6171, 6531, 6913, 7316, 7742, 8193, + 8669, 9173, 9705, 10268, 10863, 11492, 12145, 12808, 13483, 14171, 14872, 15587, 16319, 17069, 17840, 18635, + 19458, 19881, 20313, 20754, 21204, 21661, 22122, 22586, 23053, 23525, 24000, 24480, 24965, 25455, 25950, 26451, + 26959, 27473, 27995, 28524, 29062, 29609, 30165, 30732, 31309, 31899, 32501, 33116, 33746, 34391, 35043, 35706, + 36381, 37066, 37763, 38472, 39192, 39925, 40671, 41429, 42201, 42591, 42986, 43383, 43784, 44189, 44597, 45008, + 45424, 45842, 46265, 46691, 47121, 47555, 47993, 48434, 48880, 49329, 49783, 50241, 50703, 51169, 51639, 52113, + 52592, 53075, 53564, 54056, 54552, 55054, 55560, 56071, 56586, 56846, 57107, 57369, 57632, 57896, 58162, 58429, + 58697, 58967, 59238, 59510, 59783, 60057, 60333, 60611, 60889, 61169, 61451, 61733, 62017, 62303, 62589, 62877, + 63167, 63458, 63750, 64044, 64340, 64636, 64934, 65234 + }, + /* u8Asymmetry */ + 6, + /* u8SecondPole */ + 180, + /* u8Stretch */ + 50, + /* u8Compress */ + 150, + /* u8CurveSel */ + 0, + /* au16Xpoint */ + { 0, 200, 400, 600, 1000 }, + /* au16Ypoint */ + { 0, 200, 400, 600, 1000 }, + /* au16Slope */ + { 1000, 1000, 1000, 1000, 1000 } +}; + +static const ISP_CMOS_CA_S g_stIspCA = { + /* CA */ + 1, + { + 516, 525, 534, 544, 554, 563, 573, 583, 594, 604, 614, 624, 634, 644, 654, 664, 674, 684, 694, + 704, 713, 723, 732, 741, 750, 758, 766, 775, 782, 790, 797, 804, 811, 817, 823, 828, 834, 839, + 844, 848, 853, 857, 861, 865, 868, 872, 875, 878, 881, 884, 887, 890, 892, 895, 898, 900, 903, + 905, 908, 910, 913, 915, 918, 921, 924, 926, 929, 932, 935, 937, 940, 943, 945, 948, 950, 952, + 955, 957, 959, 961, 964, 966, 968, 970, 972, 974, 976, 978, 979, 981, 983, 985, 987, 988, 990, + 992, 993, 994, 995, 996, 997, 998, 998, 999, 1000, 1001, 1002, 1002, 1003, 1004, 1005, 1006, 1006, 1007, + 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1018, 1019, 1020, 1022, 1024 + }, + /* ISO */ + /* 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 */ + { 1300, 1300, 1250, 1200, 1150, 1100, 1050, 1000, 950, 900, 900, 800, 800, 800, 800, 800 } +}; + +static const ISP_CMOS_LSC_S g_stCmosLsc = { + /* MeshStrength */ + 256, + /* MeshScale */ + 4, + { + { + { + 0x26b, 0x1de, 0x179, 0x12a, 0xee, 0xc4, 0xa2, 0x94, 0x94, 0x97, 0xad, 0xc8, 0x10d, 0x133, 0x184, + 0x1fd, 0x284, 0x235, 0x1ba, 0x158, 0x10d, 0xd3, 0xad, 0x8c, 0x7b, 0x74, 0x7b, 0x90, 0xaf, 0xd8, + 0x114, 0x164, 0x1d1, 0x253, 0x210, 0x194, 0x136, 0xec, 0xbc, 0x91, 0x6f, 0x5d, 0x59, 0x5f, 0x75, + 0x94, 0xbf, 0xf7, 0x149, 0x1ac, 0x229, 0x1e1, 0x177, 0x11a, 0xd7, 0xa6, 0x7c, 0x5b, 0x44, 0x3e, + 0x4a, 0x5c, 0x7d, 0xab, 0xe2, 0x127, 0x18f, 0x200, 0x1c8, 0x15f, 0x10d, 0xc9, 0x98, 0x69, 0x4a, + 0x32, 0x2a, 0x33, 0x4a, 0x6b, 0x9e, 0xd0, 0x113, 0x175, 0x1e5, 0x1b6, 0x14f, 0xf9, 0xbf, 0x84, + 0x57, 0x34, 0x21, 0x18, 0x21, 0x3a, 0x5e, 0x8e, 0xc2, 0x105, 0x162, 0x1d8, 0x1a9, 0x140, 0xef, + 0xb4, 0x7d, 0x50, 0x2d, 0x11, 0xa, 0x15, 0x2f, 0x57, 0x83, 0xb9, 0xfb, 0x156, 0x1c3, 0x1a5, + 0x134, 0xe9, 0xae, 0x7a, 0x4b, 0x26, 0x8, 0x4, 0xc, 0x28, 0x4f, 0x7f, 0xb8, 0xf7, 0x151, + 0x1bf, 0x19d, 0x134, 0xe8, 0xac, 0x75, 0x48, 0x34, 0x4, 0x0, 0xa, 0x25, 0x50, 0x7e, 0xb5, + 0xf8, 0x150, 0x1bd, 0x199, 0x134, 0xea, 0xae, 0x73, 0x4b, 0x32, 0x5, 0x2, 0xd, 0x2a, 0x4e, + 0x83, 0xbc, 0xf9, 0x151, 0x1c0, 0x1a5, 0x139, 0xee, 0xb1, 0x7e, 0x51, 0x2f, 0x14, 0xd, 0x16, + 0x31, 0x56, 0x86, 0xbb, 0x100, 0x158, 0x1c3, 0x1b2, 0x147, 0xfe, 0xbd, 0x87, 0x5f, 0x3b, 0x24, + 0x1b, 0x24, 0x43, 0x64, 0x90, 0xc8, 0x107, 0x164, 0x1d2, 0x1c1, 0x159, 0x107, 0xca, 0x94, 0x6e, + 0x4d, 0x36, 0x30, 0x36, 0x4e, 0x74, 0x9b, 0xd1, 0x11a, 0x173, 0x1e2, 0x1de, 0x16f, 0x119, 0xda, + 0xa7, 0x7f, 0x64, 0x4e, 0x45, 0x4f, 0x62, 0x86, 0xb1, 0xe6, 0x128, 0x188, 0x1fd, 0x1f9, 0x18a, + 0x131, 0xf2, 0xbf, 0x99, 0x79, 0x65, 0x60, 0x6a, 0x7b, 0x9e, 0xc9, 0xfb, 0x13d, 0x19f, 0x21e, + 0x21c, 0x1a9, 0x14b, 0x109, 0xd6, 0xb4, 0x96, 0x83, 0x7f, 0x83, 0x94, 0xb7, 0xe0, 0x115, 0x15d, + 0x1c1, 0x23f, 0x244, 0x1c8, 0x167, 0x127, 0xf5, 0xcc, 0xb1, 0x9f, 0x99, 0x98, 0xb3, 0xce, 0xf7, + 0x12e, 0x17a, 0x1e9, 0x262, + }, + + { + 0x27c, 0x1fd, 0x18b, 0x138, 0xfb, 0xd2, 0xb1, 0xa3, 0x9d, 0xa0, 0xb7, 0xd8, 0x11d, 0x141, 0x1a4, + 0x21c, 0x2ab, 0x24a, 0x1d0, 0x164, 0x113, 0xde, 0xb4, 0x96, 0x83, 0x7e, 0x84, 0x9a, 0xbb, 0xe8, + 0x128, 0x17a, 0x1ec, 0x274, 0x21c, 0x1a8, 0x140, 0xf8, 0xc5, 0x9b, 0x77, 0x64, 0x5d, 0x67, 0x80, + 0x9f, 0xca, 0x105, 0x15a, 0x1c1, 0x24e, 0x1f6, 0x18b, 0x127, 0xe6, 0xaf, 0x82, 0x62, 0x4b, 0x46, + 0x4e, 0x64, 0x85, 0xb6, 0xee, 0x13c, 0x1a6, 0x22d, 0x1de, 0x170, 0x118, 0xd3, 0x9d, 0x6f, 0x4c, + 0x35, 0x2a, 0x37, 0x4f, 0x76, 0xa3, 0xdb, 0x123, 0x187, 0x20b, 0x1ca, 0x15c, 0x107, 0xc6, 0x8e, + 0x5d, 0x3c, 0x21, 0x19, 0x27, 0x41, 0x68, 0x94, 0xce, 0x116, 0x17a, 0x1fa, 0x1b4, 0x151, 0xfc, + 0xbd, 0x85, 0x54, 0x31, 0x12, 0x9, 0x16, 0x34, 0x5c, 0x89, 0xc6, 0x10a, 0x16b, 0x1e5, 0x1ae, + 0x147, 0xf7, 0xb7, 0x80, 0x53, 0x29, 0xa, 0x4, 0x12, 0x2c, 0x56, 0x86, 0xc1, 0x103, 0x166, + 0x1dc, 0x1ac, 0x144, 0xf5, 0xb5, 0x7d, 0x4c, 0x37, 0x7, 0x1, 0xc, 0x2a, 0x55, 0x83, 0xbe, + 0x101, 0x166, 0x1d7, 0x1aa, 0x145, 0xf9, 0xb6, 0x82, 0x52, 0x3a, 0xb, 0x5, 0xd, 0x2d, 0x57, + 0x88, 0xc0, 0x102, 0x162, 0x1dc, 0x1b4, 0x14d, 0xfe, 0xbc, 0x87, 0x5c, 0x36, 0x16, 0xf, 0x19, + 0x36, 0x5f, 0x8f, 0xca, 0x10d, 0x16b, 0x1e2, 0x1be, 0x15a, 0x10b, 0xca, 0x90, 0x63, 0x3e, 0x26, + 0x1f, 0x2b, 0x44, 0x69, 0x9c, 0xd2, 0x119, 0x175, 0x1f3, 0x1c9, 0x16a, 0x114, 0xd5, 0x9e, 0x77, + 0x54, 0x3a, 0x33, 0x3a, 0x54, 0x79, 0xa8, 0xe1, 0x127, 0x184, 0x203, 0x1ed, 0x186, 0x12a, 0xe7, + 0xb1, 0x87, 0x6a, 0x55, 0x4c, 0x54, 0x6d, 0x8f, 0xbb, 0xf4, 0x137, 0x1a0, 0x21a, 0x20d, 0x1a0, + 0x140, 0xfc, 0xc7, 0xa3, 0x81, 0x6d, 0x66, 0x71, 0x85, 0xa5, 0xd3, 0x108, 0x152, 0x1b9, 0x23c, + 0x231, 0x1bf, 0x160, 0x119, 0xe6, 0xbd, 0x9e, 0x8a, 0x84, 0x8c, 0xa2, 0xc5, 0xf0, 0x123, 0x16d, + 0x1da, 0x260, 0x25c, 0x1e1, 0x17f, 0x136, 0xfd, 0xda, 0xbe, 0xaa, 0x9f, 0xa9, 0xbb, 0xda, 0x104, + 0x13e, 0x18e, 0x1ff, 0x285, + }, + { + 0x28b, 0x1fd, 0x18e, 0x139, 0xfd, 0xd7, 0xb6, 0xa3, 0xa4, 0xa9, 0xbc, 0xde, 0x126, 0x14d, 0x1a5, + 0x21f, 0x2b1, 0x256, 0x1d6, 0x16a, 0x11d, 0xe4, 0xb9, 0x9b, 0x87, 0x83, 0x8b, 0xa0, 0xc1, 0xec, + 0x12e, 0x183, 0x1f5, 0x284, 0x229, 0x1ad, 0x142, 0xfb, 0xc9, 0x9f, 0x7c, 0x6a, 0x62, 0x6c, 0x84, + 0xa4, 0xd2, 0x10f, 0x15f, 0x1ce, 0x252, 0x201, 0x18a, 0x129, 0xe8, 0xb1, 0x86, 0x67, 0x4d, 0x4b, + 0x51, 0x6a, 0x8b, 0xbc, 0xf9, 0x140, 0x1ac, 0x229, 0x1ea, 0x176, 0x116, 0xd2, 0x9e, 0x73, 0x4e, + 0x38, 0x2f, 0x3c, 0x54, 0x7a, 0xaa, 0xe0, 0x127, 0x18f, 0x211, 0x1ce, 0x160, 0x107, 0xc8, 0x94, + 0x5f, 0x3d, 0x22, 0x1e, 0x28, 0x43, 0x6b, 0x9a, 0xd1, 0x11c, 0x17d, 0x1fa, 0x1bf, 0x153, 0x101, + 0xbe, 0x86, 0x54, 0x2f, 0x14, 0xc, 0x1b, 0x36, 0x60, 0x91, 0xc9, 0x110, 0x16f, 0x1eb, 0x1bf, + 0x14a, 0xfa, 0xb8, 0x81, 0x4f, 0x28, 0xb, 0x3, 0x11, 0x2e, 0x56, 0x8a, 0xc6, 0x10a, 0x16a, + 0x1e2, 0x1b1, 0x149, 0xfa, 0xb8, 0x7f, 0x50, 0x37, 0x8, 0x0, 0xf, 0x2e, 0x57, 0x89, 0xc2, + 0x107, 0x16a, 0x1df, 0x1b9, 0x148, 0xf9, 0xba, 0x82, 0x54, 0x36, 0xd, 0x5, 0x10, 0x2f, 0x5a, + 0x8b, 0xc5, 0x10a, 0x167, 0x1dd, 0x1c0, 0x150, 0x100, 0xbf, 0x86, 0x5a, 0x34, 0x16, 0x10, 0x18, + 0x39, 0x61, 0x91, 0xcb, 0x115, 0x171, 0x1e9, 0x1d0, 0x15d, 0x10b, 0xc9, 0x93, 0x66, 0x43, 0x26, + 0x1f, 0x29, 0x46, 0x6d, 0x9f, 0xd4, 0x11a, 0x17d, 0x1f3, 0x1e1, 0x16e, 0x11a, 0xd6, 0x9d, 0x76, + 0x54, 0x3c, 0x35, 0x40, 0x59, 0x7b, 0xad, 0xe4, 0x128, 0x187, 0x20a, 0x200, 0x184, 0x12c, 0xe8, + 0xb3, 0x87, 0x66, 0x51, 0x4d, 0x55, 0x6d, 0x93, 0xbd, 0xf9, 0x13f, 0x1a2, 0x21d, 0x214, 0x1a4, + 0x145, 0xfd, 0xc7, 0x9f, 0x82, 0x6d, 0x66, 0x6d, 0x86, 0xa8, 0xd7, 0x10c, 0x155, 0x1bd, 0x246, + 0x242, 0x1c2, 0x161, 0x119, 0xe4, 0xb9, 0x9d, 0x8f, 0x83, 0x8d, 0xa3, 0xc4, 0xf1, 0x12a, 0x174, + 0x1e1, 0x26b, 0x261, 0x1de, 0x17f, 0x131, 0xfd, 0xd8, 0xbc, 0xac, 0x9d, 0xa9, 0xbe, 0xe0, 0x109, + 0x142, 0x193, 0x208, 0x28f, + }, + { + 0x28e, 0x202, 0x186, 0x12f, 0xfb, 0xcc, 0xb4, 0xa4, 0xa4, 0xa9, 0xba, 0xe2, 0x120, 0x14b, 0x1a5, + 0x220, 0x2b6, 0x251, 0x1d8, 0x16e, 0x114, 0xde, 0xb3, 0x92, 0x83, 0x81, 0x88, 0xa1, 0xbe, 0xec, + 0x128, 0x17d, 0x1f1, 0x274, 0x228, 0x1ac, 0x144, 0xfc, 0xc2, 0x97, 0x7c, 0x67, 0x61, 0x67, 0x7e, + 0x9e, 0xcf, 0x107, 0x155, 0x1c9, 0x252, 0x1fa, 0x183, 0x12a, 0xe4, 0xb0, 0x83, 0x61, 0x4d, 0x48, + 0x50, 0x67, 0x86, 0xb4, 0xec, 0x133, 0x1a4, 0x22c, 0x1da, 0x16d, 0x113, 0xcd, 0x9f, 0x70, 0x4e, + 0x3a, 0x2f, 0x3c, 0x51, 0x75, 0xa0, 0xdb, 0x11e, 0x185, 0x201, 0x1c5, 0x15d, 0x101, 0xc5, 0x8b, + 0x5b, 0x41, 0x24, 0x1e, 0x27, 0x3d, 0x65, 0x93, 0xce, 0x114, 0x179, 0x1fc, 0x1bc, 0x150, 0xfb, + 0xbe, 0x87, 0x57, 0x30, 0x17, 0xd, 0x18, 0x37, 0x5f, 0x8b, 0xbf, 0x105, 0x16b, 0x1e9, 0x1ac, + 0x147, 0xf1, 0xb8, 0x80, 0x4f, 0x29, 0xf, 0x5, 0x10, 0x32, 0x5c, 0x88, 0xc2, 0x107, 0x160, + 0x1d4, 0x1af, 0x143, 0xf7, 0xb4, 0x7d, 0x4f, 0x3a, 0x7, 0x1, 0xc, 0x2f, 0x57, 0x8b, 0xc0, + 0x102, 0x15f, 0x1d8, 0x1a8, 0x147, 0xf5, 0xb6, 0x80, 0x51, 0x37, 0xc, 0x5, 0x10, 0x2f, 0x5a, + 0x8b, 0xc8, 0x108, 0x163, 0x1da, 0x1bc, 0x151, 0xfb, 0xba, 0x8a, 0x59, 0x36, 0x15, 0xf, 0x1b, + 0x38, 0x62, 0x92, 0xc9, 0x10e, 0x171, 0x1ec, 0x1cd, 0x156, 0x105, 0xc6, 0x8c, 0x66, 0x45, 0x27, + 0x23, 0x27, 0x47, 0x6f, 0x9a, 0xd8, 0x115, 0x17e, 0x1ee, 0x1da, 0x16c, 0x110, 0xd2, 0x9e, 0x78, + 0x54, 0x3d, 0x38, 0x3e, 0x58, 0x78, 0xad, 0xe3, 0x126, 0x186, 0x20d, 0x201, 0x18e, 0x12b, 0xe2, + 0xb1, 0x87, 0x67, 0x54, 0x51, 0x58, 0x6c, 0x93, 0xb8, 0xf4, 0x13b, 0x1a3, 0x229, 0x217, 0x1aa, + 0x147, 0x100, 0xc8, 0xa0, 0x82, 0x6c, 0x66, 0x6c, 0x86, 0xa9, 0xd0, 0x107, 0x156, 0x1bb, 0x23b, + 0x232, 0x1c2, 0x165, 0x117, 0xe4, 0xbf, 0xa2, 0x8c, 0x85, 0x8a, 0x9f, 0xc1, 0xeb, 0x126, 0x16b, + 0x1dd, 0x26c, 0x262, 0x1ea, 0x17c, 0x132, 0xf7, 0xd2, 0xc0, 0xa9, 0x9f, 0xa5, 0xb9, 0xd3, 0x102, + 0x137, 0x184, 0x206, 0x289, + }, + }, + + { + { + 0x399, 0x2df, 0x23e, 0x1cd, 0x170, 0x135, 0xfc, 0xdb, 0xda, 0xe4, 0xfd, 0x12f, 0x16e, 0x1d4, 0x24e, + 0x2ee, 0x3e2, 0x372, 0x2b0, 0x20f, 0x19a, 0x140, 0x109, 0xdc, 0xb7, 0xaf, 0xbe, 0xd5, 0x105, 0x14c, + 0x1a4, 0x225, 0x2b8, 0x384, 0x32a, 0x276, 0x1e3, 0x174, 0x11c, 0xda, 0xaf, 0x92, 0x88, 0x97, 0xac, + 0xec, 0x125, 0x180, 0x200, 0x289, 0x34f, 0x2f6, 0x24f, 0x1bd, 0x14b, 0xfd, 0xba, 0x89, 0x6c, 0x61, + 0x71, 0x89, 0xc6, 0x107, 0x15a, 0x1c7, 0x262, 0x319, 0x2c9, 0x229, 0x1a5, 0x135, 0xdb, 0x9b, 0x6a, + 0x4a, 0x3f, 0x4e, 0x6c, 0xa5, 0xeb, 0x13e, 0x1b1, 0x23d, 0x2e3, 0x2b9, 0x211, 0x187, 0x11b, 0xc9, + 0x81, 0x4d, 0x2b, 0x21, 0x2f, 0x58, 0x8f, 0xda, 0x12a, 0x196, 0x229, 0x2c8, 0x29c, 0x1fb, 0x16e, + 0x10d, 0xb5, 0x6e, 0x37, 0x11, 0x7, 0x1a, 0x46, 0x7b, 0xc3, 0x118, 0x187, 0x210, 0x2b7, 0x2bc, + 0x1f5, 0x16b, 0x106, 0xb1, 0x61, 0x2e, 0x4, 0x0, 0xe, 0x3a, 0x71, 0xba, 0x113, 0x17f, 0x206, + 0x2a4, 0x33a, 0x1f3, 0x165, 0xfd, 0xab, 0x62, 0x2d, 0x2, 0x3, 0x8, 0x35, 0x6e, 0xb6, 0x10f, + 0x179, 0x202, 0x29f, 0x2f0, 0x1e6, 0x165, 0x103, 0xac, 0x63, 0x30, 0x7, 0x1, 0xb, 0x36, 0x70, + 0xb8, 0x112, 0x176, 0x208, 0x2a4, 0x2d2, 0x1f4, 0x171, 0x106, 0xb6, 0x70, 0x38, 0x15, 0xa, 0x18, + 0x40, 0x78, 0xbf, 0x11c, 0x181, 0x20c, 0x2ac, 0x2d0, 0x202, 0x17e, 0x118, 0xc0, 0x7c, 0x4a, 0x2e, + 0x1d, 0x2e, 0x4f, 0x87, 0xcd, 0x122, 0x190, 0x21a, 0x2bb, 0x2be, 0x216, 0x194, 0x12d, 0xd9, 0x99, + 0x64, 0x49, 0x3d, 0x48, 0x68, 0x9d, 0xdd, 0x13f, 0x1a3, 0x229, 0x2cf, 0x2e4, 0x236, 0x1bb, 0x144, + 0xf0, 0xb5, 0x81, 0x63, 0x62, 0x66, 0x86, 0xb7, 0xfb, 0x14e, 0x1be, 0x249, 0x2ed, 0x30c, 0x26c, + 0x1ce, 0x164, 0x110, 0xd4, 0xa4, 0x86, 0x7f, 0x86, 0xa6, 0xd7, 0x115, 0x171, 0x1da, 0x270, 0x31c, + 0x339, 0x28d, 0x1fb, 0x18d, 0x133, 0xf6, 0xc5, 0xaa, 0xa1, 0xae, 0xca, 0xf8, 0x138, 0x195, 0x210, + 0x2a1, 0x355, 0x37f, 0x2be, 0x229, 0x1b1, 0x159, 0x118, 0xeb, 0xd3, 0xc6, 0xd4, 0xed, 0x11f, 0x15d, + 0x1cd, 0x23d, 0x2cc, 0x388, + }, + { + 0x324, 0x279, 0x1f5, 0x191, 0x148, 0x113, 0xe4, 0xcd, 0xc9, 0xd4, 0xf2, 0x11f, 0x164, 0x1b6, 0x22c, + 0x2ba, 0x392, 0x2f1, 0x250, 0x1cb, 0x16c, 0x11f, 0xe9, 0xc2, 0xa8, 0xa5, 0xb1, 0xcf, 0xfa, 0x13d, + 0x193, 0x208, 0x28d, 0x349, 0x2b8, 0x225, 0x1a9, 0x148, 0xfa, 0xc5, 0x9c, 0x80, 0x7e, 0x8e, 0xa5, + 0xe3, 0x11b, 0x16e, 0x1e6, 0x266, 0x316, 0x28b, 0x201, 0x18e, 0x12a, 0xe4, 0xa5, 0x79, 0x60, 0x59, + 0x6a, 0x85, 0xbf, 0xfe, 0x151, 0x1b7, 0x243, 0x2e3, 0x26b, 0x1e5, 0x174, 0x111, 0xc4, 0x88, 0x5d, + 0x40, 0x39, 0x4a, 0x69, 0xa2, 0xea, 0x137, 0x19e, 0x223, 0x2b8, 0x253, 0x1cd, 0x159, 0xfc, 0xb2, + 0x73, 0x43, 0x26, 0x1e, 0x30, 0x57, 0x90, 0xd8, 0x124, 0x188, 0x211, 0x2a4, 0x247, 0x1bd, 0x14c, + 0xf2, 0xa4, 0x65, 0x31, 0x10, 0x6, 0x1a, 0x49, 0x7c, 0xc3, 0x116, 0x17a, 0x201, 0x292, 0x263, + 0x1b6, 0x141, 0xec, 0xa1, 0x5a, 0x26, 0x3, 0x1, 0xf, 0x3f, 0x74, 0xb9, 0x111, 0x172, 0x1f3, + 0x285, 0x2dc, 0x1b4, 0x13e, 0xe6, 0x98, 0x56, 0x25, 0x1, 0x5, 0xb, 0x38, 0x71, 0xb8, 0x10e, + 0x16f, 0x1ed, 0x281, 0x291, 0x1af, 0x142, 0xe5, 0x9d, 0x5a, 0x2b, 0x7, 0x2, 0xe, 0x3c, 0x74, + 0xbb, 0x10f, 0x170, 0x1f0, 0x27f, 0x28d, 0x1b7, 0x14b, 0xee, 0xa5, 0x64, 0x35, 0x13, 0xa, 0x1c, + 0x42, 0x7d, 0xbe, 0x116, 0x17b, 0x1f8, 0x28c, 0x27e, 0x1c3, 0x156, 0xfc, 0xb1, 0x76, 0x46, 0x2e, + 0x1f, 0x2f, 0x55, 0x8c, 0xd1, 0x127, 0x185, 0x207, 0x2a5, 0x265, 0x1d8, 0x169, 0x111, 0xc5, 0x8a, + 0x5c, 0x49, 0x3f, 0x4c, 0x6e, 0xa0, 0xe2, 0x13b, 0x199, 0x215, 0x2ac, 0x282, 0x1f2, 0x188, 0x125, + 0xde, 0xa5, 0x79, 0x5e, 0x63, 0x67, 0x89, 0xb8, 0xf8, 0x14c, 0x1ae, 0x231, 0x2cb, 0x2a6, 0x221, + 0x19c, 0x141, 0xfb, 0xc2, 0x9a, 0x82, 0x7d, 0x88, 0xa6, 0xd6, 0x114, 0x168, 0x1cd, 0x257, 0x2f4, + 0x2cd, 0x240, 0x1c2, 0x166, 0x11e, 0xe7, 0xbc, 0xa8, 0xa0, 0xac, 0xca, 0xf7, 0x138, 0x18a, 0x1f8, + 0x27d, 0x31d, 0x317, 0x268, 0x1ef, 0x189, 0x13b, 0x106, 0xde, 0xc9, 0xc3, 0xd3, 0xed, 0x119, 0x15a, + 0x1c1, 0x221, 0x2a9, 0x357, + }, + + { + 0x32b, 0x277, 0x1f2, 0x18f, 0x148, 0x116, 0xe3, 0xc9, 0xc9, 0xd5, 0xf1, 0x11c, 0x15a, 0x1b4, 0x22d, + 0x2bd, 0x38d, 0x2f4, 0x24d, 0x1ca, 0x16d, 0x11b, 0xea, 0xc4, 0xa8, 0xa3, 0xb3, 0xc9, 0xfb, 0x13d, + 0x190, 0x204, 0x28e, 0x348, 0x2b8, 0x221, 0x1a8, 0x149, 0xfe, 0xc5, 0x9b, 0x80, 0x7a, 0x8e, 0xa6, + 0xe2, 0x119, 0x16f, 0x1e4, 0x269, 0x315, 0x28e, 0x201, 0x18a, 0x12d, 0xe3, 0xa2, 0x78, 0x60, 0x58, + 0x6c, 0x86, 0xc0, 0xfc, 0x14e, 0x1b9, 0x242, 0x2e7, 0x270, 0x1e1, 0x178, 0x115, 0xc5, 0x8a, 0x5e, + 0x41, 0x3a, 0x4b, 0x6a, 0xa2, 0xe7, 0x136, 0x19e, 0x225, 0x2bd, 0x258, 0x1ce, 0x15c, 0xff, 0xb1, + 0x75, 0x44, 0x26, 0x1e, 0x30, 0x57, 0x8d, 0xd7, 0x125, 0x18c, 0x212, 0x2a7, 0x241, 0x1bd, 0x14f, + 0xf2, 0xa5, 0x65, 0x30, 0x11, 0x7, 0x1b, 0x48, 0x7d, 0xc3, 0x118, 0x17b, 0x1ff, 0x297, 0x26b, + 0x1ba, 0x147, 0xef, 0xa1, 0x5b, 0x28, 0x4, 0x1, 0x10, 0x3e, 0x75, 0xba, 0x112, 0x171, 0x1f4, + 0x28b, 0x2de, 0x1b6, 0x140, 0xe5, 0x98, 0x5a, 0x27, 0x1, 0x5, 0xb, 0x37, 0x71, 0xb8, 0x10f, + 0x171, 0x1f2, 0x27f, 0x293, 0x1b0, 0x144, 0xe6, 0x9c, 0x5a, 0x2c, 0x7, 0x4, 0xe, 0x39, 0x74, + 0xbc, 0x10f, 0x16e, 0x1f4, 0x282, 0x285, 0x1ba, 0x14b, 0xef, 0xa5, 0x66, 0x36, 0x15, 0xb, 0x1d, + 0x46, 0x7c, 0xc1, 0x117, 0x17c, 0x1f8, 0x293, 0x27c, 0x1c5, 0x159, 0xfd, 0xb1, 0x79, 0x47, 0x2e, + 0x1f, 0x33, 0x56, 0x8e, 0xce, 0x129, 0x187, 0x206, 0x295, 0x266, 0x1db, 0x16d, 0x111, 0xc6, 0x8d, + 0x5f, 0x49, 0x3f, 0x4a, 0x6f, 0xa3, 0xe1, 0x13a, 0x19c, 0x219, 0x2ac, 0x280, 0x1f4, 0x18a, 0x126, + 0xde, 0xa5, 0x7e, 0x61, 0x61, 0x67, 0x87, 0xbd, 0xf6, 0x14e, 0x1ae, 0x232, 0x2cb, 0x2ae, 0x21f, + 0x1a0, 0x141, 0xf8, 0xc4, 0x99, 0x84, 0x7f, 0x89, 0xa6, 0xd4, 0x115, 0x169, 0x1d1, 0x255, 0x2f2, + 0x2d4, 0x243, 0x1c6, 0x165, 0x11a, 0xe6, 0xc0, 0xa8, 0xa0, 0xaa, 0xca, 0xfc, 0x137, 0x18a, 0x1f9, + 0x282, 0x324, 0x310, 0x26a, 0x1f0, 0x18a, 0x13d, 0x108, 0xde, 0xca, 0xc3, 0xcf, 0xf0, 0x11d, 0x15b, + 0x1c1, 0x227, 0x2aa, 0x360, + }, + { + 0x2f0, 0x24a, 0x1d2, 0x175, 0x137, 0x105, 0xd7, 0xbd, 0xc0, 0xca, 0xec, 0x10f, 0x14b, 0x1a7, 0x21b, + 0x29c, 0x35e, 0x2b8, 0x228, 0x1ad, 0x155, 0x114, 0xe1, 0xbe, 0xa0, 0x9d, 0xad, 0xc1, 0xf3, 0x138, + 0x183, 0x1f5, 0x278, 0x325, 0x28f, 0x1fe, 0x18b, 0x138, 0xf1, 0xbc, 0x96, 0x7e, 0x78, 0x8a, 0xa2, + 0xda, 0x114, 0x162, 0x1d6, 0x253, 0x2f5, 0x25e, 0x1df, 0x171, 0x11b, 0xd7, 0x9f, 0x76, 0x5d, 0x5b, + 0x69, 0x84, 0xbd, 0xf9, 0x14a, 0x1ae, 0x232, 0x2c8, 0x249, 0x1c4, 0x15d, 0x105, 0xba, 0x83, 0x5a, + 0x3c, 0x37, 0x4c, 0x67, 0x9f, 0xe7, 0x12f, 0x195, 0x214, 0x2a1, 0x234, 0x1af, 0x141, 0xf0, 0xa8, + 0x71, 0x3e, 0x23, 0x1d, 0x30, 0x58, 0x91, 0xd3, 0x122, 0x180, 0x202, 0x287, 0x21e, 0x19d, 0x138, + 0xe3, 0x9d, 0x61, 0x2e, 0xf, 0x6, 0x1a, 0x47, 0x7c, 0xbf, 0x119, 0x171, 0x1f5, 0x279, 0x244, + 0x19f, 0x133, 0xdd, 0x97, 0x56, 0x28, 0x4, 0x1, 0x11, 0x3d, 0x77, 0xbc, 0x10f, 0x16f, 0x1e9, + 0x276, 0x2a9, 0x19e, 0x12e, 0xda, 0x92, 0x54, 0x24, 0x4, 0x7, 0xd, 0x3c, 0x75, 0xb4, 0x10b, + 0x168, 0x1e9, 0x271, 0x267, 0x192, 0x128, 0xd9, 0x96, 0x56, 0x2a, 0x6, 0x7, 0x10, 0x3d, 0x74, + 0xb6, 0x10c, 0x168, 0x1e4, 0x271, 0x263, 0x19a, 0x134, 0xdd, 0x9d, 0x65, 0x37, 0x16, 0xe, 0x1f, + 0x46, 0x79, 0xbd, 0x112, 0x170, 0x1ef, 0x286, 0x254, 0x1a5, 0x143, 0xf0, 0xa7, 0x70, 0x46, 0x2e, + 0x21, 0x33, 0x55, 0x90, 0xcb, 0x11d, 0x17d, 0x1f9, 0x287, 0x236, 0x1bd, 0x153, 0x100, 0xba, 0x84, + 0x57, 0x45, 0x42, 0x50, 0x6d, 0xa2, 0xde, 0x137, 0x194, 0x20a, 0x297, 0x25b, 0x1db, 0x175, 0x115, + 0xd2, 0x9b, 0x76, 0x5b, 0x5f, 0x69, 0x8a, 0xba, 0xf4, 0x149, 0x1a4, 0x226, 0x2bb, 0x27d, 0x1fb, + 0x186, 0x132, 0xef, 0xbc, 0x97, 0x81, 0x7d, 0x86, 0xa4, 0xd5, 0x112, 0x15e, 0x1bc, 0x242, 0x2da, + 0x2a9, 0x21f, 0x1aa, 0x151, 0x10e, 0xdc, 0xb7, 0xa3, 0x99, 0xaa, 0xc6, 0xee, 0x130, 0x183, 0x1f3, + 0x264, 0x304, 0x2d0, 0x245, 0x1da, 0x175, 0x12c, 0xf9, 0xdb, 0xc3, 0xbb, 0xc8, 0xe7, 0x114, 0x14d, + 0x1b2, 0x218, 0x29b, 0x338, + }, + }, + }, +}; + +static const ISP_CMOS_LCAC_S g_stIspLCac = { + + /* bEnable */ + 1, + /* u16PurpleDetRange */ + 30, + /* VarThr */ + 0, + /* au16RLumaThd */ + {1500, 1500, 0}, + /* au16GLumaThd */ + {1500, 1500, 0}, + /* au16BLumaThd */ + {4095, 1500, 0}, + /* au16YLumaThd */ + {3200, 1500, 0}, + /* as16CbCrRatio */ + {-50, -50, -50}, + /* enOpMode */ + 0, + { + /* u8DePurpleCrStr */ + 0, + /* u8DePurpleCbStr */ + 3 + }, + { + /* u8DePurpleCrStr */ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* u8DePurpleCbStr */ + { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 } + } +}; + +static const ISP_CMOS_LCAC_S g_stIspLCacWdr = { + + /* bEnable */ + 1, + /* u16PurpleDetRange */ + 30, + /* VarThr */ + 130, + /* au16RLumaThd */ + {1500, 1500, 0}, + /* au16GLumaThd */ + {1500, 1500, 0}, + /* au16BLumaThd */ + {4095, 1500, 0}, + /* au16YLumaThd */ + {3200, 1500, 0}, + /* as16CbCrRatio */ + {-50, -50, -50}, + /* enOpMode */ + 0, + { + /* u8DePurpleCrStr */ + 0, + /* u8DePurpleCbStr */ + 3 + }, + { + /* u8DePurpleCrStr */ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* u8DePurpleCbStr */ + { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 } + } +}; + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ + +#endif /* __gc5603_CMOS_EX_H_ */ diff --git a/libraries/sensor/hi3516ev200/galaxycore_gc5603/gc5603_sensor_ctl.c b/libraries/sensor/hi3516ev200/galaxycore_gc5603/gc5603_sensor_ctl.c new file mode 100755 index 0000000..185751e --- /dev/null +++ b/libraries/sensor/hi3516ev200/galaxycore_gc5603/gc5603_sensor_ctl.c @@ -0,0 +1,417 @@ +/* + * Copyright (c) GK. All rights reserved. + */ + +#include "gc5603_cmos.h" +#include +#include +#include +#include +#include +#include +#include "comm_video.h" +#include "sns_ctrl.h" +#include "gk_api_isp.h" + +#ifdef GPIO_I2C +#include "gpioi2c_ex.h" +#else +#ifdef __LITEOS__ +#include "i2c.h" +#else +#include "i2c.h" +#endif + +#endif + +#define LOSCFG_HOST_TYPE_VENDOR +#ifdef LOSCFG_HOST_TYPE_VENDOR +#include +#endif + +static int g_fd[ISP_MAX_PIPE_NUM] = {[0 ...(ISP_MAX_PIPE_NUM - 1)] = -1}; + +#define I2C_DEV_FILE_NUM 16 +#define I2C_BUF_NUM 8 + +/* sensor fps mode */ +#define GC5603_1620P_30FPS_LINEAR_MODE 0 + +GK_S32 gc5603_GetQuickStartFlag(VI_PIPE ViPipe, GK_U32 *quickStartFlag) +{ + GK_S32 s32Ret; + ISP_MOD_PARAM_S stModParam; + + s32Ret = GK_API_ISP_GetModParam(&stModParam); + if (s32Ret != GK_SUCCESS) { + ISP_TRACE(MODULE_DBG_ERR, "gc5603 Get QuickStart Error\n"); + return s32Ret; + } + *quickStartFlag = stModParam.u32QuickStart; + return GK_SUCCESS; +} + +int gc5603_i2c_init(VI_PIPE ViPipe) +{ + char acDevFile[I2C_DEV_FILE_NUM] = {0}; + GK_U8 u8DevNum; + + if (g_fd[ViPipe] >= 0) { + return GK_SUCCESS; + } +#ifdef GPIO_I2C + int ret; + + g_fd[ViPipe] = open("/dev/gpioi2c_ex", O_RDONLY, S_IRUSR); + if (g_fd[ViPipe] < 0) { + ISP_TRACE(MODULE_DBG_ERR, "Open gpioi2c_ex error!\n"); + return GK_FAILURE; + } +#else + int ret; + ISP_SNS_COMMBUS_U *gc5603businfo = GK_NULL; + + gc5603businfo = gc5603_get_bus_Info(ViPipe); + u8DevNum = gc5603businfo->s8I2cDev; + ret = snprintf_s(acDevFile, sizeof(acDevFile), sizeof(acDevFile) - 1, "/dev/i2c-%u", u8DevNum); + if (ret < 0) { + return GK_FAILURE; + } + g_fd[ViPipe] = open(acDevFile, O_RDWR, S_IRUSR | S_IWUSR); + if (g_fd[ViPipe] < 0) { + ISP_TRACE(MODULE_DBG_ERR, "Open /dev/i2c_drv-%u error!\n", u8DevNum); + return GK_FAILURE; + } + + ret = ioctl(g_fd[ViPipe], I2C_SLAVE_FORCE, (GC5603_I2C_ADDR >> 1)); + if (ret < 0) { + ISP_TRACE(MODULE_DBG_ERR, "I2C_SLAVE_FORCE error!\n"); + close(g_fd[ViPipe]); + g_fd[ViPipe] = -1; + return ret; + } +#endif + + return GK_SUCCESS; +} + +int gc5603_i2c_exit(VI_PIPE ViPipe) +{ + if (g_fd[ViPipe] >= 0) { + close(g_fd[ViPipe]); + g_fd[ViPipe] = -1; + return GK_SUCCESS; + } + return GK_FAILURE; +} + + +struct i2c_rdwr_ioctl_data { + struct i2c_msg *msgs; + unsigned int nmsgs; +}; +#define GC5603_I2C_MSG_NUM 2 +#define GC5603_RECV_BUF_NUM 4 +static GK_S32 gc5603_read_register_arecvbuf(VI_PIPE ViPipe, GK_U32 addr, GK_U8 *aRecvbuf) +{ + GK_S32 s32Ret; + GK_U32 u32RegWidth = GC5603_ADDR_BYTE; + GK_U32 u32DataWidth = GC5603_DATA_BYTE; + +#ifdef LOSCFG_HOST_TYPE_VENDOR + GK_U32 u32SnsI2cAddr = (GC5603_I2C_ADDR >> 1); + struct i2c_rdwr_ioctl_data stRdwr; + struct i2c_msg astMsg[GC5603_I2C_MSG_NUM]; + (gk_void)memset_s(&stRdwr, sizeof(stRdwr), 0x0, sizeof(stRdwr)); + (gk_void)memset_s(astMsg, sizeof(astMsg), 0x0, sizeof(astMsg)); +#endif + (gk_void)memset_s(aRecvbuf, 4 * sizeof(GK_U8), 0x0, 4 * sizeof(GK_U8)); /* 4,4 len of aRecvbuf */ +#ifdef LOSCFG_HOST_TYPE_VENDOR + astMsg[0].addr = u32SnsI2cAddr; + astMsg[0].flags = 0; + astMsg[0].len = u32RegWidth; + astMsg[0].buf = aRecvbuf; + astMsg[1].addr = u32SnsI2cAddr; + astMsg[1].flags = 0; + astMsg[1].flags |= I2C_M_RD; + astMsg[1].len = u32DataWidth; + astMsg[1].buf = aRecvbuf; + stRdwr.msgs = &astMsg[0]; + stRdwr.nmsgs = 2; /* RegWidth 2 */ +#endif + +#ifdef LOSCFG_HOST_TYPE_VENDOR + if (u32RegWidth == 2) { /* RegWidth 2 */ + aRecvbuf[0] = (addr >> 8) & 0xff; /* shift 8 */ + aRecvbuf[1] = addr & 0xff; + } else { + aRecvbuf[0] = addr & 0xff; + } + s32Ret = ioctl(g_fd[ViPipe], I2C_RDWR, &stRdwr); +#else + if (u32RegWidth == 2) { /* RegWidth 2 */ + aRecvbuf[0] = addr & 0xff; + aRecvbuf[1] = (addr >> 8) & 0xff; /* shift 8 */ + } else { + aRecvbuf[0] = addr & 0xff; + } + s32Ret = read(g_fd[ViPipe], aRecvbuf, u32RegWidth + u32DataWidth); +#endif + return s32Ret; +} + + +int gc5603_read_register(VI_PIPE ViPipe, GK_S32 addr) +{ + GK_S32 s32RegVal; + + if (g_fd[ViPipe] < 0) { + return GK_FAILURE; + } + GK_S32 s32Ret; + + GK_U32 u32DataWidth = GC5603_DATA_BYTE; + GK_U8 aRecvbuf[GC5603_RECV_BUF_NUM]; + + s32Ret = gc5603_read_register_arecvbuf(ViPipe, addr, &aRecvbuf[0]); + if (s32Ret < 0) { + ISP_TRACE(MODULE_DBG_ERR, "gc5603_read_register failed!\n"); + return GK_FAILURE; + } + if (u32DataWidth == 2) { /* RegWidth 2 */ + s32RegVal = aRecvbuf[0] | (aRecvbuf[1] << 8); /* shift 8 */ + } else { + s32RegVal = aRecvbuf[0]; + } + return s32RegVal; +} + +int gc5603_write_register(VI_PIPE ViPipe, GK_S32 addr, GK_S32 data) +{ + if (g_fd[ViPipe] < 0) { + return GK_SUCCESS; + } + +#ifdef GPIO_I2C + i2c_data.dev_addr = GC5603_I2C_ADDR; + i2c_data.reg_addr = addr; + i2c_data.addr_byte_num = GC5603_ADDR_BYTE; + i2c_data.data = data; + i2c_data.data_byte_num = GC5603_DATA_BYTE; + + ret = ioctl(g_fd[ViPipe], GPIO_I2C_WRITE, &i2c_data); + if (ret) { + ISP_TRACE(MODULE_DBG_ERR, "GPIO-I2C write faild!\n"); + return ret; + } +#else + GK_U32 idx = 0; + GK_S32 ret; + GK_U8 buf[I2C_BUF_NUM]; + + if (GC5603_ADDR_BYTE == 2) { /* 2 byte */ + buf[idx] = (addr >> 8) & 0xff; /* shift 8 */ + idx++; + buf[idx] = addr & 0xff; + idx++; + } else { + buf[idx] = addr & 0xff; + idx++; + } + + if (GC5603_DATA_BYTE == 2) { /* 2 byte */ + buf[idx] = (data >> 8) & 0xff; /* shift 8 */ + idx++; + buf[idx] = data & 0xff; + idx++; + } else { + buf[idx] = data & 0xff; + idx++; + } + + ret = write(g_fd[ViPipe], buf, GC5603_ADDR_BYTE + GC5603_DATA_BYTE); + if (ret < 0) { + ISP_TRACE(MODULE_DBG_ERR, "I2C_WRITE error!\n"); + return GK_FAILURE; + } + +#endif + return GK_SUCCESS; +} + +void gc5603_standby(VI_PIPE ViPipe) +{ + return; +} + +void gc5603_restart(VI_PIPE ViPipe) +{ + return; +} + +void gc5603_mirror_flip(VI_PIPE ViPipe, ISP_SNS_MIRRORFLIP_TYPE_E eSnsMirrorFlip) +{ + + return; +} + +void gc5603_linear_1620p30_init(VI_PIPE ViPipe); + +void gc5603_init(VI_PIPE ViPipe) +{ + GK_U32 i; + GK_U32 quickStartFlag = 0; + GK_BOOL bInit; + GK_S32 ret = GK_SUCCESS; + + ISP_SNS_STATE_S *pastgc5603 = GK_NULL; + + pastgc5603 = gc5603_get_ctx(ViPipe); + bInit = pastgc5603->bInit; + + ret += gc5603_GetQuickStartFlag(ViPipe, &quickStartFlag); + + if (bInit == GK_FALSE) { + /* 1. sensor i2c init */ + gc5603_i2c_init(ViPipe); + if (ret != GK_SUCCESS) { + ISP_TRACE(MODULE_DBG_ERR, "i2c init failed!\n"); + return; + } + } + if (quickStartFlag == 0) { + + gc5603_linear_1620p30_init(ViPipe); + + } + for (i = 0; i < pastgc5603->astRegsInfo[0].u32RegNum; i++) { + ret += gc5603_write_register(ViPipe, + pastgc5603->astRegsInfo[0].astI2cData[i].u32RegAddr, + pastgc5603->astRegsInfo[0].astI2cData[i].u32Data); + } + + if (ret != GK_SUCCESS) { + ISP_TRACE(MODULE_DBG_ERR, "write register failed!\n"); + return; + } + + pastgc5603->bInit = GK_TRUE; + return; +} + +void gc5603_exit(VI_PIPE ViPipe) +{ + GK_S32 ret; + ret = gc5603_i2c_exit(ViPipe); + if (ret != GK_SUCCESS) { + ISP_TRACE(MODULE_DBG_ERR, "i2c exit failed!\n"); + return; + } + return; +} + +void gc5603_linear_1620p30_init(VI_PIPE ViPipe) +{ + GK_S32 ret = GK_SUCCESS; + ret += gc5603_write_register(ViPipe, 0x03fe, 0xf0); + ret += gc5603_write_register(ViPipe, 0x03fe, 0x00); + ret += gc5603_write_register(ViPipe, 0x03fe, 0x10); + ret += gc5603_write_register(ViPipe, 0x03fe, 0x00); + ret += gc5603_write_register(ViPipe, 0x0a38, 0x02); + ret += gc5603_write_register(ViPipe, 0x0a38, 0x03); + ret += gc5603_write_register(ViPipe, 0x0a20, 0x07); + ret += gc5603_write_register(ViPipe, 0x061c, 0x50); + ret += gc5603_write_register(ViPipe, 0x061d, 0x05); + ret += gc5603_write_register(ViPipe, 0x061e, 0x70); + ret += gc5603_write_register(ViPipe, 0x061f, 0x03); + ret += gc5603_write_register(ViPipe, 0x0a21, 0x08); + ret += gc5603_write_register(ViPipe, 0x0a34, 0x40); + ret += gc5603_write_register(ViPipe, 0x0a35, 0x51); + ret += gc5603_write_register(ViPipe, 0x0a36, 0x5e); + ret += gc5603_write_register(ViPipe, 0x0a37, 0x03); + ret += gc5603_write_register(ViPipe, 0x0314, 0x50); + ret += gc5603_write_register(ViPipe, 0x0315, 0x32); + ret += gc5603_write_register(ViPipe, 0x031c, 0xce); + ret += gc5603_write_register(ViPipe, 0x0219, 0x47); + ret += gc5603_write_register(ViPipe, 0x0342, 0x04); + ret += gc5603_write_register(ViPipe, 0x0343, 0xb0); + ret += gc5603_write_register(ViPipe, 0x0340, 0x06); + ret += gc5603_write_register(ViPipe, 0x0341, 0xd6); + ret += gc5603_write_register(ViPipe, 0x0345, 0x02); + ret += gc5603_write_register(ViPipe, 0x0347, 0x02); + ret += gc5603_write_register(ViPipe, 0x0348, 0x0b); + ret += gc5603_write_register(ViPipe, 0x0349, 0x98); + ret += gc5603_write_register(ViPipe, 0x034a, 0x06); + ret += gc5603_write_register(ViPipe, 0x034b, 0x8a); + ret += gc5603_write_register(ViPipe, 0x0094, 0x0b); //b40=2960 + ret += gc5603_write_register(ViPipe, 0x0095, 0x90); + ret += gc5603_write_register(ViPipe, 0x0096, 0x06); + ret += gc5603_write_register(ViPipe, 0x0097, 0x80);// 654=1620 + + ret += gc5603_write_register(ViPipe, 0x0099, 0x04); + ret += gc5603_write_register(ViPipe, 0x009b, 0x04); + ret += gc5603_write_register(ViPipe, 0x060e, 0xd2); + ret += gc5603_write_register(ViPipe, 0x060f, 0x05); + ret += gc5603_write_register(ViPipe, 0x070e, 0xd2); + ret += gc5603_write_register(ViPipe, 0x070f, 0x05); + ret += gc5603_write_register(ViPipe, 0x0909, 0x07); + ret += gc5603_write_register(ViPipe, 0x0902, 0x04); + ret += gc5603_write_register(ViPipe, 0x0904, 0x0b); + ret += gc5603_write_register(ViPipe, 0x0907, 0x54); + ret += gc5603_write_register(ViPipe, 0x0908, 0x06); + ret += gc5603_write_register(ViPipe, 0x0903, 0x9d); + ret += gc5603_write_register(ViPipe, 0x072a, 0x1c); + ret += gc5603_write_register(ViPipe, 0x072b, 0x1c); + ret += gc5603_write_register(ViPipe, 0x0724, 0x2b); + ret += gc5603_write_register(ViPipe, 0x0727, 0x2b); + ret += gc5603_write_register(ViPipe, 0x1466, 0x18); + ret += gc5603_write_register(ViPipe, 0x1467, 0x08); + ret += gc5603_write_register(ViPipe, 0x1468, 0x10); + ret += gc5603_write_register(ViPipe, 0x1469, 0x80); + ret += gc5603_write_register(ViPipe, 0x146a, 0xe8); + ret += gc5603_write_register(ViPipe, 0x0707, 0x07); + ret += gc5603_write_register(ViPipe, 0x0737, 0x0f); + ret += gc5603_write_register(ViPipe, 0x0704, 0x01); + ret += gc5603_write_register(ViPipe, 0x0706, 0x03); + ret += gc5603_write_register(ViPipe, 0x0716, 0x03); + ret += gc5603_write_register(ViPipe, 0x0708, 0xc8); + ret += gc5603_write_register(ViPipe, 0x0718, 0xc8); + ret += gc5603_write_register(ViPipe, 0x061a, 0x02); + ret += gc5603_write_register(ViPipe, 0x1430, 0x80); + ret += gc5603_write_register(ViPipe, 0x1407, 0x10); + ret += gc5603_write_register(ViPipe, 0x1408, 0x16); + ret += gc5603_write_register(ViPipe, 0x1409, 0x03); + ret += gc5603_write_register(ViPipe, 0x1438, 0x01); + ret += gc5603_write_register(ViPipe, 0x02ce, 0x03); + ret += gc5603_write_register(ViPipe, 0x0245, 0xc9); + ret += gc5603_write_register(ViPipe, 0x023a, 0x08); + ret += gc5603_write_register(ViPipe, 0x02cd, 0x88); + ret += gc5603_write_register(ViPipe, 0x0612, 0x02); + ret += gc5603_write_register(ViPipe, 0x0613, 0xc7); + ret += gc5603_write_register(ViPipe, 0x0243, 0x03); + ret += gc5603_write_register(ViPipe, 0x0089, 0x03); + ret += gc5603_write_register(ViPipe, 0x0040, 0xa3); + ret += gc5603_write_register(ViPipe, 0x0075, 0x64); + ret += gc5603_write_register(ViPipe, 0x0004, 0x0e); + ret += gc5603_write_register(ViPipe, 0x0053, 0x0a); + ret += gc5603_write_register(ViPipe, 0x0205, 0x0c); + ret += gc5603_write_register(ViPipe, 0x0181, 0x30); + ret += gc5603_write_register(ViPipe, 0x0182, 0x05); + ret += gc5603_write_register(ViPipe, 0x0185, 0x01); + ret += gc5603_write_register(ViPipe, 0x0180, 0x46); + ret += gc5603_write_register(ViPipe, 0x0100, 0x08); + ret += gc5603_write_register(ViPipe, 0x010d, 0x74); + ret += gc5603_write_register(ViPipe, 0x010e, 0x0e); + ret += gc5603_write_register(ViPipe, 0x0113, 0x02); + ret += gc5603_write_register(ViPipe, 0x0114, 0x01); + ret += gc5603_write_register(ViPipe, 0x0115, 0x10); + ret += gc5603_write_register(ViPipe, 0x0100, 0x09); + if (ret != GK_SUCCESS) { + ISP_TRACE(MODULE_DBG_ERR, "write register failed!\n"); + return; + } + + printf("=== Galaxycore GC5603_1620P_30FPS_10BIT_LINEAR_Init_OK!===\n"); + return; +} +