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.

TDA4VEN-Q1: How to efficiently transfer image data between different tiovx graphs

Part Number: TDA4VEN-Q1
Other Parts Discussed in Thread: TDA4VH

Hi TI Experts,

We built our tiovx application on the TDA4VEN 11.01 SDK.

Goal: How to efficiently transfer image data between different tiovx graphs

Background: 

The design of the pipeline is as below:

 

the main pipeline has extremely high requirements for latency and frame rate (~60 fps), while the processing time of the output from multiple sub-pipelines (TIDL Node, Custom Node) is approximately between 50 and 300 ms.

In order to meet the frame rate and latency requirements of the main pipeline, we plan to place the main pipeline and the sub-pipelines in different tiovx graph. Then we discovered an example in edgeai-tiovx-apps app_tiovx_linux_multi_graph_test.c.

/*
     * Note that in below loop graph on and 2 are running sequentially
     * to run them in parellel, you need to decuple them by creating
     * seperate threads for enqueue/dequeue of each graph
     */
    for (int i = 0; i < APP_NUM_ITERATIONS; i++) {
        //Graph1 Execution
        inbuf1 = v4l2_decode_dqueue_buf(v4l2_decode_handle);
        outbuf1 = tiovx_modules_acquire_buf(out_buf_pool1);
        tiovx_modules_enqueue_buf(inbuf1);
        tiovx_modules_enqueue_buf(outbuf1);
        inbuf1 = tiovx_modules_dequeue_buf(in_buf_pool1);
        outbuf1 = tiovx_modules_dequeue_buf(out_buf_pool1);
        v4l2_decode_enqueue_buf(v4l2_decode_handle, inbuf1);

        //Graph2 Execution
        inbuf2 = tiovx_modules_acquire_buf(in_buf_pool2);
        outbuf2 = tiovx_modules_acquire_buf(out_buf_pool2);
        //Swap input2 mem with output1 to feed graph1 out to graph2
        tiovx_modules_buf_swap_mem(outbuf1, inbuf2);
        tiovx_modules_release_buf(outbuf1);
        tiovx_modules_enqueue_buf(inbuf2);
        tiovx_modules_enqueue_buf(outbuf2);
        inbuf2 = tiovx_modules_dequeue_buf(in_buf_pool2);
        outbuf2 = tiovx_modules_dequeue_buf(out_buf_pool2);
        kms_display_render_buf(kms_display_handle, outbuf2);
        tiovx_modules_release_buf(inbuf2);
        tiovx_modules_release_buf(outbuf2);
    }

But the tiovx_modules_buf_swap_mem() method used here cannot solve my problem. Becasue the output buffers of AwebNode will be used in serveral output pipelines, one of the pipelines uses the buffer, while the other one cannot use meanwhile.

It seems that a feasible approach would be to create a separate buffer by copying for each pipelines. However, since the image data is quite large and the number of our sub-pipelines may increase, this copying process would result in significant CPU consumption.

So, we would like to ask if the experts from TI have any good suggestions about this problem?

regards,

Jialin

  • Hi Jialin,

    the main pipeline has extremely high requirements for latency and frame rate (~60 fps), while the processing time of the output from multiple sub-pipelines (TIDL Node, Custom Node) is approximately between 50 and 300 ms.

    If the other pipeline takes 50 ms you may not be able to run the main graph at 60 fps, so you can reduce the fps of the secondary pipeline to 30fps and run the main pipeline at 60fps.

    For this you have to break the graph into 3 graphs and manage the enqueue/dequeue the buffer from the viss node to ldc node of 2nd graph(main pipeline) and custom nodes of 3rd graph.

    Enqueue only the odd frames to the 3rd graph and enqueue all frames to 2nd graph by this way you can achieve running the graphs at different fps.

    I am sharing few patches for reference,

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/8877.avp4_5F00_3_5F00_graphs.patch this modifies avp4 demo to split the demo into 3 graph and managing enqueue/dequeue between graph without mem copy, this demo will not run on tda4aen, it is just for reference. If you still want to run the demo then use TDA4AL or TDA4VH.

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/2502.avp4_5F00_15_5F00_30_5F00_srv_5F00_ldc_5F00_parallel_5F00_execution.patch this patch modifies the avp4 demo to run 2 different graphs at different fps.

    Regards,
    Gokul