INNER CODE UNIT · Python
expected_block_bytes
untoldengine/UntoldEngine · scripts/texbake.py:357
def expected_block_bytes(width: int, height: int, block_w: int, block_h: int) -> int:
"""
Compute the expected byte count for an ASTC-compressed mip level.
Each ASTC block is always 16 bytes regardless of block dimensions.
"""
blocks_wide = math.ceil(width / block_w)
blocks_high = math.ceil(height / block_h)
return blocks_wide * blocks_high * 16
# ──────────────────────────────────────────────
# .utex writer
# ──────────────────────────────────────────────
def align_up(value: int, alignment: int) -> int:
remainder = value % alignment
return value if remainder == 0 else value + (alignment - remainder)