Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

DVR RDK Use case using Link API's

$
0
0

HI,

  I just started working on RDK  (DVRRDK_03.00.00.00) . And I am working at the Link API level. I am trying to create on use case "Multi channel capture, encode  and record". I use /dvr_rdk/demos/link_api_demos/common/chains_ipcBits.c functions to dump the output to file. The chain is not successful and I am not able to see any output written in the file. Please help me to debug my use case.

This is the application file I wrote by referring other Link API demos.

   #include <demos/link_api_demos/common/chains.h>

/*
                      Capture (YUV422I) 16CH D1 60fps
                          |
                          |
                         NSF (YUV420SP)
                          |
                          |
                         ENC (H264)
                          |
                          |
                       FWRITE (FILE)
*/

/*IVA HD MAP Table*/
static SystemVideo_Ivahd2ChMap_Tbl systemVid_encDecIvaChMapTbl =
{
    .isPopulated = 1,
    .ivaMap[0] =
    {
        .EncNumCh  = 10,
        .EncChList = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0 , 0, 0},
        .DecNumCh  = 0,
        .DecChList = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    },
    .ivaMap[1] =
    {
        .EncNumCh  = 16,
        .EncChList = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31},
        .DecNumCh  = 12,
        .DecChList = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0 , 0, 0},
    },
    .ivaMap[2] =
    {
        .EncNumCh  = 6,
        .EncChList = {10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
        .DecNumCh  = 4,
        .DecChList = {12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    },
};



Void Chains_multiChCaptureNsfDei(Chains_Ctrl *chainsCfg)
{
    CaptureLink_CreateParams    capturePrm;
    NsfLink_CreateParams        nsfPrm;

    IpcLink_CreateParams        ipcOutVpssPrm;
    IpcLink_CreateParams        ipcInVideoPrm;

    EncLink_CreateParams        encPrm;

    IpcBitsOutLinkRTOS_CreateParams   ipcBitsOutVideoPrm;
    IpcBitsInLinkHLOS_CreateParams    ipcBitsInHostPrm;


    CaptureLink_VipInstParams *pCaptureInstPrm;
    CaptureLink_OutParams     *pCaptureOutPrm;

    UInt32 captureId, nsfId, encId;
    UInt32 vipInstId, i;
    UInt32 ipcBitsOutVpssId, ipcBitsInVideoId;
    UInt32 ipcBitsOutVideoId, ipcBitsInHostId;

    Bool switchCh;
    Bool switchLayout;

    char ch;

    captureId           = SYSTEM_LINK_ID_CAPTURE;
    nsfId               = SYSTEM_LINK_ID_NSF_0;
    encId                = SYSTEM_LINK_ID_VENC_0;
    ipcBitsOutVpssId     = SYSTEM_VPSS_LINK_ID_IPC_OUT_M3_0;
    ipcBitsInVideoId     = SYSTEM_VIDEO_LINK_ID_IPC_IN_M3_0;
    ipcBitsOutVideoId    = SYSTEM_VIDEO_LINK_ID_IPC_OUT_M3_0;
    ipcBitsInHostId       = SYSTEM_HOST_LINK_ID_IPC_BITS_IN_0;


    System_linkControl(
        SYSTEM_LINK_ID_M3VIDEO,
        SYSTEM_COMMON_CMD_SET_CH2IVAHD_MAP_TBL,
        &systemVid_encDecIvaChMapTbl,
        sizeof(SystemVideo_Ivahd2ChMap_Tbl),
        TRUE
    );

    Chains_ipcBitsInit();
    CHAINS_INIT_STRUCT(CaptureLink_CreateParams, capturePrm);
    CHAINS_INIT_STRUCT(NsfLink_CreateParams, nsfPrm);
    CHAINS_INIT_STRUCT(IpcLink_CreateParams, ipcOutVpssPrm);
    CHAINS_INIT_STRUCT(IpcLink_CreateParams, ipcInVideoPrm);
    CHAINS_INIT_STRUCT(EncLink_CreateParams, encPrm);
    CHAINS_INIT_STRUCT(IpcBitsOutLinkRTOS_CreateParams, ipcBitsOutVideoPrm);
    CHAINS_INIT_STRUCT(IpcBitsInLinkHLOS_CreateParams, ipcBitsInHostPrm);

    CaptureLink_CreateParams_Init(&capturePrm);
    capturePrm.numVipInst = 4;

    capturePrm.outQueParams[0].nextLink = nsfId;
    capturePrm.tilerEnable = FALSE;

    for(vipInstId=0; vipInstId<capturePrm.numVipInst; vipInstId++)
    {
        pCaptureInstPrm                     = &capturePrm.vipInst[vipInstId];
        pCaptureInstPrm->vipInstId          = (SYSTEM_CAPTURE_INST_VIP0_PORTA+vipInstId)%SYSTEM_CAPTURE_INST_MAX;
        pCaptureInstPrm->videoDecoderId     = SYSTEM_DEVICE_VID_DEC_TVP5158_DRV;
        pCaptureInstPrm->inDataFormat       = SYSTEM_DF_YUV422P;
        pCaptureInstPrm->standard           = SYSTEM_STD_MUX_4CH_D1;
        pCaptureInstPrm->numOutput          = 1;

        pCaptureOutPrm                      = &pCaptureInstPrm->outParams[0];
        pCaptureOutPrm->dataFormat          = SYSTEM_DF_YUV422I_YUYV;
        pCaptureOutPrm->scEnable            = FALSE;
        pCaptureOutPrm->scOutWidth          = 0;
        pCaptureOutPrm->scOutHeight         = 0;
        pCaptureOutPrm->outQueId            = 0;
    }
/**
 * Capture to Noise Filter
 **/

    nsfPrm.bypassNsf                = FALSE;
    nsfPrm.tilerEnable              = FALSE;
    nsfPrm.inQueParams.prevLinkId   = captureId;
    nsfPrm.inQueParams.prevLinkQueId= 0;
    nsfPrm.numOutQue                = 1;
    nsfPrm.tilerEnable                = FALSE;
    nsfPrm.outQueParams[0].nextLink = ipcBitsOutVpssId;

/**
* Noise Filter to ipcBitsOutVpss
**/

    ipcOutVpssPrm.inQueParams.prevLinkId    = nsfId;
    ipcOutVpssPrm.inQueParams.prevLinkQueId = 1;
    ipcOutVpssPrm.numOutQue                 = 1;
    ipcOutVpssPrm.notifyNextLink            = FALSE;
    ipcOutVpssPrm.notifyPrevLink            = TRUE;
    ipcOutVpssPrm.noNotifyMode              = TRUE;
    ipcOutVpssPrm.outQueParams[0].nextLink     = ipcBitsInVideoId;
/**
* ipcBitsOutVpss to ipcBitsInVideo
**/
    ipcInVideoPrm.inQueParams.prevLinkId    = ipcBitsOutVpssId;
    ipcInVideoPrm.inQueParams.prevLinkQueId = 0;
    ipcInVideoPrm.numOutQue                 = 1;
    ipcInVideoPrm.notifyNextLink            = TRUE;
    ipcInVideoPrm.notifyPrevLink            = FALSE;
    ipcInVideoPrm.noNotifyMode              = TRUE;
    ipcInVideoPrm.outQueParams[0].nextLink  = encId;
/**
* ipcBitsInVideo to Encoder
**/
    for (i=0; i<16; i++) {
        encPrm.chCreateParams[i].format     = IVIDEO_H264HP;
        encPrm.chCreateParams[i].profile    = IH264_HIGH_PROFILE;
        encPrm.chCreateParams[i].dataLayout = IVIDEO_FIELD_SEPARATED;
        encPrm.chCreateParams[i].fieldMergeEncodeEnable  = TRUE;
        encPrm.chCreateParams[i].defaultDynamicParams.intraFrameInterval = 30;
        encPrm.chCreateParams[i].encodingPreset = XDM_DEFAULT;
        encPrm.chCreateParams[i].enableAnalyticinfo = 0;
        encPrm.chCreateParams[i].enableWaterMarking = 0;
        encPrm.chCreateParams[i].rateControlPreset =
                                 IVIDEO_STORAGE;
        encPrm.chCreateParams[i].defaultDynamicParams.inputFrameRate = 30;
        encPrm.chCreateParams[i].defaultDynamicParams.targetBitRate =
                                 (2 * 1000 * 1000);
        encPrm.chCreateParams[i].defaultDynamicParams.interFrameInterval = 1;
        encPrm.chCreateParams[i].defaultDynamicParams.mvAccuracy =
                                 IVIDENC2_MOTIONVECTOR_QUARTERPEL;
    }
    encPrm.inQueParams.prevLinkId   = ipcBitsInVideoId;
    encPrm.inQueParams.prevLinkQueId= 0;
    encPrm.outQueParams.nextLink = ipcBitsOutVideoId;
/**
* Encoder to ipcBitsOutVideo
**/
    ipcBitsOutVideoPrm.baseCreateParams.inQueParams.prevLinkId = encId;
    ipcBitsOutVideoPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
    ipcBitsOutVideoPrm.baseCreateParams.numOutQue                 = 1;
    ipcBitsOutVideoPrm.baseCreateParams.outQueParams[0].nextLink = ipcBitsInHostId;
    Chains_ipcBitsInitCreateParams_BitsOutRTOS(&ipcBitsOutVideoPrm, FALSE);

    ipcBitsInHostPrm.baseCreateParams.inQueParams.prevLinkId = ipcBitsOutVideoId;
    ipcBitsInHostPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
    ipcBitsInHostPrm.baseCreateParams.noNotifyMode = FALSE;
    Chains_ipcBitsInitCreateParams_BitsInHLOS(&ipcBitsInHostPrm);

    System_linkCreate(captureId, &capturePrm, sizeof(capturePrm));
    System_linkControl(captureId, CAPTURE_LINK_CMD_CONFIGURE_VIP_DECODERS, NULL, 0, TRUE);
    System_linkCreate(nsfId, &nsfPrm, sizeof(nsfPrm));
    System_linkCreate(ipcBitsOutVpssId, &ipcOutVpssPrm, sizeof(ipcOutVpssPrm));
    System_linkCreate(ipcBitsInVideoId, &ipcInVideoPrm, sizeof(ipcInVideoPrm));
    System_linkCreate(encId, &encPrm, sizeof(encPrm));
    System_linkCreate(ipcBitsOutVideoId, &ipcBitsOutVideoPrm, sizeof(ipcBitsOutVideoPrm));
    System_linkCreate(ipcBitsInHostId, &ipcBitsInHostPrm, sizeof(ipcBitsInHostPrm));

    Chains_memPrintHeapStatus();

    {
        System_linkStart(ipcBitsInHostId);
        System_linkStart(ipcBitsOutVideoId);
        System_linkStart(encId);
        System_linkStart(ipcBitsInVideoId);
        System_linkStart(ipcBitsOutVpssId);
        System_linkStart(nsfId);
        System_linkStart(captureId);

        //Start taking CPU load just before starting of links
         Chains_prfLoadCalcEnable(TRUE, FALSE, FALSE);

        while(1)
        {
            switchLayout = FALSE;
            switchCh     = FALSE;

            ch = Chains_menuRunTime();

            if(ch=='0')
                break;
            if(ch=='p')
                System_linkControl(captureId, CAPTURE_LINK_CMD_PRINT_ADV_STATISTICS, NULL, 0, TRUE);
            if(ch=='s')
               switchLayout = TRUE;
            if(ch=='c')
               switchCh = TRUE;
        }

        System_linkStop(captureId);
        System_linkStop(nsfId);
        Chains_ipcBitsStop();
        System_linkStop(ipcBitsOutVpssId);
        System_linkStop(ipcBitsInVideoId);
        System_linkStop(encId);
        System_linkStop(ipcBitsOutVideoId);
        System_linkStop(ipcBitsInHostId);
    }

    System_linkDelete(captureId);
    System_linkDelete(nsfId);
    System_linkDelete(ipcBitsOutVpssId);
    System_linkDelete(ipcBitsInVideoId);
    System_linkDelete(encId);
    System_linkDelete(ipcBitsOutVideoId);
    System_linkDelete(ipcBitsInHostId);
    Chains_ipcBitsExit();

    /* Print the HWI, SWI and all tasks load */
    /* Reset the accumulated timer ticks */
    Chains_prfLoadCalcEnable(FALSE, TRUE, FALSE);
}

Is there any flaw in the above chain creation? I have experience with EZSDK. I have no clue to debug an use case in RDK. Please help as early as possible.


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>