| 1325 | } |
| 1326 | |
| 1327 | void palette_index_reorderer::find_next_entry(uint32_t &best_entry, double &best_count, pEntry_dist_func pDist_func, void *pCtx, float dist_func_weight) |
| 1328 | { |
| 1329 | best_entry = 0; |
| 1330 | best_count = 0; |
| 1331 | |
| 1332 | for (uint32_t i = 0; i < m_entries_to_do.size(); i++) |
| 1333 | { |
| 1334 | const uint32_t u = m_entries_to_do[i]; |
| 1335 | double total_count = m_total_count_to_picked[u]; |
| 1336 | |
| 1337 | if (pDist_func) |
| 1338 | { |
| 1339 | float w = maximum<float>((*pDist_func)(u, m_entries_picked.front(), pCtx), (*pDist_func)(u, m_entries_picked.back(), pCtx)); |
| 1340 | assert((w >= 0.0f) && (w <= 1.0f)); |
| 1341 | total_count = (total_count + 1.0f) * lerp(1.0f - dist_func_weight, 1.0f + dist_func_weight, w); |
| 1342 | } |
| 1343 | |
| 1344 | if (total_count <= best_count) |
| 1345 | continue; |
| 1346 | |
| 1347 | best_entry = i; |
| 1348 | best_count = total_count; |
| 1349 | } |
| 1350 | } |
| 1351 | |
| 1352 | float palette_index_reorderer::pick_side(uint32_t num_syms, uint32_t entry_to_move, pEntry_dist_func pDist_func, void *pCtx, float dist_func_weight) |
| 1353 | { |