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.

convert yuv422 to yuv420sp in BYPASS mode

Other Parts Discussed in Thread: TVP5146, TVP5150

Hi :

I using dm365 + mt9d131for ipcamera,Sensor output yuv422 data,

datapath register: SRC_FMT = 3

I set Resize to BYPASS mode in continuous,there is yuv422 data ouput from Resize that i saved as file and checked it. H264 codec don't support yuv422,so i must convert yuv422 to yuv420sp through Resize .But when i  set Resize  normal mode in continuous,there is nothing output from Resize .and some related register value:

RSZ A EN = 0x0

RSZ A MODE = 0x0

RSZ A 420 = 0x0

I set RSZ A EN = 0x1,RSZ A 420 = 0x3 in PREVIEW Init after RESIZE init  in normal mode,But these register are auto reseted somewhere.

RSZ A EN = 0x0

RSZ A MODE = 0x0

RSZ A 420 = 0x0

1,How can i convert yuv422 to yuv420sp in BYPASS mode with continuous?

2,why nothing output from Resize with normal mode(not BYPASS) and when are these register  reseted.

 

Any reply will be respected,Thanks!

 

Best Regards

aGuang

  • Are these register (RSZ_A_EN ,RSZ_A_MODE,RSZ_A_420) only to be configured in one-shot mode? 

  • Hi,

    Are you using LSP or DVSDK software to program the capture, resizer and previewer driver? Actually in continuous mode, the capture driver itself sets up resizer and IPIPE so if you just program the output format in VIDIOC_S_FMT, you can get the YUV420 output from capture driver.

    The DVSDK code for encode demo does exactly same thing that you need. Please refer to that code and let us know if you need further help.

    Regards,

    Anshuman

    PS: Please mark this post as verified, if you think it has answered your question. Thanks.

  • Hi Anshuman :

    I use dvsdk software to program th capture,resize and previewer driver in continuous mode,I can capture yuv422 image from SDRAM->IPIPE in one-shot mode and convert it to yuv420 format in RSZ successfully.

    I use another app separated print register value when dvsdk demo is runned in continuous mode:

     ----IPIPE Register:------

    IPIPE_SRC_EN   0x1

    IPIPE_SRC_MODE 0x0

    IPIPE_SRC_FMT  0x3

    IPIPE_SRC_COL  0xe4

    IPIPE_SRC_VPS  0x1

    IPIPE_SRC_VSZ  0x2cf

    IPIPE_SRC_HPS  0x0

    IPIPE_SRC_HSZ  0x4ff

    IPIPE_SEL_SBU  0x0

    IPIPE_DMA_STA  0x0

    IPIPE_GCK_MMR  0x1

    IPIPE_GCK_PIX  0xe

    ----RSZ Register:------

    RSZ_SRC_EN   0x1 

    RSZ_SRC_MODE 0x0 

    RSZ_SRC_FMT0 0x0 

    RSZ_SRC_FMT1 0x0 

    RSZ_SRC_VPS  0x0 

    RSZ_SRC_VSZ  0x2cf 

    RSZ_SRC_HPS  0x0 

    RSZ_SRC_HSZ  0x4ff 

    RSZ_DMA_RZA  0x0 

    RSZ_DMA_RZB  0x0 

    RSZ_DMA_STA  0x0 

    RSZ_GCK_MMR  0x1 

    RSZ_GCK_SDR  0x1 

    RSZ_IRQ_RZA  0x1fff 

    RSZ_IRQ_RZB  0x1fff 

    RSZ_YUV_Y_MIN 0x0 

    RSZ_YUV_Y_MAX 0xff 

    RSZ_YUV_C_MIN 0x0 

    RSZ_YUV_C_MAX 0xff 

    RSZ_YUV_PHS   0x0 

    RSZ_SEQ    0x0 

    RZA_EN     0x1 

    RZA_MODE   0x0 

    RZA_420    0x0  //it should be 0x3

    SZB_EN     0x1 

    RZB_MODE   0x0 

    RZB_420    0x3

    Nothing output from RSZ.

    RSZ configuration:

    chain = 1;

    oper_mode = IMP_MODE_CONTINUOUS;

    output2.pix_fmt = IPIPE_YUV420SP;

    PRV configuration:

    bypass = IPIPE_BYPASS_OFF;

     

    1,when i configure bypass = IPIPE_BYPASS_ON ,I can capture yuv422 data from RSZ output,but when i configure bypass = IPIPE_BYPASS_OFF,nothing output.what is type of the problem may make it?

    2,In RSZ BYPASS mode,Down/Up-Scale and yuv422-to-yuv420 function all disable?

     

    Regards,

    aGuang

  • Hi,

    aGuang said:
    I use dvsdk software to program th capture,resize and previewer driver in continuous mode,I can capture yuv422 image in one-shot mode and convert it to yuv420 format successfully.

    I am a little confused here. Are you saying you have configured capture, previewer and resizer for continuous mode and still able to do conversion to YUV420 in one-shot mode? Actually, both modes cannot work together. Why dont you just configure the capture driver output in continuous mode itslef, to give out YUV420 data. As i mentioned in earlier post, you can do it by setting in VIDIOC_S_FMT ioctl.

    aGuang said:

    In RSZ BYPASS mode,Down/Up-Scale and yuv422-to-yuv420 function all disable?

    Yes, in bypass mode, these features would get disabled as explained in the VPFE userguide.

    Regards,

    Anshuman

    PS: Please mark this post as verified, if you think it has answered your question. Thanks.

  • Hi Anshuman,

    I configured continuous mode and one-shot mode Separately,I just make a compare together.I have used the VIDIOC_S_FMT ioctl and set it to V4L2_PIX_FMT_UYVY,the problems are still here. 

     

    All parameters are configured the same In continuous mode,when I just set RSZ BYPASS,I can capture yuv422 raw data from RSZ,and when disable BYPASS nothing output,So i think RSZ is the problem place.It process yuv422 data fail with disable BYPASS in RSZ,because register RZA_420 should be 0x3 .Can i think of it? or others.

     

    Regards,

    aGuang

  • aGuang said:

    I configured  continuous mode and one-shot mode Separately,I just make a compare together.I have used the VIDIOC_S_FMT ioctl and set it to V4L2_PIX_FMT_UYVY,the problems are still here. 

     

    As i asked earlier, are you using the "encode" application of DVSDK. Is that working for you? It has option of putting resizer in normal mode (non-bypass) and then just get the output in possibly both formats (YUV420SP and YUV422). I would recommend you to refer to that code.

    I am not sure why you want to do RSZ_BYPASS register setting. I am not fully aware that you can enable RSZ_BYPASS and then disable it again and expect the YUV420 output. I would not recommend that approach.

    Regards,

    Anshuman

    PS: Please mark this post as verified, if you think this has answered your question. Thanks.

  • Hi Anshuman:

    Anshuman said:

    I am not sure why you want to do RSZ_BYPASS register setting. I am not fully aware that you can enable RSZ_BYPASS and then disable it again and expect the YUV420 output. I would not recommend that approach.

     

    I change the "encode" application of DVSDK to myself application.I success capture dm365+mt9p031 raw data and RSZ(scale down,raw2yuv) it and encode it to H.264. Now my sensor is mt9d131 and output yuv422.Image quality is processed in sensor itself.All i want is that to capture the yuv422 data and convert it to yuv420sp.I don't want BYPASS mode with RSZ because i must do yuv convert processing.The reason i test RSZ BYPASS mode is that i want to find out the problem modules when i capture in non-bypass mode.why i capture nothing in non-bypass but not in bypass mode. which module cause this problem in ipipe data flow.I test the NON-BYPASS and BYPASS mode separately,i haven't conversion between them。I just want to know what is the problem i have toke for captureing yuv data in RSZ BYPASS mode under the continuous mode.

     

    Regards,

    aGuang

  • The "encode" application on DM365 EVM + DVSDK has support for TVP5146 which gives YUV input data. It is very similar to your requirement configuration, except that it gives out field interleaved data while your sensor would be giving progressive frame. But both give YUV data output and the resizer works in that demo. So you might want to refer to that.

    I am sure it is some sort of configuration from your sensor driver for the resizer which is causing the problem in continuous mode operation.

    Regards,

    Anshuman

  • Hi Anshuman:

    Thanks for you support,I have captured D1 yuv422 data with tvp5150,and also captured yuv422 data with mt9d131 in one-shot mode earlier,all in non-bypass mode,Only in continuous with non-bypass,I capture nothing from RSZ with mt9d131 yuv422 input.I will check the configure of  sensor drive as you say.

     

    Regards,

    aGuang

  • Hi:

    I want the driver mt9d131 for ipcamera,   cant  you send it to me?      e-mail:  lmspl@163.com.

    By   the way,   I am using the dm36x + APPRO  for ipcamera in linux operation system,  if   the input source is  1080p + 16bit  + YCbCr +  bt1120 + parallel,  can you give me the configuration for the DM36x ipnc?  the RESIZE output is YUV422.   thanks!  

  • Hi all,

    I have a similar issue in configuring DM368's resizer to convert yuv422 to yuv420sp pixel format in continuous (on-the-fly) mode.  Right now, I'm developing a cmos sensor driver on linux kernel linux-2.6.18_pro500 and the cmos sensor is able to output yuv422 pixel format.  Basically, I'm able to capture VGA video in YUV422 (V4L2_PIX_FMT_UYVY) without any problem in Bypass mode.  This is the snapshot of the captured video:

     

    However, when I try to capture video in YUV420SP (V4L2_PIX_FMT_NV12), there is something wrong in the captured YUV420SP video.  It looks that the color is off and there is something overlay over the image, as shown below:

     

    I tried to re-capture YUV420SP images with CbCr component filled with 0x7F and Y component filled with 0x7F respectively.  I got the following results:

    CbCr component filled with 0x7F (Y-component only)

     

    Y-component filled with 0x7F (CbCr component only)

    It looks that the Y-component seems okay but there is something wrong in CbCr component.  It looks that the CbCr component contains only a part of the whole image and something is overlay over the CbCr component.  The values of IPIPEIF, IPIPE, Resizer registers are included below for you all reference.

    IPIPEIF Registers
    **************************************************
    IPIPEIF ENABLE = 0x0
    IPIPEIF CFG = 0x2000
    IPIPEIF PPLN = 0x0
    IPIPEIF LPFR = 0x0
    IPIPEIF HNUM = 0x0
    IPIPEIF VNUM = 0x0
    IPIPEIF ADDRU = 0x0
    IPIPEIF ADDRL = 0x0
    IPIPEIF ADOFS = 0x0
    IPIPEIF RSZ = 0x10
    IPIPEIF GAIN = 0x200
    IPIPEIF DPCM = 0x0
    IPIPEIF CFG2 = 0x48
    IPIPEIF INIRSZ = 0x0
    IPIPEIF OCLIP = fff
    IPIPEIF DTUDF = 0
    IPIPEIF CLKDIV = 1
    IPIPEIF DPC1 = 0
    IPIPEIF DPC2  = 0
    IPIPEIF DFSGVL  = 0
    IPIPEIF DFSGTH  = fff
    IPIPEIF RSZ3A  = 10
    IPIPEIF INIRSZ3A  = 0
    IPIPE Registers
    **************************************************
    IPIPE_SRC_EN = 0x1
    IPIPE_SRC_MODE = 0x0
    IPIPE_SRC_FMT = 0x3
    IPIPE_SRC_COL = 0xe4
    IPIPE_SRC_VPS = 0x1
    IPIPE_SRC_VSZ = 0x1df
    IPIPE_SRC_HPS = 0x0
    IPIPE_SRC_HSZ = 0x27f
    IPIPE_SEL_SBU = 0x0
    IPIPE_DMA_STA = 0x0
    IPIPE_GCK_MMR = 0x1
    IPIPE_GCK_PIX = 0xe
    Resizer Registers
    **************************************************
    RSZ_SRC_EN = 0x0
    RSZ_SRC_MODE = 0x0
    RSZ_SRC_FMT0 = 0x2
    RSZ_SRC_FMT1 = 0x0
    RSZ_SRC_VPS = 0x0
    RSZ_SRC_VSZ = 0x1df
    RSZ_SRC_HPS = 0x0
    RSZ_SRC_HSZ = 0x27f
    RSZ_DMA_RZA = 0x0
    RSZ_DMA_RZB = 0x0
    RSZ_DMA_STA = 0x0
    RSZ_GCK_MMR = 0x1
    RSZ_GCK_SDR = 0x0
    RSZ_IRQ_RZA = 0x1fff
    RSZ_IRQ_RZB = 0x1fff
    RSZ_YUV_Y_MIN = 0x0
    RSZ_YUV_Y_MAX = 0xff
    RSZ_YUV_C_MIN = 0x0
    RSZ_YUV_C_MAX = 0xff
    RSZ_YUV_PHS = 0x0
    RSZ_SEQ = 0x0
    RSZ A EN = 0x1
    RSZ A MODE = 0x0
    RSZ A 420 = 0x3
    RSZ A I_VPS = 0x0
    RSZ A I_HPS = 0x0
    RSZ A O_VSZ = 0x1df
    RSZ A O_HSZ = 0x27f
    RSZ A V_PHS_Y = 0x0
    RSZ A V_PHS_C = 0x0
    RSZ A V_DIF = 0x100
    RSZ A V_TYP = 0x0
    RSZ A V_LPF = 0x0
    RSZ A H_PHS = 0x0
    RSZ A H_PHS_ADJ = 0x0
    RSZ A H_DIF = 0x100
    RSZ A H_TYP = 0x0
    RSZ A H_LPF = 0x0
    RSZ A DWN_EN = 0x0
    RSZ A DWN_AV = 0x0
    RSZ A RGB_EN = 0x0
    RSZ A RGB_TYP = 0x0
    RSZ A RGB_BLD = 0x0
    RSZ A SDR_Y_BAD_H = 0x0
    RSZ A SDR_Y_BAD_L = 0x0
    RSZ A SDR_Y_SAD_H = 0x0
    RSZ A SDR_Y_SAD_L = 0x0
    RSZ A SDR_Y_OFT = 0x280
    RSZ A SDR_Y_Y_PTR_S = 0x0
    RSZ A SDR_Y_PTR_E = 0x1e0
    RSZ A SDR_C_BAD_H = 0x0
    RSZ A SDR_C_BAD_L = 0x0
    RSZ A SDR_C_SAD_H = 0x0
    RSZ A SDR_C_SAD_L = 0x0
    RSZ A SDR_C_OFT = 0x280
    RSZ A SDR_C_PTR_S = 0x0
    RSZ A SDR_C_PTR_E = 0xf0
    RSZ B EN = 0x0
    RSZ B MODE = 0x0
    RSZ B 420 = 0x0
    RSZ B I_VPS = 0x0
    RSZ B I_HPS = 0x0
    RSZ B O_VSZ = 0x0
    RSZ B O_HSZ = 0x1
    RSZ B V_PHS_Y = 0x0
    RSZ B V_PHS_C = 0x0
    RSZ B V_DIF = 0x100
    RSZ B V_TYP = 0x0
    RSZ B V_LPF = 0x0
    RSZ B H_PHS = 0x0
    RSZ B H_PHS_ADJ = 0x0
    RSZ B H_DIF = 0x100
    RSZ B H_TYP = 0x0
    RSZ B H_LPF = 0x0
    RSZ B DWN_EN = 0x0
    RSZ B DWN_AV = 0x0
    RSZ B RGB_EN = 0x0
    RSZ B RGB_TYP = 0x0
    RSZ B RGB_BLD = 0x0
    RSZ B SDR_Y_BAD_H = 0x0
    RSZ B SDR_Y_BAD_L = 0x0
    RSZ B SDR_Y_SAD_H = 0x0
    RSZ B SDR_Y_SAD_L = 0x0
    RSZ B SDR_Y_OFT = 0x0
    RSZ B SDR_Y_Y_PTR_S = 0x0
    RSZ B SDR_Y_PTR_E = 0x1fff
    RSZ b SDR_C_BAD_H = 0x0
    RSZ B SDR_C_BAD_L = 0x0
    RSZ B SDR_C_SAD_H = 0x0
    RSZ B SDR_C_SAD_L = 0x0
    RSZ B SDR_C_OFT = 0x0
    RSZ B SDR_C_PTR_S = 0x0
    RSZ B SDR_C_PTR_E = 0x1fff

     

    Could you all give me some hints to fix it and what registers I need to look into further?

    Thank you so much!

    Regards,

    Chitat