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.

DM365 & IPNC Appro : Capture driver problem in YUV420

Hello

I am going on my adaptation/debug for my YUV camera into the IPNC software infrastructure.

I work on the resizer configuration since it is the last stage, and the only one after the yuv data come directly from the Isif through the ipipeif.

I output images in YUV420, transcoded from YUV422, but i do not change the size. Size of image is VGA.

 

I found in drv_ipipe.c some settings which proved problematic. Some enable bits were not enabled in the resz.setup structure. So the output image was black (the buffer default value in my case). After changing this, I got YUV data written mistakenly in the binary file I could watch with an hexadecimal editor. I got this :

Y Data - 640 pixel width on 480 lines filled with black pixels

followed but C data - 640 pixel width on 240 lines approximately (there are 3 more lines).

I checked the image viewer and the YUV buffer viewer confirmed my data.

I changed the OSA_FileWrite procedure arguments so that in YUV420 we output not 2 times the resolution (like in YUV422) but only 1.5 times the resolution (iIs it a minor bug ?).

and I also output all the resizer configuration we can get in the drv_ipipe resizer part. Here they are for my resizer A only.

My understanding is that the OUT START ADDR equivalent to Start Address (SAD in the RSZ registers) is the Y start address, and it matches the Base address (BAD).

We have the same mechanism for Chroma address (SAD and BAD). I checked the offset versus address and it is OK, everything matches. All the enable flags are also OK (concerning the YUV420) in resizer.

OUT START ADDR = 0x84dda000
OUT LINE  OFFSET = 640
OUT YUV420 COUT START ADDR = 0x84e25000
OUT YUV420 COUT LINE  OFFSET = 640
OUT BASE ADDR = 0x84dda000
OUT START LINE = 0
OUT END LINE = 480
OUT YUV420 COUT BASE ADDR = 0x84e25000
OUT YUV420 COUT START LINE = 0
OUT YUV420 COUT END LINE = 240

Any suggestions about this issue ?

Thank you in advance

  • Hi Reda,

    Sorry, i could not uinderstand your description. Are you trying YUV420SP to YUV420SP resizing or are you trying to do something else? For any analysis, please share images of the YUV data that you got out from the resizer and also the input YUV data. At one place, you mention that you get black image which is your original data. Does this mean RSZ did not dump out anything?

    reda38 said:
    OUT START ADDR = 0x84dda000
    OUT LINE  OFFSET = 640
    OUT YUV420 COUT START ADDR = 0x84e25000
    OUT YUV420 COUT LINE  OFFSET = 640
    OUT BASE ADDR = 0x84dda000
    OUT START LINE = 0
    OUT END LINE = 480
    OUT YUV420 COUT BASE ADDR = 0x84e25000
    OUT YUV420 COUT START LINE = 0
    OUT YUV420 COUT END LINE = 240

    I dont see anything wrong in the above values. Do you find some issues with these?

    Regards,

    Anshuman

  • Hello Anshuman

    >Sorry, i could not understand your description. Are you trying YUV420SP to YUV420SP resizing or are you trying to do something else?


    I am trying VGA input in YUV422 to VGA output in YUV420SP. For the moment the resizing ratio is 1:1.
    But I plan also to use resize ratio 1:4 for the reszB, once this rszA issue is fixed.


    >For any analysis, please share images of the YUV data that you got out from the resizer
    >and also the input YUV data.

    OK. I will send them to you on monday. I have switched to color bars for debugging.

    >At one place, you mention that you get black image which is your original data. Does this
    >mean RSZ did not dump out anything?

    Yes it looked like it is the case. I checked the code, and some significant enable flags were not set
    in the drv_capture.c and drv_ipipe.c.
    Maybe a minor bug due to a test case.

    >I dont see anything wrong in the above values. Do you find some issues with these?

    Neither do I. It was just to double check these values.

    Regards,

  • Hi,

    Understood your usecase. I assume you want ISIF-->IPIPEIF-->RSZ-->DDR data flow and you have already verified ISIF output to be good. Why are you concerned about drv_ipipe.c? I am attaching a few files which i think are enough for your usecase.

    What do you mean by "significant enable flags" not being set?

    Regards,

    Anshuman

    drv_ipipe_isif.zip
  • Hello Anshuman,

     

    >Understood your usecase. I assume you want ISIF-->IPIPEIF-->RSZ-->DDR data flow and you have already verified ISIF output to be good.

    yes, i verified isif to ddr, with drv_isif.c test module

    ddr to ipipeif and then resizer with drv_resz.c test module

    and now i want to validate all the chain with no temporary storage in ddr. This chain is run in the test module of drv_capture.c which calls drv_ipipe.c

     

    >Why are you concerned about drv_ipipe.c?

    drv_ipipe.c sets the parameters for the resizer and is called by drv_capture.c as said before.

    >I am attaching a few files which i think are enough for your usecase.

    Thank you i will check this on monday (not at work today).

    >What do you mean by "significant enable flags" not being set?

    the code i have was set so that the resz.setup.enable flags from configuration structures (from my memory since i do not have the files today) were set to FALSE instead of TRUE.

    Thank you

  • Hello Anshuman,
    I had a look at the files you sent and I noticed some points :

    drv_ipipe.c:
    -----------

    1-in Ipipe_Open()
    ******************

    "   for(rszId=DRV_IPIPE_RSZ_A; rszId<=DRV_IPIPE_RSZ_B; rszId++) {

        gDRV_ipipeObj.rszInfo[rszId].enable = config->rszOutConfig[rszId].enable; "


    the resizer A or B looks enabled by its bit in a global structure.

    But when you look in DRV_ipipeRszSetParams() which is called in DRV_ipipeSetParams() itself called in int DRV_ipipeOpen()
    you see this:


    "  gDRV_ipipeObj.rszSetup.enable         = TRUE;"

    and

    "  if(gDRV_ipipeObj.config.rszOutConfig[0].enable)
        gDRV_ipipeObj.rszSetup.rszAConfig     = &gDRV_ipipeObj.rszOutConfig[0];

      if(gDRV_ipipeObj.config.rszOutConfig[1].enable)
        gDRV_ipipeObj.rszSetup.rszBConfig     = &gDRV_ipipeObj.rszOutConfig[1];
    "

    Again it looked OK.
    The problem comes after, from the coming loop which sets the hardware:

    "  for(i=0; i<CSL_RSZ_CH_MAX; i++)
      {
        if(!gDRV_ipipeObj.config.rszOutConfig[i].enable)
          continue;

        pOutConfig = &gDRV_ipipeObj.rszOutConfig[i];
        ...
    "

    there is a copy to a temporary pOutConfig structure to change bits for each resizer.


    and then later in the code I see:

    "    pOutConfig->enable                 = FALSE;"

    the enableflag is reset here !

    alls flags/values are configured and then near the end we get :

    "status = CSL_rszHwSetup(&gCSL_rszHndl, &gDRV_ipipeObj.rszSetup);"

    Meaning that the enable bit will be written to FALSE into the hardware.

    I do not remember ahving seen an enable bit somewhere else in calling procedure drv_capture.c


    2-Second point:
    ***************

    I see this in the code :

    "#ifdef VIA_ISIF
      gDRV_ipipeObj.rszInConfig.inputDataPath      = CSL_RSZ_INPUT_DATA_PATH_IPIPEIF; // jbl
    #else
      gDRV_ipipeObj.rszInConfig.inputDataPath      = CSL_RSZ_INPUT_DATA_PATH_IPIPE;
    #endif
    "

    I had also to change it ,in the original code,  for my camera, but testing with the name of my camera instead of a define.


    3-Third Point:
    **************

    in DRV_ipipeSetParams(), I see :

      "gDRV_ipipeObj.ipipeSetup.dataPath                   = CSL_IPIPE_IPIPE_DATA_PATH_BAYER_IN_YCBCR_RGB_OUT;"

       I have changed this to CSL_IPIPE_IPIPE_DATA_PATH_YCBCR_IN_YCBCR_RGB_OUT, no Bayer data is input indeed.

      
    drv_isif.c:
    -----------

    1-First Point:
    **************

    I have also overwritten   sdrOutConfig.packMode with  CSL_CCDC_SDR_OUT_TYPE_8BITS_PER_PIXEL;

    2-Second Point:
    ***************

    Why in int DRV_isifSetParams()

    have you changed

      sdrOutConfig.outWidth             = gDRV_isifObj.imgsModeInfo.validWidth;
      by
      sdrOutConfig.outWidth             = gDRV_isifObj.imgsModeInfo.validWidth*2; ?

    Any way in the drv_capture test the data goes directly to ipipe fromisif, so sdram storage is not enabled.


    For other parameters I will check on monday.

    Thank you for files.

    reda

  • Hi Reda,

    Please go through the code flow of IPNC Ref Design.

    reda38 said:
    alls flags/values are configured and then near the end we get :

    "status = CSL_rszHwSetup(&gCSL_rszHndl, &gDRV_ipipeObj.rszSetup);"

    Meaning that the enable bit will be written to FALSE into the hardware.

    I do not remember ahving seen an enable bit somewhere else in calling procedure drv_capture.c

    If you refer to videoCaptureThr.c, you can see that the capture thread calls DRV_captureStart() after all initializations are done. During this time the driver goes and starts all the modules that come in data flow, including IPIPE and RSZ. There is no problem in the code for enabling these key bits. If they were not enabled, the whole code would have broken.

    reda38 said:
    I see this in the code :

    "#ifdef VIA_ISIF
      gDRV_ipipeObj.rszInConfig.inputDataPath      = CSL_RSZ_INPUT_DATA_PATH_IPIPEIF; // jbl
    #else
      gDRV_ipipeObj.rszInConfig.inputDataPath      = CSL_RSZ_INPUT_DATA_PATH_IPIPE;
    #endif
    "

    I had also to change it ,in the original code,  for my camera, but testing with the name of my camera instead of a define.

    Your changes are good.

    reda38 said:
    3-Third Point:
    **************

    in DRV_ipipeSetParams(), I see :

      "gDRV_ipipeObj.ipipeSetup.dataPath                   = CSL_IPIPE_IPIPE_DATA_PATH_BAYER_IN_YCBCR_RGB_OUT;"

       I have changed this to CSL_IPIPE_IPIPE_DATA_PATH_YCBCR_IN_YCBCR_RGB_OUT, no Bayer data is input indeed.

    Again, you changes are correct. Our code was mostly enhanced for ISIF-->DDR-->RSZ-->DDR mode of data flow.

    reda38 said:
    2-Second Point:
    ***************

    Why in int DRV_isifSetParams()

    have you changed

      sdrOutConfig.outWidth             = gDRV_isifObj.imgsModeInfo.validWidth;
      by
      sdrOutConfig.outWidth             = gDRV_isifObj.imgsModeInfo.validWidth*2; ?

    Any way in the drv_capture test the data goes directly to ipipe fromisif, so sdram storage is not enabled.

     As i mentioned earlier, we used DDR as our intermediate buffer, so the above chnages were needed. You need not do these changes for your usage.

    Regards,

    Anshuman

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

     

  • Hi anshuman,

    You are right for the flow of ipnc software. The problem comes from the fact that the drv_capture test module, does not enable the resizer while in the av_server it is done in videoCaptureThr.c.

    I will have to recopy/adapt the code so that drv_capture to be usable by drv_captureStart and av_server application.

    Concerning the other points, i am OK.

    On another point, I have found the problem of black Y buffer.

    Indeed I have not set the YConvert enableflag. so that YUV422 data was resized and written to ddr. The size was then doubled (in hardware or another mechanism) and my data was not proper. My viewer also automatically changed the viewing mode to yuv422, which i did not understand why.

    After fixing, data was well converted, and size was OK. I am now finishing my converter from yuv420sp to planar so that future debugging is easier.

    Thank you for all your support. I will now go on with the av_server integration with my yuv camera... see you soon ;)

    reda