Improve weighting for palette optimizer