| 725 | } |
| 726 | |
| 727 | uint64_t etc_block::evaluate_etc1_error(const color_rgba* pBlock_pixels, bool perceptual, int subblock_index) const |
| 728 | { |
| 729 | color_rgba unpacked_block[16]; |
| 730 | |
| 731 | unpack_etc1(*this, unpacked_block); |
| 732 | |
| 733 | uint64_t total_error = 0; |
| 734 | |
| 735 | if (subblock_index < 0) |
| 736 | { |
| 737 | for (uint32_t i = 0; i < 16; i++) |
| 738 | total_error += color_distance(perceptual, pBlock_pixels[i], unpacked_block[i], false); |
| 739 | } |
| 740 | else |
| 741 | { |
| 742 | const bool flip_bit = get_flip_bit(); |
| 743 | |
| 744 | for (uint32_t i = 0; i < 8; i++) |
| 745 | { |
| 746 | const uint32_t idx = g_etc1_pixel_indices[flip_bit][subblock_index][i]; |
| 747 | |
| 748 | total_error += color_distance(perceptual, pBlock_pixels[idx], unpacked_block[idx], false); |
| 749 | } |
| 750 | } |
| 751 | |
| 752 | return total_error; |
| 753 | } |
| 754 | |
| 755 | void etc_block::get_subblock_pixels(color_rgba* pPixels, int subblock_index) const |
| 756 | { |
no test coverage detected