Commit 5e41892a authored by vitor's avatar vitor

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.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@14341 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 2f75eaff
...@@ -105,9 +105,12 @@ static int get_high_utility_cell(elbg_data *elbg) ...@@ -105,9 +105,12 @@ static int get_high_utility_cell(elbg_data *elbg)
{ {
int i=0; int i=0;
/* Using linear search, do binary if it ever turns to be speed critical */ /* 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) while (elbg->utility_inc[i] < r)
i++; i++;
assert(!elbg->cells[i]);
return i; return i;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment