Commit 35082274 authored by ods15's avatar ods15

Original Commit: r103 | ods15 | 2006-10-01 18:00:43 +0200 (Sun, 01 Oct 2006) | 2 lines

slight optimization, don't calculate average twice

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@6507 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 79101e17
......@@ -1116,13 +1116,14 @@ static void floor_fit(venc_context_t * venc, floor_t * fc, float * coeffs, int *
int range = 255 / fc->multiplier + 1;
int i;
float tot_average = 0.;
for (i = 0; i < fc->values; i++) tot_average += get_floor_average(fc, coeffs, i);
float averages[fc->values];
for (i = 0; i < fc->values; i++) tot_average += averages[i] = get_floor_average(fc, coeffs, i);
tot_average /= fc->values;
tot_average /= venc->quality;
for (i = 0; i < fc->values; i++) {
int position = fc->list[fc->list[i].sort].x;
float average = get_floor_average(fc, coeffs, i);
float average = averages[i];
int j;
average /= pow(average, 0.5) / tot_average * pow(0.8, position/200.); // MAGIC!
......
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