X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;ds=sidebyside;f=nihav-core%2Fsrc%2Fscale%2Fpalette%2Felbg.rs;h=a9704f9cb165987fbedcf7f1421c8f9bd9a6f1c9;hb=d0d21988dc679ac5d87968da01a55ec3dc375fee;hp=300b3f1610b5dc33f8a52c05df64099e2e671344;hpb=b36f412c24813b14cb2b1f8fd151863e2a49c1e2;p=nihav.git diff --git a/nihav-core/src/scale/palette/elbg.rs b/nihav-core/src/scale/palette/elbg.rs index 300b3f1..a9704f9 100644 --- a/nihav-core/src/scale/palette/elbg.rs +++ b/nihav-core/src/scale/palette/elbg.rs @@ -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;