| 1745 | } |
| 1746 | |
| 1747 | uint32_t basisu_backend::encode() |
| 1748 | { |
| 1749 | //const bool is_video = m_pFront_end->get_params().m_tex_type == basist::cBASISTexTypeVideoFrames; |
| 1750 | m_output.m_slice_desc = m_slices; |
| 1751 | m_output.m_etc1s = m_params.m_etc1s; |
| 1752 | m_output.m_uses_global_codebooks = m_params.m_used_global_codebooks; |
| 1753 | m_output.m_srgb = m_pFront_end->get_params().m_perceptual; |
| 1754 | |
| 1755 | create_endpoint_palette(); |
| 1756 | create_selector_palette(); |
| 1757 | |
| 1758 | create_encoder_blocks(); |
| 1759 | |
| 1760 | if (!encode_image()) |
| 1761 | return 0; |
| 1762 | |
| 1763 | if (!encode_endpoint_palette()) |
| 1764 | return 0; |
| 1765 | |
| 1766 | if (!encode_selector_palette()) |
| 1767 | return 0; |
| 1768 | |
| 1769 | uint32_t total_compressed_bytes = (uint32_t)(m_output.m_slice_image_tables.size() + m_output.m_endpoint_palette.size() + m_output.m_selector_palette.size()); |
| 1770 | for (uint32_t i = 0; i < m_output.m_slice_image_data.size(); i++) |
| 1771 | total_compressed_bytes += (uint32_t)m_output.m_slice_image_data[i].size(); |
| 1772 | |
| 1773 | debug_printf("Wrote %u bytes, %3.3f bits/texel\n", total_compressed_bytes, total_compressed_bytes * 8.0f / get_total_input_texels()); |
| 1774 | |
| 1775 | return total_compressed_bytes; |
| 1776 | } |
| 1777 | |
| 1778 | } // namespace basisu |
no test coverage detected