diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-09-09 16:39:19 -0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-09-09 16:39:19 -0400 |
commit | ba7dbb365ebb1acff445a017d31e1bb859f0a9fb (patch) | |
tree | 302b5795e9d5096a864804c777f1cd5dc40b933c /src/analysis.c | |
parent | fc1b1f9b441c2ffe090046c968e5d95f2eafb038 (diff) | |
download | opus-ba7dbb365ebb1acff445a017d31e1bb859f0a9fb.tar.gz |
Analysis scaling fixes
This should make the scaling the same for fixed and float. It changes the float
scaling too by normalizing by the number of channels, which matters for
bandwidth detection.
Diffstat (limited to 'src/analysis.c')
-rw-r--r-- | src/analysis.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/analysis.c b/src/analysis.c index 6a1840b1..b79e869a 100644 --- a/src/analysis.c +++ b/src/analysis.c @@ -347,7 +347,7 @@ void tonality_analysis(TonalityAnalysisState *tonal, AnalysisInfo *info_out, con tonal->highE[b]+=.5f; tonal->lowE[b]-=.5f; } - relativeE += (logE[b]-tonal->lowE[b])/(EPSILON+tonal->highE[b]-tonal->lowE[b]); + relativeE += (logE[b]-tonal->lowE[b])/(1e-15+tonal->highE[b]-tonal->lowE[b]); L1=L2=0; for (i=0;i<NB_FRAMES;i++) @@ -356,12 +356,12 @@ void tonality_analysis(TonalityAnalysisState *tonal, AnalysisInfo *info_out, con L2 += tonal->E[i][b]; } - stationarity = MIN16(0.99f,L1/sqrt(EPSILON+NB_FRAMES*L2)); + stationarity = MIN16(0.99f,L1/sqrt(1e-15+NB_FRAMES*L2)); stationarity *= stationarity; stationarity *= stationarity; frame_stationarity += stationarity; /*band_tonality[b] = tE/(1e-15+E)*/; - band_tonality[b] = MAX16(tE/(EPSILON+E), stationarity*tonal->prev_band_tonality[b]); + band_tonality[b] = MAX16(tE/(1e-15+E), stationarity*tonal->prev_band_tonality[b]); #if 0 if (b>=NB_TONAL_SKIP_BANDS) { |