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: SRV Demo change different angles cost too much time

Part Number: TDA4VM

Hi there!

    I am working on the TDA4EVM J721E .

    Based on the demo app_srv_fileio  ,  I add the disp module and the cmd line function.

    And I  kept the two graphs working instade of only one time.

    But after changing the view paramater like below:

camx 0
camy 0
camz 200  -> 400 
targetx 0
targety 0
targetz 0
anglex 0
angley 0
anglez 0

It cost about 10 seconds to give the right image. 

And if I change the parameter 10 seconds after the last change. It worked smoothly.

How can I reduce the watting time ?

Very thanks !

  • while (obj->stop_task)
    {
        obj->cur_time = tivxPlatformGetTimeInUsecs();
    
        tivxMutexLock(obj->mutex);      // use mutex to protect the view paramater during graph working.
    
        if (obj->angle_change)
        {
            obj->angle_change = 0;
            printf("angles changes ok!\n");
    
            if (status == VX_SUCCESS)
            {
                status = app_run_graph1(obj);
            }
        }
    
        if (status == VX_SUCCESS)
        {
            status = app_run_graph2(obj);
        }
    
        obj->cur_time = tivxPlatformGetTimeInUsecs() - obj->cur_time;
        obj->cur_time /= 1000;
        tivxMutexUnlock(obj->mutex);
    
        if (status == VX_SUCCESS)
        {
            status = vxProcessGraph(obj->dispObj.disp_graph);
        }
    }

  • Hello,

    How many times does the graph execute before it gives the right image?

    Regards,

    Lucas

  • As showing in the video .

    When i enter the number '9' first time , it responses quickly .

    But after the following I entered the number '7' , until about 5 seconds later , the picture changes.

    I want the change of the image comes as quickly as possible.

    PS: the two graphs related to the SRV , cost about 27 ms per time. And they worked stable.

    Regards

  • By the way , the number 0 to 9 , represent the different paramaters of the 10 view paramaters.

  • while (obj->stop_task)
    {
        obj->cur_time = tivxPlatformGetTimeInUsecs();
    
        tivxMutexLock(obj->mutex);      // use mutex to protect the view paramater during graph working.
    
        if (obj->angle_change)
        {
            obj->angle_change = 0;
            printf("angles changes ok!\n");
        }
        
        if (status == VX_SUCCESS)
        {
            status = app_run_graph1(obj);
        }
        
        if (status == VX_SUCCESS)
        {
            status = app_run_graph2(obj);
        }
    
        obj->cur_time = tivxPlatformGetTimeInUsecs() - obj->cur_time;
        obj->cur_time /= 1000;
        tivxMutexUnlock(obj->mutex);
    
        if (status == VX_SUCCESS)
        {
            status = vxProcessGraph(obj->dispObj.disp_graph);
        }
    }

  • Hello,

    It looks like you have made several changes to this application, including adding a display node.  Could you please provide all of the details about the changes you have made to this application?

    Regards,

    Lucas

  • Hello Lucas ,

    Yes ,for easy debugging , I added the display node to watch the changes of the output image of the "srv" node.

    1 . First of all , I changed the number of the view paramaters in the "app_srv_cfg" file. I modified the value of the num_views to '1'. And delete the other 

    view x parameters.
    # If 2MP is used, set to 1, otherwise set to 0
    is2MP 1
    
    # Bowl offset
    offsetXleft    -400
    offsetXright   400
    offsetYfront   -450
    offsetYback    450
    
    # Num views
    num_views 1
    
    # view 0 parameters
    camx 0
    camy 0
    camz 200
    targetx 0
    targety 0
    targetz 0
    anglex 0
    angley 0
    anglez 0
    
    
    2. Than ,before the loop begin , I excute the "app_run_graph1" for only one time to generate the bowl.
    I put the  "app_run_graph2" and "display_graph" function in a  same loop . 
    The code is as below.
    if (status == VX_SUCCESS)
    {
        status = app_run_graph1(obj);
    }
    while (obj->stop_task)
    {
        obj->cur_time = tivxPlatformGetTimeInUsecs();
    
        tivxMutexLock(obj->mutex);      // use mutex to protect the view paramater during graph working.
    
        if (obj->angle_change)
        {
            obj->angle_change = 0;
            printf("angles changes ok!\n");
        }
    
        if (status == VX_SUCCESS)
        {
            status = app_run_graph2(obj);
        }
    
        obj->cur_time = tivxPlatformGetTimeInUsecs() - obj->cur_time;
        obj->cur_time /= 1000;
        tivxMutexUnlock(obj->mutex);
    
        if (status == VX_SUCCESS)
        {
            status = vxProcessGraph(obj->dispObj.disp_graph);
        }
    }

     3、For dynamically adjust srv_views_array parameters . I create a separate task to get the input form the keyboard.

    For example , if I enter the different number , the different views_array parameters will be modified if the mutex could be locked.

       case '1':
        {
            obj->camx[0] = 0;
            obj->camy[0] = 0;
            obj->camz[0] = 200;
            obj->targetx[0] = 0;
            obj->targety[0] = 0;
            obj->targetz[0] = 0;
            obj->anglex[0] = 0;
            obj->angley[0] = 0;
            obj->anglez[0] = 0;
        }
        break;
        ........
        ........
                        if (obj->mutex)
                    {
                        tivxMutexLock(obj->mutex);
    
                        obj->angle_change = 1;
    
                        local_srv_coords.camx = obj->camx[0];
                        local_srv_coords.camy = obj->camy[0];
                        local_srv_coords.camz = obj->camz[0];
                        local_srv_coords.targetx = obj->targetx[0];
                        local_srv_coords.targety = obj->targety[0];
                        local_srv_coords.targetz = obj->targetz[0];
                        local_srv_coords.anglex = obj->anglex[0];
                        local_srv_coords.angley = obj->angley[0];
                        local_srv_coords.anglez = obj->anglez[0];
    
                        obj->srv_views = (vx_user_data_object)vxGetObjectArrayItem((vx_object_array)obj->srv_views_array, 0);
    
                        vxCopyUserDataObject(obj->srv_views, 0, sizeof(srv_coords_t), &local_srv_coords, VX_WRITE_ONLY, VX_MEMORY_TYPE_HOST);
    
                        vxReleaseUserDataObject(&obj->srv_views);
                        tivxMutexUnlock(obj->mutex);
                    }
    

    4. In case of the views_array parameters being modified while  the "app_run_graph2" is running . I used a mutex to protect it.

    I am very sure that the display graph works well.

    I doubt that the method of modifying the view parameters is not right.

    I attemp to change the srv_views_array paramaters with the function “tivxNodeSendCommand” . But I can not find what to set for the third paramater of this function.

    Thanks a lot . 

    Regards,

    Wang

     

  • Hello,

    Overall, this looks fine.  If you want to try the method of using the tivxNodeSendCommand function, for the third parameter, you will need to add a macro to send to the node to process which command to run.  You can reference the TIVX_DISPLAY_SET_CROP_PARAMS inside tiovx/kernels_j7/include/TI/j7_display.h and tiovx/kernels_j7/hwa/display/vx_display_target.c.

    Please let me know if this produces a different result.

    Regards,

    Lucas

  • Hi , Lucas

    I found the example of the sround view.

    The path is ./vision_apps/kernels/srv/test/test_gpu_srv.c . At the line 651(TEST(tivxGlSrv, testGraph1MPViewChange)).

            local_srv_coords.camx =     0.0f;
            local_srv_coords.camy =     0.0f;
            local_srv_coords.camz =   240.0f;
            local_srv_coords.targetx =  0.0f;
            local_srv_coords.targety =  0.0f;
            local_srv_coords.targetz =  0.0f;
            local_srv_coords.anglex =   0.0f;
            local_srv_coords.angley =   0.0f;
            local_srv_coords.anglez =   0.0f;
    
            ASSERT_VX_OBJECT(srv_views = (vx_user_data_object)vxGetObjectArrayItem((vx_object_array)srv_views_array, i), (enum vx_type_e)VX_TYPE_USER_DATA_OBJECT);
    
            VX_CALL(vxCopyUserDataObject(srv_views, 0, sizeof(srv_coords_t), &local_srv_coords, VX_WRITE_ONLY, VX_MEMORY_TYPE_HOST));
    
            VX_CALL(vxReleaseUserDataObject(&srv_views));

    I used the same method to change the srv views (Just like what I did before). It cost also about 5 seconds to give the changed image.(Showing in the video below )

    Sometimes it gives the changed image quickly.

    I want to know that is there any way to reduce this waiting time between the view paramaters change.

    Best regard.

    Wang

  • Hello Wang,

    Could you please provide your full application code along with instructions to reproduce this? I will try this out on my end.

    Regards,

    Lucas

  • Hello Lucas 

    The vision of the sdk is “0800”.

    Please download the code in this page 

    https://gitee.com/tda4/ti-tda4/tree/feature/app_srv_fileio(360%20sround%20view)

    Best Regard.

  • Hello Wang,

    In the file vision_apps/kernels/srv/gpu/3dsrv/render.cpp, there is a static int called "gap" set to 50.  This serves as the number of frames to continue showing the existing image.  Given that in your use case you are wanting this to switch to a different view right after selecting the view, you can set this to 0 and let it change once you have changed the view parameters.

    Regards,

    Lucas