⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 l1_preview.c

📁 dz3000_51.0.0.4.rar
💻 C
📖 第 1 页 / 共 5 页
字号:
                               	if((xoff<Hsize) && (yoff<Vsize))
                                        L2_FixOneBadPixel(xoff, yoff);
                        }


                }

		//patch5.0@cytsai@bad pixel begin
		L2_Set4KSRAMMode(0);
		//patch5.0@cytsai@bad pixel end

                return L1K_SUCCESS;
}

//patch4.5@yichang@badpixel end

//-----------------------------------------------------------------------------
//L1_PutDateStamp
//-----------------------------------------------------------------------------
/*
Arguments:
                Addr            -       Image starting address in the SDRAM
                Hsize           -   Image horizontal size
                Vsize           -   Image vertical size
                Xoff            -       Horizontal offset of the first font
                Yoff            -       Vertical offset of the first font
                FontColor       -       color of the stamped font
                BorderColor     -       color of the black attribute
                HalfColor       -       color of the half tone attribute
                Scale           -       scale of the font (1x, 2x, 3x, 4x)
                Mode            -   the format of the stamped date
                                                0:              2001/12/04
                                                1:              hh.mm.ss
                                                others: not be defined
*/
UCHAR L1_PutDateStamp(ULONG Addr, USHORT Hsize, USHORT Vsize, USHORT Xoff, USHORT Yoff, UCHAR FontColor, UCHAR BorderColor, UCHAR HalfColor, UCHAR Scale, UCHAR Mode) USING_0
{
                UCHAR font;
                UCHAR fhsize;
   	        //patch5.0@richie@sdram mapping begin
				ULONG freeAddr;

				freeAddr = K_SDRAM_ImageCaptureDisplayBufAddr;
		//patch5.0@richie@sdram mapping end

                fhsize = 16 * Scale;

                // setting the color of the font
                L2_SetStampFontColor(FontColor, HalfColor, BorderColor);
                // settting the size of the font
                L2_SetStampFontScale(Scale);
                // setting the image starting address and size
                L2_SetBGBAddr(Addr);
                L2_SetBGBSize(Hsize,Vsize);
                // read the Real Time Clock
                L2_ReadRTC(&G_DATEINFO);
//patch5.0@richie@sdram mapping begin

//Joe@2003.3.4 13:57 modify begin
/*
                // format == 0
                if(Mode==0) {
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 162+2   , Xoff         , Yoff, freeAddr); // stamp '2'
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 162+0   , Xoff+fhsize*1, Yoff, freeAddr); // stamp '0'
                        font = (G_DATEINFO.Year)/10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 162+font, Xoff+fhsize*2, Yoff, freeAddr); // stamp year
                        font = (G_DATEINFO.Year)%10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 162+font, Xoff+fhsize*3, Yoff, freeAddr); // stamp year
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 161     , Xoff+fhsize*4, Yoff, freeAddr); // stamp '/'
                        font = (G_DATEINFO.Month)/10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 162+font, Xoff+fhsize*5, Yoff, freeAddr); // stamp month
                        font = (G_DATEINFO.Month)%10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 162+font, Xoff+fhsize*6, Yoff, freeAddr); // stamp month
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 161     , Xoff+fhsize*7, Yoff, freeAddr); // stamp '/'
                        font = (G_DATEINFO.Day)/10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 162+font, Xoff+fhsize*8, Yoff, freeAddr); // stamp day
                        font = (G_DATEINFO.Day)%10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 162+font, Xoff+fhsize*9, Yoff, freeAddr); // stamp day
                }
                // format == 0
                else if(Mode==1) {
                        font = (G_DATEINFO.Hour)/10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 162+font, Xoff+fhsize*2, Yoff, freeAddr); // stamp year
                        font = (G_DATEINFO.Hour)%10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 162+font, Xoff+fhsize*3, Yoff, freeAddr); // stamp year
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160     , Xoff+fhsize*4, Yoff, freeAddr); // stamp '.'
                        font = (G_DATEINFO.Minute)/10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 162+font, Xoff+fhsize*5, Yoff, freeAddr); // stamp month
                        font = (G_DATEINFO.Minute)%10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 162+font, Xoff+fhsize*6, Yoff, freeAddr); // stamp month
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160     , Xoff+fhsize*7, Yoff, freeAddr); // stamp '.'
                        font = (G_DATEINFO.Second)/10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 162+font, Xoff+fhsize*8, Yoff, freeAddr); // stamp day
                        font = (G_DATEINFO.Second)%10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 162+font, Xoff+fhsize*9, Yoff, freeAddr); // stamp day
                }
*/
                // format == 0
                if(Mode==0) {
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+2   , Xoff         , Yoff, freeAddr); // stamp '2'
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+0   , Xoff+fhsize*1, Yoff, freeAddr); // stamp '0'
                        font = (G_DATEINFO.Year)/10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+font, Xoff+fhsize*2, Yoff, freeAddr); // stamp year
                        font = (G_DATEINFO.Year)%10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+font, Xoff+fhsize*3, Yoff, freeAddr); // stamp year
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+19  , Xoff+fhsize*4, Yoff, freeAddr); // stamp '/'
                        font = (G_DATEINFO.Month)/10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+font, Xoff+fhsize*5, Yoff, freeAddr); // stamp month
                        font = (G_DATEINFO.Month)%10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+font, Xoff+fhsize*6, Yoff, freeAddr); // stamp month
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+19  , Xoff+fhsize*7, Yoff, freeAddr); // stamp '/'
                        font = (G_DATEINFO.Day)/10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+font, Xoff+fhsize*8, Yoff, freeAddr); // stamp day
                        font = (G_DATEINFO.Day)%10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+font, Xoff+fhsize*9, Yoff, freeAddr); // stamp day
                }
                // format == 0
                else if(Mode==1) {
                        font = (G_DATEINFO.Hour)/10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+font, Xoff+fhsize*2, Yoff, freeAddr); // stamp hour
                        font = (G_DATEINFO.Hour)%10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+font, Xoff+fhsize*3, Yoff, freeAddr); // stamp hour
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+24  , Xoff+fhsize*4, Yoff, freeAddr); // stamp ':'
                        font = (G_DATEINFO.Minute)/10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+font, Xoff+fhsize*5, Yoff, freeAddr); // stamp minute
                        font = (G_DATEINFO.Minute)%10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+font, Xoff+fhsize*6, Yoff, freeAddr); // stamp minute
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+24  , Xoff+fhsize*7, Yoff, freeAddr); // stamp ':'
                        font = (G_DATEINFO.Second)/10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+font, Xoff+fhsize*8, Yoff, freeAddr); // stamp second
                        font = (G_DATEINFO.Second)%10 ;
                        L2_StampOneFont(K_SDRAM_CharFontBufAddr, 160+font, Xoff+fhsize*9, Yoff, freeAddr); // stamp second
                }
//Joe@2003.3.4 13:57 modify end

//patch5.0@richie@sdram mapping end
                return L1K_SUCCESS;
}

#if STROBE_DEVICE
//patch4.3@andrew@0610
// this function just for reference
// BC. original struct has been erase
// I keep this part of code for future reference
void StrobeSetting(void)
{

   	if (G_pvconfig[K_UI_Preview_Strobe] == K_UI_Preview_Strobe_Fill)
	{
		STROBE = 1;
		if( Tidx < EV9_index )
		{
			if( Tidx > EV8_index )
				L2_AdjustGain(STB_Gain_min, 0);
			else if( Tidx > EV7_index )
				L2_AdjustGain(STB_Gain_mid, 0);
			else
				L2_AdjustGain(STB_Gain_max, 0);

			L2_WaitVD(0,3);
			L2_SetExposureTime(240,0);
			L2_WaitVD(0,1);
		}
		else
		{
			L2_WaitVD(0,3);
        	L2_SetExposureTime(Shutter*2, 0);
			L2_WaitVD(0,1);
		}
	}
	else if( ((G_pvconfig[K_UI_Preview_Strobe] == K_UI_Preview_Strobe_Auto) ||
			  (G_pvconfig[K_UI_Preview_Strobe] == K_UI_Preview_Strobe_Redeye)) &&
			  ( Tidx <= EV7_index ) && (AVG_LUM <80) )
	{
		STROBE = 1;
		if( Tidx < EV9_index )
		{
			if( Tidx > EV8_index )
				L2_AdjustGain(STB_Gain_min, 0);
			else if( Tidx > EV7_index )
				L2_AdjustGain(STB_Gain_mid, 0);
			else
				L2_AdjustGain(STB_Gain_max, 0);

			L2_WaitVD(0,3);
			L2_SetExposureTime(240,0);
			L2_WaitVD(0,1);
		}
		else
		{
			L2_WaitVD(0,3);
        		L2_SetExposureTime(Shutter*2, 0);
			L2_WaitVD(0,1);
		}
	}
  	else		// no strobe
  	{
  		STROBE = 0;
		L2_WaitVD(0,3);
		L2_SetExposureTime(Shutter*2, 0);
		L2_WaitVD(0,1);
  	}//wait



}

#endif

//patch4.3@andrew@0610
// for B shutter

void LongShutter(unsigned long  Tnum){

   UCHAR      temp1, temp2, tgpll;
  ULONG      pixclk;
  USHORT     linetotal, frametotal, espline;
  USHORT     B_frame;  /*extern exposure frame*/
  ULONG       frametimes;  /*each frame  ms*/

  UCHAR temp;



  //Caculate the linetotal, frametotal, pixel clock /////////////////////////////////////////////
  temp1      = XBYTE[0X2A41];
  temp2      = XBYTE[0X2A42];
  linetotal  = (USHORT)(temp2 << 8) + (USHORT)temp1;
  temp1      = XBYTE[0X2A50];
  temp2      = XBYTE[0X2A51];
  frametotal = (USHORT)(temp2 << 8) + (USHORT)temp1;
  temp1      = XBYTE[0x2A81];
  temp2      = XBYTE[0x2A82];

  tgpll      = XBYTE[0x2080] & 0x01;
  temp       = (float)(((XBYTE[0x2082] & 0x07) + 1) * (((XBYTE[0x2082] >> 4) & 0x07) + 1));
  if (tgpll)
 	pixclk = (6000000 * temp) / ((ULONG)(temp1 + 1) * (ULONG)(temp2 + 1) * (ULONG)(XBYTE[0x2081] + 1));
  else
     pixclk = 96000000 / ((ULONG)(temp1 + 1) * (ULONG)(temp2 + 1));



  //////////////////////////////////////////////////////////////////////////////////////////////
  //Caculate the Exposure time to Exposure Line number ////////////////////////////////////////



  espline    = (USHORT)((pixclk * 10) / ((ULONG)linetotal * (ULONG)Tnum));




  /*use  B shutter */
  if (espline > frametotal)
  {

	B_frame=(espline/frametotal);
	espline=espline-B_frame*frametotal;
	frametimes=((ULONG)frametotal)*((ULONG)linetotal)*1000/pixclk;

	espline = espline -2;					//Because Read use 2 line

	L2_WaitVD(0, 1);
	XBYTE[0X2B0A] = (UCHAR)espline;			//Set Exposure time
    	XBYTE[0X2B0B] = (UCHAR)(espline >> 8);


	XBYTE[0X2B07]= XBYTE[0X2B07]|0X20;  /* sub shutter on*/
	XBYTE[0X2B05] = 0x10|01 ;  /*trigger capture*/

	L2_Wait((B_frame+2)*frametimes);


	XBYTE[0x270F] = 0x02;  //Set sdram  Field mode
	XBYTE[0X2B07]= XBYTE[0X2B07]&0XDF;  /* sub shutter off */


  }

  /*normal shutter*/
  else{

	  XBYTE[0X2B05] = 0x10 | 01;
    	  XBYTE[0x270F] = 0x02;  //Set Field mode
  }







	temp = L2_WCShutter();

	if (temp == 0)
	 {
     		L2_CloseMShutter();
      		//DbgPrint("            Close Shutter \n");
     }


	temp = L2_WOShutter();
	if (temp == 0)
	 {
     		 L2_OpenMShutter();
	  	//DbgPrint("            Open Shutter \n");
	 }


	while((L2_CheckDRAMStatus()&0X02)!=0X02);

	//PRINT_FRONT ("            Snap %d Full frame Image \n", (USHORT)SnapNum);

	XBYTE[0x270F] = 0x00;  //Set Field normal mode

}



//patch4.3@andrew@0610

void Preview2SnapAETransfer(void){
//patch4.4@andrew@Mn39472
#ifdef MN39472
#ifdef TLV990
    USHORT d_gain;
    ULONG times;
    int idx,c;
    USHORT mingain_d;
    USHORT g_exp_compen=55;


    printf("preview\n");
    printf("gain=%x\n",Gain);
    printf("shutter=%lx\n",Shutter);

#if (K_MINIGAIN==20)
	mingain_d=133;
#endif

#if (K_MINIGAIN==22)
	mingain_d=152;
#endif

#if (K_MINIGAIN==24)
	mingain_d=169;
#endif


    if (Gain>mingain_d){

	    d_gain=Gain-mingain_d;

	    if(d_gain>(mingain_d-g_exp_compen))
	    	d_gain=(mingain_d-g_exp_compen);   /* 133= double*/

	    idx=(d_gain+g_exp_compen)/10;
	    c=(d_gain+g_exp_compen)-(idx*10);

	    times= TLV990_TABLE[idx]+(TLV990_TABLE[idx+1]-TLV990_TABLE[idx])*c/10;

           Shutter=(Shutter*1000)/(times);
           Gain=Gain-d_gain;
    }


   // if(Tidx<20)
    //	 XBYTE[0x21A0] = 0x02;  //Edge disable,Y  LPF

    printf("preview\n");
    printf("gain=%x\n",Gain);
    printf("shutter=%lx\n",Shutter);

    if(Shutter<=100)
    	  L2_SetFrameRate(10, 0);

    L2_AdjustGain(Gain,0);
    L2_SetExposureTime(Shutter,0);

    L2_WaitVD(0,1);
#endif
#endif


#ifdef ICM107B
	STROBE=0;
	L2_WaitVD(0,3);
	L2_SetExposureTime(Shutter*2, 0);
	L2_WaitVD(0,1);
#endif


#ifdef MCM20027    //patch4.3@jhyu@0612
	STROBE=0;

	//L2_WaitVD(0,3);

	L2_SetExposureTime(Shutter*2, 0);

	L2_WaitVD(0,1);
#endif

#ifdef OV13 //patch4.2@jhyu@0517
	int temp_gain; //patch 4.2@jhyu@0523
	unsigned long SXGA_Shutter;
	STROBE=0;
//	L2_WaitVD(0,3);	//patch4.4@jhyu@speedup

/*
	    if(Tidx < 34)
		{
		SXGA_Shutter = Shutter*1.9;
		L2_SetExposureTime(SXGA_Shutter, 0);
	//	DbgPrint("1: Shutter=%lx\n",SXGA_Shutter);
		}
*/
        if(Tidx < 11)
		{
            if (Gain >= 0x30)  //jane@040223 add

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -