int sum(int width, int levels) { return 2 * width * ((1 << levels) - 1) / (1 << levels);}
Σ(level) bytesPerImage(std::max(width >> level, 1), std::max<(height >> level, 1))
qsizetype bytesPerImage(w, h) { h * ((w * bitsPerPixel(format) + 31) >> 5) << 2}