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.

DisplyLink handling Single frame only

Hi All,

I was creating my usecase like

IpcBitsOutHLOSId->IpcBItsInVideo->DecId->swMsId->displayId

From *.avi file i was reading frame using av_read_frame() (using FFMPEG API) and copying the single packet to IpcBitsOutLink_putFullVideoBitStreamBufs() then its followed the usecase link data flow

the output of this usecase I was getting single frame appearing in display after that no frames in display.

the decode print statics is below.

 [m3video]  *** DECODE Statistics ***
 [m3video]
 [m3video]  Elasped Time           : 0 secs
 [m3video]
 [m3video]
 [m3video]  CH  | In Recv In User  Out
 [m3video]  Num | FPS     Skip FPS FPS
 [m3video]  -----------------------------------
 [m3video]    0 |       0        0   0

what could be the root cause of this issue?.

Regards,

Kolanchi

  • This usecase is similar to DVRRDK multich_vdec_vdis usecase and should work. Invoke Vsys_printBufferStatistics and share the logs.What is the DVRRDK version you are using.

  • Hi Badri,

    Thanks for your reply,

    I was working on IPNC RDK 3.5 version

    I was getting error in decoderLink Extended error

     [host] PLAYBACK_STATE_RUNNING
     [m3video] 47679:DECLINK::links_m3video/iva_dec/decLink_h264.c:[333]::INTERNAL ERROR:-1
     [m3video] ALGPROCESS FAILED:STATUS
     [m3video] outArgs->viddec3OutArgs.extendedError for channel 0 Error: 0x401
     [m3video] Sequence called number 90
     [m3video] 47691:DECLINK::links_m3video/iva_dec/decLink_h264.c:[333]::INTERNAL ERROR:-1
     [m3video] ALGPROCESS FAILED:STATUS
     [m3video] outArgs->viddec3OutArgs.extendedError for channel 0 Error: 0x401
     [m3video] Sequence called number 91
     [m3video] 47702:DECLINK::links_m3video/iva_dec/decLink_h264.c:[333]::INTERNAL ERROR:-1
     [m3video] ALGPROCESS FAILED:STATUS
     [m3video] outArgs->viddec3OutArgs.extendedError for channel 0 Error: 0x401
     [m3video] Sequence called number 92
     [m3video] 47734:DECLINK::links_m3video/iva_dec/decLink_h264.c:[333]::INTERNAL ERROR:-1
     [m3video] ALGPROCESS FAILED:STATUS
     [m3video] outArgs->viddec3OutArgs.extendedError for channel 0 Error: 0x401
     [m3video] Sequence called number 94

    After enabling Vsys_printBufferStatistics in ti_mcfw_ipnc_main.c

    below is the log this statics is comming after completion of playback ( after reaching end of file)

     [m3vpss ]  *** [SWMS0] Mosaic Statistics ***
     [m3vpss ] 74186: SWMS: Rcvd from prev = 1, Returned to prev = 0
     [m3vpss ] SWMS Out  Buf Q Status
     [m3vpss ] Empty Q -> count 3, wrPtr 100, rdPtr 97
     [m3vpss ] Full Q -> count 1, wrPtr 97, rdPtr 96
     [m3vpss ]
     [m3vpss ]  *** Display Statistics ***
     [m3vpss ] 74187: DISPLAY: Rcvd from prev = 2017, Returned to prev = 2015, BufsInDriver = 4
     [m3video]
     [m3video]  *** Encode Statistics ***
     [m3video]   74699: ENC: Rcvd from prev = 1711, Returned to prev = 1710
     [m3video]  ENC Out  BitBuf Q Status
     [m3video] Empty Q 0 -> count 7, wrPtr 357, rdPtr 350
     [m3video] Empty Q 1 -> count 4, wrPtr 344, rdPtr 340
     [m3video] Full Q -> count 0, wrPtr 305, rdPtr 305
     [m3video]
     [m3vidPHY 0:00 not found
    eo]  *** Decode Statistics ***
     [m3video]  74700: DEC: Rcvd from prev = 148, Returned to prev = 148
     [m3video] DEC Out  BufExt Q Status
     [m3video] Empty Q 0 -> count 2, wrPtr 150, rdPtr 148
     [m3video] Full Q -> count 0, wrPtr 106, rdPtr 106


    I have done some changes in buffer handling after that I was facing this issue.

    Regards,

    Kolanchi

  • Hi Badri,

    I was getting assertion failure in my usecase when, I start a playback

    from the log assertion issue part is below

    ********************************************* log **********************************************
    a040]max_analyze_duration reached
    353: PB_LOGS: Started playback of /opt/dvr/media/text.avi file
    [host] PLAYBACK_STATE_START
     [m3video] KOLANCHI : IpcOutM3Link_processFrames 293
     [m3vpss ]  68190: Assertion @ Line: 105 in links_common/system/system_linkApi.c: linkId < SYSTEM_LINK_ID_MAX : failed !!!

     [host] PLAYBACK_STATE_START

     [host] PLAYBACK_STATE_RUNNING

     [host] PLAYBACK_STATE_RUNNING

    ********************************************* log **********************************************


    after my analyzis assertion failure is from IpcOutM3Link below API.

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

    In my usecase data flow is

    IpcBitsOutId->IpcInM3->decId->IpcOutM3->IpcInVpss->swMs->displayId

    Assertion issue from decId->IpcOutM3 and below is my usecase application parameter

    (IpcInM3->decId->IpcOutM3 these part src available below)

    can you please suggets is there any parameter is wrong in the decId, IpcOutM3.
     

    *********************************** usecase code ***************************************************
           /* IPC BITS IN VIDEO Link */
            ipcBitsInVideoPrm.baseCreateParams.inQueParams.prevLinkId    = gVdecModuleContext.ipcBitsOutHLOSId;
            ipcBitsInVideoPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
            ipcBitsInVideoPrm.baseCreateParams.numOutQue                 = 1;
            ipcBitsInVideoPrm.baseCreateParams.outQueParams[0].nextLink  = gVdecModuleContext.decId;
            ipcBitsInVideoPrm.baseCreateParams.noNotifyMode              = FALSE;
            ipcBitsInVideoPrm.baseCreateParams.notifyNextLink            = TRUE;
            ipcBitsInVideoPrm.baseCreateParams.notifyPrevLink            = TRUE;
            ipcBitsInVideoPrm.baseCreateParams.inputFrameRate              = 30;
            ipcBitsInVideoPrm.baseCreateParams.outputFrameRate              = 30;

            /* DEC Link */
        DecLink_CreateParams_Init(&decPrm);

      for (i = 0; i < ipcBitsOutHostPrm.inQueInfo.numCh; i++)
        {
                decPrm.chCreateParams[i].format                               = IVIDEO_H264HP;
                decPrm.chCreateParams[i].profile                              = IH264VDEC_PROFILE_ANY;
                decPrm.chCreateParams[i].fieldMergeDecodeEnable               = FALSE;
                decPrm.chCreateParams[i].targetMaxWidth                       = ipcBitsOutHostPrm.inQueInfo.chInfo[i].width;
                decPrm.chCreateParams[i].targetMaxHeight                      = ipcBitsOutHostPrm.inQueInfo.chInfo[i].height;
                decPrm.chCreateParams[i].defaultDynamicParams.targetFrameRate = encPrm.chCreateParams[i].defaultDynamicParams.inputFrameRate;
                decPrm.chCreateParams[i].defaultDynamicParams.targetBitRate   = gVdecModuleContext.vdecConfig.decChannelParams[i].dynamicParam.targetBitRate;

                /* Max ref frames is only 2 as this is closed loop decoder */
                decPrm.chCreateParams[i].dpbBufSizeInFrames = 2;
        }
            decPrm.inQueParams.prevLinkId    = gVdecModuleContext.ipcBitsInRTOSId;
            decPrm.inQueParams.prevLinkQueId = 0;
            decPrm.outQueParams.nextLink     = gIpcOutVideoId_cbb;
        decPrm.tilerEnable               = TILER_ENABLE;
            decPrm.numBufPerPool[0]          = NUM_DECODE_BUFFERS;

            /* FRAMES OUT VIDEO Link */
            ipcOutVideoPrm.inQueParams.prevLinkId    = gVdecModuleContext.decId;
            ipcOutVideoPrm.inQueParams.prevLinkQueId = 0;
            ipcOutVideoPrm.numOutQue                 = 1;
            ipcOutVideoPrm.outQueParams[0].nextLink  = gIpcInVpssId_cbb;
            ipcOutVideoPrm.notifyNextLink            = TRUE;
            ipcOutVideoPrm.notifyPrevLink            = TRUE;
            ipcOutVideoPrm.noNotifyMode              = FALSE;

    *********************************** usecase code ***************************************************

    Regards,
    Kolanchi.

  • The decode error is because you are needing one full frame for decode.CHeck your application is feeding correct bitstream data for decode.

     

    The assert is issue with your link connection. Assert indicates prevLinkId to ipcOutVideo is wrong.

    Check you are populating correct link IDs for gVdecModuleContext.decId, gIpcInVpssId_cbb,gVdecModuleContext.decId,gVdecModuleContext.ipcBitsOutHLOSId

    and you are creating links in correct order as below

    ipcBitsOutHost,ipcBitsInRTOSVIdeo,decLink,ipcOutM3Video,ipcInM3Vpss

     

  • Hi Badri,

    below is my link Ids  and link creation order

            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;
            gIpcOutVideoId_cbb = SYSTEM_VIDEO_LINK_ID_IPC_OUT_M3_0;
            gIpcInVpssId_cbb = SYSTEM_VPSS_LINK_ID_IPC_IN_M3_0;
            gVdisModuleContext.swMsId[0]=SYSTEM_LINK_ID_SW_MS_MULTI_INST_0;
            gDisplayId = SYSTEM_LINK_ID_DISPLAY_0;

            /* Link Creation */
            System_linkCreate(gVdecModuleContext.ipcBitsOutHLOSId,&ipcBitsOutHostPrm,sizeof(ipcBitsOutHostPrm));
            System_linkCreate(gVdecModuleContext.ipcBitsInRTOSId,&ipcBitsInVideoPrm,sizeof(ipcBitsInVideoPrm));
            System_linkCreate(gVdecModuleContext.decId,&decPrm,sizeof(decPrm));
            System_linkCreate(gIpcOutVideoId_cbb,&ipcOutVideoPrm,sizeof(ipcOutVideoPrm));
            System_linkCreate(gIpcInVpssId_cbb,&ipcInVpssPrm,sizeof(ipcInVpssPrm));
            System_linkCreate(gVdisModuleContext.swMsId[0],&swMsPrm,sizeof(swMsPrm));
            System_linkCreate(gDisplayId, &displayPrm,sizeof(displayPrm));

    pls correct me if anything is wrong.

    Regsrds,

    Kolanchi.

  • Links IDs are correct. Attach your console logs and actual source code where you are creating and connecting links.Check IPNC documentation if decode display is supported. It may be disabled to reduce power.

  • /** ==================================================================
     *  @file   multich_tristream_fullFeature.c
     *
     *  @path    ipnc_mcfw/mcfw/src_linux/mcfw_api/usecases/
     *
     *  @desc   This  File contains.
     * ===================================================================
     *  Copyright (c) Texas Instruments Inc 2011, 2012
     *
     *  Use of this software is controlled by the terms and conditions found
     *  in the license agreement under which this software has been supplied
     * ===================================================================*/
    
    /*------------------------------ TRIPLE OUT <1080p + D1 + MJPEG> ----------------------------------
    									  SENSOR
                                    ________||_______
    				|----SALDRE ON--|	CAMERA LINK  |
    				|				|    ISP LINK    |
    				|				|________________|
    		GLBCE_LINK
    				|
    				|				__________________
    				|				|	CAMERA LINK  |
    				|---SALDRE ON---|    ISP LINK    |
    								|________________|
                                        Capture
    								 RSZA     RSZB
                                   1080P60    D130
                           (YUV420/YUV422I) (YUV420)	 |------------- SD DISPLAY
                                      |			|		 |
                                      |         |		(2)
    								 NSF	    ----- DUP_1(1) --------- SCALER
                                  (YUV420)              (0)                 |
                                      |                  |                  |
                                      |			         |               DUP_3(0)-------- FD 
                                      |			|---------                 (1)
    							   	  |			|                           |----------------
    								  |         |							|				| 					
    					--------------|         |					IPC FRAMES OUT(VPS) 	|
    					|                       |                           |				|(VA on VPS)
    					|                       |                			|				|
                     DUP_2(0)-------------|     |					 IPC FRAMES IN(DSP) 	|	
                       (1)        |---|   |     |             				|				|
    					|		  |   |---|-----|              				|---------------|				
    					|---------|       |                    			    |	
    									  |                             VA(VPS/DSP)
    									MERGE                  
    									  |                    
    									  |                    
    									SWOSD
                                          |
                                          |
    								   DUP_4(1)----------- HDMI DISPLAY
                                          |
    									  |	
    								IPCM3OUT(VPS)
    									  |
    									  |
    				        		 IPCM3IN(VID)
    									  |
    									  |
    								    H264ENC
    									  |
    									  |
    								  BITSOUT (VID)
    								  	  |
    								  	  |
    								  BITSIN (A8)
    ------------------------------------------------------------------------------------------*/
    
    #include "mcfw/src_linux/mcfw_api/usecases/multich_common.h"
    #include "mcfw/src_linux/mcfw_api/usecases/multich_ipcbits.h"
    #include "demos/mcfw_api_demos/multich_usecase/ti_mcfw_ipnc_main.h"
    
    #ifdef IPNC_DSP_ON
    	#define VA_ON_DSP
    #endif
    
    #define RESOLUTION_QVGA    //RAJESH
    //#define BYPASS_DISPLAY    //RAJESH
    
    
    /*in YUV sensor case, Enabling GLBCE means enabling Memory 2 Memory  */
    #ifdef IMGS_OMNIVISION_OV10630
    	#define YUV_M2M_DRV_TEST
    #endif
    
    
    #define NUM_DECODE_BUFFERS              (4)
    #define NUM_IPC_OUT_BUFFERS     (4)
    
    #define DEI_OUT_MAIN_STRAMER    (DEI_LINK_OUT_QUE_DEI_SC)   // YUV422I WB0/1
    #define DEI_OUT_SUB_STRAMER             (DEI_LINK_OUT_QUE_VIP_SC) // (or) DEI_LINK_OUT_QUE_VIP_SC_SECONDARY_OUT  => YUV422I, YUV420SP on VIP0/1,
    
    extern UInt32 gIsGlbceInitDone;
    extern GlbcePreset gGLBCE_AlgoPreset;
    
    /* =============================================================================
     * Externs
     * ============================================================================= */
    
    /* =============================================================================
     * Use case code
     * ============================================================================= */
    static SystemVideo_Ivahd2ChMap_Tbl systemVid_encDecIvaChMapTbl = {
        .isPopulated = 1,
        .ivaMap[0] = {
                      .EncNumCh = 2,
                      .EncChList = {0, 1},
                      .DecNumCh = 2,
                      .DecChList = {0, 1},
                      },
    
    };
    #ifdef ENABLE_TILER
    	#define TILER_ENABLE    TRUE
    #else
    	#define TILER_ENABLE    FALSE
    #endif
    
    /* Merge Link for camera streams */
    #define NUM_MERGE_LINK              (1)
    #define CAM_STREAM_MERGE_IDX        (0)
    
    /* Dup Links */
    #define NUM_DUP_LINK				(4)
    #define DIS_DUP_IDX					(0)
    #define MJPEG_DUP_LINK_IDX			(1)
    #define SCALER_DUP_IDX				(2)
    #define VA_DUP_IDX					(3)   
    
    UInt32 gIpcOutVpssId_cbb;
    UInt32 gIpcInVideoId_cbb;
    UInt32 gIpcOutVideoId_cbb;
    UInt32 gIpcInVpssId_cbb;
    UInt32 gDisplayId;
    
    /* ===================================================================
     *  @func     MultiCh_mipiCameraFullFtr
     *
     *  @desc     Function does the following
     *
     *  @modif    This function modifies the following structures
     *
     *  @inputs   This function takes the following inputs
     *            <argument name>
     *            Description of usage
     *            <argument name>
     *            Description of usage
     *
     *  @outputs  <argument name>
     *            Description of usage
     *
     *  @return   Return value of this function if any
     *  ==================================================================
     */
    Void MultiCh_createStreamMipiCameraFullFtr()
    {
        UInt32 i;
    
        CameraLink_CreateParams cameraPrm;
    
        IspLink_CreateParams  ispPrm;
    
        UInt32 ispId;
    
        GlbceLink_CreateParams  glbcePrm;
    
        UInt32 glbceId;	
    
        NsfLink_CreateParams nsfPrm;
    
        VnfLink_CreateParams vnfPrm;
    
        MergeLink_CreateParams mergePrm[NUM_MERGE_LINK];
    
        IpcLink_CreateParams ipcOutVpssPrm;
    
        IpcLink_CreateParams ipcInVideoPrm;
    
        EncLink_CreateParams encPrm;
    
        DupLink_CreateParams dupPrm[NUM_DUP_LINK];
    
        SclrLink_CreateParams       sclrPrm;
    
    //#ifndef BYPASS_DISPLAY
        DisplayLink_CreateParams displayPrm ;
    //#endif
    
    #ifndef  RESOLUTION_QVGA
        DisplayLink_CreateParams displayPrm_SD;
    #endif
    
        FdLink_CreateParams fdPrm;
    
        SwosdLink_CreateParams swosdPrm;
    
        IpcBitsOutLinkRTOS_CreateParams ipcBitsOutVideoPrm;
    
        IpcBitsInLinkHLOS_CreateParams ipcBitsInHostPrm0;
    
        VstabLink_CreateParams vstabPrm;
    
        GlbceSupportLink_CreateParams glbceSupportPrm;
    
        VaLink_CreateParams vaPrm;  
    
        IpcFramesOutLinkRTOS_CreateParams ipcFramesOutVpssPrm;
    
        IpcFramesInLinkRTOS_CreateParams ipcFramesInDspPrm;
    	
        CameraLink_VipInstParams *pCameraInstPrm;
    
        CameraLink_OutParams *pCameraOutPrm;
    	
        UInt32 mergeId[NUM_MERGE_LINK];
    
        UInt32 ipcOutVpssId;
    
        UInt32 ipcInVideoId;
    
        UInt32 dupId[NUM_DUP_LINK];
    
        UInt32 vstabId;
    
        UInt32 glbceSupportId;
    
        UInt32 ipcFramesOutVpssId;
    
        UInt32 ipcFramesInDspId;	
    
    
            //System_LinkInfo bitsProducerLinkInfo;                   //      KOLANCHI
    
            IpcBitsOutLinkHLOS_CreateParams ipcBitsOutHostPrm;
            IpcBitsInLinkRTOS_CreateParams ipcBitsInVideoPrm;
    
            DecLink_CreateParams decPrm;
    
            IpcLink_CreateParams ipcOutVideoPrm;
            IpcLink_CreateParams ipcInVpssPrm;
    	SwMsLink_CreateParams           swMsPrm;
    
    #ifdef WDR_ON
            OSA_printf("RAJESH: WDR_ON\n")  ;
    	WdrLink_CreateParams  wdrPrm;
    	UInt32 wdrId;
    	UInt32 wdrSupportId;
            WdrSupportLink_CreateParams wdrSupportPrm;
    #else
            OSA_printf("RAJESH: WDR_OFF\n")  ;
    
    #endif
    
        /* IPC struct init */
     
        MULTICH_INIT_STRUCT(IpcLink_CreateParams, ipcOutVpssPrm);
        MULTICH_INIT_STRUCT(IpcLink_CreateParams, ipcInVideoPrm);
        MULTICH_INIT_STRUCT(IpcBitsOutLinkRTOS_CreateParams, ipcBitsOutVideoPrm);
        MULTICH_INIT_STRUCT(IpcBitsInLinkHLOS_CreateParams, ipcBitsInHostPrm0);
        MULTICH_INIT_STRUCT(IpcFramesOutLinkRTOS_CreateParams, ipcFramesOutVpssPrm);
        MULTICH_INIT_STRUCT(IpcFramesInLinkRTOS_CreateParams, ipcFramesInDspPrm);	
    
         MULTICH_INIT_STRUCT(IpcBitsOutLinkHLOS_CreateParams,ipcBitsOutHostPrm);
            MULTICH_INIT_STRUCT(IpcBitsInLinkRTOS_CreateParams,ipcBitsInVideoPrm);
    
    
        if(Vsys_getSystemUseCase() == VSYS_USECASE_TRISTREAM_SMARTANALYTICS)
    	{
    		OSA_printf("\nRAJESH: ********** SMART ANALYTICS USECASE ********\n");
    		OSA_printf
    			("********* Entered Smart Analytics usecase - H264 1080p @60fps + H264 D1 @30fps + MJPEG 1080p @5fps ********\n\n");	
    	}
    	else
    	{
    		OSA_printf("\nRAJESH: ********** FULL FEATURE USECASE ********\n");
    		OSA_printf
    			("********* Entered Tri Streaming usecase - H264 1080p @60fps + H264 D1 @30fps + MJPEG 1080p @5fps ********\n\n");
    	}	
    
        MultiCh_detectBoard();
    
        System_linkControl(SYSTEM_LINK_ID_M3VPSS,
                           SYSTEM_M3VPSS_CMD_RESET_VIDEO_DEVICES, NULL, 0, TRUE);
    
        System_linkControl(SYSTEM_LINK_ID_M3VIDEO,
                           SYSTEM_COMMON_CMD_SET_CH2IVAHD_MAP_TBL,
                           &systemVid_encDecIvaChMapTbl,
                           sizeof(SystemVideo_Ivahd2ChMap_Tbl), TRUE);
    
        /* Link IDs */
        gVcamModuleContext.cameraId = SYSTEM_LINK_ID_CAMERA;
    
    
        gVencModuleContext.encId = SYSTEM_LINK_ID_VENC_0;
    
        gMjpegModuleContext.mjpepEncId = SYSTEM_LINK_ID_MJPEG;
    
        mergeId[CAM_STREAM_MERGE_IDX] = SYSTEM_VPSS_LINK_ID_MERGE_0;
        
        dupId[DIS_DUP_IDX] = SYSTEM_VPSS_LINK_ID_DUP_0;  
    
        dupId[MJPEG_DUP_LINK_IDX] = SYSTEM_VPSS_LINK_ID_DUP_1;
    
        dupId[SCALER_DUP_IDX] = SYSTEM_VPSS_LINK_ID_DUP_2;
    
        dupId[VA_DUP_IDX] = SYSTEM_VPSS_LINK_ID_DUP_3; 
    
        gVcamModuleContext.sclrId[0] = SYSTEM_LINK_ID_SCLR_INST_0;
    
        gVsysModuleContext.fdId = SYSTEM_LINK_ID_FD;  //NOT USING
    
        gVsysModuleContext.swOsdId = SYSTEM_LINK_ID_SWOSD_0;
    
        ispId = SYSTEM_LINK_ID_ISP_0;
    
        glbceId = SYSTEM_LINK_ID_GLBCE;
    
        vstabId = SYSTEM_LINK_ID_VSTAB_0;
    
        glbceSupportId = SYSTEM_LINK_ID_GLBCE_SUPPORT_0;
    
    
        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;
        gVdecModuleContext.ipcM3OutId = SYSTEM_VIDEO_LINK_ID_IPC_OUT_M3_0;
        gVdecModuleContext.ipcM3InId = SYSTEM_VPSS_LINK_ID_IPC_IN_M3_0;
        gDisplayId = SYSTEM_LINK_ID_DISPLAY_0;	
    
        gVdisModuleContext.swMsId[0] = SYSTEM_LINK_ID_SW_MS_MULTI_INST_0;
    
    
    
    #ifdef WDR_ON
    	wdrId = SYSTEM_LINK_ID_WDR;
    	wdrSupportId = SYSTEM_LINK_ID_WDR_SUPPORT;
    #endif
    
    //#ifndef BYPASS_DISPAY
        gVdisModuleContext.displayId[VDIS_DEV_HDMI] = SYSTEM_LINK_ID_DISPLAY_0 ;     
    //#endif
    
    #ifndef RESOLUTION_QVGA                                                            
        gVdisModuleContext.displayId[VDIS_DEV_SD] = SYSTEM_LINK_ID_DISPLAY_2 ;
    #endif
    
        ipcOutVpssId = SYSTEM_VPSS_LINK_ID_IPC_OUT_M3_0;
        ipcInVideoId = SYSTEM_VIDEO_LINK_ID_IPC_IN_M3_0;
        gVencModuleContext.ipcBitsOutRTOSId = SYSTEM_VIDEO_LINK_ID_IPC_BITS_OUT_0;
        gVencModuleContext.ipcBitsInHLOSId = SYSTEM_HOST_LINK_ID_IPC_BITS_IN_0;
    	ipcFramesOutVpssId = SYSTEM_VPSS_LINK_ID_IPC_FRAMES_OUT_0;
        ipcFramesInDspId   = SYSTEM_DSP_LINK_ID_IPC_FRAMES_IN_0;	
    
    #ifdef VA_ON_DSP
            OSA_printf("RAJESH: VA_ON_DSP\n") ;
    	gVsysModuleContext.vaId = SYSTEM_DSP_LINK_ID_VA;
    #else
            OSA_printf("RAJESH: VA_OFF_DSP\n");
        gVsysModuleContext.vaId = SYSTEM_VPSS_LINK_ID_VA;
    	if(Vsys_getSystemUseCase() == VSYS_USECASE_TRISTREAM_SMARTANALYTICS)
    	{
    		/* When VA is running on VPSS M3 then we cannot create ISS_NF 
    		   so forcing NF type to be DSS_NF */
    		gUI_mcfw_config.noisefilterMode = DSS_VNF_ON;
    	}
    #endif	
    
        if(gUI_mcfw_config.glbceEnable)
        {
                    OSA_printf("RAJESH: glbcEnable is on\n") ;
    		gVcamModuleContext.glbceId = glbceId;
    #ifdef WDR_ON
    		gVcamModuleContext.glbceId = SYSTEM_LINK_ID_INVALID;
    #endif
    
    		/* Camera Link params */
    		CameraLink_CreateParams_Init(&cameraPrm);
    		if (gUI_mcfw_config.noisefilterMode == DSS_VNF_ON)
    		{
    			gVcamModuleContext.nsfId = SYSTEM_LINK_ID_NSF_0;
    		}
    		else
    		{
    			gVcamModuleContext.vnfId = SYSTEM_LINK_ID_VNF;
    			cameraPrm.vnfLinkId = SYSTEM_LINK_ID_VNF;
    		}
    
    		cameraPrm.captureMode = CAMERA_LINK_CAPMODE_DDR;
    #ifdef YUV_M2M_DRV_TEST
    		cameraPrm.outQueParams[0].nextLink = ispId;
    #else
    		cameraPrm.outQueParams[0].nextLink = glbceId;
    	#ifdef WDR_ON
    		cameraPrm.outQueParams[0].nextLink = wdrId;
    	#endif
    #endif
    		cameraPrm.ispLinkId = ispId;
    
    		/* This is for TVP5158 Audio Channels - Change it to 16 if there are 16
    		 * audio channels connected in cascade */
    		cameraPrm.numAudioChannels = 0;
    		cameraPrm.numVipInst = 1;
    
    #if (TILER_ENABLE == TRUE)
    		cameraPrm.tilerEnable = TRUE;
    #else
    		cameraPrm.tilerEnable = FALSE;
    #endif
    
    		cameraPrm.vsEnable = gUI_mcfw_config.vsEnable;
    		cameraPrm.vstabLinkId = vstabId;
    
    		pCameraInstPrm = &cameraPrm.vipInst[0];
    		pCameraInstPrm->vipInstId = SYSTEM_CAMERA_INST_VP_CSI2;
    		pCameraInstPrm->videoDecoderId = MultiCh_getSensorId(gUI_mcfw_config.sensorId);
    		pCameraInstPrm->inDataFormat = SYSTEM_DF_YUV420SP_UV;
    
    #ifdef IMGS_OMNIVISION_OV10630
    		pCameraInstPrm->sensorOutWidth  = 1280;
    		pCameraInstPrm->sensorOutHeight = 720;
    #elif defined IMGS_SONY_IMX104
    		pCameraInstPrm->sensorOutWidth  = 1280;
    		pCameraInstPrm->sensorOutHeight = 720;
    #elif defined IMGS_MICRON_MT9M034
    		pCameraInstPrm->sensorOutWidth  = 1280;
    		pCameraInstPrm->sensorOutHeight = 736;
    #else
    		pCameraInstPrm->sensorOutWidth  = 1920;
    		pCameraInstPrm->sensorOutHeight = 1080;
    #endif
    
    		if (gUI_mcfw_config.noisefilterMode == DSS_VNF_ON)
    		{
    			pCameraInstPrm->standard = SYSTEM_STD_1080P_30;
    		}
    		else
    		{
    			pCameraInstPrm->standard = SYSTEM_STD_1080P_30;
    			cameraPrm.issVnfEnable = 1;
    		}
    
    		pCameraInstPrm->numOutput = 1;
    
    		pCameraOutPrm = &pCameraInstPrm->outParams[0];
    		pCameraOutPrm->scEnable = FALSE;
    
    #ifdef IMGS_OMNIVISION_OV10630
    		pCameraOutPrm->dataFormat = SYSTEM_DF_YUV422I_UYVY;		//SYSTEM_DF_YUV422I_VYUY;
    		pCameraOutPrm->scOutWidth = 1280;
    		pCameraOutPrm->scOutHeight = 720;
    #elif defined IMGS_SONY_IMX104
    		pCameraOutPrm->dataFormat = SYSTEM_DF_BAYER_RAW;
    		pCameraOutPrm->scOutWidth = 1280;
    		pCameraOutPrm->scOutHeight = 720;
    #elif defined IMGS_MICRON_MT9M034
    		pCameraOutPrm->dataFormat = SYSTEM_DF_BAYER_RAW;
    		pCameraOutPrm->scOutWidth = 1280;
    		pCameraOutPrm->scOutHeight = 736;
    #else
    		pCameraOutPrm->dataFormat = SYSTEM_DF_BAYER_RAW;
    		pCameraOutPrm->scOutWidth = 1920;
    		pCameraOutPrm->scOutHeight = 1080;
    #endif
    
    		pCameraOutPrm->outQueId = 0;
    
    		/* 2A config */
    		cameraPrm.t2aConfig.n2A_vendor = gUI_mcfw_config.n2A_vendor;
    		cameraPrm.t2aConfig.n2A_mode = gUI_mcfw_config.n2A_mode;
        }
    	else /*GLBCE OFF*/
    	{
                    OSA_printf("RAJESH: glbcEnable is off\n");
    
    		gVcamModuleContext.glbceId = SYSTEM_LINK_ID_INVALID;
    		/* Camera Link params */
    		CameraLink_CreateParams_Init(&cameraPrm);
    
    		if (gUI_mcfw_config.noisefilterMode == DSS_VNF_ON)
    		{
    			gVcamModuleContext.nsfId = SYSTEM_LINK_ID_NSF_0;
    		}
    		else
    		{
    			gVcamModuleContext.vnfId = SYSTEM_LINK_ID_VNF;
    			cameraPrm.vnfLinkId = SYSTEM_LINK_ID_VNF;
    		}
    
    		cameraPrm.captureMode = CAMERA_LINK_CAPMODE_ISIF;
    
    		if (gUI_mcfw_config.noisefilterMode == DSS_VNF_ON)
    			cameraPrm.outQueParams[0].nextLink  = gVcamModuleContext.nsfId;
    		else
    			cameraPrm.outQueParams[0].nextLink  = gVcamModuleContext.vnfId;
    
    		cameraPrm.outQueParams[1].nextLink = dupId[SCALER_DUP_IDX];
    
    		/* This is for TVP5158 Audio Channels - Change it to 16 if there are 16
    		 * audio channels connected in cascade */
    		cameraPrm.numAudioChannels = 1;
    		cameraPrm.numVipInst = 1;
    
    #if (TILER_ENABLE == TRUE)
    		cameraPrm.tilerEnable = TRUE;
    #else
    		cameraPrm.tilerEnable = FALSE;
    #endif
    
    		cameraPrm.vsEnable = gUI_mcfw_config.vsEnable;
    		cameraPrm.vstabLinkId = vstabId;
    
    		pCameraInstPrm = &cameraPrm.vipInst[0];
    		pCameraInstPrm->vipInstId = SYSTEM_CAMERA_INST_VP_CSI2;
    		pCameraInstPrm->videoDecoderId = MultiCh_getSensorId(gUI_mcfw_config.sensorId);
    		pCameraInstPrm->inDataFormat = SYSTEM_DF_YUV420SP_UV;
    
    #ifdef IMGS_OMNIVISION_OV10630
    		pCameraInstPrm->sensorOutWidth  = 1280;
    		pCameraInstPrm->sensorOutHeight = 720;
    #elif defined IMGS_SONY_IMX104
    		pCameraInstPrm->sensorOutWidth  = 1280;
    		pCameraInstPrm->sensorOutHeight = 720;
    #elif defined IMGS_MICRON_MT9M034
    		pCameraInstPrm->sensorOutWidth  = 1280;
    		pCameraInstPrm->sensorOutHeight = 736;
    #else
    		pCameraInstPrm->sensorOutWidth  = 1920;
    		pCameraInstPrm->sensorOutHeight = 1080;
    #endif
    
    		if (gUI_mcfw_config.noisefilterMode == DSS_VNF_ON)
    		{
    			pCameraInstPrm->standard = SYSTEM_STD_1080P_60;
    		}
    		else
    		{
    			pCameraInstPrm->standard = SYSTEM_STD_1080P_30;
    			cameraPrm.issVnfEnable = 1;
    		}
    
    		pCameraInstPrm->numOutput = 2;
    
    		/* First stream */
    		pCameraOutPrm = &pCameraInstPrm->outParams[0];
    		
    		if (gUI_mcfw_config.noisefilterMode == DSS_VNF_ON)
    			pCameraOutPrm->dataFormat = SYSTEM_DF_YUV422I_UYVY; 	
    		else
    			pCameraOutPrm->dataFormat = SYSTEM_DF_YUV420SP_UV; 		
    		pCameraOutPrm->scEnable = FALSE;
    
    #ifdef IMGS_OMNIVISION_OV10630
    		pCameraOutPrm->scOutWidth = 1280;
    		pCameraOutPrm->scOutHeight = 720;
    #elif defined IMGS_SONY_IMX104
    		pCameraOutPrm->scOutWidth = 1280;
    		pCameraOutPrm->scOutHeight = 720;
    #elif defined IMGS_MICRON_MT9M034
    		pCameraOutPrm->scOutWidth = 1280;
    		pCameraOutPrm->scOutHeight = 736;
    #else
    		/* When VS is enabled then scOutWidth/scOutHeight cannot be equal to sensorOutWidth/sensorOutHeight */
    		if(cameraPrm.vsEnable == 0)
    		{
    			pCameraOutPrm->scOutWidth = 1920;
    			pCameraOutPrm->scOutHeight = 1080;
    		}
    		else
    		{
    			pCameraOutPrm->scOutWidth = 1600;
    			pCameraOutPrm->scOutHeight = 900;
    		}
    #endif
    
    		pCameraOutPrm->outQueId = 0;
    
    		/* Second stream */
    		pCameraOutPrm = &pCameraInstPrm->outParams[1];
    		pCameraOutPrm->dataFormat = SYSTEM_DF_YUV420SP_UV;
    		pCameraOutPrm->scEnable = FALSE;  
    
    
                   if(gUI_mcfw_config.mipiCamRes == VGA )
                   {
    		    pCameraOutPrm->scOutWidth = 640  ; 
    		    pCameraOutPrm->scOutHeight = 480 ;
                        OSA_printf("RAJESH:  Setting Resolution VGA IN Fn (%s)\n", __func__) ;
                   }
                   else if(gUI_mcfw_config.mipiCamRes == QVGA  )      
                   {
    		    pCameraOutPrm->scOutWidth = 320  ; 
    		    pCameraOutPrm->scOutHeight = 240 ;
                        OSA_printf("RAJESH:  Setting Resolution QVGA IN Fn (%s)\n", __func__) ;
                   }             
     
    
    #if 0
    #ifndef RESOLUTION_QVGA   //TODO:
    		pCameraOutPrm->scOutWidth = 720;
    		pCameraOutPrm->scOutHeight = 480;
    #else
    		pCameraOutPrm->scOutWidth = 320  ; 
    		pCameraOutPrm->scOutHeight = 240 ;
    #endif
    #endif
    
    
    		pCameraOutPrm->standard = SYSTEM_STD_NTSC;
    		//pCameraOutPrm->standard = SYSTEM_STD_CIF ;
    		pCameraOutPrm->outQueId = 1;
    
    		/* 2A config */
    		cameraPrm.t2aConfig.n2A_vendor = gUI_mcfw_config.n2A_vendor;
    		cameraPrm.t2aConfig.n2A_mode = gUI_mcfw_config.n2A_mode;
    	}
    
    	/* vstab Link params */
    	vstabPrm.totalFrameWidth  = pCameraInstPrm->sensorOutWidth;
    	vstabPrm.totalFrameHeight = pCameraInstPrm->sensorOutHeight;
    
    	glbceSupportPrm.glbceLinkID = glbceId;
    	glbceSupportPrm.totalFrameWidth  = pCameraInstPrm->sensorOutWidth;
    	glbceSupportPrm.totalFrameHeight = pCameraInstPrm->sensorOutHeight;
    
    #ifdef WDR_ON
    	wdrSupportPrm.wdrLinkID = wdrId;
    	wdrSupportPrm.totalFrameWidth  = pCameraInstPrm->sensorOutWidth;
    	wdrSupportPrm.totalFrameHeight = pCameraInstPrm->sensorOutHeight;
    #endif
    
        if(gUI_mcfw_config.glbceEnable)
    	{
                OSA_printf("RAJESH: glbcEnable is on again\n") ;
    	    cameraPrm.glbceLinkId = glbceId;
    #ifdef WDR_ON
    	    cameraPrm.glbceLinkId = SYSTEM_LINK_ID_INVALID;
    #endif
    		/* Glbce Link Params */
    		glbcePrm.inQueParams.prevLinkId = gVcamModuleContext.cameraId;
    		glbcePrm.inQueParams.prevLinkQueId = 0;
    		glbcePrm.outQueParams.nextLink = ispId;
    		glbcePrm.chCreateParams[0].preset  = 0;//gGLBCE_AlgoPreset;
    		glbcePrm.glbceEnable = gUI_mcfw_config.glbceEnable;
    		glbcePrm.glbceSupportID = glbceSupportId;
    		glbcePrm.swosdLinkID = gVsysModuleContext.swOsdId;
    
    #ifdef WDR_ON
    		wdrPrm.inQueParams.prevLinkId = gVcamModuleContext.cameraId;
    		wdrPrm.inQueParams.prevLinkQueId = 0;
    		wdrPrm.outQueParams.nextLink = ispId;
    		wdrPrm.chCreateParams[0].preset  = 0;
    		wdrPrm.wdrEnable = 1;
    		wdrPrm.wdrSupportID = wdrSupportId;
    		wdrPrm.swosdLinkID = gVsysModuleContext.swOsdId;
    #endif
    
    		/* isp link params */
    #ifdef YUV_M2M_DRV_TEST
    		ispPrm.inQueParams.prevLinkId    = gVcamModuleContext.cameraId;
    #else
    		ispPrm.inQueParams.prevLinkId    = glbceId;
    #ifdef WDR_ON
    		ispPrm.inQueParams.prevLinkId	 = wdrId;
    #endif
    #endif
    		ispPrm.inQueParams.prevLinkQueId = 0;
    		ispPrm.numOutQueue               = 2;
    		
    		if (gUI_mcfw_config.noisefilterMode == DSS_VNF_ON)
    			ispPrm.outQueInfo[0].nextLink  = gVcamModuleContext.nsfId;
    		else
    			ispPrm.outQueInfo[0].nextLink  = gVcamModuleContext.vnfId;
    				
    		ispPrm.outQueInfo[1].nextLink    = dupId[SCALER_DUP_IDX];
    
    #if defined(TI_8107_BUILD)
    		ispPrm.clkDivM				     = 10;
    		ispPrm.clkDivN       			 = 30;//30;
    #else
    		ispPrm.clkDivM				     = 10;
    		ispPrm.clkDivN       			 = 20;
    #endif
    
    		ispPrm.vsEnable = gUI_mcfw_config.vsEnable;
    
    		if (gUI_mcfw_config.noisefilterMode == DSS_VNF_ON)
    			ispPrm.outQueuePrm[0].dataFormat = SYSTEM_DF_YUV422I_UYVY; 	
    		else
    			ispPrm.outQueuePrm[0].dataFormat = SYSTEM_DF_YUV420SP_UV; 	
    
    #ifdef IMGS_OMNIVISION_OV10630
    		ispPrm.outQueuePrm[0].width      = 1280;
    		ispPrm.outQueuePrm[0].height     = 720;
    #elif defined IMGS_SONY_IMX104
    		ispPrm.outQueuePrm[0].width      = 1280;
    		ispPrm.outQueuePrm[0].height     = 720;
    #elif defined IMGS_MICRON_MT9M034
    		ispPrm.outQueuePrm[0].width      = 1280;
    		ispPrm.outQueuePrm[0].height     = 736;
    #else
    		if(ispPrm.vsEnable == TRUE)
    		{
    			ispPrm.outQueuePrm[0].width      = 1600;
    			ispPrm.outQueuePrm[0].height     = 900;
    		}
    		else
    		{
    			ispPrm.outQueuePrm[0].width      = 1920;
    			ispPrm.outQueuePrm[0].height     = 1080;
    		}
    #endif
    
    		ispPrm.outQueuePrm[1].dataFormat = SYSTEM_DF_YUV420SP_UV;
    
    #ifndef RESOLUTION_QVGA /*TODO:Not Effective*/
                    OSA_printf("RAJESH: IN ispPrm.outQueuePrm[1].width = 720\n") ;
    		ispPrm.outQueuePrm[1].width      = 720;
    		ispPrm.outQueuePrm[1].height     = 480;//576;
    #else
                    OSA_printf("RAJESH: IN ispPrm.outQueuePrm[1].width = 320 \n") ;
    		ispPrm.outQueuePrm[1].width      = 320 ; //RAJESH
    		ispPrm.outQueuePrm[1].height     = 240 ;//576;
    #endif
    
    		ispPrm.outQueuePrm[1].standard   = SYSTEM_STD_NTSC ; //SYSTEM_STD_PAL;//SYSTEM_STD_NTSC;
    		//ispPrm.outQueuePrm[1].standard   = SYSTEM_STD_HALF_D1 ;//SYSTEM_STD_PAL;//SYSTEM_STD_NTSC;
    		//ispPrm.outQueuePrm[1].standard   = SYSTEM_STD_CIF ;//SYSTEM_STD_PAL;//SYSTEM_STD_NTSC;
        }
    
    	ispPrm.vnfFullResolution = FALSE;
    	cameraPrm.vnfFullResolution = FALSE;
    
        if (gUI_mcfw_config.noisefilterMode == DSS_VNF_ON)
        {
              OSA_printf("RAJESH: noisefilterMode == DSS_VNF_ON\n");
            /* NSF Link params */
    		NsfLink_CreateParams_Init(&nsfPrm);
    		if (gUI_mcfw_config.snfEnable)
    		{
    			if (gUI_mcfw_config.tnfEnable)
            		nsfPrm.bypassNsf = NSF_LINK_BYPASS_NONE;
    			else
    				nsfPrm.bypassNsf = NSF_LINK_BYPASS_TNF;
    		}
    		else
    		{
    			if (gUI_mcfw_config.tnfEnable)
            		nsfPrm.bypassNsf = NSF_LINK_BYPASS_SNF;
    			else
    				nsfPrm.bypassNsf = NSF_LINK_BYPASS_SNF_TNF;
        	}
    #if (TILER_ENABLE == TRUE)
    		nsfPrm.tilerEnable = TRUE;
    #else
    		nsfPrm.tilerEnable = FALSE;
    #endif
    
    		if(gUI_mcfw_config.glbceEnable)
    			nsfPrm.inQueParams.prevLinkId = ispId;
    		else
    			nsfPrm.inQueParams.prevLinkId = gVcamModuleContext.cameraId;
    
            nsfPrm.inQueParams.prevLinkQueId = 0;
            nsfPrm.numOutQue = 1;
    		nsfPrm.numBufsPerCh = 6;
            nsfPrm.inputFrameRate = 60;
            nsfPrm.outputFrameRate = 60;
            nsfPrm.outQueParams[0].nextLink = dupId[MJPEG_DUP_LINK_IDX];
    		nsfPrm.nsfStrength = gUI_mcfw_config.vnfStrength;
        }
        else
        {
            OSA_printf("RAJESH: Vnf Param\n") ;
            VnfLink_ChCreateParams *vnfParams;
    
            /* Vnf Link Params */
    		if(gUI_mcfw_config.glbceEnable)
    			vnfPrm.inQueParams.prevLinkId =ispId;
    		else
    			vnfPrm.inQueParams.prevLinkId = gVcamModuleContext.cameraId;
    
            vnfPrm.inQueParams.prevLinkQueId = 0;
            vnfPrm.outQueParams.nextLink = dupId[MJPEG_DUP_LINK_IDX];
    
            vnfParams = &vnfPrm.chCreateParams[0];
            vnfParams->sParams.eOutputFormat = SYSTEM_DF_YUV420SP_UV;
    		if (gUI_mcfw_config.ldcEnable)
    		{
    			vnfParams->sParams.eOperateMode = VNF_LINK_LDC_AFFINE_NSF_TNF;
    		}	
            else
    		{
    #ifdef USE_TNF2_FILTER
        		vnfParams->sParams.eOperateMode =  VNF_LINK_3DNF;
    #elif defined (USE_TNF3_FILTER)
        		vnfParams->sParams.eOperateMode =  VNF_LINK_TNF3;
    #else
        		vnfParams->sParams.eOperateMode = VNF_LINK_AFFINE_NSF_TNF;
    #endif
    			vnfParams->sParams.eNsfSet = VNF_LINK_NSF_LUMA_CHROMA;
    		}
    
    		if ((vnfParams->sParams.eOperateMode == VNF_LINK_TNF3) && (vnfParams->sParams.eNsfSet == VNF_LINK_NSF_LUMA_CHROMA))
    		{
    			if (gUI_mcfw_config.glbceEnable)
    			{
    				ispPrm.vnfFullResolution = TRUE;
    				cameraPrm.vnfFullResolution = FALSE;
    			}
    			else
    			{
    				ispPrm.vnfFullResolution = FALSE;
    				cameraPrm.vnfFullResolution = TRUE;
    			}
    		}
    		
            vnfParams->dParams.ldcParams.eInterpolationLuma =
                VNF_LINK_YINTERPOLATION_BILINEAR;
            vnfParams->dParams.ldcParams.unPixelPad = 4;
    
            vnfParams->dParams.nsfParams.bLumaEn = TRUE;
            vnfParams->dParams.nsfParams.bChromaEn = TRUE;
            vnfParams->dParams.nsfParams.eSmoothVal = VNF_LINK_SMOOTH_0;
            vnfParams->dParams.nsfParams.bSmoothLumaEn = TRUE;
            vnfParams->dParams.nsfParams.bSmoothChromaEn = TRUE;
    
            vnfParams->dParams.tnfParams.useDefault = TRUE;
    
            vnfParams->dParams.nsfFilter.eFilterParam = VNF_LINK_PARAM_DEFAULT;
            vnfParams->dParams.nsfEdge.eEdgeParam = VNF_LINK_PARAM_DISABLE;
            vnfParams->dParams.nsfShading.eShdParam = VNF_LINK_PARAM_DISABLE;
            vnfParams->dParams.nsfDesaturation.eDesatParam = VNF_LINK_PARAM_DISABLE;
    
            vnfPrm.chCreateParams[0].bSnfEnable = gUI_mcfw_config.snfEnable;
            vnfPrm.chCreateParams[0].bTnfEnable = gUI_mcfw_config.tnfEnable;
    		vnfPrm.chCreateParams[0].strength	= gUI_mcfw_config.vnfStrength;
        }
    
    
        /* Dup Link params */
        if (gUI_mcfw_config.noisefilterMode == DSS_VNF_ON)
            dupPrm[MJPEG_DUP_LINK_IDX].inQueParams.prevLinkId =
                gVcamModuleContext.nsfId;
        else
            dupPrm[MJPEG_DUP_LINK_IDX].inQueParams.prevLinkId =
                gVcamModuleContext.vnfId;
    
        dupPrm[MJPEG_DUP_LINK_IDX].inQueParams.prevLinkQueId = 0;
        dupPrm[MJPEG_DUP_LINK_IDX].numOutQue = 2;   // 1 ;		KOLANCHI MJPEG
        dupPrm[MJPEG_DUP_LINK_IDX].outQueParams[0].nextLink =
            mergeId[CAM_STREAM_MERGE_IDX];
        //dupPrm[MJPEG_DUP_LINK_IDX].outQueParams[1].nextLink =   //RAJESH
          // mergeId[CAM_STREAM_MERGE_IDX];
        dupPrm[MJPEG_DUP_LINK_IDX].outQueParams[1].nextLink =   
          	mergeId[CAM_STREAM_MERGE_IDX];						//	KOLANCHI MJPEG
        dupPrm[MJPEG_DUP_LINK_IDX].notifyNextLink = TRUE;
    
        /* Dup link for Scaler params */
        if(gUI_mcfw_config.glbceEnable){
    		dupPrm[SCALER_DUP_IDX].inQueParams.prevLinkId = ispId;
                    OSA_printf("RAJESH: glbcEnable on  dupPrm[SCALER_DUP_IDX].inQueParams.prevLinkId = ispId\n") ;
        }
        else{
    		dupPrm[SCALER_DUP_IDX].inQueParams.prevLinkId = gVcamModuleContext.cameraId;
                    OSA_printf("RAJESH: glbcEnable off dupPrm[SCALER_DUP_IDX].inQueParams.prevLinkId = gVcamModuleContext.cameraId\n") ;
        }
    
        dupPrm[SCALER_DUP_IDX].inQueParams.prevLinkQueId = 1;
    
    #ifndef RESOLUTION_QVGA
        dupPrm[SCALER_DUP_IDX].numOutQue = 3;
    #else
        dupPrm[SCALER_DUP_IDX].numOutQue = 2;
    #endif
    
        dupPrm[SCALER_DUP_IDX].outQueParams[0].nextLink =
            mergeId[CAM_STREAM_MERGE_IDX];
        dupPrm[SCALER_DUP_IDX].outQueParams[1].nextLink = gVcamModuleContext.sclrId[0];
    
    #ifndef RESOLUTION_QVGA
        dupPrm[SCALER_DUP_IDX].outQueParams[2].nextLink =
            gVdisModuleContext.displayId[VDIS_DEV_SD];
    #endif
    
        dupPrm[SCALER_DUP_IDX].notifyNextLink = TRUE;
    
        /* display link params */
    #ifndef RESOLUTION_QVGA
        MULTICH_INIT_STRUCT(DisplayLink_CreateParams,displayPrm_SD);
        displayPrm_SD.inQueParams[0].prevLinkId = dupId[SCALER_DUP_IDX];
        displayPrm_SD.inQueParams[0].prevLinkQueId = 2;
        displayPrm_SD.displayRes = gVdisModuleContext.vdisConfig.deviceParams[VDIS_DEV_SD].resolution;
    	displayPrm_SD.displayId  = DISPLAY_LINK_DISPLAY_SD;
    #endif
    
    
        /* Merge Link params */
        mergePrm[CAM_STREAM_MERGE_IDX].numInQue = 3;			//	KOLANCHI MJPEG
        //mergePrm[CAM_STREAM_MERGE_IDX].numInQue = 2 ;
    
        mergePrm[CAM_STREAM_MERGE_IDX].inQueParams[0].prevLinkId =
            dupId[MJPEG_DUP_LINK_IDX];                                       //MIPI FULL HD
        mergePrm[CAM_STREAM_MERGE_IDX].inQueParams[0].prevLinkQueId = 0;
    
        mergePrm[CAM_STREAM_MERGE_IDX].inQueParams[1].prevLinkId =          //MIPI VGA/QVGA       
            dupId[SCALER_DUP_IDX];
        mergePrm[CAM_STREAM_MERGE_IDX].inQueParams[1].prevLinkQueId = 0;
    
        mergePrm[CAM_STREAM_MERGE_IDX].inQueParams[2].prevLinkId =
            dupId[MJPEG_DUP_LINK_IDX];                                       //MIPI 		KOLANCHI MJPEG
        mergePrm[CAM_STREAM_MERGE_IDX].inQueParams[2].prevLinkQueId = 1;
    
        mergePrm[CAM_STREAM_MERGE_IDX].outQueParams.nextLink =
            gVsysModuleContext.swOsdId;
        mergePrm[CAM_STREAM_MERGE_IDX].notifyNextLink = TRUE;
    
        /* SWOSD Link Params */
        swosdPrm.inQueParams.prevLinkId = mergeId[CAM_STREAM_MERGE_IDX];
        swosdPrm.inQueParams.prevLinkQueId = 0;
    	//swosdPrm.outQueParams.nextLink = dupId[DIS_DUP_IDX];
    	swosdPrm.outQueParams.nextLink =  ipcOutVpssId ;  //DUP
        swosdPrm.frameSync = 0;                                // frame sync is
                                                               // required
        swosdPrm.frameSycChId = 0;                             // frame sync is
                                                               // required on
                                                               // channel # 1
    	#if 0
        /* Display dup link params */
    	dupPrm[DIS_DUP_IDX].inQueParams.prevLinkId = gVsysModuleContext.swOsdId;
    	dupPrm[DIS_DUP_IDX].inQueParams.prevLinkQueId = 0;
    
    //#ifndef BYPASS_DISPLAY
            if(gUI_mcfw_config.dispCamChId == MIPI_CH0_DISPLAY ) 
            {
    	    dupPrm[DIS_DUP_IDX].numOutQue = 2;
    
    	    dupPrm[DIS_DUP_IDX].outQueParams[1].nextLink = gVdisModuleContext.displayId[VDIS_DEV_HDMI];
    	    MULTICH_INIT_STRUCT(DisplayLink_CreateParams,displayPrm);
    
    	    /* display link params */
    	    displayPrm.inQueParams[0].prevLinkId = dupId[DIS_DUP_IDX];
    	    displayPrm.inQueParams[0].prevLinkQueId = 1;
    	    displayPrm.displayRes = gVdisModuleContext.vdisConfig.deviceParams[VDIS_DEV_HDMI].resolution;
    	    displayPrm.displayId  = DISPLAY_LINK_DISPLAY_SC2;
            }
            else
            {
                dupPrm[DIS_DUP_IDX].numOutQue = 1;
            }
    
    	dupPrm[DIS_DUP_IDX].outQueParams[0].nextLink = ipcOutVpssId;
    	dupPrm[DIS_DUP_IDX].notifyNextLink = TRUE;
    	#endif
    
        /* Scaler Link Params */
    	SclrLink_CreateParams_Init(&sclrPrm);
    	sclrPrm.inQueParams.prevLinkId             = dupId[SCALER_DUP_IDX];
    	sclrPrm.inQueParams.prevLinkQueId          = 1;
    	if(Vsys_getSystemUseCase() == VSYS_USECASE_TRISTREAM_SMARTANALYTICS)  
    		sclrPrm.outQueParams.nextLink          = dupId[VA_DUP_IDX];
    	else
    		sclrPrm.outQueParams.nextLink          = gVsysModuleContext.fdId;
    	sclrPrm.tilerEnable                        = FALSE;
    	sclrPrm.enableLineSkipSc                   = FALSE;
    	sclrPrm.inputFrameRate                     = 30;
    	sclrPrm.outputFrameRate                    = 30;
    	sclrPrm.scaleMode                          = DEI_SCALE_MODE_ABSOLUTE;
    	sclrPrm.scaleMode                          = DEI_SCALE_MODE_ABSOLUTE;
    	sclrPrm.outScaleFactor.absoluteResolution.outWidth   = 320;
            sclrPrm.outScaleFactor.absoluteResolution.outHeight  = 192;
    	sclrPrm.outDataFormat = VF_YUV420SP_UV;
    	sclrPrm.pathId = SCLR_LINK_SEC0_SC3;
    
    	if(Vsys_getSystemUseCase() == VSYS_USECASE_TRISTREAM_SMARTANALYTICS)
    	{
    		dupPrm[VA_DUP_IDX].inQueParams.prevLinkId = gVcamModuleContext.sclrId[0];
    		dupPrm[VA_DUP_IDX].inQueParams.prevLinkQueId = 0;
    		dupPrm[VA_DUP_IDX].numOutQue = 2;
    		dupPrm[VA_DUP_IDX].outQueParams[0].nextLink = gVsysModuleContext.fdId;
    #ifdef VA_ON_DSP
    		dupPrm[VA_DUP_IDX].outQueParams[1].nextLink = ipcFramesOutVpssId;
    #else
    		dupPrm[VA_DUP_IDX].outQueParams[1].nextLink = gVsysModuleContext.vaId;
    #endif
    		dupPrm[VA_DUP_IDX].notifyNextLink = TRUE;		
    		
    #ifdef VA_ON_DSP
    		/* IPC Frames Out VPSS for VA link params */
    		ipcFramesOutVpssPrm.baseCreateParams.inQueParams.prevLinkId = dupId[VA_DUP_IDX];
    		ipcFramesOutVpssPrm.baseCreateParams.inQueParams.prevLinkQueId = 1;
    		ipcFramesOutVpssPrm.baseCreateParams.notifyPrevLink = TRUE;
    		ipcFramesOutVpssPrm.baseCreateParams.inputFrameRate = 30;
    		ipcFramesOutVpssPrm.baseCreateParams.outputFrameRate = 30;
    
    		ipcFramesOutVpssPrm.baseCreateParams.numOutQue = 1;
    		ipcFramesOutVpssPrm.baseCreateParams.outQueParams[0].nextLink = ipcFramesInDspId;
    		ipcFramesOutVpssPrm.baseCreateParams.notifyNextLink = TRUE;
    
    		ipcFramesOutVpssPrm.baseCreateParams.processLink = SYSTEM_LINK_ID_INVALID;
    		ipcFramesOutVpssPrm.baseCreateParams.notifyProcessLink = FALSE;
    		ipcFramesOutVpssPrm.baseCreateParams.noNotifyMode = FALSE;
    
    		/* IPC Frames in DSP for VA link params */
    		ipcFramesInDspPrm.baseCreateParams.inQueParams.prevLinkId = ipcFramesOutVpssId;
    		ipcFramesInDspPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
    		ipcFramesInDspPrm.baseCreateParams.numOutQue   = 1;
    		ipcFramesInDspPrm.baseCreateParams.outQueParams[0].nextLink = gVsysModuleContext.vaId;
    		ipcFramesInDspPrm.baseCreateParams.notifyPrevLink = TRUE;
    		ipcFramesInDspPrm.baseCreateParams.notifyNextLink = TRUE;
    		ipcFramesInDspPrm.baseCreateParams.noNotifyMode   = FALSE;
    
    		/* VA link params */
    		VaLink_CreateParams_Init(&vaPrm);
    		vaPrm.inQueParams.prevLinkId	= ipcFramesInDspId;
    		vaPrm.inQueParams.prevLinkQueId = 0;
    		vaPrm.encLinkId                 = gVencModuleContext.encId;
    		vaPrm.swosdLinkId				= gVsysModuleContext.swOsdId;
    		vaPrm.cameraLinkId              = gVcamModuleContext.cameraId;
    		vaPrm.vaFrameRate               = 20;
    #else
    		/* VA link params */
    		VaLink_CreateParams_Init(&vaPrm);
    		vaPrm.inQueParams.prevLinkId	= dupId[VA_DUP_IDX];
    		vaPrm.inQueParams.prevLinkQueId = 1;
    		vaPrm.encLinkId                 = gVencModuleContext.encId;
    		vaPrm.swosdLinkId				= gVsysModuleContext.swOsdId;
    		vaPrm.cameraLinkId              = gVcamModuleContext.cameraId;
    		vaPrm.vaFrameRate               = 15;
    #endif		
    	}
    
    	
        /* FD Link Params */  
                if(Vsys_getSystemUseCase() == VSYS_USECASE_TRISTREAM_SMARTANALYTICS)
    		fdPrm.inQueParams.prevLinkId = dupId[VA_DUP_IDX];
    	else
    		fdPrm.inQueParams.prevLinkId = gVcamModuleContext.sclrId[0];
        fdPrm.inQueParams.prevLinkQueId = 0;
        fdPrm.swOsdId = gVsysModuleContext.swOsdId;            // SW OSD link ID
                                                               // used for frame
                                                               // sync
    
        /* IPC Out VPSS link params */
        //ipcOutVpssPrm.inQueParams.prevLinkId = dupId[DIS_DUP_IDX];
        ipcOutVpssPrm.inQueParams.prevLinkId = gVsysModuleContext.swOsdId ;
        ipcOutVpssPrm.inQueParams.prevLinkQueId = 0;
        ipcOutVpssPrm.numOutQue = 1;
        ipcOutVpssPrm.outQueParams[0].nextLink = ipcInVideoId;
        ipcOutVpssPrm.notifyNextLink = TRUE;
        ipcOutVpssPrm.notifyPrevLink = TRUE;
        ipcOutVpssPrm.noNotifyMode = FALSE;
    
        /* IPC In VIDEO params */
        ipcInVideoPrm.inQueParams.prevLinkId = ipcOutVpssId;
        ipcInVideoPrm.inQueParams.prevLinkQueId = 0;
        ipcInVideoPrm.numOutQue = 1;
        ipcInVideoPrm.outQueParams[0].nextLink = gVencModuleContext.encId;
        ipcInVideoPrm.notifyNextLink = TRUE;
        ipcInVideoPrm.notifyPrevLink = TRUE;
        ipcInVideoPrm.noNotifyMode = FALSE;
    
        /* Video Encoder Link params */
    	MULTICH_INIT_STRUCT(EncLink_CreateParams, encPrm);
    	{
    		EncLink_ChCreateParams *pLinkChPrm;
            EncLink_ChDynamicParams *pLinkDynPrm;
            VENC_CHN_DYNAMIC_PARAM_S *pDynPrm;
            VENC_CHN_PARAMS_S *pChPrm;
    
                    for (i = 0; i < ( VENC_PRIMARY_CHANNELS ) ; i++)
                    {
    			pLinkChPrm  = &encPrm.chCreateParams[i];
    			pLinkDynPrm = &pLinkChPrm->defaultDynamicParams;
    
    			pChPrm      = &gVencModuleContext.vencConfig.encChannelParams[i];
    			pDynPrm     = &pChPrm->dynamicParam;
    
    			switch(gUI_mcfw_config.demoCfg.codec_combo) {
    				case 0: pLinkChPrm->format = IVIDEO_H264HP; break; //"SINGLE_H264"
    				case 1: pLinkChPrm->format = IVIDEO_MPEG4SP; break; //"SINGLE_MPEG4"
    				case 2: pLinkChPrm->format = IVIDEO_MJPEG; break; //"SINGLE_JPEG"
    				case 3: pLinkChPrm->format = (i==0)? IVIDEO_H264HP:IVIDEO_MJPEG; break; //"H264_JPEG"
    				case 4: pLinkChPrm->format = (i==0)? IVIDEO_MPEG4SP:IVIDEO_MJPEG; break; //"MPEG4_JPEG"
    				case 5: pLinkChPrm->format = (i==0)? IVIDEO_H264HP:IVIDEO_H264HP; break; //"DUAL_H264"
    				case 6: pLinkChPrm->format = (i==0)? IVIDEO_MPEG4SP:IVIDEO_MPEG4SP; break; //"DUAL_MPEG4"
    				case 7: pLinkChPrm->format = (i==0)? IVIDEO_H264HP:IVIDEO_MPEG4SP; break;  //"H264_MPEG4"
    				case 8: pLinkChPrm->format = (i==0)? IVIDEO_H264HP:IVIDEO_H264HP; break;  //"TRIPLE_H264"
    				case 9: pLinkChPrm->format = (i==0)? IVIDEO_MPEG4SP:IVIDEO_MPEG4SP; break; //"TRIPLE_MPEG4"
    				default: pLinkChPrm->format = IVIDEO_H264HP;
    			}
    
    			pLinkChPrm->profile                 = gVencModuleContext.vencConfig.h264Profile[i];
                            OSA_printf("RAJESH: In Encoder Profile[%d]=%d\n", i ,  pLinkChPrm->profile ) ; 
    
    			pLinkChPrm->dataLayout              = IVIDEO_PROGRESSIVE;
    			pLinkChPrm->fieldMergeEncodeEnable  = FALSE;
    			pLinkChPrm->enableAnalyticinfo      = pChPrm->enableAnalyticinfo;
    			pLinkChPrm->maxBitRate              = pChPrm->maxBitRate;
    			pLinkChPrm->encodingPreset          = pChPrm->encodingPreset;
                            OSA_printf("RAJESH: In Encoder EncodingPreset[%d]=%d\n", i ,  pChPrm->encodingPreset ) ; 
                            
    			pLinkChPrm->rateControlPreset       = IVIDEO_USER_DEFINED; //pChPrm->rcType;
    			pLinkChPrm->enableHighSpeed         = FALSE;
    			pLinkChPrm->enableWaterMarking      = pChPrm->enableWaterMarking;
    			//pLinkChPrm->StreamPreset            = gUI_mcfw_config.StreamPreset[i];
    			pLinkChPrm->StreamPreset            = gUI_mcfw_config.StreamPreset[0] ;   //RAJESH
                            OSA_printf("RAJESH: In Encoder StreamPreset[%d]=%d\n", i ,  pLinkChPrm->StreamPreset ) ; 
    
    			pLinkDynPrm->intraFrameInterval     = pDynPrm->intraFrameInterval;
                            OSA_printf("RAJESH: In Encoder intraFrameInterval[%d]=%d\n", i ,  pLinkDynPrm->intraFrameInterval ) ; 
                            
                            if ( i == 1 ) 
    			    pDynPrm->targetBitRate = 65000 ;    //RAJESH
    			    //pDynPrm->targetBitRate = 2000000 ;    //RAJESH
                            else 
    			    pDynPrm->targetBitRate = 8000000 ;   //RAJESH
    
    			pLinkDynPrm->targetBitRate          = pDynPrm->targetBitRate;
                            OSA_printf("RAJESH: In Encoder targetBitRate[%d]=%d\n", i ,  pLinkDynPrm->targetBitRate ) ;
    			pLinkDynPrm->interFrameInterval     = 1;
    			pLinkDynPrm->mvAccuracy             = IVIDENC2_MOTIONVECTOR_QUARTERPEL;
                            pLinkDynPrm->inputFrameRate         = pDynPrm->inputFrameRate;
                            OSA_printf("RAJESH: In Encoder inputFrameRate[%d]=%d\n", i ,  pLinkDynPrm->inputFrameRate ) ;
    
    			pLinkDynPrm->rcAlg                  = pDynPrm->rcAlg;
                            OSA_printf("RAJESH: In Encoder inputFrameRate[%d]=%d\n", i ,  pLinkDynPrm->inputFrameRate ) ;
                            
    			pLinkDynPrm->qpMin                  = pDynPrm->qpMin;
                            OSA_printf("RAJESH: In Encoder qpMin[%d]=%d\n", i ,  pLinkDynPrm->qpMin ) ;
    
    			pLinkDynPrm->qpMax                  = pDynPrm->qpMax;
                            OSA_printf("RAJESH: In Encoder qpMax[%d]=%d\n", i ,  pLinkDynPrm->qpMax  ) ;
    
    			pLinkDynPrm->qpInit                 = pDynPrm->qpInit;
                            OSA_printf("RAJESH: In Encoder qpInit[%d]=%d\n", i ,  pLinkDynPrm->qpInit ) ;
    
    			pLinkDynPrm->vbrDuration            = pDynPrm->vbrDuration ;
                            OSA_printf("RAJESH: In Encoder vbrDuration[%d]=%d\n", i ,  pLinkDynPrm->vbrDuration ) ;
    
    			pLinkDynPrm->vbrSensitivity         = pDynPrm->vbrSensitivity;
                            OSA_printf("RAJESH: In Encoder vbrSensitivity[%d]=%d\n", i ,  pLinkDynPrm->vbrSensitivity ) ;
    
    			encPrm.numBufPerCh[i] = 4;
    
    			gVencModuleContext.encFormat[i] = pLinkChPrm->format;
                            OSA_printf("RAJESH: In Encoder encFormat[%d]=%d\n", i ,  pLinkChPrm->format ) ;
    		}
    	}
    
        /* Video Encoder Framerate */
    #ifdef IMGS_OMNIVISION_OV10630
        encPrm.chCreateParams[0].defaultDynamicParams.inputFrameRate = 30;  // ENC_LINK_DEFAULT_ALGPARAMS_INPUTFRAMERATE;
    #elif defined IMGS_SONY_IMX104
        encPrm.chCreateParams[0].defaultDynamicParams.inputFrameRate = 30;  // ENC_LINK_DEFAULT_ALGPARAMS_INPUTFRAMERATE;
    #elif defined IMGS_MICRON_MT9M034
    	encPrm.chCreateParams[0].defaultDynamicParams.inputFrameRate = 30;  //
    #else
        encPrm.chCreateParams[0].defaultDynamicParams.inputFrameRate = 60;  // ENC_LINK_DEFAULT_ALGPARAMS_INPUTFRAMERATE;
    #endif
        encPrm.chCreateParams[1].defaultDynamicParams.inputFrameRate = 30;  // ENC_LINK_DEFAULT_ALGPARAMS_INPUTFRAMERATE;
    	
        encPrm.vsEnable = gUI_mcfw_config.vsEnable;
    
    	if(gUI_mcfw_config.vaUseCase == TRUE)
    	{
    	    encPrm.isVaUseCase = 1;
    	}
    	else
    	{
    	    encPrm.isVaUseCase = 0;
    	}
    
    
      for (i = VENC_PRIMARY_CHANNELS; i < VENC_CHN_MAX - 1; i++)
        {
            printf("KOLANCHI : CHANNEL Creation for MIPI MJPEG\n");
            encPrm.chCreateParams[i].format = IVIDEO_MJPEG;
            encPrm.chCreateParams[i].profile = 0;
            encPrm.chCreateParams[i].dataLayout = IVIDEO_PROGRESSIVE;
            encPrm.chCreateParams[i].fieldMergeEncodeEnable = FALSE;
            encPrm.chCreateParams[i].defaultDynamicParams.intraFrameInterval = 0;
            encPrm.chCreateParams[i].encodingPreset = 0;
            encPrm.chCreateParams[i].enableAnalyticinfo = 0;
            encPrm.chCreateParams[i].enableWaterMarking = 0;
            encPrm.chCreateParams[i].defaultDynamicParams.inputFrameRate = 60;
            encPrm.chCreateParams[i].rateControlPreset = 0;
            encPrm.chCreateParams[i].defaultDynamicParams.targetBitRate =
                100 * 1000;
            encPrm.chCreateParams[i].defaultDynamicParams.interFrameInterval = 0;
            encPrm.chCreateParams[i].defaultDynamicParams.mvAccuracy = 0;
        }
    
    
        encPrm.inQueParams.prevLinkId = ipcInVideoId;
        encPrm.inQueParams.prevLinkQueId = 0;
        encPrm.outQueParams.nextLink = gVencModuleContext.ipcBitsOutRTOSId;
    
        /* IPC Bits Out VIDEO Link params */
        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);
    
        /* IPC Bits In HOST Link params */
        ipcBitsInHostPrm0.baseCreateParams.inQueParams.prevLinkId =
            gVencModuleContext.ipcBitsOutRTOSId;
        ipcBitsInHostPrm0.baseCreateParams.inQueParams.prevLinkQueId = 0;
        MultiCh_ipcBitsInitCreateParams_BitsInHLOS(&ipcBitsInHostPrm0);
    
        /* Links Creation */
        /* Camera Link */
        System_linkCreate(gVcamModuleContext.cameraId, &cameraPrm,
                          sizeof(cameraPrm));
        System_linkControl(gVcamModuleContext.cameraId,
                           CAMERA_LINK_CMD_DETECT_VIDEO, NULL, 0, TRUE);
    
    
        if(gUI_mcfw_config.glbceEnable)
        {
    #ifndef WDR_ON
    		System_linkCreate(glbceSupportId, &glbceSupportPrm,sizeof(glbceSupportPrm));
    #else
    		System_linkCreate(wdrSupportId, &wdrSupportPrm,sizeof(wdrSupportPrm));
    #endif
    		/* glbce link create */
    #ifdef YUV_M2M_DRV_TEST
    #else
    #ifndef WDR_ON
    		System_linkCreate(glbceId, &glbcePrm,sizeof(glbcePrm));
    #else
    		System_linkCreate(wdrId, &wdrPrm,sizeof(wdrPrm));
    #endif
    #endif
    		/* cam pp link create */
    		System_linkCreate(ispId, &ispPrm,sizeof(ispPrm));
    		gIsGlbceInitDone = 1;
        }
    	else
    	{
    		gIsGlbceInitDone = 0;
    	}
    
        if (gUI_mcfw_config.noisefilterMode == DSS_VNF_ON){
            /* NSF Link */
            System_linkCreate(gVcamModuleContext.nsfId, &nsfPrm, sizeof(nsfPrm));
            OSA_printf("RAJESH: System_linkCreate(gVcamModuleContext.nsfId, &nsfPrm, sizeof(nsfPrm))\n") ;
        }
        else{
            /* Vnf Link */
            System_linkCreate(gVcamModuleContext.vnfId, &vnfPrm, sizeof(vnfPrm));
            OSA_printf("RAJESH: System_linkCreate(gVcamModuleContext.vnfId, &vnfPrm, sizeof(vnfPrm))\n") ;
        }
    
        /* Dup link */
        System_linkCreate(dupId[MJPEG_DUP_LINK_IDX], &dupPrm[MJPEG_DUP_LINK_IDX],
                          sizeof(dupPrm[MJPEG_DUP_LINK_IDX]));
    
        /* Dup Link for Scaler */
        System_linkCreate(dupId[SCALER_DUP_IDX], &dupPrm[SCALER_DUP_IDX],
                          sizeof(dupPrm[SCALER_DUP_IDX]));
    
        /* Merge Link */
        System_linkCreate(mergeId[CAM_STREAM_MERGE_IDX],
                          &mergePrm[CAM_STREAM_MERGE_IDX],
                          sizeof(mergePrm[CAM_STREAM_MERGE_IDX]));
    
        /* SWOSD Link */
        System_linkCreate(gVsysModuleContext.swOsdId, &swosdPrm, sizeof(swosdPrm));
    
        /* Dup link for display */
    	//System_linkCreate(dupId[DIS_DUP_IDX], &dupPrm[DIS_DUP_IDX],
    	//				  sizeof(dupPrm[DIS_DUP_IDX]));
    
        /* Scaler Link */
        System_linkCreate(gVcamModuleContext.sclrId[0], &sclrPrm, sizeof(sclrPrm));
    
    	
    	if(Vsys_getSystemUseCase() == VSYS_USECASE_TRISTREAM_SMARTANALYTICS)
    	{
    		/* Dup link for VA */
    		System_linkCreate(dupId[VA_DUP_IDX], &dupPrm[VA_DUP_IDX], sizeof(dupPrm[VA_DUP_IDX]));	
    		
    #ifdef VA_ON_DSP
    		/* IPC Frames links */
    		System_linkCreate(ipcFramesOutVpssId, &ipcFramesOutVpssPrm, sizeof(ipcFramesOutVpssPrm));
    		System_linkCreate(ipcFramesInDspId, &ipcFramesInDspPrm, sizeof(ipcFramesInDspPrm));
    #endif
    
    		/* VA link */
    		System_linkCreate(gVsysModuleContext.vaId, &vaPrm, sizeof(vaPrm));		
    	} 
    
    
        /* FD Link */
        System_linkCreate(gVsysModuleContext.fdId, &fdPrm, sizeof(fdPrm));
    
        /* IPC Links */
        System_linkCreate(ipcOutVpssId, &ipcOutVpssPrm, sizeof(ipcOutVpssPrm));
        System_linkCreate(ipcInVideoId, &ipcInVideoPrm, sizeof(ipcInVideoPrm));
    
        /* Video Encoder Link */
        System_linkCreate(gVencModuleContext.encId, &encPrm, sizeof(encPrm));
    
    	/* VSTAB link */
    	System_linkCreate(vstabId, &vstabPrm, sizeof(vstabPrm));
    
        /* IPC Bits Links */
        System_linkCreate(gVencModuleContext.ipcBitsOutRTOSId, &ipcBitsOutVideoPrm,
                          sizeof(ipcBitsOutVideoPrm));
        System_linkCreate(gVencModuleContext.ipcBitsInHLOSId, &ipcBitsInHostPrm0,
                          sizeof(ipcBitsInHostPrm0));
    
        /* display link */
    //#ifndef BYPASS_DISPLAY
    	#if 0
            if(gUI_mcfw_config.dispCamChId == MIPI_CH0_DISPLAY )
            {
    	    System_linkCreate(gVdisModuleContext.displayId[VDIS_DEV_HDMI], &displayPrm,
    					  sizeof(displayPrm));
            }
    	#endif
    //#endif
    
    #ifndef RESOLUTION_QVGA
        System_linkCreate(gVdisModuleContext.displayId[VDIS_DEV_SD], &displayPrm_SD,
                          sizeof(displayPrm_SD));
    #endif
    
    	/********************************************************************************************************************/
            /************************************************ DECODE PATH *******************************************************/
            /********************************************************************************************************************/
    	#if 0
            /* Get Encoder params */
            System_linkGetInfo(gVencModuleContext.encId,&bitsProducerLinkInfo);
    
            /* IPC BITS OUT HLOS Link */
            ipcBitsOutHostPrm.baseCreateParams.outQueParams[0].nextLink = gVdecModuleContext.ipcBitsInRTOSId;
            ipcBitsOutHostPrm.baseCreateParams.notifyNextLink           = FALSE;
            ipcBitsOutHostPrm.baseCreateParams.notifyPrevLink           = FALSE;
            ipcBitsOutHostPrm.numBufPerCh[0]                            = NUM_IPC_OUT_BUFFERS;
            ipcBitsOutHostPrm.inQueInfo                                                                     = bitsProducerLinkInfo.queInfo[0];
    	#endif
    
          	ipcBitsOutHostPrm.baseCreateParams.inQueParams.prevLinkQueId      = 0 ;
            ipcBitsOutHostPrm.baseCreateParams.numOutQue                      = 1 ;
            ipcBitsOutHostPrm.baseCreateParams.inputFrameRate                 = 30 ;
            ipcBitsOutHostPrm.baseCreateParams.outputFrameRate                = 30 ;
            ipcBitsOutHostPrm.baseCreateParams.outQueParams[0].nextLink       = gVdecModuleContext.ipcBitsInRTOSId ;
            ipcBitsOutHostPrm.baseCreateParams.notifyNextLink                 = TRUE;
            ipcBitsOutHostPrm.baseCreateParams.notifyPrevLink                 = FALSE;
            ipcBitsOutHostPrm.baseCreateParams.noNotifyMode                   = FALSE;
    
            ipcBitsOutHostPrm.inQueInfo.numCh                                 = 1;
            ipcBitsOutHostPrm.inQueInfo.chInfo[0].startX                      = 0;
            ipcBitsOutHostPrm.inQueInfo.chInfo[0].startY                      = 0;
            ipcBitsOutHostPrm.inQueInfo.chInfo[0].height                      = 1080;
            ipcBitsOutHostPrm.inQueInfo.chInfo[0].width                       = 1920;
            ipcBitsOutHostPrm.inQueInfo.chInfo[0].pitch[0]                    = 0;
            ipcBitsOutHostPrm.inQueInfo.chInfo[0].pitch[1]                    = 0;
            ipcBitsOutHostPrm.inQueInfo.chInfo[0].pitch[2]                    = 0;
            ipcBitsOutHostPrm.inQueInfo.chInfo[0].bufType                     = SYSTEM_BUF_TYPE_VIDBITSTREAM;
            ipcBitsOutHostPrm.inQueInfo.chInfo[0].codingformat                = 9;
            ipcBitsOutHostPrm.inQueInfo.chInfo[0].memType                     = SYSTEM_MT_NONTILEDMEM;
            ipcBitsOutHostPrm.inQueInfo.chInfo[0].dataFormat                  = SYSTEM_DF_YUV422I_YUYV;
            ipcBitsOutHostPrm.inQueInfo.chInfo[0].scanFormat                  = SYSTEM_SF_PROGRESSIVE;//SYSTEM_SF_INTERLACED;//
    
            /* IPC BITS IN VIDEO Link */
            ipcBitsInVideoPrm.baseCreateParams.inQueParams.prevLinkId    = gVdecModuleContext.ipcBitsOutHLOSId;
            ipcBitsInVideoPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
            ipcBitsInVideoPrm.baseCreateParams.numOutQue                 = 1;
            ipcBitsInVideoPrm.baseCreateParams.outQueParams[0].nextLink  = gVdecModuleContext.decId;
            ipcBitsInVideoPrm.baseCreateParams.noNotifyMode              = FALSE;
            ipcBitsInVideoPrm.baseCreateParams.notifyNextLink            = TRUE;
            ipcBitsInVideoPrm.baseCreateParams.notifyPrevLink            = TRUE;
    	ipcBitsInVideoPrm.baseCreateParams.inputFrameRate              = 30;
    	ipcBitsInVideoPrm.baseCreateParams.outputFrameRate              = 30;
    
            /* DEC Link */
        DecLink_CreateParams_Init(&decPrm);
    
      for (i = 0; i < ipcBitsOutHostPrm.inQueInfo.numCh; i++)
        {
                decPrm.chCreateParams[i].format                               = IVIDEO_H264HP;
                decPrm.chCreateParams[i].profile                              = IH264VDEC_PROFILE_ANY;
                decPrm.chCreateParams[i].fieldMergeDecodeEnable               = FALSE;
                decPrm.chCreateParams[i].targetMaxWidth                       = ipcBitsOutHostPrm.inQueInfo.chInfo[i].width;
                decPrm.chCreateParams[i].targetMaxHeight                      = ipcBitsOutHostPrm.inQueInfo.chInfo[i].height;
                decPrm.chCreateParams[i].defaultDynamicParams.targetFrameRate = encPrm.chCreateParams[i].defaultDynamicParams.inputFrameRate;
                decPrm.chCreateParams[i].defaultDynamicParams.targetBitRate   = gVdecModuleContext.vdecConfig.decChannelParams[i].dynamicParam.targetBitRate;
    
                /* Max ref frames is only 2 as this is closed loop decoder */
                decPrm.chCreateParams[i].dpbBufSizeInFrames = 2;
        }
     	decPrm.inQueParams.prevLinkId    = gVdecModuleContext.ipcBitsInRTOSId;
            decPrm.inQueParams.prevLinkQueId = 0;
    
            decPrm.outQueParams.nextLink     = gVdecModuleContext.ipcM3OutId;
            decPrm.tilerEnable               = TILER_ENABLE;
            decPrm.numBufPerPool[0]          = NUM_DECODE_BUFFERS;
    
            /* FRAMES OUT VIDEO Link */
            ipcOutVideoPrm.inQueParams.prevLinkId    = gVdecModuleContext.decId;
            ipcOutVideoPrm.inQueParams.prevLinkQueId = 0;
            ipcOutVideoPrm.numOutQue                 = 1;
            ipcOutVideoPrm.outQueParams[0].nextLink  = gVdecModuleContext.ipcM3InId;
            ipcOutVideoPrm.notifyNextLink            = TRUE;
            ipcOutVideoPrm.notifyPrevLink            = TRUE;
            ipcOutVideoPrm.noNotifyMode              = FALSE;
    
            /* FRAMES IN VPSS Link */
            ipcInVpssPrm.inQueParams.prevLinkId    = gVdecModuleContext.ipcM3OutId;
            ipcInVpssPrm.inQueParams.prevLinkQueId = 0;
            ipcInVpssPrm.numOutQue                 = 1;
            //ipcInVpssPrm.outQueParams[0].nextLink  = gMergeId_cbb[DIS_MERGE_IDX];
            ipcInVpssPrm.outQueParams[0].nextLink  = gVdisModuleContext.swMsId[0];
            //ipcInVpssPrm.outQueParams[0].nextLink  = dupId[VA_DUP_IDX];
            ipcInVpssPrm.notifyNextLink            = TRUE;
            ipcInVpssPrm.notifyPrevLink            = TRUE;
            ipcInVpssPrm.noNotifyMode              = FALSE;
    
            /* Link Creation */
            System_linkCreate(gVdecModuleContext.ipcBitsOutHLOSId,&ipcBitsOutHostPrm,sizeof(ipcBitsOutHostPrm));
            System_linkCreate(gVdecModuleContext.ipcBitsInRTOSId,&ipcBitsInVideoPrm,sizeof(ipcBitsInVideoPrm));
            System_linkCreate(gVdecModuleContext.decId,&decPrm,sizeof(decPrm));
            System_linkCreate(gVdecModuleContext.ipcM3OutId,&ipcOutVideoPrm,sizeof(ipcOutVideoPrm));
            System_linkCreate(gVdecModuleContext.ipcM3InId,&ipcInVpssPrm,sizeof(ipcInVpssPrm));
    
    	/********************************************************************************************************************/
            /************************************************ DISPLAY PATH ******************************************************/
            /********************************************************************************************************************/
    
    
    /* SW MS Link */
            SwMsLink_CreateParams_Init(&swMsPrm);
            swMsPrm.numSwMsInst               = 1;
            //swMsPrm.swMsInstId[0]             = SYSTEM_SW_MS_SC_INST_SC5;
            swMsPrm.swMsInstId[0]             = SYSTEM_SW_MS_SC_INST_VIP0_SC;
            swMsPrm.swMsInstStartWin[0]       = 0;
            //swMsPrm.inQueParams.prevLinkId    = gMergeId_cbb[DIS_MERGE_IDX];
            swMsPrm.inQueParams.prevLinkId    = gVdecModuleContext.ipcM3InId;
            swMsPrm.inQueParams.prevLinkQueId = 0;
            //swMsPrm.outQueParams.nextLink     = gDupId_cbb[DIS_DUP_IDX];
            //swMsPrm.outQueParams.nextLink     = gVdisModuleContext.displayId[VDIS_DEV_HDMI];
            swMsPrm.outQueParams.nextLink     = gDisplayId;
            swMsPrm.maxInputQueLen            = SYSTEM_SW_MS_DEFAULT_INPUT_QUE_LEN;
            swMsPrm.maxOutRes                 = gVdisModuleContext.vdisConfig.deviceParams[VDIS_DEV_HDMI].resolution;
            swMsPrm.lineSkipMode              = FALSE;
            swMsPrm.enableLayoutGridDraw      = gVdisModuleContext.vdisConfig.enableLayoutGridDraw;
            swMsPrm.enableOuputDup              = FALSE;
            swMsPrm.enableProcessTieWithDisplay = FALSE;
            swMsPrm.outDataFormat               = SYSTEM_DF_YUV422I_YUYV;
    
            MultiCh_swMsGetDefaultLayoutPrm(SYSTEM_DC_VENC_HDMI,&swMsPrm,FALSE);
    
    
    
    
            /* HDMI Display */
            MULTICH_INIT_STRUCT(DisplayLink_CreateParams,displayPrm);
    //        displayPrm_SD.inQueParams[0].prevLinkId    = gDupId_cbb[DIS_DUP_IDX];
            displayPrm.inQueParams[0].prevLinkId    = gVdisModuleContext.swMsId[0];
            //displayPrm.inQueParams[0].prevLinkId    = gCbbDeiId;
            //displayPrm.inQueParams[0].prevLinkId    = gSelectId;
            displayPrm.inQueParams[0].prevLinkQueId = 0;
            displayPrm.activeQueue                  = 0;
            displayPrm.displayRes                   = gVdisModuleContext.vdisConfig.deviceParams[VDIS_DEV_HDMI].resolution;
            displayPrm.displayId                    = DISPLAY_LINK_DISPLAY_SC2;
    
            /* Select Link */
            System_linkCreate(gVdisModuleContext.swMsId[0],&swMsPrm,sizeof(swMsPrm));
            System_linkCreate(gDisplayId, &displayPrm,sizeof(displayPrm));
    
    
        OSA_printf("USECASE SETUP DONE\n");
    }
    
    /* ===================================================================
     *  @func     MultiCh_deleteTriStreamFullFtr
     *
     *  @desc     Function does the following
     *
     *  @modif    This function modifies the following structures
     *
     *  @inputs   This function takes the following inputs
     *            <argument name>
     *            Description of usage
     *            <argument name>
     *            Description of usage
     *
     *  @outputs  <argument name>
     *            Description of usage
     *
     *  @return   Return value of this function if any
     *  ==================================================================
     */
    Void MultiCh_deleteStreamMipiCameraFullFtr()
    {
        UInt32 ispId;
        UInt32 glbceId;
        UInt32 mergeId[NUM_MERGE_LINK];
        UInt32 ipcOutVpssId;
        UInt32 ipcInVideoId;
    	UInt32 ipcFramesOutVpssId;
    	UInt32 ipcFramesInDspId;	
        UInt32 dupId[NUM_DUP_LINK];
    	UInt32 vstabId;
    	UInt32 glbceSupportId;
    #ifdef WDR_ON
        UInt32 wdrId;
    	UInt32 wdrSupportId;
    #endif
    
        mergeId[CAM_STREAM_MERGE_IDX] = SYSTEM_VPSS_LINK_ID_MERGE_0;
        dupId[DIS_DUP_IDX] = SYSTEM_VPSS_LINK_ID_DUP_0;
        dupId[MJPEG_DUP_LINK_IDX] = SYSTEM_VPSS_LINK_ID_DUP_1;
        dupId[SCALER_DUP_IDX] = SYSTEM_VPSS_LINK_ID_DUP_2;
    	dupId[VA_DUP_IDX] = SYSTEM_VPSS_LINK_ID_DUP_3;  
        gVcamModuleContext.sclrId[0] = SYSTEM_LINK_ID_SCLR_INST_0;
        gVsysModuleContext.fdId = SYSTEM_LINK_ID_FD;
        gVsysModuleContext.swOsdId = SYSTEM_LINK_ID_SWOSD_0;
        ipcOutVpssId = SYSTEM_VPSS_LINK_ID_IPC_OUT_M3_0;
        ipcInVideoId = SYSTEM_VIDEO_LINK_ID_IPC_IN_M3_0;
    	ipcFramesOutVpssId = SYSTEM_VPSS_LINK_ID_IPC_FRAMES_OUT_0;
        ipcFramesInDspId   = SYSTEM_DSP_LINK_ID_IPC_FRAMES_IN_0;	
    	ispId = SYSTEM_LINK_ID_ISP_0;
    	glbceId = SYSTEM_LINK_ID_GLBCE;
    	vstabId = SYSTEM_LINK_ID_VSTAB_0;
    	glbceSupportId = SYSTEM_LINK_ID_GLBCE_SUPPORT_0;
    
    #ifdef WDR_ON
    	wdrId = SYSTEM_LINK_ID_WDR;
    	wdrSupportId = SYSTEM_LINK_ID_WDR_SUPPORT;
    #endif
    
        /* Links Deletion in reverse order from sink to source */
    
        /* display link */
    //#ifndef BYPASS_DISPLAY
            if(gUI_mcfw_config.dispCamChId == MIPI_CH0_DISPLAY )
            {
    	    System_linkDelete(gVdisModuleContext.displayId[VDIS_DEV_HDMI]);
            }
    //#endif
    
    #ifndef RESOLUTION_QVGA
        System_linkDelete(gVdisModuleContext.displayId[VDIS_DEV_SD]);
    #endif
    
        /* IPC Bits Links */
        System_linkDelete(gVencModuleContext.ipcBitsOutRTOSId);
        System_linkDelete(gVencModuleContext.ipcBitsInHLOSId);
    
        /* VSTAB Link */
        System_linkDelete(vstabId);
    
        /* Video Encoder Link */
        System_linkDelete(gVencModuleContext.encId);
    
        /* IPC Links */
        System_linkDelete(ipcOutVpssId);
        System_linkDelete(ipcInVideoId);
    
        /* FD Link */
        System_linkDelete(gVsysModuleContext.fdId);
    
    
    	if(Vsys_getSystemUseCase() == VSYS_USECASE_TRISTREAM_SMARTANALYTICS)	
    	{
    		/* VA link */
    		System_linkDelete(gVsysModuleContext.vaId);		
    		
    #ifdef VA_ON_DSP
    		/* IPC Frames Links */
    		System_linkDelete(ipcFramesOutVpssId);
    		System_linkDelete(ipcFramesInDspId);
    #endif
    
    		/* Dup for VA link */
    		System_linkDelete(dupId[VA_DUP_IDX]);		
    	}
    
    	
        /* Scaler Link */
        System_linkDelete(gVcamModuleContext.sclrId[0]);
    
    	/* dup link for display */
           if(gUI_mcfw_config.dispCamChId == MIPI_CH0_DISPLAY )
           {
    	    System_linkDelete(dupId[DIS_DUP_IDX]);
           }
    
        /* SWOSD Link */
        System_linkDelete(gVsysModuleContext.swOsdId);
    
        /* Merge Link */
        System_linkDelete(mergeId[CAM_STREAM_MERGE_IDX]);
    
        /* Dup link for Scaler */
        System_linkDelete(dupId[SCALER_DUP_IDX]);
    
        /* Dup Link */
        System_linkDelete(dupId[MJPEG_DUP_LINK_IDX]);
    
        if (gUI_mcfw_config.noisefilterMode == DSS_VNF_ON)
            /* NSF Link */
            System_linkDelete(gVcamModuleContext.nsfId);
        else
            /* VNF Link */
            System_linkDelete(gVcamModuleContext.vnfId);
    
        if(gIsGlbceInitDone)
        {
    		System_linkDelete(ispId);
    #ifdef YUV_M2M_DRV_TEST
    #else
    #ifndef WDR_ON
    		System_linkDelete(glbceId);
    		System_linkDelete(glbceSupportId);
    #else
    		System_linkDelete(wdrId);
    		System_linkDelete(wdrSupportId);
    #endif
    #endif
    		gIsGlbceInitDone = 0;
    	}
    
        /* Camera Link */
        System_linkDelete(gVcamModuleContext.cameraId);
    
        /* Print the HWI, SWI and all tasks load */
        /* Reset the accumulated timer ticks */
        MultiCh_prfLoadCalcEnable(FALSE, TRUE, FALSE);
    
        OSA_printf("USECASE TEARDOWN DONE\n");
    }
    

    Hi Badri,

    please find console log and src code file in the attachment.

    I am working IPNC RDK 3.5 version. It has one usecase like decode and display is available. (MultiCh_createEncA8Dec)

    In the log there is one warnings " [host] IPCBITSOUT:!!!WARNING.!!! NO FREE BUF AVAILABLE. OCCURENCE COUNT:[1000]".


    Regards,

    Kolanchi.

  •   HI Badri,

    In previous post, I have attached the source code. with that I have tested now, (I have done some changes. after removing dupLink inbetween IpcInVpssLink and swMsLink)

    there is no assertion issue. warnings only appearing and single frame displaying in the display.

    Warnings :

    [host] IPCBITSOUT:!!!WARNING.!!! NO FREE BUF AVAILABLE. OCCURENCE COUNT:[1000]

    Regards,

    Kolanchi.

  • Hi Badri,

    Where I can find the IPNC documentation, can you please mention doc name.


    Regards,

    Kolanchi.