changeset 7354:456957d86106 libavcodec

My commit at r14340 was not the right solution. For a monochromatic frame, there will be only one centroid and it will be impossible to find three distinct ones. It is better to just avoid shifting if there are not three different centroids.
author vitor
date Wed, 23 Jul 2008 05:54:34 +0000
parents 3d9cdb5a4f01
children 5719e2c85aa3
files elbg.c
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/elbg.c	Wed Jul 23 03:56:13 2008 +0000
+++ b/elbg.c	Wed Jul 23 05:54:34 2008 +0000
@@ -306,12 +306,11 @@
             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);
+            if (idx[1] != idx[0] && idx[1] != idx[2])
+                try_shift_candidate(elbg, idx);
         }
 }