comparison elbg.c @ 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 5b7d5a33a3e2
comparison
equal deleted inserted replaced
7353:3d9cdb5a4f01 7354:456957d86106
304 for (idx[0]=0; idx[0] < elbg->numCB; idx[0]++) 304 for (idx[0]=0; idx[0] < elbg->numCB; idx[0]++)
305 if (elbg->numCB*elbg->utility[idx[0]] < elbg->error) { 305 if (elbg->numCB*elbg->utility[idx[0]] < elbg->error) {
306 if (elbg->utility_inc[elbg->numCB-1] == 0) 306 if (elbg->utility_inc[elbg->numCB-1] == 0)
307 return; 307 return;
308 308
309 idx[1] = get_high_utility_cell(elbg);
309 idx[2] = get_closest_codebook(elbg, idx[0]); 310 idx[2] = get_closest_codebook(elbg, idx[0]);
310 do { 311
311 idx[1] = get_high_utility_cell(elbg); 312 if (idx[1] != idx[0] && idx[1] != idx[2])
312 } while (idx[1] == idx[0] || idx[1] == idx[2]); 313 try_shift_candidate(elbg, idx);
313
314 try_shift_candidate(elbg, idx);
315 } 314 }
316 } 315 }
317 316
318 #define BIG_PRIME 433494437LL 317 #define BIG_PRIME 433494437LL
319 318