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.

TMS320DM8148: Interlaced Encoding Links Delete Error

Part Number: TMS320DM8148

Hi,

We are using DM8148 on custom board. Our use case involves 1080I60 encoding and transmission over Ethernet. I am able to create and start the links properly and able to encode the interlaced video. But when I want to delete the links and create them dynamically, I am facing Terminating Execution.

Below is source code for my use case:

		CaptureLink_CreateParams_Init(&capturePrm);
		NsfLink_CreateParams_Init(&nsfPrm);
		EncLink_CreateParams_Init(&encPrm);
		IpcLink_CreateParams_Init(&ipcOutVpssPrm);
		IpcLink_CreateParams_Init(&ipcInVideoPrm);
		IpcBitsOutLinkRTOS_CreateParams_Init(&ipcBitsOutVideoPrm);
		IpcBitsInLinkHLOS_CreateParams_Init(&ipcBitsInHostPrm);

		gVcapModuleContext.captureId				= SYSTEM_LINK_ID_CAPTURE;
		gVcapModuleContext.nsfId[0]					= SYSTEM_LINK_ID_NSF_0;
		gVencModuleContext.encId					= SYSTEM_LINK_ID_VENC_0;
		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;

		CaptureLink_VipInstParams         *pCaptureInstPrm;
		CaptureLink_OutParams             *pCaptureOutPrm;

		capturePrm.numVipInst    							= 1;
		capturePrm.tilerEnable              				= FALSE;
		capturePrm.enableSdCrop             				= FALSE;

		pCaptureInstPrm                     				= &capturePrm.vipInst[0];
		pCaptureInstPrm->videoIfMode        				= SYSTEM_CAPT_VIDEO_IF_MODE_16BIT;
		pCaptureInstPrm->videoCaptureMode 					= SYSTEM_CAPT_VIDEO_CAPTURE_MODE_SINGLE_CH_NON_MUX_EMBEDDED_SYNC;
		pCaptureInstPrm->vipInstId          				= (SYSTEM_CAPTURE_INST_VIP0_PORTA+0)%SYSTEM_CAPTURE_INST_MAX;
		pCaptureInstPrm->videoDecoderId     				= 0;
		pCaptureInstPrm->inDataFormat       				= SYSTEM_DF_YUV422P;
		pCaptureInstPrm->numOutput          				= 1;
		pCaptureInstPrm->numBufsPerCh						= 1;

		pCaptureOutPrm										= &pCaptureInstPrm->outParams[0];
		pCaptureOutPrm->scEnable            				= FALSE;
		pCaptureOutPrm->scOutWidth          				= 0;
		pCaptureOutPrm->scOutHeight         				= 0;
		pCaptureOutPrm->outQueId            				= 0;
		pCaptureOutPrm->dataFormat          				= SYSTEM_DF_YUV422I_YUYV;

		capturePrm.outQueParams[0].nextLink 		= gVcapModuleContext.nsfId[0];
		pCaptureInstPrm->inScanFormat					= SYSTEM_SF_INTERLACED;
		pCaptureInstPrm->standard					= SYSTEM_STD_1080I_60;


		nsfPrm.inQueParams.prevLinkId    				= gVcapModuleContext.captureId;
		nsfPrm.bypassNsf                 				= TRUE;
		nsfPrm.tilerEnable               				= FALSE;
		nsfPrm.inQueParams.prevLinkQueId 				= 0;
		nsfPrm.numOutQue                 				= 1;
		nsfPrm.outQueParams[0].nextLink  				= ipcOutVpssId;
		nsfPrm.numBufsPerCh              				= 4;
		nsfPrm.inputFrameRate            				= frameRate;
		nsfPrm.outputFrameRate           				= frameRate;

		ipcOutVpssPrm.inQueParams.prevLinkId			= gVcapModuleContext.nsfId[0];
		ipcOutVpssPrm.inQueParams.prevLinkQueId			= 0;
		ipcOutVpssPrm.numOutQue								= 1;
		ipcOutVpssPrm.outQueParams[0].nextLink				= ipcInVideoId;
		ipcOutVpssPrm.notifyNextLink						= TRUE;
		ipcOutVpssPrm.notifyPrevLink						= TRUE;
		ipcOutVpssPrm.noNotifyMode							= FALSE;
		ipcOutVpssPrm.inputFrameRate						= frameRate;
		ipcOutVpssPrm.outputFrameRate						= frameRate;

		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;
		ipcInVideoPrm.inputFrameRate							= frameRate;
		ipcInVideoPrm.outputFrameRate							= frameRate;

		EncLink_ChCreateParams *pLinkChPrm;
		EncLink_ChDynamicParams *pLinkDynPrm;

		encPrm.numBufPerCh[0] 								= 4;
		encPrm.inQueParams.prevLinkId   					= ipcInVideoId;
		encPrm.inQueParams.prevLinkQueId					= 0;
		encPrm.outQueParams.nextLink 						= gVencModuleContext.ipcBitsOutRTOSId;

		pLinkChPrm  										= &encPrm.chCreateParams[0];
		pLinkDynPrm 										= &pLinkChPrm->defaultDynamicParams;

		pLinkChPrm->format                  				= IVIDEO_H264HP;
		pLinkChPrm->profile                 				= 100;
		pLinkChPrm->dataLayout              				= IVIDEO_FIELD_SEPARATED;
		pLinkChPrm->fieldMergeEncodeEnable  				= FALSE;
		pLinkChPrm->enableAnalyticinfo      				= TRUE;
		pLinkChPrm->enableWaterMarking      				= FALSE;
		pLinkChPrm->maxBitRate              				= -1; //3*1000*1000;//5*1000*1000;
		pLinkChPrm->encodingPreset          				= 3; //VENC_XDM_HIGH_SPEED; //3;
		pLinkChPrm->enableSVCExtensionFlag  				= 0;
		pLinkChPrm->numTemporalLayer        				= 1;
		pLinkChPrm->rateControlPreset       				= 0;

		pLinkDynPrm->intraFrameInterval     				= 30;
		pLinkDynPrm->targetBitRate          				= currentBitrate;
		pLinkDynPrm->interFrameInterval     				= 1;
		pLinkDynPrm->mvAccuracy             				= IVIDENC2_MOTIONVECTOR_QUARTERPEL;
		pLinkDynPrm->inputFrameRate         				= frameRate;
		pLinkDynPrm->rcAlg                  				= 0;
		pLinkDynPrm->qpMin                  				= 10;
		pLinkDynPrm->qpMax                  				= 30;
		pLinkDynPrm->qpInit                 				= -1;
		pLinkDynPrm->vbrDuration            				= 8;
		pLinkDynPrm->vbrSensitivity         				= 0;

		ipcBitsOutVideoPrm.baseCreateParams.inQueParams.prevLinkId = gVencModuleContext.encId;
		ipcBitsOutVideoPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
		ipcBitsOutVideoPrm.baseCreateParams.numOutQue                 = 1;
		ipcBitsOutVideoPrm.baseCreateParams.inputFrameRate            = frameRate;
		ipcBitsOutVideoPrm.baseCreateParams.outputFrameRate              = frameRate;
		ipcBitsOutVideoPrm.baseCreateParams.outQueParams[0].nextLink = gVencModuleContext.ipcBitsInHLOSId;
		MultiCh_ipcBitsInitCreateParams_BitsOutRTOS(&ipcBitsOutVideoPrm,TRUE);

		ipcBitsInHostPrm.baseCreateParams.inQueParams.prevLinkId 		= gVencModuleContext.ipcBitsOutRTOSId;
		ipcBitsInHostPrm.baseCreateParams.inQueParams.prevLinkQueId 	= 0;
		ipcBitsInHostPrm.baseCreateParams.outQueParams[0].nextLink   	= SYSTEM_LINK_ID_INVALID;
		ipcBitsInHostPrm.baseCreateParams.inputFrameRate            = frameRate;
		ipcBitsInHostPrm.baseCreateParams.outputFrameRate              = frameRate;

		MultiCh_ipcBitsInitCreateParams_BitsInHLOS(&ipcBitsInHostPrm);

		System_linkCreate(gVcapModuleContext.captureId, &capturePrm, sizeof(capturePrm));
		System_linkCreate(gVcapModuleContext.nsfId[0], &nsfPrm, sizeof(nsfPrm));
		System_linkCreate(ipcOutVpssId, &ipcOutVpssPrm, sizeof(ipcOutVpssPrm));
		System_linkCreate(ipcInVideoId, &ipcInVideoPrm, sizeof(ipcInVideoPrm));
		System_linkCreate(gVencModuleContext.encId, &encPrm, sizeof(encPrm));
		System_linkCreate(gVencModuleContext.ipcBitsOutRTOSId, &ipcBitsOutVideoPrm, sizeof(ipcBitsOutVideoPrm));
		System_linkCreate(gVencModuleContext.ipcBitsInHLOSId, &ipcBitsInHostPrm, sizeof(ipcBitsInHostPrm));

		EncLink_ChInputFpsParam inParams;
		inParams.chId            = 0;
		inParams.inputFps       = frameRate;
		System_linkControl(SYSTEM_LINK_ID_VENC_0, ENC_LINK_CMD_SET_CODEC_INPUT_FPS, &inParams, sizeof(inParams), TRUE);

		EncLink_ChFpsParams params;
		params.chId            = 0;
		params.targetFps       = (1000 * frameRate);
		params.targetBitRate   = 0;

		System_linkControl(SYSTEM_LINK_ID_VENC_0, ENC_LINK_CMD_SET_CODEC_FPS, &params, sizeof(params), TRUE);

		System_linkStart(gVencModuleContext.ipcBitsInHLOSId);
		System_linkStart(gVencModuleContext.ipcBitsOutRTOSId);
		System_linkStart(gVencModuleContext.encId);
		System_linkStart(ipcInVideoId);
		System_linkStart(ipcOutVpssId);
		System_linkStart(gVcapModuleContext.nsfId[0]);
		System_linkStart(gVcapModuleContext.captureId);

Link Stop and Deletion Part:

	if(gVcapModuleContext.captureId != SYSTEM_LINK_ID_INVALID)
		System_linkStop(gVcapModuleContext.captureId);

	if(gVcapModuleContext.nsfId[0] != SYSTEM_LINK_ID_INVALID)
		System_linkStop(gVcapModuleContext.nsfId[0]);

	if(ipcOutVpssId != SYSTEM_LINK_ID_INVALID)
		System_linkStop(ipcOutVpssId);

	if(ipcInVideoId != SYSTEM_LINK_ID_INVALID)
		System_linkStop(ipcInVideoId);

	if(gVencModuleContext.encId != SYSTEM_LINK_ID_INVALID)
		System_linkStop(gVencModuleContext.encId);

	if(gVencModuleContext.ipcBitsOutRTOSId != SYSTEM_LINK_ID_INVALID)
		System_linkStop(gVencModuleContext.ipcBitsOutRTOSId);

	if(gVencModuleContext.ipcBitsInHLOSId != SYSTEM_LINK_ID_INVALID)
		System_linkStop(gVencModuleContext.ipcBitsInHLOSId);

	if(gVcapModuleContext.captureId != SYSTEM_LINK_ID_INVALID)
	{
		System_linkDelete(gVcapModuleContext.captureId);
		gVcapModuleContext.captureId			= SYSTEM_LINK_ID_INVALID;
	}

	if(gVcapModuleContext.nsfId[0] != SYSTEM_LINK_ID_INVALID)
	{
		System_linkDelete(gVcapModuleContext.nsfId[0]);
		gVcapModuleContext.nsfId[0]				= SYSTEM_LINK_ID_INVALID;
	}

	if(ipcOutVpssId != SYSTEM_LINK_ID_INVALID)
	{
		System_linkDelete(ipcOutVpssId);
		ipcOutVpssId							= SYSTEM_LINK_ID_INVALID;
	}

	if(ipcInVideoId != SYSTEM_LINK_ID_INVALID)
	{
		System_linkDelete(ipcInVideoId);
		ipcInVideoId							= SYSTEM_LINK_ID_INVALID;
	}

	if(gVencModuleContext.encId != SYSTEM_LINK_ID_INVALID)
	{
		System_linkDelete(gVencModuleContext.encId);
		gVencModuleContext.encId				= SYSTEM_LINK_ID_INVALID;
	}

	if(gVencModuleContext.ipcBitsOutRTOSId != SYSTEM_LINK_ID_INVALID)
	{
		System_linkDelete(gVencModuleContext.ipcBitsOutRTOSId);
		gVencModuleContext.ipcBitsOutRTOSId		= SYSTEM_LINK_ID_INVALID;
	}

	if(gVencModuleContext.ipcBitsInHLOSId != SYSTEM_LINK_ID_INVALID)
	{
		System_linkDelete(gVencModuleContext.ipcBitsInHLOSId);
		gVencModuleContext.ipcBitsInHLOSId		= SYSTEM_LINK_ID_INVALID;
	}

I am able to create the links and video encoding is working fine. But when I delete the links dynamically, I am facing the issue.

Regards,

Pranay Kumar