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.

DM385: How to get captured frame from VPSS to A8 Host

Part Number: DM385

Hi Everyone,

I'm using an ADV7280 to capture analog video and using VIP0 Port A (8-Bit) to capture it. Currently, I'm setting up the ADV7280 in user space before loading the VPSS firmware.

I can configure the VPSS firmware to create a Capture -> Null link, and once those links are created and started, I can see that we are receiving video data due to a periodic printout with capture stats. I configure, create, and start these links in the file In src_bios6/main_app/src/main_m3vpss.c. The code is essentially this (Light editing of code):

	UInt32 cameraId;
	UInt32 captureId;

	CaptureLink_CreateParams capturePrm;
	NullLink_CreateParams nullPrm;
	CaptureLink_VipInstParams *pCaptureInstPrm;
	CaptureLink_OutParams *pCaptureOutPrm;




    System_linkControl(	SYSTEM_LINK_ID_M3VPSS,
    					SYSTEM_M3VPSS_CMD_RESET_VIDEO_DEVICES,
    					NULL,
    					0,
    					TRUE	);

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


	/* Link Ids */
    captureId = SYSTEM_LINK_ID_CAPTURE;
    nullId = SYSTEM_VPSS_LINK_ID_NULL_0;

	/* Cature Link params */
	CaptureLink_CreateParams_Init(&capturePrm);
	capturePrm.numVipInst				= 1;
	capturePrm.tilerEnable				= FALSE;
	capturePrm.numBufsPerCh				= 10;
	capturePrm.outQueParams[0].nextLink = nullId;

	pCaptureInstPrm                     = &capturePrm.vipInst[0];
	pCaptureInstPrm->vipInstId          = SYSTEM_CAPTURE_INST_VIP0_PORTA;
	pCaptureInstPrm->videoDecoderId     = SYSTEM_DEVICE_VID_DEC_DUMMY;
	pCaptureInstPrm->standard           = SYSTEM_STD_D1;
	pCaptureInstPrm->numOutput          = 1;
	pCaptureInstPrm->inDataFormat       = SYSTEM_DF_YUV422P;

	pCaptureOutPrm                      = &pCaptureInstPrm->outParams[0];
	pCaptureOutPrm->dataFormat          = SYSTEM_DF_YUV420SP_UV;
	pCaptureOutPrm->scEnable            = FALSE;
	pCaptureOutPrm->scOutWidth          = 720;			// used only if pCaptureOutPrm->scEnable is TRUE
	pCaptureOutPrm->scOutHeight         = 240;			// used only if pCaptureOutPrm->scEnable is TRUE
	pCaptureOutPrm->outQueId            = 0;
	pCaptureOutPrm->frameSkipMask       = 0;


	/*
	 * Capture NULL Link
	 */
	nullPrm.numInQue = 1;
	nullPrm.inQueParams[0].prevLinkId = captureId;
	nullPrm.inQueParams[0].prevLinkQueId = 0;



	Vps_printf("capture link create time - %u ms\r\n", Utils_getCurTimeInMsec());

	System_linkCreate(captureId, &capturePrm, sizeof(capturePrm));

	Vps_printf("others link create time - %u ms\r\n", Utils_getCurTimeInMsec());

    Vps_printf("null link create time - %u ms\r\n", Utils_getCurTimeInMsec());

    System_linkCreate(nullId, &nullPrm, sizeof(nullPrm));

    Vps_printf("null link create time - %u ms\r\n", Utils_getCurTimeInMsec());


    System_linkStart( captureId );

Upon loading, I get a periodic print that outputs stats about the capture. If I disable the ADV7280 chip via an I2C command, the stats indicate that frames are no longer coming in, if I re-enable the chip, the stats indicate that frames are now coming in.

Currently, our system sets up all the MCFW links on the host side in a custom use case. I'm trying to setup the capture & null link under our custom use case on the host and I'm not seeing any frames being captured. Here is the code from the host side. I have edited this snippet to remove non-capture related code:

static uint32_t                 g_cap_id;
static uint32_t                 g_null_id;



    CaptureLink_CreateParams capturePrm;
    NullLink_CreateParams nullPrm;
    CaptureLink_VipInstParams *pCaptureInstPrm;
    CaptureLink_OutParams *pCaptureOutPrm;



    /*
     * Configure Capture Path
     */
    OSA_printf("\n********* Entered Capture -> Encode -> Out (A8) ********\n");

    vcapDecParams.videoIfMode           = DEVICE_CAPT_VIDEO_IF_MODE_8BIT;
    vcapDecParams.videoDataFormat       = VF_YUV422P;
    vcapDecParams.standard              = VSYS_STD_AUTO_DETECT;
    vcapDecParams.videoCaptureMode      = DEVICE_CAPT_VIDEO_CAPTURE_MODE_SINGLE_CH_NON_MUX_EMBEDDED_SYNC;
    vcapDecParams.videoSystem           = DEVICE_VIDEO_DECODER_VIDEO_SYSTEM_AUTO_DETECT;
    vcapDecParams.videoCropEnable       = FALSE;

    Vcap_configVideoDecoder( &vcapDecParams, 1 );



    /*
     * Setup Link IDs
     */
    g_cap_id                            = SYSTEM_LINK_ID_CAPTURE;
    g_null_id                           = SYSTEM_VPSS_LINK_ID_NULL_0;


    /*
     * Setup CaptureLink
     */
    CaptureLink_CreateParams_Init(&capturePrm);
    capturePrm.numVipInst               = 1;
    capturePrm.tilerEnable              = FALSE;
    capturePrm.numBufsPerCh             = 10;
    capturePrm.outQueParams[0].nextLink = g_null_id;

    pCaptureInstPrm                     = &capturePrm.vipInst[0];
    pCaptureInstPrm->vipInstId          = SYSTEM_CAPTURE_INST_VIP0_PORTA;
    pCaptureInstPrm->videoDecoderId     = SYSTEM_DEVICE_VID_DEC_DUMMY;
    pCaptureInstPrm->standard           = SYSTEM_STD_D1;
    pCaptureInstPrm->numOutput          = 1;
    pCaptureInstPrm->inDataFormat       = SYSTEM_DF_YUV422P;

    pCaptureOutPrm                      = &pCaptureInstPrm->outParams[0];
    pCaptureOutPrm->dataFormat          = SYSTEM_DF_YUV420SP_UV;
    pCaptureOutPrm->scEnable            = FALSE;
    pCaptureOutPrm->scOutWidth          = 720;          // used only if pCaptureOutPrm->scEnable is TRUE
    pCaptureOutPrm->scOutHeight         = 240;          // used only if pCaptureOutPrm->scEnable is TRUE
    pCaptureOutPrm->outQueId            = 0;
    pCaptureOutPrm->frameSkipMask       = 0;

    nullPrm.numInQue                    = 1;
    nullPrm.inQueParams[0].prevLinkId   = g_cap_id;
    nullPrm.inQueParams[0].prevLinkQueId = 0;


    /*
     * Reset M3VPSS & Set Enc/Dec Channel Map
     */
    System_linkControl(SYSTEM_LINK_ID_M3VPSS, SYSTEM_M3VPSS_CMD_RESET_VIDEO_DEVICES,NULL,0,TRUE);

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



    //CREATE
    OSA_printf("############# CREATE CAPTURE LINK #################\n");
    System_linkCreate(g_cap_id,                     &capturePrm,            sizeof(capturePrm));
    System_linkCreate(g_null_id,                    &nullPrm,               sizeof(nullPrm));


    System_linkStart(g_cap_id);

Note: The System_linkStart on the Host example typically would happen when I call the Vcap_start from a different part of code, but for the example, I'll have it get called here instead.

Could anyone tell me why when I startup capture from VPSS, I appear to capture frames without any issues, while when I start it from the A8 Host it appears that I don't get any frame capture? I'm wondering if somehow the VIP0 interface is being configured differently between the two, but I'm not sure how to check.

Thanks

  • I think I've answered my own question. It looks like this call "Vcap_configVideoDecoder( &vcapDecParams, 1 );" was resetting the ADV7280, so obviously we wouldn't get frames  The above code should be working to capture to a null link if anyone needs a reference.