astc-encoder icon indicating copy to clipboard operation
astc-encoder copied to clipboard

How to minimize heap/stack memory usage of multiple contexts on mobile platform?

Open NoSW opened this issue 10 months ago • 3 comments

I'm using astcenc-encoder to compress volumetric lightmap data on mobile platform. I have selected two block sizes, 5x5 and 5x5x5, based on certain criteria.

When decompressing, it is required to create two different contexts simultaneously, or even four contexts if considering HDR/LDR. This results in a memory allocation of 30MB to 40MB, which is challenging to accept on mobile devices, especially on iOS.

I have noticed the build option ASTCENC_BLOCK_MAX_TEXELS, but the limit of 5x5x5=125 is still too large.

Q1: Is there any possibility to merge contexts with different block sizes and HDR/LDR settings into a big one?

Q2: Starting from #246, are there any opportunities to further reduce memory overhead?

(I have noticed WEIGHTS_MAX_DECIMATION_MODES, WEIGHTS_MAX_BLOCK_MODES, and BLOCK_MAX_WEIGHTS are still constant in v4.7.0.)

Q3: Can ASTCENC_BLOCK_MAX_TEXELS be changed to (c++) template?

NoSW avatar Apr 11 '24 03:04 NoSW