]> git.nihav.org Git - nihav.git/commitdiff
nihav_core/scale: fix ELBG palettisation in the same way as the generic version
authorKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 8 Jul 2020 15:26:54 +0000 (17:26 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 8 Jul 2020 15:26:54 +0000 (17:26 +0200)
nihav-core/src/scale/palette/elbg.rs

index 300b3f1610b5dc33f8a52c05df64099e2e671344..8b67a513fdc84797b33aa103d6a57f9d7bde4a04 100644 (file)
@@ -66,9 +66,6 @@ impl Cluster {
         }
     }
     fn calc_dist(&mut self) {
-        if self.count != 0 {
-            self.dist = (self.dist + self.count / 2) / self.count;
-        }
     }
 }
 
@@ -232,7 +229,7 @@ impl ELBG {
         let mut rng = RNG::new();
         let mut iterations = 0usize;
         let mut do_elbg_step = true;
-        while (iterations < 20) && (dist < prev_dist - prev_dist / 1000) {
+        while (iterations < 10) && (dist < prev_dist - prev_dist / 100) {
             prev_dist = dist;
             for i in 0..256 {
                 old_cb[i] = self.clusters[i].centroid;