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

📄 l1_preview.c

📁 dz3000_51.0.0.4.rar
💻 C
📖 第 1 页 / 共 5 页
字号:
		}

		min_gain = FR;
		if( FG1 < min_gain ) min_gain = FG1;
		if( FB  < min_gain ) min_gain = FB;
		if( FG2 < min_gain ) min_gain = FG2;

		ratio = 64/(float)min_gain;

		FR *= ratio;
		FG1*= ratio;
		FB *= ratio;
		FG2*= ratio;

		if (FR > AWBMaxGain) 	FR=AWBMaxGain;
	    	if (FR < AWBMinGain) 	FR=AWBMinGain;
		if (FG1> AWBMaxGain) 	FG1=AWBMaxGain;
        	if (FG1< AWBMinGain) 	FG1=AWBMinGain;
		if (FB > AWBMaxGain) 	FB=AWBMaxGain;
        	if (FB < AWBMinGain) 	FB=AWBMinGain;
		if (FG2> AWBMaxGain) 	FG2=AWBMaxGain;
        	if (FG2< AWBMinGain) 	FG2=AWBMinGain;
 	}
	else
	{
		r_gain = Reg_Rg | ((Reg_Hg&0x08)<<5);
		gr_gain= Reg_Grg| ((Reg_Hg&0x04)<<6);
   	 	b_gain = Reg_Bg | ((Reg_Hg&0x02)<<7);
    		gb_gain= Reg_Gbg| ((Reg_Hg&0x01)<<8);

		FR = (USHORT)r_gain;
		FG1= (USHORT)gr_gain;
   	 	FB = (USHORT)b_gain;
    		FG2= (USHORT)gb_gain;

	}

	L2_SetWB(r_off, gr_off, b_off, gb_off, FR, FG1, FB, FG2);//patch4.3@jhyu@0604


	ratio = 1.3*256/Gain;

	if( SAT && ( Gain < 0x150))
	{
			FR *= ratio;
			FG1*= ratio;
        		FB *= ratio;
			FG2*= ratio;

	}
	else
	{

	}

	L2_SetWB(r_off, gr_off, b_off, gb_off, FR, FG1, FB, FG2);//patch4.3@jhyu@0604

	if( STROBE )
	{
		L2_ConfigSPW(3, 0xa0, 0xf0, 0xe0, 0x20, 0xf0, 0x10);
		L2_ConfigSPW(2, 0x78, 0xa0, 0xe4, 0x1c, 0xf2, 0x0e);
		L2_ConfigSPW(1, 0x50, 0x78, 0xe8, 0x18, 0xf4, 0x0c);
		L2_ConfigSPW(0, 0x28, 0x50, 0xec, 0x14, 0xf6, 0x0a);

		//patch5.0@richie@sdram mapping begin
		L2_DoCDSP(G_RawImageBufAddr,G_Hsize,G_Vsize+12,
                      K_SDRAM_ImageCaptureGeneralBufAddr,280,200,
                      1,0x22);
		//patch5.0@richie@sdram mapping end

		XBYTE[0x20e8] |= 0x04;

		LumClamp0 = XBYTE[0x221b];
		LumClamp1 = XBYTE[0x221c];
		LumClamp2 = XBYTE[0x221d];
		LumClamp3 = XBYTE[0x221e];
		LumClamp4 = XBYTE[0x221f];

	        	//L2_WaitVD(0,1);
	        	XBYTE[0x221b] = 0;
	        	XBYTE[0x221c] = 0;
	        	XBYTE[0x221d] = 0;
	        	XBYTE[0x221e] = 0;
	        	XBYTE[0x221f] = 0;
			for( i =0 ; i< 4; i++)
			{
				L2_ReadSPW(i, &spwnum, &spwlum, &spwry, &spwby);
				SPW_CNT[i] = spwnum;
				SPW_Y[i] = spwlum;
				SPW_RY[i] = spwry;
				SPW_BY[i] = spwby;
			}

	        	XBYTE[0x20e8] &= 0xfb;
	        	XBYTE[0x221b] = LumClamp0;
	        	XBYTE[0x221c] = LumClamp1;
	        	XBYTE[0x221d] = LumClamp2;
	        	XBYTE[0x221e] = LumClamp3;
	        	XBYTE[0x221f] = LumClamp4;
			for( i=1; i< 4; i++)
				SPW_Y[0]+=SPW_Y[i];
			SPW_Y[0] /= 4;

			for( i=1; i< 4; i++)
				SPW_BY[0]+=SPW_BY[i];
			SPW_BY[0] /= 4;

			for( i=1; i< 4; i++)
				SPW_RY[0]+=SPW_RY[i];
			SPW_RY[0] /= 4;

			SPW_BY[0] += SPW_Y[0];
			SPW_RY[0] += SPW_Y[0];
			SPW_Y[0] = ((ULONG)SPW_Y[0]*512-152*SPW_RY[0]-57*SPW_BY[0])/303;
			if( (SPW_RY[0] > 10) && (SPW_BY[0] > 10) && (SPW_Y[0] > 40) )
			{
				FR *= ((float)SPW_Y[0]*1.0/SPW_RY[0]);
			 	FB *= ((float)SPW_Y[0]*1.0/SPW_BY[0]);

			    min_gain = FR;
				if( FG1  < min_gain )	min_gain = FG1;
				if( FB < min_gain )		min_gain = FB;
				if( FG2 < min_gain ) 	min_gain = FG2;

				ratio = 64/(float)min_gain;

				FR *= ratio;
				FG1*= ratio;
				FB *= ratio;
				FG2*= ratio;

				if (FR>AWBMaxGain) 	FR=AWBMaxGain;
				if (FR<AWBMinGain) 	FR=AWBMinGain;
				if (FG1>AWBMaxGain) FG1=AWBMaxGain;
				if (FG1<AWBMinGain) FG1=AWBMinGain;
				if (FB>AWBMaxGain) 	FB=AWBMaxGain;
				if (FB<AWBMinGain) 	FB=AWBMinGain;
				if (FG2>AWBMaxGain) FG2=AWBMaxGain;
				if (FG2<AWBMinGain) FG2=AWBMinGain;

				ratio = 1.3*256/Gain;
				if( SAT && ( Gain < 0x150))
				{
					FR *= ratio;
					FG1 *= ratio;
					FG2 *= ratio;
        			FB *= ratio;
				}
				L2_SetWB(r_off, gr_off, b_off, gb_off, FR, FG1, FB, FG2);//patch4.3@jhyu@0604
			}
//			SetStdColor2();
	}
//patch5.0@richie@sdram mapping begin

	//Joe@2003.3.15 16:23 add begin
	if (STROBE)
	{
    		//L2_SetWB(0x00, 0x00, 0x00, 0x00, 0x56, 0x3f, 0x4d, 0x40);
	}
	else
	{
	    	#ifdef OV2610
	    		//L2_SetWB(0x01, 0x07, 0x00, 0x00, 0x59, 0x3d, 0x56, 0x40);
			 //L2_SetWB(0x0d, 0x03, 0x0b, 0x00, 0x59, 0x3f, 0x49, 0x40);//mito
		#else	
			//ov9620
			//L2_SetWB(0x0f, 0xf5, 0x0b, 0x00, 0x51, 0x40, 0x65, 0x40);
		#endif		
	}
	//Joe@2003.3.15 16:23 add end

	//XBYTE[0x2a82] = 3;
	L2_Wait( 10 );

	L2_DoCDSP2(G_RawImageBufAddr,G_Hsize,G_Vsize+12,
	                G_RawImageBufAddr,G_Hsize,G_Vsize,
	                0,0,K_SDRAM_ImageCaptureGeneralBufAddr);        //this function should extend the horizontal 16-pixels

	//XBYTE[0x2a82] = 1;

#else
        L2_DoCDSP2(G_RawImageBufAddr,G_Hsize,G_Vsize+12,
	                G_RawImageBufAddr,G_Hsize,G_Vsize,
	                0,0,K_SDRAM_ImageCaptureGeneralBufAddr);        //this function should extend the horizontal 16-pixels
#endif

	L2_SetCopyColorKey(0, 0);



        //yichang@0508 for multi-size snapping
        /////// 2X Digital Zoom ///////////////////////////////////////////
	//patch4.3@richie@zo begin

	//patch4.5@richie@smooth zoom begin
	// 1X
	if (G_usZoomX == 100)
	{
		//do nothing
	}
	// 1. X ~ 2X
	else if ((G_usZoomX > 100) && (G_usZoomX < 200))
	{
		captureWidth = ((ULONG)G_Hsize*(ULONG)100)/(ULONG)(G_usZoomX);
		captureHeight = ((ULONG)G_Vsize*(ULONG)100)/(ULONG)(G_usZoomX);
		captureWidth = (captureWidth >> 2) << 2;
		captureHeight = (captureHeight >> 2) << 2;
printf("1.XXX zoom captureWidth=%d,captureHeight=%d\n",captureWidth,captureHeight);

		zoomOffX = (G_Hsize - captureWidth) / 2;
		zoomOffY = (G_Vsize - captureHeight) / 2;



		//copy cutted image to bottom of ICGB from bottom 1/4 to top 1/4
			//source address and size
                L2_CopyImage(G_RawImageBufAddr,G_Hsize,G_Vsize,
			//source offset
			zoomOffX,
			zoomOffY + (captureHeight / 4) * 3,
			//size to be copied
                        captureWidth, captureHeight / 4,
			//destination address and size
			K_SDRAM_ImageCaptureGeneralBufAddr + K_SDRAM_ImageCaptureGeneralBufSize
			- ((ULONG)captureWidth * ((ULONG)captureHeight / (ULONG)4))
                        , captureWidth, captureHeight / 4,
			//destination offset
                        0,0);

                L2_CopyImage(G_RawImageBufAddr,G_Hsize,G_Vsize,
			//source offset
			zoomOffX,
			zoomOffY + (captureHeight / 4) * 2,
			//size to be copied
                        captureWidth, captureHeight / 4,
			//destination address and size
			K_SDRAM_ImageCaptureGeneralBufAddr + K_SDRAM_ImageCaptureGeneralBufSize
			- ((ULONG)captureWidth * ((ULONG)captureHeight / (ULONG)2))
                        , captureWidth, captureHeight / 4,
			//destination offset
                        0,0);

                L2_CopyImage(G_RawImageBufAddr,G_Hsize,G_Vsize,
			//source offset
			zoomOffX,
			zoomOffY + (captureHeight / 4),
			//size to be copied
                        captureWidth, captureHeight / 4,
			//destination address and size
			K_SDRAM_ImageCaptureGeneralBufAddr + K_SDRAM_ImageCaptureGeneralBufSize
			- ((ULONG)captureWidth * ((ULONG)captureHeight / (ULONG)4) * (ULONG)3)
                        , captureWidth, captureHeight / 4,
			//destination offset
                        0,0);



                L2_CopyImage(G_RawImageBufAddr,G_Hsize,G_Vsize,
			//source offset
			zoomOffX,
			zoomOffY,
			//size to be copied
                        captureWidth, captureHeight / 4,
			//destination address and size
			K_SDRAM_ImageCaptureGeneralBufAddr + K_SDRAM_ImageCaptureGeneralBufSize
			- ((ULONG)captureWidth * (ULONG)captureHeight)
                        , captureWidth, captureHeight / 4,
			//destination offset
                        0,0);

		/*
			//source address and size
                L2_CopyImage(G_RawImageBufAddr,G_Hsize,G_Vsize,
			//source offset
			zoomOffX,
			zoomOffY,
			//size to be copied
                        captureWidth, captureHeight,
			//destination address and size
                        G_RawImageBufAddr, captureWidth, captureHeight,
			//destination offset
                        0,0);
		*/


		//scale up image
		L2_ScaleUpImage_H(K_SDRAM_ImageCaptureGeneralBufAddr + K_SDRAM_ImageCaptureGeneralBufSize
				  - ((ULONG)captureWidth * (ULONG)captureHeight),
				  //src size
				  captureWidth,captureHeight,
				  //dest address
				  K_SDRAM_ImageCaptureGeneralBufAddr + K_SDRAM_ImageCaptureGeneralBufSize
				  - ((ULONG)G_Hsize * (ULONG)captureHeight)
				  - (K_SDRAM_ImageCaptureGeneralBufSize / (ULONG)2),
				  G_Hsize);

		L2_ScaleUpImage_V(K_SDRAM_ImageCaptureGeneralBufAddr + K_SDRAM_ImageCaptureGeneralBufSize
				  - ((ULONG)G_Hsize * (ULONG)captureHeight)
				  - (K_SDRAM_ImageCaptureGeneralBufSize / (ULONG)2),
				  //src size
				  G_Hsize,captureHeight,
				  //dest address
				  K_SDRAM_ImageCaptureBufAddr,
				  G_Vsize);

		//patch5.0@richie@conti shot begin
		G_RawImageBufAddr = K_SDRAM_ImageCaptureBufAddr;
		//patch5.0@richie@conti shot end

	}
	else
	{
		captureWidth = ((ULONG)G_Hsize*(ULONG)100)/(ULONG)(G_usZoomX);
		captureHeight = ((ULONG)G_Vsize*(ULONG)100)/(ULONG)(G_usZoomX);
		captureWidth = (captureWidth >> 2) << 2;
		captureHeight = (captureHeight >> 2) << 2;
printf("2.XXX zoom captureWidth=%d,captureHeight=%d\n",captureWidth,captureHeight);

		zoomOffX = (G_Hsize - captureWidth) / 2;
		zoomOffY = (G_Vsize - captureHeight) / 2;



		//copy cutted image to top of ICB
			//source address and size
                L2_CopyImage(G_RawImageBufAddr,G_Hsize,G_Vsize,
			//source offset
			zoomOffX,
			zoomOffY,
			//size to be copied
                        captureWidth, captureHeight,
			//destination address and size
//patch5.0@richie@conti shot begin
			//G_RawImageBufAddr,
			K_SDRAM_ImageCaptureBufAddr,
//patch5.0@richie@conti shot end
			captureWidth, captureHeight,
			//destination offset
                        0,0);


		//scale up image
		L2_ScaleUpImage_H(
//patch5.0@richie@conti shot begin
				  //G_RawImageBufAddr,
				  K_SDRAM_ImageCaptureBufAddr,
//patch5.0@richie@conti shot end
				  //src size
				  captureWidth,captureHeight,
				  //dest address
				  K_SDRAM_ImageCaptureGeneralBufAddr + K_SDRAM_ImageCaptureGeneralBufSize
				  - ((ULONG)G_Hsize * (ULONG)captureHeight),
				  G_Hsize);

		L2_ScaleUpImage_V(K_SDRAM_ImageCaptureGeneralBufAddr + K_SDRAM_ImageCaptureGeneralBufSize
				  - ((ULONG)G_Hsize * (ULONG)captureHeight),
				  //src size
				  G_Hsize,captureHeight,
				  //dest address
				  K_SDRAM_ImageCaptureBufAddr,
				  G_Vsize);

		//patch5.0@richie@conti shot begin
		G_RawImageBufAddr = K_SDRAM_ImageCaptureBufAddr;
		//patch5.0@richie@conti shot end
	}

	//patch4.5@richie@smooth zoom end
	//patch4.3@richie@zo end

	//Joe@2003.3.4 13:09 add begin
	//FontColor	0: white
	//		1: yellow
	//		2: cyan
	//		3: green
	//		4: magenta
	//		5: red
	//		6: blue
	//		7: black
	//HalfTone	0: color of "halftone" attribute is the same as the image
	//		1: color of "halftone" attribute is the same as the font
	//		2: color of "halftone" attribute is black
	//BorderColor	0: color of "border" attribute is the same as the image
	//		1: color of "border" attribute is the same as the font
	//		2: color of "border" attribute is black
	//scale		scaling factor
	//        	1: 16x32 original size
	//		2: x2 scale up
	//		3: x3 scale up
	//		4: x4 scale up
	//Mode		0: YY/MM/DD
	//		1: HH:MM:SS
	if (G_DateStamp == 1)
	{
	     L1_PutDateStamp(G_RawImageBufAddr, G_Hsize, G_Vsize, G_Hsize-400, G_Vsize-160, 6/*FontColor*/, 0/*BorderColor*/, 0/*HalfColor*/, 2/*Scale*/, 0/*Mode*/);
	  //   L1_PutDateStamp(G_RawImageBufAddr, G_Hsize, G_Vsize, G_Hsize-400, G_Vsize-100, 6/*FontColor*/, 0/*BorderColor*/, 0/*HalfColor*/, 2/*Scale*/, 1/*Mode*/);
	//     L1_PutDateStamp(G_RawImageBufAddr, G_Hsize, G_Vsize, G_Hsize-330, G_Vsize-100, 6/*FontColor*/, 0/*BorderColor*/, 0/*HalfColor*/, 2/*Scale*/, 0/*Mode*/);//hx@del
	//     L1_PutDateStamp(G_RawImageBufAddr, G_Hsize, G_Vsize, G_Hsize-330, G_Vsize-60, 6/*FontColor*/, 0/*BorderColor*/, 0/*HalfColor*/, 2/*Scale*/, 1/*Mode*/);//hx@del for mito

	}
	//Joe@2003.3.4 13:09 add end

 	//hx@2003.5.31 add for mito begin
	/*/if ((G_CameraOptions.function == K_UIOPTION_FUNCTION_SINGLE) &&(G_DisplayMode == K_DisplayModeOsdOff))
	if (G_DisplayMode == K_DisplayModeOsdOff)
	{UI_SelfTimerLed(1);
     	//L2_ScaleDownImage(G_RawImageBufAddr, G_Hsize , G_Vsize , K_SDRAM_GeneralBufAddr, G_DSPHsize,G_DSPVsize, K_SDRAM_TemporaryBufAddr);
     	L2_ScaleDownImage(G_RawImageBufAddr, G_Hsize , G_Vsize , K_SDRAM_ImageCaptureDisplayBufAddr, G_DSPHsize,G_DSPVsize, K_SDRAM_ImageCaptureGeneralBufAddr);

     	L1_InitPlayback();
     	L2_SetBFBSize(G_DSPHsize,G_DSPVsize);
     	//L2_SetBFBAddr(K_SDRAM_GeneralBufAddr);
	L2_SetBFBAddr(K_SDRAM_ImageCaptureDisplayBufAddr);
     	L2_TurnOnOffDisplay(1);
	 	DELAY_1s();//UI_Buzzer();UI_Buzzer();
     	L2_TurnOnOffDisplay(0);
     	UI_SelfTimerLed(0);
	}
	*///hx@2003.5.31 add for mito  end

	///////  RESOLUTION 640X480 / 320X240  ///////
        if(G_CameraOptions.ImageSize == K_UIOPTION_IMGSIZE_MIDDLE)
        {

⌨️ 快捷键说明

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