TI中文支持网
TI专业的中文技术问题搜集分享网站

在video_preview例程想使用ccs 3.3的view中的image来查看图像

平台是6437和ccs3.3以下是我的代码:

void main() {

printf("Video Preview Application\n");
fflush(stdout);

/* 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 */
sysModuleRegs -> PINMUX0 &= (0x005482A3u);
sysModuleRegs -> PINMUX0 |= (0x005482A3u);

/* PCIEN = 0: PINMUX1 – Bit 0 */
sysModuleRegs -> PINMUX1 &= (0xFFFFFFFEu);
sysModuleRegs -> VPSSCLKCTL = (0x18u);

// Reset TVP5151
FI1206_GPIO_init();
FI1206_GPIO_setDir(GPIO03,0);
FI1206_GPIO_setOutput(GPIO03,0);
_waitusec( 800000 );
FI1206_GPIO_setOutput(GPIO03,1);
_waitusec( 800000 );

return;
}

/*
* ======== video_preview ========
*/
void video_preview(void) {

FVID_Frame *frameBuffTable[FRAME_BUFF_CNT];
FVID_Frame *frameBuffPtr;
GIO_Handle hGioVpfeCcdc;
GIO_Handle hGioVpbeVid0;
GIO_Handle hGioVpbeVenc;
int status = 0;
int result;
int i;
int standard;
int width;
int height;

/* Set video display/capture driver params to defaults */
PSP_VPFE_TVP5151_ConfigParams tvp5151Params = VID_PARAMS_TVP5151_DEFAULT;
PSP_VPFECcdcConfigParams vpfeCcdcConfigParams= VID_PARAMS_CCDC_DEFAULT_D1;
PSP_VPBEOsdConfigParams vpbeOsdConfigParams = VID_PARAMS_OSD_DEFAULT_D1;
PSP_VPBEVencConfigParams vpbeVencConfigParams;

standard = STANDARD_PAL;
/* Update display/capture params based on video standard (PAL/NTSC) */
if (standard == STANDARD_PAL) {
width = 720;
height = 576;
vpbeVencConfigParams.displayStandard = PSP_VPBE_DISPLAY_PAL_INTERLACED_COMPOSITE;
}
else {
width = 720;
height = 480;
vpbeVencConfigParams.displayStandard = PSP_VPBE_DISPLAY_NTSC_INTERLACED_COMPOSITE;
}
vpfeCcdcConfigParams.height = vpbeOsdConfigParams.height = height;
vpfeCcdcConfigParams.width = vpbeOsdConfigParams.width = width;
vpfeCcdcConfigParams.pitch = vpbeOsdConfigParams.pitch = width * 2;

/* init the frame buffer table */
for (i=0; i<FRAME_BUFF_CNT; i++) {
frameBuffTable[i] = NULL;
}

/* 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,NULL);
status = (hGioVpfeCcdc == NULL ? -1 : 0);
}

/* create video output channel, plane 0 */
if (status == 0) {
PSP_VPBEChannelParams vpbeChannelParams;
vpbeChannelParams.id = PSP_VPBE_VIDEO_0;
vpbeChannelParams.params = (PSP_VPBEOsdConfigParams*)&vpbeOsdConfigParams;
hGioVpbeVid0 = FVID_create("/VPBE0",IOM_INOUT,NULL,&vpbeChannelParams,NULL);
status = (hGioVpbeVid0 == NULL ? -1 : 0);
}

/* 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,NULL);
status = (hGioVpbeVenc == NULL ? -1 : 0);
}

/* configure the TVP5158 video decoder */
if (status == 0) {
result = FVID_control(hGioVpfeCcdc, VPFE_ExtVD_BASE+PSP_VPSS_EXT_VIDEO_DECODER_CONFIG, &tvp5151Params);
status = (result == IOM_COMPLETED ? 0 : -1);
}

/* allocate some frame buffers */
if (status == 0) {
for (i=0; i<FRAME_BUFF_CNT && status == 0; i++) {
result = FVID_allocBuffer(hGioVpfeCcdc, &frameBuffTable[i]);
status = (result == IOM_COMPLETED && frameBuffTable[i] != NULL ? 0 : -1);
}
}

/* prime up the video capture channel */
if (status == 0) {
FVID_queue(hGioVpfeCcdc, frameBuffTable[0]);
FVID_queue(hGioVpfeCcdc, frameBuffTable[1]);
FVID_queue(hGioVpfeCcdc, frameBuffTable[2]);
}

/* prime up the video display channel */
if (status == 0) {
FVID_queue(hGioVpbeVid0, frameBuffTable[3]);
FVID_queue(hGioVpbeVid0, frameBuffTable[4]);
FVID_queue(hGioVpbeVid0, frameBuffTable[5]);
}

/* grab first buffer from input queue */
if (status == 0) {
FVID_dequeue(hGioVpfeCcdc, &frameBuffPtr);
}

/* loop forever performing video capture and display */
while ( status == 0 ) {

/* grab a fresh video input frame */
FVID_exchange(hGioVpfeCcdc, &frameBuffPtr);

/* display the video frame */
FVID_exchange(hGioVpbeVid0, &frameBuffPtr);

}

我在最后的FVID_exchange处设断点想查看frameBuffPtr中的缓存帧但是不成功求指导

Chris Meng:

Wang Xin,

你能否确认一下现在是没有获得正确的图像数据的问题?,还是图像数据在CCS里面显示不正确的问题?

xin wang22:

回复 Chris Meng:

你好,我想问一下图像的存储格式是什么?,是按ycrcb的顺序存储的吗?如果是的话4:2:2又怎么体现呢?

Chris Meng:

回复 xin wang22:

Wang Xin,

是YUYV,请参考http://www.cnblogs.com/azraelly/archive/2013/01/01/2841269.html,了解更多交织模式和planar模式的信息。

xin wang22:

回复 Chris Meng:

我现在能够显示yuv图像

我的设置是这样的,这是否说明图像是按照uyvy的顺序存放的?y分量占2字节,u,v各占4字节?

Chris Meng:

回复 xin wang22:

Wang Xin,

YUV422是Y0U0Y1V1。两个像素有两个8-bit Y,一个8-bit U,一个8-bit V。

xin wang22:

回复 Chris Meng:

y0存在低8位吗还是高8位?

Chris Meng:

回复 xin wang22:

Wang Xin,

你是否有阅读过DM6437 VPFE Guide?

http://www.ti.com/lit/ug/spru977d/spru977d.pdf

xin wang22:

回复 Chris Meng:

谢谢,现在已经能够提取Y分量了,关于ccs的图像这块并不熟悉,添麻烦了

user4938350:

我想问一下,程序里输入通道和输出通道的接口是什么,我想往输入输出中间添加东西,求解答,谢谢。

xin wang22:

回复 user4938350:

输入图像会存在申请的堆内存里,函数返回一个指向内存的指针

赞(0)
未经允许不得转载:TI中文支持网 » 在video_preview例程想使用ccs 3.3的view中的image来查看图像
分享到: 更多 (0)