summaryrefslogtreecommitdiff
path: root/src/analysis.h
diff options
context:
space:
mode:
authorRalph Giles <giles@mozilla.com>2015-12-30 10:00:17 -0800
committerRalph Giles <giles@mozilla.com>2015-12-31 00:42:43 -0800
commitd43445f350ff4e4f36442590697f9ce9a366848a (patch)
tree817c24b93f796874fdadab914bad61bdd4c67447 /src/analysis.h
parentbd1fb513c136c76f46f7e42a68ea20ddc41a94b2 (diff)
downloadopus-d43445f350ff4e4f36442590697f9ce9a366848a.tar.gz
Add an initializer for TonalityAnalysisState.
This interns the asm flags parameter in the state struct so we don't need to pass it with every call. It can be expensive, so we don't want to query every run_analysis() call, but since this (private) api is used by webrtc code we need to provide a supportable interface for filling in the correct value. Note the initialization code is partially duplicated between opus_encoder_init and the OPUS_RESET_STATE switch case, so we must re-initialize it there. Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
Diffstat (limited to 'src/analysis.h')
-rw-r--r--src/analysis.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/analysis.h b/src/analysis.h
index 9c328e8b..9c2b978a 100644
--- a/src/analysis.h
+++ b/src/analysis.h
@@ -76,12 +76,21 @@ typedef struct {
int read_pos;
int read_subframe;
AnalysisInfo info[DETECT_SIZE];
+ int arch;
} TonalityAnalysisState;
+/** Initialize a TonalityAnalysisState struct.
+ *
+ * This performs some possibly slow initialization steps which should
+ * not be repeated every analysis step. No allocated memory is retained
+ * by the state struct, so no cleanup call is required.
+ */
+void tonality_analysis_init(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,
int analysis_frame_size, int frame_size, int c1, int c2, int C, opus_int32 Fs,
- int lsb_depth, downmix_func downmix, AnalysisInfo *analysis_info, int arch);
+ int lsb_depth, downmix_func downmix, AnalysisInfo *analysis_info);
#endif