diff options
author | Ralph Giles <giles@mozilla.com> | 2015-12-31 02:27:02 +0300 |
---|---|---|
committer | Ralph Giles <giles@mozilla.com> | 2015-12-31 11:43:27 +0300 |
commit | 9e3872a8161d657407c55b6a29882664d1a6320c (patch) | |
tree | 6117661754b737a69e83346355a07ed80c570b53 /src/analysis.h | |
parent | d43445f350ff4e4f36442590697f9ce9a366848a (diff) |
Add tonality_analysis_reset().
Add a reset function for the TonalityAnalysisState struct
and call it on encoder reset.
Move the state struct above the clear line in OpusEncoder
so reset doesn't clobber reusable fields. Currently this
is only the arch field, which is moved to to top of the
struct so we can use the same memset-to-the-end pattern
as OpusEncoder.
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
Diffstat (limited to 'src/analysis.h')
-rw-r--r-- | src/analysis.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/analysis.h b/src/analysis.h index 9c2b978a..9eae56a5 100644 --- a/src/analysis.h +++ b/src/analysis.h @@ -39,6 +39,8 @@ #define DETECT_SIZE 200 typedef struct { + int arch; +#define TONALITY_ANALYSIS_RESET_START angle float angle[240]; float d_angle[240]; float d2_angle[240]; @@ -76,7 +78,6 @@ typedef struct { int read_pos; int read_subframe; AnalysisInfo info[DETECT_SIZE]; - int arch; } TonalityAnalysisState; /** Initialize a TonalityAnalysisState struct. @@ -87,6 +88,12 @@ typedef struct { */ void tonality_analysis_init(TonalityAnalysisState *analysis); +/** Reset a TonalityAnalysisState stuct. + * + * Call this when there's a discontinuity in the data. + */ +void tonality_analysis_reset(TonalityAnalysisState *analysis); + void tonality_get_info(TonalityAnalysisState *tonal, AnalysisInfo *info_out, int len); void run_analysis(TonalityAnalysisState *analysis, const CELTMode *celt_mode, const void *analysis_pcm, |