| 1169 | } |
| 1170 | |
| 1171 | static bool test_compress_etc1s() |
| 1172 | { |
| 1173 | printf("test_compress_etc1s:\n"); |
| 1174 | |
| 1175 | const uint32_t W = 256, H = 256; |
| 1176 | |
| 1177 | image img(W, H); |
| 1178 | for (uint32_t y = 0; y < H; y++) |
| 1179 | for (uint32_t x = 0; x < W; x++) |
| 1180 | img(x, y).set(((x ^ y) & 1) ? 255 : 0); |
| 1181 | |
| 1182 | basis_compressor_params params; |
| 1183 | |
| 1184 | // Set the format to ETC1S using the recommended unified method. |
| 1185 | params.set_format_mode_and_quality_effort(basist::basis_tex_format::cETC1S, 75, 3); |
| 1186 | |
| 1187 | // Input is sRGB |
| 1188 | params.set_srgb_options(true); |
| 1189 | |
| 1190 | // Provide the HDR source image. |
| 1191 | params.m_source_images.push_back(img); |
| 1192 | |
| 1193 | // Enable debug/status output and statistics. |
| 1194 | params.m_debug = true; |
| 1195 | params.m_status_output = true; |
| 1196 | params.m_compute_stats = true; |
| 1197 | |
| 1198 | // Write a .KTX2 file to disk. |
| 1199 | params.m_create_ktx2_file = true; |
| 1200 | params.m_write_output_basis_or_ktx2_files = true; |
| 1201 | params.m_out_filename = "test_etc1s.ktx2"; |
| 1202 | |
| 1203 | // Create a job pool. A job pool MUST always be created, even if threading is disabled. |
| 1204 | // num_total_threads is the TOTAL thread count: 1 = calling thread only, 7 = calling thread + 6 extra. |
| 1205 | const uint32_t NUM_THREADS = 7; |
| 1206 | job_pool jp(NUM_THREADS); |
| 1207 | params.m_pJob_pool = &jp; |
| 1208 | params.m_multithreading = true; |
| 1209 | |
| 1210 | // Initialize and run the compressor. |
| 1211 | basis_compressor comp; |
| 1212 | if (!comp.init(params)) |
| 1213 | return false; |
| 1214 | |
| 1215 | basisu::basis_compressor::error_code ec = comp.process(); |
| 1216 | if (ec != basisu::basis_compressor::cECSuccess) |
| 1217 | return false; |
| 1218 | |
| 1219 | return true; |
| 1220 | } |
| 1221 | |
| 1222 | static bool test_compress_uastc_ldr_4x4() |
| 1223 | { |
no test coverage detected