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.

H.264 encoder memory consumption

Hello,

from the documentation of the H.264 encoder (version 2.10.00.06) I'm using the formula to calculate the amount of memory used by the encoder for Memrab[5]. For the given example of a 2048x2048 image 13635072 bytes are used by the encoder. But if I use the calculation rule (2048 + (26 <<1)) * (2048 + (32<<1)) * 3 Memtab[5] should be 13305600 bytes only. For other resolutions I saw that the encoder requests more memory for Memtab[5] than expected as well. 

Could you please provide a valid calculation rule for Memtab[5].

 

Thanks

Frank

  • Frank,

     

    I guess you are encoding interlace sequences. The formula mentioned in the documentation is for progressive streams. Interlaced sequences require additional memory space which can be calculated using formula (2048 + (26 << 2)) * (2048 + (32 << 1)) * 3 = 13635072

    Regards

    Adithya

  • Hi,

    I'm encoding progressive images. The numbers from my first post came from the datasheet.

    My real case is (2560*(32<<1)) * (1936*(26<<1)) * 3 = 15649536. But the encoder requests 16160256 bytes. That would not be true for interlaced contend also.

     

    Regards

    Frank

  • Frank your calculation for memTab[5] is absolutely fine.

    what is your capture resolution, is it the same like encode resolution you have mentioned here.

  • Adithya Banninthaya said:
    I guess you are encoding interlace sequences. The formula mentioned in the documentation is for progressive streams. Interlaced sequences require additional memory space which can be calculated using formula (2048 + (26 << 2)) * (2048 + (32 << 1)) * 3 = 13635072

    Regards

    Adithya

    I'm confused about the calculations presented here.  In my H264enc data sheet the calc for memtab 5 is....

    uSize = (uHeight * uWidth * 3) >>1

    You guys are leaving off the divide by 2 (shift right), which doubles the memory requirement.  I'm trying to reduce my cmem pool allocation so this is important to me.

    I also have another question.  Where do the values for PAD_HORZ and PAD_VERT come from?  Are they the same for all resolutions?

    John A

  • There needs to be a correction in the datasheet.

    Size of memtab[5].size = (uHeight * uWidth * 3)

    uHeight = maxHeight + (26 << 1) for progressive streams (maxheight is expected to be multiple of 16)

    uHeight = maxHeight + (26 << 2) for interlaced streams (maxheight is expected to be multiple of 32)

    uWidth = maxWidth + (32 << 1)    (maxWidth is expected to be multiple of 64)

    Frank,

    Are you sure maxWidth and maxHeight in your application are 2560 and 1936 respectively?

    John,

    Padding is same for all resolutions.