tskVideoOutput.c
上传用户:dahaojd
上传日期:2008-01-29
资源大小:14357k
文件大小:2k
源码类别:

DSP编程

开发平台:

C/C++

  1. #include <std.h>
  2. #include <csl.h>
  3. #include <csl_dat.h>
  4. #include <csl_cache.h>
  5. #include <chan.h>
  6. #include <scom.h>
  7. #include <utl.h>
  8. #include <fvid.h>
  9. #include <tsk.h>
  10. #include "edc.h"
  11. #include "vport.h"
  12. #include "vportdis.h"
  13. #include "evmdm642.h"
  14. //#include "saa7105.h" /*change*/
  15. #include "saa7121.h" /*change*/
  16. #include "appMain.h"
  17. #include "appThreads.h"
  18. #include "evmdm642_vdisparams.h"
  19. #include "cap_dis_size.h"
  20. /* heap IDs defined in the BIOS configuration file */
  21. extern int extHeap;
  22. #pragma DATA_SECTION(scratch2,".internal_data1");
  23. #pragma DATA_ALIGN(scratch2,8);
  24. unsigned char scratch2[20*LINE_SZ];
  25. //extern unsigned char scratch1[];
  26. FVID_Handle  disChan;
  27. FVID_Frame *disFrameBuf;
  28. void tskVideoOutputInit()
  29. {
  30.     int             status;
  31.     EVMDM642_vDisParamsChan.segId = extHeap;
  32.     EVMDM642_vDisParamsSAA7121.hI2C = EVMDM642_I2C_hI2C;/*change*/
  33.     disChan = FVID_create("/VP2DISPLAY", IOM_OUTPUT,
  34.         &status, (Ptr)&EVMDM642_vDisParamsChan, NULL);
  35.     FVID_control(disChan, VPORT_CMD_EDC_BASE+EDC_CONFIG, (Ptr)&EVMDM642_vDisParamsSAA7121); /*change*/
  36. }
  37. void tskVideoOutputStart()
  38. {
  39.     FVID_control(disChan, VPORT_CMD_START, NULL);
  40. }
  41. /* handle video capture, scaling and re-format */
  42. void tskVideoOutput()
  43. {
  44.     char *inBuf[3], *outBuf[3];
  45.     SCOM_Handle fromProctoOut,fromOuttoProc;
  46.     ScomMessage *pMsgBuf;
  47.     fromProctoOut = SCOM_open("PROCTOOUT");
  48.     fromOuttoProc = SCOM_open("OUTTOPROC");
  49.     FVID_alloc(disChan, &disFrameBuf);
  50.     while(1)
  51.     {
  52.         pMsgBuf = SCOM_getMsg(fromProctoOut, SYS_FOREVER);
  53.         UTL_stsStart( stsDispTime );
  54.         inBuf[0] = pMsgBuf->bufY;
  55.         inBuf[1] = pMsgBuf->bufU;
  56.         inBuf[2] = pMsgBuf->bufV;
  57.         outBuf[0] =  disFrameBuf->frame.iFrm.y1;
  58.         outBuf[1] =  disFrameBuf->frame.iFrm.cb1;
  59.         outBuf[2] =  disFrameBuf->frame.iFrm.cr1;
  60.         yuv420to422(inBuf,outBuf,720,480);
  61.         UTL_stsStop( stsDispTime );
  62.         SCOM_putMsg(fromOuttoProc, pMsgBuf);
  63.         FVID_exchange(disChan, &disFrameBuf);
  64.     }
  65. }