www.pudn.com > SobelEdge_all_2.rar > tskProcess.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 "fvid.h" 
#include "appmain.h" 
#include "appThreads.h" 
#include "tskProcess.h"         
 
ScomBufChannels MsgProcess; 
 
void tskProcessInit() 
{ 
	tskVideoInputInit(); 
    tskVideoOutputInit();                 
}                    
 
unsigned char SobelData[720*576*2]; 
//unsigned char *SobelData; 
/*-------------------------------------------------------*/ 
/* Create the channel instance : the cell algorithms will*/ 
/* be instantiated                                       */ 
/*-------------------------------------------------------*/ 
void tskProcessStart()  
{ 
	tskVideoInputStart(); 
    tskVideoOutputStart(); 
} 
 
 
/*-------------------------------------------------------*/ 
/* The task will handle the processing part :            */ 
/* -Will get the message from the Input task with input  */ 
/*  frame pointers                                       */ 
/* -Will execute the channel to encode followed by decode*/ 
/* -Will pass the decoded frame pointers to output task  */ 
/*-------------------------------------------------------*/ 
 
void tskProcess() 
{ 
    ScomBufChannels *pMsgBuf;             
    unsigned char *Input; 
    //unsigned char *t1; 
    SCOM_Handle fromInputtoProc,fromProctoInput,\ 
    		fromProctoOut, fromOuttoProc; 
    		 
    fromInputtoProc = SCOM_open("INTOPROC"); 
    fromProctoInput = SCOM_open("PROCTOIN"); 
    fromProctoOut   = SCOM_open("PROCTOOUT"); 
    fromOuttoProc 	= SCOM_open("OUTTOPROC"); 
     
    while(1) 
    { 
 	    /*-----------------------------------------------------------*/ 
	  	/* Wait for the message from  input task to recieve captured */ 
  		/* frame to be cycled through encoding and decoding.         */ 
   		/*-----------------------------------------------------------*/ 
	 	pMsgBuf = SCOM_getMsg(fromInputtoProc, SYS_FOREVER);  
	  
	 	Input = pMsgBuf->bufChannel; 
	   	/*-------------------------------------------------------*/ 
		/* Sobel detect								           	 */ 
		/*-------------------------------------------------------*/ 
		 
		IMG_sobel(Input,SobelData,720,576); 
	    
	   	/*-----------------------------------------------------------*/ 
	   	/* Send the message to the input task to continue with next frame*/ 
	   	/*-----------------------------------------------------------*/ 
	    SCOM_putMsg(fromProctoInput, NULL);  	   	 
	   		 
	   	/*-----------------------------------------------------------*/ 
	   	/* Send message to output task with pointers to decoded frame*/ 
	   	/*-----------------------------------------------------------*/ 
	    MsgProcess.bufChannel = SobelData; 
	   	SCOM_putMsg(fromProctoOut,&MsgProcess); 
	   	 
	   	/*-----------------------------------------------------------*/ 
	   	/* Waiting for display one frame is completed				 */ 
	   	/*-----------------------------------------------------------*/ 
	   	SCOM_getMsg(fromOuttoProc, SYS_FOREVER);  
 	}	                                                  
}