📄 camera_test.c
字号:
CAMERA_StartPreviewPath();
printf("\nHit any key to stop it!\n");
UART_Getc();
CAMERA_StopPreviewPath();
INTC_Disable(NUM_CAMIF_P);
// LCD Off
LCD_SetAllWinOnOff(0);
LCD_Stop();
}
*/
//////////
// Function Name : CAMERAT_TestPreviewPathToFifoOut_AllParams
// Function Description : Camera Preview Path Test. Basic(No Flip, No output Rotator, No Winoffset, No ScnaLineOffset)
// Test case = 5+4+5 +9 = 23 EA
// Fifo Out mode doesn't support the scan line offset.No Rotation, No Flip in fifo in&fifo out mode.
// Input : None
// Output : None
/*
static void CAMERAT_TestPreviewPathToFifoOut_AllParams(void)
{
u32 uSrcCropIdx;
u32 uImgEffectIdx;
u32 uArbitraryIdx;
u32 uDstIndex;
// 1. Set the case group of the input parameters.
//================================
u32 uSrcCropSzList[5][2] = {{192,260}, {592, 400}, {176, 208}, {160, 320}, {800, 600}};
IMAGE_EFFECT eImgEffectList[6] = {BYPASS, ARBITRARY_CBCR, NEGATIVE, ART_FREEZE, EMBOSSING, SILHOUETTE};
u32 uArbitraryCbCrList[5][2] = {{0, 0}, {128, 128}, {255, 255}, {0, 255}, {255, 0}};
CSPACE eDstFmtArray[9] = {YCBYCR, YCRYCB, CBYCRY, CRYCBY, YC422, YC420, RGB16, RGB18, RGB24};
// 2. Change the case and test all the case
//==================================
eDstDataFmt = RGB24;
for (uSrcCropIdx=0; uSrcCropIdx<5; uSrcCropIdx++) // Test case = 5 EA
{
uSrcCroppedHsz = uSrcCropSzList[uSrcCropIdx][0];
uSrcCroppedVsz = uSrcCropSzList[uSrcCropIdx][1];
printf("\nHit any key to test\n");
UART_Getc();
CAMERAT_TestPreviewPathToFifoOut_Complex();
}
for (uImgEffectIdx=2; uImgEffectIdx<6; uImgEffectIdx++) // Test case = 4 EA
{
eImgEffect = eImgEffectList[uImgEffectIdx];
printf("\nHit any key to test\n");
UART_Getc();
CAMERAT_TestPreviewPathToFifoOut_Complex();
}
eImgEffect = ARBITRARY_CBCR;
for (uArbitraryIdx=0; uArbitraryIdx<5; uArbitraryIdx++) // Test case = 5 EA
{
uArbitraryCbValue = uArbitraryCbCrList[uArbitraryIdx][0];
uArbitraryCrValue = uArbitraryCbCrList[uArbitraryIdx][1];
printf("\nHit any key to test\n");
UART_Getc();
CAMERAT_TestPreviewPathToFifoOut_Complex();
}
eImgEffect = BYPASS;
eRotDeg = ROT_0;
eFlipDir = FLIP_NO;
for ( uDstIndex = 0 ; uDstIndex < 9 ; uDstIndex++)
{
eDstDataFmt = eDstFmtArray[uDstIndex];
printf("\nHit any key to test\n");
UART_Getc();
CAMERAT_TestPreviewPathToFifoOut_Complex();
}
eImgEffect = BYPASS;
eRotDeg = ROT_0;
eFlipDir = FLIP_NO;
}
*/
//////////
// Function Name : CAMERAT_TestCodecPathToFifoOut_Simple
// Function Description : camera input and fifo out test function
// Preveiw->FIFO, the DstFmt = RGB24(fixed)
// For Cam FIFO out, win1 is used for p_path, win2 is used for c_path
// Input : None
// Output : None
/*
static void CAMERAT_TestCodecPathToFifoOut_Simple(void)
{
u32 uLcdHsz, uLcdVsz;
// 1. Initialize interrupt
//================================
INTC_Enable(NUM_CAMIF_C);
INTC_SetVectAddr(NUM_CAMIF_C, Isr_CodecDone);
// 2. Initialize lcd
//========================================
LCD_InitDISPC(eLcdBpp, uLcdFbAddr, WIN2, false);
LCD_GetFrmSz(&uLcdHsz, &uLcdVsz, WIN2);
LCD_InitWinForFifoIn1(IN_CIM, WIN2, LOCALIN_RGB);
LCD_SetWinOnOff(1, WIN2);
LCD_Start();
// 3. Initialize camera and run the process of fifo-input fifo-output p_path
//===============================================
CAMERA_InitSensor();
CAMERA_InitCodecPathToFifoOut(uLcdHsz, uLcdVsz, eLcdBpp);
CAMERA_StartCodecPath(0);
printf("\nHit any key to stop it!\n");
UART_Getc();
CAMERA_StopCodecPath();
INTC_Disable(NUM_CAMIF_C);
// LCD Off
LCD_SetWinOnOff(0, WIN2);
LCD_Stop();
}
*/
//////////
// Function Name : CAMERAT_TestCodecPathToFifoOut_Complex
// Function Description : camera input and fifo out test function
// Fifo out mode doesn't support the scan line offset. No Rotation, No Flip in fifo in&fifo out mode.
// Input : None
// Output : None
/*
static void CAMERAT_TestCodecPathToFifoOut_Complex(void)
{
u32 uLcdHsz, uLcdVsz;
u32 uSrcCropStartX, uSrcCropStartY;
u32 uLCDInputFormat;
// 1. Initialize interrupt
//================================
INTC_Enable(NUM_CAMIF_C);
INTC_SetVectAddr(NUM_CAMIF_C, Isr_CodecDone);
// 2. Initialize lcd
//========================================
if ( eDstDataFmt == RGB16 || eDstDataFmt == RGB18 || eDstDataFmt == RGB24 )
{
uLCDInputFormat = LOCALIN_RGB ;
}
else
{
uLCDInputFormat = LOCALIN_YCbCr;
}
LCD_InitDISPC(eLcdBpp, uLcdFbAddr, WIN2, false);
LCD_GetFrmSz(&uLcdHsz, &uLcdVsz, WIN2);
LCD_InitWinForFifoIn1(IN_CIM, WIN2, (LOCAL_INPUT_COLORSPACE)uLCDInputFormat);
LCD_SetWinOnOff(1, WIN2);
LCD_Start();
// 3. Initialize camera and variables, run the process of fifo-input fifo-output p_path
//==========================================================
uSrcCropStartX = 0, uSrcCropStartY = 0;
CAMERA_InitSensor();
CAMERA_InitCodecPathToFifoOut0(uSrcCropStartX, uSrcCropStartY, uSrcCroppedHsz, uSrcCroppedVsz, uLcdHsz, uLcdVsz, eDstDataFmt);
if (eImgEffect == ARBITRARY_CBCR)
CAMERA_SetArbitraryCbCr( uArbitraryCbValue, uArbitraryCrValue);
else
CAMERA_SetImageEffect(eImgEffect);
CAMERAT_DisplayParam();
CAMERA_StartCodecPath(0);
printf("\nHit any key to stop it!\n");
UART_Getc();
CAMERA_StopCodecPath();
INTC_Disable(NUM_CAMIF_C);
// LCD Off
LCD_SetAllWinOnOff(0);
LCD_Stop();
}
*/
//////////
// Function Name : CAMERAT_TestCodecPathToFifoOut_AllParams
// Function Description : Camera Preview Path Test. Basic(No Flip, No output Rotator, No Winoffset, No ScnaLineOffset)
// Test case = 5+4+5+9 = 23 EA
// Fifo Out mode doesn't support the scan line offset.No Rotation, No Flip in fifo in&fifo out mode.
// Input : None
// Output : None
/*
static void CAMERAT_TestCodecPathToFifoOut_AllParams(void)
{
u32 uSrcCropIdx;
u32 uImgEffectIdx;
u32 uArbitraryIdx;
u32 uDstIndex;
// 1. Set the case group of the input parameters.
//================================
u32 uSrcCropSzList[5][2] = {{320,240}, {560, 400}, {240, 160}, {160, 320}, {800, 600} };
IMAGE_EFFECT eImgEffectList[6] = {BYPASS, ARBITRARY_CBCR, NEGATIVE, ART_FREEZE, EMBOSSING, SILHOUETTE};
u32 uArbitraryCbCrList[5][2] = {{0, 0}, {128, 128}, {255, 255}, {0, 255}, {255, 0}};
CSPACE eDstFmtArray[9] = {YCBYCR, YCRYCB, CBYCRY, CRYCBY, YC422, YC420, RGB16, RGB18, RGB24};
// 3. Change the case and test all the case
//==================================
eDstDataFmt = RGB24;
for (uSrcCropIdx=0; uSrcCropIdx<5; uSrcCropIdx++) // Test case = 5 EA
{
uSrcCroppedHsz = uSrcCropSzList[uSrcCropIdx][0];
uSrcCroppedVsz = uSrcCropSzList[uSrcCropIdx][1];
printf("\nHit any key to test\n");
UART_Getc();
CAMERAT_TestCodecPathToFifoOut_Complex();
}
for (uImgEffectIdx=2; uImgEffectIdx<6; uImgEffectIdx++) // Test case = 4 EA
{
eImgEffect = eImgEffectList[uImgEffectIdx];
printf("\nHit any key to test\n");
UART_Getc();
CAMERAT_TestCodecPathToFifoOut_Complex();
}
eImgEffect = ARBITRARY_CBCR;
for (uArbitraryIdx=0; uArbitraryIdx<5; uArbitraryIdx++) // Test case = 5 EA
{
uArbitraryCbValue = uArbitraryCbCrList[uArbitraryIdx][0];
uArbitraryCrValue = uArbitraryCbCrList[uArbitraryIdx][1];
printf("\nHit any key to test\n");
UART_Getc();
CAMERAT_TestCodecPathToFifoOut_Complex();
}
eImgEffect = BYPASS;
eRotDeg = ROT_0;
eFlipDir = FLIP_NO;
for ( uDstIndex = 0 ; uDstIndex < 9 ; uDstIndex++)
{
eDstDataFmt = eDstFmtArray[uDstIndex];
printf("\nHit any key to test\n");
UART_Getc();
CAMERAT_TestCodecPathToFifoOut_Complex();
}
eImgEffect = BYPASS;
eRotDeg = ROT_0;
eFlipDir = FLIP_NO;
}
*/
//////////
// Function Name : CAMERAT_TestCodecPath_Simple
// Function Description : Codec Path Simple Test
// Input : None
// Output : None
static void CAMERAT_TestCodecPath_Simple(void)
{
u32 uLcdHsz, uLcdVsz;
u32 i,j,k;
// 1. Initialize interrupt
//=================================
INTC_Enable(NUM_CAMIF_C);
INTC_SetVectAddr(NUM_CAMIF_C, Isr_CodecDone);
bCodecDone = false;
// 2. Initialize lcd
//==================================
*(volatile unsigned *)0x7410800c=0x0; // Modem I/F Bypass Control. It should be 0,
LCD_InitDISPC(eLcdBpp, uLcdFbAddr, WIN0, false);
LCD_GetFrmSz(&uLcdHsz, &uLcdVsz, WIN0);
LCD_SetWinOnOff(1, WIN0);
GLIB_InitInstance(uLcdFbAddr, uLcdHsz, uLcdVsz, eLcdBpp);
k=0;
for(i=0; i<240; i++)
for(j=0; j<320; j++)
GLIB_PutPixel2(j, i, pSmile[k++]);
LCD_Start();
printf("\nHit any key to start Camera simple test!\n");
UART_Getc();
// 3. Initialize camera and run the process of codec path
//==================================================
CAMERA_InitSensor();
CAMERA_InitCodecPath(uLcdHsz, uLcdVsz, uLcdFbAddr, eLcdBpp, FLIP_NO, ROT_0);
CAMERA_StartCodecPath(0);
printf("\nHit any key to capture frame!\n");
UART_Getc();
while(!bCodecDone);
CAMERA_StopCodecPath();
INTC_Disable(NUM_CAMIF_C);
// LCD Off
LCD_SetAllWinOnOff(0);
LCD_Stop();
printf("\nLCD OFF\n");
}
//////////
// Function Name : CAMERAT_TestCodecPath_Complex
// Function Description : CodecPath Complex Test Function(ScanLine Offset)
// Input : None
// Output : None
static void CAMERAT_TestCodecPath_Complex(void)
{
u32 uLcdHsz, uLcdVsz;
u32 uDstHsz, uDstVsz;
u32 uDisplayStartX, uDisplayStartY;
u32 uSrcCropStartX, uSrcCropStartY;
// 1. Initialize interrupt
//=================================
INTC_Enable(NUM_CAMIF_C);
INTC_SetVectAddr(NUM_CAMIF_C, Isr_CodecDone);
bCodecDone = false;
// 2. Initialize lcd
//==================================
LCD_InitDISPC(eLcdBpp, uLcdFbAddr, WIN0, false);
LCD_GetFrmSz(&uLcdHsz, &uLcdVsz, WIN0);
LCD_SetWinOnOff(1, WIN0);
LCD_Start();
// 3. Initialize camera and run the process of codec path
//==================================================
uDstHsz = 160, uDstVsz = 120;
uSrcCropStartX = 0, uSrcCropStartY = 0;
uDisplayStartX = 80, uDisplayStartY = 60;
eRotDeg = ROT_0;
CAMERA_InitSensor();
CAMERA_InitCodecPath0(uSrcCropStartX, uSrcCropStartY, uSrcCroppedHsz, uSrcCroppedVsz,
uLcdHsz, uLcdVsz, uDisplayStartX, uDisplayStartY, uDstHsz, uDstVsz, uLcdFbAddr, uLcdFbAddr, eLcdBpp, eFlipDir, eRotDeg);
if (eImgEffect == ARBITRARY_CBCR)
CAMERA_SetArbitraryCbCr( uArbitraryCbValue, uArbitraryCrValue);
else
CAMERA_SetImageEffect(eImgEffect);
CAMERAT_DisplayParam();
CAMERA_StartCodecPath(0);
printf("\nHit any key to capture frame!\n");
UART_Getc();
while(!bCodecDone);
CAMERA_StopCodecPath();
INTC_Disable(NUM_CAMIF_C);
// LCD Off
LCD_SetAllWinOnOff(0);
LCD_Stop();
printf("\nLCD OFF\n");
}
//////////
// Function Name : CAMERAT_TestCodecPath_AllParams
// Function Description : Camera Codec Path Test.
// Test case = 5+4+5+4 = 18 EA
// Input : None
// Output : None
static void CAMERAT_TestCodecPath_AllParams(void)
{
// 1. Set the case of the input parameters.
//================================
u32 uSrcCropSzList[5][2] = {{192,240}, {600, 448}, {160, 200}, {176, 360}, {800, 600}};
IMAGE_EFFECT eImgEffectList[6] = {BYPASS, ARBITRARY_CBCR, NEGATIVE, ART_FREEZE, EMBOSSING, SILHOUETTE};
u32 uArbitraryCbCrList[5][2] = {{0, 0}, {128, 128}, {255, 255}, {0, 255}, {255, 0}};
FLIP_DIR eFlipDirList[4] = {FLIP_X, FLIP_Y, FLIP_XY, FLIP_NO};
u32 uSrcCropIdx;
u32 uImgEffectIdx;
u32 uArbitraryIdx;
u32 uFlipIdx;
// 2. Change the case and test all the case of codec path.
//=============================================
for (uSrcCropIdx=0; uSrcCropIdx<5; uSrcCropIdx++) // Scaler up,down, bypass = 5 EA (2*2 + 1)
{
uSrcCroppedHsz = uSrcCropSzList[uSrcCropIdx][0];
uSrcCroppedVsz = uSrcCropSzList[uSrcCropIdx][1];
printf("\nHit any key to test\n");
Getc();
CAMERAT_TestCodecPath_Complex();
}
for (uImgEffectIdx=2; uImgEffectIdx<6; uImgEffectIdx++) // Image effect = 4 EA
{
eImgEffect = eImgEffectList[uImgEffectIdx];
printf("\nHit any key to test\n");
Getc();
CAMERAT_TestCodecPath_Complex();
}
eImgEffect = ARBITRARY_CBCR;
for (uArbitraryIdx=0; uArbitraryIdx<5; uArbitraryIdx++) // Arbitrary Cb,Cr = 5 EA
{
uArbitraryCbValue = uArbitraryCbCrList[uArbitraryIdx][0];
uArbitraryCrValue = uArbitraryCbCrList[uArbitraryIdx][1];
printf("\nHit any key to test\n");
Getc();
CAMERAT_TestCodecPath_Complex();
}
eImgEffect = BYPASS;
for (uFlipIdx=0; uFlipIdx<4; uFlipIdx++) // Flip = 4 EA
{
eFlipDir = eFlipDirList[uFlipIdx];
printf("\nHit any key to test\n");
Getc();
CAMERAT_TestCodecPath_Complex();
}
eImgEffect = BYPASS;
eFlipDir = FLIP_NO;
eRotDeg = ROT_0;
}
//////////
// Function Name : CAMERAT_TestMultiCaptureOfCodecPath
// Function Description : Capture Count Function Test
// Input : None
// Output : None
static void CAMERAT_TestMultiCaptureOfCodecPath(void)
{
u32 uLcdHsz, uLcdVsz;
u32 uCapNum;
u32 uBufCnt;
// 0. Interrupt Setting
//=====================================
INTC_Enable(NUM_CAMIF_C);
INTC_SetVectAddr(NUM_CAMIF_C, Isr_CodecDone);
bCodecDone = false;
// 1. Initialize lcd
//=====================================
LCD_InitDISPC(eLcdBpp, uLcdFbAddr, WIN0, false);
LCD_GetFrmSz(&uLcdHsz, &uLcdVsz, WIN0);
LCD_SetWinOnOff(1, WIN0);
LCD_Start();
// 2. Set the process mode(interrupt or polling mode) and captured pic number
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -