| 943 | } |
| 944 | |
| 945 | static bool compress_mode(command_line_params &opts) |
| 946 | { |
| 947 | uint32_t num_threads = 1; |
| 948 | |
| 949 | if (opts.m_comp_params.m_multithreading) |
| 950 | { |
| 951 | // We use std::thread::hardware_concurrency() as a hint to determine the default # of threads to put into a pool. |
| 952 | num_threads = std::thread::hardware_concurrency(); |
| 953 | if (num_threads < 1) |
| 954 | num_threads = 1; |
| 955 | if (num_threads > opts.m_max_threads) |
| 956 | num_threads = opts.m_max_threads; |
| 957 | } |
| 958 | |
| 959 | job_pool compressor_jpool(opts.m_parallel_compression ? 1 : num_threads); |
| 960 | if (!opts.m_parallel_compression) |
| 961 | opts.m_comp_params.m_pJob_pool = &compressor_jpool; |
| 962 | |
| 963 | if (!expand_multifile(opts)) |
| 964 | { |
| 965 | error_printf("-multifile expansion failed!\n"); |
| 966 | return false; |
| 967 | } |
| 968 | |
| 969 | if (!opts.m_input_filenames.size()) |
| 970 | { |
| 971 | error_printf("No input files to process!\n"); |
| 972 | return false; |
| 973 | } |
| 974 | |
| 975 | basis_data* pGlobal_codebook_data = nullptr; |
| 976 | if (opts.m_etc1s_use_global_codebooks_file.size()) |
| 977 | { |
| 978 | pGlobal_codebook_data = load_basis_file(opts.m_etc1s_use_global_codebooks_file.c_str(), true); |
| 979 | if (!pGlobal_codebook_data) |
| 980 | return false; |
| 981 | |
| 982 | printf("Loaded global codebooks from .basis file \"%s\"\n", opts.m_etc1s_use_global_codebooks_file.c_str()); |
| 983 | |
| 984 | #if 0 |
| 985 | // Development/test code. TODO: Remove. |
| 986 | basis_data* pGlobal_codebook_data2 = load_basis_file("xmen_1024.basis", sel_codebook, true); |
| 987 | const basist::basisu_lowlevel_etc1s_transcoder &ta = pGlobal_codebook_data->m_transcoder.get_lowlevel_etc1s_decoder(); |
| 988 | const basist::basisu_lowlevel_etc1s_transcoder &tb = pGlobal_codebook_data2->m_transcoder.get_lowlevel_etc1s_decoder(); |
| 989 | if (ta.get_endpoints().size() != tb.get_endpoints().size()) |
| 990 | { |
| 991 | printf("Endpoint CB's don't match\n"); |
| 992 | } |
| 993 | else if (ta.get_selectors().size() != tb.get_selectors().size()) |
| 994 | { |
| 995 | printf("Selector CB's don't match\n"); |
| 996 | } |
| 997 | else |
| 998 | { |
| 999 | for (uint32_t i = 0; i < ta.get_endpoints().size(); i++) |
| 1000 | { |
| 1001 | if (ta.get_endpoints()[i] != tb.get_endpoints()[i]) |
| 1002 | { |
no test coverage detected