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.

DM8107 encode 4x1080p30 H264 and MJPEG

Other Parts Discussed in Thread: DM8107

hello,
I am currently working on DVR RDK 4.1 and my target is a DM8107 (CPU 1GHz and 450MHz to HDVICP).
I want to know if it is possible to encode 2x1080p30 H264 and MJPEG 2x1080p30?
I currently manage to make a use case which is 2x1080p30 H264 or MJPEG 2x1080p30 but impossible to make a use case that encodes 4 channels simultaneously.
I do not know if this is due to a problem of resources (I only have 512MB of RAM) or is this a problem for my use case.
I capture two sources VIP0 and VIP1. I duplicate each lane (to obtain 4 lane) and then I sent to a merge.

CAPT (2x1080p30) -> DUP1-> Merge-> DEI-> NSF-> ENC-> ARM (file)
                                    -> Dup2->

The 2 lane in MJPEG are only use to make snapshot JPEG of the 2 inputs streams.

If I reduced the frequency of both channels (10Hz) MJPEG, can it permetre me to run this use case ? 

Thank you!

Regards

  • Pls attach your usecase file where you are creating and connecting links and the console logs from start of application.

    Why are you doing dei for 4 channels.Do you want to scale each encode channel independently.DEI cant scale 4 ch 1080P in real time

  • Hi Badri,

    I attach my usecase.c and a graph of my use case.

    /*****************************/
    
    #define ENABLE_FAKE_HD_MODE
    
    #define NUM_CAPTURE_DEVICES        	(2)
    #define NB_SNAP_CHANNEL 			(2)
    
    #define TILER_ENABLE    FALSE //FALSE
    
    /*IVA HD MAP Table*/
    static SystemVideo_Ivahd2ChMap_Tbl _systemVid_encDecIvaChMapTbl =
    {
        .isPopulated = 1,
        .ivaMap[0] =
        {
            .EncNumCh  = 1,
            .EncChList = {0, 1, 2, 3, 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},
        },
    };
    
    int _nbChannelEncode = 0;
    
    UInt32 _captureId;
    UInt32 _encId;
    UInt32 _mergeId;
    UInt32 _deiId;
    UInt32 _nsfId;
    UInt32 _dup1Id;
    UInt32 _dup2Id;
    
    UInt32 _ipcBitsOutVpssId, _ipcBitsInVideoId;
    UInt32 _ipcBitsOutVideoId, _ipcBitsInHostId;
    
    VCAP_DEVICE_CREATE_PARAM_S _vidDecVideoModeArgs[NUM_CAPTURE_DEVICES];
    
    void capture_encode_set_dei_prm(DeiLink_CreateParams *deiPrm, UInt32 outWidth, UInt32 outHeight, UInt32 inputFramerate, UInt32 deiOutId)
    {
        UInt32 i, outId, chId;
        //UInt32 outIdList[] = { DEI_LINK_OUT_QUE_DEI_SC/*, DEI_LINK_OUT_QUE_VIP_SC */};
    
        deiPrm->comprEnable                 = FALSE;
        deiPrm->setVipScYuv422Format        = FALSE;
        deiPrm->inputDeiFrameRate           = inputFramerate;
        deiPrm->outputDeiFrameRate          = inputFramerate;
        deiPrm->enableDeiForceBypass        = TRUE;
        deiPrm->enableForceInterlacedInput  = FALSE;
        deiPrm->enableLineSkipSc            = FALSE;
        deiPrm->enableDualVipOut            = FALSE;
        deiPrm->enableInputFrameRateUpscale = FALSE;
    
        //for(i=0; i<OSA_ARRAYSIZE(outIdList); i++)
        //{
            //outId = outIdList[i];
            outId = deiOutId;
    
            deiPrm->enableOut[outId] = TRUE;
    
            deiPrm->tilerEnable[outId] = TILER_ENABLE;
            for(chId=0; chId< DEI_LINK_MAX_CH; chId++)
            {
                deiPrm->outScaleFactor[outId][chId].scaleMode = DEI_SCALE_MODE_ABSOLUTE;
                deiPrm->outScaleFactor[outId][chId].absoluteResolution.outWidth = outWidth;
                deiPrm->outScaleFactor[outId][chId].absoluteResolution.outHeight = outHeight;
                
            }
    
            deiPrm->inputFrameRate[outId]   = inputFramerate;
            deiPrm->outputFrameRate[outId]  = inputFramerate;
    
            deiPrm->numBufsPerCh[outId]     = 6;
            deiPrm->generateBlankOut[outId] = FALSE;
        //}
    }
    
    void capture_encode_set_nsf_prm(NsfLink_CreateParams * nsfPrm, UInt32 numBufPerCh, UInt32 inputFramerate,UInt32 outputFramerate)
    {
        nsfPrm->numOutQue    = 1;
        nsfPrm->bypassNsf    = TRUE;
        nsfPrm->tilerEnable  = TILER_ENABLE; 
        nsfPrm->numBufsPerCh = numBufPerCh;
        nsfPrm->inputFrameRate = inputFramerate;
        nsfPrm->outputFrameRate = outputFramerate;
    }
    
    Void capture_set_capture_prm(CaptureLink_CreateParams *capturePrm,Config_struct *Pt_Conf, int8_t nbChannel)
    {
        CaptureLink_VipInstParams         *pCaptureInstPrm;
        CaptureLink_OutParams             *pCaptureOutPrm;
        UInt32 vipInstId;
    
        capturePrm->isPalMode                   = TRUE;
        capturePrm->numVipInst                  = nbChannel;
        capturePrm->tilerEnable                 = TILER_ENABLE;
    #ifdef ENABLE_FAKE_HD_MODE
        capturePrm->fakeHdMode                  = TRUE;
    #else
        capturePrm->fakeHdMode                  = FALSE;
    #endif
        capturePrm->enableSdCrop                = FALSE;
        capturePrm->doCropInCapture             = FALSE;
        capturePrm->numBufsPerCh                = 6;
        capturePrm->numExtraBufs                = 0;
        capturePrm->maxBlindAreasPerCh          = 0;
        capturePrm->overrideNumBufsInInstPrms   = 0;
    
        for(vipInstId=0; vipInstId<capturePrm->numVipInst; vipInstId++)
        {
            pCaptureInstPrm                     = &capturePrm->vipInst[vipInstId];
            if( vipInstId == 0 )
                pCaptureInstPrm->vipInstId          = SYSTEM_CAPTURE_INST_VIP0_PORTA;
            else
                pCaptureInstPrm->vipInstId          = SYSTEM_CAPTURE_INST_VIP1_PORTA;
                
            pCaptureInstPrm->videoDecoderId     = SYSTEM_DEVICE_VID_DEC_TVP5158_DRV;
            pCaptureInstPrm->standard           = VSYS_STD_PAL;
            pCaptureInstPrm->inDataFormat       = SYSTEM_DF_YUV422P;
            pCaptureInstPrm->numOutput          = 1;
    
            pCaptureInstPrm->inDataFormat       = SYSTEM_DF_YUV422P;
            pCaptureInstPrm->videoIfMode        = SYSTEM_CAPT_VIDEO_IF_MODE_8BIT;
            //pCaptureInstPrm->inScanFormat       = SYSTEM_SF_INTERLACED;
            pCaptureInstPrm->videoCaptureMode   = SYSTEM_CAPT_VIDEO_CAPTURE_MODE_SINGLE_CH_NON_MUX_EMBEDDED_SYNC;
    
            pCaptureOutPrm                      = &pCaptureInstPrm->outParams[0]; 
            pCaptureOutPrm->dataFormat          = SYSTEM_DF_YUV420SP_UV; //SYSTEM_DF_YUV422I_YUYV;
    		pCaptureOutPrm->scEnable            = FALSE;
    		pCaptureOutPrm->scOutWidth          = 0;
    		pCaptureOutPrm->scOutHeight         = 0;
    
            pCaptureOutPrm->outQueId            = 0;
        }
    }
    void capture_configure_extvideodecoder_prm(Config_struct *Pt_Conf, int8_t nbChannel)
    {
        int i;
        Int32 status = 0;
        uint32_t numCaptureDevices = nbChannel;
        
        for(i = 0; i < numCaptureDevices; i++)
        {
            if( i == 0 )
                _vidDecVideoModeArgs[i].vipInstId        = SYSTEM_CAPTURE_INST_VIP0_PORTA; /* capture on VIP 0 */
            else
                _vidDecVideoModeArgs[i].vipInstId        = SYSTEM_CAPTURE_INST_VIP1_PORTA; /* capture on VIP 1 */
            _vidDecVideoModeArgs[i].deviceId         = DEVICE_VID_DEC_TVP5158_DRV;
            _vidDecVideoModeArgs[i].numChInDevice    = 1; //4
    
            _vidDecVideoModeArgs[i].modeParams.videoIfMode        = DEVICE_CAPT_VIDEO_IF_MODE_8BIT;
            _vidDecVideoModeArgs[i].modeParams.videoDataFormat    = SYSTEM_DF_YUV422P;
            _vidDecVideoModeArgs[i].modeParams.standard           = VSYS_STD_PAL;
            _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;
        }
        status = Vcap_deviceCreate(_vidDecVideoModeArgs, numCaptureDevices);
        printf("LOG :  create tv5158 status = 0x%X\n",status);
    }
    
    void capture_encode_create(Config_struct *Pt_Conf)
    {
        CaptureLink_CreateParams    capturePrm;
        DeiLink_CreateParams        deiPrm;
        NsfLink_CreateParams        nsfPrm;
        MergeLink_CreateParams      mergePrm;
    
        IpcLink_CreateParams        ipcOutVpssPrm;
        IpcLink_CreateParams        ipcInVideoPrm;
    
        EncLink_CreateParams        encPrm;  
        DupLink_CreateParams        dup1Prm;   
        DupLink_CreateParams        dup2Prm;   
        
        IpcBitsOutLinkRTOS_CreateParams   ipcBitsOutVideoPrm;
        IpcBitsInLinkHLOS_CreateParams    ipcBitsInHostPrm;
    
        CaptureLink_VipInstParams *pCaptureInstPrm = NULL;
        CaptureLink_OutParams     *pCaptureOutPrm = NULL;
        
        UInt32 vipInstId;
        UInt32 i/*, status*/;
    
        printf("LOG :  capture_encode_start\n");
        _captureId            = SYSTEM_LINK_ID_CAPTURE;
        _deiId                = SYSTEM_LINK_ID_DEI_HQ_0;
        _nsfId                = SYSTEM_LINK_ID_NSF_0;
        _mergeId              = SYSTEM_VPSS_LINK_ID_MERGE_0;
        _encId                = SYSTEM_LINK_ID_VENC_0;   
        _dup1Id               = SYSTEM_VPSS_LINK_ID_DUP_0;
        _dup2Id               = SYSTEM_VPSS_LINK_ID_DUP_1;
        
        _ipcBitsOutVpssId     = SYSTEM_VPSS_LINK_ID_IPC_OUT_M3_0;
        _ipcBitsInVideoId     = SYSTEM_VIDEO_LINK_ID_IPC_IN_M3_0;
        
        _ipcBitsOutVideoId    = SYSTEM_VIDEO_LINK_ID_IPC_BITS_OUT_0;
        _ipcBitsInHostId      = SYSTEM_HOST_LINK_ID_IPC_BITS_IN_0;
    
        System_linkControl(
            SYSTEM_LINK_ID_M3VPSS,
            SYSTEM_M3VPSS_CMD_RESET_VIDEO_DEVICES,
            NULL,
            0,
            TRUE
        );
    	_nbChannelEncode = 2;
        _systemVid_encDecIvaChMapTbl.ivaMap[0].EncNumCh = _nbChannelEncode + NB_SNAP_CHANNEL;
    	
        System_linkControl(
            SYSTEM_LINK_ID_M3VIDEO,
            SYSTEM_COMMON_CMD_SET_CH2IVAHD_MAP_TBL,
            &_systemVid_encDecIvaChMapTbl,
            sizeof(SystemVideo_Ivahd2ChMap_Tbl),
            TRUE
        );
        
        CHAINS_INIT_STRUCT(CaptureLink_CreateParams, capturePrm);
        CHAINS_INIT_STRUCT(IpcLink_CreateParams, ipcOutVpssPrm);
        CHAINS_INIT_STRUCT(IpcLink_CreateParams, ipcInVideoPrm);
        CHAINS_INIT_STRUCT(EncLink_CreateParams, encPrm);
        CHAINS_INIT_STRUCT(IpcBitsOutLinkRTOS_CreateParams, ipcBitsOutVideoPrm);
        CHAINS_INIT_STRUCT(IpcBitsInLinkHLOS_CreateParams, ipcBitsInHostPrm);
        DeiLink_CreateParams_Init(&deiPrm);
        NsfLink_CreateParams_Init(&nsfPrm);
        
    /** CAPTURE */    
        capture_configure_extvideodecoder_prm(Pt_Conf,_nbChannelEncode);
        capturePrm.outQueParams[0].nextLink = _dup1Id ;
        capturePrm.outQueParams[1].nextLink = _dup2Id;    
        capture_set_capture_prm(&capturePrm,Pt_Conf,_nbChannelEncode);
          
    /** DUPLICATE */
        dup1Prm.inQueParams.prevLinkId  = _captureId;
        dup1Prm.inQueParams.prevLinkQueId   = 0;
        dup1Prm.numOutQue                   = 2;
        dup1Prm.notifyNextLink              = TRUE;
        dup1Prm.outQueParams[0].nextLink        = _mergeId;
    
        dup2Prm.inQueParams.prevLinkId  = _captureId;
        dup2Prm.inQueParams.prevLinkQueId   = 1;
        dup2Prm.numOutQue                   = 2;
        dup2Prm.notifyNextLink              = TRUE;
        dup2Prm.outQueParams[0].nextLink        = _mergeId;
         
    /** MERGE */    
        mergePrm.numInQue = _nbChannelEncode + NB_SNAP_CHANNEL; 
        mergePrm.inQueParams[0].prevLinkId       = _dup1Id;  
        mergePrm.inQueParams[0].prevLinkQueId    = 0;
              
    	mergePrm.inQueParams[2].prevLinkId       = _dup1Id;
    	mergePrm.inQueParams[2].prevLinkQueId    = 1;
    	
    	mergePrm.inQueParams[1].prevLinkId       = _dup2Id;
    	mergePrm.inQueParams[1].prevLinkQueId    = 0;
    	mergePrm.inQueParams[3].prevLinkId       = _dup2Id;
    	mergePrm.inQueParams[3].prevLinkQueId    = 1;   
         
        mergePrm.notifyNextLink             = TRUE;
        mergePrm.outQueParams.nextLink  	= _deiId;
    /** DEI */    
        capture_encode_set_dei_prm(&deiPrm, 1920, 1080,Pt_Conf->framerate[0], DEI_LINK_OUT_QUE_DEI_SC );
        deiPrm.inQueParams.prevLinkId    = _mergeId;
        deiPrm.inQueParams.prevLinkQueId = 0;
        deiPrm.outQueParams[DEI_LINK_OUT_QUE_DEI_SC].nextLink = _nsfId;
    /** NSF */    
        capture_encode_set_nsf_prm(&nsfPrm, 3, Pt_Conf->framerate[0],Pt_Conf->framerate[0]);
        nsfPrm.inQueParams.prevLinkId    = _deiId;
        nsfPrm.inQueParams.prevLinkQueId = 0;
        nsfPrm.outQueParams[0].nextLink  = _ipcBitsOutVpssId;
    /**IPC OUT VPSS */
        ipcOutVpssPrm.inQueParams.prevLinkId    = _nsfId;
        ipcOutVpssPrm.inQueParams.prevLinkQueId = 0;
        ipcOutVpssPrm.numOutQue                 = 1;
        ipcOutVpssPrm.notifyNextLink            = TRUE;
        ipcOutVpssPrm.notifyPrevLink            = TRUE;
        ipcOutVpssPrm.noNotifyMode              = FALSE;
        //ipcOutVpssPrm.notifyProcessLink         = FALSE;
        ipcOutVpssPrm.outQueParams[0].nextLink  = _ipcBitsInVideoId;
        ipcOutVpssPrm.numChPerOutQue[0]  = _nbChannelEncode + NB_SNAP_CHANNEL; 
        
    /** IPC IN HVICP */
        printf("LOG :  ipcBitsOutVpss to ipcBitsInVideo\n");
        ipcInVideoPrm.inQueParams.prevLinkId    = _ipcBitsOutVpssId;
        ipcInVideoPrm.inQueParams.prevLinkQueId = 0;
        ipcInVideoPrm.numOutQue                 = 1;
        ipcInVideoPrm.notifyNextLink            = TRUE;
        ipcInVideoPrm.notifyPrevLink            = TRUE;
        ipcInVideoPrm.noNotifyMode              = FALSE; 
        ipcInVideoPrm.outQueParams[0].nextLink  = _encId;
        ipcInVideoPrm.numChPerOutQue[0]  = _nbChannelEncode + NB_SNAP_CHANNEL; 
        
    /** ENC HVICP */
        printf("LOG :  ipcBitsInVideo to Encoder\n");
        EncLink_ChCreateParams *pLinkChPrm = NULL;
        EncLink_ChDynamicParams *pLinkDynPrm  = NULL;
        
        encPrm.inQueParams.prevLinkId   = _ipcBitsInVideoId;
        encPrm.inQueParams.prevLinkQueId= 0;
        encPrm.outQueParams.nextLink = _ipcBitsOutVideoId;
        
        for( i = 0 ; i < _nbChannelEncode + NB_SNAP_CHANNEL ; i++ )
        {
            pLinkChPrm  = &encPrm.chCreateParams[i];
            pLinkDynPrm = &pLinkChPrm->defaultDynamicParams;
            printf("LOG :  Configure Encoder %d\n",i);
            encPrm.numBufPerCh[i] = 6;
            if( i < _nbChannelEncode ) /* ch id 0 and 1 in H264 */
            {    
                if( Pt_Conf->codec == VCODEC_TYPE_H264 )
                {
                    pLinkChPrm->format                  = IVIDEO_H264HP;
                    pLinkChPrm->profile                 = IH264_HIGH_PROFILE;
                    pLinkChPrm->enableAnalyticinfo      = 1;
                    pLinkChPrm->enableWaterMarking      = 1;
                    pLinkChPrm->maxBitRate              = 4000 * 1000 ;
                    pLinkChPrm->encodingPreset          = VENC_XDM_DEFAULT;
                    pLinkChPrm->rateControlPreset       = VENC_RATE_CTRL_VBR; //IVIDEO_STORAGE
                    pLinkChPrm->enableHighSpeed         = FALSE; /* enable only if encodingPreset is set to VENC_XDM_USER_DEFINED*/
                    pLinkChPrm->overrideInputScanFormat = FALSE; 
                    pLinkChPrm->fieldPicEncode = FALSE; 
    
                    pLinkDynPrm->intraFrameInterval     = 25;
                    pLinkDynPrm->targetBitRate          = 4000 * 1000 ;
                    pLinkDynPrm->interFrameInterval     = 1;
                    pLinkDynPrm->mvAccuracy             = IVIDENC2_MOTIONVECTOR_QUARTERPEL;
                    pLinkDynPrm->rcAlg                  = 0;//VENC_RATE_CTRL_VBR;
                    pLinkDynPrm->qpMin                  = 10;
                    pLinkDynPrm->qpMax                  = 40;
                    pLinkDynPrm->qpInit                 = -1;
                    pLinkDynPrm->vbrDuration            = 8;
                    pLinkDynPrm->vbrSensitivity         = 0;
    				pLinkChPrm->fieldMergeEncodeEnable = FALSE;
                    pLinkChPrm->dataLayout = VCODEC_FIELD_SEPARATED; /*IVIDEO_PROGRESSIVE;*/
    #if 0
                    switch(Pt_Conf->res[i])
                    {
                        case VSYS_STD_NTSC:
                        case VSYS_STD_PAL:
                        case VSYS_STD_480I:
                        case VSYS_STD_576I:
                        case VSYS_STD_CIF:
                        case VSYS_STD_HALF_D1:
                        case VSYS_STD_D1:
                        case VSYS_STD_1080I_60:
                        case VSYS_STD_1080I_50:
                            //pLinkChPrm->fieldMergeEncodeEnable = TRUE;
                            pLinkChPrm->fieldMergeEncodeEnable = FALSE;
                            pLinkChPrm->dataLayout = IVIDEO_FIELD_INTERLEAVED; /*IVIDEO_INTERLACED;*/
                            break;
                        case VSYS_STD_480P:
                        case VSYS_STD_576P:
                        case VSYS_STD_720P_60:
                        case VSYS_STD_720P_50:
                        case VSYS_STD_1080P_60:
                        case VSYS_STD_1080P_50:
                        case VSYS_STD_1080P_24:
                        case VSYS_STD_1080P_30:
                        default:
                            pLinkChPrm->fieldMergeEncodeEnable = FALSE;
                            pLinkChPrm->dataLayout = VCODEC_FIELD_SEPARATED; /*IVIDEO_PROGRESSIVE;*/
                            break;
                    }
    #endif					
                }
            }
            else /* ch id 2 and 3 in MJPEG */
            {
                pLinkChPrm->format                 = IVIDEO_MJPEG;
                pLinkChPrm->profile                = 0;
                pLinkChPrm->dataLayout             = VCODEC_FIELD_SEPARATED;
                pLinkChPrm->fieldMergeEncodeEnable = FALSE;
                pLinkChPrm->enableAnalyticinfo     = 0;
                pLinkChPrm->enableWaterMarking     = 0;
                pLinkChPrm->maxBitRate             = 0 ;
                pLinkChPrm->encodingPreset         = 0;
                pLinkChPrm->rateControlPreset      = 0;
                pLinkChPrm->enableSVCExtensionFlag = 0;
                pLinkChPrm->numTemporalLayer       = 0;
    
                pLinkDynPrm->intraFrameInterval    = 0;
                pLinkDynPrm->targetBitRate         = 10000 * 1000 * 10;
                pLinkDynPrm->interFrameInterval    = 0;
                pLinkDynPrm->mvAccuracy            = 0;
                pLinkDynPrm->inputFrameRate        = 25 ;
                pLinkDynPrm->qpMin                 = 0;
                pLinkDynPrm->qpMax                 = 0;
                pLinkDynPrm->qpInit                = 97 ; 
                pLinkDynPrm->vbrDuration           = 0;
                pLinkDynPrm->vbrSensitivity        = 0;
            }
        }
    /** IPC OUT HDVICP */
        printf("LOG :  Encoder to ipcBitsOutVideo\n");
        ipcBitsOutVideoPrm.baseCreateParams.inQueParams.prevLinkId = _encId;
        ipcBitsOutVideoPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
        ipcBitsOutVideoPrm.baseCreateParams.numOutQue                 = 1;
        ipcBitsOutVideoPrm.baseCreateParams.outQueParams[0].nextLink = _ipcBitsInHostId;
        ipcBitsOutVideoPrm.baseCreateParams.numChPerOutQue[0]  = _nbChannelEncode + NB_SNAP_CHANNEL; 
        capture_encode_ipcBitsInitCreateParams_BitsOutRTOS(&ipcBitsOutVideoPrm, TRUE);
    /** IPC IN ARM */
        ipcBitsInHostPrm.baseCreateParams.inQueParams.prevLinkId = _ipcBitsOutVideoId;
        ipcBitsInHostPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
        ipcBitsInHostPrm.baseCreateParams.numOutQue                 = 1;
        ipcBitsInHostPrm.baseCreateParams.outQueParams[0].nextLink   = SYSTEM_LINK_ID_INVALID;
        ipcBitsInHostPrm.baseCreateParams.numChPerOutQue[0]  = 0;
        capture_encode_ipcBitsInitCreateParams_BitsInHLOS(&ipcBitsInHostPrm);
    
        printf("LOG :  System_linkCreate _captureId\n");
        System_linkCreate(_captureId, &capturePrm, sizeof(capturePrm));
        printf("LOG :  System_linkCreate _dup1Id\n");
        System_linkCreate(_dup1Id, &dup1Prm, sizeof(dup1Prm));    
        System_linkCreate(_dup2Id, &dup2Prm, sizeof(dup2Prm));  
        printf("LOG :  System_linkCreate _mergeId\n");
        System_linkCreate(_mergeId, &mergePrm, sizeof(mergePrm));
        printf("LOG :  System_linkCreate _deiId\n");
        System_linkCreate(_deiId, &deiPrm, sizeof(DeiLink_CreateParams));
        printf("LOG :  System_linkCreate _nsfId \n");
        System_linkCreate(_nsfId,&nsfPrm, sizeof(NsfLink_CreateParams));
        printf("LOG :  System_linkCreate _ipcBitsOutVpssId\n");
        System_linkCreate(_ipcBitsOutVpssId, &ipcOutVpssPrm, sizeof(ipcOutVpssPrm));
        printf("LOG :  System_linkCreate _ipcBitsInVideoId\n");
        System_linkCreate(_ipcBitsInVideoId, &ipcInVideoPrm, sizeof(ipcInVideoPrm));
        printf("LOG :  System_linkCreate _encId\n");
        System_linkCreate(_encId, &encPrm, sizeof(encPrm));
        printf("LOG :  System_linkCreate _ipcBitsOutVideoId\n");
        System_linkCreate(_ipcBitsOutVideoId, &ipcBitsOutVideoPrm, sizeof(ipcBitsOutVideoPrm));
        printf("LOG :  System_linkCreate _ipcBitsInHostId\n");
        System_linkCreate(_ipcBitsInHostId, &ipcBitsInHostPrm, sizeof(ipcBitsInHostPrm));
      
    	capture_encode_start(Pt_Conf);
    }
    
    void capture_encode_start(Config_struct *Pt_Conf)
    {
        printf("LOG :  System_linkStart _ipcBitsInHostId\n");
        System_linkStart(_ipcBitsInHostId);
        printf("LOG :  System_linkStart _ipcBitsOutVideoId\n");
        System_linkStart(_ipcBitsOutVideoId);
        printf("LOG :  System_linkStart _encId\n");
        System_linkStart(_encId);
        printf("LOG :  System_linkStart _ipcBitsInVideoId\n");
        System_linkStart(_ipcBitsInVideoId);
        printf("LOG :  System_linkStart _ipcBitsOutVpssId\n");
        System_linkStart(_ipcBitsOutVpssId);
        printf("LOG :  System_linkStart _nsfId\n");
        System_linkStart(_nsfId);
        printf("LOG :  System_linkStart _deiId\n");
        System_linkStart(_deiId);
        printf("LOG :  System_linkStart _mergeId\n");
        System_linkStart(_mergeId);  
        printf("LOG :  System_linkStart _dup1Id\n");
        System_linkStart(_dup1Id);     
        System_linkStart(_dup2Id);    
        printf("LOG :  System_linkStart _captureId\n");
        System_linkStart(_captureId);
        Vcap_deviceStart();
    }
    
    void capture_encode_stop(Config_struct *Pt_Conf)
    {
        Vcap_deviceStop();
        printf("LOG :  capture_encode_stop\n");
        System_linkStop(_captureId);
        System_linkStop(_nsfId);
        System_linkStop(_deiId); 
        System_linkStop(_mergeId);   
        System_linkStop(_dup1Id);   
        System_linkStop(_dup2Id);  
        System_linkStop(_ipcBitsOutVpssId);
        System_linkStop(_ipcBitsInVideoId);
        System_linkStop(_encId);
        System_linkStop(_ipcBitsOutVideoId);
        System_linkStop(_ipcBitsInHostId);
    	
        System_linkDelete(_captureId);
        System_linkDelete(_nsfId);
        System_linkDelete(_deiId);        
        System_linkDelete(_mergeId); 
        System_linkDelete(_dup1Id);    
        System_linkDelete(_dup2Id); 
        System_linkDelete(_ipcBitsOutVpssId);
        System_linkDelete(_ipcBitsInVideoId);
        System_linkDelete(_encId);
        System_linkDelete(_ipcBitsOutVideoId);
        System_linkDelete(_ipcBitsInHostId);
    }
    
    

    I reality, I work whith DM8107 DVR RDK from UDWORKS because I prepare functions for my futur custom board which is equiped with a DM8107.

    I capture 2 D1, and I use the fakeHD mode to simulate HD video.

    I use the DEI to transform stream interlaced in progressif at the input of the encoder.

    I don't have the log output today, but I have message "[m3vpss ] 13452: SYSTEM: Opening MsgQ [DSP_MSGQ]..." and finally I got an assertion in ipclink.

    Can you see if there is a problem in my usecase ? Is it possible to do it (4x1080p30) ?

    thank

  • Ok, I have read the doc HDVPSS_FeaturePerformanceGuide.pdf.
    My use case is impossible !
    The max performance of DEI and NSF is 130MP/s.
    I can only pas two 1080p30 (1920x1080x30*2 = 124,4MP/s).

    I have use DEI and NSF because I have now an HW configuration which not permit me to capture 2 videos in 1080p30.

    But whit my future custom board, I will can capture 2 1080p30. In theory, I will not need DEI and NSF.
    In this case, do you think I can do : CAPT (420SP x2) -> DUP(x2) -> MERGE -> ENC (2xH264 and 2xMJPEG) directly ?

    I have a constraint on taking snapshot, I should be able to take an image every 300ms.

    If is not possible, have you an idea for doing snapshots of the two lane which are encoding in H264 ?
    A - Is it possible to use ENC_LINK_CMD_SET_CODEC_SNAPSHOT to do snapshot when encoder is configured in H264 ?
    B - I think, I also can do it with a select link and with the dynamic command ENC_LINK_CMD_SWITCH_CODEC_CHANNEL of enclink but what are the performance of the command ENC_LINK_CMD_SWITCH_CODEC_CHANNEL (delay for switch between H264<->MJPEG) ?

    What do you think about this 2 ideas ?

    Regards

  • The issue with your usecase is dupLink after capture link has prevLinkId as 1 but all capture channels are output only on que 0. 

    Regarding performance 2 ch 1080p30 is possible .I think 6 fps additonal mjpeg will be possible as there is some margin.If you face performance issue we can check other options.

    You can implement capture encode Usecase without nsf and dei as you mentioned.For usecase development on uddvr do dup after dei.You dont need nsf.Set dei output format as yuv420sp and select vipsc outque

  • Hi Badri,

    Thank for the response.

    Can you confirm I have well understood that you said about my use case on dvr (a drawing is better than a long speech I think !):

    I can't test it today, but tomorrow I come back to you for the result of the test.

    thank again

  • Yes your new data flow is exactly whatI meant.Do you require snapshot at periodic interval or is it based on user action.Can you set your h264 IDR interval to 300ms.The IDR could be used as snapshot.

  • The snapshot is a user (external CPU) action which send a command to do it (it's asynchronous).

    Your suggestion it's a good idea, but if I set set IDR interval to 300ms, it does not meet my need of asynchronous snapshot.

    But, in the same kind of idea, I could use the dynamic command ENC_LINK_CMD_SET_CODEC_FORCEI to force the insertion of an IDR frame. Is true ?

    The problem is, I think, that the quality of the IDR is directly linked with the encoder configuartion. If the bitrate is low the quality of the IDR picture is low too.

    There is a lot of chance that the quality is less(for a bitrate at 4Mbit/s)  than a jpeg with qpInit at 97.

    I will test this solution to see.

    If the quality of the IDR is good, what software can you view these images ? The IDR pictures are like uncompress (raw) pictures ?

    thanks

  • Hi Badri, I am testing the usecase and I have problem. See log attach.

     0: SYSTEM: System Common Init in progress !!!
     1: SYSTEM: IPC init in progress !!!
     12: SYSTEM: CPU [DSP] is NOT available on this platform !!!
     12: SYSTEM: CPU [VIDEO-M3] syslink proc ID is [0] !!!
     12: SYSTEM: CPU [VPSS-M3] syslink proc ID is [1] !!!
     12: SYSTEM: CPU [HOST] syslink proc ID is [2] !!!
     12: SYSTEM: Creating MsgQ Heap [IPC_MSGQ_MSG_HEAP_3] ...
     14: SYSTEM: Creating MsgQ [HOST_MSGQ] ...
     15: SYSTEM: Creating MsgQ [HOST_ACK_MSGQ] ...
     16: SYSTEM: Opening MsgQ [VIDEO-M3_MSGQ] ...
     16: SYSTEM: Opening MsgQ [VPSS-M3_MSGQ] ...
     17: SYSTEM: Notify register to [VIDEO-M3] line 0, event 15 ...
     18: SYSTEM: Notify register to [VPSS-M3] line 0, event 15 ...
     18: SYSTEM: IPC init DONE !!!
     19: SYSTEM: Creating ListMP [HOST_IPC_OUT_24] in region 0 ...
     21: SYSTEM: Creating ListMP [HOST_IPC_IN_24] in region 0 ...
     22: SYSTEM: ListElem Shared Addr = 0x40640200
     23: SYSTEM: Creating ListMP [HOST_IPC_OUT_25] in region 0 ...
     24: SYSTEM: Creating ListMP [HOST_IPC_IN_25] in region 0 ...
     25: SYSTEM: ListElem Shared Addr = 0x40677000
     26: SYSTEM: Creating ListMP [HOST_IPC_OUT_19] in region 0 ...
     28: SYSTEM: Creating ListMP [HOST_IPC_IN_19] in region 0 ...
     29: SYSTEM: ListElem Shared Addr = 0x406ade00
     30: SYSTEM: Creating ListMP [HOST_IPC_OUT_20] in region 0 ...
     31: SYSTEM: Creating ListMP [HOST_IPC_IN_20] in region 0 ...
     32: SYSTEM: ListElem Shared Addr = 0x406f1100
     33: SYSTEM: Creating ListMP [HOST_IPC_OUT_21] in region 0 ...
     35: SYSTEM: Creating ListMP [HOST_IPC_IN_21] in region 0 ...
     36: SYSTEM: ListElem Shared Addr = 0x40734400
     52: SYSTEM: System Common Init Done !!!
    LOG :  imDuration 40 ms
    LOG :  capture_encode_start
     VCAP: DEVICE-0 (0x5c): Chip ID 0x5158, Rev 0x0002, Firmware 0x0000 !!!
     VCAP: DEVICE-0 (0x5c): Detected video (720x288@50Hz, 1) !!!
     VCAP: DEVICE-1 (0x5e): Chip ID 0x5158, Rev 0x0002, Firmware 0x0000 !!!
     VCAP: DEVICE-1 (0x5e): Detected video (720x288@50Hz, 1) !!!
     TVP5158: 0x5c: Downloading patch ...
     TVP5158: 0x5c: Downloading patch ... DONE !!!
     TVP5158: 0x5c: 5158:0002:0302
     TVP5158: 0x5e: Downloading patch ...
     TVP5158: 0x5e: Downloading patch ... DONE !!!
     TVP5158: 0x5e: 5158:0002:0302
    LOG :  create tv5158 status = 0x0
    LOG :  ipcBitsOutVpss to ipcBitsInVideo
    LOG :  ipcBitsInVideo to Encoder
    LOG :  Configure Encoder 0 in H264
    LOG :  Configure Encoder 1 in H264
    LOG :  Configure Encoder 2 in MJPEG
    LOG :  Configure Encoder 3 in MJPEG
    LOG :  Encoder to ipcBitsOutVideo
    LOG :  System_linkCreate _captureId
     [m3vpss ]  72533: CAPTURE: Create in progress !!!
     [m3vpss ]  72544: CAPTURE: VIP0 PortA capture mode is [ 8-bit, Non-mux Embedded Sync] !!!
     [m3vpss ]  72630: CAPTURE: VIP1 PortA capture mode is [ 8-bit, Non-mux Embedded Sync] !!!
    LOG :  System_linkCreate _deiId
     [m3vpss ]  UTILS: DMA: Allocated CH (TCC) = 58 (58)
     [m3vpss ]  UTILS: DMA: 0 of 4: Allocated PaRAM = 58 (0x49004740)
     [m3vpss ]  UTILS: DMA: 1 of 4: Allocated PaRAM = 64 (0x49004800)
     [m3vpss ]  UTILS: DMA: 2 of 4: Allocated PaRAM = 65 (0x49004820)
     [m3vpss ]  UTILS: DMA: 3 of 4: Allocated PaRAM = 66 (0x49004840)
     [m3vpss ] CAPTURE::HEAPID:0    USED:520
     [m3vpss ] CAPTURE::HEAPID:4    USED:37324800
     [m3vpss ]  72718: CAPTURE: Create Done !!!
     [m3vpss ]  72718: DEI    : Create in progress !!!
     [m3vpss ] DEI: Ch 0, Outformat is PROGRESSIVE
     [m3vpss ]  72834: DEI: OUT0:  0: Format: PROGRESSIVE, 0xb8ac4c80, 1920 x 1080, 6 frames
     [m3vpss ] DEI: Ch 1, Outformat is PROGRESSIVE
    LOG :  System_linkCreate _nsfId
     [m3vpss ]  72949: DEI: OUT0:  1: Format: PROGRESSIVE, 0xba27fc80, 1920 x 1080, 6 frames
     [m3vpss ]  72950: DEI     : Loading Down-scaling Co-effs
     [m3vpss ]  72950: DEI     : Co-effs Loading ... DONE !!!
     [m3vpss ] DEI:HEAPID:0 USED:64
     [m3vpss ] DEI:HEAPID:1 USED:4576
     [m3vpss ] DEI:HEAPID:4 USED:49766400
     [m3vpss ]  72950: DEI    : Create Done !!!
     [m3vpss ]  72951: NSF: Create in progress !!!
    LOG :  System_linkCreate _dup1Id
    LOG :  System_linkCreate _mergeId
    LOG :  System_linkCreate _ipcBitsOutVpssId
    LOG :  System_linkCreate _ipcBitsInVideoId
    LOG :  System_linkCreate _encId
     [m3video]  73047: IPC_IN_M3   : Create in progress !!!
     [m3video]  73048: SYSTEM: Opening ListMP [VPSS-M3_IPC_OUT_0] ...
     [m3vpss ] NSF::HEAPID:0        USED:128
     [m3video]  73048: SYSTEM: Opening ListMP [VPSS-M3_IPC_IN_0] ...
     [m3vpss ] NSF::HEAPID:1        USED:6336
     [m3video]  73050: IPC_IN_M3   : Create Done !!!
     [m3vpss ] NSF::HEAPID:4        USED:18800640
     [m3video]  73051: ENCODE: Create in progress ... !!!
     [m3vpss ]  73039: NSF: Create Done !!!
     [m3video] ENCLINK:INFO: !!!Number of output buffers for ch[2] set to [1]
     [m3vpss ]  73043: DUP:  0: Format: PROGRESSIVE, 1920 x 1080
     [m3vpss ]  73043: DUP:  1: Format: PROGRESSIVE, 1920 x 1080
     [m3vpss ]  73044: DUP   : Create Done !!!
     [m3vpss ]  73045: MERGE:  0: Format: PROGRESSIVE, 1920 x 1080
     [m3vpss ]  73045: MERGE:  1: Format: PROGRESSIVE, 1920 x 1080
     [m3vpss ]  73046: MERGE:  2: Format: PROGRESSIVE, 1920 x 1080
     [m3vpss ]  73046: MERGE:  3: Format: PROGRESSIVE, 1920 x 1080
     [m3vpss ]  73046: MERGE   : Create Done !!!
     [m3vpss ]  73046: IPC_OUT_M3   : Create in progress !!!
     [m3vpss ]  73047: IPC_OUT_M3   : Create Done !!!
     [m3video]  73126: ENCODE: Creating CH0 of 1920 x 1080, pitch = (1920, 1920) [PROGRESSIVE] [NON-TILED  ], bitrate = 4000 Kbps, I-P Interval 1...
     [m3video] ENCLINK_H264:HEAPID:0        USED:13808
     [m3video] ENCLINK_H264:HEAPID:3        USED:7176192
     [m3video]  73160: ENCODE: Creating CH1 of 1920 x 1080, pitch = (1920, 1920) [PROGRESSIVE] [NON-TILED  ], bitrate = 4000 Kbps, I-P Interval 1...
     [m3video] ENCLINK_H264:HEAPID:0        USED:11912
     [m3video] ENCLINK_H264:HEAPID:3        USED:7176192
     [m3video]  73194: ENCODE: Creating CH2 of 1920 x 1080, pitch = (1920, 1920) [PROGRESSIVE] [NON-TILED  ], bitrate = 100000 Kbps, I-P Interval 0...
     [m3video] ENCLINK_JPEG:HEAPID:0        USED:2064
     [m3video]  73195: ENCODE: Creating CH3 of 1920 x 1080, pitch = (1920, 1920) [PROGRESSIVE] [NON-TILED  ], bitrate = 100000 Kbps, I-P Interval 0...
     [m3video] ENCLINK_JPEG:HEAPID:0        USED:2064
     [m3video]  73195: ENCODE: All CH Create ... DONE !!!
     [m3video] ENCLINK:HEAPID:0     USED:29888
     [m3video] ENCLINK:HEAPID:2     USED:15892352
     [m3video] ENCLINK:HEAPID:3     USED:14352384
     [m3video]  73196: ENCODE: Create ... DONE !!!
    LOG :  System_linkCreate _ipcBitsOutVideoId
    LOG :  System_linkCreate _ipcBitsInHostId
    
     [host] IpcBitsInLink_tskMain:Entered[HOST]
    ThreadName:IpcBitsInLink_tskMain_3000001b,ThreadID:751
    
     [host]  8486: IPC_BITS_IN   : Create in progress !!!
    
     [host]  8486: IPC_BITS_IN   : ListMPOpen start !!!
    
     [host]  8486: SYSTEM: Opening ListMP [VIDEO-M3_IPC_OUT_24] ...
     8487: SYSTEM: Opening ListMP [VIDEO-M3_IPC_IN_24] ...
    
     [host]  8488: IPC_BITS_IN   : ListMPOpen done !!!
    
     [host]  8489: IPC_BITS_IN   : System_linkGetInfo done !!!
    
     [host]  8489: IPC_BITS_IN   : Create Done !!!
     [m3video]  78197: IPC_BITS_OUT   : Create in progress !!!
     [m3video]  78199: IPC_BITS_OUT   : Create Done !!!
    LOG :  Change dynamics parameters
    LOG : Activation des deux voies
    LOG :  run
    LOG :  System_linkStart _ipcBitsInHostId
    LOG :  System_linkStart _ipcBitsOutVideoId
    LOG :  System_linkStart _encId
    LOG :  System_linkStart _ipcBitsInVideoId
    LOG :  System_linkStart _ipcBitsOutVpssId
    LOG :  System_linkStart _mergeId
    LOG :  System_linkStart _dup1Id
    LOG :  System_linkStart _nsfId
    LOG :  System_linkStart _deiId
    LOG :  System_linkStart _captureId
     [m3vpss ]  80206: CAPTURE: Start in progress !!!
     [m3vpss ]  80306: CAPTURE: Enabled Time Stamping !!!
     [m3vpss ]  80314: CAPTURE: Enabled Time Stamping !!!
     Options:
     0  : take snap ch 0
     1  : take snap ch 1
     2  : print capture stat
     3  : print encode stat
     4  : stop link api and quit
     5  : Step and stare (81 image pendant 27 secondes, ch0)
     [m3vpss ]  80322: CAPTURE: Start Done !!!
     [m3vpss ]  CAPTURE : Capture FPS: 0.0 fps ... in 4294887.0 secs
     [m3vpss ] MSGQ:Warning!! Forcing waitAck = TRUE as waitAck = FALSE is not supported.Fix send cmd [0x4] to linkId [0x71bb4
     [m3vpss ]  80384: SYSTEM: Opening MsgQ [DSP_MSGQ] ...
     [m3vpss ]  81384: SYSTEM: Opening MsgQ [DSP_MSGQ] ...
     [m3vpss ]  82384: SYSTEM: Opening MsgQ [DSP_MSGQ] ...
     [m3vpss ]  83384: SYSTEM: Opening MsgQ [DSP_MSGQ] ...
     [m3vpss ]  84384: SYSTEM: Opening MsgQ [DSP_MSGQ] ...
     [m3vpss ]  85384: SYSTEM: Opening MsgQ [DSP_MSGQ] ...
     [m3vpss ]  86384: SYSTEM: Opening MsgQ [DSP_MSGQ] ...
     [m3vpss ]  87384: SYSTEM: Opening MsgQ [DSP_MSGQ] ...
     [m3vpss ]  88384: SYSTEM: Opening MsgQ [DSP_MSGQ] ...
     [m3vpss ]  89384: SYSTEM: Opening MsgQ [DSP_MSGQ] ...
     [m3vpss ]  CAPTURE : Capture FPS: 94.8 fps ... in 10.0 secs
     [m3vpss ]  90384: Assertion @ Line: 289 in links_common/system/system_ipc_msgq.c: 0 : failed !!!
    

    I don't understantd why there is [DSP_MSGQ] !!!

    I think is a problem with the IPC link id but, i don't see my error.

        _captureId            = SYSTEM_LINK_ID_CAPTURE;
        _deiId                = SYSTEM_LINK_ID_DEI_HQ_0;
    #if ENABLE_NSF
        _nsfId                = SYSTEM_LINK_ID_NSF_0;
    #endif
        _mergeId              = SYSTEM_VPSS_LINK_ID_MERGE_0;
        _encId                = SYSTEM_LINK_ID_VENC_0; 
        _dup1Id               = SYSTEM_VPSS_LINK_ID_DUP_0;
       
        _ipcBitsOutVpssId     = SYSTEM_VPSS_LINK_ID_IPC_OUT_M3_0;
        _ipcBitsInVideoId     = SYSTEM_VIDEO_LINK_ID_IPC_IN_M3_0;
       
        _ipcBitsOutVideoId    = SYSTEM_VIDEO_LINK_ID_IPC_BITS_OUT_0;
        _ipcBitsInHostId      = SYSTEM_HOST_LINK_ID_IPC_BITS_IN_0;

    Can you help me ?

    Thank

  • The nextLinkId is wrongly set to 0 for one of the links. Based on your previous usecase file looks like dupLink is the issue

    dup1Prm.numOutQue                   = 2;

     dup1Prm.outQueParams[0].nextLink is set but  dup1Prm.outQueParams[1].nextLink is not set.

    I see same issue for dup2Prm as well

  • Thanks again Badri,

    You have found the error !!

    I will continue my tests and I will come to you if I have any other problems or to give you the results.

    Regards