mirror of
https://github.com/xiph/opus.git
synced 2025-05-28 14:19:13 +00:00
Recalibrate VBR to hit target bitrate on average
This commit is contained in:
parent
c2d32337ec
commit
f26afaa60d
1 changed files with 2 additions and 2 deletions
|
@ -1283,7 +1283,7 @@ static int compute_vbr(const CELTMode *mode, AnalysisInfo *analysis, opus_int32
|
||||||
/* Boost the rate according to dynalloc (minus the dynalloc average for calibration). */
|
/* Boost the rate according to dynalloc (minus the dynalloc average for calibration). */
|
||||||
target += tot_boost-(19<<LM);
|
target += tot_boost-(19<<LM);
|
||||||
/* Apply transient boost, compensating for average boost. */
|
/* Apply transient boost, compensating for average boost. */
|
||||||
tf_calibration = QCONST16(0.04f,14);
|
tf_calibration = QCONST16(0.044f,14);
|
||||||
target += (opus_int32)SHL32(MULT16_32_Q15(tf_estimate-tf_calibration, target),1);
|
target += (opus_int32)SHL32(MULT16_32_Q15(tf_estimate-tf_calibration, target),1);
|
||||||
|
|
||||||
#ifndef DISABLE_FLOAT_API
|
#ifndef DISABLE_FLOAT_API
|
||||||
|
@ -1294,7 +1294,7 @@ static int compute_vbr(const CELTMode *mode, AnalysisInfo *analysis, opus_int32
|
||||||
float tonal;
|
float tonal;
|
||||||
|
|
||||||
/* Tonality boost (compensating for the average). */
|
/* Tonality boost (compensating for the average). */
|
||||||
tonal = MAX16(0.f,analysis->tonality-.15f)-0.09f;
|
tonal = MAX16(0.f,analysis->tonality-.15f)-0.12f;
|
||||||
tonal_target = target + (opus_int32)((coded_bins<<BITRES)*1.2f*tonal);
|
tonal_target = target + (opus_int32)((coded_bins<<BITRES)*1.2f*tonal);
|
||||||
if (pitch_change)
|
if (pitch_change)
|
||||||
tonal_target += (opus_int32)((coded_bins<<BITRES)*.8f);
|
tonal_target += (opus_int32)((coded_bins<<BITRES)*.8f);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue