超出曝光的曝光时间计算

        根据项目需要,在IMX214的sensor上实现超出曝光,简单的做法就是创建一个属性节点,上层通过属性节点来操作超出曝光,通过测试,可以达到预期的效果,不过所用时间都是微秒级的,所以需要注意变量类型,再就是,MTK的32平台最长曝光时间是4-5s,超过这个时间,ISP就会自动重启.



static kal_uint32 CalcInus(void)
 {
  kal_uint32    LineInus[2]={0};
  UINT16 Para16[2]={0};
  UINT32 Para32;
 
  //switch(IMX214CurrentScenarioId)
  {
   //case MSDK_SCENARIO_ID_VIDEO_PREVIEW:
   //Para16[0]=imgsensor.line_length;//IMX214_FeatureControl_PERIOD_PixelNum;
   //Para16[1]=imgsensor.frame_length;//IMX214_FeatureControl_PERIOD_LineNum;
   //Para32 = imgsensor.pclk;//IMX214.videoPclk * 100000;      
   //break;
   //case MSDK_SCENARIO_ID_CAMERA_ZSD:
   //case MSDK_SCENARIO_ID_CAMERA_CAPTURE_JPEG:
   //Para16[0]=imgsensor.line_length;//IMX214_FeatureControl_PERIOD_PixelNum;
   //Para16[1]=imgsensor.frame_length;//IMX214_FeatureControl_PERIOD_LineNum;
   //Para32 = imgsensor.pclk;//IMX214.capPclk * 100000; //19500000;
   //break;
   //default:
    Para16[0]=imgsensor.line_length;//IMX214_FeatureControl_PERIOD_PixelNum;
    Para16[1]=imgsensor.frame_length;//IMX214_FeatureControl_PERIOD_LineNum;
    Para32 = imgsensor.pclk;//IMX214.pvPclk * 100000; //19500000;
    //break;
  }
 
  printk("[ma] Para16[0]=%d,Para16[1]=%d,Para32=%d\n",Para16[0],Para16[1],Para32);
  //LineInus[0]=(UINT32)(((unsigned long)Para16[0]*1000000+(Para32>>1))/Para32);
  Para32=Para32/1000000;
  printk("[ma] Para16[0]=%d,Para16[1]=%d,Para32=%d\n",Para16[0],Para16[1],Para32);
  LineInus[0]=(UINT32)(((unsigned long)Para16[0]+(Para32>>1))/Para32);
  printk("[ma] CalcInus=%d\n",LineInus[0]);
  return LineInus[0];//us
 }
 
 void IMX214_SetShutterForD(kal_uint32 Eposuretime)
 {
  //printk("[ma][IMX214] X_SetShutter %d\n",iShutter);
  //x1220_Shutter=iShutter;
  //IMX214_write_shutter(iShutter);
  
  kal_uint32  LineInus[2]={0};
  kal_uint16 iShutter=0;
 
  printk("[ma] IMX214_SetShutter Eposuretime=%d\n",Eposuretime);
  LineInus[0]=CalcInus();
  iShutter=(kal_uint32)(((Eposuretime))/LineInus[0]);
  printk("[ma] IMX214_SetShutter %d\n",iShutter);
  x1220_Shutter=iShutter;
  if(iShutter!=0) write_shutter(iShutter);//IMX214_write_shutter(iShutter);
  else printk("[ma] cancle IMX214_SetShutter %d\n",iShutter);
 }
 kal_uint32 IMX214_GetShutterForD(void)
 {
  //printk("[ma][IMX214] X_GetShutter %d\n",x1220_Shutter);
  //return x1220_Shutter;
  kal_uint32  LineInus[2]={0};
  kal_uint32 Eposuretime=0;
  printk("[ma] IMX214_GetShutter %d\n",cur_Shutter);
  LineInus[0]=CalcInus();
  Eposuretime=(kal_uint32)(cur_Shutter*LineInus[0]);///1000;
  printk("[ma] IMX214_GetShutter Eposuretime=%d\n",Eposuretime);
  return Eposuretime;
 }

你可能感兴趣的:(超出曝光的曝光时间计算)