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: Decoding the h264 file with decode node will get stuck at scheduling node

Part Number: TDA4VM


Hi team,

Here's an issue from the customer may need your help:

Development Board: TDA4VM

SDK: Linux + RTOS SDK 6.02

The customer wants to decode the h264 file with the decode node of tiovx and display the decoded image with the display node. Referenced to test_video_decoder.c in the tiovx directory to configure the decode node and display it as input to display node with the output image of the decode node.

The H264 file used is as same as used in test_video_decoder.C: "%s/tivx/video_decoder/1280x720_allIframe_CBR_20mbps_HIGHSPEED_HP_CABAC.264"

The data from the first few decoded frames can be read and displayed, but after decoding several frames, processing the graph of a decode gets stuck and cannot execute.

The code is as follows:

vx_status app_init_decode(vx_context context, DecodeObj *decodeObj)

{

 vx_status status = VX_SUCCESS;



 /* Create object for encode parameters */

 tivx_video_decoder_params_init(&decodeObj->params); //Initialization parameters 

 decodeObj->params.bitstream_format = TIVX_BITSTREAM_FORMAT_H264; //Set the decode format to H264 



 decodeObj->configuration_obj = vxCreateUserDataObject(context, 

 "tivx_video_decoder_params_t", 

 sizeof(tivx_video_decoder_params_t), 

 NULL);



 vxCopyUserDataObject(decodeObj->configuration_obj,

 0,

 sizeof(tivx_video_decoder_params_t),

 &decodeObj->params,

 VX_WRITE_ONLY,

 VX_MEMORY_TYPE_HOST);



 if (vxGetStatus((vx_reference)decodeObj->configuration_obj) != VX_SUCCESS)

 {

 APP_PRINTF("configuration_obj create failed\n");

 return VX_FAILURE;

 }



 decodeObj->num_buf = MAX_NUM_BUF;

 decodeObj->pipeline_depth = MAX_NUM_BUF;

 int i = 0;

 for (i = 0; i < decodeObj->num_buf; i++)

 {

 decodeObj->bitstream_obj[i] = vxCreateUserDataObject(context, "video_bitstream", decodeObj->width * decodeObj->height * 3 / 2, NULL);

 decodeObj->output_image[i] = vxCreateImage(context, decodeObj->width, decodeObj->height, VX_DF_IMAGE_NV12); 

 }



 return status;

}



vx_status app_create_graph_decode(vx_graph graph, DecodeObj *decodeObj, vx_user_data_object *bitstream_obj)

{

 vx_status status = VX_SUCCESS;



 decodeObj->node = tivxVideoDecoderNode(graph,

 decodeObj->configuration_obj,

 bitstream_obj[0],

 decodeObj->output_image[0]);



 vxSetNodeTarget(decodeObj->node, VX_TARGET_STRING, TIVX_TARGET_VDEC1); //Set node Target kernel 



 vxSetReferenceName((vx_reference)decodeObj->node, "Decode_node");

 status = vxGetStatus((vx_reference)decodeObj->node);

 return status;

}


vx_status app_run_decodeGraph(vx_graph graph, DecodeObj *decodeObj)

{

 vx_rectangle_t rect_y;

 rect_y.start_x = 0;

 rect_y.start_y = 0;

 rect_y.end_x = 1280;

 rect_y.end_y = 720;



 vx_status status = VX_SUCCESS;

 app_get_oneframe_decodeBitStream(&decodeObj->bitstream_obj[0], "/opt/test1.h264", current_frame);

 current_frame ++;

 if (current_frame >= 100) {

 current_frame = 0; 

 } 



 status = vxProcessGraph(graph);

 uint32_t checksum_actual = tivx_utils_simple_image_checksum( decodeObj->output_image[0], 0, rect_y);

 printf("checksum_actual = 0x%x!!!\n", checksum_actual);

 //}



 return status;

}


void app_get_oneframe_decodeBitStream(vx_user_data_object *de_bitstream_obj, char *input_file, vx_uint32 current_frame)

{

 vx_uint32 i;

 uint8_t *bitstream;

 vx_map_id map_id;

 FILE* in_fp = NULL;

 size_t num_read;

 vx_size seek[300];

 vx_status status, seek_status;



 seek[0] = 0;

 for(i = 1; i < 100; i++)

 {

 seek[i] = seek[i - 1] + bitstream_sizes[i - 1];

 }



 vxMapUserDataObject(*de_bitstream_obj, 0, bitstream_sizes[current_frame], &map_id, (void*) &bitstream, VX_WRITE_ONLY, VX_MEMORY_TYPE_HOST, 0);



 in_fp = fopen(input_file, "rb+");

 if (NULL != in_fp)

 {

 seek_status = fseek(in_fp, seek[current_frame], SEEK_SET);

 printf("seek address = 0x%x!!!\n", seek[current_frame]);

 if (0 == seek_status)

 {

 num_read = fread(bitstream, sizeof(uint8_t), bitstream_sizes[current_frame], in_fp);

 fclose(in_fp);

 in_fp = NULL;

 if (bitstream_sizes[current_frame] != num_read)

 {

 printf("%s: Read less than expected!!!\n", input_file);

 printf("Read %d, expected %d!!!\n", num_read, bitstream_sizes[current_frame]);

 }

 printf("%d byte for decode bitstream read \n", num_read); 

 }

 else

 {

 fclose(in_fp);

 in_fp = NULL;

 printf("%s: Seek failed!!!\n", input_file);

 }

 }

 else

 {

 printf("%s: Input file not found!!!\n", input_file);

 }

 vxUnmapUserDataObject(*de_bitstream_obj, map_id);

 tivxSetUserDataObjectAttribute(*de_bitstream_obj, TIVX_USER_DATA_OBJECT_VALID_SIZE, (void*)&bitstream_sizes[current_frame], sizeof(vx_size));

}


static vx_status app_run_graph_for_one_frame(AppObj *obj, char *curFileName, vx_uint32 counter)

{

 vx_status status = VX_SUCCESS;



 //decode执行相关

 if (status == VX_SUCCESS)

 {

 if (vx_true_e == tivxIsTargetEnabled(TIVX_TARGET_VDEC1))

 {

 uint64_t cur1_time = tivxPlatformGetTimeInUsecs();

 APP_PRINTF("current time = %ld.\n", cur1_time);

 status = app_run_decodeGraph(obj->decodeObj.graph, &obj->decodeObj);

 cur1_time = tivxPlatformGetTimeInUsecs() - cur1_time;

 /* convert to msecs */

 cur1_time = cur1_time / 1000;

 APP_PRINTF("\n\nDecode Information: Decode time  = %ld ms\n", cur1_time);

 }

 } else {

 APP_PRINTF("vx_status = %ld.\n", status); 

 }



 if(status == VX_SUCCESS)

 {

 if ((vx_true_e == tivxIsTargetEnabled(TIVX_TARGET_DISPLAY1)) && (obj->displayObj.display_option == 1))

 {

 APP_PRINTF("app_tidl: Running display graph ... \n");

 /* Execute the display graph */

 if(status == VX_SUCCESS)

 {

 status = vxProcessGraph(obj->displayObj.disp_graph); //Execute the displayed graph 

 }

 APP_PRINTF("app_tidl: Running display graph ... Done.\n");

 }

 } else {

 APP_PRINTF("vx_status = %ld.\n", status); 

 }

 return status;

}

The log after execution is as follows: 

app_tidl: Init ...
app_init_display DONE!
app_templete: Init ... Done.
app_tidl: Creating graph ...
app_tidl: Creating graph ... Done.
app_tidl: Verifying display graph ...
0.015258 s: VX_ZONE_ERROR:[ownContextSendCmd:523] ownContextSendCmd: target_id: 106 cmd: 1 num_obj_desc: 1 obj_desc_id: 13
0.015989 s: VX_ZONE_INFO:[ownGraphNodeKernelInit:581] kernel init for node 0, kernel com.ti.hwa.display ...
0.015998 s: VX_ZONE_INFO:[ownGraphNodeKernelInit:592] kernel init for node 0, kernel com.ti.hwa.display ... done !!!
app_tidl: Verifying display graph ... Done.
app_tidl: Verifying decode graph ...
0.016183 s: VX_ZONE_ERROR:[ownContextSendCmd:523] ownContextSendCmd: target_id: 108 cmd: 1 num_obj_desc: 1 obj_desc_id: 12
0.083937 s: VX_ZONE_INFO:[ownGraphNodeKernelInit:581] kernel init for node 0, kernel com.ti.hwa.video_decoder ...
0.083946 s: VX_ZONE_INFO:[ownGraphNodeKernelInit:592] kernel init for node 0, kernel com.ti.hwa.video_decoder ... done !!!
app_tidl: Verifying decode graph ... Done.
app_tidl: Verifying graph ... Done.

Enter Choice: current time = 184243.
seek address = 0x0!!!
82993 byte for decode bitstream read
0.191066 s: VX_ZONE_INFO:[ownGraphScheduleGraph:763] Scheduling Graph (graph=19, pipe=0)
0.191074 s: VX_ZONE_INFO:[ownNodeKernelSchedule:584] Scheduling Node (node=12, pipe=0)
0.256662 s: VX_ZONE_INFO:[ownCheckGraphCompleted:676] Graph Completed (graph=19, pipe=0)
0.256694 s: VX_ZONE_INFO:[ownCheckGraphCompleted:701] All Graphs Completed
checksum_actual = 0x0!!!

Decode Information: Decode time  = 72 ms
app_tidl: Running display graph ...
0.257182 s: VX_ZONE_INFO:[ownGraphScheduleGraph:763] Scheduling Graph (graph=16, pipe=0)
0.257190 s: VX_ZONE_INFO:[ownNodeKernelSchedule:584] Scheduling Node (node=13, pipe=0)
0.257447 s: VX_ZONE_INFO:[ownCheckGraphCompleted:676] Graph Completed (graph=16, pipe=0)
0.257453 s: VX_ZONE_INFO:[ownCheckGraphCompleted:701] All Graphs Completed
app_tidl: Running display graph ... Done.
current time = 257468.
seek address = 0x14431!!!
39524 byte for decode bitstream read
0.258004 s: VX_ZONE_INFO:[ownGraphScheduleGraph:763] Scheduling Graph (graph=19, pipe=0)
0.258010 s: VX_ZONE_INFO:[ownNodeKernelSchedule:584] Scheduling Node (node=12, pipe=0)
0.269753 s: VX_ZONE_INFO:[ownCheckGraphCompleted:676] Graph Completed (graph=19, pipe=0)
0.269759 s: VX_ZONE_INFO:[ownCheckGraphCompleted:701] All Graphs Completed
checksum_actual = 0x2bfbdee0!!!

Decode Information: Decode time = 12 ms
app_tidl: Running display graph ...
0.270188 s: VX_ZONE_INFO:[ownGraphScheduleGraph:763] Scheduling Graph (graph=16, pipe=0)
0.270195 s: VX_ZONE_INFO:[ownNodeKernelSchedule:584] Scheduling Node (node=13, pipe=0)
0.293071 s: VX_ZONE_INFO:[ownCheckGraphCompleted:676] Graph Completed (graph=16, pipe=0)
0.293079 s: VX_ZONE_INFO:[ownCheckGraphCompleted:701] All Graphs Completed
app_tidl: Running display graph ... Done.
current time = 293096.
seek address = 0x1de95!!!
45091 byte for decode bitstream read
0.293738 s: VX_ZONE_INFO:[ownGraphScheduleGraph:763] Scheduling Graph (graph=19, pipe=0)
0.293744 s: VX_ZONE_INFO:[ownNodeKernelSchedule:584] Scheduling Node (node=12, pipe=0)

The program gets stuck at this point, but it doesn't always get stuck at this frame and sometimes it runs several more frames of data. 

Could you help check this case? Thanks.

Best Regards,

Cherry