text: 
  #include <utils/Log.h>
  #include <fcntl.h>
  #include <math.h>
  
  #include "camera_custom_nvram.h"
  #include "camera_custom_sensor.h"
  #include "image_sensor.h"
  #include "kd_imgsensor_define.h"
  #include "camera_AE_PLineTable_gc5004raw.h"
  #include "camera_info_gc5004raw.h"
  #include "camera_custom_AEPlinetable.h"
  //#include "camera_custom_flicker_table.h"
  #include "camera_custom_flicker_para.h"
  #include <cutils/xlog.h>
  
  
  static void get_flicker_para_by_preview(FLICKER_CUST_PARA* para)
  {
    int i;
    int freq[9] = { 70, 80, 90, 100, 120, 130, 140, 160, 170};
    FLICKER_CUST_STATISTICS EV50_L50 = {-194, 4721, 381, -766};
    FLICKER_CUST_STATISTICS EV50_L60 = {1052, 441, 825, -409};
    FLICKER_CUST_STATISTICS EV60_L50 = {1255, 465, 1228, -483};
    FLICKER_CUST_STATISTICS EV60_L60 = {-162, 2898, 247, -642};
    for(i=0;i<9;i++)
    {
      para->flickerFreq[i]=freq[i];
    }
    para->flickerGradThreshold=26;
    para->flickerSearchRange=32;
    para->minPastFrames=3;
    para->maxPastFrames=14;
    para->EV50_L50=EV50_L50;
    para->EV50_L60=EV50_L60;
    para->EV60_L50=EV60_L50;
    para->EV60_L60=EV60_L60;
    para->EV50_thresholds[0]=-30;
    para->EV50_thresholds[1]=12;
    para->EV60_thresholds[0]=-30;
    para->EV60_thresholds[1]=12;
    para->freq_feature_index[0]=4;
    para->freq_feature_index[1]=3;
  }
  
  static void get_flicker_para_by_ZSD(FLICKER_CUST_PARA* para)
  {
    int i;
    int freq[9] =  { 70, 80, 90, 100, 110, 120, 130, 140, 160};
    FLICKER_CUST_STATISTICS EV50_L50 = {-194, 4721, 381, -766};
    FLICKER_CUST_STATISTICS EV50_L60 = {7424, 62, 117, 90};
    FLICKER_CUST_STATISTICS EV60_L50 = {8853, 65, 174, 16};
    FLICKER_CUST_STATISTICS EV60_L60 = {-162, 2898, 247, -642};
  
    for(i=0;i<9;i++)
    {
      para->flickerFreq[i]=freq[i];
    }
    para->flickerGradThreshold=33;
    para->flickerSearchRange=32;
    para->minPastFrames=3;
    para->maxPastFrames=14;
    para->EV50_L50=EV50_L50;
    para->EV50_L60=EV50_L60;
    para->EV60_L50=EV60_L50;
    para->EV60_L60=EV60_L60;
    para->EV50_thresholds[0]=-30;
    para->EV50_thresholds[1]=12;
    para->EV60_thresholds[0]=-30;
    para->EV60_thresholds[1]=12;
    para->freq_feature_index[0]=5;
    para->freq_feature_index[1]=3;
  }
  
  static void get_flicker_para_by_vPreview(FLICKER_CUST_PARA* para)
  {
    int i;
    int freq[9] =  { 80, 90, 100, 120, 130, 140, 170, 210, 230};
    FLICKER_CUST_STATISTICS EV50_L50 = {-194, 4721, 381, -766};
    FLICKER_CUST_STATISTICS EV50_L60 = {1029, 451, 843, -415};
    FLICKER_CUST_STATISTICS EV60_L50 = {1227, 475, 1256, -489};
    FLICKER_CUST_STATISTICS EV60_L60 = {-162, 2898, 247, -642};
  
    for(i=0;i<9;i++)
    {
      para->flickerFreq[i]=freq[i];
    }
    para->flickerGradThreshold=29;
    para->flickerSearchRange=16;
    para->minPastFrames=3;
    para->maxPastFrames=14;
    para->EV50_L50=EV50_L50;
    para->EV50_L60=EV50_L60;
    para->EV60_L50=EV60_L50;
    para->EV60_L60=EV60_L60;
    para->EV50_thresholds[0]=-30;
    para->EV50_thresholds[1]=12;
    para->EV60_thresholds[0]=-30;
    para->EV60_thresholds[1]=12;
    para->freq_feature_index[0]=3;
    para->freq_feature_index[1]=2;
  }
  
  
  typedef NSFeature::RAWSensorInfo<SENSOR_ID> SensorInfoSingleton_T;
  namespace NSFeature {
  template <>
  UINT32
  SensorInfoSingleton_T::
  impGetFlickerPara(MINT32 sensorMode, MVOID*const pDataBuf) const
  {
  	XLOGD("impGetFlickerPara+ mode=%d", sensorMode);
  	XLOGD("prv=%d, vdo=%d, cap=%d, zsd=%d",
  	    (int)e_sensorModePreview, (int)e_sensorModeVideoPreview, (int)e_sensorModeCapture, (int)e_sensorModeZsd );
  	FLICKER_CUST_PARA* para;
  	para =  (FLICKER_CUST_PARA*)pDataBuf;
  	if(sensorMode==e_sensorModePreview)
  		get_flicker_para_by_preview(para);
  	else if(sensorMode==e_sensorModeZsd||
  	   sensorMode==e_sensorModeCapture)
  	{
  		get_flicker_para_by_ZSD(para);
  	}
  	else if(sensorMode==e_sensorModeVideoPreview)
  	{
  		get_flicker_para_by_vPreview(para);
  	}
  	else
  	{
  		XLOGD("impGetFlickerPara ERROR ln=%d", __LINE__);
  		return -1;
  	}
  	XLOGD("impGetFlickerPara-");
  	return 0;
  }
  }
  
  