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.

RTOS/TDA2PXEVM: For adding vision sdk VPE link support convert YUV420 to RGB888 format

Part Number: TDA2PXEVM

Tool/software: TI-RTOS

hi all,

i refer the answer of e2e.ti.com/.../2794974

my link is : NullSource_Animation (A15) -> Decode -> VPE_Animation -> Display_vid3

i change the code to support convert YUV420 to RGB888  as following:

vpscore_vpeWb.c:

/* Even for YUV444 we need to use RGB888 data type */
            case FVID2_DF_YUV444I:
            case FVID2_DF_RGB24_888:
                /* Note: The R and B lines are connected to B and R ports of
                 * VPDMA. Hence need to use BGR datatype to capture RGB data and
                 * viceversa.
                 * Same applies for YUV444 output as well - Y and V are
                 * swapped. */
                chObj->vpdmaDataType[0U] = VPSHAL_VPDMA_CHANDT_RGB888;
                break;

and displayLink_drv.c:

if(dssPrms->inFmt.dataFormat == SYSTEM_DF_ARGB32_8888)
    {
        /* Convert to equivalent Display format */
        dssPrms->inFmt.dataFormat = SYSTEM_DF_BGRA32_8888;
    }

    if(dssPrms->inFmt.dataFormat == SYSTEM_DF_RGB24_888)
    {
        /* Convert to equivalent Display format */
        dssPrms->inFmt.dataFormat = SYSTEM_DF_BGR24_888;
    }

but the red and blue color are swap as follow:

what's more the left and top edge of screen appear strange mosic, my setting VPE parameter code as following:
    UInt16 chId;

    pPrm->enableOut[0] = TRUE;

    for(chId = 0; chId < numLvdsCh; chId++)
    {
        pPrm->chParams[chId].outParams[0].numBufsPerCh = VPE_LINK_NUM_BUFS_PER_CH_DEFAULT;

        pPrm->chParams[chId].outParams[0].width = 1920;
        pPrm->chParams[chId].outParams[0].height = 720;
        pPrm->chParams[chId].outParams[0].dataFormat = SYSTEM_DF_RGB24_888;

        pPrm->chParams[chId].scCfg.bypass       = FALSE;
        pPrm->chParams[chId].scCfg.nonLinear    = FALSE;
        pPrm->chParams[chId].scCfg.stripSize    = 0;

        pPrm->chParams[chId].scCropCfg.cropStartX = 0;
        pPrm->chParams[chId].scCropCfg.cropStartY = 0;
        pPrm->chParams[chId].scCropCfg.cropWidth = 1920;
        pPrm->chParams[chId].scCropCfg.cropHeight = 720;
    }
}

the correct should be:

  • Hi ,

    In the VPE link, instead of RGB888, can you try outputting BGR888?

    Change
    chObj->vpdmaDataType[0U] = VPSHAL_VPDMA_CHANDT_RGB888;
    to
    chObj->vpdmaDataType[0U] = VPSHAL_VPDMA_CHANDT_BGR888;

    Rgds,
    Brijesh
  • hi Brijesh,
    thanks for your quickly reply, the color can show normal, but there is a green strip in left edge and mosic in the top edge of screen. my crop parameter of vpe is wrong?
    best regard
  • Hi,

    I think it might be coming because of decoder, decoder adds some padding, that need to be removed.
    Can you try to crop off first 32 pixels and 32 lines?

    Rgds,
    Brijesh
  • hi, Brijesh
    if set crop offset, source image border will dispear, this is not my expectation. i just want to see the same to the source image.
    i dont know where the decoder add the padding.
    my decode parameter setting as following:
    for (chId = 0; chId < 1; chId++)
    {
    UTILS_assert (chId < DEC_LINK_MAX_CH);
    decPrm = &pPrm->chCreateParams[chId];

    decPrm->dpbBufSizeInFrames = DEC_LINK_DPB_SIZE_IN_FRAMES_DEFAULT;
    decPrm->algCreateStatus = DEC_LINK_ALG_CREATE_STATUS_CREATE;
    decPrm->decodeFrameType = DEC_LINK_DECODE_ALL;

    decPrm->processCallLevel = DEC_LINK_FRAMELEVELPROCESSCALL;
    decPrm->targetMaxWidth = SystemUtils_align(1920, 32);
    decPrm->targetMaxHeight = SystemUtils_align(720, 32);

    decPrm->numBufPerCh = 6;
    decPrm->defaultDynamicParams.targetBitRate = 10*1000*1000;
    decPrm->defaultDynamicParams.targetFrameRate = 30;
    decPrm->fieldMergeDecodeEnable = FALSE;

    /* H264 */
    decPrm->format = SYSTEM_IVIDEO_H264HP;
    decPrm->profile = 3;
    decPrm->displayDelay = 0;
    }

    what's more,

    if not use VPE change YUV420 to RGB888 by the following link, it will display correctly:

    NullSource_Animation (A15) -> Decode -> Display_vid3



    Best regards!

  • hi Brijesh,

    according this modify, i want to convert YUV420 to ARGB8888, so i modify following code:

    vpscore_vpeWb.c:

                  case FVID2_DF_RGB24_888:

                   /* Note: The R and B lines are connected to B and R ports of

                    * VPDMA. Hence need to use BGR datatype to capture RGB data and

                    * viceversa.

                    * Same applies for YUV444 output as well - Y and V are

                    * swapped. */

                   chObj->vpdmaDataType[0U] = VPSHAL_VPDMA_CHANDT_RGB888;

                   break;

    case FVID2_DF_ARGB32_8888:

               chObj->vpdmaDataType[0U] = VPSHAL_VPDMA_CHANDT_ARGB8888;

               break;

    vpeLink_drvCommon.c:

    add the case:

    case SYSTEM_DF_ARGB32_8888:
                            pFormat->dataFormat = FVID2_DF_ARGB32_8888;
                            pFormat->pitch[0] *= 4U;
                            pFormat->bpp = FVID2_BPP_BITS32;
                            break;

    and my VPE link parameter change to :

    pPrm->chParams[chId].outParams[0].dataFormat = SYSTEM_DF_ARGB32_8888;

    but the result is not show correctly:

  • Hi,

    I think startx is 32 pixels on each line and starty is 24 lines.. So you could set the crop parameters 32x24.. This will remove extra padding without cropping actual image.

    Rgds,
    Brijesh

  • Hi,

    I am not sure what is incorrect, as i dont know the original image.
    Are you seeing incorrect colors or some artifacts?

    Regards,
    Brijesh
  • hi Brijesh,

    thanks for your reply,  colors is incorrect and also left and top edge have mosic pixels.

    original image as following:

  • Hi,

    I think the color issue can be easily resolved by changing

    VPSHAL_VPDMA_CHANDT_ARGB8888

    to

    VPSHAL_VPDMA_CHANDT_ABGR8888

    Can you try changing this?

    Rgds,
    Brijesh
  • hi Brijesh,

    if change to VPSHAL_VPDMA_CHANDT_ABGR8888, also not correct, result as follow:

  • hi Brijesh,

    thanks for your reply, i try all the possible choice:

    if set to   chObj->vpdmaDataType[0U] = VPSHAL_VPDMA_CHANDT_BGRA8888; the result as follow:

    if set to chObj->vpdmaDataType[0U] = VPSHAL_VPDMA_CHANDT_RGBA8888; the result as follow:

  • Hi,

    Do you really require ARGB format?
    Can we first check with the RGB888 format and make sure that the color are correct?

    Rgds,
    Brijesh
  • hi,

    now i can use VPE link to convert YUV to RGB888.

    yes i really require ARGB or BGRA format, we design this link path:

    NullSource_Animation (A15) -> Decode -> VPE -> Merge -> Display_Vid1
    DispDistSrc_Navi -> Merge

    as the source format of DispDistSrc_Navi is ARGB, so the other path into Merge link should ARGB too, if i use VPE to convert YUV420 to RGB888 then i switch to play the DispDistSrc_Navi, it will not show correctly, as the two path into merge should the same color fomat.

    what can i do to modify the vpe link code to support this convert?

    best regards

  • Hi,

    VPE supports 4 different output frame format for the RGBA32 format. whereas DSS does not support all of them. I think DSS supports only 2 of them.
    So we need to make sure that the VPE outputs in a format, which is supported by DSS.

    Can you try ARGB32 format in VPE output, which means data type 9 in VPDMA and RGBA32 in DSS, which means format=0xD?

    Regards,
    Brijesh
  • Hi,
    thanks for your help, i know type 9 in VPDMA is "VPSHAL_VPDMA_CHANDT_RGBA8888", but i dont know what the type in DSS represent the value "0xD"?
    best regards
  • hi,
    i find halDssConvFvid2DataFmt() funciton in vpshal_dssDispcVid.c has the following code:

    case FVID2_DF_ABGR32_8888: /*RGBA32-8888*/
    fmt = 0xd;
    break;

    so i try to modify the following code:

    (1) in set VPE prms:
    pPrm->chParams[chId].outParams[0].dataFormat = SYSTEM_DF_ABGR32_8888;

    (2) in vpeLink_drvCommon.c add:

    case SYSTEM_DF_ABGR32_8888:
    pFormat->dataFormat = FVID2_DF_ABGR32_8888;
    pFormat->pitch[0] *= 4U;
    pFormat->bpp = FVID2_BPP_BITS32;
    break;

    (3) in vpscore_vpeWb.c add:
    case FVID2_DF_ABGR32_8888:
    chObj->vpdmaDataType[0U] = VPSHAL_VPDMA_CHANDT_RGBA8888 (this value is 0x9);
    break;

    but result is also not correct!

    best regards!
  • Hi,

    ok, since your capture data type is RGBA32=0x9, which means A is in lower byte and followed by B and so on. In DSS, you need to use data type 0xD.. could you please try with this?

    Rgds,
    Brijesh
  • hi Brijesh,

    i had try this, please refer to above message.
    best regards
  • Can we please check in the DSS register that it is set to 0xD?
    From the specs, i see that these formats are matching.

    What do you see in the output for this case?

    Regards,
    Brijesh
  • HI Brijesh,

    sorrry i don't know what the DSS register address is? could you please tell me the DSS address or register name so i can check the value by CCS Debug tool.

    the result is look like this one:

  • Hi,

    You could look at the ATTRIBUTE register of pipelines. These registers are DISPC_VID1_ATTRIBUTES(0x580010CC)/DISPC_VID2_ATTRIBUTES(0x5800115C)/DISPC_VID3_ATTRIBUTES(0x58001370)?

    Rgds,
    Brijesh
  • Hi,

    I am closing this thread, since there is no activity on this thread for long time.
    Let me know if you have any further questions, we can reopen it.

    Rgds,
    Brijesh