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

📄 post.c

📁 三星s3c2460开发板完整功能测试代码
💻 C
📖 第 1 页 / 共 4 页
字号:
			case 'j':
				DstStartX-=8;
				if(DstStartX<0)
					DstStartX=0;
				break;	 				
			case '\r':
				return;
			default:
				break;
		}		
		printf("[SW,SH,DW,DH] = [0x%x, 0x%x, 0x%x, 0x%x]\n", SrcWidth, SrcHeight, DstWidth, DstHeight);
		printf("[SX,SY,DX,DY] = [0x%x, 0x%x, 0x%x, 0x%x]\n", SrcStartX, SrcStartY, DstStartX, DstStartY);
		PostInit((unsigned int)OrgSrcWidth, (unsigned int)OrgSrcHeight, (unsigned int)SrcWidth, (unsigned int)SrcHeight, (unsigned int)SrcStartX, (unsigned int)SrcStartY, 
				(unsigned int)OrgDstWidth, (unsigned int)OrgDstHeight, (unsigned int)DstWidth, (unsigned int)DstHeight, (unsigned int)DstStartX, (unsigned int)DstStartY, 
				InFrameBuffer, OutFrameBuffer, mode);		
		PostStartProcessing(0);
		while(!postProcessingDone);
		postProcessingDone=0;//redundant;
	}

	rINTSUBMSK2 |= BIT_SUB_POST;
	rINTMSK |= BIT_CAMIF_BLOCK_POST;

	
}

void Test_Post_RGB_RGB_PQVGA(void)
{

	unsigned int i,j,k;
	unsigned int OrgSrcWidth, OrgSrcHeight, SrcWidth, SrcHeight, SrcStartX, SrcStartY;
	unsigned int OrgDstWidth, OrgDstHeight, DstWidth, DstHeight, DstStartX, DstStartY;
	unsigned int InFrameBuffer, OutFrameBuffer;
	unsigned int mode;
	
	unsigned int temp;

	unsigned int *postframebuffer;
	unsigned int *lcdframebuffer;

	OrgSrcWidth=SrcWidth=PQVGA_XSIZE; //no source offset
	OrgSrcHeight=SrcHeight=PQVGA_YSIZE; //no source offset
	SrcStartX=SrcStartY=0;
	OrgDstWidth=DstWidth=PQVGA_XSIZE; //no destination offset
	OrgDstHeight=DstHeight=PQVGA_YSIZE; //no destination offset
	DstStartX=DstStartY=0;
	InFrameBuffer=downloadAddress;
	OutFrameBuffer=LCDFRAMEBUFFERBG1;

	mode=0;
	
	k=0;
	temp=0;

	postframebuffer=(unsigned int *)downloadAddress;
	lcdframebuffer=(unsigned int *)LCDFRAMEBUFFERBG1;
	printf("Select Input format of Post Processor\n");
	printf("0:16bpp, 1:24bpp\n");
	i=GetIntNum();
	switch(i) {
		case 0:			
			mode|=POST_IN_RGB16B;
			for(j=0; j<PQVGA_YSIZE; j++)
				for(i=0; i<PQVGA_XSIZE; i+=2) {
					*(lcdframebuffer++)=*(postframebuffer++);
				}
			LcdBGInit(MODE_PAR_16BIT565_240320|MODE_NO_VIRTUAL_16B);				
			break;
		case 1:			
			mode|=POST_IN_RGB24B;
			for(j=0; j<PQVGA_YSIZE; j++)				
				for(i=0; i<PQVGA_XSIZE; i++) {
					*(lcdframebuffer++)=*(postframebuffer++);
				}	
			LcdBGInit(MODE_PAR_24BIT_240320|MODE_NO_VIRTUAL_24B);				
			break;
		default:				
			mode|=POST_IN_RGB16B;
			for(j=0; j<PQVGA_YSIZE; j++)
				for(i=0; i<PQVGA_XSIZE; i+=2) {
					*(lcdframebuffer++)=*(postframebuffer++);
				}
			LcdBGInit(MODE_PAR_16BIT565_240320|MODE_NO_VIRTUAL_16B);				
			break;
	}	

	
	LcdEnvidOnOffDirect(1);
	printf("Original Image before post processing!!!!\n");
	printf("Press any key to process POST\n");
	getchar();
	LcdEnvidOnOffDirect(0);
	
	//mode=POST_IN_YCBYCR420|POST_OUT_RGB16B;
	
	//LCD Initialization 
	//LcdBGInit(MODE_PAR_16BIT565_240320|MODE_NO_VIRTUAL_16B);	

	printf("Select Output format of Post Processor\n");
	printf("0:RG16, 1:RGB24\n");
	i=GetIntNum();
	switch(i) {
		case 0:
			mode|=POST_OUT_RGB16B;
			LcdBGInit(MODE_PAR_16BIT565_240320|MODE_NO_VIRTUAL_16B);
			break;
		case 1:
			mode|=POST_OUT_RGB24B;
			LcdBGInit(MODE_PAR_24BIT_240320|MODE_NO_VIRTUAL_24B);
			break;
		default:			
			mode|=POST_OUT_RGB16B;
			LcdBGInit(MODE_PAR_16BIT565_240320|MODE_NO_VIRTUAL_16B);
			break;
	}


	PostInit(OrgSrcWidth, OrgSrcHeight, SrcWidth, SrcHeight, SrcStartX, SrcStartY, 
			OrgDstWidth, OrgDstHeight, DstWidth, DstHeight, DstStartX, DstStartY, 
			InFrameBuffer, OutFrameBuffer, mode);

	pISR_CAMIF_BLOCK_POST=(unsigned)PostIsr;
	rINTMSK &= ~(BIT_CAMIF_BLOCK_POST);
	rINTSUBMSK2 &= ~(BIT_SUB_POST);

	printf("rMODE:0x%x\n", rMODE);

#if 1
	PostStartProcessing(0);
#else
	if(mode&POST_IN_YCBYCR420)
		amount=OrgSrcWidth*OrgSrcHeight*3/2;

	if(mode&POST_OUT_RGB16B)
		amount+=OrgDstWidth*OrgDstHeight*2;
	else if(mode&POST_OUT_RGB24B)
		amount+=OrgDstWidth*OrgDstHeight*4;
	PostStartProcessing(amount, 0);
#endif

	while(!postProcessingDone); //waiting for post-processing done 
	postProcessingDone=0;

	LcdEnvidOnOffDirect(1); //LCD Envid On
	printf("Processed Image!!!\n");
	printf("Press any key to continue\n");
	getchar();
	LcdEnvidOnOffDirect(0); //LCD Envid Off	

	rINTSUBMSK2 |= BIT_SUB_POST;
	rINTMSK |= BIT_CAMIF_BLOCK_POST;
	
}
*/



void Test_Post_Allfunc(void)
{
	int OrgSrcWidth, OrgSrcHeight, SrcWidth, SrcHeight, SrcStartX, SrcStartY;
	int OrgDstWidth, OrgDstHeight, DstWidth, DstHeight, DstStartX, DstStartY;
	unsigned int InFrameBuffer, OutFrameBuffer;
	unsigned int mode;
	unsigned int i;

	printf("Select size of INPUT image \n0:PQVGA, 1:CIF, 2:QCIF(D) ->");
	i=GetIntNum();
	if (i==0) {
		OrgSrcWidth=PQVGA_XSIZE;
		OrgSrcHeight=PQVGA_YSIZE;
	}
	else if (i==1) {
		OrgSrcWidth=CIF_XSIZE;
		OrgSrcHeight=CIF_YSIZE;
	}
	else {
		OrgSrcWidth=QCIF_XSIZE;
		OrgSrcHeight=QCIF_YSIZE;
	}

	mode=0;
	printf("Select Input format of Post Processor\n");
	printf("0:YCBYCR420(D), 1:YCBYCR422, 2:CBYCRY422, 3:16BPP RGB, 4:24BPP RGB ->");
	i=GetIntNum();
	if (i==1) 	mode|=POST_IN_YCBYCR422;
	else if (i==2) mode|=POST_IN_CBYCRY422;
	else if (i==3) mode|=POST_IN_RGB16B;
	else if (i==4) mode|=POST_IN_RGB24B;
	else mode|=POST_IN_YCBYCR420;

	printf("Select size of OUTPUT image\n0:PQVGA(D), 1:CIF, 2:QCIF ->");
	i=GetIntNum();
	if(i==1) {
		DstWidth=CIF_XSIZE;
		DstHeight=CIF_YSIZE;
	}
	else if(i==2) {
		DstWidth=QCIF_XSIZE;
		DstHeight=QCIF_YSIZE;
	}
	else {
		DstWidth=PQVGA_XSIZE;
		DstHeight=PQVGA_YSIZE;
	}
	OrgDstWidth=PQVGA_XSIZE;
	OrgDstHeight=PQVGA_YSIZE;

	printf("Select bpp of OUTPUT image\n0:16BPP SLCD(D), 1:24BPP SLCD, 2:16BPP PLCD, 3:24BPP PLCD ->");
	i=GetIntNum();
	if(i==1) {
		Init_240X320_AMLCD();
		mode|=POST_OUT_RGB24B;
		LcdBGInit(MODE_SER_24BIT_240320|MODE_NO_VIRTUAL_24B);
		GlibInit(MODE_SER_24BIT_240320|MODE_NO_VIRTUAL_24B, BGBUFFER1);
		GlibClearScr(0); // Fill the LCD panel with Black Color
		GlibFilledRectangle(0, 0, BG_XSIZE_240320/2-1, BG_YSIZE_240320/2-1, 0xfc0000); //red
		GlibFilledRectangle(BG_XSIZE_240320/2, 0, BG_XSIZE_240320-1, BG_YSIZE_240320/2-1, 0xfc00);//green
		GlibFilledRectangle(0, BG_YSIZE_240320/2, BG_XSIZE_240320/2-1, BG_YSIZE_240320-1,0xfc);//blue
		GlibFilledRectangle(BG_XSIZE_240320/2, BG_YSIZE_240320/2, BG_XSIZE_240320-1, BG_YSIZE_240320-1,0xfcfcfc);//white	
	}
	else if(i==2) {
		mode|=POST_OUT_RGB24B;
		LcdBGInit(MODE_PAR_16BIT565_240320|MODE_NO_VIRTUAL_16B);
		GlibInit(MODE_SER_16BIT565_240320|MODE_NO_VIRTUAL_16B, BGBUFFER1);
		GlibClearScr(0); // Fill the LCD panel with Black Color
		GlibFilledRectangle(0, 0, BG_XSIZE_240320/2-1, BG_YSIZE_240320/2-1, 0xf800); //red
		GlibFilledRectangle(BG_XSIZE_240320/2, 0, BG_XSIZE_240320-1, BG_YSIZE_240320/2-1, 0x7e0);//green
		GlibFilledRectangle(0, BG_YSIZE_240320/2, BG_XSIZE_240320/2-1, BG_YSIZE_240320-1,0x1f);//blue
		GlibFilledRectangle(BG_XSIZE_240320/2, BG_YSIZE_240320/2, BG_XSIZE_240320-1, BG_YSIZE_240320-1,0xffff);//white	
	}
	else if(i==3) {
		mode|=POST_OUT_RGB24B;
		LcdBGInit(MODE_PAR_24BIT_240320|MODE_NO_VIRTUAL_24B);
		GlibInit(MODE_PAR_24BIT_240320|MODE_NO_VIRTUAL_24B, BGBUFFER1);
		GlibClearScr(0); // Fill the LCD panel with Black Color
		GlibFilledRectangle(0, 0, BG_XSIZE_240320/2-1, BG_YSIZE_240320/2-1, 0xfc0000); //red
		GlibFilledRectangle(BG_XSIZE_240320/2, 0, BG_XSIZE_240320-1, BG_YSIZE_240320/2-1, 0xfc00);//green
		GlibFilledRectangle(0, BG_YSIZE_240320/2, BG_XSIZE_240320/2-1, BG_YSIZE_240320-1,0xfc);//blue
		GlibFilledRectangle(BG_XSIZE_240320/2, BG_YSIZE_240320/2, BG_XSIZE_240320-1, BG_YSIZE_240320-1,0xfcfcfc);//white	
	}
	else {
		Init_240X320_AMLCD();
		mode|=POST_OUT_RGB16B;
		LcdBGInit(MODE_SER_16BIT565_240320|MODE_NO_VIRTUAL_16B);
		GlibInit(MODE_SER_16BIT565_240320|MODE_NO_VIRTUAL_16B, BGBUFFER1);
		GlibClearScr(0); // Fill the LCD panel with Black Color
		GlibFilledRectangle(0, 0, BG_XSIZE_240320/2-1, BG_YSIZE_240320/2-1, 0xf800); //red
		GlibFilledRectangle(BG_XSIZE_240320/2, 0, BG_XSIZE_240320-1, BG_YSIZE_240320/2-1, 0x7e0);//green
		GlibFilledRectangle(0, BG_YSIZE_240320/2, BG_XSIZE_240320/2-1, BG_YSIZE_240320-1,0x1f);//blue
		GlibFilledRectangle(BG_XSIZE_240320/2, BG_YSIZE_240320/2, BG_XSIZE_240320-1, BG_YSIZE_240320-1,0xffff);//white	
	}

	LcdEnvidOnOff(1); //LCD Envid On
	getchar();		
	LcdEnvidOnOff(0); //LCD Envid On
	
	SrcWidth=OrgSrcWidth;
	SrcHeight=OrgSrcHeight;
	SrcStartX=SrcStartY=0;
	DstStartX=DstStartY=0;
	InFrameBuffer=downloadAddress;
	OutFrameBuffer=LCDFRAMEBUFFERBG1;
	

	PostInit(OrgSrcWidth, OrgSrcHeight, SrcWidth, SrcHeight, SrcStartX, SrcStartY, 
			OrgDstWidth, OrgDstHeight, DstWidth, DstHeight, DstStartX, DstStartY, 
			InFrameBuffer, OutFrameBuffer, mode);

	pISR_CAMIF_BLOCK_POST=(unsigned)PostIsr;
	rINTMSK &= ~(BIT_CAMIF_BLOCK_POST);
	rINTSUBMSK2 &= ~(BIT_SUB_POST);

	PostStartProcessing(0);

	while(!postProcessingDone); //waiting for post-processing done 
	postProcessingDone=0;
	
	LcdEnvidOnOff(1); //LCD Envid On

	printf("Test of Zoom In/Out, PIP Operation\n");
	printf("w.z.s.a for Zoom in/out\n");	
	printf("r.c.f.d for Coordination of zoomed image\n");
	printf("y.b.h.g for PIP\n");	
	printf("i.m.k.j for Coordination of PIP image\n");

	SrcStartX=SrcStartY=0;
	DstStartX=DstStartY=0;
	while(1) {
		switch(getchar()) {
		// Zoom in/out
			case 'w':
				SrcHeight+=8;
				if(SrcHeight>OrgSrcHeight)
					SrcHeight=OrgSrcHeight;
				break;
			case 'z':
				SrcHeight-=8;
				if(SrcHeight<8)
					SrcHeight=8;
				break;
			case 'a':
				SrcWidth+=8;
				if(SrcWidth>OrgSrcWidth)
					SrcWidth=OrgSrcWidth;
				break;
			case 's':
				SrcWidth-=8;
				if(SrcWidth<8)
					SrcWidth=8;
				break;
		// Coordination of zoomed image
			case 'r':
				SrcStartY+=8;
				if((SrcStartY-1)>(OrgSrcHeight-SrcHeight))
					SrcStartY=OrgSrcHeight-SrcHeight;
				break;
			case 'c':
				SrcStartY-=8;
				if(SrcStartY<0)
					SrcStartY=0;
				break;
			case 'f':
				SrcStartX+=8;
				if((SrcStartX-1)>(OrgSrcWidth-SrcWidth))
					SrcStartX=OrgSrcWidth-SrcWidth;
				break;
			case 'd':
				SrcStartX-=8;
				if(SrcStartX<0)
					SrcStartX=0;
				break;				
		// PIP
			case 'b':
				DstHeight+=4;
				if(DstHeight>OrgDstHeight)
					DstHeight=OrgDstHeight;
				break;
			case 'y':
				DstHeight-=4;
				if(DstHeight<12)
					DstHeight=12;
				break;
			case 'h':
				DstWidth+=4;
				if(DstWidth>OrgDstWidth)
					DstWidth=OrgDstWidth;
				break;
			case 'g':
				DstWidth-=4;
				if(DstWidth<12)
					DstWidth=12;
				break;
		// Coordination of PIP
			case 'i':
				DstStartY-=8;
				if(DstStartY<0)
					DstStartY=0;
				break;
			case 'm':
				DstStartY+=8;
				if((DstStartY-1)>(OrgDstHeight-DstHeight))
					DstStartY=OrgDstHeight-DstHeight;
				break;
			case 'k':
				DstStartX+=8;
				if((DstStartX-1)>(OrgDstWidth-DstWidth))
					DstStartX=OrgDstWidth-DstWidth;
				break;
			case 'j':
				DstStartX-=8;
				if(DstStartX<0)
					DstStartX=0;
				break;	 				
			case '\r':
			case ' ':
				return;
			default:
				break;
		}		
		printf("[SW,SH,DW,DH] = [0x%x, 0x%x, 0x%x, 0x%x]\n", SrcWidth, SrcHeight, DstWidth, DstHeight);
		printf("[SX,SY,DX,DY] = [0x%x, 0x%x, 0x%x, 0x%x]\n", SrcStartX, SrcStartY, DstStartX, DstStartY);
		PostInit((unsigned int)OrgSrcWidth, (unsigned int)OrgSrcHeight, (unsigned int)SrcWidth, (unsigned int)SrcHeight, (unsigned int)SrcStartX, (unsigned int)SrcStartY, 
				(unsigned int)OrgDstWidth, (unsigned int)OrgDstHeight, (unsigned int)DstWidth, (unsigned int)DstHeight, (unsigned int)DstStartX, (unsigned int)DstStartY, 
				InFrameBuffer, OutFrameBuffer, mode);		
		GlibClearScr(0); // Fill the LCD panel with Black Color
		PostStartProcessing(0);
		while(!postProcessingDone);
		postProcessingDone=0;//redundant;
	}

	rINTSUBMSK2 |= BIT_SUB_POST;
	rINTMSK |= BIT_CAMIF_BLOCK_POST;

	
}

⌨️ 快捷键说明

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