* @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. */
| 251 | * @return The number of bit mismatches. |
| 252 | */ |
| 253 | static 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. |
no test coverage detected