diff elbg.c @ 7351:1502ba3beb72 libavcodec

The codebook generator algorithm involves picking three different codebook centroids ("high utility", "low utility" and "closest to the low utility one"). This change avoid the corner case of choosing two times the same centroid.
author vitor
date Wed, 23 Jul 2008 03:54:31 +0000
parents f7cbb7733146
children c2318e551ff5
line wrap: on
line diff
--- a/elbg.c	Wed Jul 23 02:12:54 2008 +0000
+++ b/elbg.c	Wed Jul 23 03:54:31 2008 +0000
@@ -299,8 +299,10 @@
             if (elbg->utility_inc[elbg->numCB-1] == 0)
                 return;
 
-            idx[1] = get_high_utility_cell(elbg);
             idx[2] = get_closest_codebook(elbg, idx[0]);
+            do {
+                idx[1] = get_high_utility_cell(elbg);
+            } while (idx[1] == idx[0] || idx[1] == idx[2]);
 
             try_shift_candidate(elbg, idx);
         }