[FFmpeg-cvslog] r14341 - trunk/libavcodec/elbg.c
vitor
subversion
Wed Jul 23 05:55:38 CEST 2008
Author: vitor
Date: Wed Jul 23 05:55:37 2008
New Revision: 14341
Log:
When picking a "high utility centroid" do not pick one
that has no corresponding points. Not only it is the
worst possible pick, but also the code was written
without this case in mind.
Modified:
trunk/libavcodec/elbg.c
Modified: trunk/libavcodec/elbg.c
==============================================================================
--- trunk/libavcodec/elbg.c (original)
+++ trunk/libavcodec/elbg.c Wed Jul 23 05:55:37 2008
@@ -105,9 +105,12 @@ static int get_high_utility_cell(elbg_da
{
int i=0;
/* Using linear search, do binary if it ever turns to be speed critical */
- int r = av_random(elbg->rand_state)%elbg->utility_inc[elbg->numCB-1];
+ int r = av_random(elbg->rand_state)%(elbg->utility_inc[elbg->numCB-1]-1) + 1;
while (elbg->utility_inc[i] < r)
i++;
+
+ assert(!elbg->cells[i]);
+
return i;
}
More information about the ffmpeg-cvslog
mailing list