Other Parts Discussed in Thread: TVP5146
Hello. Happy New Year.
I have a question about video preview which is using THE PSP VPSS Driver.
First, Here is my video preview image having problem.
Sorry. It's me.
and, as you can see this image,
right side of TI DSP LOGO Image(VIDEO WINDOWS 1 Layer) is tearing with the bottom image(Basic VIDEO WINDOWS 0 Layer)
but left side of TI DSP LOGO Image is fine..I don't know why this phenomenon is occured.
My System : DSP/BIOS 5.4, CCS 3.3, EVM DM6437 and PSP Driver 1.10
I use external image sensor through a daughter card. and i use psp driver includes I2C, VPFE, VPBE and RESIZER.
so, I want to show you some code for your advice.
| /* * Copyright 2008 by Texas Instruments Incorporated. * All rights reserved. Property of Texas Instruments Incorporated. * Restricted rights to use, duplicate or disclose this code are * granted through contract. * * @(#) dvsdk_1_11_00_00 1.11.00.00 061808 (biosdvsdk-c00x) */ /* * ======== video_preview.c ======== * */ /* runtime include files */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdarg.h> /* BIOS include files */ #include <std.h> #include <gio.h> #include <tsk.h> #include <trc.h> /* PSP include files */ #include <ti/sdo/pspdrivers/drivers/i2c/psp_i2c.h> #include <ti/sdo/pspdrivers/drivers/vpfe/psp_vpfe.h> #include <ti/sdo/pspdrivers/drivers/vpbe/psp_vpbe.h> #include <ti/sdo/pspdrivers/drivers/resizer/psp_resizer.h> #include <ti/sdo/pspdrivers/drivers/previewer/psp_previewer.h> #include <ti/sdo/pspdrivers/system/dm6437/bios/evmDM6437/video/fvid.h> #include <ti/sdo/pspdrivers/system/dm6437/bios/evmDM6437/video/fvid_evmDM6437.h> #include <ti/sdo/pspdrivers/system/dm6437/bios/evmDM6437/video/psp_tvp5146_extVidDecoder.h> #include <ti/sdo/pspdrivers/system/dm6437/bios/evmDM6437/video/FVID_evmDM6437.h> /* CSL include files */ #include <ti/sdo/pspdrivers/soc/dm6437/dsp/soc.h> #include <ti/sdo/pspdrivers/soc/dm6437/dsp/cslr_sys.h> #include <cslr_gpio.h> #include <cslr_ccdc.h> /* BSL include files */ #include <evmdm6437.h> #include <evmdm6437_dip.h> /* Video Params Defaults */ #include <vid_params_default.h> /* include file for this module */ #include "dm6437_sccb.h" #include "OV10630_extImageSensor.h" #include "OV10630_extImageSensorParamDefault.h" /* This example supports either PAL or NTSC depending on position of JP1 */ #define STANDARD_PAL 0 #define STANDARD_NTSC 1 #define FRAME_IN_BUFF_CNT 3 #define FRAME_OUT_BUFF_CNT 3 //OSD0 - RGB565 Image Source //extern unsigned char TIDSP146x146RGB565[23360]; // (320*146)/2 //VID1 - RGB888 Image Source extern unsigned char TIDSP146x146RGB888[65408]; // 448*146 extern int DDR2; static CSL_SysRegsOvly sysModuleRegs = (CSL_SysRegsOvly )CSL_SYS_0_REGS; static CSL_CcdcRegsOvly sysCcdc = (CSL_CcdcRegsOvly)CSL_VPSS_CCDC_0_REGS; #if !defined(OV10630_SENSOR) static int read_JP1(void) { int jp1 = -1; while (jp1 == -1) { jp1 = EVMDM6437_DIP_get(JP1_JUMPER); TSK_sleep(1); } return(jp1); } #endif /* * ======== main ======== */ void main() { printf("Video Preview Application\n"); fflush(stdout); /* Initialize BSL library to read jumper switches: */ EVMDM6437_DIP_init(); /* VPSS PinMuxing */ /* CI10SEL - No CI[1:0] */ /* CI32SEL - No CI[3:2] */ /* CI54SEL - No CI[5:4] */ /* CI76SEL - No CI[7:6] */ /* CFLDSEL - No C_FIELD */ /* CWENSEL - No C_WEN */ /* HDVSEL - CCDC HD and VD enabled */ /* CCDCSEL - CCDC PCLK, YI[7:0] enabled */ /* AEAW - EMIFA full address mode */ /* VPBECKEN - VPBECLK enabled */ /* RGBSEL - No digital outputs */ /* CS3SEL - LCD_OE/EM_CS3 disabled */ /* CS4SEL - CS4/VSYNC enabled */ /* CS5SEL - CS5/HSYNC enabled */ /* VENCSEL - VCLK,YOUT[7:0],COUT[7:0] enabled */ /* AEM - 8bEMIF + 8bCCDC + 8 to 16bVENC */ #if defined(OV10630_SENSOR) CFG_PINMUX0 = 0 | ( 0 << 30 ) // CI10SEL - No CI[1:0] | ( 0 << 28 ) // CI32SEL - No CI[3:2] | ( 0 << 26 ) // CI54SEL - No CI[5:4] | ( 0 << 25 ) // CI76SEL - No CI[7:6] | ( 0 << 24 ) // CFLDSEL - No C_FIELD | ( 0 << 23 ) // CWENSEL - No C_WEN | ( 1 << 22 ) // HDVSEL - Enable CCDC HD and VD | ( 1 << 20 ) // CCDCSEL - CCDC PCLK, YI[7:0] enabled | ( 4 << 16 ) // AEAW - EMIFA full address mode | ( 1 << 15 ) // VPBECLK - VPBECLK enabled | ( 0 << 12 ) // RGBSEL - No digital outputs | ( 0 << 10 ) // CS3SEL - LCD_OE/EM_CS3 disabled | ( 0 << 8 ) // CS4SEL - CS4/VSYNC disabled | ( 0 << 6 ) // CS5SEL - CS5/HSYNC disabled | ( 0 << 4 ) // VENCSEL - Video encoder outputs disabled | ( 1 << 0 ); // AEM - 8-bit EMIFA, 8-bit CCDC in CFG_PINMUX1 = 0 | ( 1 << 24 ) // SPBK1 - McBSP1 enabled | ( 1 << 22 ) // SPBK0 - McBSP0 enabled | ( 2 << 20 ) // TIM1BK - UART1 enabled, Timer1 disabled | ( 1 << 16 ) // TIM0BK - Timer0 enabled | ( 2 << 14 ) // CKOBK - CLKOUT disabled, PWM2 enabled | ( 0 << 12 ) // PWM1BK - PWM1 disabled, GIO84 enabled | ( 1 << 10 ) // UR0FCBK - UART0 HW flow control enabled | ( 1 << 8 ) // UR0DBK - UART0 data enabled | ( 3 << 4 ) // HOSTBK - VLYNQ + MII + MDIO Mode | ( 0 << 0 ); // PCIEN - PCI disabled CFG_VDD3P3V_PWDN = 0x0000; // Everything on sysModuleRegs -> VPSS_CLKCTL = (0x18u); /* sysModuleRegs -> PINMUX0 &= (0x005482A3u); sysModuleRegs -> PINMUX0 |= (0x005482A3u); sysModuleRegs -> PINMUX1 &= (0xFFFFFFFEu); sysModuleRegs -> VPSS_CLKCTL = (0x18u); */ sysCcdc->CCDCFG |= (0x1000); #else sysModuleRegs -> PINMUX0 &= (0x005482A3u); sysModuleRegs -> PINMUX0 |= (0x005482A3u); /* PCIEN = 0: PINMUX1 - Bit 0 */ sysModuleRegs -> PINMUX1 &= (0xFFFFFFFEu); sysModuleRegs -> VPSS_CLKCTL = (0x18u); #endif return; } /* * ======== video_preview ======== */ void video_preview(void) { FVID_Frame *frameBuffInTable[FRAME_IN_BUFF_CNT]; FVID_Frame *frameBuffOutTable[FRAME_OUT_BUFF_CNT]; FVID_Frame *frameBuffPtr = NULL; //TI OSD Image FrameBuffer Pointer FVID_Frame *osdFrameBufferPtr = NULL; GIO_Handle hGioOSD0Handle = NULL; GIO_Handle hGioVpfeCcdc; GIO_Handle hGioVpbeVid0; GIO_Handle hGioVpbeVenc; GIO_Attrs gioAttrs = GIO_ATTRS; int status = 0; int phase =0; int result; int i; int terminal=0; #if defined(OV10630_RESIZER) GIO_Handle hGioResizer; PSP_RSZresize resizerArgs; FVID_Frame *resizedBuffPtr = NULL; PSP_RSZparams resizerParams = OV10630_PARAMS_RESIZER; int memSegId = 0; #endif /* Set video display/capture driver params to defaults */ PSP_VPFECcdcConfigParams vpfeCcdcConfigParams = OV10630_PARAMS_CCDC; PSP_VPBEOsdConfigParams vpbeVid0ConfigParams = OV10630_PARAMS_VID0; PSP_VPBEVencConfigParams vpbeVencConfigParams; //TI OSD Image ConfigParameters Setting // PSP_VPBEOsdConfigParams vpbeOSD0ConfigParams = OV10630_PARAMS_OSD0; static PSP_VPBEOsdConfigParams vid1Params = { FVID_FRAME_MODE, /* ffmode */ FVID_BPP_BITS24, /* bitsPerPixel */ FVID_RGB_888_INTERLEAVED, /* colorFormat */ 448, /* pitch */ 100, /* leftMargin */ 0, /* topMargin */ 146, /* width */ 146, /* height */ 0, /* segId */ PSP_VPBE_ZOOM_IDENTITY, /* hScaling */ PSP_VPBE_ZOOM_IDENTITY, /* vScaling */ PSP_VPBE_EXP_IDENTITY, /* hExpansion */ PSP_VPBE_EXP_IDENTITY, /* vExpansion */ NULL /* appCallback */ }; vid1Params.segId = DDR2; vid1Params.blending = PSP_VPBE_BLEND0; vid1Params.CLUTSource = PSP_VPBE_CLUTSOURCE_ROM; vid1Params.transparency = TRUE; vid1Params.transparencyColor = 0xFFFF; // vpbeOSD0ConfigParams.segId=DDR2; // vpbeOSD0ConfigParams.blending = PSP_VPBE_BLEND4; // vpbeOSD0ConfigParams.transparency = FALSE; // vpbeOSD0ConfigParams.transparencyColor = 0xFFFF; // does not matter vpbeVencConfigParams.displayStandard = PSP_VPBE_DISPLAY_NTSC_INTERLACED_COMPOSITE; printf("OVSENSOR SETTING\n"); /* init the input frame buffer table */ for (i=0; i<FRAME_IN_BUFF_CNT; i++) { frameBuffInTable[i] = NULL; } /* init the output frame buffer table */ for (i=0; i<FRAME_OUT_BUFF_CNT; i++) { frameBuffOutTable[i] = NULL; } //3 printf("Phase %d, STATUS : %d\n", phase++, status); //2 printf("Phase %d, STATUS : %d\n", phase++, status); printf("1. Making a VPFE Channel...\n"); /* create video input channel */ if (status == 0) { PSP_VPFEChannelParams vpfeChannelParams; vpfeChannelParams.id = PSP_VPFE_CCDC; vpfeChannelParams.params = (PSP_VPFECcdcConfigParams*)&vpfeCcdcConfigParams; hGioVpfeCcdc = FVID_create("/VPFE0",IOM_INOUT,NULL,&vpfeChannelParams, &gioAttrs); status = (hGioVpfeCcdc == NULL ? -1 : 0); } printf("2. Making a VID0 Channel...\n"); /* create video output channel, plane 0 */ if (status == 0) { PSP_VPBEChannelParams vpbeChannelParams; vpbeChannelParams.id = PSP_VPBE_VIDEO_0; vpbeChannelParams.params = (Ptr)&vpbeVid0ConfigParams; hGioVpbeVid0 = FVID_create("/VPBE0",IOM_INOUT,NULL,&vpbeChannelParams, &gioAttrs); status = (hGioVpbeVid0 == NULL ? -1 : 0); } printf("3. Making a VID1 Channel...\n"); //Create VID0 Channel if(status==0) { PSP_VPBEChannelParams beinitParams; beinitParams.id = PSP_VPBE_VIDEO_1; beinitParams.params = (PSP_VPBEOsdConfigParams*)&vid1Params; hGioOSD0Handle = FVID_create("/VPBE0", IOM_INOUT, NULL, &beinitParams, &gioAttrs); status = (hGioOSD0Handle == NULL ? -1 : 0); } printf("4. Making a RESIZER Channel...\n"); if (status == 0) { hGioResizer = FVID_create("/resizer", IOM_INOUT, NULL, &memSegId, &gioAttrs); status = (hGioResizer == NULL ? -1 : 0); result = FVID_control(hGioResizer, PSP_RSZ_IOCTL_SET_PARAMS, &resizerParams); } printf("5. Making a VENC Channel...\n"); /* create video output channel, venc */ if (status == 0) { PSP_VPBEChannelParams vpbeChannelParams; vpbeChannelParams.id = PSP_VPBE_VENC; vpbeChannelParams.params = (PSP_VPBEVencConfigParams *)&vpbeVencConfigParams; hGioVpbeVenc = FVID_create("/VPBE0",IOM_INOUT,NULL,&vpbeChannelParams, &gioAttrs); status = (hGioVpbeVenc == NULL ? -1 : 0); } printf("///////////////////////////////////////////////\n"); printf("1) Allocating THE VPFE Buffer Memory\n"); /* allocate some input frame buffers */ if (status == 0) { for (i=0; i<FRAME_IN_BUFF_CNT && status == 0; i++) { result = FVID_allocBuffer(hGioVpfeCcdc, &frameBuffInTable[i]); status = (result == IOM_COMPLETED && frameBuffInTable[i] != NULL ? 0 : -1); } } printf("2) Allocating THE VID1 Buffer Memory\n"); //VID1 Handle if(status==0) { result = FVID_allocBuffer(hGioOSD0Handle, &osdFrameBufferPtr); status = (result == IOM_COMPLETED && osdFrameBufferPtr != NULL ? 0 : -1); } printf(" -Copy a Image Resource\n"); memcpy(osdFrameBufferPtr->frame.frameBufferPtr, TIDSP146x146RGB888, 65408 ); //INPUT OSD if(status==0) { //resizerArgs.inBufSize = 146 * 146 * 2; //resizerArgs.outBufSize = 146 * 146 * 2; //resizerArgs.inBuf = osdFrameBufferPtr->frame.frameBufferPtr; //resizerArgs.outBuf = resizedBuffPtr->frame.frameBufferPtr; //result = FVID_control(hGioResizer, PSP_RSZ_IOCTL_RESIZE, &resizerArgs); FVID_queue(hGioOSD0Handle, osdFrameBufferPtr); } printf("3) Allocating THE VID0 Buffer Memory\n"); /* allocate some output frame buffers */ if (status == 0) { for (i=0; i<FRAME_OUT_BUFF_CNT && status == 0; i++) { result = FVID_allocBuffer(hGioVpbeVid0, &frameBuffOutTable[i]); status = (result == IOM_COMPLETED && frameBuffOutTable[i] != NULL ? 0 : -1); } } /* prime up the video capture channel */ if (status == 0) { FVID_queue(hGioVpfeCcdc, frameBuffInTable[0]); FVID_queue(hGioVpfeCcdc, frameBuffInTable[1]); FVID_queue(hGioVpfeCcdc, frameBuffInTable[2]); } /* prime up the video display channel */ if (status == 0) { FVID_queue(hGioVpbeVid0, frameBuffOutTable[0]); FVID_queue(hGioVpbeVid0, frameBuffOutTable[1]); FVID_queue(hGioVpbeVid0, frameBuffOutTable[2]); } /* grab first buffer from input queue */ if (status == 0) { FVID_dequeue(hGioVpfeCcdc, &frameBuffPtr); } #if defined(OV10630_RESIZER) /* grab first buffer from output queue */ if (status == 0) { FVID_dequeue(hGioVpbeVid0, &resizedBuffPtr); } #endif //FVID_dequeue(hGioOSD0Handle, &osdFrameBufferPtr); /* loop forever performing video capture and display */ while ( status == 0 ) { /* grab a fresh video input frame */ FVID_exchange(hGioVpfeCcdc, &frameBuffPtr); ///////////////////////////////////////////////////////////////////// //Resizing/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// resizerArgs.inBufSize = OV10630_INPUT_HEIGHT * OV10630_INPUT_WIDTH * 2; resizerArgs.outBufSize = OV10630_OUTPUT_HEIGHT * OV10630_OUTPUT_WIDTH * 2; resizerArgs.inBuf = frameBuffPtr->frame.frameBufferPtr; resizerArgs.outBuf = resizedBuffPtr->frame.frameBufferPtr; result = FVID_control(hGioResizer, PSP_RSZ_IOCTL_RESIZE, &resizerArgs); ///////////////////////////////////////////////////////////////////// /* display the video frame */ FVID_exchange(hGioVpbeVid0, &resizedBuffPtr); /* terminal++; */ /* if(terminal==100) */ /* { */ /* FVID_dequeue(hGioOSD0Handle, &osdFrameBufferPtr); */ /* FVID_free(hGioOSD0Handle, osdFrameBufferPtr); */ /* } */ /* */ } } |
If you could give me some advice, i will be very happy to you
Thank you.
Regards,
Zizek