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.

TDA4VH-Q1: How to use two different LDC bin files in one wrd folder

Part Number: TDA4VH-Q1

Tool/software:

Hello Team,

I have two LDC node one is for driver side camera for that I want to rotate image anti clockwise 90 degrees and

another LDC node for passenger side camera and rotate image anti clockwise 90 degrees and flip horizontally

for this operation I am using 

 https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1058565/faq-tda4vm-how-to-create-a-ldc-mesh-lut-for-fisheye-distortion-correction-on-tda4?keyMatch=LDC%20FAQ

and I am able to generate LDC XML and LUT files one for driver side image and another is for passenger side, 

 question are:

Q1. as we copy this file in imaging\wrd folder then build the generator.sh file and generate .bin file which are used by our application for LDC correction so How can I add 2 different LDC XML and LUT files in single wdr folder?

Q2. how can we use driver side LDC node -> anti clock 90 rotation and passenger side -> anti clock 90 rotation and flip bin files from wrd folder?

Please guide me,

Thank you,

Vaishnavi Jangle

  • Hi Vaishnavi,

    I have two LDC node

    Each of you LDC node can take it is own LDC input.

    How can I add 2 different LDC XML and LUT files in single wdr folder?

    You may modify the bash script for generating 2 separate LDC bin files.

    Q2. how can we use driver side LDC node -> anti clock 90 rotation and passenger side -> anti clock 90 rotation and flip bin files from wrd folder?

    You may let your 2x LDC nodes to use its corresponding LDC binary file.

  • Hi Gang,

    I have created 2 ldc XML and LUT files from DCC tool for driver side and passenger side image and copied in wrd folder and updated in bash script as follow:

    rm *.bin
    rm $OUT_PATH/dcc_ldc_ds_ar0233_wdr.h
    $DCC_TOOL_PATH/dcc_gen_linux AR0233_mesh_ldc2_dcc_ds_ldc.xml
    cat *.bin > ../../dcc_bins/dcc_ldc_ds_wdr.bin
    $DCC_TOOL_PATH/dcc_bin2c ../../dcc_bins/dcc_ldc_ds_wdr.bin $OUT_PATH/dcc_ldc_ds_ar0233_wdr.h dcc_ldc_ds_ar0233_wdr
    
    rm *.bin
    rm $OUT_PATH/dcc_ldc_ps_ar0233_wdr.h
    $DCC_TOOL_PATH/dcc_gen_linux AR0233_mesh_ldc2_dcc_ps_ldc.xml
    cat *.bin > ../../dcc_bins/dcc_ldc_ps_wdr.bin
    $DCC_TOOL_PATH/dcc_bin2c ../../dcc_bins/dcc_ldc_ps_wdr.bin $OUT_PATH/dcc_ldc_ps_ar0233_wdr.h dcc_ldc_ps_ar0233_wdr

    after running bash script, 2 bin files are generated in bin folder and header files in include folder as follow

    Question:

    Q1.  are the above steps correct?

    Q2. if yes then how can I used .bin files for respective image in node_ldc.c

    static vx_status set_prms_ldc(vx_context context, SensorObj *sensorObj, LDCObj *ldcObj)
    {
       vx_status status = VX_SUCCESS;
    
       tivx_vpac_ldc_params_t params_ldc;
    
       vx_size dcc_buff_size_ldc;
       vx_map_id dcc_ldc_buf_map_id;
       uint8_t *dcc_ldc_buf;
    
       ldcObj->image_width = sensorObj->image_width;
       ldcObj->image_height = sensorObj->image_height;
    
       tivx_vpac_ldc_params_init(&params_ldc);
       params_ldc.luma_interpolation_type = TIVX_VPAC_LDC_INTERPOLATION_BILINEAR;
       params_ldc.dcc_camera_id = sensorObj->sensorParams.dccId;
    
       ldcObj->config = vxCreateUserDataObject(context,
                                               "tivx_vpac_ldc_params_t",
                                               sizeof(tivx_vpac_ldc_params_t),
                                               &params_ldc);
    
       /* Creating DCC */
       dcc_buff_size_ldc = appIssGetDCCSizeLDC(sensorObj->sensor_name, sensorObj->sensor_wdr_enabled);
       GEN3_DBG_PRINTF("dcc_buff_size_ldc: %d!\n", (uint32_t)dcc_buff_size_ldc);
    
       ldcObj->dcc_config = vxCreateUserDataObject(context,
                                                   "dcc_ldc",
                                                   dcc_buff_size_ldc,
                                                   NULL);
    
       status = vxMapUserDataObject(ldcObj->dcc_config,
                                    0,
                                    dcc_buff_size_ldc,
                                    &dcc_ldc_buf_map_id,
                                    (void **)&dcc_ldc_buf,
                                    VX_WRITE_ONLY,
                                    VX_MEMORY_TYPE_HOST,
                                    0);
       memset(dcc_ldc_buf, 0xAB, dcc_buff_size_ldc);
    
       status = appIssGetDCCBuffLDC(sensorObj->sensor_name,
                                    sensorObj->sensor_wdr_enabled,
                                    dcc_ldc_buf,
                                    dcc_buff_size_ldc);
    
       status = vxUnmapUserDataObject(ldcObj->dcc_config, dcc_ldc_buf_map_id);
       /* Done w/ DCC */
    
       return status;
    }
    
    vx_status create_node_ldc(vx_context context,
                              vx_graph graph,
                              graph_hdlr_type_te graph_hdlr_type,
                              SensorObj *sensorObj,
                              vx_image ldc_in_img_cl2_cl4,
                              LDCObj *ldcObj)
    {
       vx_status status = VX_SUCCESS;
    
       /* ldc params */
       vx_image sample_ldc_out_nv12_img;
       vx_image ldc_out_img_cl2_cl4, ldc_out_img_cl2_cl4_op;
    
       vx_bool ldc_prms_replicate[] = {vx_false_e,
                                       vx_false_e, vx_false_e, vx_false_e, vx_false_e, vx_false_e,
                                       vx_true_e,
                                       vx_true_e, vx_false_e};
    
       status = set_prms_ldc(context, sensorObj, ldcObj);
    
       /* Allocate sample NV12 image, using which object array of NV12 images is created */
       sample_ldc_out_nv12_img = vxCreateImage(context, ldcObj->image_width, ldcObj->image_height, VX_DF_IMAGE_NV12);
    
       /* allocate object array for ldc output frames */
       ldcObj->out_arr = vxCreateObjectArray(context,
                                             (vx_reference)sample_ldc_out_nv12_img,
                                             NUM_OF_CAMERAS);
       /* Get one NV12 image for ldc initialization */
       ldc_out_img_cl2_cl4 = (vx_image)vxGetObjectArrayItem(ldcObj->out_arr, 0);
    
       ldcObj->node = tivxVpacLdcNode(graph,
                                      ldcObj->config,
                                      NULL, NULL, NULL, NULL, ldcObj->dcc_config,
                                      ldc_in_img_cl2_cl4,
                                      ldc_out_img_cl2_cl4, NULL);

  • Hi Vaishnavi,

    Q1.  are the above steps correct?

    Yes, that looks correct to me.

    Q2. if yes then how can I used .bin files for respective image in node_ldc.c

    The 7th input parameter "ldcObj->dcc_config" for "tivxVpacLdcNode" should be from your bin file.

  • Hi Gang,

    right, but while get DCC buffer size from below function

    dcc_buff_size_ldc = appIssGetDCCSizeLDC(sensorObj->sensor_name, sensorObj->sensor_wdr_enabled);
    GEN3_DBG_PRINTF("dcc_buff_size_ldc: %d!\n", (uint32_t)dcc_buff_size_ldc);

    we can load one buffer at a time, as shown in app_iss_common.c

    #if defined (SOC_J721E) || defined (SOC_J721S2) || defined (SOC_J784S4)
                    else if (0 == strcmp(sensor_name, SENSOR_SONY_IMX390_UB953_DISCOVERY_MID))
                        size = DCC_LDC_IMX390_DISCOVERY_MID_WDR_DCC_CFG_NUM_ELEM;
                    else if (0 == strcmp(sensor_name, SENSOR_SONY_IMX390_UB953_DISCOVERY_NARROW)){
                        printf("********************imx390 Discovery %s [%d]********************\n", __func__, __LINE__);
                        size = DCC_LDC_IMX390_DISCOVERY_NARROW_WDR_DCC_CFG_NUM_ELEM;
                    }
                    else if (0 == strcmp(sensor_name, SENSOR_SONY_IMX390_UB953_DISCOVERY_WIDE))
                        size = DCC_LDC_IMX390_DISCOVERY_WIDE_WDR_DCC_CFG_NUM_ELEM;
    #endif
                    else if (0 == strcmp(sensor_name, SENSOR_ONSEMI_AR0233_UB953_MARS))
                        //size = DCC_LDC_AR0233_WDR_DCC_CFG_NUM_ELEM;
                        size = DCC_LDC_AR0233_WDR_DATA;
                    else if (0 == strcmp(sensor_name, SENSOR_ONSEMI_AR0820_UB953_LI))
                        size = DCC_LDC_AR0820_WDR_DCC_CFG_NUM_ELEM;
                    else
                        size = -1;
                    break;

    So, Can you please guide me

    Q1.how we can load multiple buffer (one for driver and passenger side ldc bin file)?

    Q2. Do you have any document for reference?

  • Hi Vaishnavi,

    we can load one buffer at a time, as shown in app_iss_common.c

    In our SDK sensor driver, it assumed a single camera or same configuration for the same camera type.
    The size and DCC data are saved in c header files by sensor driver.

    Your application goes beyond that assumption and you would have to make your own changes.
    If you use the binary files, you don't need to use the appIssGetDCCSizeLDC function.

    Q1.how we can load multiple buffer (one for driver and passenger side ldc bin file)?

    I am not an expert on openvx s/w, but I suppose you may read the bin files directly from your openvx application.
    The size is simply the size of the binary file.
    They don't have to be from sensor driver.

    Q2. Do you have any document for reference?

    I am not an s/w expert and I am not sure what document is right for you.
    You may refer to openvx documentation if you have any questions with using openvx LDC kernel.

    For reading binary files, it should be common C operations.