3 ms·
The best palette-reducing algorithm I know is the one by Xiaolin Wu: https://www.ece.mcmaster.ca/~xwu/cq.c https://www.ece.mcmaster.ca/~xwu/cq.c That particula
by Const-me 4y ago
The best palette-reducing algorithm I know is the one by Xiaolin Wu: https://www.ece.mcmaster.ca/~xwu/cq.c https://www.ece.mcmaster.ca/~xwu/cq.c
That particular implementation is less than ideal. It has issues with correctness (the precision of FP32 accumulators was not enough for my use cases, needed an upgrade to FP64), performance (no SIMD), and subjective code quality (I tend to avoid global variables for things like that).
But the algorithm itself is awesome.