]> git.sesse.net Git - ffmpeg/commitdiff
The codebook generator algorithm involves picking three
authorVitor Sessak <vitor1001@gmail.com>
Wed, 23 Jul 2008 03:54:31 +0000 (03:54 +0000)
committerVitor Sessak <vitor1001@gmail.com>
Wed, 23 Jul 2008 03:54:31 +0000 (03:54 +0000)
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.

Originally committed as revision 14340 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/elbg.c

index 130f5f634cac3b6c8ce34ebf3f5a61556b24ce3b..9f8ed221a43706915b6f2e513eb714078fea851a 100644 (file)
@@ -299,8 +299,10 @@ static void do_shiftings(elbg_data *elbg)
             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);
         }