| 404 | } |
| 405 | |
| 406 | void basisu_backend::create_encoder_blocks() |
| 407 | { |
| 408 | debug_printf("basisu_backend::create_encoder_blocks\n"); |
| 409 | |
| 410 | interval_timer tm; |
| 411 | tm.start(); |
| 412 | |
| 413 | basisu_frontend& r = *m_pFront_end; |
| 414 | const bool is_video = r.get_params().m_tex_type == basist::cBASISTexTypeVideoFrames; |
| 415 | |
| 416 | m_slice_encoder_blocks.resize(m_slices.size()); |
| 417 | |
| 418 | uint32_t total_endpoint_pred_missed = 0, total_endpoint_pred_hits = 0, total_block_endpoints_remapped = 0; |
| 419 | |
| 420 | uint_vec all_endpoint_indices; |
| 421 | all_endpoint_indices.reserve(get_total_blocks()); |
| 422 | |
| 423 | for (uint32_t slice_index = 0; slice_index < m_slices.size(); slice_index++) |
| 424 | { |
| 425 | const int prev_frame_slice_index = is_video ? find_video_frame(slice_index, -1) : -1; |
| 426 | const bool is_iframe = m_slices[slice_index].m_iframe; |
| 427 | const uint32_t first_block_index = m_slices[slice_index].m_first_block_index; |
| 428 | |
| 429 | //const uint32_t width = m_slices[slice_index].m_width; |
| 430 | //const uint32_t height = m_slices[slice_index].m_height; |
| 431 | const uint32_t num_blocks_x = m_slices[slice_index].m_num_blocks_x; |
| 432 | const uint32_t num_blocks_y = m_slices[slice_index].m_num_blocks_y; |
| 433 | |
| 434 | m_slice_encoder_blocks[slice_index].resize(num_blocks_x, num_blocks_y); |
| 435 | |
| 436 | for (uint32_t block_y = 0; block_y < num_blocks_y; block_y++) |
| 437 | { |
| 438 | for (uint32_t block_x = 0; block_x < num_blocks_x; block_x++) |
| 439 | { |
| 440 | const uint32_t block_index = first_block_index + block_x + block_y * num_blocks_x; |
| 441 | |
| 442 | encoder_block& m = m_slice_encoder_blocks[slice_index](block_x, block_y); |
| 443 | |
| 444 | m.m_endpoint_index = r.get_subblock_endpoint_cluster_index(block_index, 0); |
| 445 | BASISU_BACKEND_VERIFY(r.get_subblock_endpoint_cluster_index(block_index, 0) == r.get_subblock_endpoint_cluster_index(block_index, 1)); |
| 446 | |
| 447 | m.m_selector_index = r.get_block_selector_cluster_index(block_index); |
| 448 | |
| 449 | m.m_endpoint_predictor = basist::NO_ENDPOINT_PRED_INDEX; |
| 450 | |
| 451 | const uint32_t block_endpoint = m.m_endpoint_index; |
| 452 | |
| 453 | uint32_t best_endpoint_pred = UINT32_MAX; |
| 454 | |
| 455 | for (uint32_t endpoint_pred = 0; endpoint_pred < basist::NUM_ENDPOINT_PREDS; endpoint_pred++) |
| 456 | { |
| 457 | if ((is_video) && (endpoint_pred == basist::CR_ENDPOINT_PRED_INDEX)) |
| 458 | { |
| 459 | if ((prev_frame_slice_index != -1) && (!is_iframe)) |
| 460 | { |
| 461 | const uint32_t cur_endpoint = m_slice_encoder_blocks[slice_index](block_x, block_y).m_endpoint_index; |
| 462 | const uint32_t cur_selector = m_slice_encoder_blocks[slice_index](block_x, block_y).m_selector_index; |
| 463 | const uint32_t prev_endpoint = m_slice_encoder_blocks[prev_frame_slice_index](block_x, block_y).m_endpoint_index; |
nothing calls this directly
no test coverage detected