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

📄 camera.cpp

📁 share-2440 wince5.0 of LCD drivers 源代码
💻 CPP
📖 第 1 页 / 共 3 页
字号:
		case IOCTL_CAM_ENVINT :
			RETAILMSG(MSG_EN_1,(TEXT("CAMERA:IOCTL_CAM_ENVINT\r\n")));
			break;

		case IOCTL_CAM_DISVINT :
			RETAILMSG(MSG_EN_1,(TEXT("CAMERA:IOCTL_CAM_DISVINT\r\n")));
			break;

		case IOCTL_CAM_SETCAMERA :
			RETAILMSG(MSG_EN_1,(TEXT("CAMERA:IOCTL_CAM_SETCAMERA\r\n")));
			
/*
			RETAILMSG(MSG_EN_1,(_T("---------------------------------------\r\n")));
			RETAILMSG(MSG_EN_1,(_T("ImgCptEn_PRSC = %d\r\n"), (s2440CAM->rCIPRSTATUS>>21)&0x1));
			RETAILMSG(MSG_EN_1,(_T("PrScalerStart = %d\r\n"), (s2440CAM->rCIPRSCCTRL>>15)&0x1));
			RETAILMSG(MSG_EN_1,(_T("---------------------------------------\r\n")));
			RETAILMSG(MSG_EN_1,(_T("CoScalerStart  = %d\r\n"), (s2440CAM->rCICOSCCTRL>>15)&0x1));
			RETAILMSG(MSG_EN_1,(_T("VSYNC          = %d\r\n"), (s2440CAM->rCICOSTATUS>>28)&0x1));
			RETAILMSG(MSG_EN_1,(_T("ImgCptEn_Camif = %d\r\n"), (s2440CAM->rCICOSTATUS>>22)&0x1));
			RETAILMSG(MSG_EN_1,(_T("ImgCptEn_CoSC  = %d\r\n"), (s2440CAM->rCICOSTATUS>>21)&0x1));
			RETAILMSG(MSG_EN_1,(_T("VSYNC_A  = %d\r\n"), (s2440CAM->rCICOSTATUS>>20)&0x1));
			RETAILMSG(MSG_EN_1,(_T("VSYNC_B  = %d\r\n"), (s2440CAM->rCICOSTATUS>>19)&0x1));
			RETAILMSG(MSG_EN_1,(_T("---------------------------------------\r\n")));
			RETAILMSG(MSG_EN_1,(_T("ImgCptEn      = %d\r\n"), (s2440CAM->rCIIMGCPT>>31)&0x1));
			RETAILMSG(MSG_EN_1,(_T("ImgCptEn_CoSc = %d\r\n"), (s2440CAM->rCIIMGCPT>>30)&0x1));
			RETAILMSG(MSG_EN_1,(_T("ImgCptEn_PrSc = %d\r\n"), (s2440CAM->rCIIMGCPT>>29)&0x1));
			RETAILMSG(MSG_EN_1,(_T("----------------- %d ----------------------\r\n"), mInitialized));
			SetEvent(CameraEvent);
*/
			break;

		default : 
			RETAILMSG(MSG_EN_1,(TEXT("CAMERA:Ioctl code = 0x%x\r\n"), dwCode));
			return FALSE;

	}
	return TRUE;
} 

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
DWORD CIS_Open(DWORD hDeviceContext, DWORD AccessCode, DWORD ShareMode)
{
	RETAILMSG(1,(TEXT("CAMERA: CIS_Open\r\n")));

      RETAILMSG(1,(TEXT("CAMERA: CIS_Open---------\r\n")));
	  RETAILMSG(1,(TEXT("CAMERA: CIS_Open----------\r\n")));
	  RETAILMSG(1,(TEXT("CAMERA: CIS_Open-----------\r\n")));
	  
	DRIVER_PREVIEW_ENABLE = 2;

	return TRUE;
} 

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
BOOL CIS_Close(DWORD hOpenContext)
{
	RETAILMSG(1,(TEXT("CAMERA: CIS_Close\r\n")));
	return TRUE;
} 

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void CIS_PowerDown(DWORD hDeviceContext)
{
	RETAILMSG(1,(TEXT("CAMERA: CIS_PowerDown\r\n")));

	m_Dx = (_CEDEVICE_POWER_STATE)D4;

	Camif_Capture(CAPTURE_OFF, CAPTURE_OFF);

	CamClockOn(FALSE);

	//RETAILMSG(1,(TEXT("CAMERA: CIS_PowerDown, m_Dx = D%u, init %d \r\n"), m_Dx, mInitialized));
} 

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void CIS_PowerUp(DWORD hDeviceContext)
{
	RETAILMSG(1,(TEXT("CAMERA: CIS_PowerUp\r\n")));
	
	m_Dx = (_CEDEVICE_POWER_STATE)D0;
	
    //
    // 1. Camera IO setup
    //
	CamGpioInit();

	//
    // 2. Camera Clock setup
    //
	CamClockOn(TRUE);

	// 3. Camera i/f reset
    CAM_IF_Reset();

	if (image_size == 1)
		CamInit(QCIF_XSIZE, QCIF_YSIZE, QCIF_XSIZE, QCIF_YSIZE, 112, 20, COPIFRAMEBUFFER_B, COPIFRAMEBUFFER_A);
	else if (image_size == 2)
		CamInit(CIF_XSIZE, CIF_YSIZE, QCIF_XSIZE, QCIF_YSIZE, 112, 20, COPIFRAMEBUFFER_B, COPIFRAMEBUFFER_A);
	
	RETAILMSG(1,(TEXT("CAMERA: CIS_PowerUp, m_Dx = D%u\r\n"), m_Dx));
} 

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
DWORD CIS_Read(DWORD hOpenContext, LPVOID pBuffer, DWORD Count)
{
	RETAILMSG(1,(TEXT("CAMERA: CIS_Read\r\n")));
	return TRUE;
} 

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
DWORD CIS_Seek(DWORD hOpenContext, long Amount, DWORD Type)
{
	RETAILMSG(1,(TEXT("CAMERA: CIS_Seek\r\n")));
	return 0;
} 

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
DWORD CIS_Write(DWORD hOpenContext, LPCVOID pSourceBytes, DWORD NumberOfBytes)
{
	RETAILMSG(1,(TEXT("CAMERA: CIS_Write\r\n")));
	return 0;
}

// for MPEG4
void Copy_Cam_Image(U8 *pBufOut, U32 size_x, U32 size_y, U8 port)
{
	U8 *buffer_y, *buffer_cb, *buffer_cr;
	U32 Y_size, C_size, P_size;
	int temp;
	U8 *pImage;
	static unsigned int frame_timestamp_prev = GetTickCount();
	static int frame_bank_prev = -1;
	YUVINFO yuvinfo;

	RETAILMSG(MSG_EN_1,(_T("Copy_Cam_Image\r\n")));

	//s2440IOP->rGPFDAT &= ~(1<<6);	

	pImage = pBufOut;

	if (image_size == 1) // QCIF	
		Y_size = QCIF_XSIZE*QCIF_YSIZE;
	else if (image_size == 2) // CIF
		Y_size = CIF_XSIZE*CIF_YSIZE;
			
	C_size = Y_size/4;	
	P_size = Y_size + C_size*2;

	{
		temp = (s2440CAM->rCICOSTATUS>>26)&3;
		temp = (temp + 2) % 4;

		RETAILMSG(MSG_EN_1,(_T("Copy_Cam_Image %d\r\n"), temp));

		switch (temp)
		{
		case 0:
			buffer_y = (U8 *)s2440CAM->rCICOYSA1;
			buffer_cb = (U8 *)s2440CAM->rCICOCBSA1;
			buffer_cr = (U8 *)s2440CAM->rCICOCRSA1;
			break;
		case 1:
			buffer_y = (U8 *)s2440CAM->rCICOYSA2;
			buffer_cb = (U8 *)s2440CAM->rCICOCBSA2;
			buffer_cr = (U8 *)s2440CAM->rCICOCRSA2;
			break;
		case 2:
			buffer_y = (U8 *)s2440CAM->rCICOYSA3;
			buffer_cb = (U8 *)s2440CAM->rCICOCBSA3;
			buffer_cr = (U8 *)s2440CAM->rCICOCRSA3;
			break;
		case 3:
			buffer_y = (U8 *)s2440CAM->rCICOYSA4;
			buffer_cb = (U8 *)s2440CAM->rCICOCBSA4;
			buffer_cr = (U8 *)s2440CAM->rCICOCRSA4;
			break;
		default :
			buffer_y = (U8 *)s2440CAM->rCICOYSA1;
			buffer_cb = (U8 *)s2440CAM->rCICOCBSA1;
			buffer_cr = (U8 *)s2440CAM->rCICOCRSA1;
			break;
		}
	} 		

#if (DOTNET_DRIVER)
	SetKMode(TRUE);
#endif	

	buffer_y += VIRTUAL_ADDR_OFFSET;
	buffer_cb += VIRTUAL_ADDR_OFFSET;
	buffer_cr += VIRTUAL_ADDR_OFFSET;

	RETAILMSG(MSG_EN_1,(_T("buffer_y = 0x%x\r\n"), buffer_y));
	RETAILMSG(MSG_EN_1,(_T("buffer_cb = 0x%x\r\n"), buffer_cb));
	RETAILMSG(MSG_EN_1,(_T("buffer_cr = 0x%x\r\n"), buffer_cr));

	if (image_size == 1) // QCIF	
	{
		yuvinfo.frame_width = QCIF_XSIZE;
		yuvinfo.frame_height = QCIF_YSIZE;
	}
	else if (image_size == 2) // CIF	
	{
		yuvinfo.frame_width = CIF_XSIZE;
		yuvinfo.frame_height = CIF_YSIZE;
	}
	
	if (temp == frame_bank_prev) yuvinfo.frame_stamp = frame_timestamp_prev;
	else 
	{
		yuvinfo.frame_stamp = GetTickCount();
		frame_timestamp_prev = yuvinfo.frame_stamp;
		frame_bank_prev = temp;
	}

	RETAILMSG(MSG_EN_1,(_T("pBufOut 0 offset = 0x%x\r\n"), pImage));
	memcpy(pImage, &yuvinfo, sizeof(YUVINFO));
	pImage += sizeof(YUVINFO);	
	
	RETAILMSG(MSG_EN_1,(_T("pBufOut Y = 0x%x\r\n"), pImage));
	memcpy(pImage, buffer_y, Y_size);
	pImage += (Y_size);
	
	RETAILMSG(MSG_EN_1,(_T("pBufOut cb = 0x%x\r\n"), pImage));
	memcpy(pImage, buffer_cb, C_size);
	pImage += C_size;
	RETAILMSG(MSG_EN_1,(_T("pBufOut cr = 0x%x\r\n"), pImage));
	memcpy(pImage, buffer_cr, C_size);
//	pBufOut += (size_x*size_y)/4;


#if (DOTNET_DRIVER)
	SetKMode(FALSE);
#endif	


//	RETAILMSG(MSG_EN_1,(TEXT("1:buffer_y:0x%x,buffer_cb:0x%x,buffer_cr:0x%x\r\n"),buffer_y,buffer_cb,buffer_cr));

	//s2440IOP->rGPFDAT |= (1<<6);	
	
	Tick_COPY_FRAME = GetTickCount();

	RETAILMSG(MSG_EN_1,(_T("COPY_Tick = %d\r\n"), (Tick_COPY_FRAME-Tick_GET_FRAME_CUR)));
	RETAILMSG(MSG_EN_1,(_T("Frame_Tick = %d\r\n"), (Tick_GET_FRAME_CUR-Tick_GET_FRAME_PREV)));
	
//	RETAILMSG(1,(_T("Tick_COPY_FRAME = %d\r\n"), Tick_COPY_FRAME));
//	RETAILMSG(1,(_T("Tick_GET_FRAME_PREV = %d\r\n"), Tick_GET_FRAME_PREV));
//	RETAILMSG(1,(_T("Tick_GET_FRAME_CUR = %d\r\n"), Tick_GET_FRAME_CUR));	


}

void Samsung_camcoder(U8 *pBufOut)
{
	U8 *pImage;
	PINGPONG caminfo;

	pImage = pBufOut;

	if( codec_flag )
	{
		caminfo.flag = 1;
		caminfo.y_address = y_address;
		caminfo.cb_address = cb_address;
		caminfo.cr_address = cr_address;
		
		memcpy(pImage, &caminfo, sizeof(PINGPONG));
		codec_flag = 0;
	}
}

void Samsung_camcoder_pr(U8 *pBufOut)
{
	U8 *pImage;
	PINGPONG_PR prinfo;

	pImage = pBufOut;

	if ( rgb_flag )
	{
		prinfo.flag = 1;
		prinfo.rgb_address = rgb_address;
		memcpy(pImage, &prinfo, sizeof(PINGPONG_PR));
		rgb_flag = 0;
	}	
}

void Buffer_codec_info_update()
{
	U32 Y_size, C_size, P_size;
	int temp;
	unsigned int buffer_y, buffer_cb, buffer_cr;
	
	if ( image_size == 1 )
		Y_size = QCIF_XSIZE*QCIF_YSIZE;
	else if ( image_size == 2 )
		Y_size = CIF_XSIZE*CIF_YSIZE;

	C_size = Y_size/4;	
	P_size = Y_size + C_size*2;

	temp = (s2440CAM->rCICOSTATUS>>26)&3;
	temp = (temp + 2) % 4;

	RETAILMSG(MSG_EN_2,(_T("codec index = %d, size %d\r\n"), temp, image_size));

	switch (temp)
	{
	case 0:
		buffer_y = s2440CAM->rCICOYSA1;
		buffer_cb = s2440CAM->rCICOCBSA1;
		buffer_cr = s2440CAM->rCICOCRSA1;
		break;
	case 1:
		buffer_y = s2440CAM->rCICOYSA2;
		buffer_cb = s2440CAM->rCICOCBSA2;
		buffer_cr = s2440CAM->rCICOCRSA2;
		break;
	case 2:
		buffer_y = s2440CAM->rCICOYSA3;
		buffer_cb = s2440CAM->rCICOCBSA3;
		buffer_cr = s2440CAM->rCICOCRSA3;
		break;
	case 3:
		buffer_y = s2440CAM->rCICOYSA4;
		buffer_cb = s2440CAM->rCICOCBSA4;
		buffer_cr = s2440CAM->rCICOCRSA4;
		break;
	default :
		buffer_y = s2440CAM->rCICOYSA1;
		buffer_cb = s2440CAM->rCICOCBSA1;
		buffer_cr = s2440CAM->rCICOCRSA1;
		break;
	}

	buffer_y += VIRTUAL_ADDR_OFFSET;
	buffer_cb += VIRTUAL_ADDR_OFFSET;
	buffer_cr += VIRTUAL_ADDR_OFFSET;
#if 0
	RETAILMSG(MSG_EN_1,(_T("buffer_y = 0x%x\r\n"), buffer_y));
	RETAILMSG(MSG_EN_1,(_T("buffer_cb = 0x%x\r\n"), buffer_cb));
	RETAILMSG(MSG_EN_1,(_T("buffer_cr = 0x%x\r\n"), buffer_cr));
#endif
	if( codec_flag )	RETAILMSG(MSG_EN_1,(_T("Buffer is not read\r\n")));
	codec_flag = 1;
	y_address = buffer_y;
	cb_address = buffer_cb;
	cr_address = buffer_cr;
}


void Buffer_preview_info_update()
{
//	U32 Y_size;
	int temp;
	unsigned int buffer_rgb;
	
/*
	if ( image_size == 1 )
		Y_size = QCIF_XSIZE*QCIF_YSIZE;
	else if ( image_size == 2 )
		Y_size = CIF_XSIZE*CIF_YSIZE;
*/

	temp = (s2440CAM->rCIPRSTATUS>>26)&3;
	temp = (temp + 2) % 4;

	RETAILMSG(MSG_EN_2,(_T("preview index = %d, size %d\r\n"), temp, image_size));

	switch (temp)
	{
	case 0:
		buffer_rgb = s2440CAM->rCIPRCLRSA1;
		break;
	case 1:
		buffer_rgb = s2440CAM->rCIPRCLRSA2;
		break;
	case 2:
		buffer_rgb = s2440CAM->rCIPRCLRSA3;
		break;
	case 3:
		buffer_rgb = s2440CAM->rCIPRCLRSA4;
		break;
	default :
		buffer_rgb = s2440CAM->rCIPRCLRSA1;
		break;
	}

	buffer_rgb += VIRTUAL_ADDR_OFFSET;
#if 0
	RETAILMSG(MSG_EN_1,(_T("buffer_rgb = 0x%x\r\n"), buffer_rgb));
#endif
	if( rgb_flag )	RETAILMSG(MSG_EN_1,(_T("Buffer is not read\r\n")));
	rgb_flag = 1;
	rgb_address = buffer_rgb;
}


void CamInit(U32 CoDstWidth, U32 CoDstHeight, U32 PrDstWidth, U32 PrDstHeight, 
			U32 WinHorOffset, U32 WinVerOffset,  U32 CoFrameBuffer, U32 PrFrameBuffer)
{
	U32 WinOfsEn;
	U32 divisor, multiplier;
	U32 MainBurstSizeY, RemainedBurstSizeY, MainBurstSizeC, RemainedBurstSizeC, MainBurstSizeRGB, RemainedBurstSizeRGB;
	U32 H_Shift, V_Shift, PreHorRatio, PreVerRatio, MainHorRatio, MainVerRatio;
	U32 SrcWidth, SrcHeight;
	U32 ScaleUp_H_Co, ScaleUp_V_Co, ScaleUp_H_Pr, ScaleUp_V_Pr;

	//constant for calculating codec dma address
	if(CAM_CODEC_OUTPUT)
		divisor=2; //CCIR-422
	else
		divisor=4; //CCIR-420
		
	//constant for calculating preview dma address
	if(CAM_PVIEW_OUTPUT)
		multiplier=4;
	else
		multiplier=2;
	
	if(WinHorOffset==0 && WinVerOffset==0)
		WinOfsEn=0;
	else
		WinOfsEn=1;

	SrcWidth=CAM_SRC_HSIZE-WinHorOffset*2;
	SrcHeight=CAM_SRC_VSIZE-WinVerOffset*2;

	if(SrcWidth>=CoDstWidth) ScaleUp_H_Co=0; //down
	else ScaleUp_H_Co=1;		//up

	if(SrcHeight>=CoDstHeight) ScaleUp_V_Co=0;
	else ScaleUp_V_Co=1;		

	if(SrcWidth>=PrDstWidth) ScaleUp_H_Pr=0; //down
	else ScaleUp_H_Pr=1;		//up

	if(SrcHeight>=PrDstHeight) ScaleUp_V_Pr=0;
	else ScaleUp_V_Pr=1;		

	////////////////// common control setting
	s2440CAM->rCIGCTRL |= (1<<26)|(0<<27); // inverse PCLK, test pattern
	s2440CAM->rCIWDOFST = (1<<30)|(0xf<<12); // clear overflow 
	s2440CAM->rCIWDOFST = 0;	
	s2440CAM->rCIWDOFST=(WinOfsEn<<31)|(WinHorOffset<<16)|(WinVerOffset);
	s2440CAM->rCISRCFMT=(CAM_ITU601<<31)|(0<<30)|(0<<29)|(CAM_SRC_HSIZE<<16)|(CAM_ORDER_YCBYCR<<14)|(CAM_SRC_VSIZE);
	//s2440CAM->rCISRCFMT=(CAM_ITU656<<31)|(0<<30)|(0<<29)|(CAM_SRC_HSIZE<<16)|(CAM_ORDER_CBYCRY<<14)|(CAM_SRC_VSIZE);

	////////////////// codec port setting
	s2440CAM->rCICOYSA1=CoFrameBuffer;
	s2440CAM->rCICOYSA2=s2440CAM->rCICOYSA1+CoDstWidth*CoDstHeight+2*CoDstWidth*CoDstHeight/divisor;
	s2440CAM->rCICOYSA3=s2440CAM->rCICOYSA2+CoDstWidth*CoDstHeight+2*CoDstWidth*CoDstHeight/divisor;
	s2440CAM->rCICOYSA4=s2440CAM->rCICOYSA3+CoDstWidth*CoDstHeight+2*CoDstWidth*CoDstHeight/divisor;
	
	s2440CAM->rCICOCBSA1=s2440CAM->rCICOYSA1+CoDstWidth*CoDstHeight;
	s2440CAM->rCICOCBSA2=s2440CAM->rCICOYSA2+CoDstWidth*CoDstHeight;
	s2440CAM->rCICOCBSA3=s2440CAM->rCICOYSA3+CoDstWidth*CoDstHeight;
	s2440CAM->rCICOCBSA4=s2440CAM->rCICOYSA4+CoDstWidth*CoDstHeight;

	s2440CAM->rCICOCRSA1=s2440CAM->rCICOCBSA1+CoDstWidth*CoDstHeight/divisor;
	s2440CAM->rCICOCRSA2=s2440CAM->rCICOCBSA2+CoDstWidth*CoDstHeight/divisor;
	s2440CAM->rCICOCRSA3=s2440CAM->rCICOCBSA3+CoDstWidth*CoDstHeight/divisor;
	s2440CAM->rCICOCRSA4=s2440CAM->rCICOCBSA4+CoDstWidth*CoDstHeight/divisor;
    
	s2440CAM->rCICOTRGFMT=(CAM_CODEC_IN_422<<31)|(CAM_CODEC_OUTPUT<<30)|(CoDstWidth<<16)|(CAM_FLIP_NORMAL<<14)|(CoDstHeight);

	CalculateBurstSize(CoDstWidth, &MainBurstSizeY, &RemainedBurstSizeY);
	CalculateBurstSize(CoDstWidth/2, &MainBurstSizeC, &RemainedBurstSizeC);
	s2440CAM->rCICOCTRL=(MainBurstSizeY<<19)|(RemainedBurstSizeY<<14)|(MainBurstSizeC<<9)|(RemainedBurstSizeC<<4);

	CalculatePrescalerRatioShift(SrcWidth, CoDstWidth, &PreHorRatio, &H_Shift);
	CalculatePrescalerRatioShift(SrcHeight, CoDstHeight, &PreVerRatio, &V_Shift);
	MainHorRatio=(SrcWidth<<8)/(CoDstWidth<<H_Shift);
	MainVerRatio=(SrcHeight<<8)/(CoDstHeight<<V_Shift);
    			
	s2440CAM->rCICOSCPRERATIO=((10-H_Shift-V_Shift)<<28)|(PreHorRatio<<16)|(PreVerRatio);
	s2440CAM->rCICOSCPREDST=((SrcWidth/PreHorRatio)<<16)|(SrcHeight/PreVerRatio); 
	s2440CAM->rCICOSCCTRL=(CAM_SCALER_BYPASS_OFF<<31)|(ScaleUp_H_Co<<30)|(ScaleUp_V_Co<<29)|(MainHorRatio<<16)|(MainVerRatio);

	s2440CAM->rCICOTAREA=CoDstWidth*CoDstHeight;

	///////////////// preview port setting
	s2440CAM->rCIPRCLRSA1=PrFrameBuffer;
	s2440CAM->rCIPRCLRSA2=s2440CAM->rCIPRCLRSA1+PrDstWidth*PrDstHeight*multiplier;
	s2440CAM->rCIPRCLRSA3=s2440CAM->rCIPRCLRSA2+PrDstWidth*PrDstHeight*multiplier;
	s2440CAM->rCIPRCLRSA4=s2440CAM->rCIPRCLRSA3+PrDstWidth*PrDstHeight*multiplier;

	s2440CAM->rCIPRTRGFMT=(PrDstWidth<<16)|(CAM_FLIP_NORMAL<<14)|(PrDstHeight);

	if (CAM_PVIEW_OUTPUT==CAM_RGB24B)
		CalculateBurstSize(PrDstWidth*4, &MainBurstSizeRGB, &RemainedBurstSizeRGB);
	else // RGB16B
		CalculateBurstSize(PrDstWidth*2, &MainBurstSizeRGB, &RemainedBurstSizeRGB);
   	s2440CAM->rCIPRCTRL=(MainBurstSizeRGB<<19)|(RemainedBurstSizeRGB<<14);

	CalculatePrescalerRatioShift(SrcWidth, PrDstWidth, &PreHorRatio, &H_Shift);
	CalculatePrescalerRatioShift(SrcHeight, PrDstHeight, &PreVerRatio, &V_Shift);
	MainHorRatio=(SrcWidth<<8)/(PrDstWidth<<H_Shift);
	MainVerRatio=(SrcHeight<<8)/(PrDstHeight<<V_Shift);
	s2440CAM->rCIPRSCPRERATIO=((10-H_Shift-V_Shift)<<28)|(PreHorRatio<<16)|(PreVerRatio);		 
	s2440CAM->rCIPRSCPREDST=((SrcWidth/PreHorRatio)<<16)|(SrcHeight/PreVerRatio);
	s2440CAM->rCIPRSCCTRL=(1<<31)|(CAM_RGB16B<<30)|(ScaleUp_H_Pr<<29)|(ScaleUp_V_Pr<<28)|(MainHorRatio<<16)|(MainVerRatio);
    
	s2440CAM->rCIPRTAREA= PrDstWidth*PrDstHeight;
}

⌨️ 快捷键说明

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