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.

add DSP link to Multich_vdec_vdis.c example

Hi all,

I have the decode display demo running successfully on my DVR RDK for 8168. I would like to add a link to the DSP so the DSP can analyze the frames which are decoded.


To which link in the existing link chain should the DSP link be connected? And it is a "process link" or do I need a "frames in" link?

IPC_BITS_OUT_A8 (BitStream)
|
IPC_BITS_IN (Video)
|
DEC (YUV420SP)
|
IPC_OUT (Video)
|
IPC_IN (Vpss)
|   (32 D1 + 10 720P + 6 1080P)
MP_SCLR (Vpss)
|
DUP
(48CH)    | |    (48CH)
+---------------+ +-------------+
|                               |
|                               |
SW Mosaic                       SW Mosaic
(SC5 SC1 YUV422I)                (SC4 SC2 YUV422I)
|  |                             |  |
|  |                             |  |
(DDR)(422I)                      (DDR)(422I)
|                               |
GRPX0   |                      GRPX1    |
|    |                          |    |
On-Chip HDMI                    Off-Chip HDMI
1080p60                        1080p60

should I connect it after the MPSCLR and before the DUP?

Any links to related questions on the forum or example code would be greatly appreciated!

Thanks,

Aaron

  • You can add dspLink after MpSclr link . WIll the DSP algorithm be processing the video frames at native resolution or do you require the frames to be scaled before DSP algLink analysis. If you can process native decode resolution upto 1080P then the data flow should be

    MpSclr -> ipcFramesOutVpss -> (processLink) -> ipcFramesInDsp ->algLink

                                                     -> (nextLink) -> dupLink -> remaining data flow is the same.  

     

    I

  • Thank you very much Badri for your assistance, I succeeded to add the process link as you suggested.

    I have a small question about process links, is it true that for each frame the frame will go to the process link and until we call

    System_putLinksEmptyFrames(pInQueParams->prevLinkId, pInQueParams->prevLinkQueId,&frameList);

    in algLink_priv.c

    the next link after ipcFramesOutVpss does not recieve the new frames?

    (in other words the process link is blocking???)

    I tried to write to the memory of the frames in the y buffer from inside the DSP in two for loops (not efficient, I know) to make a black square in the picture (for testing)

    when i did this I saw that the picture of the output movies from the example had a black square but it was sort of flashing and some of the lines of the square were not being show, as if the memory was switching faster than I could write to it ...

    in the process link do the frames refer to the same memory locations that the frames which the next link (dup) will get? or is the memory being copied in and out of the process link somewhere ... ???

     

    thanks!

     

    Aaron Lieber

     

  • ProcessLink is blocking and the next link doesn't get access to the frame until the processLink frees the buffer.

     

    This could be issue with avsync dropping video frames as frames are out of realtime. You can check disabling avsync in

    /dvr_rdk/mcfw/src_linux/mcfw_api/usecases/ti81xx/multich_vdec_vdis.c

     

    mulich_vdec_vdis_set_avsync_vidque_prm

     

    queCfg->avsyncEnable = TRUE;

    change to

    queCfg->avsyncEnable = FALSE;

     

    Another issue could be you are not doing Cache_coherency operation after writing to the buffer. You should do Cache_wbInv before releasing the buffer if you update its contents via CPU

  • Thank you for your help. In fact, it was a Cache_coherency problem and now I am not seeing the missing lines anymore.

    After processing with the DSP, I would like to add a link to encode only one of the frames and write it to disk.

     

    Right now my link chain looks like this:

    (same as original example)

    ...

    MP_SCLR

       |

    IpcVpssOut -----> (process link) ipcDspIn ---> DspAlgLink

    |

    Dup

    ... (same as original example)

    Looking again at the examples of multich_vdec_vis.c and multich_vcap_venc_vdis.c, if I understand correctly, I need to add another Dup link before the existing Dup, and on the 2nd leg of this new Dup link add the following link chain:

    IPC_IN (m3)

       |

    Encode (1 CH D1)

       |

    IPC Bits out (M3)

      |

    IPC_BITS_IN (a8)

     

    so I have two questions:

    1) How do I set up the encode link just to encode 1 of the 16 channels it will be receiving from the previous dup link?

    2) where is the code which tells the A8 where to save the file and that it needs to save to disk at all?

     

    I see the linking being done in multich_vcap_venc_vdis.c to send the encoded bits to the A8 but I don't see any sort of configuration for the A8 or code which saves something to disk ...

     

    Thanks!

    Aaron Lieber

  • DupLink can have multiple output queues. So you can have 3 output queues as:

     

            Que0  -- SwMs 0

    Dup Que1  -- SwMs 1

            Que 2 -- ipcOutM3 (VPSS) -- ipcInM3 (Video) -- encLink -- ipcBitsOut -- ipcBitsIn (A8)

    This is the simplest configuration and here encLInk will get created for 16 channels. i.e You have to set valid coding type for all 16 channels. You can disable the encode channels that you don't require after creation using ENC_LINK_CMD_DISABLE_CHANNEL

    You can set required encode fps for the enabled channel using ENC_LINK_CMD_SET_CODEC_INPUT_FPS and ENC_LINK_CMD_SET_CODEC_FPS

     

    If you are using MCFW APIs you get the encoded bitstream using Venc_getBiststreamBuffer() and free the buffer using Venc_putBitstreamBuffer API. Refer /dvr_rdk/demos/mcfw_api_demos/mcfw_demo/demo_vcap_venc_vdis_bits_wr.c

    If you are using only the link API directly the functions to use are IpcBitsInLink_getFullVideoBitStreamBufs and IpcBitsInLink_putEmptyVideoBitStreamBufs

     

     

     

  • Hi Badri,

    I am trying to add encoding and I adapted some code from multich_vcap_venc_vdis.c and from demo_vcap_venc_vdec_dis.c and demo_vcap_venc_vdis_bits_wr.c into multich_vdec_vdis.c and demo_vdec_vdis.c

    However I my link chain is not being set up, it is being stuck by an assert in the function EncLink_codecCreate in file encLink_common.c:

    UTILS_assert(pPrm->inQueParams.prevLinkQueId < pObj->inTskInfo.numQue);

    apparently both values are 0

    I don't understand how I can set the number of queues in the encoder link (to 1 like it is for the multich_vcap_venc_vdis demo and not 0 how it currently is ... )

    where can I set this number of queues to 1 ???

    Thanks,

    Aaron

  • Sorry I realized I should have included the modified example files ...

    6076.multich_vdec_vdis.c
    /*******************************************************************************
     *                                                                             *
     * Copyright (c) 2009 Texas Instruments Incorporated - http://www.ti.com/      *
     *                        ALL RIGHTS RESERVED                                  *
     *                                                                             *
     ******************************************************************************/
    /*  ========================= TI_816X_BUILD case ==============================
                              |
                            IPC_BITS_OUT_A8 (BitStream)
                              |
                            IPC_BITS_IN (Video)
                              |
                            DEC (YUV420SP)
                              |
                            IPC_OUT (Video)
                              |
                            IPC_IN (Vpss)
                              |   (32 D1 + 10 720P + 6 1080P)
                            MP_SCLR (Vpss)
                              |
    
    						  ------------------------process link dsp-------------
    			       |
    			       |
                             DUP
                   (48CH)    | |    (48CH)             // add decode link for ch 1  Que 2 -- ipcOutM3 (VPSS) -- ipcInM3 (Video) -- encLink -- ipcBitsOut -- ipcBitsIn (A8)
             +---------------+ +-------------+-----------------------------------
             |                               |                                                                         |
             |                               |                                                                 ipcOutM3 (VPSS)
          SW Mosaic                       SW Mosaic                                                           |
         (SC5 SC1 YUV422I)                (SC4 SC2 YUV422I)                                   ipcInM3 (Video)
            |  |                             |  |                                                                     |
            |  |                             |  |                                                                 encLink
           (DDR)(422I)                      (DDR)(422I)                                                       |
              |                               |                                                                    ipcBitsOut
      GRPX0   |                      GRPX1    |                                                                 |
         |    |                          |    |                                                                  ipcBitsIn(A8)
         On-Chip HDMI                    Off-Chip HDMI
           1080p60                        1080p60
    */
    
    /* ========================= TI_814X_BUILD case ==============================
                              |
                            IPC_BITS_OUT_A8 (BitStream)
                              |
                            IPC_BITS_IN (Video)
                              |
                            DEC (YUV420SP)
                              |
                            IPC_OUT (Video)
                              |
                            IPC_IN (Vpss)
                              |   (16 channels)
                            MP_SCLR (Vpss)
                              |
                             DUP
                   (16CH)    | |    (16CH)
             +---------------+ +-------------+
             |                               |
             |                               |
          SW Mosaic                       SW Mosaic
         (SC5 YUV422I)                (SC5 YUV422I)
            |  |                             |  |
            |  |                             |  |
           (DDR)(422I)                      (DDR)(422I)
              |                               |
      GRPX0   |----Tied---|                   |
         |    |           |                   |
         On-Chip HDMI  Off-Chip HDMI         SDTV
           1080p60       1080p60
    */
    
    #include "multich_common.h"
    #include "multich_ipcbits.h"
    #include "mcfw/interfaces/link_api/system_tiler.h"
    #include "mcfw/interfaces/link_api/avsync_hlos.h"
    
    /* =============================================================================
     * Externs
     * =============================================================================
     */
    
    
    /* =============================================================================
     * Use case code
     * =============================================================================
     */
    
    
    
    #define MAX_DEC_OUT_FRAMES_PER_CH                           (5)
    #define MULTICH_VDEC_VDIS_IPCFRAMEEXPORT_NUM_CHANNELS       (16)
    #define MULTICH_VDEC_VDIS_IPCFRAMEEXPORT_FRAME_WIDTH        (720)
    #define MULTICH_VDEC_VDIS_IPCFRAMEEXPORT_FRAME_HEIGHT       (480)
    #define MULTICH_NUM_SWMS_MAX_BUFFERS                        (7)
    
    #define ENABLE_STATIC_CHANNELS_IN_TILED_MODE                (FALSE)
    
    
    #if defined(TI_814X_BUILD) || defined(TI_8107_BUILD)
    static SystemVideo_Ivahd2ChMap_Tbl systemVid_encDecIvaChMapTbl =
    {
        .isPopulated = 1,
        .ivaMap[0] =
        {
            .EncNumCh  = 0,
            .EncChList = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0},
    
            .DecNumCh  = 16,
            .DecChList = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
        },
    };
    #define NUM_STATIC_CHANNELS   (6)
    #else
    /*
    Max channels per IVA-HD MUST be < 16,
    i.e total number of channels for decode can be 48.
    
    Example CH allocation for SD+HD,
    
    32CH SD    :  0 to 31
     6CH 1080P : 32 to 38
    10CH 720P  : 39 to 48
    
    */
    static SystemVideo_Ivahd2ChMap_Tbl systemVid_encDecIvaChMapTbl =
    {
        .isPopulated = 1,
        .ivaMap[0] =
        {
            .EncNumCh  = 0,
            .EncChList = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0},
    
            .DecNumCh  = 17,
            .DecChList = {   0,  3,  6,  9, 12, 15, 18, 21,
                            24, 27, 30, 33, 36, 39, 42, 45,
                            48
                         },
        },
        .ivaMap[1] =
        {
            .EncNumCh  = 0,
            .EncChList = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0},
    
            .DecNumCh  = 17,
            .DecChList = {   1,  4,  7, 10, 13, 16, 19, 22,
                            25, 28, 31, 34, 37, 40, 43, 46,
                            49
                         },
        },
        .ivaMap[2] =
        {
            .EncNumCh  = 0,
            .EncChList = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0},
    
            .DecNumCh  = 16,
            .DecChList = {   2,  5,  8, 11, 14, 17, 20, 23,
                            26, 29, 32, 35, 38, 41, 44, 47
                         },
        },
    };
    #define NUM_STATIC_CHANNELS   (8)
    #endif
    
    typedef struct {
    
        UInt32 dupId;
        UInt32 ipcOutVideoId;
        UInt32 ipcInVpssId;
        UInt32 mergeId;
        Bool   enableVideoFrameExport;
        AvsyncLink_LinkSynchConfigParams   avsyncCfg[VDIS_DEV_MAX];
        UInt32 mpSclrId;
    
    
        // new stuff --- for DSP
        UInt32 ipcFramesOutVpssId;
        UInt32 ipcFramesInDspId;
        UInt32 dspAlgId;
    
        //////////////////////////
        // new stuff --- for ENCODE
        //UInt32 ipcOutVpssId; 
        //UInt32 ipcM3InId;
        //UInt32 encId;
        //UInt32 ipcBitsOutRTOSId;
        //UInt32 ipcBitsInHLOSId;
    
        // needed???
        UInt32 ipcOutVpssId;
        UInt32 ipcInVideoId;
        /////////////////////////	
    	
    
    } MultiCh_VdecVdisObj;
    
    MultiCh_VdecVdisObj gMultiCh_VdecVdisObj;
    
    static Void MultiCh_setIpcFramesOutInQueInfo(System_LinkQueInfo *inQueInfo)
    {
        Int i;
    
        inQueInfo->numCh = MULTICH_VDEC_VDIS_IPCFRAMEEXPORT_NUM_CHANNELS;
        for (i = 0; i < inQueInfo->numCh; i++)
        {
            inQueInfo->chInfo[i].bufType = SYSTEM_BUF_TYPE_VIDFRAME;
            inQueInfo->chInfo[i].dataFormat = SYSTEM_DF_YUV422I_YUYV;
            inQueInfo->chInfo[i].memType    = SYSTEM_MT_NONTILEDMEM;
            inQueInfo->chInfo[i].scanFormat = SYSTEM_SF_PROGRESSIVE;
            inQueInfo->chInfo[i].startX     = 0;
            inQueInfo->chInfo[i].startY     = 0;
            inQueInfo->chInfo[i].width      =
                       MULTICH_VDEC_VDIS_IPCFRAMEEXPORT_FRAME_WIDTH;
            inQueInfo->chInfo[i].height     =
                       MULTICH_VDEC_VDIS_IPCFRAMEEXPORT_FRAME_HEIGHT;
            inQueInfo->chInfo[i].pitch[0]   =
                       MULTICH_VDEC_VDIS_IPCFRAMEEXPORT_FRAME_WIDTH * 2;
            inQueInfo->chInfo[i].pitch[1]   = 0;
            inQueInfo->chInfo[i].pitch[2]   = 0;
        }
    }
    
    static
    Void mulich_vdec_vdis_set_avsync_vidque_prm(Avsync_SynchConfigParams *queCfg,
                                                Int chnum,
                                                UInt32 avsStartChNum,
                                                UInt32 avsEndChNum,
                                                VDIS_DEV vdDevId)
    {
        queCfg->chNum = chnum;
        queCfg->audioPresent = FALSE;
        if ((queCfg->chNum >= avsStartChNum)
            &&
            (queCfg->chNum <= avsEndChNum)
            &&
            (gVsysModuleContext.vsysConfig.enableAVsync))
        {
            queCfg->avsyncEnable = TRUE;
        }
        else
        {
            queCfg->avsyncEnable = FALSE;
        }
        queCfg->clkAdjustPolicy.refClkType = AVSYNC_REFCLKADJUST_NONE;
        queCfg->clkAdjustPolicy.clkAdjustLead = AVSYNC_VIDEO_TIMEBASESHIFT_MAX_LEAD_MS;
        queCfg->clkAdjustPolicy.clkAdjustLag  = AVSYNC_VIDEO_TIMEBASESHIFT_MAX_LAG_MS;
        queCfg->vidSynchPolicy.maxReplayLead  = AVSYNC_VIDEO_FUTURE_FRAME_DROP_THRESHOLD_MS;
        queCfg->vidSynchPolicy.playMaxLag  = 180;
        queCfg->vidSynchPolicy.playMaxLead = 0;
        queCfg->vidSynchPolicy.doMarginScaling = FALSE;
        queCfg->playTimerStartTimeout = 0;
        queCfg->playStartMode = AVSYNC_PLAYBACK_START_MODE_WAITSYNCH;
        queCfg->ptsInitMode   = AVSYNC_PTS_INIT_MODE_APP;
    }
    
    static
    Void mulich_vdec_vdis_set_avsync_prm(AvsyncLink_LinkSynchConfigParams *avsyncPrm,
                                         UInt32 swMsIdx,
                                         VDIS_DEV vdDevId)
    {
        Int i;
        Int32 status;
    
        Vdis_getAvsyncConfig(vdDevId,avsyncPrm);
        avsyncPrm->displayLinkID        = Vdis_getDisplayId(vdDevId);
        avsyncPrm->videoSynchLinkID = gVdisModuleContext.swMsId[swMsIdx];
        avsyncPrm->numCh            = gVdecModuleContext.vdecConfig.numChn;
        avsyncPrm->syncMasterChnum =  AVSYNC_INVALID_CHNUM;
        for (i = 0; i < avsyncPrm->numCh;i++)
        {
            mulich_vdec_vdis_set_avsync_vidque_prm(&avsyncPrm->queCfg[i],
                                                   i,
                                                   0,
                                                   (0 + gVdecModuleContext.vdecConfig.numChn),
                                                   vdDevId);
        }
        if (0 == swMsIdx)
        {
            Vdis_setAvsyncConfig(VDIS_DEV_HDMI,avsyncPrm);
        }
        else
        {
            Vdis_setAvsyncConfig(VDIS_DEV_SD,avsyncPrm);
        }
    
        status = Avsync_configSyncConfigInfo(avsyncPrm);
        OSA_assert(status == 0);
    }
    
    Void MultiCh_createVdecVdis()
    {
      printf("aaron enter MultiCh_createVdecVdis\n");
      
        IpcBitsOutLinkHLOS_CreateParams   ipcBitsOutHostPrm;
        IpcBitsInLinkRTOS_CreateParams    ipcBitsInVideoPrm;
        DecLink_CreateParams        decPrm;
        IpcLink_CreateParams        ipcOutVideoPrm;
        IpcLink_CreateParams        ipcInVpssPrm;
        DupLink_CreateParams        dupPrm;
        static SwMsLink_CreateParams       swMsPrm[VDIS_DEV_MAX];
        DisplayLink_CreateParams    displayPrm[VDIS_DEV_MAX];
        IpcFramesOutLinkHLOS_CreateParams  ipcFramesOutHostPrm;
        IpcFramesInLinkRTOS_CreateParams   ipcFramesInVpssFromHostPrm;
        MergeLink_CreateParams             mergePrm;
        MpSclrLink_CreateParams            mpSclrPrm;
    
    
    // new stuff for DSP
        IpcFramesInLinkRTOS_CreateParams  ipcFramesInDspPrm;
        IpcFramesOutLinkRTOS_CreateParams ipcFramesOutVpssPrm;
        AlgLink_CreateParams              dspAlgPrm;
    
    
        // new stuff for encode                 ----  adapted from Multich_vcap_venc_vdis.c
        //
        IpcLink_CreateParams            ipcOutVpssPrm;
        IpcLink_CreateParams            ipcInVideoPrm;
        EncLink_CreateParams            encPrm;
        IpcBitsOutLinkRTOS_CreateParams ipcBitsOutVideoPrm;
        IpcBitsInLinkHLOS_CreateParams  ipcBitsInHostPrm[2];
        ///////////////////////////////
    
    	
    
        UInt32 i;
        
        UInt32 j;
        
        UInt32 enableGrpx;
        Bool tilerEnable;
        Bool enableVideoFrameExport;
    
        MULTICH_INIT_STRUCT(IpcLink_CreateParams,ipcInVpssPrm);
        MULTICH_INIT_STRUCT(IpcLink_CreateParams,ipcOutVideoPrm);
        MULTICH_INIT_STRUCT(IpcBitsOutLinkHLOS_CreateParams,ipcBitsOutHostPrm);
        MULTICH_INIT_STRUCT(IpcBitsInLinkRTOS_CreateParams,ipcBitsInVideoPrm);
        MULTICH_INIT_STRUCT(DecLink_CreateParams, decPrm);
        MULTICH_INIT_STRUCT(IpcFramesOutLinkHLOS_CreateParams ,ipcFramesOutHostPrm);
        MULTICH_INIT_STRUCT(IpcFramesInLinkRTOS_CreateParams  ,ipcFramesInVpssFromHostPrm);
        for (i = 0; i < VDIS_DEV_MAX;i++)
        {
            MULTICH_INIT_STRUCT(DisplayLink_CreateParams,displayPrm[i]);
            MULTICH_INIT_STRUCT(SwMsLink_CreateParams ,swMsPrm[i]);
        }
    
        MULTICH_INIT_STRUCT(MpSclrLink_CreateParams, mpSclrPrm);
    
        //New stuff
        MULTICH_INIT_STRUCT(IpcFramesInLinkRTOS_CreateParams,ipcFramesInDspPrm);
        MULTICH_INIT_STRUCT(IpcFramesOutLinkRTOS_CreateParams,ipcFramesOutVpssPrm);
        MULTICH_INIT_STRUCT(AlgLink_CreateParams, dspAlgPrm);
    
    
        // New stuff for encoding      --- adapted from Multich_vcap_venc_vdis.c
        //
        MULTICH_INIT_STRUCT(IpcLink_CreateParams ,ipcOutVpssPrm);
        MULTICH_INIT_STRUCT(IpcLink_CreateParams ,ipcInVideoPrm);
        MULTICH_INIT_STRUCT(IpcBitsOutLinkRTOS_CreateParams,ipcBitsOutVideoPrm);
        MULTICH_INIT_STRUCT(IpcBitsInLinkHLOS_CreateParams,ipcBitsInHostPrm[0]);
        MULTICH_INIT_STRUCT(IpcBitsInLinkHLOS_CreateParams,ipcBitsInHostPrm[1]);
        MULTICH_INIT_STRUCT(EncLink_CreateParams, encPrm);
        //
        ///////////////////////////////////////
      printf("aaron MultiCh_detectBoard\n");
    
        MultiCh_detectBoard();
      printf("aaron after MultiCh_detectBoard\n");
    
        System_linkControl(
            SYSTEM_LINK_ID_M3VPSS,
            SYSTEM_M3VPSS_CMD_RESET_VIDEO_DEVICES,
            NULL,
            0,
            TRUE
            );
    
      printf("aaron SYSTEM_LINK_ID_M3VIDEO\n");
        System_linkControl(
            SYSTEM_LINK_ID_M3VIDEO,
            SYSTEM_COMMON_CMD_SET_CH2IVAHD_MAP_TBL,
            &systemVid_encDecIvaChMapTbl,
            sizeof(SystemVideo_Ivahd2ChMap_Tbl),
            TRUE
        );
      printf("aaron after SYSTEM_LINK_ID_M3VIDEO\n");
    #if defined(TI_814X_BUILD) || defined(TI_8107_BUILD)
        enableGrpx   = FALSE;
    #else
        enableGrpx   = TRUE;
    #endif
    
    #if ENABLE_STATIC_CHANNELS_IN_TILED_MODE
        tilerEnable  = TRUE;
    #else
        tilerEnable  = FALSE;
    #endif
    
        if (tilerEnable == FALSE)
        {
            /* Disable tiler allocator for this usecase
             * for that tiler memory can be reused for
             * non-tiled allocation
             */
            SystemTiler_disableAllocator();
        }
    
        enableVideoFrameExport = FALSE;
    
        gVdecModuleContext.ipcBitsOutHLOSId = SYSTEM_HOST_LINK_ID_IPC_BITS_OUT_0;
        gVdecModuleContext.ipcBitsInRTOSId  = SYSTEM_VIDEO_LINK_ID_IPC_BITS_IN_0;
        gVdecModuleContext.decId            = SYSTEM_LINK_ID_VDEC_0;
    
        gMultiCh_VdecVdisObj.ipcOutVideoId  = SYSTEM_VIDEO_LINK_ID_IPC_OUT_M3_0;
        gMultiCh_VdecVdisObj.ipcInVpssId    = SYSTEM_VPSS_LINK_ID_IPC_IN_M3_0;
        gMultiCh_VdecVdisObj.dupId          = SYSTEM_VPSS_LINK_ID_DUP_0;
        gMultiCh_VdecVdisObj.mpSclrId       = SYSTEM_LINK_ID_MP_SCLR_INST_0;
    
    
    
        //New stuff --- for dsp link
        gMultiCh_VdecVdisObj.ipcFramesOutVpssId   = SYSTEM_VPSS_LINK_ID_IPC_FRAMES_OUT_0;
        gMultiCh_VdecVdisObj.ipcFramesInDspId = SYSTEM_DSP_LINK_ID_IPC_FRAMES_IN_0;
        gMultiCh_VdecVdisObj.dspAlgId =  SYSTEM_DSP_LINK_ID_ALG_0;
    
    
    
        ////////////////////////////////////////////////////////////////////////
        // New stuff for encoding ... should go here
        //                                                            adapted from Multich_vdec_vdis.c
        //
        //
        gVencModuleContext.encId            = SYSTEM_LINK_ID_VENC_0;
        gVencModuleContext.ipcBitsInHLOSId   = SYSTEM_HOST_LINK_ID_IPC_BITS_IN_0;
        gVencModuleContext.ipcBitsOutRTOSId = SYSTEM_VIDEO_LINK_ID_IPC_BITS_OUT_0;
    
    
        // ??? needed ???
        gMultiCh_VdecVdisObj.ipcOutVpssId                       = SYSTEM_VPSS_LINK_ID_IPC_OUT_M3_0;
        gMultiCh_VdecVdisObj.ipcInVideoId                       = SYSTEM_VIDEO_LINK_ID_IPC_IN_M3_0;
    	
        //
        // 
        /////////////////////////////////////////////////////////////////////////
    
    
        gVdisModuleContext.mpSclrId         = SYSTEM_LINK_ID_MP_SCLR_INST_0;
    
        gVdisModuleContext.swMsId[0]        = SYSTEM_LINK_ID_SW_MS_MULTI_INST_0;
    
    
        gVdisModuleContext.displayId[0]     = SYSTEM_LINK_ID_DISPLAY_0; // ON AND OFF CHIP HDMI
    
        if (gVsysModuleContext.vsysConfig.numDisplays > 1)
        {
            gVdisModuleContext.swMsId[1]        = SYSTEM_LINK_ID_SW_MS_MULTI_INST_1;
    #if defined(TI_814X_BUILD) || defined(TI_8107_BUILD)
            gVdisModuleContext.displayId[1]     = SYSTEM_LINK_ID_DISPLAY_2; // SDTV
    #else
            gVdisModuleContext.displayId[1]     = SYSTEM_LINK_ID_DISPLAY_1; // OFF CHIP HDMI
    #endif
        }
    
        if (enableVideoFrameExport)
        {
            gMultiCh_VdecVdisObj.mergeId                 = SYSTEM_VPSS_LINK_ID_MERGE_0;
            gVdisModuleContext.ipcFramesOutHostId        = SYSTEM_HOST_LINK_ID_IPC_FRAMES_OUT_0;
            gVdisModuleContext.ipcFramesInVpssFromHostId = SYSTEM_VPSS_LINK_ID_IPC_FRAMES_IN_0;
        }
    
        if(enableGrpx)
        {
            // GRPX is enabled in Vdis_start() based on the link ID set here
            gVdisModuleContext.grpxId[0]    = SYSTEM_LINK_ID_GRPX_0;
    #if defined(TI_814X_BUILD) || defined(TI_8107_BUILD)
            gVdisModuleContext.grpxId[1]    = SYSTEM_LINK_ID_INVALID;
    #else
            gVdisModuleContext.grpxId[1]    = SYSTEM_LINK_ID_GRPX_1;
    #endif
        }
    
        ipcBitsOutHostPrm.baseCreateParams.outQueParams[0].nextLink= gVdecModuleContext.ipcBitsInRTOSId;
        ipcBitsOutHostPrm.baseCreateParams.notifyNextLink       = FALSE;
        ipcBitsOutHostPrm.baseCreateParams.notifyPrevLink       = FALSE;
        ipcBitsOutHostPrm.baseCreateParams.noNotifyMode         = TRUE;
        ipcBitsOutHostPrm.baseCreateParams.numOutQue            = 1;
        ipcBitsOutHostPrm.inQueInfo.numCh                       = gVdecModuleContext.vdecConfig.numChn;
        ipcBitsOutHostPrm.bufPoolPerCh                          = TRUE;
    
        for (i=0; i<ipcBitsOutHostPrm.inQueInfo.numCh; i++)
        {
            ipcBitsOutHostPrm.inQueInfo.chInfo[i].width =
                gVdecModuleContext.vdecConfig.decChannelParams[i].maxVideoWidth;
    
            ipcBitsOutHostPrm.inQueInfo.chInfo[i].height =
                gVdecModuleContext.vdecConfig.decChannelParams[i].maxVideoHeight;
    
            ipcBitsOutHostPrm.inQueInfo.chInfo[i].scanFormat =
                SYSTEM_SF_PROGRESSIVE;
    
            ipcBitsOutHostPrm.inQueInfo.chInfo[i].bufType        = 0; // NOT USED
            ipcBitsOutHostPrm.inQueInfo.chInfo[i].codingformat   = 0; // NOT USED
            ipcBitsOutHostPrm.inQueInfo.chInfo[i].dataFormat     = 0; // NOT USED
            ipcBitsOutHostPrm.inQueInfo.chInfo[i].memType        = 0; // NOT USED
            ipcBitsOutHostPrm.inQueInfo.chInfo[i].startX         = 0; // NOT USED
            ipcBitsOutHostPrm.inQueInfo.chInfo[i].startY         = 0; // NOT USED
            ipcBitsOutHostPrm.inQueInfo.chInfo[i].pitch[0]       = 0; // NOT USED
            ipcBitsOutHostPrm.inQueInfo.chInfo[i].pitch[1]       = 0; // NOT USED
            ipcBitsOutHostPrm.inQueInfo.chInfo[i].pitch[2]       = 0; // NOT USED
            ipcBitsOutHostPrm.numBufPerCh[i] = 6;
        }
    
        ipcBitsInVideoPrm.baseCreateParams.inQueParams.prevLinkId    = gVdecModuleContext.ipcBitsOutHLOSId;
        ipcBitsInVideoPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
        ipcBitsInVideoPrm.baseCreateParams.outQueParams[0].nextLink  = gVdecModuleContext.decId;
        ipcBitsInVideoPrm.baseCreateParams.noNotifyMode              = TRUE;
        ipcBitsInVideoPrm.baseCreateParams.notifyNextLink            = TRUE;
        ipcBitsInVideoPrm.baseCreateParams.notifyPrevLink            = FALSE;
        ipcBitsInVideoPrm.baseCreateParams.numOutQue                 = 1;
    
        for (i=0; i<ipcBitsOutHostPrm.inQueInfo.numCh; i++)
        {
            if(gVdecModuleContext.vdecConfig.decChannelParams[i].isCodec == VDEC_CHN_H264)
                decPrm.chCreateParams[i].format                 = IVIDEO_H264HP;
            else if(gVdecModuleContext.vdecConfig.decChannelParams[i].isCodec == VDEC_CHN_MPEG4)
                decPrm.chCreateParams[i].format                 = IVIDEO_MPEG4ASP;
            else if(gVdecModuleContext.vdecConfig.decChannelParams[i].isCodec == VDEC_CHN_MJPEG)
                decPrm.chCreateParams[i].format                 = IVIDEO_MJPEG;
    
            decPrm.chCreateParams[i].numBufPerCh
                             = gVdecModuleContext.vdecConfig.decChannelParams[i].numBufPerCh;
            decPrm.chCreateParams[i].profile                = IH264VDEC_PROFILE_ANY;
            decPrm.chCreateParams[i].displayDelay
                             = gVdecModuleContext.vdecConfig.decChannelParams[i].displayDelay;
            decPrm.chCreateParams[i].dpbBufSizeInFrames = IH264VDEC_DPB_NUMFRAMES_AUTO;
            decPrm.chCreateParams[i].processCallLevel   = VDEC_FRAMELEVELPROCESSCALL;
            //decPrm.chCreateParams[i].processCallLevel   = VDEC_FIELDLEVELPROCESSCALL;
    
            decPrm.chCreateParams[i].targetMaxWidth  =
                ipcBitsOutHostPrm.inQueInfo.chInfo[i].width;
    
            decPrm.chCreateParams[i].targetMaxHeight =
                ipcBitsOutHostPrm.inQueInfo.chInfo[i].height;
    
            decPrm.chCreateParams[i].defaultDynamicParams.targetFrameRate =
                gVdecModuleContext.vdecConfig.decChannelParams[i].dynamicParam.frameRate;
    
            decPrm.chCreateParams[i].defaultDynamicParams.targetBitRate =
                gVdecModuleContext.vdecConfig.decChannelParams[i].dynamicParam.targetBitRate;
            decPrm.chCreateParams[i].tilerEnable = tilerEnable;
    
    #if ENABLE_STATIC_CHANNELS_IN_TILED_MODE
            if (i >= NUM_STATIC_CHANNELS)
                decPrm.chCreateParams[i].tilerEnable = FALSE;
    #endif
        }
    
        decPrm.inQueParams.prevLinkId       = gVdecModuleContext.ipcBitsInRTOSId;
        decPrm.inQueParams.prevLinkQueId    = 0;
        decPrm.outQueParams.nextLink        = gMultiCh_VdecVdisObj.ipcOutVideoId;
    
        ipcOutVideoPrm.inQueParams.prevLinkId    = gVdecModuleContext.decId;
        ipcOutVideoPrm.inQueParams.prevLinkQueId = 0;
        ipcOutVideoPrm.outQueParams[0].nextLink     = gMultiCh_VdecVdisObj.ipcInVpssId;
        ipcOutVideoPrm.notifyNextLink            = TRUE;
        ipcOutVideoPrm.notifyPrevLink            = TRUE;
        ipcOutVideoPrm.numOutQue                 = 1;
    
        ipcInVpssPrm.inQueParams.prevLinkId    = gMultiCh_VdecVdisObj.ipcOutVideoId;
        ipcInVpssPrm.inQueParams.prevLinkQueId = 0;
        ipcInVpssPrm.notifyNextLink            = TRUE;
        ipcInVpssPrm.notifyPrevLink            = TRUE;
        ipcInVpssPrm.numOutQue                 = 1;
    
        if (enableVideoFrameExport)
        {
            ipcFramesOutHostPrm.baseCreateParams.noNotifyMode = TRUE;
            ipcFramesOutHostPrm.baseCreateParams.notifyNextLink = FALSE;
            ipcFramesOutHostPrm.baseCreateParams.notifyPrevLink = FALSE;
            ipcFramesOutHostPrm.baseCreateParams.inQueParams.prevLinkId = SYSTEM_LINK_ID_INVALID;
            ipcFramesOutHostPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
            ipcFramesOutHostPrm.baseCreateParams.numOutQue = 1;
            ipcFramesOutHostPrm.baseCreateParams.outQueParams[0].nextLink = gVdisModuleContext.ipcFramesInVpssFromHostId;
            MultiCh_setIpcFramesOutInQueInfo(&ipcFramesOutHostPrm.inQueInfo);
    
            ipcFramesInVpssFromHostPrm.baseCreateParams.noNotifyMode = TRUE;
            ipcFramesInVpssFromHostPrm.baseCreateParams.notifyNextLink = TRUE;
            ipcFramesInVpssFromHostPrm.baseCreateParams.notifyPrevLink = FALSE;
            ipcFramesInVpssFromHostPrm.baseCreateParams.inQueParams.prevLinkId = gVdisModuleContext.ipcFramesOutHostId;
            ipcFramesInVpssFromHostPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
            ipcFramesInVpssFromHostPrm.baseCreateParams.numOutQue = 1;
            ipcFramesInVpssFromHostPrm.baseCreateParams.outQueParams[0].nextLink = gMultiCh_VdecVdisObj.mergeId;
    
    
            ipcInVpssPrm.outQueParams[0].nextLink     = gMultiCh_VdecVdisObj.mergeId;
    
            mergePrm.numInQue                     = 2;
            mergePrm.inQueParams[0].prevLinkId    = gMultiCh_VdecVdisObj.ipcInVpssId;
            mergePrm.inQueParams[0].prevLinkQueId = 0;
            mergePrm.inQueParams[1].prevLinkId    = gVdisModuleContext.ipcFramesInVpssFromHostId;
            mergePrm.inQueParams[1].prevLinkQueId = 0;
    
            mergePrm.outQueParams.nextLink        = gMultiCh_VdecVdisObj.mpSclrId;
            mergePrm.notifyNextLink               = TRUE;
            mpSclrPrm.inQueParams.prevLinkId      = gMultiCh_VdecVdisObj.mergeId;
        }
        else
        {
            mpSclrPrm.inQueParams.prevLinkId        = gMultiCh_VdecVdisObj.ipcInVpssId;
            ipcInVpssPrm.outQueParams[0].nextLink   = gMultiCh_VdecVdisObj.mpSclrId;
    
        }
        mpSclrPrm.pathId = MP_SCLR_LINK_SC5;
        mpSclrPrm.numCh = 4;
        mpSclrPrm.enableLineSkip = FALSE;
    
        //TBD
       // mpSclrPrm.outQueParams.nextLink       = gMultiCh_VdecVdisObj.dupId;
        mpSclrPrm.outQueParams.nextLink       = gMultiCh_VdecVdisObj.ipcFramesOutVpssId;
    
        {
                //ipcOutVpssPrm.inQueParams.prevLinkId    = gVcapModuleContext.ipcFramesOutVpssId;
    
                /* Redirect to DSP for OSD / SCD */
                ipcFramesOutVpssPrm .baseCreateParams.inQueParams.prevLinkId   = gMultiCh_VdecVdisObj.mpSclrId;//merge0Id;
                ipcFramesOutVpssPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
                ipcFramesOutVpssPrm.baseCreateParams.outQueParams[0].nextLink  = gMultiCh_VdecVdisObj.dupId;//ipcOutVpssId;
                ipcFramesOutVpssPrm.baseCreateParams.processLink               = gMultiCh_VdecVdisObj.ipcFramesInDspId;
                ipcFramesOutVpssPrm.baseCreateParams.notifyPrevLink            = TRUE;
                ipcFramesOutVpssPrm.baseCreateParams.notifyNextLink            = TRUE;
                ipcFramesOutVpssPrm.baseCreateParams.notifyProcessLink         = TRUE;
                ipcFramesOutVpssPrm.baseCreateParams.noNotifyMode              = FALSE;
                ipcFramesOutVpssPrm.baseCreateParams.numOutQue                 = 1;
    
                ipcFramesInDspPrm.baseCreateParams.inQueParams.prevLinkId      = gMultiCh_VdecVdisObj.ipcFramesOutVpssId;
                ipcFramesInDspPrm.baseCreateParams.inQueParams.prevLinkQueId   = 0;
                ipcFramesInDspPrm.baseCreateParams.outQueParams[0].nextLink    = gMultiCh_VdecVdisObj.dspAlgId;
                ipcFramesInDspPrm.baseCreateParams.notifyPrevLink              = TRUE;
                ipcFramesInDspPrm.baseCreateParams.notifyNextLink              = TRUE;
                ipcFramesInDspPrm.baseCreateParams.noNotifyMode                = FALSE;
                ipcFramesInDspPrm.baseCreateParams.numOutQue                   = 1;
    
                dspAlgPrm.enableOSDAlg = TRUE;
                dspAlgPrm.enableSCDAlg = FALSE;
                dspAlgPrm.inQueParams.prevLinkId = gMultiCh_VdecVdisObj.ipcFramesInDspId;
                dspAlgPrm.inQueParams.prevLinkQueId = 0;
            }
    
    
    // some stuff is new for encoding
    ///////////////////////////// modify dup to send one copy out for encoding
    
    
    //  dupPrm.inQueParams.prevLinkId         = gMultiCh_VdecVdisObj.mpSclrId;
        dupPrm.inQueParams.prevLinkId         = gMultiCh_VdecVdisObj.ipcFramesOutVpssId;
        dupPrm.inQueParams.prevLinkQueId      = 0;
    //    dupPrm.numOutQue                      = gVsysModuleContext.vsysConfig.numDisplays;
    // new for encoding
        dupPrm.numOutQue                      = gVsysModuleContext.vsysConfig.numDisplays + 1; // + 1 for encoding path
    
    
        dupPrm.outQueParams[0].nextLink       = gVdisModuleContext.swMsId[0];
        dupPrm.outQueParams[1].nextLink       = gVdisModuleContext.swMsId[1];
    // new for encoding
        dupPrm.outQueParams[2].nextLink       = gMultiCh_VdecVdisObj.ipcOutVpssId;
    //
    	
        dupPrm.notifyNextLink                 = TRUE;
    
    ////////////////////////////////////////////////////////////////
    
    
    
    ////////////////////// NEW ENCODING STUFF//////////////////////////
    
        ipcOutVpssPrm.inQueParams.prevLinkId = gMultiCh_VdecVdisObj.dupId; //gMultiCh_VcapVencVdisObj.mergeId[DEI_VIP_SC_MERGE_LINK_IDX];
    
        ipcOutVpssPrm.inQueParams.prevLinkQueId = 0;
        ipcOutVpssPrm.numOutQue                 = 1;
        ipcOutVpssPrm.outQueParams[0].nextLink  = gMultiCh_VdecVdisObj.ipcInVideoId; //gMultiCh_VcapVencVdisObj.ipcInVideoId;
        ipcOutVpssPrm.notifyNextLink            = FALSE;
        ipcOutVpssPrm.notifyPrevLink            = TRUE;
        ipcOutVpssPrm.noNotifyMode              = TRUE;
    
        ipcInVideoPrm.inQueParams.prevLinkId    = gMultiCh_VdecVdisObj.ipcOutVpssId;
        ipcInVideoPrm.inQueParams.prevLinkQueId = 0;
        ipcInVideoPrm.numOutQue                 = 1;
        ipcInVideoPrm.outQueParams[0].nextLink     = gVencModuleContext.encId;
        ipcInVideoPrm.notifyNextLink            = TRUE;
        ipcInVideoPrm.notifyPrevLink            = FALSE;
        ipcInVideoPrm.noNotifyMode              = TRUE;
    
        ipcBitsOutVideoPrm.baseCreateParams.inQueParams.prevLinkId    = gVencModuleContext.encId;
        ipcBitsOutVideoPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
        ipcBitsOutVideoPrm.baseCreateParams.numOutQue                 = 1;
        ipcBitsOutVideoPrm.baseCreateParams.outQueParams[0].nextLink   = gVencModuleContext.ipcBitsInHLOSId;
        MultiCh_ipcBitsInitCreateParams_BitsOutRTOS(&ipcBitsOutVideoPrm, TRUE);
    
        ipcBitsInHostPrm[0].baseCreateParams.inQueParams.prevLinkId    = gVencModuleContext.ipcBitsOutRTOSId;
        ipcBitsInHostPrm[0].baseCreateParams.inQueParams.prevLinkQueId = 0;
        ipcBitsInHostPrm[0].baseCreateParams.numOutQue                 = 1;
        ipcBitsInHostPrm[0].baseCreateParams.outQueParams[0].nextLink   = SYSTEM_LINK_ID_INVALID;
        MultiCh_ipcBitsInitCreateParams_BitsInHLOS(&ipcBitsInHostPrm[0]);
    
        encPrm.numBufPerCh[0] = 6; //D1
        encPrm.numBufPerCh[1] = 4; //CIF
    
        {
            EncLink_ChCreateParams *pLinkChPrm;
            EncLink_ChDynamicParams *pLinkDynPrm;
            VENC_CHN_DYNAMIC_PARAM_S *pDynPrm;
            VENC_CHN_PARAMS_S *pChPrm;
    
            /* Primary Stream Params - D1 */
            for (i=0; i<gVencModuleContext.vencConfig.numPrimaryChn; i++)
            {
    	  printf("primary\n");
                pLinkChPrm  = &encPrm.chCreateParams[i];
                pLinkDynPrm = &pLinkChPrm->defaultDynamicParams;
    
                pChPrm      = &gVencModuleContext.vencConfig.encChannelParams[i];
                pDynPrm     = &pChPrm->dynamicParam;
    
                pLinkChPrm->format                  = IVIDEO_H264HP;
                pLinkChPrm->profile                 = gVencModuleContext.vencConfig.h264Profile[i];
                pLinkChPrm->dataLayout              = IVIDEO_FIELD_SEPARATED;
                pLinkChPrm->fieldMergeEncodeEnable  = FALSE;
                pLinkChPrm->enableAnalyticinfo      = pChPrm->enableAnalyticinfo;
                pLinkChPrm->enableWaterMarking      = pChPrm->enableWaterMarking;
                pLinkChPrm->maxBitRate              = pChPrm->maxBitRate;
                pLinkChPrm->encodingPreset          = pChPrm->encodingPreset;
                pLinkChPrm->rateControlPreset       = pChPrm->rcType;
                pLinkChPrm->enableSVCExtensionFlag  = pChPrm->enableSVCExtensionFlag;
                pLinkChPrm->numTemporalLayer        = pChPrm->numTemporalLayer;
    
                pLinkDynPrm->intraFrameInterval     = pDynPrm->intraFrameInterval;
                pLinkDynPrm->targetBitRate          = pDynPrm->targetBitRate;
                pLinkDynPrm->interFrameInterval     = 1;
                pLinkDynPrm->mvAccuracy             = IVIDENC2_MOTIONVECTOR_QUARTERPEL;
                pLinkDynPrm->inputFrameRate         = pDynPrm->inputFrameRate;
                pLinkDynPrm->rcAlg                  = pDynPrm->rcAlg;
                pLinkDynPrm->qpMin                  = pDynPrm->qpMin;
                pLinkDynPrm->qpMax                  = pDynPrm->qpMax;
                pLinkDynPrm->qpInit                 = pDynPrm->qpInit;
                pLinkDynPrm->vbrDuration            = pDynPrm->vbrDuration;
                pLinkDynPrm->vbrSensitivity         = pDynPrm->vbrSensitivity;
            }
    
            if (gVsysModuleContext.vsysConfig.enableSecondaryOut == TRUE)
            {
                /* Secondary Out <CIF> Params */
                for (i=gVencModuleContext.vencConfig.numPrimaryChn, j=VENC_PRIMARY_CHANNELS;
                      i<(gVencModuleContext.vencConfig.numPrimaryChn
                               + gVencModuleContext.vencConfig.numSecondaryChn);
                        i++, j++)
                {printf("CIF params %d %d\n",i,j);
                    pLinkChPrm  = &encPrm.chCreateParams[i];
                    pLinkDynPrm = &pLinkChPrm->defaultDynamicParams;
    
                    pChPrm      = &gVencModuleContext.vencConfig.encChannelParams[j];
                    pDynPrm     = &pChPrm->dynamicParam;
    
                    pLinkChPrm->format                  = IVIDEO_H264HP;
                    pLinkChPrm->profile                 = gVencModuleContext.vencConfig.h264Profile[i];
                    pLinkChPrm->dataLayout              = IVIDEO_FIELD_SEPARATED;
                    pLinkChPrm->fieldMergeEncodeEnable  = FALSE;
                    pLinkChPrm->enableAnalyticinfo      = pChPrm->enableAnalyticinfo;
                    pLinkChPrm->enableWaterMarking      = pChPrm->enableWaterMarking;
                    pLinkChPrm->maxBitRate              = pChPrm->maxBitRate;
                    pLinkChPrm->encodingPreset          = pChPrm->encodingPreset;
                    pLinkChPrm->rateControlPreset       = pChPrm->rcType;
                    pLinkChPrm->enableSVCExtensionFlag  = pChPrm->enableSVCExtensionFlag;
                    pLinkChPrm->numTemporalLayer        = pChPrm->numTemporalLayer;
    
                    pLinkDynPrm->intraFrameInterval     = pDynPrm->intraFrameInterval;
                    pLinkDynPrm->targetBitRate          = pDynPrm->targetBitRate;
                    pLinkDynPrm->interFrameInterval     = 1;
                    pLinkDynPrm->mvAccuracy             = IVIDENC2_MOTIONVECTOR_QUARTERPEL;
                    pLinkDynPrm->inputFrameRate         = pDynPrm->inputFrameRate;
                    pLinkDynPrm->qpMin                  = pDynPrm->qpMin;
                    pLinkDynPrm->qpMax                  = pDynPrm->qpMax;
                    pLinkDynPrm->qpInit                 = pDynPrm->qpInit;
                    pLinkDynPrm->vbrDuration            = pDynPrm->vbrDuration;
                    pLinkDynPrm->vbrSensitivity         = pDynPrm->vbrSensitivity;
                }
            }
    
            encPrm.inQueParams.prevLinkId   = gMultiCh_VdecVdisObj.ipcInVideoId;
            encPrm.inQueParams.prevLinkQueId= 0;
            encPrm.outQueParams.nextLink    = gVencModuleContext.ipcBitsOutRTOSId;
        }
    
    
    ///////////////////////////////////////////////////////////////////
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    #if defined(TI_814X_BUILD) || defined(TI_8107_BUILD)
    
        swMsPrm[0].numSwMsInst = 1;
        swMsPrm[0].swMsInstId[0]        = SYSTEM_SW_MS_SC_INST_DEIHQ_SC_NO_DEI;
    
        swMsPrm[0].swMsInstStartWin[0]  = 0;
        swMsPrm[0].swMsInstStartWin[1]  = 10;
    
        swMsPrm[1].numSwMsInst = 1;
        swMsPrm[1].swMsInstId[0]        = SYSTEM_SW_MS_SC_INST_DEI_SC_NO_DEI;
    
        swMsPrm[1].swMsInstStartWin[0]  = 0;
        swMsPrm[1].swMsInstStartWin[1]  = 10;
    
        swMsPrm[0].enableProcessTieWithDisplay = TRUE;
        swMsPrm[1].enableProcessTieWithDisplay = FALSE;
    
    #else
        swMsPrm[0].swMsInstId[0]        = SYSTEM_SW_MS_SC_INST_VIP1_SC;
        swMsPrm[0].swMsInstId[1]        = SYSTEM_SW_MS_SC_INST_DEI_SC_NO_DEI;
    
        swMsPrm[1].swMsInstId[0]        = SYSTEM_SW_MS_SC_INST_DEIHQ_SC_NO_DEI;
        swMsPrm[1].swMsInstId[1]        = SYSTEM_SW_MS_SC_INST_SC5;
    
        swMsPrm[0].numSwMsInst          = 2;
    
        swMsPrm[0].swMsInstStartWin[0]  = 0;
        swMsPrm[0].swMsInstStartWin[1]  = 4;
    
        swMsPrm[1].numSwMsInst          = swMsPrm[0].numSwMsInst;
        swMsPrm[1].swMsInstStartWin[0]  = swMsPrm[0].swMsInstStartWin[0];
        swMsPrm[1].swMsInstStartWin[1]  = swMsPrm[0].swMsInstStartWin[1];
    
        swMsPrm[0].enableProcessTieWithDisplay = TRUE;
        swMsPrm[1].enableProcessTieWithDisplay = TRUE;
    
    #endif
        for(i=0; i<gVsysModuleContext.vsysConfig.numDisplays; i++)
        {
            VDIS_DEV vdDevId = VDIS_DEV_HDMI;
    
            swMsPrm[i].inQueParams.prevLinkId     = gMultiCh_VdecVdisObj.dupId;
            swMsPrm[i].inQueParams.prevLinkQueId  = i;
            swMsPrm[i].outQueParams.nextLink      = gVdisModuleContext.displayId[i];
            swMsPrm[i].numOutBuf                 = MULTICH_NUM_SWMS_MAX_BUFFERS;
    
            /* Disable inQue drop at SwMs as input may arrive very fast in VDEC->VDIS use case */
            swMsPrm[i].maxInputQueLen             = SYSTEM_SW_MS_INVALID_INPUT_QUE_LEN;
            if (i == 0)
            {
                vdDevId = VDIS_DEV_HDMI;
                swMsPrm[i].maxOutRes              = VSYS_STD_1080P_60;
                swMsPrm[i].initOutRes             = gVdisModuleContext.vdisConfig.deviceParams[VDIS_DEV_HDMI].resolution;
            }
            else if (i == 1)
            {
    #if defined(TI_814X_BUILD) || defined(TI_8107_BUILD)
                vdDevId = VDIS_DEV_SD;
                swMsPrm[i].maxOutRes              = VSYS_STD_PAL;
                swMsPrm[i].outQueParams.nextLink  = SYSTEM_LINK_ID_DISPLAY_2;
                swMsPrm[i].initOutRes             = gVdisModuleContext.vdisConfig.deviceParams[VDIS_DEV_SD].resolution;
    
    #else
                vdDevId = VDIS_DEV_DVO2;
                swMsPrm[i].maxOutRes              = VSYS_STD_1080P_60;
                swMsPrm[i].initOutRes             = gVdisModuleContext.vdisConfig.deviceParams[VDIS_DEV_DVO2].resolution;
    #endif
            }
            /* low cost line skip mode of scaling can be used, when tiler is off */
            if(tilerEnable)
                swMsPrm[i].lineSkipMode           = FALSE;
            else
                swMsPrm[i].lineSkipMode           = TRUE;
    
            swMsPrm[i].enableLayoutGridDraw = gVdisModuleContext.vdisConfig.enableLayoutGridDraw;
    
            MultiCh_swMsGetDefaultLayoutPrm(vdDevId, &swMsPrm[i], FALSE);    /* both from 0-16 chnl */
    
            displayPrm[i].inQueParams[0].prevLinkId    = gVdisModuleContext.swMsId[i];
            displayPrm[i].inQueParams[0].prevLinkQueId = 0;
            displayPrm[i].displayRes                = swMsPrm[i].initOutRes;
            if (i == 1)
    #if defined(TI_814X_BUILD) || defined(TI_8107_BUILD)
                            displayPrm[i].displayRes            = gVdisModuleContext.vdisConfig.deviceParams[VDIS_DEV_SD].resolution;
    #else
                            displayPrm[i].displayRes            = gVdisModuleContext.vdisConfig.deviceParams[VDIS_DEV_DVO2].resolution;
    #endif
            mulich_vdec_vdis_set_avsync_prm(&gMultiCh_VdecVdisObj.avsyncCfg[i],i,vdDevId);
        }
      printf("aaron System_linkCreate ipcBitsOutHLOSId\n");
    
        System_linkCreate(gVdecModuleContext.ipcBitsOutHLOSId,&ipcBitsOutHostPrm,sizeof(ipcBitsOutHostPrm));
        System_linkCreate(gVdecModuleContext.ipcBitsInRTOSId,&ipcBitsInVideoPrm,sizeof(ipcBitsInVideoPrm));
        System_linkCreate(gVdecModuleContext.decId, &decPrm, sizeof(decPrm));
    
        System_linkCreate(gMultiCh_VdecVdisObj.ipcOutVideoId, &ipcOutVideoPrm, sizeof(ipcOutVideoPrm));
        System_linkCreate(gMultiCh_VdecVdisObj.ipcInVpssId  , &ipcInVpssPrm, sizeof(ipcInVpssPrm));
    
        if (enableVideoFrameExport)
        {
            System_linkCreate(gVdisModuleContext.ipcFramesOutHostId     , &ipcFramesOutHostPrm    , sizeof(ipcFramesOutHostPrm));
            System_linkCreate(gVdisModuleContext.ipcFramesInVpssFromHostId     , &ipcFramesInVpssFromHostPrm    , sizeof(ipcFramesInVpssFromHostPrm));
            System_linkCreate(gMultiCh_VdecVdisObj.mergeId,&mergePrm,sizeof(mergePrm));
        }
    
        System_linkCreate(gMultiCh_VdecVdisObj.mpSclrId, &mpSclrPrm, sizeof(mpSclrPrm));
    
      printf("aaron new stuff for DSP\n");
    
        // new stuff for DSP
        System_linkCreate(gMultiCh_VdecVdisObj.ipcFramesOutVpssId, &ipcFramesOutVpssPrm, sizeof(ipcFramesOutVpssPrm));
        System_linkCreate(gMultiCh_VdecVdisObj.ipcFramesInDspId, &ipcFramesInDspPrm, sizeof(ipcFramesInDspPrm));
        System_linkCreate(gMultiCh_VdecVdisObj.dspAlgId, &dspAlgPrm, sizeof(dspAlgPrm));
    
        
        
          printf("aaron new stuff for Encoder\n");
    
    	///////////////////////////////////////////////////////////////
    	// new stuff for encoder
    	//////////////////////////////////////////////////////////
        System_linkCreate(gMultiCh_VdecVdisObj.ipcOutVpssId , &ipcOutVpssPrm , sizeof(ipcOutVpssPrm) );
        System_linkCreate(gMultiCh_VdecVdisObj.ipcInVideoId , &ipcInVideoPrm , sizeof(ipcInVideoPrm) );
    printf("aaron link create Encoder\n");
        System_linkCreate(gVencModuleContext.encId, &encPrm, sizeof(encPrm));
          printf("aaron after link create Encoder\n");
        System_linkCreate(gVencModuleContext.ipcBitsOutRTOSId, &ipcBitsOutVideoPrm, sizeof(ipcBitsOutVideoPrm));
        System_linkCreate(gVencModuleContext.ipcBitsInHLOSId, &ipcBitsInHostPrm[0], sizeof(ipcBitsInHostPrm[0]));
    	//////////////////////////////////////////////////////////////////////
    
        System_linkCreate(gMultiCh_VdecVdisObj.dupId     , &dupPrm    , sizeof(dupPrm));
    
        for(i=0; i<gVsysModuleContext.vsysConfig.numDisplays; i++)
            System_linkCreate(gVdisModuleContext.swMsId[i]  , &swMsPrm[i], sizeof(swMsPrm[i]));
    
        for(i=0; i<gVsysModuleContext.vsysConfig.numDisplays; i++)
            System_linkCreate(gVdisModuleContext.displayId[i], &displayPrm[i], sizeof(displayPrm[i]));
    
        MultiCh_memPrintHeapStatus();
        gMultiCh_VdecVdisObj.enableVideoFrameExport = enableVideoFrameExport;
        {
            MultiCh_setDec2DispMap(VDIS_DEV_HDMI,gVdecModuleContext.vdecConfig.numChn,0,0);
            #if defined(TI_814X_BUILD) || defined(TI_8107_BUILD)
            MultiCh_setDec2DispMap(VDIS_DEV_SD,gVdecModuleContext.vdecConfig.numChn,0,0);
            #else
            MultiCh_setDec2DispMap(VDIS_DEV_HDCOMP,gVdecModuleContext.vdecConfig.numChn,0,0);
            #endif
       }
    printf("aaron finished create\n");
    }
    
    Void MultiCh_deleteVdecVdis()
    {
        Bool tilerEnable;
    
    #if ENABLE_STATIC_CHANNELS_IN_TILED_MODE
        tilerEnable  = TRUE;
    #else
        tilerEnable  = FALSE;
    #endif
    
        /* delete can be done in any order */
        Vdec_delete();
        Vdis_delete();
    
    
    // new stuff for encoder
    
        Venc_delete();
    //////////////////
    	
    
        if (gMultiCh_VdecVdisObj.enableVideoFrameExport)
        {
            System_linkDelete(gMultiCh_VdecVdisObj.mergeId);
        }
    
        System_linkDelete(gMultiCh_VdecVdisObj.mpSclrId);
        System_linkDelete(gMultiCh_VdecVdisObj.dupId);
        System_linkDelete(gMultiCh_VdecVdisObj.ipcOutVideoId );
        System_linkDelete(gMultiCh_VdecVdisObj.ipcInVpssId );
    
    // new stuff for encoder
        System_linkDelete(gMultiCh_VdecVdisObj.ipcOutVpssId );
        System_linkDelete(gMultiCh_VdecVdisObj.ipcInVideoId );
    	//////////////
    	
    
        /* Print the HWI, SWI and all tasks load */
        /* Reset the accumulated timer ticks */
        MultiCh_prfLoadCalcEnable(FALSE, TRUE, FALSE);
    
    
        if (tilerEnable == FALSE)
        {
            /* Disable tiler allocator for this usecase
             * for that tiler memory can be reused for
             * non-tiled allocation
             */
            SystemTiler_enableAllocator();
        }
    }
    
    8484.demo_vdec_vdis.c
    /*==============================================================================
     * @file:       demo_vdec_vdis.c
     *
     * @brief:      Video capture mcfw function definition.
     *
     * @vers:       0.5.0.0 2011-06
     *
     *==============================================================================
     *
     * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
     *
     *  Redistribution and use in source and binary forms, with or without
     *  modification, are permitted provided that the following conditions
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     */
    #include <sys/time.h>
    #include <demo_vdec_vdis.h>
    #include <demo_vcap_venc_vdis.h>
    
    //#define VDEC_VDIS_ENABLE_IPCFRAMESOUT                 (TRUE)
    
    static Int64 get_current_time_to_msec(void)
    {
        struct timeval tv;
        gettimeofday(&tv, NULL);
    
        return ((Int64)tv.tv_sec*1000 + tv.tv_usec/1000);
    }
    
    Void VdecVdis_start()
    {
        VSYS_PARAMS_S vsysParams;
        VDEC_PARAMS_S vdecParams;
        VDIS_PARAMS_S vdisParams;
        VDIS_MOSAIC_S sVdMosaicParam;
    
    	// added for encoding
        VENC_PARAMS_S vencParams;
    
    
        UInt32 i,status;
        Bool forceLowCostScale = FALSE;
        UInt32 startChID;
        UInt64 wallTimeBase;
    
    /*        while(1){
        printf("Nissim   Nissim  Nissim");				//Nissim Debug
        }
    */    
        VdecVdis_bitsRdInit();
    
        #ifdef VDEC_VDIS_ENABLE_IPCFRAMESOUT
        VdecVdis_ipcFramesCreate();
        #endif
    
        gDemo_info.maxVcapChannels = 0;
        gDemo_info.maxVdisChannels = gVdecVdis_config.fileNum;
        gDemo_info.maxVencChannels = 1;  // AARON change for encoder
        gDemo_info.maxVdecChannels = gVdecVdis_config.fileNum;
    
    
    // added for encoding
        vencParams.numPrimaryChn   = 0;
        vencParams.numSecondaryChn = 0; /// ???? 
        gDemo_info.maxVencChannels = 2;
        vencParams.numPrimaryChn   = gDemo_info.maxVencChannels;
    
    
        vdecParams.numChn = gVdecVdis_config.fileNum;
        vdisParams.numChannels = gVdecVdis_config.fileNum;
    
        Vsys_params_init(&vsysParams);
        vsysParams.systemUseCase = VSYS_USECASE_MULTICHN_VDEC_VDIS;
        vsysParams.enableCapture = FALSE;
        vsysParams.enableNsf     = FALSE;
    
    // changed for encode
    //    vsysParams.enableEncode  = FALSE;
        vsysParams.enableEncode  = TRUE;
    
    
        vsysParams.enableDecode  = TRUE;
        vsysParams.enableNullSrc = FALSE;
        vsysParams.enableAVsync  = TRUE;
        vsysParams.numDeis       = 0;
    #if defined(TI_814X_BUILD) || defined(TI_8107_BUILD)
        vsysParams.numSwMs       = 2;
        vsysParams.numDisplays   = 2;
    #else
        vsysParams.numSwMs       = 2;
        vsysParams.numDisplays   = 2;
    #endif
    
        printf ("--------------- CHANNEL DETAILS-------------\n");
        printf ("Dec Channels => %d\n", vdecParams.numChn);
        printf ("Disp Channels => %d\n", vdisParams.numChannels);
        printf ("Enc Channels => %d    AARON\n", vencParams.numPrimaryChn);
        printf ("-------------------------------------------\n");
    
        /* Override the context here as needed */
        Vsys_init(&vsysParams);
    
        Vdec_params_init(&vdecParams);
        /* Override the context here as needed */
    
        vdecParams.numChn = gVdecVdis_config.fileNum;
        vdecParams.forceUseDecChannelParams = TRUE;
    
        OSA_assert( vdecParams.numChn <= VDEC_CHN_MAX );
    
        for (i=0; i < vdecParams.numChn; i++) {
    
            vdecParams.decChannelParams[i].dynamicParam.frameRate = 30; // NOT USED
            vdecParams.decChannelParams[i].dynamicParam.targetBitRate = 2 * 1000 * 1000; // NOT USED
            if (gVdecVdis_config.fileInfo[i].width != 0 && gVdecVdis_config.fileInfo[i].height != 0)
            {
                vdecParams.decChannelParams[i].maxVideoWidth = gVdecVdis_config.fileInfo[i].width;
                vdecParams.decChannelParams[i].maxVideoHeight = gVdecVdis_config.fileInfo[i].height;
            }
            else
            {
                printf(" ERROR: Invalid Decoder width x height !!!\n");
                OSA_assert(0);
            }
    
            /*If the codec type is missing, by default choose h264*/
            if(strlen(gVdecVdis_config.fileInfo[i].codec) == 0)
                strcpy(gVdecVdis_config.fileInfo[i].codec,"h264");
    
            if(strcmp(gVdecVdis_config.fileInfo[i].codec,"h264") == 0)
            {
                vdecParams.decChannelParams[i].isCodec = VDEC_CHN_H264;
                printf("ch[%d], h264\n",i);
            }
            else if(strcmp(gVdecVdis_config.fileInfo[i].codec,"mpeg4") == 0)
            {
                vdecParams.decChannelParams[i].isCodec = VDEC_CHN_MPEG4;
                vdecParams.decChannelParams[i].dynamicParam.frameRate = 30;
                vdecParams.decChannelParams[i].dynamicParam.targetBitRate = 2 * 1000 * 1000;
    
                printf("ch[%d], mpeg4\n",i);
            }
            else if(strcmp(gVdecVdis_config.fileInfo[i].codec,"mjpeg") == 0)
            {
                vdecParams.decChannelParams[i].isCodec = VDEC_CHN_MJPEG;
                vdecParams.decChannelParams[i].dynamicParam.frameRate = 1;
                vdecParams.decChannelParams[i].dynamicParam.targetBitRate = 2 * 1000 * 1000;
                printf("ch[%d], jpeg\n",i);
    
            }
    
            vdecParams.decChannelParams[i].displayDelay = gVdecVdis_config.fileInfo[i].displaydelay;
            vdecParams.decChannelParams[i].numBufPerCh = gVdecVdis_config.fileInfo[i].numbuf;
    
        }
    
    
    // ADDED FOR ENCODING
    printf("Venc_init ---- AARON\n");
        Venc_init(&vencParams);
    /////
    printf("after Venc_init ---- AARON\n");
    
    
    
        Vdec_init(&vdecParams);
        Vdis_params_init(&vdisParams);
        /* Override the context here as needed */
        vdisParams.numChannels = gVdecVdis_config.fileNum;
    
        vdisParams.deviceParams[VDIS_DEV_HDMI].resolution   = DEMO_HD_DISPLAY_DEFAULT_STD;
        /* Since HDCOMP and DVO2 are tied together they must have same resolution */
        vdisParams.deviceParams[VDIS_DEV_HDCOMP].resolution = DEMO_HD_DISPLAY_DEFAULT_STD;
        vdisParams.deviceParams[VDIS_DEV_DVO2].resolution   =
                               vdisParams.deviceParams[VDIS_DEV_HDMI].resolution;
        vdisParams.deviceParams[VDIS_DEV_SD].resolution     = VSYS_STD_NTSC;
    
        Vdis_tiedVencInit(VDIS_DEV_HDCOMP, VDIS_DEV_DVO2, &vdisParams);
    
    printf("after Vdis_tiedVencInit ---- AARON\n");
    
    
    #if defined(TI_814X_BUILD) || defined(TI_8107_BUILD)
        /* set for 2 displays */
        i = 0;
        Demo_swMsGenerateLayout(VDIS_DEV_HDMI, 0, vdecParams.numChn,
                              DEMO_LAYOUT_MODE_4CH,
                              &vdisParams.mosaicParams[VDIS_DEV_HDMI], forceLowCostScale, gDemo_info.Type,
                              Vdis_getSwMsLayoutResolution(VDIS_DEV_HDMI));
        vdisParams.mosaicParams[VDIS_DEV_HDMI].userSetDefaultSWMLayout = TRUE;
    
        if(vdecParams.numChn < 16)
            startChID = 0;
        else
            startChID = 16;
        i = 1;
        Demo_swMsGenerateLayout(VDIS_DEV_SD, startChID, vdecParams.numChn,
                              DEMO_LAYOUT_MODE_4CH,
                              &vdisParams.mosaicParams[VDIS_DEV_SD], forceLowCostScale, gDemo_info.Type,
                              Vdis_getSwMsLayoutResolution(VDIS_DEV_SD));
        vdisParams.mosaicParams[VDIS_DEV_SD].userSetDefaultSWMLayout = TRUE;
    #else
        /* set for 3 displays */
        i = 0;
        Demo_swMsGenerateLayout(VDIS_DEV_HDMI, 0, vdecParams.numChn,
                              DEMO_LAYOUT_MODE_4CH_4CH,
                              &vdisParams.mosaicParams[i], forceLowCostScale,
                              gDemo_info.Type,
                              Vdis_getSwMsLayoutResolution(VDIS_DEV_HDMI));
        vdisParams.mosaicParams[i].userSetDefaultSWMLayout = TRUE;
    
    
        if(vdecParams.numChn < 16)
            startChID = 0;
        else
            startChID = 16;
        i = 1;
        Demo_swMsGenerateLayout(VDIS_DEV_HDCOMP, startChID, vdecParams.numChn,
                              DEMO_LAYOUT_MODE_4CH_4CH,
                              &vdisParams.mosaicParams[i], forceLowCostScale,
                              gDemo_info.Type,
                              Vdis_getSwMsLayoutResolution(VDIS_DEV_HDCOMP));
        vdisParams.mosaicParams[i].userSetDefaultSWMLayout = TRUE;
    
    #endif
        Vdis_init(&vdisParams);
    
        wallTimeBase = get_current_time_to_msec();
        wallTimeBase = 0;
        Vdis_setWallTimeBase(wallTimeBase);
    
    
    
    
    // ADDED FOR ENCODING
        /* Init the application specific module which will handle bitstream exchange */
        VcapVenc_bitsWriteCreate();           // ??????????
    
    ///
    printf("after VcapVenc_bitsWriteCreate() ---- AARON\n");
    
    
    
    
        /* Configure display */
        Vsys_configureDisplay();
    
    #if USE_FBDEV
        grpx_init(GRPX_FORMAT_RGB565);
    #endif
        printf("Vsys_create()\n");
        /* Create Link instances and connects compoent blocks */
        Vsys_create();
        printf("done Vsys_create()\n");
        /* This is done to re-map ch to window mappping when no. of chan are <16 */
        if(vdecParams.numChn < 16)
        {
            status = Vdis_getMosaicParams(1,&sVdMosaicParam);
            status = Vdis_setMosaicParams(1, &sVdMosaicParam);
        }
    
        /* Start components in reverse order */
        Vdis_start();
    
    // added for encoding
    	Venc_start();
    	
        Vdec_start();
    
    ////////////// added for encoding ... ??? needed??? ////
        /* reset statistics */
        VcapVenc_resetStatistics();
    ///////////////////////////////
    
    
        #ifdef VDEC_VDIS_ENABLE_IPCFRAMESOUT
        VdecVdis_ipcFramesStart();
        #endif
    
        VdecVdis_bitsRdStart();
    
    
    // for encoder ... needed?
    //VcapVencVdecVdisCustom_setSwMs(VDIS_DEV_SD, 0, DEMO_LAYOUT_MODE_1CH, vdisParams.deviceParams[VDIS_DEV_SD].resolution);
    	
    }
    
    Void VdecVdis_stop()
    {
        VdecVdis_bitsRdStop();
    
        #ifdef VDEC_VDIS_ENABLE_IPCFRAMESOUT
        VdecVdis_ipcFramesStop();
        #endif
    
        /* Stop components */
        Vdec_stop();
        Vdis_stop();
    
    	
    /////// for encoding////////////////////
    	    Venc_stop();
    	 /* delete bits write */
        VcapVenc_bitsWriteDelete();
    ////////////////////////
    
    
    #if USE_FBDEV
        grpx_exit();
    #endif
    
        Vsys_delete();
    
        /* De-configure display */
        Vsys_deConfigureDisplay();
    
    
        /* De-initialize components */
        Vdec_exit();
        Vdis_exit();
    
    // for encoder////
        Venc_exit();
    ///////////////
    
    	
        Vsys_exit();
    
        VdecVdis_bitsRdExit();
    
        #ifdef VDEC_VDIS_ENABLE_IPCFRAMESOUT
        VdecVdis_ipcFramesDelete();
        #endif
    
    }
    
    

  • whoops! I realized my mistake. I should have created the dup link before the encoder link (and vpss and m3 links going to the encoder ...)

    now i have made it past that exception :)

  • Hi Aaron:

       I met the same problem as you(flashing), So how to do the "Cache_coherency operation" , and what I used is DM8127(RDK3.5), thanks