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.

YUV 4:2:0 resize issue



Dear Sir :

I want to resize 1280*720 image to 720*480 by DM365 resizer.

However, after resizing, the color of image is wrong.

The following pictures show the resizing result.

 

Could any body advise me how to solve this problem?

Best regards,

yuenjune

  • Dear Sir :

    Sorry, there is one thing I do not mention.

    The input  and output image are YUV 4:2:0 format.

     

    Best regards,

    yuenjune

  • Hi,

    What is the first image and what is the second image? I assume the first image is input and second image as output. Can you confirm if 1:1 ratio resize operation is working fine and giving you right colors?

    Regards,

    Anshuman

  • Dear Sir :

    I appreciate your quickly reply.

    Yes, the first image is input and the second is output image.

    I will try your suggestion to confirm if 1:1 ratio is ok.

    By the way, is it possible that there is something wrong with the offsets from start of buffer for the C data.

     

    Best regards,

    yuenjune

     

  • lu yuenjune said:

    By the way, is it possible that there is something wrong with the offsets from start of buffer for the C data.

    It is very much likely that your chroma offset is wrong which is resulting in such issue.

    Regards,

    Anshuman

  • Dear Sir :

    I have tried your suggestion to confirm if 1:1 ratio and the pictures below show the result.

    video size 1280*720 ; YUV 4:2:0 format

     After 1:1 ratio resizing

     

    So, the result is the same.

    I will check if chroma offset is wrong.

    I wonder the chroma offset is wrong after the test that you advise me.

    Please give me your suggestion!

     

    Best regards,

    yuenjune 

  • How are you doing YUV420 resize operation? Can you check the input address that you are passing for chroma resize?

    Have you ensured that your driver is supporting YUV420 resize?

    Regards,

    Anshuman

  • Dear Anshuman:

    We use RTOS filesystem,not linux. 

    Our resizing process is decoding Encode video data to SDRAM

    first process: SDRAM(YUV420PSEMI)=>IPIPEIF=>Resizer(IPIPE_420SP_Y)=>OSD Display(SDRAM)

    second process: SDRAM(YUV420PSEMI)=>IPIPEIF=>Resizer(IPIPE_420SP_C)=>OSD Display(SDRAM)

    Here are the registers from the our problem case:

    IPIPE_420SP_Y Processing

    Resizer Configuration

    RSZ_GCK_MMR         = 0x0001;
    RSZ_SRC_EN          = 0x0000;
    RSZ_SRC_MODE        = 0x0000;
    RSZ_SRC_FMT0        = 0x0001; // 0:from IPIPE,1:from IPIPEIF
    RSZ_SRC_FMT1        = 0x0000;
    RSZ_SRC_VPS         = 0x0015;
    RSZ_SRC_VSZ         = 0x02CF;
    RSZ_SRC_HSZ         = 0x053F;
    RSZ_SRC_HPS         = 0x0000;
    RSZ_DMA_RZA         = 0x0000;
    RSZ_DMA_RZB         = 0x0000;
    RSZ_DMA_STA         = 0x0000;
    RSZ_GCK_SDR         = 0x0001;
    RSZ_IRQ_RZA         = 0x1FFF;
    RSZ_IRQ_RZB         = 0x1FFF;
    RSZ_YUV_Y_MIN       = 0x0000;
    RSZ_YUV_Y_MAX       = 0x00FF;
    RSZ_YUV_C_MIN       = 0x0000;
    RSZ_YUV_C_MAX       = 0x00FF;
    RSZ_YUV_PHS         = 0x0000;
    RSZ_SEQ             = 0x0000;
    RSZ_SRC_EN          = 0x0001;

    IPIPEIF Configuration

    IPIPEIF_ENABLE   = 0x0000;
    IPIPEIF_CFG      = 0xC40C;
    IPIPEIF_PPLN     = 0x0548;
    IPIPEIF_LPFR     = 0x02DA;
    IPIPEIF_HNUM     = 0x0540;
    IPIPEIF_VNUM     = 0x02D0;
    IPIPEIF_ADDRU    = (y_src/32) >> 16;
    IPIPEIF_ADDRL    = (y_src/32) & 0xffff;
    IPIPEIF_ADOFS    = 0x002A;
    IPIPEIF_RSZ      = 0x0010;
    IPIPEIF_GAIN     = 0x0200;
    IPIPEIF_DPCM     = 0x0000;
    IPIPEIF_CFG2     = 0x0048;
    IPIPEIF_INIRSZ   = 0x0000;
    IPIPEIF_OCLIP    = 0x0FFF;
    IPIPEIF_DTUDF    = 0x0000;
    IPIPEIF_CLKDIV   = 0x0001;
    IPIPEIF_DPC1     = 0x0000;
    IPIPEIF_DPC2     = 0x0000;
    IPIPEIF_DFSGVL   = 0x0000;
    IPIPEIF_DFSGTH   = 0x0FFF;
    IPIPEIF_RSZ3A    = 0x0010;
    IPIPEIF_INIRSZ3A = 0x0000;
    IPIPEIF_ENABLE   = 0x0001;   // Start IPIPEIF

    Resizer A Configuration

    RSZ_SRC_FMT1        = 0x0002; //IPIPE_420SP_Y

    RSZ_A_EN            = 0x0000;  //Stop resize A
    RSZ_A_MODE          = 0x0001;
    RSZ_A_420           = 0x0001;
    RSZ_A_I_VPS         = 0x0000;
    RSZ_A_I_HPS         = 0x0000;
    RSZ_A_O_VSZ         = 0x01DF;
    RSZ_A_O_HSZ         = 0x027F;
    RSZ_A_V_DIF         = 0x0180;
    RSZ_SRC_VPS         = 0x0000;
    RSZ_A_H_DIF         = 0x010C;
    RSZ_A_SDR_Y_BAD_H   = dest >> 16;
    RSZ_A_SDR_Y_BAD_L   = dest & 0xfffc;
    RSZ_A_SDR_Y_SAD_H   = dest >> 16;
    RSZ_A_SDR_Y_SAD_L   = dest & 0xfffc;
    RSZ_A_SDR_Y_OFT     = 0x0280;
    RSZ_A_SDR_Y_Y_PTR_S = 0x0000;
    RSZ_A_SDR_Y_PTR_E   = 0x01E0;
    RSZ_A_SDR_C_BAD_H   = 0x0000;
    RSZ_A_SDR_C_BAD_L   = 0x0000;
    RSZ_A_SDR_C_SAD_H   = 0x0000;
    RSZ_A_SDR_C_SAD_L   = 0x0000;
    RSZ_A_SDR_C_OFT     = 0x0000;
    RSZ_A_SDR_C_PTR_S   = 0x0000;
    RSZ_A_SDR_C_PTR_E   = 0x0000;
    RSZ_A_EN            = 0x0001;   //Start Resize A

    while(RSZ_A_EN&1);

    IPIPE_420SP_C Processing

    IPIPEIF Configuration

    IPIPEIF_ENABLE   = 0x0000;
    IPIPEIF_CFG      = 0xC40C;
    IPIPEIF_PPLN     = 0x0548;
    IPIPEIF_LPFR     = 0x02DA;
    IPIPEIF_HNUM     = 0x0540;
    IPIPEIF_VNUM     = 0x02D0;
    IPIPEIF_ADDRU    = (c_src/32) >> 16;
    IPIPEIF_ADDRL    = (c_src/32) & 0xffff;
    IPIPEIF_ADOFS    = 0x002A;
    IPIPEIF_RSZ      = 0x0010;
    IPIPEIF_GAIN     = 0x0200;
    IPIPEIF_DPCM     = 0x0000;
    IPIPEIF_CFG2     = 0x0048;
    IPIPEIF_INIRSZ   = 0x0000;
    IPIPEIF_OCLIP    = 0x0FFF;
    IPIPEIF_DTUDF    = 0x0000;
    IPIPEIF_CLKDIV   = 0x0001;
    IPIPEIF_DPC1     = 0x0000;
    IPIPEIF_DPC2     = 0x0000;
    IPIPEIF_DFSGVL   = 0x0000;
    IPIPEIF_DFSGTH   = 0x0FFF;
    IPIPEIF_RSZ3A    = 0x0010;
    IPIPEIF_INIRSZ3A = 0x0000;
    IPIPEIF_ENABLE   = 0x0001;   // Start IPIPEIF

    Resizer A Configuration

    RSZ_SRC_FMT1        = 0x0006; //IPIPE_420SP_C

    RSZ_A_EN            = 0x0000;
    RSZ_A_MODE          = 0x0001;
    RSZ_A_420           = 0x0003;
    RSZ_A_I_VPS         = 0x0000;
    RSZ_A_I_HPS         = 0x0000;
    RSZ_A_O_VSZ         = 0x01DF;
    RSZ_A_O_HSZ         = 0x027F;
    RSZ_A_V_DIF         = 0x0180;
    RSZ_SRC_VPS         = 0x0000;
    RSZ_A_H_DIF         = 0x010C;
    RSZ_A_SDR_Y_BAD_H   = 0x0000;
    RSZ_A_SDR_Y_BAD_L   = 0x0000;
    RSZ_A_SDR_Y_SAD_H   = 0x0000;
    RSZ_A_SDR_Y_SAD_L   = 0x0000;
    RSZ_A_SDR_Y_OFT     = 0x0000;
    RSZ_A_SDR_Y_Y_PTR_S = 0x0000;
    RSZ_A_SDR_Y_PTR_E   = 0x0000;
    RSZ_A_SDR_C_BAD_H   = (dest+(640 * 480)) >> 16;
    RSZ_A_SDR_C_BAD_L   = (dest+(640 * 480)) & 0xfffc;
    RSZ_A_SDR_C_SAD_H   = (dest+(640 * 480)) >> 16;
    RSZ_A_SDR_C_SAD_L   = (dest+(640 * 480)) & 0xfffc;
    RSZ_A_SDR_C_OFT     = 0x0280;
    RSZ_A_SDR_C_PTR_S   = 0x0000;
    RSZ_A_SDR_C_PTR_E   = 0x00F0;
    RSZ_A_EN            = 0x0001;   //Start Resize A

    while(RSZ_A_EN&1);

    Any advice on how to proceed in debugging this problem would be greatly appreciated!

    Thanks!