codec_support/vq: use 1% improvement as a threshold in ELBG loop
[nihav.git] / nihav-codec-support / src / vq / generic_elbg.rs
index 3c3e3c075f480043b3834e88e24ba6eb7bbc89fc..91a56586d81bc1c619ddecde52d7edf6e8d6b3e0 100644 (file)
@@ -56,9 +56,6 @@ impl<T: VQElement, TS: VQElementSum<T>> Cluster<T, TS> {
         }
     }
     fn calc_dist(&mut self) {
-        if self.count != 0 {
-            self.dist = (self.dist + self.count / 2) / self.count;
-        }
     }
 }
 
@@ -184,7 +181,7 @@ impl<T: VQElement+Default, TS: VQElementSum<T>> ELBG<T, TS> {
         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 < 20) && (dist < prev_dist - prev_dist / 100) {
             prev_dist = dist;
             for i in 0..dst.len() {
                 old_cb[i] = self.clusters[i].centroid;