| 1002 | } |
| 1003 | |
| 1004 | bool basis_compressor::process_frontend() |
| 1005 | { |
| 1006 | debug_printf("basis_compressor::process_frontend\n"); |
| 1007 | |
| 1008 | #if 0 |
| 1009 | // TODO |
| 1010 | basis_etc1_pack_params pack_params; |
| 1011 | pack_params.m_quality = cETCQualityMedium; |
| 1012 | pack_params.m_perceptual = m_params.m_perceptual; |
| 1013 | pack_params.m_use_color4 = false; |
| 1014 | |
| 1015 | pack_etc1_block_context pack_context; |
| 1016 | |
| 1017 | std::unordered_set<uint64_t> endpoint_hash; |
| 1018 | std::unordered_set<uint32_t> selector_hash; |
| 1019 | |
| 1020 | for (uint32_t i = 0; i < m_source_blocks.size(); i++) |
| 1021 | { |
| 1022 | etc_block blk; |
| 1023 | pack_etc1_block(blk, m_source_blocks[i].get_ptr(), pack_params, pack_context); |
| 1024 | |
| 1025 | const color_rgba c0(blk.get_block_color(0, false)); |
| 1026 | endpoint_hash.insert((c0.r | (c0.g << 5) | (c0.b << 10)) | (blk.get_inten_table(0) << 16)); |
| 1027 | |
| 1028 | const color_rgba c1(blk.get_block_color(1, false)); |
| 1029 | endpoint_hash.insert((c1.r | (c1.g << 5) | (c1.b << 10)) | (blk.get_inten_table(1) << 16)); |
| 1030 | |
| 1031 | selector_hash.insert(blk.get_raw_selector_bits()); |
| 1032 | } |
| 1033 | |
| 1034 | const uint32_t total_unique_endpoints = (uint32_t)endpoint_hash.size(); |
| 1035 | const uint32_t total_unique_selectors = (uint32_t)selector_hash.size(); |
| 1036 | |
| 1037 | if (m_params.m_debug) |
| 1038 | { |
| 1039 | debug_printf("Unique endpoints: %u, unique selectors: %u\n", total_unique_endpoints, total_unique_selectors); |
| 1040 | } |
| 1041 | #endif |
| 1042 | |
| 1043 | const double total_texels = m_total_blocks * 16.0f; |
| 1044 | |
| 1045 | int endpoint_clusters = m_params.m_max_endpoint_clusters; |
| 1046 | int selector_clusters = m_params.m_max_selector_clusters; |
| 1047 | |
| 1048 | if (endpoint_clusters > basisu_frontend::cMaxEndpointClusters) |
| 1049 | { |
| 1050 | error_printf("Too many endpoint clusters! (%u but max is %u)\n", endpoint_clusters, basisu_frontend::cMaxEndpointClusters); |
| 1051 | return false; |
| 1052 | } |
| 1053 | if (selector_clusters > basisu_frontend::cMaxSelectorClusters) |
| 1054 | { |
| 1055 | error_printf("Too many selector clusters! (%u but max is %u)\n", selector_clusters, basisu_frontend::cMaxSelectorClusters); |
| 1056 | return false; |
| 1057 | } |
| 1058 | |
| 1059 | if (m_params.m_quality_level != -1) |
| 1060 | { |
| 1061 | const float quality = saturate(m_params.m_quality_level / 255.0f); |
nothing calls this directly
no test coverage detected