MCPcopy Create free account
hub / github.com/BinomialLLC/basis_universal / astc_init

Function astc_init

encoder/basisu_bc7enc.cpp:97–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95static uint8_t g_astc_nearest_sorted_index[BC7ENC_TOTAL_ASTC_RANGES][256];
96
97static void astc_init()
98{
99 for (uint32_t range = 0; range < BC7ENC_TOTAL_ASTC_RANGES; range++)
100 {
101 if (!astc_is_valid_endpoint_range(range))
102 continue;
103
104 const uint32_t levels = astc_get_levels(range);
105
106 uint32_t vals[256];
107 // TODO
108 for (uint32_t i = 0; i < levels; i++)
109 vals[i] = (unquant_astc_endpoint_val(i, range) << 8) | i;
110
111 std::sort(vals, vals + levels);
112
113 for (uint32_t i = 0; i < levels; i++)
114 {
115 uint32_t order = vals[i] & 0xFF;
116 uint32_t unq = vals[i] >> 8;
117
118 g_astc_sorted_order_unquant[range][i].m_unquant = (uint8_t)unq;
119 g_astc_sorted_order_unquant[range][i].m_index = (uint8_t)order;
120
121 } // i
122
123#if 0
124 if (g_astc_bise_range_table[range][1] || g_astc_bise_range_table[range][2])
125 {
126 printf("// Range: %u, Levels: %u, Bits: %u, Trits: %u, Quints: %u\n", range, levels, g_astc_bise_range_table[range][0], g_astc_bise_range_table[range][1], g_astc_bise_range_table[range][2]);
127
128 printf("{");
129 for (uint32_t i = 0; i < levels; i++)
130 {
131 printf("{%u,%u}", g_astc_sorted_order_unquant[range][i].m_index, g_astc_sorted_order_unquant[range][i].m_unquant);
132 if (i != (levels - 1))
133 printf(",");
134 }
135 printf("}\n");
136 }
137#endif
138
139#if 0
140 if (g_astc_bise_range_table[range][1] || g_astc_bise_range_table[range][2])
141 {
142 printf("// Range: %u, Levels: %u, Bits: %u, Trits: %u, Quints: %u\n", range, levels, g_astc_bise_range_table[range][0], g_astc_bise_range_table[range][1], g_astc_bise_range_table[range][2]);
143
144 printf("{");
145 for (uint32_t i = 0; i < levels; i++)
146 {
147 printf("{%u,%u}", g_astc_unquant[range][i].m_index, g_astc_unquant[range][i].m_unquant);
148 if (i != (levels - 1))
149 printf(",");
150 }
151 printf("}\n");
152 }
153#endif
154

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected