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: Does the DSS m2m module support scaling and format conversion at 3840*2160 resolution?

Part Number: TDA4VM

Hi,experts

The data I collected from the camera is in YUV422 format, with a resolution of 3840*2160.

I want to use the DSS m2m module, scale it to 1920*1080 resolution, and convert the format to NV12.

But I found that the converted image is incorrect. The converted image only has half the content of the original image, and the left and right halves of the image are the same.

But when I convert an image with format YUV422 and resolution 1920*1080 to 1280*720 and format NV12, there is no problem.

So, does the DSS m2m module support scaling and format conversion at 3840*2160 resolution?

Best regards,

Tao

  • Hi Tao,

    Yes, DSS M2M can support this resolution. Can you first check if you can do first format conversion without scaling? Lets see if this works fine first. 

    Regards,

    Brijesh

  • Btw, which SDK release are you using? I remember there was a bug in the SDK in scale factor calculation. Can you please use latest release to check this? 

  • Hi,Brijesh

    Btw, which SDK release are you using?

    RTOS SDK version: ti-processor-sdk-rtos-j721e-evm-08_01_00_11

    Linux SDK version: ti-processor-sdk-linux-j7-evm-08_01_00_07

    Can you first check if you can do first format conversion without scaling?

    I just gave it a try and only did format conversion without scaling. But the problem remains the same.

    This is the original image.

    This is the image after format conversion.

    This is the DSS m2m node I created and its corresponding configuration.

        tivx_display_m2m_params_t local_m2m_config;
        tivx_display_m2m_params_init(&local_m2m_config);
        local_m2m_config.instId     = 0;
        /* Only one pipeline is supported */
        local_m2m_config.numPipe    = 1;
        local_m2m_config.pipeId[0U] = 3;
        local_m2m_config.overlayId  = 3;
        
        if (status == (vx_status)VX_SUCCESS)
        {
            m2m_config = vxCreateUserDataObject(usecase->context,
                                                "tivx_display_m2m_params_t",
                                                sizeof(tivx_display_m2m_params_t),
                                                &local_m2m_config);
    
            usecase->format_node = tivxDisplayM2MNode(graph, m2m_config, usecase->N1O, usecase->N2O);
            status = vxSetReferenceName( (vx_reference)usecase->format_node, "format_node");
            if (status == (vx_status)VX_SUCCESS)
            {
                status = vxSetNodeTarget(usecase->format_node, VX_TARGET_STRING, TIVX_TARGET_DISPLAY_M2M1);
            }
        }

    Best regards,

    Tao

  • Hi Tao,

    Can you please check if below code is present in pdk/packages/ti/csl/src/ip/dss/V4/priv/csl_dssVideoPipe.c file? 

    static void CSL_dssVidPipeSetFir(CSL_dss_pipeRegs *pipeRegs,
                                     uint32_t inSizeX,
                                     uint32_t inSizeY,
                                     uint32_t outSizeX,
                                     uint32_t outSizeY)
    {
        uint64_t tempFirHinc, tempFirVinc;
        uint32_t firHinc, firVinc, regVal;
    
        tempFirHinc = ((0x200000U * ((uint64_t)inSizeX)) / ((uint64_t)outSizeX));
        tempFirVinc = ((0x200000U * ((uint64_t)inSizeY)) / ((uint64_t)outSizeY));
        firHinc = (uint32_t)tempFirHinc;
        firVinc = (uint32_t)tempFirVinc;
        regVal = CSL_REG32_RD(&pipeRegs->FIRH);
        CSL_FINS(regVal,
                 DSS_VID1_FIRH_FIRHINC,
                 firHinc);
        CSL_REG32_WR(&pipeRegs->FIRH, regVal);
        regVal = CSL_REG32_RD(&pipeRegs->FIRV);
        CSL_FINS(regVal,
                 DSS_VID1_FIRV_FIRVINC,
                 firVinc);
        CSL_REG32_WR(&pipeRegs->FIRV, regVal);
    }
    

    There is a similar fix in pdk/packages/ti/csl/src/ip/dss/V4/priv/csl_dssWbPipe.c file. 

    static void CSL_dssWbPipeSetFir(CSL_dss_wbRegs *wbRegs,
                                     uint32_t inSizeX,
                                     uint32_t inSizeY,
                                     uint32_t outSizeX,
                                     uint32_t outSizeY)
    {
        uint64_t tempFirHinc, tempFirVinc;
        uint32_t firHinc, firVinc, regVal;
    
        tempFirHinc = ((0x200000U * ((uint64_t)inSizeX)) / ((uint64_t)outSizeX));
        tempFirVinc = ((0x200000U * ((uint64_t)inSizeY)) / ((uint64_t)outSizeY));
        firHinc = (uint32_t)tempFirHinc;
        firVinc = (uint32_t)tempFirVinc;
        regVal = CSL_REG32_RD(&wbRegs->FIRH);
        CSL_FINS(regVal,
                 DSS_WB_FIRH_FIRHINC,
                 firHinc);
        CSL_REG32_WR(&wbRegs->FIRH, regVal);
        regVal = CSL_REG32_RD(&wbRegs->FIRV);
        CSL_FINS(regVal,
                 DSS_WB_FIRV_FIRVINC,
                 firVinc);
        CSL_REG32_WR(&wbRegs->FIRV, regVal);
    }
    

    Regards,

    Brijesh

  • Hi, Brijesh

    These codes are present in both files.

    Best regards,

    Tao

  • Hi Tao,

    ok, can you please not even do format conversion? Just use same input and output format and see how the output look? 

    There was a somewhat similar issue on below link. It worked fine on SDK8.2 release.

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1120996/tda4vm-how-to-convert-yuv420-nv12-to-bgr888/4170230#4170230

    Regards,

    Brijesh

  • Hi,Brijesh

    ok, can you please not even do format conversion? Just use same input and output format and see how the output look? 

    In this case, the input image and output image are the same.

    Best regards,

    Tao

  • Hi Tao,

    ok, so seems the issue is with scaling. Is it possible for you try out 3-tap filter, instead of 5-tap for scaling operation? Most likely DSS M2M node uses scalar in the WB path, so can you try changing filter to 3-tap and see if it works?

    Regards,

    Brijesh

  • Hi, Brijesh

    so can you try changing filter to 3-tap and see if it works?

    Okay, but what should I do? Which parameter should be modified?

    In addition, I found that the DSS m2m module can scale the image with a resolution of 3840*1080 to 1920*1080.

    Best regards,

    Tao

  • Hi Tao,

    ok, bit confused. So what's not working? Scaling + format conversion? 

    In order to change to 3-tap filter, please change the API CSL_dssWbPipeSetConfig in packages/ti/csl/src/ip/dss/V4/priv/csl_dssWbPipe.c file.

    Regards,

    Brijesh

  • Hi, Brijesh

    These are several situations that I am currently aware of.

    YUV422 3840*2160 -------format and scale-------> YUV420 1920*1080    FAILED

    YUV422 3840*2160 -------format-------> YUV420 3840*2160                    FAILED

    YUV422 3840*2160 -------scale-------> YUV422 1920*1080                      FAILED

    YUV422 3840*1080 -------scale-------> YUV422 1920*1080                      SUCCESSED

    Best regards,

    Tao

  • Hi Tao,

    ok, is it possible for you to share this test case to try it on EVM? 

    Regards,

    Brijesh

  • Hi, Brijesh

    Good news!

    After I use 3-tap filter, The following two situations can be successful.

    YUV422 3840*2160 -------scale-------> YUV422 1920*1080       SUCCESSED

    YUV422 3840*2160 -------format------> YUV420 3840*2160       SUCCESSED

    But when I tried to complete the conversion and scaling all at once, the program got stuck.

    YUV422 3840*2160 -------scale and format------> YUV420 1920*1080   FAILED

    Then I tried to do it in two steps, the first step was to achieve scaling, the second step was to achieve format conversion, and then I obtained an image with a resolution of 1920*1080 and a format of YUV420, and the data was correct.

    YUV422 3840*2160 -------scale-------> YUV422 1920*1080       SUCCESSED

    YUV422 1920*1080 -------format------> YUV420 1920*1080       SUCCESSED

    At present, although it needs to be completed in two steps, I have achieved the desired result anyway. Thank you for your support. Of course, I still want to ask, do you know why scaling and conversion cannot be completed simultaneously?

    Of course, if you want, I can close this thread now.

    Best regards,

    Tao

  • Hi Tao,

    It should work, but not sure, we will have to check register settings and see if anything is missing. If possible, can you please share this test case for the debug?

    Regards,

    Brijesh

  • Hi, Brijesh

    If possible, can you please share this test case for the debug?

    Due to the inclusion of camera nodes in our routine, the DSS module receives data from the camera nodes. Therefore, without the camera and its driver, this routine cannot be run. If I want to test the DDS m2m module separately, I need to rebuild a routine that only uses the DDS m2m module and read data from the file. But yesterday I wanted to upload the original data of YUV422, but the website told me that it could not be uploaded. Maybe the file was too large, and it was 16MB.

    So this matter is a bit troublesome and will take some time, but now I need to do the H264 encoding of the converted data.

    In addition, I studied the reasons why the program got stuck when performing format conversion and scaling simultaneously. In fact, the program did not get stuck, it was waiting for the driver to complete processing, so it stopped at this location:

    /* Wait for Frame Completion */
    tivxEventWait(drvObj->waitForProcessCmpl, TIVX_EVENT_TIMEOUT_WAIT_FOREVER);
    Therefore, it seems that there was a problem with the driver and the conversion was not completed.
    Best regards,
    Tao
  • Hi Tao,

    ok, let me see if there is any existing test case that can be used to test this feature.

    But, yes, if it gets stuck here in semaphore wait, that means driver is not getting completion callback from the HW and so HW is stuck when doing this operation. This seems to be different problem then what you were seeing earlier, which was incorrect output. 

    Could you please confirm that the only change you did in the driver is to change the number of taps to 3? 

    Regards,

    Brijesh

  • Hi, Brijesh

    Could you please confirm that the only change you did in the driver is to change the number of taps to 3? 

    Yes, the only change I did in the driver is to change the number of taps to 3.

    I just changed

    ‘verticalTaps = CSL_DSS_WB_ATTRIBUTES_VERTICALTAPS_VAL_TAPS5; ’
    to
    'verticalTaps = CSL_DSS_WB_ATTRIBUTES_VERTICALTAPS_VAL_TAPS3;'
    Best regards,
    Tao
  • Hi Tao,

    Thanks. Will try to recreate the issue.

    Regards,

    Brijesh

  • Hi Tao,

    Can you please share the input image that you are using or can you save one 3840x2160 YUV422 image? I want to try recreating this issue using a standalone example.

    Regards,

    Brijesh

  • Hi, Brijesh

    The compressed package contains a raw data of  3840x2160 YUV422 and a parsed image. Please check.

    [PDK-13191] [DSS M2M]: Scaling and Format conversion causes hang in the DSS M2M path for higher resolution - Texas Instruments JIRA

    Also, I am unable to access this link. If the problem is resolved, can you notify me under this post?

    YUV422_Data.zip

    Best regards,

    Tao

  • Hi Tao,

    I suspect there is some limitation in WB scalar when used with format conversion, as per below statement. Because of this the output seems to be repeated after 896 pixels and chroma also seems to be getting repeated/corrupted. 

    Instead of using WB pipeline, we can use video pipeline to do this scaling. I tested this with DSS WB standalone PDK example by enabling scaling in video pipeline and it works fine.. But this would require some changes in the vision apps and probably tiovx. We would have to use VID1 or VID2 pipeline for the WB pipeline. 

    Are you using display in your project? If yes, what all pipelines and how many pipelines are you using? If VID pipeline is free, i can make the change and share it. 

    Regards,

    Brijesh

  • Hi, Brijesh

    Currently, our application does not require display, I only use WB pipeline for conversion.

    So, can you share the usage of VID pipeline?

    Best Regards,

    Tao

  • Hi Tao,

    The first part of this is to use different pipeline id for display m2m path. Please find attached patch which uses VID2 pipeline for the display m2m path. 

    In the default SDK, we are using VIDL2 pipeline for the display m2m path. With this patch, VIDL2 pipeline is used in display path and VID2 can now be used for display m2m path.

    /cfs-file/__key/communityserver-discussions-components-files/791/DSS_5F00_M2M_5F00_Use_5F00_VID2_5F00_PIPE.patch

    I now work on getting scalar enabled in the VID2 pipeline and will share you new patch.

    Regards,

    Brijesh

  • ok done, please apply attached patch on ti-processor-sdk-rtos-j721e-evm-08_06_00_12\tiovx folder and try it for 3840x2160 input resolution and also for format conversion? 

    /cfs-file/__key/communityserver-discussions-components-files/791/DSS_5F00_M2M_5F00_Added_5F00_Scalar_5F00_Support_5F00_In_5F00_VID_5F00_Pipe.patch

    Regards,

    Brijesh

  • Hi, Brijesh

    Thank you for providing the patch. It is valid and I can now complete both scaling and format conversion simultaneously.

    Best Regards,

    Tao