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

📄 high_api.c

📁 VC0558 BackEnd IC Program
💻 C
📖 第 1 页 / 共 5 页
字号:
		Framebuf: the head point of frame buffer
		Thumbuf: the head point of thumbnail buffer(should be 4k)
	Note:
	       Before capture a still, the V558 should be in preview mode

	Remarks:
		Please refer to USER558_SetCaptureParameter() for capture resolution
		Please refer to USER558_MultiShot_SetWidth() for capture resolution		

*********************************************************************************/
void USER558_CaptureThumbStill(UINT8* Framebuf, UINT8* Thumbuf,USER558_CallBack pUCallBack)
{
	V558_JPEGBUF g_buf;

	g_MutiShot_OneFrame=0;
	gUSER_CallBack=pUCallBack;
	g_MutiShot_pTHUMB=Thumbuf;
 	g_buf.pData=(gUSER_CallBack)(FIFO_INIT,0,0);
	g_buf.ActLen = 0;
	g_buf.Len = 0x8000;
	g_buf.pData =Framebuf;
	V558_CaptureStillThumb(&g_buf, JpegNote);
	g_558_WorkStatus=STATE558_Capture;
}

/********************************************************************************

	Description:
		Change the width of  thum image.
		And the width:hight=4:3
	Parameters:
		width: the width of thum image	
	Note:
	       None

	Remarks:
		state: valid
*********************************************************************************/
void USER558_MultiShot_SetWidth(UINT16 width)
{
	V558_SetThumbWidth(width);
}

/********************************************************************************

	Description:
		Display frame(s) of JPEG

	Parameters:
		VideoBuf: the video buffer.
		buflen: length of video buffer(byte count)		
		frameNumber: how many frames be displayed
		Delay_ms: the delay times(ms) between each frame display.
		Lcd_OffsetX: display offset X on LCD
		Lcd_OffsetY: display offset Y on LCD
		Display_W:   display width on LCD
		Display_H:    display hight on LCD
	Note:
	 	if VideoBuf==0&&buflen=00; it will play the video as the last time's recorder.
	 	
	return:
		the end buffer point after display the frame(s)
		
*********************************************************************************/
UINT8* USER558_DisplayVideo(UINT8* VideoBuf , UINT32 buflen, UINT32 frameNumber, UINT32 Delay_ms,UINT16 Lcd_OffsetX, UINT16 Lcd_OffsetY, UINT16 Display_W, UINT16 Display_H)
{
	UINT16 temp;
	V558_JPEGBUF decBuf;
	V558_JPEG_INDEX info;
	V558_LAYER_PROPERTY proty;	
    	V558_LcdALEnable();
	proty.Size.cx = Display_W;
	proty.Size.cy = Display_H;
	proty.DisRect.left = 0;
	proty.DisRect.top = 0;
	proty.DisRect.width = Display_W;
	proty.DisRect.height =Display_H;
	proty.DisPoint.x = Lcd_OffsetX;	
	proty.DisPoint.y = Lcd_OffsetY;

	decBuf.pData = VideoBuf;
	decBuf.Len = 0x8000;
	decBuf.ActLen = buflen;
	if(VideoBuf==0)
			decBuf.pData = g_VideoBUF;
	if(buflen==0)
			decBuf.ActLen = g_VideoLength;
	if((decBuf.pData==0)||(decBuf.ActLen==0))
			return 0;	
	
	 g_558_WorkStatus=STATE558_Display;
	 while(frameNumber)
	 {
		if((V558_JpegParse(&decBuf, &info) == 0)&&(g_558_WorkStatus==STATE558_Display))
		{
 			temp = 0x5000;
 			V558_SetReg(V558_REG_LCD_IST, 0);
			V558_DisplayStill(&decBuf, &info, &proty);
		}
		else
		{
			if(g_558_WorkStatus==STATE558_Display)
			{
				g_VideoBUF=0;
				g_VideoLength=0;
			}
			return 0;
		}
			//break;
		decBuf.ActLen -= info.endpos;
		decBuf.pData += info.endpos;	
		if(--frameNumber)
			V558_Delay(Delay_ms);	
		while( ((V558_LcdGetInterrupt() & 0x3) == 0) && (temp-- != 0) );

	 }
	 g_558_WorkStatus=STATE558_Idle;
	 g_VideoBUF=decBuf.pData;
	 g_VideoLength=decBuf.ActLen;
	 return g_VideoBUF;
}

/********************************************************************************

	Description:
		Stop(pause) video display

*********************************************************************************/
void USER558_DisplayVideoStop(void)
{
	g_558_WorkStatus=STATE558_Idle;
}

/********************************************************************************

	Description:
		The image in LCD will  Rotate  with the function.

	Parameters:
		mode: Rotation mode

	Note:
	       This function must be used in preview mode
		<TABLE>
		value					meaning
		-----					-------
		0						normal
		1						90 
		2						180
		3						270
		</TABLE>

	Remarks:
		state: invalid

*********************************************************************************/
void USER558_Rotation(UINT8 mode) 
{
	UINT16 lc;
	
	V558_LcdALDisable();
	V558_LcdDispDisable();
   	switch(mode)
   	{
   	case 0:   		
 		ChangIppDisplay(g_Preview_Para.Display_W,g_Preview_Para.Display_H);
   		V558_LcdSetDispMode(4);

   		lc=V558_LcdGetIFControl();
   		V558_LcdSetIFControl(lc|0x08);

   		  V558_LcdBLEnable();
   		break;
   	case 1:
   		 V558_LcdBLDisable();
   		if(g_Preview_Para.Display_W>g_Preview_Para.Display_H) 
			ChangIppDisplay(g_Preview_Para.Display_W,g_Preview_Para.Display_W);
   		else
   			ChangIppDisplay(g_Preview_Para.Display_H,g_Preview_Para.Display_H);
   		lc=V558_LcdGetIFControl();
   		V558_LcdSetIFControl(lc&0xfff7);  
  		V558_LcdSetDispMode(0);
   		break;
   	case 2:
   		 V558_LcdBLDisable();
   		ChangIppDisplay(g_Preview_Para.Display_W,g_Preview_Para.Display_H);
   		V558_LcdSetDispMode(2);
   		
   		lc=V558_LcdGetIFControl();
   		V558_LcdSetIFControl(lc|0x08);
   		break;
   	case 3:
   		 V558_LcdBLDisable();
       	if(g_Preview_Para.Display_W>g_Preview_Para.Display_H) 
			ChangIppDisplay(g_Preview_Para.Display_W,g_Preview_Para.Display_W);
   		else
   			ChangIppDisplay(g_Preview_Para.Display_H,g_Preview_Para.Display_H);
              
		 lc= V558_LcdGetIFControl();
   		V558_LcdSetIFControl(lc&0xfff7);  
   		
  		V558_LcdSetDispMode(1);
   		break;
   	default:
   		break;
   	}
		
		V558_LcdDispEnable();
   		V558_LcdALEnable();	
}
/********************************************************************************

	Description:
		flip(vertical mirror) the image from sensor

	Parameters:
		None

	Note:
		

	Remarks:
		state: valid with HYNIX7131GP and OV7649 sensor.

*********************************************************************************/
void USER558_SensorFlip(void)
{
 UINT32 temp1;
 temp1=temp1;
V558_SifDisableSyncGen();
#if(SELECT_HYNIX7131GP_YUV||SELECT_HYNIX7131GP_BAYER)
  DrvGetSnrReg(0x01,&temp1);
  if(temp1&0x04) temp1&=0xFB;
  else temp1|=0x04;
  DrvSetSnrReg(0x01,temp1); 
 #endif
#if(SELECT_OV_7649_YUV||SELECT_OV_7649_BAYER)
  DrvGetSnrReg(0x75,&temp1);
  if(temp1&0x80) temp1&=0x7f;
  else temp1|=0x80;
  DrvSetSnrReg(0x75,temp1); 
 #endif
 V558_SifEnableSyncGen();
}
/********************************************************************************

	Description:
		mirror(horizontal) the image from sensor

	Parameters:
		None

	Note:
		

	Remarks:
		state: valid with HYNIX7131GP and OV7649 sensor.

*********************************************************************************/
void USER558_SensorMirror(void)
{
 UINT32 temp1;
 temp1=temp1;
V558_SifDisableSyncGen();
#if(SELECT_HYNIX7131GP_YUV||SELECT_HYNIX7131GP_BAYER)
  DrvGetSnrReg(0x01,&temp1);
  if(temp1&0x08) temp1&=0xF7;
  else temp1|=0x08;
  DrvSetSnrReg(0x01,temp1); 
 #endif
#if(SELECT_OV_7649_YUV||SELECT_OV_7649_BAYER)
   DrvGetSnrReg(0x12,&temp1);
  if(temp1&0x40) temp1&=0xbf;
  else temp1|=0x40;
  DrvSetSnrReg(0x12,temp1);
 #endif
  V558_SifEnableSyncGen();
}
/********************************************************************************

	Description:
		Set special effect

	Parameters:
		Mode: Set Special Effect mode

	Note:
	       This function must be used in viewfiner situation
		<TABLE>
		value					meaning
		-----					-------
		0                                       special effect disable;
		1                                       sephia-moonlight;
		2                                       Sephia-old;
		3  					     Monochrome;
		4					     Negative;

		</TABLE>

	Remarks:
		state: valid

*********************************************************************************/
void USER558_Set_Special_Effect(UINT8 Mode)
{
	switch(Mode)
	{
	case 1://seh1
		V558_IppSetUoffset(108);
		V558_IppSetVoffset(158);
		V558_IppSetSpeCtrl(0x01);
		break;
	case 2://seh2
		V558_IppSetUoffset(0x80);
		V558_IppSetVoffset(0x40);
		V558_IppSetSpeCtrl(0x01);
		break;
	case 3://color range
		V558_IppSetUTopThrd(0x40);
		V558_IppSetUBottomThrd(0xc0);
		V558_IppSetVTopThrd(0x00);
		V558_IppSetVBottomThrd(0x20);		
		V558_IppSetSpeCtrl(0x03);
		break;
	case 4://nagative
		V558_IppSetSpeCtrl(0x05);
		break;
	case 0:
		V558_IppDisableSpecial();
		break;
	default:
		break;
	}
}

/********************************************************************************

	Description:
		Set the value of color range  (special effect)

	Parameters:
		UStart: U start value
		UStop: U stop value
		VStart: V Start  value
		VStop: V Stop value

	Remarks:
		state: valid

*********************************************************************************/

void USER558_Set_ColorRange(UINT8	UStart,UINT8 UStop,UINT8 VStart,UINT8 VStop)
{
		V558_IppSetUTopThrd(UStart);
		V558_IppSetUBottomThrd(UStop);
		V558_IppSetVTopThrd(VStart);
		V558_IppSetVBottomThrd(VStop);
		V558_IppSetSpeCtrl(0x03);
}
/********************************************************************************

	Description:
		The image in LCD will be mirrored  by using the function(A&B).

	Parameters:
		mode: Mirror mode

	Note:
	       This function must be used in preview mode
		<TABLE>
		value					meaning
		-----					-------
		0					      normal;
		1					     horizontal mirror;
		2					     vertical mirror.
		</TABLE>

	Remarks:
		state: invalid

*********************************************************************************/
void USER558_Mirror(UINT8 mode)
{
	V558_LcdDispDisable();
	switch(mode)
		{
		case 0:
			 V558_LcdBLEnable();
	          	V558_LcdSetDispMode(4);
	     		 break;	      
	       case 1:
	            V558_LcdBLDisable();
	      	     V558_LcdSetDispMode(3);
	     		break;	      
	      case 2:
	      	       V558_LcdBLDisable();
			 V558_LcdSetDispMode(5);
	       	break;	      
	      default:
   			break;
		}
	V558_LcdDispEnable();
}



/********************************************************************************

 Description:
  	Get the valid zoom steps( USER558_PreviewZoom() )

 Parameters:
  	mode: 0:zoom in .1:zoom out

Return:
	The total valid zoom steps(please refer the 'step' parameter in USER558_PreviewZoom() )
UINT16 USER558_PreviewZoom(UINT8 mode,UINT16 step,UINT16 x,UINT16 y) )

 Remarks:
  	state: valid

*********************************************************************************/
UINT16  USER558_GetPreviewZoomSteps(UINT8 mode)
{
 	UINT16 DeWith,devisor,temp;
 	UINT16 XRatio, YRatio;
 	V558_SIZE Size,DisSize,CapSize;

  	V558_IppGetSizerSize(&Size);
  	V558_IppGetDispSize(&DisSize);
	V558_IppGetCapSize(&CapSize);

  	devisor=Find_common_divisor(g_Preview_Para.Source_W,g_Preview_Para.Source_H);

  	XRatio=g_Preview_Para.Source_W/devisor;
  	YRatio=g_Preview_Para.Source_H/devisor;  
	if(XRatio==0) return 0;
		
 	if(!mode)
 	{	
 		if(Size.cx<=CapSize.cx) return 0;
 		DeWith=Size.cx-CapSize.cx;
 		
 	}
 	else
 	{
 		if(g_Preview_Para.Source_W<=Size.cx) return 0;
 		DeWith=g_Preview_Para.Source_W-Size.cx;		
 	}
 	temp=(DeWith/XRatio)/ZOOMPIXEL;
  		
	return temp;
}
/********************************************************************************
 Description:
  	set 558 Previw Zoom 

 Parameters:
  	mode: 0:zoom in .1:zoom out
  	step: zoom steps;
  	x: offset x in zoom image;if x=0xffff and y=0xffff than auto find the middle
  	y: offset y in zoom image;

  return: 
  	With current zoom parameter, how many times this function can be called valid
  	(otherwise it will have no effect)
  	if return 0xffff, means zoom failure

 Note:
 	step:1-5
       Capture(still/video) will be zoomed also.
       this function only valid with preview on.
 Remarks:
  	state: valid

*********************************************************************************/
UINT16 USER558_PreviewZoom(UINT8 mode,UINT16 step,UINT16 x,UINT16 y)
{
 	UINT16 DeWith,Dehigh,devisor;
 	UINT16 XRatio, YRatio, ZoomTime;
 	V558_SIZE Size,DisSize,CapSize;
 	V558_POINT StartPoint;
//ZoomTime=USER558_GetZoomSteps(mode);
  	V558_IppGetSizerSize(&Size);
  	V558_IppGetDispSize(&DisSize);
	V558_IppGetCapSize(&CapSize);

  	devisor=Find_common_divisor(g_Preview_Para.Source_W,g_Preview_Para.Source_H);


  	XRatio=g_Preview_Para.Source_W/devisor;
  	YRatio=g_Preview_Para.Source_H/devisor;  
  	DeWith=XRatio*ZOOMPIXEL*step;
  	Dehigh=YRatio*ZOOMPIXEL*step;
  	if(DeWith==0)  return 0xffff;
 	StartPoint.x=x;
 	StartPoint.y=y;	

⌨️ 快捷键说明

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