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: TDA4VM: How to use different coefficients in MSC

Part Number: TDA4VM

Hello, TI expert.

I was previously using Nearest neighbor with coefficient to resize MSC.
However, to use DOF, I found that I need to use a pyramid coefficient to make it work properly (TIVX_VPAC_MSC_CMD_SET_COEFF).
If I use TIVX_VPAC_MSC_CMD_SET_COEFF to set the coefficient of the MSC to use DOF, the problem occurs because the MSC does not use the nearest neighbor when resizing.

Is there a good way to solve this situation?

Thanks,

best regards.

  • Hyeonseong,

    Q) But I don't see any part in tivx_vpac_msc_output_params_t to set uv_mode, how can I set uv_mode in multi_phase mode?

    This is expected, as i guess you are using this scalar for NV12 format. In this case, each plane will be processed separately by the driver and request would be submitted two times inside the driver, first for luma and second for the chroma plane. For the second request, the only change would be uv_mode set to 1. Rest all config will remain same. 

    Q) After all, how should I configure tivx_vpac_msc_output_params_t output_params if I want set0 to use an NN resizer and set1 to use a Gaussian Filter?

    Set horz_coef_sel/vert_coef_sel to 0 in the first case and set it to 1 for the Gaussian filter. 

    For the Gaussian Filter, you might want to use single-phase coefficients, and not multi-phase coefficients. There are two sets of single phase coefficients available in the scalar coefficients, you can set them and then use them in the SET_OUTPUT_PARAMS ioctl.

    Regards,

    Brijesh 

  • Hi Brijesh, 

    Thanks to your support, TIVX_VPAC_MSC_CMD_SET_OUTPUT_PARAMS is now working properly. I have a questions.

    1. will our work be reflected in a future PSDK patch, and if so, in which PSDK version?

    --- vx_vpac_msc_pyramid_target_org.c	2023-11-08 14:45:52.165840348 +0900
    +++ vx_vpac_msc_pyramid_target.c	2023-11-08 14:39:59.645031537 +0900
    @@ -1155,8 +1155,17 @@
                 }
                 case TIVX_VPAC_MSC_CMD_SET_OUTPUT_PARAMS:
                 {
    -                status = tivxVpacMscPmdSetOutputParamsCmd(msc_obj,
    -                    (tivx_obj_desc_user_data_object_t **)&obj_desc[0U]);
    +                uint32_t cnt;
    +                tivx_obj_desc_user_data_object_t *data_obj[TIVX_PYRAMID_MAX_LEVEL_OBJECTS];
    +                
    +                VX_PRINT(VX_ZONE_ERROR, "TIVX_VPAC_MSC_CMD_SET_OUTPUT_PARAMS: num_params = %d\n",
    +                    num_params);
    +                    
    +                for (cnt = 0u; cnt < num_params; cnt ++)
    +                {
    +                    data_obj[cnt] = (tivx_obj_desc_user_data_object_t *)obj_desc[cnt];
    +                }
    +                status = tivxVpacMscPmdSetOutputParamsCmd(msc_obj, data_obj);
                     break;
                 }
                 default:
    @@ -1347,7 +1356,7 @@
         if ((gTivxVpacMscPmdInstObj[TIVX_VPAC_MSC_G_PMG_START_IDX].target_kernel == target_kernel) ||
             (gTivxVpacMscPmdInstObj[TIVX_VPAC_MSC_G_PMG_START_IDX+1U].target_kernel == target_kernel))
         {
    -        max_ds_factor = 2;
    +        max_ds_factor = 4;
         }
     
         /* TODO:
    @@ -1355,7 +1364,7 @@
          * on Khronos test.  However, when we relax this, it is better to put to 4 for
          * speed performance improvements.
          */
    -    max_ds_factor = 2;
    +    max_ds_factor = 4;
     
         if (NULL != msc_obj)
         {
    @@ -1732,15 +1741,15 @@
         ss_info = &msc_obj->ss_info[0u];
         for (cnt = 0u; cnt < msc_obj->num_pmd_levels; cnt ++)
         {
    -        if (NULL != usr_data_obj[cnt])
    +        if (NULL != usr_data_obj[0])
             {
    -            target_ptr = tivxMemShared2TargetPtr(&usr_data_obj[cnt]->mem_ptr);
    +            target_ptr = tivxMemShared2TargetPtr(&usr_data_obj[0]->mem_ptr);
     
    -            tivxCheckStatus(&status, tivxMemBufferMap(target_ptr, usr_data_obj[cnt]->mem_size,
    +            tivxCheckStatus(&status, tivxMemBufferMap(target_ptr, usr_data_obj[0]->mem_size,
                     (vx_enum)VX_MEMORY_TYPE_HOST, (vx_enum)VX_READ_ONLY));
     
                 if (sizeof(tivx_vpac_msc_output_params_t) ==
    -                    usr_data_obj[cnt]->mem_size)
    +                    usr_data_obj[0]->mem_size)
                 {
                     out_prms = (tivx_vpac_msc_output_params_t *)target_ptr;
     
    @@ -1765,7 +1774,7 @@
                     status = (vx_status)VX_ERROR_INVALID_PARAMETERS;
                 }
     
    -            tivxCheckStatus(&status, tivxMemBufferUnmap(target_ptr, usr_data_obj[cnt]->mem_size,
    +            tivxCheckStatus(&status, tivxMemBufferUnmap(target_ptr, usr_data_obj[0]->mem_size,
                     (vx_enum)VX_MEMORY_TYPE_HOST, (vx_enum)VX_READ_ONLY));
             }
             else
    @@ -1775,7 +1784,7 @@
             }
     
     
    -        if ((vx_status)VX_SUCCESS == status)
    +        if ((vx_status)VX_SUCCESS != status)
             {
                 break;
             }
    

    Regards,

    Hyeonseong

  • Hi Hyeonseong,

    I think the fix related max pyramid level will be available in the next release. But this second change is temporary fix. we should be able to get data descriptors for all pyramid level images. Somehow it is not correctly passed from the application. 

    Regards,

    Brijesh

    Regards,

    Brijesh

  • Hi Brijesh, 

    In the debug session with TI, I modified the code as below.
    However, when I built it with debug target, the code below causes a segemtation fault and dies. The problem seems to be that the number of refs is different from the number of num_ref.

    // before TI debugging session
    if (pyramid_node_ != nullptr && pyramid_coeff_ != nullptr) {
                vx_reference refs[1] = {(vx_reference)pyramid_coeff_};
                status = tivxNodeSendCommand(pyramid_node_, 0u, TIVX_VPAC_MSC_CMD_SET_COEFF, refs, 1u);
            }
    
    // after TI debugging session
    if (pyramid_node_ != nullptr && pyramid_coeff_ != nullptr) {
                vx_reference refs[1] = {(vx_reference)pyramid_coeff_};
                status = tivxNodeSendCommand(pyramid_node_, 0u, TIVX_VPAC_MSC_CMD_SET_COEFF, refs, 5u);
            }

    I think I can modify it like below, is it correct?

    vx_reference refs[pyramid_level_];
                for(uint32_t i = 0; i < pyramid_level_; i++) {
                    vx_reference refs[i] = (vx_reference)pyramid_coeff_;
                }
                status = tivxNodeSendCommand(pyramid_node_, 0u, TIVX_VPAC_MSC_CMD_SET_COEFF, refs, pyramid_level_);

    If this is correct, could you please explain the mechanism involved?

    Regards,

    Hyeonseong

  • Hyeonseong,

    As we discussed in the meeting, this command expects the list of references where the size of this list is equal to number of pyramid levels. So please make sure to pass 'n' number of references in the array, where 'n' is number of pyramid levels. 

    Regards,

    Brijesh