⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 thrdisplay.c

📁 DM642平台上的H.264源码(可实时运行)
💻 C
字号:
/*
 *  Copyright 2002 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.
 *  
 */
/*
 *  ======== thrDisplay.c ========
 */
#include <stdio.h>
#include <std.h>
#include <string.h>

// DSP/BIOS includes
#include <tsk.h>


// CSL includes
#include <csl_dat.h>

// RF5 module includes
#include <scom.h>
#include <utl.h>

// DDK
#include <fvid.h>

#include "edc.h"
#include "vport.h"
#include "vportdis.h"
#include "evmdm642.h"
#include "saa7105.h"

#include "appThreads.h"

#include "evmdm642_vdisparams.h"

// application includes
#include "appResources.h"   /* application-wide common info */

// Thread include
#include "thrDisplay.h"

#pragma DATA_SECTION(dis_mem_temp, ".INTPROCBUFF");
#pragma DATA_ALIGN(dis_mem_temp, MEMALIGN);
unsigned char dis_mem_temp[720];

/*#pragma DATA_SECTION(errint, ".INTPROCBUFF");
#pragma DATA_ALIGN(errint, MEMALIGN);
int errint[16][16];*/

//FVID Variables
FVID_Handle disChan;
FVID_Frame *disFrameBuf;

// Local function prototypes
void yuv420to422( char *frameIn[], char *frm_out[], int width, int height);
/*
 *  ======== thrDisplayInit ========
 *
 */
Void thrDisplayInit()
{
    SCOM_Handle scomReceive;
    int status;
    
    EVMDM642_vDisParamsChan.segId = EXTERNALHEAP;

    EVMDM642_vDisParamsSAA7105.hI2C = EVMDM642_I2C_hI2C;

    disChan = FVID_create("/VP2DISPLAY", IOM_OUTPUT,
        &status, (Ptr)&EVMDM642_vDisParamsChan, NULL);
    
    FVID_control(disChan, VPORT_CMD_EDC_BASE+EDC_CONFIG, (Ptr)&EVMDM642_vDisParamsSAA7105);
    
    scomReceive = SCOM_create("scomDisplay", NULL);
    UTL_assert( scomReceive != NULL);
}


/*
 *  ======== thrDisplayStartup ========
 *
 */
Void thrDisplayStartup()
{
	FVID_control(disChan, VPORT_CMD_START, NULL);
}

/*
 *  ======== thrDisplayRun ========
 *
 *  Main function of Display Thread.
 */
int g_dec=0;
#if 0
Void thrDisplayRun() 
{
    SCOM_Handle     scomReceive, scomSend;
    Char *inBuf[3];
    Char *outBuf[3];
    char testL[256];
	FILE* F_test; 

    UTL_logDebug1("thrDisplayRun:  task = 0x%x", TSK_self());

    // create the SCOM links (one for receiving and another for sending) 
    scomReceive = SCOM_open( "scomDisplay" );
    scomSend = SCOM_open( "scomToDecodeFromDisplay" );  //发送decode消息
//    scomSend    = SCOM_open( "scomCapture" );  //采集显示

    UTL_assert( scomReceive != NULL );
    UTL_assert( scomSend != NULL );
    
    FVID_alloc(disChan, &disFrameBuf);

    // Main loop
    while (0) 
    { 
        ScomDecToDisp  *scombufDisp;
        
        // get a full buffer from the ProcToDisp link       
        scombufDisp = SCOM_getMsg( scomReceive, SYS_FOREVER );
        
        //Convert 420 to 422
        inBuf[Y]  = scombufDisp->bufYCRCB[Y];
        inBuf[CR] = scombufDisp->bufYCRCB[CR];
        inBuf[CB] = scombufDisp->bufYCRCB[CB];
        
        outBuf[Y]  = disFrameBuf->frame.iFrm.y1;
        outBuf[CR] = disFrameBuf->frame.iFrm.cr1;
        outBuf[CB] = disFrameBuf->frame.iFrm.cb1;
        
#if 0   
		g_dec++;	
  		if((g_dec%103)==102)
 		{
	 		printf("write dst begin\n");
    		sprintf(testL,"dst%04d.yuv",g_dec/52);
    		F_test = fopen(testL,"wb");
    		fwrite(inBuf[0],352*288,1,F_test);
    		fwrite(inBuf[2],176*144,1,F_test);
    		fwrite(inBuf[1],176*144,1,F_test);
    		fclose(F_test);
	 		printf("write dst end\n");
  		}

#endif 
        
        yuv420to422(inBuf, outBuf, PROCF_WIDTH, PROCF_HEIGHT);
        	
        
		FVID_exchange(disChan, &disFrameBuf);
		
        // send back descriptors of now used up source channels to Process
        SCOM_putMsg( scomSend, scombufDisp );
    }
}

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -