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.

TDA4VM: CSI2-TX: Set lanebandspeed for 1920x1080@25fps, but the output framerate is 25.3.

Part Number: TDA4VM

Hello TI Experts

Based on the link: tda4vm-csi2-tx-set-lanebandspeed-for-1920x1080-30fps-but-the-output-framerate-is-34

I set the UYVY frames output at 1920*1080@25fps. The laneband speed is : 

TIVX_CSITX_LANE_BAND_SPEED_200_TO_240_MBPS = 1920*1080*16*25*1.2/(1024*1024*4) = 237.3047

static vx_status app_csitx_run_graph(AppCsitxObj *obj)
{
    vx_status status = VX_SUCCESS;
    uint32_t  delay_time = 0;

    switch(gTestNo)
    {
        case '1':
            delay_time = 3000; /* 1920x1080@30P */
            break;
        case '2':
            delay_time = 0; /* 1920x1080@25P */
            break;
        case '3':
            delay_time = 2000; /* 1920x720@25P */
            break;
        default:
            VX_PRINT(VX_ZONE_ERROR, "%s[%d] case number is %c, no case named %c\n", __FUNCTION__, __LINE__, gTestNo, gTestNo);
    }

    do{
        vxProcessGraph(obj->graph);
        if (delay_time != 0)
        {
            usleep(delay_time);
        }
    }while(obj->stop_task != 1);

    return status;
}

The delay_time is set to change the dispatch cycle for API:vxProcessGraph.

编号 delay_time fps remark
1 0 25.3 The delay_time is too small, we need to change the delay_time to 474((1000/25) - (1000/25.3) = 40ms - 39.526ms = 0.474ms).
2 474 24.4 why
3 1 24.4 why

according to the above table, we can see that if the delay_time is no 0, the fps will be 24.4

Why the delay_time no effact? Could you please tell me what can I do for the 25fps?

best wishes

Chengwu.Tang

  • Hi Chengwu Tang,

    Which example are you using? Are you enabling pipelinig in the OpenVX example? If pipline is enabled, delay is not required. 

    Regards,

    Brijesh

  • Hello Brijesh

    The SDK Version is 8.0. 

    Releated source code is below:

    static vx_status app_csitx_create_graph_1920_1080_25P(AppCsitxObj *obj)
    {
        vx_status                   status = VX_SUCCESS;
        uint32_t                    frmIdx = 0;
        uint32_t                    loopCnt = 0;
    
        vx_image                    tx_frame_array_item = NULL;
    
        VX_PRINT(VX_ZONE_INFO, "Creating graph \n");
        /* Create graph */
        obj->graph = vxCreateGraph(obj->context);
        if(status == VX_SUCCESS)
        {
            VX_PRINT(VX_ZONE_INFO, "Creating graph done\n");
            status = vxGetStatus((vx_reference) obj->graph);
        }
        
        obj->rect.start_x = IMAGE_POSI_START_X;
        obj->rect.start_y = IMAGE_POSI_START_Y;
        obj->rect.end_x = IMAGE_POSI_1920_1080_END_X;
        obj->rect.end_y = IMAGE_POSI_1920_1080_END_Y;
    
        /* set init value of all parameters */
        obj->csitx_image = vxCreateImage(obj->context, obj->rect.end_x, obj->rect.end_y, CSITX_FORMAT);
        if (obj->csitx_image == NULL)
        {
            VX_PRINT(VX_ZONE_ERROR, "%s[%d]csitx_image cretae failed\n", __FUNCTION__, __LINE__);
        }
    
        /* create the parameter list */
        /* allocate Input and Output refs*/
        obj->csitx_frame_obj = vxCreateObjectArray(obj->context, (vx_reference)obj->csitx_image, NUM_CHANNELS);
        if (obj->csitx_frame_obj == NULL)
        {
            VX_PRINT(VX_ZONE_ERROR, "%s[%d] csitx_frame_obj create failed\n", __FUNCTION__, __LINE__);
        }
    
        /* this is currently supported for UYVY formats only */
        /* initialization of frames for each channel with unique pattern
           it is (channel no. + x) */
        VX_PRINT(VX_ZONE_INFO,"Initializing Transmit Buffers...\n");
        for (frmIdx = 0U ; frmIdx < NUM_CHANNELS ; frmIdx++)
        {
            tx_frame_array_item = (vx_image)vxGetObjectArrayItem(obj->csitx_frame_obj , frmIdx);
            if (tx_frame_array_item == NULL)
            {
                VX_PRINT(VX_ZONE_ERROR,"%s[%d]vx_frame_array_item create failed\n", __FUNCTION__, __LINE__);
            }
            else
            {
                VX_PRINT(VX_ZONE_INFO, "vxGetObjectArrayItem success\n");
            }
    
            app_csitx_load_vximage_from_yuvfile(tx_frame_array_item, IMAGE_1920x1080_UYVY);
            status = vxReleaseImage(&tx_frame_array_item);
            if(status != VX_SUCCESS)
            {
                VX_PRINT(VX_ZONE_ERROR, "%s[%d] tx_frame_array_item Release failed\n", __FUNCTION__, __LINE__);
            }
        }
        VX_PRINT(VX_ZONE_INFO, "Initializing Transmit Buffers Done.\n");
    
        /* CSITX Config initialization */
        tivx_csitx_params_init(&obj->csitx_config);
        obj->csitx_config.numInst                          = 1U;
        obj->csitx_config.numCh                            = NUM_CHANNELS;
        obj->csitx_config.instId[0U]                       = CSITX_INST_ID;
        obj->csitx_config.instCfg[0U].rxCompEnable         = (uint32_t)vx_true_e;
        obj->csitx_config.instCfg[0U].rxv1p3MapEnable      = (uint32_t)vx_true_e;
        obj->csitx_config.instCfg[0U].laneBandSpeed        = TIVX_CSITX_LANE_BAND_SPEED_200_TO_240_MBPS;
        obj->csitx_config.instCfg[0U].numDataLanes         = 4U;
        for (loopCnt = 0U ;
            loopCnt < obj->csitx_config.instCfg[0U].numDataLanes ;
            loopCnt++)
        {
            obj->csitx_config.instCfg[0U].lanePolarityCtrl[loopCnt] = 0u;
        }
        for (loopCnt = 0U; loopCnt < NUM_CHANNELS; loopCnt++)
        {
            obj->csitx_config.chVcNum[loopCnt]   = loopCnt;
            obj->csitx_config.chInstMap[loopCnt] = CSITX_INST_ID;
        }
    
        VX_PRINT(VX_ZONE_INFO, "start to call vxCreateUserDataObject\n");
        obj->csitx_config_obj = vxCreateUserDataObject(obj->context, "tivx_csitx_params_t", sizeof(tivx_csitx_params_t), &obj->csitx_config);
        if (obj->csitx_config_obj == NULL)
        {
            VX_PRINT(VX_ZONE_ERROR, "%s[%d] csitx_config create failed\n", __FUNCTION__, __LINE__);
        }
        
        VX_PRINT(VX_ZONE_INFO, "Start to call tivxCsitxNode\n");
        obj->csitx_node = tivxCsitxNode(obj->graph, obj->csitx_config_obj, obj->csitx_frame_obj);
        if (obj->csitx_node == NULL)
        {
            VX_PRINT(VX_ZONE_ERROR, "%s[%d] csitx_node create failed\n", __FUNCTION__, __LINE__);
        }
    
        VX_PRINT(VX_ZONE_INFO, "Start to call vxSetNodeTarget\n");
        status = vxSetNodeTarget(obj->csitx_node, VX_TARGET_STRING, TIVX_TARGET_CSITX);
        if (status != VX_SUCCESS)
        {
            VX_PRINT(VX_ZONE_ERROR, "%s[%d] TIVX_TARGET_CSITX set failed\n", __FUNCTION__, __LINE__);
        }
    
        /* input @ node index 0, becomes csitx_graph parameter 1 */
        VX_PRINT(VX_ZONE_INFO, "Start to call add_graph_parameter_by_node_index\n");
        add_graph_parameter_by_node_index(obj->graph, obj->csitx_node, 1);
    
        VX_PRINT(VX_ZONE_INFO, "Start to run vxVerifyGraph\n");
        status = vxVerifyGraph(obj->graph);
        if (status != VX_SUCCESS)
        {
            VX_PRINT(VX_ZONE_ERROR, "%s[%d] csitx_graph verified failed\n", __FUNCTION__, __LINE__);
        }
    
        VX_PRINT(VX_ZONE_INFO, "app_create_graph exiting\n");
        return status;
    }
    

    best wishes

    Chengwu.Tang

  • Hi Brijesh

    About the frame rate calculation, I use the same method to calculate 1920*720@25fps and can make it stable at 25.0fps output.
    But I don't know why I can't get the expected output frame rate for 1920*1080@25fps.

    Could you tell me what can I do for it?

    best wishes

    Chengwu.Tang

  • Hi Brijesh

    I change the paramter : lanebandspeed  and delay time, and the csitx can output stably at 25fps .

    lanebandspeed delay_time
    before modify TIVX_CSITX_LANE_BAND_SPEED_200_TO_240_MBPS 0ms
    after modify TIVX_CSITX_LANE_BAND_SPEED_240_TO_320_MBPS 11ms

    I don't know why the lanebandspeed : TIVX_CSITX_LANE_BAND_SPEED_200_TO_240_MBPS, can not output at 25fps.

    Do you tell me why?

    best wishes

    Chengwu.Tang

  • Hi Tang,

    What is the resolution, fps and number of lanes are you using? 

    1080p resolution at 25 would require around 250Mbps speed per lane (1920x1080x25x16x1.2/(4*1000000))..

    Regards,

    Brijesh

  • Hi Brijesh

    What is the resolution, fps and number of lanes are you using? 

    1920*1080, 25.0 fps and 4 data lanes, and the color format is UYVY

    best wishes

    Chengwu.Tang

  • Hi Tang,

    As i mentioned, this would require 250Mbps lane speed per lane if we just consider 20% overhead for blanking and protocol.. It could be more depending on your timing information.. So 240 to 320Mbps seems to be correct lane speed for this resolution..

    Regards,

    Brijesh

  • Hi,Brijesh

    why do you calculate the lanebandspeed using (4 * 1000000) not (4 * 1024 * 1024)?

    If using (4 * 1024 * 1024), the lanebandspeed will be 237Mbps

    best wishes

    Chengwu.Tang

  • Hi Tang,

    Typically in speed calculation, it is 1000 which is used..

    Regards,

    Brijesh