MCPcopy Create free account
hub / github.com/defold/defold / evaluate_etc1_error

Method evaluate_etc1_error

engine/dlib/src/basis/encoder/basisu_etc.cpp:727–753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 5

init_global_codebooksMethod · 0.80
create_encoder_blocksMethod · 0.80
encode_imageMethod · 0.80

Calls 2

unpack_etc1Function · 0.85
color_distanceFunction · 0.85

Tested by

no test coverage detected