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.

MultiChannel Dec+Mosaic+Enc in DVRRDK

Hi,

I am working with multichannel Dec+Mosaic+Enc usecase in DVRRDK3.5 and get some issues. The following is the code.

#include "multich_common.h"
#include "multich_ipcbits.h"
#include "mcfw/interfaces/link_api/avsync_hlos.h"
#include "mcfw/interfaces/link_api/system_tiler.h"

#define NUM_SWMS_LINK (6)

#define NUM_BUFS_PER_CH_DEC (4)
#define NUM_BUFS_PER_CH_SWMS (4)
#define NUM_BUFS_PER_CH_ENC (4)
#define NUM_BUFS_PER_CH_NSF (4)
#define NUM_BUFS_PER_CH_MERGE (4)


static SystemVideo_Ivahd2ChMap_Tbl systemVid_encDecIvaChMapTbl =
{
.isPopulated = 1,
.ivaMap[0] =
{
.EncNumCh = 6,
.EncChList = {0, 1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0 , 0, 0},

.DecNumCh = 6,
.DecChList = {0, 1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0 , 0, 0},
},
.ivaMap[1] = { .EncNumCh = 0, .DecNumCh = 0, },
.ivaMap[2] = { .EncNumCh = 0, .DecNumCh = 0, },
};

typedef struct {

UInt32 swmsId[NUM_SWMS_LINK];
UInt32 mergeId;
UInt32 nsfId;
UInt32 dupId;

/* encode, deccode, ipc ID's are in gVxxxModuleContext */
} MultiCh_VdecVmosaicVencVObj;

MultiCh_VdecVmosaicVencVObj gMultiCh_VdecVmosaicVencVObj;

/*Set Link IDs*/
void Multich_SetLinkIds()
{
gVdecModuleContext.ipcBitsOutHLOSId = SYSTEM_HOST_LINK_ID_IPC_BITS_OUT_0;
gVdecModuleContext.ipcBitsInRTOSId = SYSTEM_VIDEO_LINK_ID_IPC_BITS_IN_0;
gVdecModuleContext.ipcM3InId = SYSTEM_VPSS_LINK_ID_IPC_IN_M3_0;
gVdecModuleContext.ipcM3OutId = SYSTEM_VIDEO_LINK_ID_IPC_OUT_M3_0;
gVdecModuleContext.decId = SYSTEM_LINK_ID_VDEC_0;

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

gMultiCh_VdecVmosaicVencVObj.dupId = SYSTEM_VPSS_LINK_ID_DUP_0;
gMultiCh_VdecVmosaicVencVObj.mergeId = SYSTEM_VPSS_LINK_ID_MERGE_0;
gMultiCh_VdecVmosaicVencVObj.nsfId = SYSTEM_LINK_ID_NSF_0;

gMultiCh_VdecVmosaicVencVObj.swmsId[0] = SYSTEM_LINK_ID_SW_MS_MULTI_INST_0;
gMultiCh_VdecVmosaicVencVObj.swmsId[1] = SYSTEM_LINK_ID_SW_MS_MULTI_INST_1;
gMultiCh_VdecVmosaicVencVObj.swmsId[2] = SYSTEM_LINK_ID_SW_MS_MULTI_INST_2;
gMultiCh_VdecVmosaicVencVObj.swmsId[3] = SYSTEM_LINK_ID_SW_MS_MULTI_INST_3;
gMultiCh_VdecVmosaicVencVObj.swmsId[4] = SYSTEM_LINK_ID_SW_MS_MULTI_INST_4;
gMultiCh_VdecVmosaicVencVObj.swmsId[5] = SYSTEM_LINK_ID_SW_MS_MULTI_INST_5;
//gMultiCh_VdecVmosaicVencVObj.swmsId[6] = SYSTEM_LINK_ID_SW_MS_MULTI_INST_6;
//gMultiCh_VdecVmosaicVencVObj.swmsId[7] = SYSTEM_LINK_ID_SW_MS_MULTI_INST_7;
}

/*Set Encoder Params*/
static Void Multich_SetEncParams(EncLink_CreateParams *encPrm)
{
Uint32 i;
EncLink_ChCreateParams *pLinkChPrm;
EncLink_ChDynamicParams *pLinkDynPrm;
VENC_CHN_DYNAMIC_PARAM_S *pDynPrm;
VENC_CHN_PARAMS_S *pChPrm;

encPrm->numBufPerCh[0] = NUM_BUFS_PER_CH_ENC;
for (i=0; i < gVencModuleContext.vencConfig.numPrimaryChn; 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->maxBitRate = pChPrm->maxBitRate;
pLinkChPrm->encodingPreset = pChPrm->encodingPreset;
pLinkChPrm->rateControlPreset = pChPrm->rcType;
pLinkChPrm->enableHighSpeed = FALSE;
pLinkChPrm->numTemporalLayer = pChPrm->numTemporalLayer;
pLinkChPrm->enableSVCExtensionFlag = pChPrm->enableSVCExtensionFlag;

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;
}
}


/*Set Mosaic Params*/
static Void MultiCh_setSwMsParams(SwMsLink_CreateParams *swMsPrm, int i)//之后修改为只混合除与会者本人之外的7路图像
{
SwMsLink_LayoutPrm *layoutInfo;
SwMsLink_LayoutWinInfo *winInfo;
UInt32 outWidth, outHeight, row, col, winId, widthAlign, heightAlign;
outWidth = 1280;
outHeight = 720;

widthAlign = 8;
heightAlign = 1;

layoutInfo = &swMsPrm->layoutPrm;
/* init to known default */
memset(layoutInfo, 0, sizeof(*layoutInfo));

layoutInfo->onlyCh2WinMapChanged = FALSE;
layoutInfo->outputFPS = 30;
layoutInfo->numWin = 8;

for(row=0; row<2; row++)
{
for(col=0; col<2; col++)
{
winId = row*2+col;
winInfo = &layoutInfo->winInfo[winId];
winInfo->width = SystemUtils_floor((outWidth*2)/5, widthAlign);
winInfo->height = SystemUtils_floor(outHeight/2, heightAlign);
winInfo->startX = winInfo->width*col;
winInfo->startY = winInfo->height*row;
winInfo->bypass = FALSE;
winInfo->channelNum = winId;
}
}

for(row=0; row<4; row++)
{
winId = 4 + row;
winInfo = &layoutInfo->winInfo[winId];
winInfo->width = layoutInfo->winInfo[0].width/2;
winInfo->height = layoutInfo->winInfo[0].height/2;
winInfo->startX = layoutInfo->winInfo[0].width*2;
winInfo->startY = winInfo->height*row;
winInfo->bypass = FALSE;
winInfo->channelNum = winId;
}
}

/*Set Noisefilter Params*/
static Void Multich_SetNsfParams(NsfLink_CreateParams *nsfPrm)
{
nsfPrm->bypassNsf = TRUE;
nsfPrm->tilerEnable = FALSE;
nsfPrm->numOutQue = 1;
nsfPrm->numBufsPerCh = NUM_BUFS_PER_CH_NSF;
nsfPrm->inputFrameRate = 30;
nsfPrm->outputFrameRate = 30;
}
/*Create usecase*/
void MultiCh_createVdecVmosaicVenc()
{
printf("Enter the usecase file!!!\n");
//Define Link Params
SwMsLink_CreateParams swMsPrm[NUM_SWMS_LINK];
MergeLink_CreateParams mergePrm;
DupLink_CreateParams dupPrm;
NsfLink_CreateParams nsfPrm;
IpcLink_CreateParams ipcOutVpssPrm;
IpcLink_CreateParams ipcInVideoPrm;
IpcLink_CreateParams ipcOutVideoPrm;
IpcLink_CreateParams ipcInVpssPrm;
EncLink_CreateParams encPrm;
DecLink_CreateParams decPrm;
IpcBitsOutLinkRTOS_CreateParams ipcBitsOutVideoPrm;
IpcBitsInLinkRTOS_CreateParams ipcBitsInVideoPrm;
IpcBitsOutLinkHLOS_CreateParams ipcBitsOutHostPrm;
IpcBitsInLinkHLOS_CreateParams ipcBitsInHostPrm;

UInt32 i;
//Set Link ID
Multich_SetLinkIds();
//Init Link Params
for(i=0; i<NUM_SWMS_LINK; i++)
MULTICH_INIT_STRUCT(SwMsLink_CreateParams, swMsPrm[i]);
MULTICH_INIT_STRUCT(NsfLink_CreateParams, nsfPrm);
MULTICH_INIT_STRUCT(IpcLink_CreateParams, ipcOutVpssPrm);
MULTICH_INIT_STRUCT(IpcLink_CreateParams, ipcInVideoPrm);
MULTICH_INIT_STRUCT(IpcLink_CreateParams, ipcOutVideoPrm);
MULTICH_INIT_STRUCT(IpcLink_CreateParams, ipcInVpssPrm);
MULTICH_INIT_STRUCT(EncLink_CreateParams, encPrm);
MULTICH_INIT_STRUCT(DecLink_CreateParams, decPrm);
MULTICH_INIT_STRUCT(IpcBitsOutLinkRTOS_CreateParams, ipcBitsOutVideoPrm);
MULTICH_INIT_STRUCT(IpcBitsInLinkRTOS_CreateParams, ipcBitsInVideoPrm);
MULTICH_INIT_STRUCT(IpcBitsOutLinkHLOS_CreateParams, ipcBitsOutHostPrm);
MULTICH_INIT_STRUCT(IpcBitsInLinkHLOS_CreateParams, ipcBitsInHostPrm);

MultiCh_detectBoard();

System_linkControl(
SYSTEM_LINK_ID_M3VPSS,
SYSTEM_M3VPSS_CMD_RESET_VIDEO_DEVICES,
NULL,
0,
TRUE
);
/* Disable tiler allocator for this usecase
* for that tiler memory can be reused for
* non-tiled allocation
*/
SystemTiler_disableAllocator();

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

printf("Start to config Link Params!!!\n");
/******************************set ipcBitsOutHLOS link param *******************************/
IpcBitsOutLinkHLOS_CreateParams_Init(&ipcBitsOutHostPrm);
ipcBitsOutHostPrm.baseCreateParams.outQueParams[0].nextLink = gVdecModuleContext.ipcBitsInRTOSId;
ipcBitsOutHostPrm.baseCreateParams.notifyNextLink = FALSE;
ipcBitsOutHostPrm.baseCreateParams.notifyPrevLink = FALSE;
ipcBitsOutHostPrm.baseCreateParams.noNotifyMode = TRUE;
ipcBitsOutHostPrm.baseCreateParams.numOutQue = 1;
ipcBitsOutHostPrm.inQueInfo.numCh = NUM_SWMS_LINK;
ipcBitsOutHostPrm.bufPoolPerCh = TRUE;
for (i=0; i<ipcBitsOutHostPrm.inQueInfo.numCh; i++)
{
ipcBitsOutHostPrm.inQueInfo.chInfo[i].width =
gVdecModuleContext.vdecConfig.decChannelParams[i].maxVideoWidth;

ipcBitsOutHostPrm.inQueInfo.chInfo[i].height =
gVdecModuleContext.vdecConfig.decChannelParams[i].maxVideoHeight;

ipcBitsOutHostPrm.inQueInfo.chInfo[i].scanFormat =
SYSTEM_SF_PROGRESSIVE;

ipcBitsOutHostPrm.inQueInfo.chInfo[i].bufType = 0; // NOT USED
ipcBitsOutHostPrm.inQueInfo.chInfo[i].codingformat = 0; // NOT USED
ipcBitsOutHostPrm.inQueInfo.chInfo[i].dataFormat = 0; // NOT USED
ipcBitsOutHostPrm.inQueInfo.chInfo[i].memType = 0; // NOT USED
ipcBitsOutHostPrm.inQueInfo.chInfo[i].startX = 0; // NOT USED
ipcBitsOutHostPrm.inQueInfo.chInfo[i].startY = 0; // NOT USED
ipcBitsOutHostPrm.inQueInfo.chInfo[i].pitch[0] = 0; // NOT USED
ipcBitsOutHostPrm.inQueInfo.chInfo[i].pitch[1] = 0; // NOT USED
ipcBitsOutHostPrm.inQueInfo.chInfo[i].pitch[2] = 0; // NOT USED
ipcBitsOutHostPrm.numBufPerCh[i] = 6;
}
/******************************set ipcBitsInRTOS link param *******************************/
IpcBitsInLinkRTOS_CreateParams_Init(&ipcBitsInVideoPrm);
ipcBitsInVideoPrm.baseCreateParams.inQueParams.prevLinkId = gVdecModuleContext.ipcBitsOutHLOSId;//Arm out
ipcBitsInVideoPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
ipcBitsInVideoPrm.baseCreateParams.outQueParams[0].nextLink = gVdecModuleContext.decId;
ipcBitsInVideoPrm.baseCreateParams.noNotifyMode = TRUE;
ipcBitsInVideoPrm.baseCreateParams.notifyNextLink = TRUE;
ipcBitsInVideoPrm.baseCreateParams.notifyPrevLink = FALSE;
ipcBitsInVideoPrm.baseCreateParams.numOutQue = 1;

printf("Config DecLink Params!!!\n");
/******************************set dec link param *******************************/
DecLink_CreateParams_Init(&decPrm);

for (i=0; i<NUM_SWMS_LINK; i++)
{
decPrm.chCreateParams[i].format = IVIDEO_H264HP;
decPrm.chCreateParams[i].profile = IH264VDEC_PROFILE_ANY;
decPrm.chCreateParams[i].processCallLevel = VDEC_FRAMELEVELPROCESSCALL;
decPrm.chCreateParams[i].dpbBufSizeInFrames = IH264VDEC_DPB_NUMFRAMES_AUTO;
decPrm.chCreateParams[i].targetMaxWidth = ipcBitsOutHostPrm.inQueInfo.chInfo[i].width;
decPrm.chCreateParams[i].targetMaxHeight = ipcBitsOutHostPrm.inQueInfo.chInfo[i].height;
decPrm.chCreateParams[i].numBufPerCh = NUM_BUFS_PER_CH_DEC;
decPrm.chCreateParams[i].defaultDynamicParams.targetFrameRate = gVdecModuleContext.vdecConfig.decChannelParams[i].dynamicParam.frameRate;
decPrm.chCreateParams[i].defaultDynamicParams.targetBitRate = gVdecModuleContext.vdecConfig.decChannelParams[i].dynamicParam.targetBitRate;
decPrm.chCreateParams[i].tilerEnable = FALSE;
}
decPrm.inQueParams.prevLinkId = gVdecModuleContext.ipcBitsInRTOSId;//video in
decPrm.inQueParams.prevLinkQueId = 0;
decPrm.outQueParams.nextLink = gVdecModuleContext.ipcM3OutId;//Video out

/******************************set ipcOutVideo link param *******************************/
IpcLink_CreateParams_Init(&ipcOutVideoPrm);
ipcOutVideoPrm.inQueParams.prevLinkId = gVdecModuleContext.decId;
ipcOutVideoPrm.inQueParams.prevLinkQueId = 0;
ipcOutVideoPrm.outQueParams[0].nextLink = gVdecModuleContext.ipcM3InId;//Vpss in
ipcOutVideoPrm.notifyNextLink = TRUE;
ipcOutVideoPrm.notifyPrevLink = TRUE;
//ipcOutVideoPrm.noNotifyMode = TRUE;
ipcOutVideoPrm.numOutQue = 1;
/******************************set ipcInVpss link param *******************************/
IpcLink_CreateParams_Init(&ipcInVpssPrm);
ipcInVpssPrm.inQueParams.prevLinkId = gVdecModuleContext.ipcM3OutId;
ipcInVpssPrm.inQueParams.prevLinkQueId = 0;
ipcInVpssPrm.notifyNextLink = TRUE;
ipcInVpssPrm.notifyPrevLink = TRUE;
//ipcInVpssPrm.noNotifyMode = TRUE;
ipcInVpssPrm.numOutQue = 1;
ipcInVpssPrm.outQueParams[0].nextLink = gMultiCh_VdecVmosaicVencVObj.dupId;

printf("Config DupLink Params!!!\n");
/******************************set dup link param *******************************/
dupPrm.inQueParams.prevLinkId = gVdecModuleContext.ipcM3InId;;
dupPrm.inQueParams.prevLinkQueId = 0;
dupPrm.numOutQue = NUM_SWMS_LINK;
for(i=0; i<NUM_SWMS_LINK; i++)
dupPrm.outQueParams[i].nextLink = gMultiCh_VdecVmosaicVencVObj.swmsId[i];
dupPrm.notifyNextLink = TRUE;

printf("Config SWMSLink Params!!!\n");
/******************************set swms link param *******************************/
for(i=0; i<NUM_SWMS_LINK; i++)
{
SwMsLink_CreateParams_Init(&swMsPrm[i]);
swMsPrm[i].numSwMsInst = 1;
if(i == 0)
swMsPrm[i].swMsInstId[0] = SYSTEM_SW_MS_SC_INST_VIP1_SC;//4
else if(i == 1)
swMsPrm[i].swMsInstId[0] = SYSTEM_SW_MS_SC_INST_VIP1_SC;//4
else if(i == 2)
swMsPrm[i].swMsInstId[0] = SYSTEM_SW_MS_SC_INST_VIP1_SC;//4
else if(i == 3)
swMsPrm[i].swMsInstId[0] = SYSTEM_SW_MS_SC_INST_VIP1_SC;//4
else if(i == 4)
swMsPrm[i].swMsInstId[0] = SYSTEM_SW_MS_SC_INST_SC5;//5
else if(i == 5)
swMsPrm[i].swMsInstId[0] = SYSTEM_SW_MS_SC_INST_SC5;//5
else if(i == 6)
swMsPrm[i].swMsInstId[0] = SYSTEM_SW_MS_SC_INST_SC5;//5
else
swMsPrm[i].swMsInstId[0] = SYSTEM_SW_MS_SC_INST_SC5;//5

swMsPrm[i].maxInputQueLen = SYSTEM_SW_MS_DEFAULT_INPUT_QUE_LEN + 4;
swMsPrm[i].numOutBuf = NUM_BUFS_PER_CH_SWMS;

swMsPrm[i].maxOutRes = VSYS_STD_720P_60;
swMsPrm[i].initOutRes = VSYS_STD_720P_60;
swMsPrm[i].lineSkipMode = FALSE;
swMsPrm[i].enableLayoutGridDraw = FALSE;
MultiCh_setSwMsParams(&swMsPrm[i], i);
swMsPrm[i].inQueParams.prevLinkId = gMultiCh_VdecVmosaicVencVObj.dupId;
swMsPrm[i].inQueParams.prevLinkQueId = i;
swMsPrm[i].outQueParams.nextLink = gMultiCh_VdecVmosaicVencVObj.mergeId;

swMsPrm[i].outputBufModified = FALSE;
swMsPrm[i].enableProcessTieWithDisplay = FALSE;

}
printf("Config MergeLink Params!!!\n");
/******************************set merge link param *******************************/
mergePrm.numInQue = NUM_SWMS_LINK;
for(i=0; i<NUM_SWMS_LINK; i++)
{
mergePrm.inQueParams[i].prevLinkId = gMultiCh_VdecVmosaicVencVObj.swmsId[i];
mergePrm.inQueParams[i].prevLinkQueId = 0;
}
mergePrm.outQueParams.nextLink = gMultiCh_VdecVmosaicVencVObj.nsfId;
mergePrm.notifyNextLink = TRUE;

printf("Config NfsLink Params!!!\n");
/******************************set nsf link param *******************************/
NsfLink_CreateParams_Init(&nsfPrm);
Multich_SetNsfParams(&nsfPrm);
nsfPrm.inQueParams.prevLinkId = gMultiCh_VdecVmosaicVencVObj.mergeId;
nsfPrm.inQueParams.prevLinkQueId = 0;
nsfPrm.outQueParams[0].nextLink = gVencModuleContext.ipcM3OutId;
/******************************set ipcOutVpssPrm link param *******************************/
IpcLink_CreateParams_Init(&ipcOutVpssPrm);
ipcOutVpssPrm.inQueParams.prevLinkId = gMultiCh_VdecVmosaicVencVObj.nsfId;
ipcOutVpssPrm.inQueParams.prevLinkQueId = 0;
ipcOutVpssPrm.numOutQue = 1;
ipcOutVpssPrm.outQueParams[0].nextLink = gVencModuleContext.ipcM3InId;
ipcOutVpssPrm.notifyNextLink = TRUE;
ipcOutVpssPrm.notifyPrevLink = TRUE;
ipcOutVpssPrm.noNotifyMode = FALSE;
/******************************set ipcInVideoPrm link param *******************************/
IpcLink_CreateParams_Init(&ipcInVideoPrm);
ipcInVideoPrm.inQueParams.prevLinkId = gVencModuleContext.ipcM3OutId;
ipcInVideoPrm.inQueParams.prevLinkQueId = 0;
ipcInVideoPrm.numOutQue = 1;
ipcInVideoPrm.outQueParams[0].nextLink = gVencModuleContext.encId;
ipcInVideoPrm.notifyNextLink = TRUE;
ipcInVideoPrm.notifyPrevLink = FALSE;
ipcInVideoPrm.noNotifyMode = TRUE;

printf("Config EncLink Params!!!\n");
/******************************set enc link param *******************************/
EncLink_CreateParams_Init(&encPrm);
Multich_SetEncParams(&encPrm);
encPrm.inQueParams.prevLinkId = gVencModuleContext.ipcM3InId;
encPrm.inQueParams.prevLinkQueId = 0;
encPrm.outQueParams.nextLink = gVencModuleContext.ipcBitsOutRTOSId;
/******************************set IpcBitsOutLinkRTOS link param *******************************/
IpcBitsOutLinkRTOS_CreateParams_Init(&ipcBitsOutVideoPrm);
ipcBitsOutVideoPrm.baseCreateParams.inQueParams.prevLinkId = gVencModuleContext.encId;
ipcBitsOutVideoPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
ipcBitsOutVideoPrm.baseCreateParams.numOutQue = 1;
ipcBitsOutVideoPrm.baseCreateParams.outQueParams[0].nextLink = gVencModuleContext.ipcBitsInHLOSId;
ipcBitsOutVideoPrm.baseCreateParams.notifyNextLink = FALSE;
ipcBitsOutVideoPrm.baseCreateParams.notifyPrevLink = TRUE;
ipcBitsOutVideoPrm.baseCreateParams.noNotifyMode = TRUE;

/******************************set IpcBitsInLinkHLOS link param *******************************/
IpcBitsInLinkHLOS_CreateParams_Init(&ipcBitsInHostPrm);
ipcBitsInHostPrm.baseCreateParams.inQueParams.prevLinkId = gVencModuleContext.ipcBitsOutRTOSId;
ipcBitsInHostPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
ipcBitsInHostPrm.baseCreateParams.numOutQue = 1;
ipcBitsInHostPrm.baseCreateParams.outQueParams[0].nextLink = SYSTEM_LINK_ID_INVALID;
ipcBitsInHostPrm.baseCreateParams.notifyNextLink = FALSE;
ipcBitsInHostPrm.baseCreateParams.notifyPrevLink = FALSE;
ipcBitsInHostPrm.baseCreateParams.noNotifyMode = TRUE;
/******************************Create Links from src to sink *******************************/
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));

System_linkCreate(gMultiCh_VdecVmosaicVencVObj.dupId, &dupPrm, sizeof(dupPrm));
for(i=0; i<NUM_SWMS_LINK; i++)
{
System_linkCreate(gMultiCh_VdecVmosaicVencVObj.swmsId[i],
&swMsPrm[i],
sizeof(swMsPrm[i])
);
}
System_linkCreate(gMultiCh_VdecVmosaicVencVObj.mergeId, &mergePrm, sizeof(mergePrm));
System_linkCreate(gMultiCh_VdecVmosaicVencVObj.nsfId, &nsfPrm, sizeof(nsfPrm));
Int32 res;
res = System_linkCreate(gVencModuleContext.ipcM3OutId, &ipcOutVpssPrm, sizeof(ipcOutVpssPrm));
if(res == 0)
printf("Create ipcM3Out success!!!\n");
res = System_linkCreate(gVencModuleContext.ipcM3InId, &ipcInVideoPrm, sizeof(ipcInVideoPrm));
if(res == 0)
printf("Create ipcM3In success!!!\n");
res = System_linkCreate(gVencModuleContext.encId, &encPrm, sizeof(encPrm));
if(res == 0)
printf("Create Enc success!!!\n");
res = System_linkCreate(gVencModuleContext.ipcBitsOutRTOSId, &ipcBitsOutVideoPrm, sizeof(ipcBitsOutVideoPrm));
if(res == 0)
printf("Create ipcBitsOutRTOS success!!!\n");
res = System_linkCreate(gVencModuleContext.ipcBitsInHLOSId, &ipcBitsInHostPrm, sizeof(ipcBitsInHostPrm));
if(res == 0)
printf("Create ipcBitsInHLOS success!!!\n");
MultiCh_memPrintHeapStatus();
}
//delete usecase
void MultiCh_deleteVdecVmosaicVenc()
{
int i;
Vdec_delete();
Venc_delete();
System_linkDelete(gMultiCh_VdecVmosaicVencVObj.dupId);
for(i=0; i<NUM_SWMS_LINK; i++)
System_linkDelete(gMultiCh_VdecVmosaicVencVObj.swmsId[i]);
System_linkDelete(gMultiCh_VdecVmosaicVencVObj.mergeId);
System_linkDelete(gMultiCh_VdecVmosaicVencVObj.nsfId);
/* Print slave processor load info */
MultiCh_prfLoadCalcEnable(FALSE, TRUE, FALSE);
}

 It could run but there is no data in the data flow. The dec link could not gets input data. The file read code is just the same as the dec_dis usecase. Could someone tell me why there is no data? Here is the log after invoking Vsys_printBufferStatistics() and Vsys_printDetailedStatistics() functions.

[m3video] 4826514: HDVICP-ID:0
[m3video] All percentage figures are based off totalElapsedTime
[m3video] totalAcquire2wait :0 %
[m3video] totalWait2Isr :75 %
[m3video] totalIsr2Done :0 %
[m3video] totalWait2Done :75 %
[m3video] totalDone2Release :0 %
[m3video] totalAcquire2Release :87 %
[m3video] totalAcq2acqDelay :12 %
[m3video] totalElapsedTime in msec : 24
[m3video] numAccessCnt: 24
[m3video] IVA-FPS : 0
[m3video] Average time spent per frame in microsec: 750
[m3video] 4826515: HDVICP-ID:1
[m3video] All percentage figures are based off totalElapsedTime
[m3video] totalAcquire2wait :0 %
[m3video] totalWait2Isr :0 %
[m3video] totalIsr2Done :0 %
[m3video] totalWait2Done :0 %
[m3video] totalDone2Release :0 %
[m3video] totalAcquire2Release :0 %
[m3video] totalAcq2acqDelay :0 %
[m3video] totalElapsedTime in msec : 0
[m3video] numAccessCnt: 0
[m3video] IVA-FPS : 0
[m3video] Average time spent per frame in microsec: 0
[m3video] 4826516: HDVICP-ID:2
[m3video] All percentage figures are based off totalElapsedTime
[m3video] totalAcquire2wait :0 %
[m3video] totalWait2Isr :0 %
[m3video] totalIsr2Done :0 %
[m3video] totalWait2Done :0 %
[m3video] totalDone2Release :0 %
[m3video] totalAcquire2Release :0 %
[m3video] totalAcq2acqDelay :0 %
[m3video] totalElapsedTime in msec : 0
[m3video] numAccessCnt: 0
[m3video] IVA-FPS : 0
[m3video] Average time spent per frame in microsec: 0
[m3video]
[m3video] *** ENCODE Statistics ***
[m3video]
[m3video] Elasped Time : 4826 secs
[m3video]
[m3video]
[m3video] CH | In Recv In Skip In User Out Latency
[m3video] Num | FPS FPS Skip FPS FPS Min / Max
[m3video] --------------------------------------------
[m3video] 0 | 0 0 0 0 0 / 0
[m3video] 1 | 0 0 0 0 0 / 0
[m3video] 2 | 0 0 0 0 0 / 0
[m3video] 3 | 0 0 0 0 0 / 0
[m3video] 4 | 0 0 0 0 0 / 0
[m3video] 5 | 0 0 0 0 0 / 0
[m3video]
[m3video] Multi Channel Encode Average Submit Batch Size
[m3video] Max Submit Batch Size : 24
[m3video] IVAHD_0 Average Batch Size : 0
[m3video] IVAHD_0 Max achieved Batch Size : 0
[m3video] IVAHD_1 Average Batch Size : 0
[m3video] IVAHD_1 Max achieved Batch Size : 0
[m3video] IVAHD_2 Average Batch Size : 0
[m3video] IVAHD_2 Max achieved Batch Size : 0
[m3video]
[m3video] Multi Channel Encode Batch break Stats
[m3video] Total Number of Batches created: 0
[m3video] All numbers are based off total number of Batches created
[m3video] Batch breaks due to batch sizeexceeding limit: 0 %
[m3video] Batch breaks due to ReqObj Que being empty: 0 %
[m3video] Batch breaks due to changed resolution class: 0 %
[m3video] Batch breaks due to interlace and progressivecontent mix: 0 %
[m3video] Batch breaks due to channel repeat: 0 %
[m3video] Batch breaks due to different codec: 0 %
[m3video] Total Number of Batches created: 0
[m3video] All numbers are based off total number of Batches created
[m3video] Batch breaks due to batch sizeexceeding limit: 0 %
[m3video] Batch breaks due to ReqObj Que being empty: 0 %
[m3video] Batch breaks due to changed resolution class: 0 %
[m3video] Batch breaks due to interlace and progressivecontent mix: 0 %
[m3video] Batch breaks due to channel repeat: 0 %
[m3video] Batch breaks due to different codec: 0 %
[m3video] Total Number of Batches created: 0
[m3video] All numbers are based off total number of Batches created
[m3video] Batch breaks due to batch sizeexceeding limit: 0 %
[m3video] Batch breaks due to ReqObj Que being empty: 0 %
[m3video] Batch breaks due to changed resolution class: 0 %
[m3video] Batch breaks due to interlace and progressivecontent mix: 0 %
[m3video] Batch breaks due to channel repeat: 0 %
[m3video] Batch breaks due to different codec: 0 %
[m3video]
[m3video] *** DECODE Statistics ***
[m3video]
[m3video] Elasped Time : 13 secs
[m3video]
[m3video]
[m3video] CH | In Recv In User Out
[m3video] Num | FPS Skip FPS FPS
[m3video] -----------------------------------
[m3video] 0 | 0 0 0
[m3video] 1 | 0 0 0
[m3video] 2 | 0 0 0
[m3video] 3 | 0 0 0
[m3video] 4 | 0 0 0
[m3video] 5 | 0 0 0
[m3video]
[m3video] Multi Channel Decode Average Submit Batch Size
[m3video] Max Submit Batch Size : 24
[m3video] IVAHD_0 Average Batch Size : 0
[m3video] IVAHD_0 Max achieved Batch Size : 0
[m3video] IVAHD_1 Average Batch Size : 0
[m3video] IVAHD_1 Max achieved Batch Size : 0
[m3video] IVAHD_2 Average Batch Size : 0
[m3video] IVAHD_2 Max achieved Batch Size : 0
[m3video]
[m3video] Multi Channel Decode Batch break Stats
[m3video] Total Number of Batches created: 0
[m3video] All numbers are based off total number of Batches created
[m3video] Batch breaks due to batch sizeexceeding limit: 0 %
[m3video] Batch breaks due to ReqObj Que being empty: 0 %
[m3video] Batch breaks due to changed resolution class: 0 %
[m3video] Batch breaks due to interlace and progressivecontent mix: 0 %
[m3video] Batch breaks due to channel repeat: 0 %
[m3video] Batch breaks due to different codec: 0 %
[m3video] Total Number of Batches created: 0
[m3video] All numbers are based off total number of Batches created
[m3video] Batch breaks due to batch sizeexceeding limit: 0 %
[m3video] Batch breaks due to ReqObj Que being empty: 0 %
[m3video] Batch breaks due to changed resolution class: 0 %
[m3video] Batch breaks due to interlace and progressivecontent mix: 0 %
[m3video] Batch breaks due to channel repeat: 0 %
[m3video] Batch breaks due to different codec: 0 %
[m3video] Total Number of Batches created: 0
[m3video] All numbers are based off total number of Batches created
[m3video] Batch breaks due to batch sizeexceeding limit: 0 %
[m3video] Batch breaks due to ReqObj Que being empty: 0 %
[m3video] Batch breaks due to changed resolution class: 0 %
[m3video] Batch breaks due to interlace and progressivecontent mix: 0 %
[m3video] Batch breaks due to channel repeat: 0 %
[m3video] Batch breaks due to different codec: 0 %
[m3video]
[m3vpss ]
[m3vpss ] 4828524: LOAD: CPU: 1.5% HWI: 0.3%, SWI:0.8%
[m3vpss ]
[m3vpss ] 4828524: LOAD: TSK: MISC : 0.4%
[m3vpss ]
[m3video]
[m3video] 4829025: LOAD: CPU: 2.8% HWI: 0.2%, SWI:0.5%
[m3video]
[m3video] 4829025: LOAD: TSK: IPC_IN_M30 : 0.1%
[m3video] 4829025: LOAD: TSK: IPC_BITS_IN0 : 0.1%
[m3video] 4829025: LOAD: TSK: ENC0 : 1.3%
[m3video] 4829025: LOAD: TSK: DEC0 : 0.3%
[m3video] 4829025: LOAD: TSK: DEC_PROCESS_TSK_0 : 413.4%
[m3video] 4829025: LOAD: TSK: DEC_PROCESS_TSK_1 : 440.4%
[m3video] 4829025: LOAD: TSK: DEC_PROCESS_TSK_2 : 326.5%
[m3video] 4829026: LOAD: TSK: MISC : -1180.0%
[m3video]
[c6xdsp ]
[c6xdsp ] 4827166: LOAD: CPU: 0.2% HWI: 0.0%, SWI:0.0%
[c6xdsp ]
[c6xdsp ] 4827166: LOAD: TSK: MISC : 0.2%
[c6xdsp ]

/******************************************************************/

IPCBITSOUTLINK:Buffer Statistics
Num Alloc Pools:6
PoolId | TotalBufCnt | FreeBufCnt | BufSize | AppAllocCount
0| 6| 0| 76800| 0
1| 6| 0| 76800| 0
2| 6| 0| 76800| 0
3| 6| 0| 76800| 0
4| 6| 0| 76800| 0
5| 6| 0| 76800| 0

VDEC:Buffer Statistics
ChId | InBufCnt | OutBufCnt
0| 6| 4
1| 6| 4
2| 6| 4
3| 6| 4
4| 6| 4
5| 6| 4
[m3video]
[m3video] *** Encode Statistics ***
[m3video] 246032: ENC: Rcvd from prev = 0, Returned to prev = 0
[m3video] ENC Out BitBuf Q Status
[m3video] Empty Q 0 -> count 24, wrPtr 24, rdPtr 0
[m3video] Full Q -> count 0, wrPtr 0, rdPtr 0

Thanks very much! Appreciate for your reply!

  • The issue is because application on A8 is not freeing the encoded bitstream buffers. You have to add a thread on A8 which does Venc_getBitstreamBuffer & Venc_releaseBitstreamBuffer

  • Hi Badri,

    Thanks for your reply!

    I use the VcapVenc_bitsWriteCreate function provided in demo_vcap_venc_vdis_bits_wr.c to write the encoded data into a file. In the VcapVenc_bitsWriteMain() function it invoked the Venc_getBitstreamBuffer & Venc_releaseBitstreamBuffer functions. The file write thread create and run successfully but the newDataAvailableCb of the enc could never be triggered. So the file write thread could not receive the sem signal. In addition, the file read thread also create and run successfully but it hung after the IpcBitsOutHLOS's buffers are filled. The dec link does not run actually. Do you think what's the matter?

  • The following is the buffer statistics added dec link. It shows that the dec link does not return the buffer to the pre link correctly.

    IPCBITSOUTLINK:Buffer Statistics
    Num Alloc Pools:6
    PoolId | TotalBufCnt | FreeBufCnt | BufSize | AppAllocCount
    0| 6| 0| 76800| 0
    1| 6| 0| 76800| 0
    2| 6| 0| 76800| 0
    3| 6| 0| 76800| 0
    4| 6| 0| 76800| 0
    5| 6| 0| 76800| 0

    VDEC:Buffer Statistics
    ChId | InBufCnt | OutBufCnt
    0| 6| 6
    1| 6| 6
    2| 6| 6
    3| 6| 6
    4| 6| 6
    5| 6| 6
    [m3video]
    [m3video] *** Decode Statistics ***
    [m3video] 49746: DEC: Rcvd from prev = 72, Returned to prev = 36
    [m3video] DEC Out BufExt Q Status
    [m3video] Empty Q 0 -> count 0, wrPtr 6, rdPtr 6
    [m3video] Empty Q 1 -> count 0, wrPtr 6, rdPtr 6
    [m3video] Empty Q 2 -> count 0, wrPtr 6, rdPtr 6
    [m3video] Empty Q 3 -> count 0, wrPtr 6, rdPtr 6
    [m3video] Empty Q 4 -> count 0, wrPtr 6, rdPtr 6
    [m3video] Empty Q 5 -> count 0, wrPtr 6, rdPtr 6
    [m3video] Full Q -> count 0, wrPtr 36, rdPtr 36
    [m3video]
    [m3video] *** Encode Statistics ***
    [m3video] 50246: ENC: Rcvd from prev = 0, Returned to prev = 0
    [m3video] ENC Out BitBuf Q Status
    [m3video] Empty Q 0 -> count 36, wrPtr 36, rdPtr 0
    [m3video] Full Q -> count 0, wrPtr 0, rdPtr 0

  • - Are you doing System_linkStart for nsfId ?

    - Have you made the change to set swmsPrm.enableOutputDup = FALSE

     

    Pls print buffer statistics for nsf and swms also and share the log

  • Hi Badri,

    Are you doing System_linkStart for nsfId ?

    I forget to invoke System_linkStart for nsflink. What about other links as dup and merge? Should I doing System_linkStart for them too?

    Have you made the change to set swmsPrm.enableOutputDup = FALSE

    Yes, I set the swmsPrm as follows:

    swMsPrm[i].outputBufModified = FALSE;
    swMsPrm[i].enableProcessTieWithDisplay = FALSE;
    swMsPrm[i].lineSkipMode = FALSE;
    swMsPrm[i].enableLayoutGridDraw = FALSE;

    I will add the buffer statistics for nsf and swms.


  • Hi Badri,

    I add System_linkStart for swms and now the app runs successfully. I will check the output file to see if the data flow is correct.

    In addition, the problem about num of scalar instances still exist. Does the  swMsPrm.swMsInstId must be set? If the swms does not do scalar, could I set the swMsPrm.numSwMsInst  = 1?

  • Hi Badri,

    Thanks so much!

    I am glad to say now the demo runs correctly. I forget to set callback function for the IpcBitsInHLOS. I want to expand this demo, use RTP to send and receive video streams. I intend to use jrtplib to do the rtp transmission. I transplant it onto the EVM8168 board and do send and receive test already. 

    To bring in the rtp send and receive, I need to include the header file of the jrtplib in the demo and add the lib path and inc path and build options to the makefile. Could you tell me how to do this? In another word, I need to add "-I/usr/local/include/jrtplib3 -L/usr/local/lib  -I/usr/local/include -ljrtp -ljthread -lpthread" to the makefile.