MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / partition_mismatch2

Function partition_mismatch2

Source/astcenc_find_best_partitioning.cpp:253–263  ·  view source on GitHub ↗

* @brief Compute bit-mismatch for partitioning in 2-partition mode. * * @param a The texel assignment bitvector for the block. * @param b The texel assignment bitvector for the partition table. * * @return The number of bit mismatches. */

Source from the content-addressed store, hash-verified

251 * @return The number of bit mismatches.
252 */
253static inline uint8_t partition_mismatch2(
254 const uint64_t a[2],
255 const uint64_t b[2]
256) {
257 int v1 = popcount(a[0] ^ b[0]) + popcount(a[1] ^ b[1]);
258 int v2 = popcount(a[0] ^ b[1]) + popcount(a[1] ^ b[0]);
259
260 // Divide by 2 because XOR always counts errors twice, once when missing
261 // in the expected position, and again when present in the wrong partition
262 return static_cast<uint8_t>(astc::min(v1, v2) / 2);
263}
264
265/**
266 * @brief Compute bit-mismatch for partitioning in 3-partition mode.

Callers 1

Calls 2

popcountFunction · 0.70
minFunction · 0.70

Tested by

no test coverage detected