| 1208 | } |
| 1209 | |
| 1210 | bool basis_compressor::extract_frontend_texture_data() |
| 1211 | { |
| 1212 | if (!m_params.m_compute_stats) |
| 1213 | return true; |
| 1214 | |
| 1215 | debug_printf("basis_compressor::extract_frontend_texture_data\n"); |
| 1216 | |
| 1217 | m_frontend_output_textures.resize(m_slice_descs.size()); |
| 1218 | m_best_etc1s_images.resize(m_slice_descs.size()); |
| 1219 | m_best_etc1s_images_unpacked.resize(m_slice_descs.size()); |
| 1220 | |
| 1221 | for (uint32_t i = 0; i < m_slice_descs.size(); i++) |
| 1222 | { |
| 1223 | const basisu_backend_slice_desc &slice_desc = m_slice_descs[i]; |
| 1224 | |
| 1225 | const uint32_t num_blocks_x = slice_desc.m_num_blocks_x; |
| 1226 | const uint32_t num_blocks_y = slice_desc.m_num_blocks_y; |
| 1227 | |
| 1228 | const uint32_t width = num_blocks_x * 4; |
| 1229 | const uint32_t height = num_blocks_y * 4; |
| 1230 | |
| 1231 | m_frontend_output_textures[i].init(texture_format::cETC1, width, height); |
| 1232 | |
| 1233 | for (uint32_t block_y = 0; block_y < num_blocks_y; block_y++) |
| 1234 | for (uint32_t block_x = 0; block_x < num_blocks_x; block_x++) |
| 1235 | memcpy(m_frontend_output_textures[i].get_block_ptr(block_x, block_y, 0), &m_frontend.get_output_block(slice_desc.m_first_block_index + block_x + block_y * num_blocks_x), sizeof(etc_block)); |
| 1236 | |
| 1237 | #if 0 |
| 1238 | if (m_params.m_debug_images) |
| 1239 | { |
| 1240 | char filename[1024]; |
| 1241 | sprintf_s(filename, sizeof(filename), "rdo_etc_frontend_%u_", i); |
| 1242 | write_etc1_vis_images(m_frontend_output_textures[i], filename); |
| 1243 | } |
| 1244 | #endif |
| 1245 | |
| 1246 | m_best_etc1s_images[i].init(texture_format::cETC1, width, height); |
| 1247 | for (uint32_t block_y = 0; block_y < num_blocks_y; block_y++) |
| 1248 | for (uint32_t block_x = 0; block_x < num_blocks_x; block_x++) |
| 1249 | memcpy(m_best_etc1s_images[i].get_block_ptr(block_x, block_y, 0), &m_frontend.get_etc1s_block(slice_desc.m_first_block_index + block_x + block_y * num_blocks_x), sizeof(etc_block)); |
| 1250 | |
| 1251 | m_best_etc1s_images[i].unpack(m_best_etc1s_images_unpacked[i]); |
| 1252 | } |
| 1253 | |
| 1254 | return true; |
| 1255 | } |
| 1256 | |
| 1257 | bool basis_compressor::process_backend() |
| 1258 | { |
nothing calls this directly
no test coverage detected