www.pudn.com > SobelEdge_all_2.rar > tskVideoOutput.c
/* * Copyright 2003 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. * */ #include#include #include #include #include #include #include #include #include #include #include #include #include "seeddm642.h" #include "seedvpm642_vcapparams.h" #include "seedvpm642_vdisparams.h" #include "edc.h" #include "vportdis.h" #include "evmdm642.h" #include "evmdm642_vdisparams.h" #include "appMain.h" #include "appThreads.h" #include "tskVideoOutput.h" #include "prepost.h" ScomBufChannels MsgOutput; /* heap IDs defined in the BIOS configuration file */ FVID_Handle disChan; #pragma DATA_SECTION(scratch2,".internal_data1"); #pragma DATA_ALIGN(scratch2,8); unsigned char scratch2[20*LINE_SZ]; FVID_Handle disChan; FVID_Frame *disFrameBuf; /*-------------------------------------------------------*/ /* Initialize the display channel */ /*-------------------------------------------------------*/ void tskVideoOutputInit() { int status; EVMDM642_vDisParamsChan.segId = EXTERNALHEAP; //EXTERNALHEAP; EVMDM642_vDisParamsSAA7121.hI2C = SEEDVPM642_I2C_hI2C; /******************************************************/ /* initialization of display driver */ /******************************************************/ disChan = FVID_create("/VP0DISPLAY/A/0", IOM_OUTPUT, &status, (Ptr)&EVMDM642_vDisParamsChan, NULL); /******************************************************/ /* configure video decoder */ /******************************************************/ FVID_control(disChan, VPORT_CMD_EDC_BASE + EDC_CONFIG, (Ptr)&EVMDM642_vDisParamsSAA7121); /******************************************************/ /* configure video encoder & decoder */ /******************************************************/ /*ÅäÖÃSAA7121*/ FVID_control(disChan, VPORT_CMD_EDC_BASE + EDC_CONFIG, (Ptr)&EVMDM642_vDisParamsSAA7121); } /*-------------------------------------------------------*/ /* Start the display channel */ /*-------------------------------------------------------*/ void tskVideoOutputStart() { FVID_control(disChan, VPORT_CMD_START, NULL); } /*-------------------------------------------------------*/ /* handle video display, scaling and re-format */ /*-------------------------------------------------------*/ void tskVideoOutput() { unsigned char *frame; IMG in1,out1; SCRATCH scr; SCOM_Handle fromProctoOut,fromOuttoProc; ScomBufChannels *pMsgBuf; fromProctoOut = SCOM_open("PROCTOOUT"); fromOuttoProc = SCOM_open("OUTTOPROC"); FVID_alloc(disChan, &disFrameBuf); while(1) { /*-----------------------------------------------------------*/ /* Wait for the message from the process task to recieve new */ /* frame to be displayed.*/ /*-----------------------------------------------------------*/ pMsgBuf = SCOM_getMsg(fromProctoOut, SYS_FOREVER); frame = (unsigned char *)pMsgBuf->bufChannel; in1.Y_data = frame; in1.Cb_data = in1.Y_data + FRM_WIDTH*FRM_HEIGHT; in1.Cr_data = in1.Cb_data + ((FRM_WIDTH*FRM_HEIGHT)>>2); out1.Y_data = disFrameBuf->frame.iFrm.y1; out1.Cb_data = disFrameBuf->frame.iFrm.cr1; out1.Cr_data = disFrameBuf->frame.iFrm.cb1; scr.in_data = scratch2; CACHE_clean(CACHE_L2ALL,NULL,NULL); /*-----------------------------------------------------------*/ /* Call YUV420to422v to do chroma resampling */ /*-----------------------------------------------------------*/ yuv420to422(&in1,&out1,FRM_WIDTH,FRM_HEIGHT,&scr); memset(out1.Cb_data,0x80,((FRM_WIDTH*FRM_HEIGHT)>>1)); memset(out1.Cr_data,0x80,((FRM_WIDTH*FRM_HEIGHT)>>1)); CACHE_clean(CACHE_L2ALL,NULL,NULL); /*-----------------------------------------------------------*/ /* Display the decoded frame. */ /*-----------------------------------------------------------*/ FVID_exchange(disChan, &disFrameBuf); /*-----------------------------------------------------------*/ /* Send message to process task to continue */ /*-----------------------------------------------------------*/ SCOM_putMsg(fromOuttoProc, NULL); } }