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.

TDA2EG: the size of GAlignLUT

Part Number: TDA2EG

Hi

   I am working on the 2D surround view, and have a question about the size of GAlignLUT array:  what is the size of this huge array?

   The related docs says that "this LUT encode both LDC and perspective transformation information". The perspective transformation matrix is 3*3 matrix, and i think it is the same for one camera's image pixels.

   So why the LUT's size is so large? Is it pixel-level?  But if the perspective transformation matrix keep the same for the pixels of one camera, why we need to describe the GAlignLUT at a pixel-level?

Thanks

xuanbo

  • Hi, ,

    Our expert is OoO and there will be a delay in answering your question.

    Regards,
    Mariya
  • Hi Mariya

    OK, i will wait~ thank you.

    Regards
    xuanbo
  • The LUT is pixel by pixel since it encodes both the lens model and the perspective transform. The lens model (fisheye correction) requires a full pixel by pixel table.

    Regards

    Shashank

  • Hi Shashank

    Thank you for your explaination.
    Although the perspective transformation matrix is 3*3 matrix, lens model requires pixel by pixel. So the GAlignLUT which encodes both the lens and perspective transform is pixel by pixel. OK, i think i got it.
    Suppose the SRV output resolution is 880*1080, and 1.5 bytes per pixel, so the size of GAlignLUT is: 880*1080*1.5?
    Does my calculation is right or not?

    Thanks
    xuanbo
  • I will have to check and get back to you.

    Regards
    Shashank
  • Each entry is of 2 byte, so I think it should be 880*1080*1.5*2 bytes.
  • Hi Do-Kyoung

    what does the "entry" mean here?

    Thanks
    xuanbo
  • I meant the value for each pixel in GAlignLUT.
  • Hi Do-Kyoung

    I am sorry that I still don't quite understand.
    Suppose the format is YUV420, then one pixel need 1.5 bytes to describe. So the total bytes is 880*1080*1.5.
    Then for the GAlignLUT, each "byte" needs two bytes value to describe? So we need to multiply 2?

    Thanks
    xuanbo
  • I was wrong: actually we have to multiply 4 (2 bytes for horizontal (x) position, 2 bytes for vertical (y) position).

    Note that this table have pixel (x, y) position in source image to which the target pixel maps. So we need 4 byte for each pixel.

    For luma, we need ' 880*1080* 4 bytes"

    For chroma (UV) we need (880*1080 / 4) * 4 bytes (note that U and V share the same table)

    So total should be 880*1080 * 5 bytes.

  • Hi Do-Kyoung

       I found that there are 2 places describing the size of GalinLUT in the VSDK: 

       1 In the vision_sdk\apps\src\rtos\alg_plugins\surroundview\svAlgLink_priv.h:  

    /**
    *******************************************************************************
    *
    * \brief Size of Geometric Alignment LUT
    *
    * Buffer allocation done considering following factors -
    * - Output height
    * - Output width
    * - Based on the color format (1.25 for 420SP)-U and V use
    * same table
    * - 3 tables - Simple synthesis LUT, Blend LUT1, Blend LUT2
    * TBD - Make 3 when blending / PA Stats is enabled
    * - Per entry size of GAlignLUT_BitPerEntry
    * - An additional 256 bytes for any round off etc during
    * division etc..
    *
    * SUPPORTED in ALL platforms
    *
    *******************************************************************************
    */
    #define SV_ALGLINK_GALUT_SIZE ((SV_ALGLINK_OUTPUT_FRAME_HEIGHT) * \
    (SV_ALGLINK_OUTPUT_FRAME_WIDTH) * \
    (1.25) * \
    2 * \
    GAlignLUT_BitPerEntry \
    + 256)

      2 And in the vision_sdk\apps\src\rtos\alg_plugins\surroundview\svLutGen_If.c: (Utils_sv2dUpdatePersMat function) 

    for ( j=0; j<svGalignObj.SVOutDisplayHeight*svGalignObj.SVOutDisplayWidth*(1.25)*2; j++){
    svGalignObj.GAlignLUT[j] = GAlignLUT[j];
    }

      So how to explain above codes?

    Thanks

    xuanbo

  • Hello Xuanbo,

    I think both codes somewhat match to what I said.

    1)

    #define SV_ALGLINK_GALUT_SIZE ((SV_ALGLINK_OUTPUT_FRAME_HEIGHT) * \
    (SV_ALGLINK_OUTPUT_FRAME_WIDTH) * \
    (1.25) * \
    2 * \    
    GAlignLUT_BitPerEntry \   
    + 256)

    => I think GAlignLUT_BitPerEntry is the number of bytes per entry. It is 4 now, but it could be 2. 

    2)  for ( j=0; j<svGalignObj.SVOutDisplayHeight*svGalignObj.SVOutDisplayWidth*(1.25)*2; j++){
             svGalignObj.GAlignLUT[j] = GAlignLUT[j];
         }

    => 1.25 is for Y and UV. 2 is for x and y. GAlignLUT is a pointer to unsigned 16 bits.

  • Hi Do-Kyoung

    OK, thank you for your explaination.

    Regards
    xuanbo