Avoid using log2() since it's not in C90
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Thu, 1 Jun 2017 17:21:59 +0000 (13:21 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Thu, 1 Jun 2017 17:21:59 +0000 (13:21 -0400)
src/analysis.c

index e3c93f8..7591baa 100644 (file)
@@ -481,7 +481,7 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
           E += binE;
        }
        E = SCALE_ENER(E);
-       band_log2[0] = (float).5*log2(E+1e-10f);
+       band_log2[0] = .5f*1.442695f*(float)log(E+1e-10f);
     }
     for (b=0;b<NB_TBANDS;b++)
     {
@@ -512,7 +512,7 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
 
        frame_loudness += (float)sqrt(E+1e-10f);
        logE[b] = (float)log(E+1e-10f);
-       band_log2[b+1] = (float).5*log2(E+1e-10f);
+       band_log2[b+1] = .5f*1.442695f*(float)log(E+1e-10f);
        tonal->logE[tonal->E_count][b] = logE[b];
        if (tonal->count==0)
           tonal->highE[b] = tonal->lowE[b] = logE[b];