Skip to main content

Module analysis

Module analysis 

Source
Expand description

Port of libopus 1.3.1 src/analysis.c + src/mlp.c (float build): the tonality/music/bandwidth analysis that drives mode selection, bandwidth detection, VBR boosts and prefilter damping in the reference encoder.

Faithful line-for-line port. The MLP (dense 25→32, GRU →24, dense →2) uses the shipped int8 weight tables in crate::analysis_data. The FFT is the CELT mode’s N=480 kiss-FFT (same twiddles/bitrev as the reference; the forward scale 1/N is applied in the input copy, as C’s opus_fft does).

Structs§

AnalysisInfo
celt.h AnalysisInfo (float build).
TonalityAnalysisState

Constants§

ANALYSIS_BUF_SIZE
ANALYSIS_COUNT_MAX
DETECT_SIZE
LEAK_BANDS
NB_FRAMES
NB_TBANDS

Functions§

run_analysis
run_analysis: feed the frame through 20 ms analysis steps, then read the interpolated info for this frame.
tonality_get_info
tonality_get_info: interpolate the ring of per-20ms analyses into one AnalysisInfo for a frame of len samples (encoder rate), applying the music/speech hysteresis thresholds (music_prob_min/max).