diff options
author | Oded Shimon <ods15@ods15.dyndns.org> | 2006-10-02 06:09:24 +0000 |
---|---|---|
committer | Oded Shimon <ods15@ods15.dyndns.org> | 2006-10-02 06:09:24 +0000 |
commit | cc767a89690935048373151a556041fde536c6ef (patch) | |
tree | 88296829fac8d0a9888a5fb5ed5654e53c64d80f /libavcodec | |
parent | 7e46045784e2b737f43962c643b930195c7d7057 (diff) | |
download | ffmpeg-cc767a89690935048373151a556041fde536c6ef.tar.gz |
Original Commit: r103 | ods15 | 2006-10-01 18:00:43 +0200 (Sun, 01 Oct 2006) | 2 lines
slight optimization, don't calculate average twice
Originally committed as revision 6507 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/vorbis_enc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/vorbis_enc.c b/libavcodec/vorbis_enc.c index 0fe629874a..964e1a108e 100644 --- a/libavcodec/vorbis_enc.c +++ b/libavcodec/vorbis_enc.c @@ -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! |