changeset 11812:b7d5e6078e04 libavcodec

Avoid division by zero that caused noise, typically at the beginning or end of a file. Patch by Frank Barchard, fbarchard google
author cehoyos
date Wed, 02 Jun 2010 16:09:19 +0000
parents 2501df1cabc5
children fda5ab5d31bb
files vorbis_enc.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/vorbis_enc.c	Wed Jun 02 15:22:21 2010 +0000
+++ b/vorbis_enc.c	Wed Jun 02 16:09:19 2010 +0000
@@ -681,7 +681,7 @@
         float average = averages[i];
         int j;
 
-        average *= pow(tot_average / average, 0.5) * pow(1.25, position/200.); // MAGIC!
+        average = sqrt(tot_average * average) * pow(1.25f, position*0.005f); // MAGIC!
         for (j = 0; j < range - 1; j++)
             if (ff_vorbis_floor1_inverse_db_table[j * fc->multiplier] > average)
                 break;