TDA4VM: Problems encountered when converting RGBX to NV12 using m2m nodes

Part Number: TDA4VM

Tool/software:

Hello,

I want to convert the output of srv to NV12, and then go through scaler nodes, mosaic nodes, and display nodes. I encountered some problems during this process and hope to get your help.

I did the following test. SDK:08-04

1. capture(yuv422)->ldc(NV12)->srv(RGBX)->m2m(NV12)->display

The screen is as shown in Figure 1. When I delete vxReplicateNode() in "app_fmt_cnv_module.c" obtained from [FAQ] TDA4VM: How to use DSS M2M for format conversion? - Processors forum - Processors - TI E2E support forums, the screen can output normally. 

2. capture(yuv422)->ldc(NV12)->srv(RGBX)->m2m(NV12)->scaler->mosaic->display

When deleting vxReplicateNode() in "app_fmt_cnv_module.c", 

some of the logs are as follows.

    69.713375 s: ISS: Initializing sensor [SG2-IMX390C-5200-FPDLINK] ... Done !!!
Sensor init done!
captureObj->params.numDataLanes = 4 
captureObj->params.dataLanesMap[0] = 1 
captureObj->params.dataLanesMap[1] = 2 
captureObj->params.dataLanesMap[2] = 3 
captureObj->params.dataLanesMap[3] = 4 
sensorObj->sensor_dcc_enabled=1
sensorObj->sensor_name=SG2-IMX390C-5200-FPDLINK
sensorObj->sensor_wdr_enabled=0
sensorObj->sensorParams.dccId=6100
LDC init done!
capture init done!
Reading calmat file 
Calmat size for cnt 0 = 48 
Calmat size for cnt 1 = 48 
Calmat size for cnt 2 = 48 
Calmat size for cnt 3 = 48 
For Camera = 0 Ref calmat[0] = 1072386015 Ref Calmat[11] = -2545998 
For Camera = 1 Ref calmat[0] = 4014387 Ref Calmat[11] = -2127016 
For Camera = 2 Ref calmat[0] = -1071093409 Ref Calmat[11] = 2069336 
For Camera = 3 Ref calmat[0] = 5995671 Ref Calmat[11] = 2050034 
file read completed 
--------------out_gpulut_array done ------------
--------in_params.SVInCamFrmHeight, weight:1080,1920
srv init done!
[FMT-CONV-MODULE]: Num Channels 1 WxH 1920x1080
FMT conversion init done!
Creating VX_DF_IMAGE_NV12 image!
scaler init done!
Img Mosaic init done!
-----------DISPLAY1 target enable
Display init done!
App Init Done! 
Graph create done!
Capture graph done!
dcc->config nonempty
LDC graph done!
GPU LUT Graph Verify successful!Adding SRV write node on graph .. 
SRV write node added! 
srv graph done!
fmt conversion graph done!
scaler output number:1
output1------------------
scaler graph done!
enable_mosaic and enable_scaler!
Img Mosaic graph done!
Display graph done!
ldc Pipeline params setup done!
SRV Pipeline params setup done!
    69.738939 s:  VX_ZONE_ERROR:[tivxSetNodeParameterNumBufByIndex:2325] Invalid parameters
fmt conversion Pipeline params setup done!
scaler Pipeline params setup done!
MOSAIC Pipeline params setup done!
App Create Graph Done! 
EGL: version 1.5
----------verify status:0
Graph verify done!
App Verify Graph Done! 
APP GPU LUT Graph Done
app_pipeline_params_defaults returned
    70.278618 s: ISS: Starting sensor [SG2-IMX390C-5200-FPDLINK] ... !!!


 =========================
 Demo : Camera Demo
 =========================

 s: Save CSIx, VISS and LDC outputs

 p: Print performance statistics

 x: Exit

 Enter Choice: 


 =========================
 Demo : Camera Demo
 =========================

 s: Save CSIx, VISS and LDC outputs

 p: Print performance statistics

 x: Exit

 Enter Choice:     70.919367 s: ISS: Starting sensor [SG2-IMX390C-5200-FPDLINK] ... !!!
appStartImageSensor returned with status: 0
[MCU2_0]     71.069698 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
[MCU2_0]     71.103433 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
[MCU2_0]     71.137479 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
[MCU2_0]     71.178563 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
[MCU2_0]     71.208685 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
[MCU2_0]     71.242017 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
x[MCU2_0]     95.508683 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
[MCU2_0]     95.574592 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
[MCU2_0]     95.607612 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
[MCU2_0]     95.641344 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
[MCU2_0]     95.707529 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
[MCU2_0]     95.741622 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
[MCU2_0]     95.774668 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
[MCU2_0]     95.841347 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
[MCU2_0]     95.874431 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
[MCU2_0]     95.907657 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
...

[MCU2_0]     95.974664 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
[MCU2_0]     96.007589 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
[MCU2_0]     96.040724 s:  VX_ZONE_ERROR:[tivxVpacMscScaleProcess:698] NULL Params check failed
    96.059319 s: ISS: Stopping sensor [SG2-IMX390C-5200-FPDLINK] ... !!!
    96.187352 s: ISS: Stopping sensor [SG2-IMX390C-5200-FPDLINK] ... Done !!!
App Run Graph Done! 
Capture delete done!
VISS delete done!
AEWB delete done!
LDC delete done!
srv delete done!
fmt conversion detele done
scaler deinit done!
Img Mosaic delete done!
Display delete done!
[MCU2_0]     96.239175 s: ==========================================================
[MCU2_0]     96.239274 s:  Capture Status: Instance|0
[MCU2_0]     96.239315 s: ==========================================================
[MCU2_0]     96.239363 s:  overflowCount: 0
[MCU2_0]     96.239399 s:  spuriousUdmaIntrCount: 0
[MCU2_0]     96.239438 s:  frontFIFOOvflCount: 0
[MCU2_0]     96.239474 s:  crcCount: 1
[MCU2_0]     96.239506 s:  eccCount: 0
[MCU2_0]     96.239539 s:  correctedEccCount: 0
[MCU2_0]     96.239574 s:  dataIdErrorCount: 0
[MCU2_0]     96.239613 s:  invalidAccessCount: 0
[MCU2_0]     96.239650 s:  invalidSpCount: 0
[MCU2_0]     96.239688 s:  strmFIFOOvflCount[0]: 0
[MCU2_0]     96.239722 s:  Channel Num | Frame Queue Count | Frame De-queue Count | Frame Drop Count | Error Frame Count |
[MCU2_0]     96.239799 s:            0 |               754 |                  754 |                2 |                 0 |
[MCU2_0]     96.239878 s:            1 |               754 |                  754 |                1 |                 0 |
[MCU2_0]     96.239957 s:            2 |               754 |                  754 |                2 |                 0 |
[MCU2_0]     96.240036 s:            3 |               754 |                  754 |                2 |                 0 |
[MCU2_0]     96.259885 s: ==========================================================
[MCU2_0]     96.259982 s:  Display M2M Status: Instance|0
[MCU2_0]     96.260023 s: ==========================================================
[MCU2_0]     96.260224 s:  Queue Count: 752
[MCU2_0]     96.260274 s:  De-queue Count: 752
[MCU2_0]     96.260316 s:  Write-back Frames Count: 752
[MCU2_0]     96.260355 s:  Underflow Count: 0
Graph delete done!
App Delete Graph Done! 
    96.273705 s: ISS: De-initializing sensor [SG2-IMX390C-5200-FPDLINK] ... !!!
    96.274177 s: ISS: De-initializing sensor [SG2-IMX390C-5200-FPDLINK] ... Done !!!
Sensor deinit done!
Capture deinit done!
LDC deinit done!
srv deinit done!
fmt conversion deinit done!
scaler deinit done!
Img Mosaic deinit done!
Display deinit done!
appGrpxDeInit done
Kernels unload done!
Release context done!
App De-init Done! 
    96.759960 s:  VX_ZONE_INIT:[tivxHostDeInitLocal:100] De-Initialization Done for HOST !!!
    96.764491 s:  VX_ZONE_INIT:[tivxDeInitLocal:193] De-Initialization Done !!!
APP: Deinit ... !!!
REMOTE_SERVICE: Deinit ... !!!
REMOTE_SERVICE: Deinit ... Done !!!
IPC: Deinit ... !!!
IPC: DeInit ... Done !!!
MEM: Deinit ... !!!
DDR_SHARED_MEM: Alloc's: 85 alloc's of 183982428 bytes 
DDR_SHARED_MEM: Free's : 85 free's  of 183982428 bytes 
DDR_SHARED_MEM: Open's : 0 allocs  of 0 bytes 
DDR_SHARED_MEM: Total size: 536870912 bytes 
MEM: Deinit ... Done !!!
APP: Deinit ... Done !!!

the first error VX_ZONE_ERROR:[tivxSetNodeParameterNumBufByIndex:2325] Invalid parameters in code:

if (status == VX_SUCCESS) {
status = tivxSetNodeParameterNumBufByIndex(obj->fmtConvObj.node, 1, APP_BUFFER_Q_DEPTH);
status = tivxSetNodeParameterNumBufByIndex(obj->fmtConvObj.node, 2, APP_BUFFER_Q_DEPTH);
 } .

My graph create code as:

if(obj->sensorObj.enable_ldc == 1)
    {
        vx_object_array ldc_in_arr;
        if(1 == obj->enable_viss)
        {
            ldc_in_arr = obj->vissObj.output_arr;
        }
        else
        {
            ldc_in_arr = obj->captureObj.raw_image_arr[0];
        }
        if (status == VX_SUCCESS)
        {
            status = app_create_graph_ldc(obj->graph, &obj->ldcObj, ldc_in_arr);
            APP_PRINTF("LDC graph done!\n");
        }
        // obj->imgMosaicObj.input_arr[idx++] = obj->ldcObj.output_arr;
    }

    if(obj->enable_srv == 1 && status == VX_SUCCESS)
    {
        status = app_create_graph_srv(obj->context, obj->graph, &obj->srvObj, obj->ldcObj.output_arr);
        APP_PRINTF("srv graph done!\n");
    }

    if(obj->enable_m2m == 1 && status == VX_SUCCESS)
    {
        status = app_create_graph_fmt_conv(obj->graph, &obj->fmtConvObj, obj->srvObj.output_img_arr);
        APP_PRINTF("fmt conversion graph done!\n");
    }

    if(obj->enable_scaler == 1 && status == VX_SUCCESS)
    {
        status = app_create_graph_scaler(obj->context, obj->graph, &obj->scalerObj, obj->fmtConvObj.arr);
        APP_PRINTF("scaler graph done!\n");
    }
    vx_int32 idx = 0;
    vx_image display_in_image;
    if(obj->enable_mosaic == 1)
    {
        if(obj->enable_scaler == 1)
        {
            obj->imgMosaicObj.input_arr[idx++] = obj->scalerObj.output[0].arr;
            APP_PRINTF("enable_mosaic and enable_scaler!\n");
        }
        else
        {
            obj->imgMosaicObj.input_arr[idx++] = obj->fmtConvObj.arr;
        }

        obj->imgMosaicObj.num_inputs = idx;

        if(status == VX_SUCCESS)
        {
            status = app_create_graph_img_mosaic(obj->graph, &obj->imgMosaicObj, NULL);
            APP_PRINTF("Img Mosaic graph done!\n");
        }
        display_in_image = obj->imgMosaicObj.output_image[0];
    }
    else{
        display_in_image = (vx_image)vxGetObjectArrayItem(obj->fmtConvObj.arr, 0);

    }


    if(status == VX_SUCCESS)
    {
        if(obj->enable_mosaic)
        {
            status = app_create_graph_display(obj->graph, &obj->displayObj, display_in_image);
        }
        else
        {
            printf("m2m output\n");
            status = app_create_graph_display(obj->graph, &obj->displayObj, display_in_image);
        }
        APP_PRINTF("Display graph done!\n");
    }

Next, I delete 'status = tivxSetNodeParameterNumBufByIndex(obj->fmtConvObj.node, 1, APP_BUFFER_Q_DEPTH);' ,the first error VX_ZONE_ERROR:[tivxSetNodeParameterNumBufByIndex:2325] Invalid parameters  has disappeared while the other errors still exist. The screen is as shown in Figure 2.

Then I try to add vxReplicateNode() in "app_fmt_cnv_module.c", the error seems to have disappeared, but there is still an issue with the display. 

Sensor selected : SG2-IMX390C-5200-FPDLINK
Querying SG2-IMX390C-5200-FPDLINK 
   202.951709 s: ISS: Querying sensor [SG2-IMX390C-5200-FPDLINK] ... !!!
   202.952131 s: ISS: Querying sensor [SG2-IMX390C-5200-FPDLINK] ... Done !!!
LDC Selection Yes(1)/No(0)
1
Max number of cameras supported by sensor SG2-IMX390C-5200-FPDLINK = 4 
Please enter number of cameras to be enabled 
4
WDR mode is not supported. Defaulting to linear 
Sensor DCC is enabled 
Sensor width = 1920
Sensor height = 1080
Sensor DCC ID = 6100
Sensor Supported Features = 0x00000100
Sensor Enabled Features = 0x00000120
YUV Input selected. VISS, AEWB and Mosaic nodes will be bypassed. 
Creating context done!
Kernel loading done!
----------------is enable gui
   204.928524 s: ISS: Initializing sensor [SG2-IMX390C-5200-FPDLINK], doing IM_SENSOR_CMD_PWRON ... !!!
   204.928907 s: ISS: Initializing sensor [SG2-IMX390C-5200-FPDLINK], doing IM_SENSOR_CMD_CONFIG ... !!!
[MCU2_0]    205.572675 s: ===ub953_cfgScript chId=0 i2cAddrSer=74
[MCU2_0]    206.065674 s: ===ub953_cfgScript chId=1 i2cAddrSer=76
[MCU2_0]    206.558672 s: ===ub953_cfgScript chId=2 i2cAddrSer=78
[MCU2_0]    207.051670 s: ===ub953_cfgScript chId=3 i2cAddrSer=7a
   207.412906 s: ISS: Initializing sensor [SG2-IMX390C-5200-FPDLINK] ... Done !!!
Sensor init done!
captureObj->params.numDataLanes = 4 
captureObj->params.dataLanesMap[0] = 1 
captureObj->params.dataLanesMap[1] = 2 
captureObj->params.dataLanesMap[2] = 3 
captureObj->params.dataLanesMap[3] = 4 
sensorObj->sensor_dcc_enabled=1
sensorObj->sensor_name=SG2-IMX390C-5200-FPDLINK
sensorObj->sensor_wdr_enabled=0
sensorObj->sensorParams.dccId=6100
LDC init done!
capture init done!
Reading calmat file 
Calmat size for cnt 0 = 48 
Calmat size for cnt 1 = 48 
Calmat size for cnt 2 = 48 
Calmat size for cnt 3 = 48 
For Camera = 0 Ref calmat[0] = 1072386015 Ref Calmat[11] = -2545998 
For Camera = 1 Ref calmat[0] = 4014387 Ref Calmat[11] = -2127016 
For Camera = 2 Ref calmat[0] = -1071093409 Ref Calmat[11] = 2069336 
For Camera = 3 Ref calmat[0] = 5995671 Ref Calmat[11] = 2050034 
file read completed 
--------------out_gpulut_array done ------------
--------in_params.SVInCamFrmHeight, weight:1080,1920
srv init done!
[FMT-CONV-MODULE]: Num Channels 1 WxH 1920x1080
FMT conversion init done!
Creating VX_DF_IMAGE_NV12 image!
scaler init done!
Img Mosaic init done!
-----------DISPLAY1 target enable
Display init done!
App Init Done! 
Graph create done!
Capture graph done!
dcc->config nonempty
LDC graph done!
GPU LUT Graph Verify successful!Adding SRV write node on graph .. 
SRV write node added! 
srv graph done!
fmt conversion graph done!
scaler output number:1
output1------------------
scaler graph done!
enable_mosaic and enable_scaler!
Img Mosaic graph done!
Display graph done!
ldc Pipeline params setup done!
SRV Pipeline params setup done!
fmt conversion Pipeline params setup done!
scaler Pipeline params setup done!
MOSAIC Pipeline params setup done!
App Create Graph Done! 
EGL: version 1.5
----------verify status:0
Graph verify done!
App Verify Graph Done! 
APP GPU LUT Graph Done
app_pipeline_params_defaults returned
   207.967265 s: ISS: Starting sensor [SG2-IMX390C-5200-FPDLINK] ... !!!


 =========================
 Demo : Camera Demo
 =========================

 s: Save CSIx, VISS and LDC outputs

 p: Print performance statistics

 x: Exit

 Enter Choice: 


 =========================
 Demo : Camera Demo
 =========================

 s: Save CSIx, VISS and LDC outputs

 p: Print performance statistics

 x: Exit

 Enter Choice:    208.607893 s: ISS: Starting sensor [SG2-IMX390C-5200-FPDLINK] ... !!!
appStartImageSensor returned with status: 0
x

   350.913897 s: ISS: Stopping sensor [SG2-IMX390C-5200-FPDLINK] ... !!!
   351.041879 s: ISS: Stopping sensor [SG2-IMX390C-5200-FPDLINK] ... Done !!!
App Run Graph Done! 
Capture delete done!
VISS delete done!
AEWB delete done!
LDC delete done!
srv delete done!
fmt conversion detele done
scaler deinit done!
Img Mosaic delete done!
Display delete done!
[MCU2_0]    351.113825 s: ==========================================================
[MCU2_0]    351.113921 s:  Capture Status: Instance|0
[MCU2_0]    351.113960 s: ==========================================================
[MCU2_0]    351.114008 s:  overflowCount: 0
[MCU2_0]    351.114045 s:  spuriousUdmaIntrCount: 0
[MCU2_0]    351.114083 s:  frontFIFOOvflCount: 0
[MCU2_0]    351.114118 s:  crcCount: 1
[MCU2_0]    351.114148 s:  eccCount: 0
[MCU2_0]    351.114182 s:  correctedEccCount: 0
[MCU2_0]    351.114218 s:  dataIdErrorCount: 0
[MCU2_0]    351.114255 s:  invalidAccessCount: 0
[MCU2_0]    351.114292 s:  invalidSpCount: 0
[MCU2_0]    351.114332 s:  strmFIFOOvflCount[0]: 0
[MCU2_0]    351.114363 s:  Channel Num | Frame Queue Count | Frame De-queue Count | Frame Drop Count | Error Frame Count |
[MCU2_0]    351.114445 s:            0 |              4269 |                 4269 |                2 |                 0 |
[MCU2_0]    351.114524 s:            1 |              4269 |                 4269 |                2 |                 0 |
[MCU2_0]    351.114658 s:            2 |              4269 |                 4269 |                1 |                 0 |
[MCU2_0]    351.114746 s:            3 |              4269 |                 4269 |                1 |                 0 |
[MCU2_0]    351.131209 s: ==========================================================
[MCU2_0]    351.131307 s:  Display M2M Status: Instance|0
[MCU2_0]    351.131347 s: ==========================================================
[MCU2_0]    351.131398 s:  Queue Count: 1067
[MCU2_0]    351.131435 s:  De-queue Count: 1067
[MCU2_0]    351.131476 s:  Write-back Frames Count: 1067
[MCU2_0]    351.131514 s:  Underflow Count: 0
Graph delete done!
App Delete Graph Done! 
   351.154918 s: ISS: De-initializing sensor [SG2-IMX390C-5200-FPDLINK] ... !!!
   351.155310 s: ISS: De-initializing sensor [SG2-IMX390C-5200-FPDLINK] ... Done !!!
Sensor deinit done!
Capture deinit done!
LDC deinit done!
srv deinit done!
fmt conversion deinit done!
scaler deinit done!
Img Mosaic deinit done!
Display deinit done!
appGrpxDeInit done
Kernels unload done!
Release context done!
App De-init Done! 
   351.597698 s:  VX_ZONE_INIT:[tivxHostDeInitLocal:100] De-Initialization Done for HOST !!!
   351.602214 s:  VX_ZONE_INIT:[tivxDeInitLocal:193] De-Initialization Done !!!
APP: Deinit ... !!!
REMOTE_SERVICE: Deinit ... !!!
REMOTE_SERVICE: Deinit ... Done !!!
IPC: Deinit ... !!!
IPC: DeInit ... Done !!!
MEM: Deinit ... !!!
DDR_SHARED_MEM: Alloc's: 85 alloc's of 183982428 bytes 
DDR_SHARED_MEM: Free's : 85 free's  of 183982428 bytes 
DDR_SHARED_MEM: Open's : 0 allocs  of 0 bytes 
DDR_SHARED_MEM: Total size: 536870912 bytes 
MEM: Deinit ... Done !!!
APP: Deinit ... Done !!!

Can M2M be considered as a single channel input when accepting the output of SRV? When do I need to use vxReplicateNode()? Why set node parameters for m2m input? How can I modify it? Can you give me some suggestions?

Thanks.

  • Hi,

    Yes, DSS M2M node can support single channel input and when it is working in single channel input mode, please dont call vxReplicateNode for this node. Also when you are not calling vxReplicateNode, please use separate vx_image as output image, instead of an instance of object array. This should solve both of the issues. 

    Regards,

    Brijesh

  • Thank you for your reply.

    You mean to change the output of m2m to vx_image type but the input of scaler is vx_object_array, please how to convert vx_image to vx_object_array?

    I add codes between m2m node and asacler node, shown in the first txt. I know this  is wrong. And only shows pink on the screen , shown in fig.1. How do I change it and where do I place it?

    static vx_status MapImageToArray(vx_context context, vx_object_array *array, vx_image in_img)
    {
        vx_status status = VX_SUCCESS;
        vx_rectangle_t rect;
        vx_imagepatch_addressing_t in_addr, out_addr;
        vx_map_id map_id_in;
        vx_map_id map_id_out;
    
        void * in_ptr, *out_ptr;
        vx_uint32  img_width;
        vx_uint32  img_height;
        vx_uint32  y;
        vx_image   out_img;
        out_img = (vx_image)vxGetObjectArrayItem((*array), 0);
    
        vxQueryImage(out_img, VX_IMAGE_WIDTH, &img_width, sizeof(vx_uint32));
        vxQueryImage(out_img, VX_IMAGE_HEIGHT, &img_height, sizeof(vx_uint32));
    
    
        rect.start_x = 0;
        rect.start_y = 0;
        rect.end_x = img_width;
        rect.end_y = img_height;
        status = vxMapImagePatch(in_img,&rect,0,&map_id_in,&in_addr,&in_ptr,VX_READ_ONLY,VX_MEMORY_TYPE_HOST,VX_NOGAP_X);
        if(status == VX_SUCCESS)
        {
            status = vxMapImagePatch(out_img,&rect,0,&map_id_out,&out_addr,&out_ptr,VX_WRITE_ONLY,VX_MEMORY_TYPE_HOST,VX_NOGAP_X);
        }
        printf("in_addr.dim_y, out_addr.dim_y, in_addr.stride_y:%d, %d, %d\n",in_addr.dim_y, out_addr.dim_y, in_addr.stride_y);
        if(status == VX_SUCCESS)
        {
            for(y = 0; y < in_addr.dim_y; y++)
            {
                void *in_ptr_y = in_ptr + y * in_addr.stride_y;
                void *out_ptr_y = out_ptr + y * out_addr.stride_y;
    
                memcpy(out_ptr_y, in_ptr_y, in_addr.stride_y);
            }
            printf("COPY DONE\n");
        }
        status = vxUnmapImagePatch(in_img, map_id_in);
        if(status == VX_SUCCESS)
        {
            status = vxUnmapImagePatch(out_img, map_id_out);
        }
        return status;
    
    }

    Also, for a scaler node, what if the input is also single channel? I found that the scaler node of the demo app_tidi_od receives single channel data with two outputs, vxRepliacate() is called.


    Here's the code for my m2m node creation as well as graph creation.
    Thank you.

    vx_status app_create_graph_fmt_conv(vx_graph graph, FmtConvObj *obj, vx_image input)
    {
        vx_status status = VX_SUCCESS;
        /* 
        fmtObj->output_img  = vxCreateImage(context,
        sensorObj->sensorParams.sensorInfo.raw_params.width,
        sensorObj->sensorParams.sensorInfo.raw_params.height,
        fmtObj->color_format); 
        */
        obj->node = tivxDisplayM2MNode(graph, obj->m2m_obj, input, obj->output_img);
        status = vxGetStatus((vx_reference)obj->node);
    
        if(status == VX_SUCCESS)
        {
            vxSetNodeTarget(obj->node, VX_TARGET_STRING, TIVX_TARGET_DISPLAY_M2M1);
            vxSetReferenceName((vx_reference)obj->node, "FmtConvNode");
        }
        else
        {
            printf("[FMT-CONV-MODULE] Unable to create scaler node! \n");
        }
    
        //vxReleaseImage(&input);
        // vxReleaseImage(&output);
    
        return status;

     if(obj->sensorObj.enable_ldc == 1)
        {
            vx_object_array ldc_in_arr;
            if(1 == obj->enable_viss)
            {
                ldc_in_arr = obj->vissObj.output_arr;
            }
            else
            {
                ldc_in_arr = obj->captureObj.raw_image_arr[0];
            }
            if (status == VX_SUCCESS)
            {
                status = app_create_graph_ldc(obj->graph, &obj->ldcObj, ldc_in_arr);
                APP_PRINTF("LDC graph done!\n");
            }
            // obj->imgMosaicObj.input_arr[idx++] = obj->ldcObj.output_arr;
        }
    
        if(obj->enable_srv == 1 && status == VX_SUCCESS)
        {
            status = app_create_graph_srv(obj->context, obj->graph, &obj->srvObj, obj->ldcObj.output_arr);
            APP_PRINTF("srv graph done!\n");
        }
    
        if(obj->enable_m2m == 1 && status == VX_SUCCESS)
        {
            status = app_create_graph_fmt_conv(obj->graph, &obj->fmtConvObj, obj->srvObj.output_img);
            APP_PRINTF("fmt conversion graph done!\n");
        }
        /* vx_object_array fmtConvObj_out_arr: trans m2m vx_image to vx_object_array
        test error
        */
        obj->fmtConvObj_out_arr = vxCreateObjectArray(obj->context, (vx_reference)obj->fmtConvObj.output_img, 1);
        status = MapImageToArray(obj->context, &obj->fmtConvObj_out_arr, obj->fmtConvObj.output_img);
        
    
        if(obj->enable_scaler == 1 && status == VX_SUCCESS)
        {
            /* input ch:1   output: 1*/
            status = app_create_graph_scaler(obj->context, obj->graph, &obj->scalerObj, obj->fmtConvObj_out_arr);
            APP_PRINTF("scaler graph done!\n");
        }
        vx_int32 idx = 0;
        vx_image display_in_image;
        if(obj->enable_mosaic == 1)
        {
            if(obj->enable_scaler == 1)
            {
                obj->imgMosaicObj.input_arr[idx++] = obj->scalerObj.output[0].arr;
                APP_PRINTF("enable_mosaic and enable_scaler!\n");
            }
            else
            {
                obj->imgMosaicObj.input_arr[idx++] = obj->fmtConvObj_out_arr;
            }
    
            obj->imgMosaicObj.num_inputs = idx;
    
            if(status == VX_SUCCESS)
            {
                status = app_create_graph_img_mosaic(obj->graph, &obj->imgMosaicObj, NULL);
                APP_PRINTF("Img Mosaic graph done!\n");
            }
            display_in_image = obj->imgMosaicObj.output_image[0];
        }
        else
        {
            display_in_image = (vx_image)vxGetObjectArrayItem(obj->fmtConvObj_out_arr, 0);
            //display_in_image = obj->fmtConvObj.output_img;
    
        }
    
    
        if(status == VX_SUCCESS)
        {
            if(obj->enable_mosaic)
            {
                status = app_create_graph_display(obj->graph, &obj->displayObj, display_in_image);
            }
            else
            {
                printf("m2m output\n");
                status = app_create_graph_display(obj->graph, &obj->displayObj, display_in_image);
            }
            APP_PRINTF("Display graph done!\n");
        }
    
    #if ENABLE_SWITCH_CH
        obj->channel_prms.active_channel_id = 0;
        obj->switch_ch_obj = vxCreateUserDataObject(obj->context,
            "tivx_display_select_channel_params_t",
            sizeof(tivx_display_select_channel_params_t), &obj->channel_prms);
        if (vxGetStatus((vx_reference)obj->switch_ch_obj) != VX_SUCCESS)
        {
            APP_PRINTF("switch_ch_obj create failed\n");
        }
    
        obj->refs[0] = (vx_reference)obj->switch_ch_obj;
    #endif
    
        if(status == VX_SUCCESS)
        {
            graph_parameter_index = 0;
            add_graph_parameter_by_node_index(obj->graph, obj->captureObj.node, 1);
            obj->captureObj.graph_parameter_index = graph_parameter_index;
            graph_parameters_queue_params_list[graph_parameter_index].graph_parameter_index = graph_parameter_index;
            graph_parameters_queue_params_list[graph_parameter_index].refs_list_size = APP_BUFFER_Q_DEPTH;
            graph_parameters_queue_params_list[graph_parameter_index].refs_list = (vx_reference*)&obj->captureObj.raw_image_arr[0];
            graph_parameter_index++;
    
            status = vxSetGraphScheduleConfig(obj->graph,
                    VX_GRAPH_SCHEDULE_MODE_QUEUE_AUTO,
                    graph_parameter_index,
                    graph_parameters_queue_params_list);
    
            if (status == VX_SUCCESS)
            {
                status = tivxSetGraphPipelineDepth(obj->graph, APP_PIPELINE_DEPTH);
            }
            if((obj->enable_viss == 1) && (status == VX_SUCCESS))
            {
                status = tivxSetNodeParameterNumBufByIndex(obj->vissObj.node, 6, APP_BUFFER_Q_DEPTH);
    
                if (status == VX_SUCCESS)
                {
                    status = tivxSetNodeParameterNumBufByIndex(obj->vissObj.node, 9, APP_BUFFER_Q_DEPTH);
                }
            }
            if((obj->enable_aewb == 1) && (status == VX_SUCCESS))
            {
                if (status == VX_SUCCESS)
                {
                    status = tivxSetNodeParameterNumBufByIndex(obj->aewbObj.node, 4, APP_BUFFER_Q_DEPTH);
                }
            }
    
            if((obj->sensorObj.enable_ldc == 1) && (status == VX_SUCCESS))
            {
                status = tivxSetNodeParameterNumBufByIndex(obj->ldcObj.node, 7, APP_BUFFER_Q_DEPTH);
                APP_PRINTF("ldc Pipeline params setup done!\n");
            }
            if((obj->enable_srv == 1) && (status == VX_SUCCESS))
            {
            
                status = tivxSetNodeParameterNumBufByIndex(obj->srvObj.node, 4, APP_BUFFER_Q_DEPTH);
                APP_PRINTF("SRV Pipeline params setup done!\n");
            }
            if((obj->enable_m2m == 1) && (status == VX_SUCCESS))
            {
                //status = tivxSetNodeParameterNumBufByIndex(obj->fmtConvObj.node, 1, APP_BUFFER_Q_DEPTH);
                status = tivxSetNodeParameterNumBufByIndex(obj->fmtConvObj.node, 2, APP_BUFFER_Q_DEPTH);
                
                APP_PRINTF("fmt conversion Pipeline params setup done!\n");
            }
            if((obj->enable_scaler == 1) && (status == VX_SUCCESS))
            {
            
                status = tivxSetNodeParameterNumBufByIndex(obj->scalerObj.node, 1, APP_BUFFER_Q_DEPTH);
                APP_PRINTF("scaler Pipeline params setup done!\n");
            }
    
            if((obj->enable_mosaic == 1) && (status == VX_SUCCESS))
            {
                status = tivxSetNodeParameterNumBufByIndex(obj->imgMosaicObj.node, 1, APP_BUFFER_Q_DEPTH);
                APP_PRINTF("MOSAIC Pipeline params setup done!\n");
            }
        }
    
        return status;

  • Has there been any update on this issue?

    thank you. 

  • Hi Yang,

    Are you still facing this issue? 

    Regards,

    Brijesh