changeset 3902:bd0cb21d956d libavcodec

Original Commit: r103 | ods15 | 2006-10-01 18:00:43 +0200 (Sun, 01 Oct 2006) | 2 lines slight optimization, don't calculate average twice
author ods15
date Mon, 02 Oct 2006 06:09:24 +0000
parents e255692302f0
children 7a57a82cfa10
files vorbis_enc.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/vorbis_enc.c	Mon Oct 02 06:09:22 2006 +0000
+++ b/vorbis_enc.c	Mon Oct 02 06:09:24 2006 +0000
@@ -1116,13 +1116,14 @@
     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!