Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ChafaPalette: Improve dynamic palette generator
This replaces the old median cut quantizer with a pairwise nearest-neighbor clustering approach. It also makes the sixel quantization parameters tunable with -w. The new approach is faster and yields much higher quality. On the highest setting, it outperforms ImageMagick on peak absolute error and comes close in other quality measurements, using less than 1/8 of the energy and 1/24 wall clock time (4 cores). The prepared image in the below test is a 3873x2582 QIF image. Other images show a similar trend. Dithering was turned off in all tests. specimen ncolors MSE SSIM PSNR PAE utime elapsed peakrss original 37568 - - - - - - - prepared 34683 - - - - - - - magick 251 2.873 0.967 43.582 5654 3.89 3.96 283296 img2sixel 250 6.857 0.912 39.803 5397 7.90 7.93 114412 ncplayer 294 21.944 0.858 34.752 8995 0.67 0.54 204612 chafa-old 162 6.002 0.964 40.382 8481 0.50 0.15 95104 chafa-w1 24 27.572 0.838 33.760 6939 0.25 0.10 95104 chafa-w2 25 26.801 0.838 33.883 6682 0.26 0.10 94976 chafa-w3 135 7.390 0.929 39.478 4112 0.33 0.11 94984 chafa-w4 143 7.191 0.929 39.597 4112 0.34 0.11 95080 chafa-w5 154 7.221 0.929 39.578 3598 0.34 0.11 95000 chafa-w6 255 3.960 0.949 42.188 4369 0.43 0.13 94984 chafa-w7 255 3.991 0.949 42.154 3598 0.40 0.13 94860 chafa-w8 255 3.976 0.949 42.171 3855 0.42 0.16 94984 chafa-w9 255 3.965 0.949 42.182 3341 0.45 0.16 99008 Fixes #174 (GitHub).
- Loading branch information