This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

问题:dm8127 mcfw dsp 端加算法图像无变化



dear TI masters,

dsp端加算法,最简单的图像处理,但从显示的图像没有变化。

我是在ipnc_mcfw\mcfw\src_bios6\links_c6xdsp\alg_link 目录下加的,scd和osd都加了,试过没有什么变化,

我编译的时候,也选了full feature ,而且boot的时候也 置1了

algLink_priv.c文件

#define MY_FUNCTION 1

#if MY_FUNCTION
Uint8 myProcImage1[320 * 190];
#endif

Int32 AlgLink_algProcessData(AlgLink_Obj * pObj)
{
    UInt32 frameId, status;
    System_LinkInQueParams *pInQueParams;
    FVID2_Frame *pFrame;

    FVID2_FrameList frameList;
#if MY_FUNCTION
    Uint8* ucPtr;
    int i;
#endif

    pInQueParams = &pObj->createArgs.inQueParams;
    System_getLinksFullFrames(pInQueParams->prevLinkId,
                              pInQueParams->prevLinkQueId, &frameList);



    if (frameList.numFrames)
    {
        /* SCD should be done first as it requires to operate on raw YUV */
        if (pObj->createArgs.enableSCDAlg)
        {
            status = AlgLink_ScdalgProcessData(&pObj->scdAlg, &frameList, &pObj->outObj[0].bufOutQue);

            if (status == FVID2_SOK)
            {
                /* Send-out the output bitbuffer */
                System_sendLinkCmd(pObj->createArgs.outQueParams.nextLink,
                                   SYSTEM_CMD_NEW_DATA);
            }

        }

        for(frameId = 0; frameId < frameList.numFrames; frameId++)
        {


/////////////////////////////////////////////////////////////////
#if MY_FUNCTION
            pFrame = frameList.frames[frameId];


            ucPtr = (unsigned char*)pFrame->addr[0][0];

            memcpy( myProcImage1,ucPtr, 320 * 190);

            for (i = 0 ; i < 320 * 190 ; i++)
            {
                if (myProcImage1[i] < 168)
                    myProcImage1[i] = 255;
                else
                    myProcImage1[i] = 255;
            }
Vps_printf(" kxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n");
            memcpy(ucPtr, myProcImage1, 320 * 190);
#endif
/////////////////////////////////////////////////////////////////

            if(pFrame->channelNum >= pObj->inQueInfo.numCh)
                continue;

            // do SW OSD
            if (pObj->createArgs.enableOSDAlg)
            {
                    Vps_printf(" xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n");
                 AlgLink_OsdalgProcessFrame(&pObj->osdAlg, pFrame);
            }
        }
        System_putLinksEmptyFrames(pInQueParams->prevLinkId,
                                   pInQueParams->prevLinkQueId, &frameList);
    }

    return FVID2_SOK;
}

而且发现,程序没有运行到这个函数,我加了打印。

====================================

另外在va下面加,也是没有什么变化,

ipnc_rdk_ga_release3.5.0\example-applications.git\ipnc_mcfw\mcfw\src_bios6\links_common\va

Int32 cnt_frame = 0;

#define MY_FUNCTION_8 1
#define MY_FUNCTION_1 1
#define MY_FUNCTION_5 1
#define MY_FUNCTION_4 1

#define WIDTH_P 640
#define HEIGHT_P 480

#if MY_FUNCTION_4
Uint32 myProcImage6[320 * 190];
#endif


Int32 VaLink_algProcessFrames(VaLink_Obj *pObj)
{
    Int32 status;
    VaLink_algObj *pAlgObj = &pObj->algObj;
    Int32 libStatus;
    DMVALhandle *pDmvaHndl = &pAlgObj->dmvalHndl;
    DMVALimage inImage;
    UInt32 frameId;
    FVID2_Frame *pFullFrame;
    FVID2_Frame *pEmptyFrame;
#if MY_FUNCTION_8
#if MY_FUNCTION_4
    Uint8* ucPtr;
    int i;
    
    int j;
#endif
#endif



#ifdef VA_PROFILE
    UInt32 start, end;
#endif

    do
    {
        /* Get the frame from the full queue */
        status = Utils_bufGetFullFrame(&pObj->outFrameQue, &pFullFrame, BIOS_NO_WAIT);

        if ((status == FVID2_SOK) && (pFullFrame != NULL))
        {
            /***************************
                 VA ALG APPLY HERE
            ***************************/
            inImage.size        = sizeof(DMVALimage);
            inImage.timeStamp   = VaLink_algGetFrameTS(pObj, pFullFrame->timeStamp);
            inImage.type        = DMVAL_IMG_YUV420_PLANARINTERLEAVED;
            inImage.pixelDepth  = DMVAL_PIXEL_U08;
            inImage.width       = pAlgObj->params.maxWidth;
            inImage.height      = pAlgObj->params.maxHeight;
            inImage.imageStride = pAlgObj->inStride;
            inImage.horzOffset  = 0;
            inImage.vertOffset  = 0;
            inImage.imageData   = pFullFrame->addr[0][0];
            inImage.inputId     = ((VaLink_perFrameConfig*)pFullFrame->perFrameCfg)->bufId;
            inImage.focusValue  = VaLink_algGetFocusValue(pObj);
            inImage.type        = DMVAL_IMG_YUV420_PLANARINTERLEAVED;



            /* 算法添加测试 */
            cnt_frame++;
            if (cnt_frame >= 30)
            {
                cnt_frame = 0;
                Vps_printf("width: %d, height: %d\n", inImage.width, inImage.height);
            }

#ifdef VA_PROFILE
            start = Utils_getCurTimeInMsec();
#endif
//            pImg = (unsigned char * )  pFullFrame->addr[0][0];
//            for(y_i = 0; y_i < inImage.width * inImage.height; y_i++)
//            {
//                *(pImg + y_i) = 0x80;
//                y_i++;
//               // if(*(pImg + y_i) ==45)
//                  //  Vps_printf("*(pImg + y_i) %d  width: %d, height: %d\n", *(pImg + y_i),inImage.width, inImage.height);
//            }

#if MY_FUNCTION_8
#if 0


            ucPtr = (Uint8*)pFullFrame->addr[0][0];

            memcpy(myProcImage6, ucPtr, 320 * 190);

            for (i = 0 ; i < 320 * 190 ; i++)
            {
                //if (myProcImage6[i] < 0x80)
                //   myProcImage6[i] = 0;
                //else
                myProcImage6[i] = 255;



            }

            memcpy(ucPtr, myProcImage6, 320 * 190);
#else


            ucPtr = (Uint8*)pFullFrame->addr[0][0];


            for (i = 0 ; i < 190 ; i++)
            {
                for (j = 0 ; j < 320 ; j++)
                {
                    if (ucPtr[i * 1920 + j] < 128)
                        ucPtr[i * 1920 + j] = 240;
                    else
                        ucPtr[i * 1920 + j] = 245;
                }
            }
#endif
#endif

            /* libStatus = DMVAL_process(pDmvaHndl,
                                       &inImage,
                                       &pAlgObj->output);*/
            libStatus = DMVAL_process(pDmvaHndl,
                                      &inImage,
                                      &pAlgObj->output);





            UTILS_assert(libStatus == DMVAL_NO_ERROR);

            status = VaLink_algCreateMetaData(pObj);
            UTILS_assert(status == FVID2_SOK);

#ifdef VA_PROFILE
            end = Utils_getCurTimeInMsec();
            pAlgObj->totalProcessTime += (end - start);
#endif

            pAlgObj->processFrCnt ++;

            if(pAlgObj->processFrCnt >= 900)
            {
                Vps_printf(" %d: VA   : ######################################### !!!\n",
                           Clock_getTicks());
#ifdef VA_PROFILE
                Vps_printf(" %d: VA   : Peroidic Avg Process time = %d msec/frame !!!\n",
                           Clock_getTicks(), pAlgObj->totalProcessTime / pAlgObj->processFrCnt);
#else
                Vps_printf(" %d: VA   : Peroidic print !!!\n", Clock_getTicks());
#endif
                Vps_printf(" %d: VA   : ######################################### !!!\n",
                           Clock_getTicks());
                pAlgObj->processFrCnt     = 0;
                pAlgObj->totalProcessTime = 0;
            }

            for(frameId = 0; frameId < DMVAL_MAX_BUFFER_LOCK; frameId ++)
            {
                /* The array ends with Id equal to 0 */
                if(pAlgObj->output.freeBufId[frameId] == 0)
                {
                    break;
                }

                pEmptyFrame = &pObj->outFrames[pAlgObj->output.freeBufId[frameId] - 1];
#if MY_FUNCTION_8
//#if MY_FUNCTION_5
#if 0


                ucPtr = (UInt8*)pEmptyFrame->addr[0][0];

                memcpy(myProcImage6, ucPtr, 320 * 190);

                for (i = 0 ; i < 320 * 190 ; i++)
                {
                    //   if (myProcImage6[i] < 168)
                    //       myProcImage6[i] = 0;
                    //  else
                    myProcImage6[i] = 255;
                }

                memcpy(ucPtr, myProcImage6, 320 * 190);
#else
                ucPtr = (Uint8*)pFullFrame->addr[0][0];

                for (i = 0 ; i < 190 ; i++)
                {
                    for (j = 0 ; j < 320 ; j++)
                    {
                        if (ucPtr[i * 1920 + j] < 128)
                            ucPtr[i * 1920 + j] = 240;
                        else
                            ucPtr[i * 1920 + j] = 245;
                    }
                }
#endif
#endif
                /* Put the frames back which are marked as free by DMVAL_process */
                status = Utils_bufPutEmptyFrame(&pObj->outFrameQue, pEmptyFrame);
                UTILS_assert(status == FVID2_SOK);
            }
        }
    }
    while ((status == FVID2_SOK) && (pFullFrame != NULL));

    return FVID2_SOK;
}

==========================

再补一个问题,有没有 采集----->dsp-处理----》显示。这样简单的demo。
不知道哪里有问题,请ti专家帮忙看看,谢谢

BRS