MCPcopy Create free account
hub / github.com/BinomialLLC/basis_universal / process_frontend

Method process_frontend

encoder/basisu_comp.cpp:2768–2972  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2766 }
2767
2768 bool basis_compressor::process_frontend()
2769 {
2770 debug_printf("basis_compressor::process_frontend\n");
2771
2772#if 0
2773 // TODO
2774 basis_etc1_pack_params pack_params;
2775 pack_params.m_quality = cETCQualityMedium;
2776 pack_params.m_perceptual = m_params.m_perceptual;
2777 pack_params.m_use_color4 = false;
2778
2779 pack_etc1_block_context pack_context;
2780
2781 std::unordered_set<uint64_t> endpoint_hash;
2782 std::unordered_set<uint32_t> selector_hash;
2783
2784 for (uint32_t i = 0; i < m_source_blocks.size(); i++)
2785 {
2786 etc_block blk;
2787 pack_etc1_block(blk, m_source_blocks[i].get_ptr(), pack_params, pack_context);
2788
2789 const color_rgba c0(blk.get_block_color(0, false));
2790 endpoint_hash.insert((c0.r | (c0.g << 5) | (c0.b << 10)) | (blk.get_inten_table(0) << 16));
2791
2792 const color_rgba c1(blk.get_block_color(1, false));
2793 endpoint_hash.insert((c1.r | (c1.g << 5) | (c1.b << 10)) | (blk.get_inten_table(1) << 16));
2794
2795 selector_hash.insert(blk.get_raw_selector_bits());
2796 }
2797
2798 const uint32_t total_unique_endpoints = (uint32_t)endpoint_hash.size();
2799 const uint32_t total_unique_selectors = (uint32_t)selector_hash.size();
2800
2801 if (m_params.m_debug)
2802 {
2803 debug_printf("Unique endpoints: %u, unique selectors: %u\n", total_unique_endpoints, total_unique_selectors);
2804 }
2805#endif
2806
2807 const double total_texels = m_total_blocks * 16.0f;
2808
2809 int endpoint_clusters = m_params.m_etc1s_max_endpoint_clusters;
2810 int selector_clusters = m_params.m_etc1s_max_selector_clusters;
2811
2812 if (endpoint_clusters > basisu_frontend::cMaxEndpointClusters)
2813 {
2814 error_printf("Too many endpoint clusters! (%u but max is %u)\n", endpoint_clusters, basisu_frontend::cMaxEndpointClusters);
2815 return false;
2816 }
2817 if (selector_clusters > basisu_frontend::cMaxSelectorClusters)
2818 {
2819 error_printf("Too many selector clusters! (%u but max is %u)\n", selector_clusters, basisu_frontend::cMaxSelectorClusters);
2820 return false;
2821 }
2822
2823 if (m_params.m_quality_level != -1)
2824 {
2825 const float quality = saturate(m_params.m_quality_level / 255.0f);

Callers

nothing calls this directly

Calls 14

error_printfFunction · 0.85
saturateFunction · 0.85
get_block_colorMethod · 0.80
get_inten_tableMethod · 0.80
get_raw_selector_bitsMethod · 0.80
dump_debug_imageMethod · 0.80
lerpFunction · 0.70
sizeMethod · 0.45
get_ptrMethod · 0.45
insertMethod · 0.45
was_changedMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected