fix clippy warnings for update to rustc 1.46
[nihav.git] / nihav-core / src / scale / palette / elbg.rs
index 300b3f1610b5dc33f8a52c05df64099e2e671344..a9704f9cb165987fbedcf7f1421c8f9bd9a6f1c9 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;
-        }
     }
 }
 
@@ -198,7 +195,7 @@ impl ELBG {
         clu1.calc_dist();
         clu0.dist + clu1.dist
     }
-    #[allow(clippy::cyclomatic_complexity)]
+    #[allow(clippy::cognitive_complexity)]
     pub fn quantise(&mut self, src: &[Pixel], dst: &mut [[u8; 3]; 256]) {
         if src.len() < 3 {
             return;
@@ -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;