Opus tuning
This page is meant to provide help on tuning the current Opus encoder. It assumes you are working on the master branch, not 1.0.x. As work progresses, some info (especially any line numbers) may become outdated. The numbers in parentheses represent (in order):
- Impact on quality
- Quality of current tuning
- Difficulty
Parameters
These are some parameters that can be tuned to improve the Opus encoder quality (in no particular order)
tonality (10 5 1)
around line 1574 of celt_encoder.c:
tonal_target = target + (opus_int32)((coded_bins<<BITRES)*1.2f*tonal);
Replacing the constant 1.2f will change the impact of tonality on the bit-rate. The higher value, the higher the bit-rate of tonal frames/samples.
trim (7 7 8)
Trim controls the bit allocation balance between low and high frequencies. This is currently computed by alloc_trim_analysis() around line 677 of celt_encoder.c.
dynalloc (5 5 9)
Dynamic allocation is the part of the Opus bitstream that makes it possible to increase the allocation of any band(s). This is currently computed in dynalloc_analysis() around line 810 of celt_encoder.c.
stereo saving (4 6 6)
Stereo saving controls the bitrate reduction applied for stereo signals with a narrow image. It is computed in alloc_trim_analysis(), around line 733 of celt_encoder.c. It is applied in celt_encode_with_ec(), around line 1558 or celt_encoder.c.
spreading (4 7 7)
spreading_decision() bands.c around line 413.
tapset (1 4 9)
spreading_decision() bands.c around line 413.
transient estimator (10 8 8)
transient_analysis() celt_encoder.c around line 209.
transient boost (8 6 6)
transient_analysis() celt_encoder.c around line 209.
tf estimator (6 6 9)
tf_analysis() in celt_encoder.c around line 475.
Intensity threshold (7 8 3)
intensity_thresholds[] table in celt_encoder.c around line 1492.
skip threshold (3 6 4)
interp_bits2pulses() in rate.c around line 356.