ref: 15a30e282586f9c88784975944daf9e6c44aa72a
parent: f3390cdf732d7f51264c6f869fe41955f511de3d
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Sat Jun 3 22:59:33 EDT 2017
Properly init speech/music confidence values This was sometimes causing the music probability to be stuck at zero at the beginning of files
--- a/src/analysis.c
+++ b/src/analysis.c
@@ -224,6 +224,8 @@
/* Clear non-reusable fields. */
char *start = (char*)&tonal->TONALITY_ANALYSIS_RESET_START;
OPUS_CLEAR(start, sizeof(TonalityAnalysisState) - (start - (char*)tonal));
+ tonal->music_confidence = .9f;
+ tonal->speech_confidence = .1f;
}
void tonality_get_info(TonalityAnalysisState *tonal, AnalysisInfo *info_out, int len)
@@ -869,11 +871,6 @@
tonal->speech_confidence_count = IMIN(tonal->speech_confidence_count, 500);
tonal->speech_confidence += adapt*MIN16(.2f,frame_probs[0]-tonal->speech_confidence);
}
- } else {
- if (tonal->music_confidence_count==0)
- tonal->music_confidence = .9f;
- if (tonal->speech_confidence_count==0)
- tonal->speech_confidence = .1f;
}
}
tonal->last_music = tonal->music_prob>.5f;