aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2008-07-23 03:54:31 +0000
committerVitor Sessak <vitor1001@gmail.com>2008-07-23 03:54:31 +0000
commit5916af1954f0c25f06e87d2076aaf536c684ed98 (patch)
tree40507a8da25e7fad96da22b0ac2f9dd6092c4cca /libavcodec
parent26b86e47c010029d7ca7c7264f710c240d85339a (diff)
downloadffmpeg-5916af1954f0c25f06e87d2076aaf536c684ed98.tar.gz
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. Originally committed as revision 14340 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/elbg.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/elbg.c b/libavcodec/elbg.c
index 130f5f634c..9f8ed221a4 100644
--- a/libavcodec/elbg.c
+++ b/libavcodec/elbg.c
@@ -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);
}