Esempio n. 1
0
Int32 AlgLink_ScdalgProcessData(AlgLink_ScdObj * pObj, FVID2_FrameList *frameList, Utils_BitBufHndl *bufOutQue)
{
    UInt32 frameId, curTime;
    FVID2_Frame *pFrame;
    Int32 chIdx, status;
    Int32 frameFound;
    Bitstream_Buf *pOutBuf;
    Bitstream_BufList outBitBufList;
    System_FrameInfo *pInFrameInfo;

    outBitBufList.numBufs = 0;
    outBitBufList.appData = NULL;

    AlgLink_ScdChObj *pChObj;

    pObj->totalFrameCount += frameList->numFrames;

    status = FVID2_EFAIL;
    if (frameList->numFrames)
    {
        for(frameId=0; frameId< frameList->numFrames; frameId++)
        {
            Bool doFrameDrop;
        	pFrame = frameList->frames[frameId];
            //chIdx = pFrame->channelNum - pObj->createArgs.startChNoForSCD;
     
            frameFound = 0;
            for(chIdx = 0; chIdx < pObj->createArgs.numValidChForSCD; chIdx++)
            {
                if(pFrame->channelNum == pObj->createArgs.chDefaultParams[chIdx].chId)
                {
                  frameFound = 1;
                  break;
                }
            }
     
            if (frameFound == 0)
              continue;

            pChObj = &pObj->chObj[chIdx];

            pChObj->inFrameRecvCount++;
            doFrameDrop = Utils_doSkipFrame(&pChObj->frameSkipCtx);
            if(doFrameDrop == FALSE)
            {
                pOutBuf = NULL;
                status = Utils_bitbufGetEmptyBuf(bufOutQue,
                                                 &pOutBuf,
                                                 0, //pObj->outObj.ch2poolMap[chIdx], /*Need to change later.*/
                                                 BIOS_NO_WAIT);

                if(!((status == FVID2_SOK) && (pOutBuf)))
                {
                   doFrameDrop = TRUE;
                }
            }
            if(doFrameDrop == FALSE)
            {
                pObj->chParams[chIdx].curFrame = pFrame->addr[0][0];

                pInFrameInfo = (System_FrameInfo *) pFrame->appData;

                pOutBuf->lowerTimeStamp = (UInt32)(pInFrameInfo->ts64 & 0xFFFFFFFF);
                pOutBuf->upperTimeStamp = (UInt32)(pInFrameInfo->ts64 >> 32);
                pOutBuf->channelNum = pFrame->channelNum;
                pOutBuf->fillLength = sizeof(AlgLink_ScdResult);
                pOutBuf->frameWidth = pObj->chParams[chIdx].width;
                pOutBuf->frameHeight = pObj->chParams[chIdx].height;

                curTime = Utils_getCurTimeInMsec();
                
//                AlgLink_ScdalgProcess(pObj, pFrame->channelNum, (AlgLink_ScdResult *) pOutBuf->addr);
                AlgLink_ScdalgProcess(pObj, chIdx, (AlgLink_ScdResult *) pOutBuf->addr);
                pObj->chParams[chIdx].chBlkConfigUpdate = FALSE;

                pChObj->inFrameProcessTime += (Utils_getCurTimeInMsec() - curTime);

                pChObj->inFrameProcessCount++;
                outBitBufList.bufs[outBitBufList.numBufs] = pOutBuf;
                outBitBufList.numBufs++;

            }
            else
            {
                pChObj->inFrameUserSkipCount++;

            }
        }
Esempio n. 2
0
/* ===================================================================
*  @func     HelloWorldLink_algProcessData
*
*  @desc     Process upon the input frame received from previous link
*            At this place, make a call to algorithm process call
*
*  @modif    This function modifies the following structures
*
*  @inputs   This function takes the following inputs
*            <HelloWorldLink_Obj>
*            Object to hello world link
*
*  @outputs  <argument name>
*            Description of usage
*
*  @return   Status of process call
*  ==================================================================
*/
Int32 HelloWorldLink_processData(HelloWorldLink_Obj * pObj)
{
    UInt32 frameId;
    System_LinkInQueParams *pInQueParams;
    FVID2_Frame *pFrame;
    FVID2_FrameList frameList;
    Bitstream_Buf *pOutBuf;
    Utils_BitBufHndl *bufOutQue;
    Int32 status;
    System_FrameInfo *pInFrameInfo;
    Bitstream_BufList outBitBufList;
    Bitstream_BufList tempBitBufList; 
	HELLOWORLDALG_Result *pHelloWorldResult = NULL;
    Uint8* pBufferStart;
    UInt8 *pBuffer;
    int i,j;
    UInt8 *y0pixel,*y1pixel,*upixel,*vpixel;


    status = FVID2_EFAIL;
    pInQueParams = &pObj->createArgs.inQueParams;

    bufOutQue = &pObj->outObj[0].bufOutQue;
    outBitBufList.numBufs=0;
    /*************************************************************************/
    /* Get input frames from previous link output queue                      */
    /*************************************************************************/
    System_getLinksFullFrames(pInQueParams->prevLinkId,
        pInQueParams->prevLinkQueId, &frameList);

    /*************************************************************************/
    /* If input frame received from queue, get the output buffer from out    */
    /* queue and process the frame                                           */
    /*************************************************************************/
    if (frameList.numFrames)
    {
        Vps_printf(" %d frameList.numFrames:%d  !!!\n", 
        Utils_getCurTimeInMsec(),frameList.numFrames);
        //pObj->totalFrameCount += frameList.numFrames;

        /*********************************************************************/
        /* Get the outout buffer for each input buffer and process the frame */
        /*                                                                   */
        /*********************************************************************/
        for(frameId=0; frameId< frameList.numFrames; frameId++)
        {
            Bool doFrameDrop = FALSE;

			pFrame = frameList.frames[frameId];

            //pChObj = &pObj->chObj[chIdx];

            //pChObj->inFrameRecvCount++;


            /*********************************************************************/
            /* If current frame needs to be processed, get the output buffer     */
            /* from output queue                                                 */
            /*********************************************************************/
            if(pObj->createArgs.createOutBuf1)
            {
                pOutBuf = NULL;
		//  Vps_printf(" bufOutQue->fullQue.count :%d \r\n",bufOutQue->empytQue[0].count);
                status = Utils_bitbufGetEmptyBuf(bufOutQue,
                    &pOutBuf,
                    0, //pObj->outObj.ch2poolMap[chIdx], /*Need to change later.*/
                    BIOS_NO_WAIT);
		//   Vps_printf(" bufOutQue->fullQue.count :%d \r\n",bufOutQue->emptyQue[0].count);

                if(!((status == FVID2_SOK) && (pOutBuf)))
                {
                    doFrameDrop = TRUE;
                }

                /*********************************************************************/
                /* Captured YUV buffers time stamp is passed by all links to next    */
                /* buffers bu copying the input buffer times stamp to it's output    */
                /* buffer. This is used for benchmarking system latency.             */
                /*********************************************************************/
                pInFrameInfo = (System_FrameInfo *) pFrame->appData;
                pOutBuf->lowerTimeStamp = (UInt32)(pInFrameInfo->ts64 & 0xFFFFFFFF);
                pOutBuf->upperTimeStamp = (UInt32)(pInFrameInfo->ts64 >> 32);
                pOutBuf->channelNum = pFrame->channelNum;
                //pOutBuf->fillLength = ;
                //pOutBuf->frameWidth = ;
                //pOutBuf->frameHeight = ;

				pHelloWorldResult = (HELLOWORLDALG_Result *) pOutBuf->addr;
            }

            /*********************************************************************/
            /* Now input and output buffers available and this frame need not be */
            /* skipped, make a call to the algorithm process call and process the*/
            /* frame.                                                            */
            /*********************************************************************/
            if(doFrameDrop == FALSE)
            {
                /*********************************************************************/
                /* Pointer to Luma buffer for processing.                            */
                /*********************************************************************/
                //pObj->chParams[chIdx].curFrame = pFrame->addr[0][0];

                pInFrameInfo = (System_FrameInfo *) pFrame->appData;

                //curTime = Utils_getCurTimeInMsec();
          //      Vps_printf("width:%d  ,height: %d  \r\n",pInFrameInfo->rtChInfo.width,pInFrameInfo->rtChInfo.height);   
                pBufferStart=pFrame->addr[0][0];
                for(i=0;i<pInFrameInfo->rtChInfo.height;i++){
                      pBuffer=pBufferStart+(i*pInFrameInfo->rtChInfo.width*2);
                      for(j=0;j<pInFrameInfo->rtChInfo.width/2;j++){
                               y0pixel=pBuffer;
                               y1pixel=pBuffer+2;
                               upixel=pBuffer+1;
                               vpixel=pBuffer+3;
                      if(i==1&&j<5)
			// Vps_printf("y0pixel: %d ,upixel: %d ,y1pixel: %d ,vpixel: %d \r\n",*y0pixel,*upixel,*y1pixel,*vpixel);
                               *upixel=0;
                               *vpixel=0;
                               pBuffer+=4;
			       //if(i==1&&j<5)
			//  Vps_printf("y0pixel: %d ,upixel: %d ,y1pixel: %d ,vpixel: %d \r\n",*y0pixel,*upixel,*y1pixel,*vpixel);
                      }

                      

                }
		//  Vps_printf("pbufferstart:%d  ,pBuffer:%d  ,y0pixel:%d  ,vpixel:%d   \r\n",pBufferStart,pBuffer,y0pixel,vpixel);
               
                /*********************************************************************/
                /* Make a call to algorithm process call here                        */
                /*********************************************************************/
                HELLOWORLDALG_TI_process(pObj->algHndl, 0, pHelloWorldResult);//HelloWorldLink_algProcess();

                /*********************************************************************/
                /* Benchmark frame process time                                      */
                /*********************************************************************/
                //pChObj->inFrameProcessTime += (Utils_getCurTimeInMsec() - curTime);

                //pChObj->inFrameProcessCount++;
                outBitBufList.bufs[outBitBufList.numBufs] = pOutBuf;
                outBitBufList.numBufs++;
                tempBitBufList.numBufs=outBitBufList.numBufs;

            }
            else
            {
                //pChObj->inFrameUserSkipCount++;
            }
        }