TDA4VM: How can i get tivxVpacMscPyramidNode's different level's out put?

Part Number: TDA4VM

Tool/software:

I'm using the tivxVpacMscPyramidNode to get different size picture, it seems that i can only get the level 0's picture, other levels' picture is black. The tivxVpacMscPyramidNode's level is setted to 4.

Only the marked line's output is ok;

code is bellow:

vx_status writePyramidOutput(char *file_name, vx_pyramid pyramid, vx_int32 pyramid_level)
{
vx_status status;
FILE *fp = fopen(file_name, "wb");

vx_image out_img;
out_img = vxGetPyramidLevel(pyramid, pyramid_level);

vx_rectangle_t rect;
vx_imagepatch_addressing_t image_addr;
vx_map_id map_id;
void *data_ptr;
vx_uint32 img_width;
vx_uint32 img_height;

vx_uint32 num_bytes = 0;
vx_df_image df;

vxQueryImage(out_img, VX_IMAGE_WIDTH, &img_width, sizeof(vx_uint32));
vxQueryImage(out_img, VX_IMAGE_HEIGHT, &img_height, sizeof(vx_uint32));
vxQueryImage(out_img, VX_IMAGE_FORMAT, &df, sizeof(vx_df_image));
printf("image_width %d.\n", img_width);
printf("image_height %d.\n", img_height);
printf("image_format %d.\n", df);
if (df == VX_DF_IMAGE_U8)
{
printf("image is u8.\n");
}
else
{
printf("image is not u8.\n");
}

rect.start_x = 0;
rect.start_y = 0;
rect.end_x = img_width;
rect.end_y = img_height;
fprintf(fp, "P5\n%d %d\n255\n", img_width, img_height);

status = vxMapImagePatch(out_img,
&rect,
0,
&map_id,
&image_addr,
&data_ptr,
VX_READ_ONLY,
VX_MEMORY_TYPE_HOST,
VX_NOGAP_X);
int j;
/* Copy Luma */
for (j = 0; j < img_height; j++)
{
num_bytes += fwrite(data_ptr, 1, img_width, fp);
data_ptr += image_addr.stride_y;
}

if (num_bytes != (img_width * img_height))
printf("Luma bytes written = %d, expected = %d\n", num_bytes, img_width * img_height);

vxUnmapImagePatch(out_img, map_id);
vxReleaseImage(&out_img);

fclose(fp);

return (status);
}

  • Hi Cheng,

    can you check the width and height of the levels, is that all seems to be ok ?

    and when are you saving the output after calling vxProcessGraph().

    we have some implementation to save pyramid output similar to what you shared,

    Can you try printing the memory buffer of the levels 1 to 4 and see data is present there.

    Regards,
    Gokul

  • Hi Gokul,

    Sorry, I check all the output pyramid pictures,it seems that all level's picture of pyramid are ok. But threr is anoter problem, some of the output picture is not ok. Some frames of the pictures is like the picture bellow,every three frames of the output pictures have two  frames like the picture bellow,   do you know why?

  • Hi Cheng,

    Which application are you running and describe how are you dumping the frames in sequence.

    How is your graph created ? is pipelining enabled ?

    Regards,
    Gokul

  • It's the vx_app_single_cam application, in the application i add color convert ,scaler and pyramid node,  the pipieline is same as the origin app(but delete the buf size code),it seems tha the buf of the pipeline input must be greater than 4,  can you tell me why?

     // added vx_node

    status = app_create_graph_capture(obj->graph, &obj->captureObj);

    printf("[APP-MODULE] after capture.\n");

    if (status == VX_SUCCESS)
    {
    status = app_create_graph_convert(obj->graph, &obj->colorConvertObj, obj->captureObj.raw_image_arr[0]);
    }
    printf("[APP-MODULE] after convert.\n");

    if (status == VX_SUCCESS)
    {
    status = app_create_graph_scaler(obj->context, obj->graph, &obj->scalerObj, obj->inputImageObj.input_image_array);
    }

    printf("[APP-MODULE] after scaler.\n");

    if (status == VX_SUCCESS)
    {
    status = app_create_graph_pyramid(obj->graph,
    &obj->pyramidObj,
    obj->scalerObj.output[INDEX_PICTURE_SEGMENTION].arr,
    DOF_PYRAMID_START_FROM_PREVIOUS);
    }

    //pipeline set

    add_graph_parameter_by_node_index(obj->graph, obj->captureObj.node, 1);

    graph_parameters_queue_params_list[graph_parameter_num].graph_parameter_index = graph_parameter_num;
    graph_parameters_queue_params_list[graph_parameter_num].refs_list_size = obj->num_cap_buf;
    printf("graph parameters size is %d.\n",obj->num_cap_buf);
    graph_parameters_queue_params_list[graph_parameter_num].refs_list = (vx_reference *)&(obj->captureObj.raw_image_arr[0]);

    if (status == VX_SUCCESS)
    {
    status = tivxSetGraphPipelineDepth(obj->graph, obj->num_cap_buf);
    }

    /* Schedule mode auto is used, here we dont need to call vxScheduleGraph
    * Graph gets scheduled automatically as refs are enqueued to it
    */
    if (status == VX_SUCCESS)
    {
    status = vxSetGraphScheduleConfig(obj->graph,
    VX_GRAPH_SCHEDULE_MODE_QUEUE_AUTO,
    params_list_depth,
    graph_parameters_queue_params_list);
    }

  • Hi Cheng,

    it seems tha the buf of the pipeline input must be greater than 4,  can you tell me why?

    Yes, because for running capture_node in pipeline we set minimun pipeup buffers which is 3, so you have to atleast enqueue 3 buffers to capture node.

    And if you are running in pipeline mode then you should add output of pyramid  node as graph parameter and save it to file.

    Regards,
    Gokul

  • In the app, i do not add the graph parameter, but it can also save the pyramid output to file, it also works for the scaler node, what's the difference between add the node parameter and not to add it, and can you tell me the effect of it ? The above picture , which is not normal , is the affect of the graph parameter?

  • Hi Cheng,

    If you running in pipelining mode it is not recommended to save the images directly without creating it as graph parameter. As the buffers are used by the framework you may end up with some corruption. making it as graph parameter will give you the control of buffer to application.

    Refer to  Node and Graph Parameter Definitions in the user guide.

    Regards,
    Gokul