int TI_2A_ISP_control(int eTime, int aGain, int dGain, int cTemp) { static int steaySet = -1; static int tempSet = -1, tempCnt = 0; int tempCountLimit = 10; int i = getSetIndex(eTime, aGain, dGain, cTemp); int j = 0; if (steaySet == i) { tempSet = -1; tempCnt = 0; } else if (tempSet == i && tempCnt >= tempCountLimit) { steaySet = i; tempSet = -1; tempCnt = 0; ISP_config(i); } else if (tempSet == i) { tempCnt++; } else { tempSet = i; tempCnt = 0; } return 100 * steaySet + j; }
void simulate(FILE* fp, int setIndex, int lines, int blockBits) { //simulate cache memory struct cache_line** cache = build_cache(setIndex, lines); char blank; char Op; int addressVal; int offset; char buf[1000]; int hit = 0, miss = 0, eviction = 0; int setNumber; int tag; int tempHit, tempMiss, tempEvict; while (fgets(buf, sizeof(buf), fp) != NULL) { tempHit = tempMiss = tempEvict = 0; sscanf(buf, "%c %c %x,%d",&blank, &Op, &addressVal, &offset); if (blank == 'I') continue; setNumber = getSetIndex(addressVal, setIndex, blockBits); tag = addressVal >> (setIndex + blockBits); if (findCache(cache, setNumber, lines, tag)) { hit ++; tempHit ++; updateCache(setNumber, tag); } else { miss ++; tempMiss ++; tempEvict += replaceCache(cache, setNumber, lines, tag); } if (Op == 'M') { //if the operation is M, need to find cache again if (findCache(cache, setNumber, lines, tag)) { hit ++; tempHit ++; updateCache(setNumber, tag); } else { miss ++; tempMiss ++; tempEvict += replaceCache(cache, setNumber, lines, tag); } } eviction += tempEvict; if (verbose) printVerboseInfo(buf, tempHit, tempMiss, tempEvict); } //printf("%d %d %d\n", hit, miss, eviction); freeCache(cache); freeQueue(); printSummary(hit, miss, eviction); }
static void ISP_SetCcdcClamp(int aGain, int dGain) { static int value_bak = -1; int value; int i; static CSL_CcdcClampConfig pPrm = { .enable = 1, .mode = 0, .dcOffset = -200, .clampStartV = 0, .horzClampMode = 0, .horzClampBlack = 0, .horzClampWinStartH = 0, .horzClampWinStartV = 0, .horzClampWinSizeV = 16, .horzClampWinSizeH = 256, .horzClampBaseWin = 0, .horzClampNumWin = 0, .vertClampResetValue = 0, .vertClampResetValueSource = 0, .vertClampLineAvgCoeff = 0, .vertClampWinStartH = 0, .vertClampWinStartV = 0, .vertClampWinSizeH = 0, .vertClampNumWin = 0, .vertClampBlackOptical = 16, }; if (aGain < 3000) { value = -200; } else { value = -200 - (aGain - 3000) / 500.0 - (dGain - 1000) / 300.0; } value += gALG_AewbDebug.CcdcClamp.ClampValue_adjust; value = (value > -180) ? -180 : value; value = (value < -210) ? -210 : value; if (value == value_bak) { return; } value_bak = value; #if ISP_DEBUG printf("----ISP_SetCcdcClamp value =%d\n", value); #endif gALG_AewbDebug.CcdcClamp.ClampValue = value; pPrm.dcOffset = (Uint32)value; DRV_isifLock(); //ANR - ISIF CSL_ccdcSetClampConfig(&gCSL_ccdcHndl, &pPrm); DRV_isifUnlock(); //ANR - ISIF } static void ISP_ipipeSetNf2(int aGain, int dGain) { static int value_bak = -1; static CSL_IpipeNfConfig nf2 = { .enable = 1, .spreadVal = 3, .spreadValSrc = 0, .lutAddrShift = 0, .greenSampleMethod = 0, .lscGainEnable = 0, .edgeDetectThresMin = 0, .edgeDetectThresMax = 2047, .lutThresTable = {20, 20, 20, 20, 20, 20, 20, 20}, .lutIntensityTable = {24, 25, 26, 26, 27, 28, 29, 30}, .lutSpreadTable = { 0, 0, 0, 0, 0, 0, 0, 0}, }; int ag = (aGain > 40000) ? 40000 : aGain; int dg = (dGain > 1536) ? 1536 : dGain; int value = 0; if (ag < 10000) { value = 20; } else { value = 20 + (ag - 10000) / 300 + (dg - 1000) / 10; } value += gALG_AewbDebug.ipipeNf2.Nf2Value_adjust + ALG_aewbGetNoiseLevel(); value = (value > 200) ? 200 : value; value = (value < 16) ? 16 : value; if (value == value_bak) { return; } value_bak = value; int i; for (i = 0; i < 8; i++) { nf2.lutThresTable[i] = (Uint32)value + (Uint32)(i * value / 10); } gALG_AewbDebug.ipipeNf2.Nf2Value = value; #if ISP_DEBUG printf("ISP_ipipeSetNf2 value = %3d\n", value); #endif DRV_ipipeSetNf2(&nf2); } static int getSetIndex(int eTime, int aGain, int dGain, int cTemp) { if (aGain >= 40000 && dGain >= 1280) { return 2; } else if (aGain >= 20000) { return 1; } else { return 0; } } int TI_2A_ISP_control_ar0331(int eTime, int aGain, int dGain, int cTemp) { static int steaySet = -1; static int tempSet = -1, tempCnt = 0; int tempCountLimit = 100; int i = getSetIndex(eTime, aGain, dGain, cTemp); int j = 0; ISP_ipipeSetNf2(aGain, dGain); if (steaySet == i) { j = switch_rgb2rgb_matrixes(cTemp, rgb_matrixes[i], 0); tempSet = -1; tempCnt = 0; } else if (tempSet == i && tempCnt >= tempCountLimit) { steaySet = i; tempSet = -1; tempCnt = 0; j = switch_rgb2rgb_matrixes(cTemp, rgb_matrixes[i], 1); } else if (tempSet == i) { tempCnt++; } else { tempSet = i; tempCnt = 0; } return 100 * steaySet + j; }