summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2008-07-23 05:54:34 +0000
committerVitor Sessak <vitor1001@gmail.com>2008-07-23 05:54:34 +0000
commit144b46f21bec16501f30ec3dae1a60261144a8e8 (patch)
tree4280e417902341d2d4a03b76cc1c7083c7675b1d
parent6de727244c559c4565ec88b96da1f4f6269c2819 (diff)
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. Originally committed as revision 14343 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/elbg.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libavcodec/elbg.c b/libavcodec/elbg.c
index 87ff0236b7..fed25fcdd4 100644
--- a/libavcodec/elbg.c
+++ b/libavcodec/elbg.c
@@ -306,12 +306,11 @@ 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);
+ if (idx[1] != idx[0] && idx[1] != idx[2])
+ try_shift_candidate(elbg, idx);
}
}