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.

Question about the phenomenon when no signal input

Other Parts Discussed in Thread: TVP5158

Hi all

my environment is dvr03.50.00.05 with dm8168

the usecase is customed for our special product:

#define MULTI_DEI_TEST
#ifdef MULTI_DEI_TEST
#include "mcfw/src_linux/mcfw_api/usecases/multich_common.h"
#include "mcfw/src_linux/mcfw_api/usecases/multich_ipcbits.h"



// Keeping TILER disabled for 4D1 usecase
#define TILER_ENABLE    FALSE

#define DEI_OUT_MAIN_STRAMER	(DEI_LINK_OUT_QUE_DEI_SC)
#define DEI_OUT_SUB_STRAMER		(DEI_LINK_OUT_QUE_VIP_SC)

#if(defined(TI_814X_BUILD) || defined(DDR_MEM_256M))
#define     NUM_CAPTURE_BUFFERS          8
#define     NUM_NSF_BUFFERS              4
#define     NUM_ENCODE_D1_BUFFERS       4
#define     NUM_ENCODE_CIF_BUFFERS       4
#define     NUM_DECODE_BUFFERS           4
#define     NUM_IPC_OUT_BUFFERS          4
#define     NUM_SWMS_MAX_BUFFERS         8
#else
#define     NUM_CAPTURE_BUFFERS          8
#define     NUM_NSF_BUFFERS              6
#define     NUM_ENCODE_D1_BUFFERS       6
#define     NUM_ENCODE_CIF_BUFFERS       6
#define     NUM_DECODE_BUFFERS           6
#define     NUM_IPC_OUT_BUFFERS          6
#define     NUM_SWMS_MAX_BUFFERS         8
#endif

#define DEI_INFRAME_RATE		(30)	//(30)
#define DEI_OUTFRAME_RATE	(30)	//(30)
#define DEI_OUTFRAME_RATE_SUB	(30)	//(30)

#define MAX_DEI_NSF_LINK_CHAIN	(3)


 static SystemVideo_Ivahd2ChMap_Tbl system_IvaChMapTbl_HDEX1002F =
{
	.isPopulated = 1,
	.ivaMap[0] =
	{	
		.EncNumCh  = 1,
		.EncChList = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0},
		.DecNumCh  = 0,
		.DecChList = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0},
	},
	.ivaMap[1] =
	{	
		.EncNumCh  = 2,
		.EncChList = {2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0},
		.DecNumCh  = 0,
		.DecChList = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0},
	},
	.ivaMap[2] =
	{
		
		.EncNumCh  = 3,
		.EncChList = {1, 3, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0},
		.DecNumCh  = 0,
		.DecChList = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0},
	},
};

Void MultiCh_createVcapVenc(Adv7441InputPrm *pAdv7441Inputprm)
{
    int i_index;
    int j_index;

	for (i_index = 0;i_index < 3;i_index++)
	{
		TRACE_LOG("index %d chid %d inputtype %d\n", i_index, pAdv7441Inputprm[i_index].chId, pAdv7441Inputprm[i_index].inputType);
	}

    if(gVcapModuleContext.vcapConfig.numChn > MAX_DEI_NSF_LINK_CHAIN)
    {
    	TRACE_ERROR("Current usecase only support %d <= %d\n ", 
    		gVcapModuleContext.vcapConfig.numChn, MAX_DEI_NSF_LINK_CHAIN);
    }

    int i_dei_nsf_link_num = gVcapModuleContext.vcapConfig.numChn;

    CaptureLink_VipInstParams         *pCaptureInstPrm;
    CaptureLink_OutParams             *pCaptureOutPrm

    CaptureLink_CreateParams	capturePrm;	
    DeiLink_CreateParams	deiPrm[MAX_DEI_LINK];
    NsfLink_CreateParams	nsfPrm[MAX_NSF_LINK];
    MergeLink_CreateParams	mergePrm[MAX_MERGE_LINK];	
    IpcLink_CreateParams	ipcOutVpssPrm;

    IpcLink_CreateParams        ipcInVideoPrm;
    EncLink_CreateParams        encPrm;
    IpcBitsOutLinkRTOS_CreateParams   ipcBitsOutVideoPrm;

    IpcBitsInLinkHLOS_CreateParams    ipcBitsInHostPrm[2];
    System_LinkInfo                   bitsProducerLinkInfo;
	
#ifdef ENABLE_FRAMES_EXPORT
    IpcFramesOutLinkRTOS_CreateParams  ipcFramesOutVpssToHostPrm;
    IpcFramesInLinkHLOS_CreateParams   ipcFramesInHostPrm;
	System_LinkInfo framesProducerLinkInfo;
#endif

    UInt32 vipInstId;
    UInt32 i;
    VCAP_ADV7441_OUT_PARAMS_S adv7441_outparams[MAX_DEI_NSF_LINK_CHAIN];
    //UInt32 j;

    MULTICH_INIT_STRUCT(CaptureLink_CreateParams, capturePrm);
    for(i_index=0; i_index<i_dei_nsf_link_num; i_index++)
    {
    	MULTICH_INIT_STRUCT(DeiLink_CreateParams, deiPrm[i_index]);
    	MULTICH_INIT_STRUCT(NsfLink_CreateParams, nsfPrm[i_index]);
    }
    MULTICH_INIT_STRUCT(IpcLink_CreateParams,ipcOutVpssPrm);

    MULTICH_INIT_STRUCT(IpcLink_CreateParams,ipcInVideoPrm);
    MULTICH_INIT_STRUCT(EncLink_CreateParams, encPrm);
    MULTICH_INIT_STRUCT(IpcBitsOutLinkRTOS_CreateParams,ipcBitsOutVideoPrm);

    MULTICH_INIT_STRUCT(IpcBitsInLinkHLOS_CreateParams,ipcBitsInHostPrm[0]);

#ifdef ENABLE_FRAMES_EXPORT
    MULTICH_INIT_STRUCT(IpcFramesOutLinkRTOS_CreateParams ,ipcFramesOutVpssToHostPrm);
    MULTICH_INIT_STRUCT(IpcFramesInLinkHLOS_CreateParams  ,ipcFramesInHostPrm);
#endif

    MultiCh_detectBoard();

    TRACE_LOG("\n");
    System_linkControl(
    	SYSTEM_LINK_ID_M3VPSS,
    	SYSTEM_M3VPSS_CMD_RESET_VIDEO_DEVICES,
    	NULL,
    	0,
    	TRUE
    	);

    TRACE_LOG("\n");
    if(VSYS_USECASE_MULTICHN_VCAP_VENC_3HD_EX1002F == gVsysModuleContext.vsysConfig.systemUseCase)
    {
    	System_linkControl(
    		SYSTEM_LINK_ID_M3VIDEO,
    		SYSTEM_COMMON_CMD_SET_CH2IVAHD_MAP_TBL,
    		 &system_IvaChMapTbl_HDEX1002F,		
    		sizeof(SystemVideo_Ivahd2ChMap_Tbl),
    		TRUE
    		);
    }
    else
    {
    	System_linkControl(
    		SYSTEM_LINK_ID_M3VIDEO,
    		SYSTEM_COMMON_CMD_SET_CH2IVAHD_MAP_TBL,
    		 &system_IvaChMapTbl_HDEX1002F,		
    		sizeof(SystemVideo_Ivahd2ChMap_Tbl),
    		TRUE
    		);
    }
    TRACE_LOG("\n");

    //----------------------------------------------------------------------------------	

    gVcapModuleContext.captureId    = SYSTEM_LINK_ID_CAPTURE;
    gVcapModuleContext.deiId[0]     = SYSTEM_LINK_ID_DEI_HQ_0;//---SYSTEM_LINK_ID_DEI_0;
    gVcapModuleContext.deiId[1]     = SYSTEM_LINK_ID_DEI_0;//---SYSTEM_LINK_ID_DEI_0;
    gVcapModuleContext.deiId[2]     = SYSTEM_LINK_ID_DEI_1;//---SYSTEM_LINK_ID_DEI_0;
    gVcapModuleContext.nsfId[0]     = SYSTEM_LINK_ID_NSF_0;//---SYSTEM_LINK_ID_DEI_0;
    gVcapModuleContext.nsfId[1]     = SYSTEM_LINK_ID_NSF_1;//---SYSTEM_LINK_ID_DEI_0;
    gVcapModuleContext.nsfId[2]     = SYSTEM_LINK_ID_NSF_2;//---SYSTEM_LINK_ID_DEI_0;
    gVcapModuleContext.mergeId[0]	= SYSTEM_VPSS_LINK_ID_MERGE_0;//SYSTEM_VPSS_LINK_ID_MERGE_1;
    gVcapModuleContext.ipcOutVpssId = SYSTEM_VPSS_LINK_ID_IPC_OUT_M3_0;

    gVencModuleContext.ipcM3InId = SYSTEM_VIDEO_LINK_ID_IPC_IN_M3_0;
    gVencModuleContext.encId        = SYSTEM_LINK_ID_VENC_0;
    gVencModuleContext.ipcBitsOutRTOSId  = SYSTEM_VIDEO_LINK_ID_IPC_BITS_OUT_0;
    gVencModuleContext.ipcBitsInHLOSId   = SYSTEM_HOST_LINK_ID_IPC_BITS_IN_0;   


#ifdef ENABLE_FRAMES_EXPORT
    gVcapModuleContext.ipcFramesOutVpssToHostId  = SYSTEM_VPSS_LINK_ID_IPC_FRAMES_OUT_1;
    gVcapModuleContext.ipcFramesInHostId         = SYSTEM_HOST_LINK_ID_IPC_FRAMES_IN_0;
#endif

    TRACE_LOG("Capture link Params\n");
    for(i_index=0; i_index<i_dei_nsf_link_num; i_index++)
    {
    	capturePrm.outQueParams[i_index].nextLink   = gVcapModuleContext.deiId[i_index];
    }
    capturePrm.numVipInst    = i_dei_nsf_link_num;
    capturePrm.tilerEnable                = FALSE;
    capturePrm.numBufsPerCh               = NUM_CAPTURE_BUFFERS;
    capturePrm.maxBlindAreasPerCh         = 4;

	capturePrm.enableSdCrop 			= FALSE;
	capturePrm.doCropInCapture			= FALSE;

    int standard;

    for(vipInstId=0; vipInstId < capturePrm.numVipInst; vipInstId++)
    {
        pCaptureInstPrm = &capturePrm.vipInst[vipInstId];
        pCaptureInstPrm->videoDecoderId = SYSTEM_DEVICE_VID_DEC_TVP7002_DRV;
        pCaptureInstPrm->inDataFormat   = SYSTEM_DF_YUV422P;
        adv7441_outparams[vipInstId].instChId = vipInstId;

    #ifdef LPW_DEBUG
        standard = Vcap_GetAdv7441Resolution2(&adv7441_outparams[vipInstId], pAdv7441Inputprm[vipInstId]);/**/
    #else
        standard = Vcap_GetAdv7441Resolution(&adv7441_outparams[vipInstId]);
    #endif	
            
    	TRACE_LOG("VCap Ch cfg to standard %d \n", standard);
    	if(standard != SYSTEM_STD_INVALID)
    	{
    		pCaptureInstPrm->standard = standard;/*SYSTEM_Standard*/
    	}
    	else
    	{	
    		pCaptureInstPrm->standard = SYSTEM_STD_XGA_60;
    	}
                
    	pCaptureInstPrm->numOutput      = 1;
    	pCaptureOutPrm = &pCaptureInstPrm->outParams[0];
    	if (vipInstId == 0)
    	{
    		pCaptureInstPrm->vipInstId 	= (SYSTEM_CAPTURE_INST_VIP0_PORTA+
    		                              vipInstId)%SYSTEM_CAPTURE_INST_MAX;				
    	}
    	else
    	{
    		pCaptureInstPrm->vipInstId 	= (SYSTEM_CAPTURE_INST_VIP0_PORTB+
    		                              vipInstId)%SYSTEM_CAPTURE_INST_MAX;				
    	}
    	pCaptureOutPrm->outQueId = vipInstId;
    	
    	pCaptureOutPrm->dataFormat      = SYSTEM_DF_YUV422I_YUYV;
    	pCaptureOutPrm->scEnable        = FALSE;
    	pCaptureOutPrm->scOutWidth      = 0;
    	pCaptureOutPrm->scOutHeight     = 0;		
    }
    for(i = 0; i < i_dei_nsf_link_num; i++)
    {
    	if (i == 0)
    	{
			vidDecVideoModeArgs[i].vipInstId        			= SYSTEM_CAPTURE_INST_VIP0_PORTA+i;
			vidDecVideoModeArgs[i].modeParams.videoIfMode       = DEVICE_CAPT_VIDEO_IF_MODE_16BIT;
    	}
		else
		{
			vidDecVideoModeArgs[i].vipInstId        			= SYSTEM_CAPTURE_INST_VIP0_PORTB+i;
			vidDecVideoModeArgs[i].modeParams.videoIfMode       = DEVICE_CAPT_VIDEO_IF_MODE_8BIT;
		}
		TRACE_LOG("vidDecVideoModeArgs[%d].vipInstId = %d \n", i, vidDecVideoModeArgs[i].vipInstId);
		
		vidDecVideoModeArgs[i].deviceId         = DEVICE_VID_DEC_TVP7002_DRV;
        vidDecVideoModeArgs[i].numChInDevice    = 1;
		TRACE_LOG("AD %d num ch is %d\n", i, vidDecVideoModeArgs[i].numChInDevice);
		
        vidDecVideoModeArgs[i].modeParams.videoDataFormat    = SYSTEM_DF_YUV422P;
        vidDecVideoModeArgs[i].modeParams.standard           = SYSTEM_STD_1080P_30;
        vidDecVideoModeArgs[i].modeParams.videoCaptureMode   =
                    DEVICE_CAPT_VIDEO_CAPTURE_MODE_SINGLE_CH_NON_MUX_EMBEDDED_SYNC;
        vidDecVideoModeArgs[i].modeParams.videoSystem        =
                                      DEVICE_VIDEO_DECODER_VIDEO_SYSTEM_AUTO_DETECT;
        vidDecVideoModeArgs[i].modeParams.videoCropEnable    = FALSE;
        vidDecVideoModeArgs[i].modeParams.videoAutoDetectTimeout = -1;
    }

	for(i = 0; i < i_dei_nsf_link_num; i++)
	{
	    vidDecVideoModeArgs[i].adv7441Params.chId = pAdv7441InputPrm[i].chId; //i;
		vidDecVideoModeArgs[i].adv7441Params.inputType = pAdv7441InputPrm[i].inputType;
	}
    Vcap_configVideoDecoder(vidDecVideoModeArgs, 3);
    
    TRACE_LOG("\n");

    int i_dei_cfg_out_index = 0;
    for(i_index=0; i_index<i_dei_nsf_link_num; i_index++)
    {
    	deiPrm[i_index].inQueParams.prevLinkId = gVcapModuleContext.captureId;
    	deiPrm[i_index].inQueParams.prevLinkQueId  = i_index ;
    	deiPrm[i_index].enableLineSkipSc = FALSE;
    	if (adv7441_outparams[i_index].bInterlaced)	
    	{
    		deiPrm[i_index].enableDeiForceBypass = FALSE;
    	}
    	else
    	{
    		deiPrm[i_index].enableDeiForceBypass = TRUE;
    	}
    	
    	if(0 == i_index)
    	{
    		deiPrm[i_index].inputDeiFrameRate = 60;
    		deiPrm[i_index].outputDeiFrameRate = 60;
    	}
    	else
    	{
    		deiPrm[i_index].inputDeiFrameRate = 60;
    		deiPrm[i_index].outputDeiFrameRate = 60;
    	}

    	deiPrm[i_index].outQueParams[DEI_OUT_MAIN_STRAMER].nextLink = gVcapModuleContext.nsfId[i_index];
    	deiPrm[i_index].outQueParams[DEI_OUT_SUB_STRAMER].nextLink     = gVcapModuleContext.mergeId[0];
    	deiPrm[i_index].enableOut[DEI_OUT_MAIN_STRAMER] = TRUE;
    	deiPrm[i_index].enableOut[DEI_OUT_SUB_STRAMER] = TRUE;

    	deiPrm[i_index].tilerEnable[DEI_OUT_MAIN_STRAMER]          = TILER_ENABLE;
    	deiPrm[i_index].comprEnable = FALSE;
    	deiPrm[i_index].setVipScYuv422Format = FALSE;	

    	deiPrm[i_index].inputFrameRate[DEI_OUT_MAIN_STRAMER] = DEI_INFRAME_RATE;
    	deiPrm[i_index].outputFrameRate[DEI_OUT_MAIN_STRAMER] = DEI_OUTFRAME_RATE;
    	deiPrm[i_index].inputFrameRate[DEI_OUT_SUB_STRAMER] = DEI_INFRAME_RATE;
    	deiPrm[i_index].outputFrameRate[DEI_OUT_SUB_STRAMER] = DEI_OUTFRAME_RATE_SUB;
    	TRACE_LOG("VCap ch %d DEI %d ������֡��: %d %d ������֡��: %d %d\n",
    		i_index, i_index, 	DEI_INFRAME_RATE, DEI_OUTFRAME_RATE,
    							DEI_INFRAME_RATE, DEI_OUTFRAME_RATE_SUB);

    	TRACE_LOG("��Ƶͨ�� %d �������ֱ���Auto\n", i_index);
    	deiPrm[i_index].outScaleFactor[DEI_OUT_MAIN_STRAMER][i_dei_cfg_out_index].scaleMode = DEI_SCALE_MODE_RATIO;
    	deiPrm[i_index].outScaleFactor[DEI_OUT_MAIN_STRAMER][i_dei_cfg_out_index].ratio.heightRatio.numerator = 1;
    	deiPrm[i_index].outScaleFactor[DEI_OUT_MAIN_STRAMER][i_dei_cfg_out_index].ratio.heightRatio.denominator = 1;
    	deiPrm[i_index].outScaleFactor[DEI_OUT_MAIN_STRAMER][i_dei_cfg_out_index].ratio.widthRatio.numerator = 1;
    	deiPrm[i_index].outScaleFactor[DEI_OUT_MAIN_STRAMER][i_dei_cfg_out_index].ratio.widthRatio.denominator = 1;	
    	
    	TRACE_LOG("��Ƶͨ�� %d ������ %d %d %d\n", i_index, 
    					gVcapModuleContext.vcapConfig.channelParams[i_index].strmResolution[1].scaleMode,
    					gVcapModuleContext.vcapConfig.channelParams[i_index].strmResolution[1].param_x,
    					gVcapModuleContext.vcapConfig.channelParams[i_index].strmResolution[1].param_y);
    	if(1 == gVcapModuleContext.vcapConfig.channelParams[i_index].strmResolution[1].scaleMode)
    	{
    		TRACE_LOG("��Ƶͨ�� %d ������ �ֱ���ָ��%d %d\n", i_index, 
    				gVcapModuleContext.vcapConfig.channelParams[i_index].strmResolution[1].param_x,
    				gVcapModuleContext.vcapConfig.channelParams[i_index].strmResolution[1].param_y);
    		deiPrm[i_index].outScaleFactor[DEI_OUT_SUB_STRAMER][i_dei_cfg_out_index].scaleMode = DEI_SCALE_MODE_ABSOLUTE;		
    		deiPrm[i_index].outScaleFactor[DEI_OUT_SUB_STRAMER][i_dei_cfg_out_index].absoluteResolution.outWidth = gVcapModuleContext.vcapConfig.channelParams[i_index].strmResolution[1].param_x;
    		deiPrm[i_index].outScaleFactor[DEI_OUT_SUB_STRAMER][i_dei_cfg_out_index].absoluteResolution.outHeight = gVcapModuleContext.vcapConfig.channelParams[i_index].strmResolution[1].param_y;		
    	}
    	else
    	{
    		TRACE_LOG("��Ƶͨ�� %d ������ �ֱ���AUTO\n", i_index);
    		deiPrm[i_index].outScaleFactor[DEI_OUT_SUB_STRAMER][i_dei_cfg_out_index].scaleMode = DEI_SCALE_MODE_RATIO;
    		deiPrm[i_index].outScaleFactor[DEI_OUT_SUB_STRAMER][i_dei_cfg_out_index].ratio.heightRatio.numerator = 1;
    		deiPrm[i_index].outScaleFactor[DEI_OUT_SUB_STRAMER][i_dei_cfg_out_index].ratio.heightRatio.denominator = 1;
    		deiPrm[i_index].outScaleFactor[DEI_OUT_SUB_STRAMER][i_dei_cfg_out_index].ratio.widthRatio.numerator = 1;
    		deiPrm[i_index].outScaleFactor[DEI_OUT_SUB_STRAMER][i_dei_cfg_out_index].ratio.widthRatio.denominator = 1;
    	}				
    }
    for(i_index=0; i_index<i_dei_nsf_link_num; i_index++)
    {
    	nsfPrm[i_index].inQueParams.prevLinkId	= gVcapModuleContext.deiId[i_index];
    	nsfPrm[i_index].inQueParams.prevLinkQueId	= DEI_OUT_MAIN_STRAMER;
    	nsfPrm[i_index].numOutQue	= 1;	
    	nsfPrm[i_index].outQueParams[0].nextLink 		= gVcapModuleContext.mergeId[0];			
    	nsfPrm[i_index].bypassNsf	= TRUE;
    	nsfPrm[i_index].tilerEnable	= TILER_ENABLE;					
    	nsfPrm[i_index].numBufsPerCh	=  NUM_NSF_BUFFERS;
    	nsfPrm[i_index].inputFrameRate = 30;
    	nsfPrm[i_index].outputFrameRate = 30;
    }
    mergePrm[0].numInQue = 2 * i_dei_nsf_link_num;
    for(i_index=0; i_index<i_dei_nsf_link_num; i_index++)
    {
    	mergePrm[0].inQueParams[i_index*2].prevLinkId       = gVcapModuleContext.nsfId[i_index];
    	mergePrm[0].inQueParams[i_index*2].prevLinkQueId    = 0;
    	mergePrm[0].inQueParams[i_index*2 + 1].prevLinkId       = gVcapModuleContext.deiId[i_index];
    	mergePrm[0].inQueParams[i_index*2 + 1].prevLinkQueId    = DEI_OUT_SUB_STRAMER;
    }

	#ifdef ENABLE_FRAMES_EXPORT
	mergePrm[0].outQueParams.nextLink  = gVcapModuleContext.ipcFramesOutVpssToHostId;
	#else
    mergePrm[0].outQueParams.nextLink  = gVcapModuleContext.ipcOutVpssId;
	#endif

    mergePrm[0].notifyNextLink                  = TRUE;


    ipcOutVpssPrm.inQueParams.prevLinkQueId    = 0;    

    #ifdef ENABLE_FRAMES_EXPORT
        /* Set ipcFramesOutVpss link info */
        ipcFramesOutVpssToHostPrm.baseCreateParams.noNotifyMode = FALSE;
        ipcFramesOutVpssToHostPrm.baseCreateParams.notifyNextLink = TRUE;
        ipcFramesOutVpssToHostPrm.baseCreateParams.notifyPrevLink = TRUE;
        ipcFramesOutVpssToHostPrm.baseCreateParams.notifyProcessLink = TRUE;
        ipcFramesOutVpssToHostPrm.baseCreateParams.inQueParams.prevLinkId = gVcapModuleContext.mergeId[0];
        ipcFramesOutVpssToHostPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
        ipcFramesOutVpssToHostPrm.baseCreateParams.outQueParams[0].nextLink = gVcapModuleContext.ipcOutVpssId;
		ipcFramesOutVpssToHostPrm.baseCreateParams.processLink = gVcapModuleContext.ipcFramesInHostId;
		
		ipcFramesOutVpssToHostPrm.baseCreateParams.numOutQue = 1;
		ipcFramesOutVpssToHostPrm.baseCreateParams.inputFrameRate = 30;
		ipcFramesOutVpssToHostPrm.baseCreateParams.outputFrameRate = 30;

        ipcFramesInHostPrm.baseCreateParams.noNotifyMode = FALSE;
        ipcFramesInHostPrm.baseCreateParams.notifyNextLink = FALSE;
        ipcFramesInHostPrm.baseCreateParams.notifyPrevLink = TRUE;
        ipcFramesInHostPrm.baseCreateParams.inQueParams.prevLinkId = gVcapModuleContext.ipcFramesOutVpssToHostId;
        ipcFramesInHostPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
        ipcFramesInHostPrm.baseCreateParams.outQueParams[0].nextLink = SYSTEM_LINK_ID_INVALID;
        ipcFramesInHostPrm.exportOnlyPhyAddr = TRUE;
		ipcFramesInHostPrm.baseCreateParams.inputFrameRate = 30;
		ipcFramesInHostPrm.baseCreateParams.outputFrameRate = 30;

        ipcFramesInHostPrm.cbCtx = &gVcapModuleContext;
        ipcFramesInHostPrm.cbFxn = Vcap_ipcFramesInCbFxn;

        ipcOutVpssPrm.inQueParams.prevLinkId  = gVcapModuleContext.ipcFramesOutVpssToHostId;
    #else
        ipcOutVpssPrm.inQueParams.prevLinkId = gVcapModuleContext.mergeId[0];
	#endif
#endif

    ipcOutVpssPrm.outQueParams[0].nextLink     = gVencModuleContext.ipcM3InId;
    ipcOutVpssPrm.numOutQue = 1;    
    ipcOutVpssPrm.notifyNextLink               = TRUE;
    ipcOutVpssPrm.notifyPrevLink               = TRUE;
    ipcOutVpssPrm.noNotifyMode                 = FALSE;
    ipcOutVpssPrm.notifyProcessLink			   = FALSE;	

    ipcInVideoPrm.inQueParams.prevLinkId       = gVcapModuleContext.ipcOutVpssId;
    ipcInVideoPrm.inQueParams.prevLinkQueId    = 0;
    ipcInVideoPrm.numOutQue                    = 1;	
    ipcInVideoPrm.outQueParams[0].nextLink     = gVencModuleContext.encId;

    ipcInVideoPrm.notifyNextLink               = TRUE;
    ipcInVideoPrm.notifyPrevLink               = TRUE;
    ipcInVideoPrm.noNotifyMode                 = FALSE;

    TRACE_LOG("\n");

    {
    	EncLink_ChCreateParams *pLinkChPrm;
    	EncLink_ChDynamicParams *pLinkDynPrm;
    	VENC_CHN_PARAMS_S *pChPrm;
    	VENC_CHN_DYNAMIC_PARAM_S *pDynPrm;


    	TRACE_LOG("������ͨ����: %d ������ͨ����: %d MJPEGͨ����: %d\n",
    		gVencModuleContext.vencConfig.numPrimaryChn,
    		gVencModuleContext.vencConfig.numSecondaryChn,
    		gVencModuleContext.vencConfig.numTertiaryChn);

    	encPrm.inQueParams.prevLinkId    = gVencModuleContext.ipcM3InId;
    	encPrm.inQueParams.prevLinkQueId = 0;		
    	encPrm.outQueParams.nextLink     = gVencModuleContext.ipcBitsOutRTOSId;
    	encPrm.numBufPerCh[0] = NUM_ENCODE_D1_BUFFERS;
    	encPrm.numBufPerCh[1] = NUM_ENCODE_CIF_BUFFERS;		

    	/* Primary Stream Params - D1 */
    	for (i=0; i<(gVencModuleContext.vencConfig.numPrimaryChn + gVencModuleContext.vencConfig.numSecondaryChn); i++)
    	{
    		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;
    		pLinkChPrm->sliceCodingPreset = pChPrm->sliceCodingPreset; 
    		pLinkChPrm->sliceMode = pChPrm->sliceMode; 
    		pLinkChPrm->sliceUnitSize = pChPrm->sliceUnitSize;
    		TRACE_LOG("Pri ch %d slice params %d %d %d\n",
    			i, pLinkChPrm->sliceCodingPreset, pLinkChPrm->sliceMode, pLinkChPrm->sliceUnitSize);

    		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 0
    	/* Secondary Out <CIF> Params */
    	for (i=gVencModuleContext.vencConfig.numPrimaryChn, j=VENC_PRIMARY_CHANNELS;
    		i<(gVencModuleContext.vencConfig.numPrimaryChn
    		       + gVencModuleContext.vencConfig.numSecondaryChn);
    		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;
    	}
    	#endif
    }

    ipcBitsOutVideoPrm.baseCreateParams.inQueParams.prevLinkId = gVencModuleContext.encId;
    ipcBitsOutVideoPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
    ipcBitsOutVideoPrm.baseCreateParams.numOutQue                 = 1;
    ipcBitsOutVideoPrm.baseCreateParams.outQueParams[0].nextLink = gVencModuleContext.ipcBitsInHLOSId;

    TRACE_LOG("\n");	
    MultiCh_ipcBitsInitCreateParams_BitsOutRTOS(&ipcBitsOutVideoPrm,
                                               TRUE);

    TRACE_LOG("\n");

    ipcBitsInHostPrm[0].baseCreateParams.inQueParams.prevLinkId = gVencModuleContext.ipcBitsOutRTOSId;
    ipcBitsInHostPrm[0].baseCreateParams.inQueParams.prevLinkQueId = 0;
    MultiCh_ipcBitsInitCreateParams_BitsInHLOS(&ipcBitsInHostPrm[0]);

    TRACE_LOG("\n");

    System_linkCreate (gVcapModuleContext.captureId, &capturePrm, sizeof(capturePrm));
    TRACE_LOG("\n");
    for(i_index=0; i_index<i_dei_nsf_link_num; i_index++)
    {
    	System_linkCreate(gVcapModuleContext.deiId[i_index], &(deiPrm[i_index]), sizeof(DeiLink_CreateParams));
    	TRACE_LOG("\n");

    	System_linkCreate(gVcapModuleContext.nsfId[i_index], &(nsfPrm[i_index]), sizeof(NsfLink_CreateParams));
    	TRACE_LOG("\n");
    }
    System_linkCreate(gVcapModuleContext.mergeId[0], &mergePrm[0], sizeof(mergePrm[0]));	

    TRACE_LOG("\n");	

#ifdef ENABLE_FRAMES_EXPORT
	System_linkCreate(gVcapModuleContext.ipcFramesOutVpssToHostId	  , &ipcFramesOutVpssToHostPrm	  , sizeof(ipcFramesOutVpssToHostPrm));
	System_linkCreate(gVcapModuleContext.ipcFramesInHostId	   , &ipcFramesInHostPrm	, sizeof(ipcFramesInHostPrm));
	System_linkGetInfo(gVcapModuleContext.ipcFramesInHostId,&framesProducerLinkInfo);
	OSA_assert(framesProducerLinkInfo.numQue == 1);

#endif

    System_linkCreate(gVcapModuleContext.ipcOutVpssId, &ipcOutVpssPrm , sizeof(ipcOutVpssPrm) );

    TRACE_LOG("\n");	
    System_linkCreate(gVencModuleContext.ipcM3InId , &ipcInVideoPrm , sizeof(ipcInVideoPrm) );
    TRACE_LOG("\n");
    System_linkCreate(gVencModuleContext.encId, &encPrm, sizeof(encPrm));
    TRACE_LOG("\n");
    System_linkCreate(gVencModuleContext.ipcBitsOutRTOSId, &ipcBitsOutVideoPrm, sizeof(ipcBitsOutVideoPrm));
    TRACE_LOG("\n");

    System_linkCreate(gVencModuleContext.ipcBitsInHLOSId, &ipcBitsInHostPrm[0], sizeof(ipcBitsInHostPrm[0]));
    TRACE_LOG("\n");

    System_linkGetInfo(gVencModuleContext.ipcBitsInHLOSId,&bitsProducerLinkInfo);
    OSA_assert(bitsProducerLinkInfo.numQue == 1);


    printf ("\n\n========bitsProducerLinkInfo============\n");
    System_LinkQueInfo  *p_queInfo = NULL;
    for(i_index=0; i_index<bitsProducerLinkInfo.numQue; i_index++)
    {
    	p_queInfo = &(bitsProducerLinkInfo.queInfo[i_index]);
    	for(j_index=0; j_index<p_queInfo->numCh; j_index++)
    	{
    		printf ("Que [%d] Ch [%d]/[%d] Width %d, Height %d\n",
    			i_index, j_index, p_queInfo->numCh,
    			p_queInfo->chInfo[j_index].width,
    			p_queInfo->chInfo[j_index].height);
    	}
    	/*if(p_queInfo->numCh > gVencModuleContext.vencConfig.numPrimaryChn)
    	{
    	p_queInfo->numCh = gVencModuleContext.vencConfig.numPrimaryChn;
    	printf ("Reducing bitsProducerLinkInfo.numCh to %d\n", p_queInfo->numCh);
    	}*/
    }
    printf ("\n=================================================\n\n");

    TRACE_LOG("Create finish\n");
}

Void MultiCh_deleteVcapVenc()
{
	int i_index;

	System_linkDelete(gVcapModuleContext.captureId);

	TRACE_LOG("Delete %d NumCh\n", gVcapModuleContext.vcapConfig.numChn);
	for(i_index=0; i_index<gVcapModuleContext.vcapConfig.numChn; i_index++)
	{
		System_linkDelete(gVcapModuleContext.deiId[i_index]);
		System_linkDelete(gVcapModuleContext.nsfId[i_index]);
	}
	System_linkDelete(gVcapModuleContext.mergeId[0]);	
#ifdef SUPPORT_OSD
	System_linkDelete(gVcapModuleContext.ipcFramesOutVpssId[0]);
	System_linkDelete(gVcapModuleContext.ipcFramesInDspId[0]);
	System_linkDelete(gVcapModuleContext.dspAlgId[0]);	
#endif
	System_linkDelete(gVcapModuleContext.ipcOutVpssId);

	System_linkDelete(gVencModuleContext.ipcM3InId);
	System_linkDelete(gVencModuleContext.encId);
	System_linkDelete(gVencModuleContext.ipcBitsOutRTOSId);
	
	System_linkDelete(gVencModuleContext.ipcBitsInHLOSId);

#ifdef ENABLE_FRAMES_EXPORT
	System_linkDelete(gVcapModuleContext.ipcFramesOutVpssToHostId);
	System_linkDelete(gVcapModuleContext.ipcFramesInHostId);
#endif
	/* Print the HWI, SWI and all tasks load */
	/* Reset the accumulated timer ticks */
	MultiCh_prfLoadCalcEnable(FALSE, TRUE, FALSE);

}
#endif

when there is no videoinput at the three input port, the outputs of encode link is different, leading to the different phenomenon of encoded bits

If the output fps of encode link isn't 0 the encoded bits is like this(otherwise there is no bits):

the full log of Vsys_printDetailedStatistics :

2818.0710.TXT

I believe the reason comes from the capture link's output:

[m3vpss ] | Total Even Odd Total Even Odd Min / Max Min / Max Dropped Fid Repeat Frame Error Y/C
[m3vpss ] CH | Fields Fields Fields FPS FPS FPS Width Height Fields Count (Desc Error Y/C)
[m3vpss ] ------------------------------------------------------------------------------------------------------------
[m3vpss ] 000 | 1 1 0 0 0 0 65535 / 0 65535 / 0 1 0 0/0 (0/0)
[m3vpss ] 200 | 838 838 0 52 52 0 2 / 7850 2 / 9 1 0 0/0 (0/0)
[m3vpss ] 300 | 487 487 0 30 30 0 76 / 8176 2 / 2 1 0 0/0 (0/0)

but I don't know why. I want to unify the three port's phenomenon when no signal input, Pls show me how to do this, Thanks

  • Any body give some support!

    If port 0 get an input video 1080p30, the capture link's output like this:

    and port 1 and port 2 doesn't output grey bits


    [m3vpss ]        |  Total     Even    Odd Total Even Odd   Min / Max Min / Max Dropped  Fid Repeat   Frame Error Y/C
    [m3vpss ] CH | Fields Fields Fields FPS   FPS FPS          Width     Height      Fields           Count   (Desc Error Y/C)
    [m3vpss ] ------------------------------------------------------------------------------------------------------------
    [m3vpss ] 000 | 19151 19151        0    30       30      0           1920 / 1920 1080 / 1080     1           0    0/0 (0/0)
    [m3vpss ] 200 | 1                   1        0       0         0      0            65535 / 0   65535 / 0            1           0    0/0 (0/0)
    [m3vpss ] 300 | 978          978        0       1        1       0            35 / 396     2 / 14                   1           0    0/0 (0/0)

  • hi,

     

    how is your inputs connected to the VIP port? Is it the same input connected to all three VIP ports? i see one port is not at all detecting inputs and other port is detecting but the size really varying a lot? Can you make sure that your input is correct?

     

    Regards,

    Brijesh

  • hi, Thanks for your reply

    input0 is 16bit mode

    input1 and input2 is 8bit mode

    the size value you see is not correct  and random  when there is no input at three ports

    I will check further.

  • RDK 3.5 assumes VPS_CAPT_VIDEO_IF_MODE_16BIT and VPS_CAPT_VIDEO_CAPTURE_MODE_SINGLE_CH_NON_MUX_EMBEDDED_SYNC if video decoder device is anything other than TVP5158 and input data format is not FVID2_DF_RGB24_888.

    This is probably why you are seeing wrong width and height for 8bit ports.

    This is fixed in RDK 4.0. So migrate to RDK 4.0 .If that is not possible you will have to modify

    dvr_rdk\mcfw\src_bios6\links_m3vpss\capture\captureLink_drv.c

    CaptureLink_drvCreateInst

    to correctly configure the VIP parameters.