MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / bc7_dequant

Function bc7_dequant

external/basisu/encoder/basisu_gpu_texture.cpp:432–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430 // Instead of one monster routine to unpack all the BC7 modes, we're lumping the 3 subset, 2 subset, 1 subset, and dual plane modes together into simple shared routines.
431
432 static inline uint32_t bc7_dequant(uint32_t val, uint32_t pbit, uint32_t val_bits) { assert(val < (1U << val_bits)); assert(pbit < 2); assert(val_bits >= 4 && val_bits <= 8); const uint32_t total_bits = val_bits + 1; val = (val << 1) | pbit; val <<= (8 - total_bits); val |= (val >> total_bits); assert(val <= 255); return val; }
433 static inline uint32_t bc7_dequant(uint32_t val, uint32_t val_bits) { assert(val < (1U << val_bits)); assert(val_bits >= 4 && val_bits <= 8); val <<= (8 - val_bits); val |= (val >> val_bits); assert(val <= 255); return val; }
434
435 static inline uint32_t bc7_interp2(uint32_t l, uint32_t h, uint32_t w) { assert(w < 4); return (l * (64 - basist::g_bc7_weights2[w]) + h * basist::g_bc7_weights2[w] + 32) >> 6; }

Callers 3

unpack_bc7_mode0_2Function · 0.85
unpack_bc7_mode1_3_7Function · 0.85
unpack_bc7_mode4_5Function · 0.85

Calls 1

assertFunction · 0.85

Tested by

no test coverage detected