summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2016-05-31 17:54:20 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2016-06-02 15:13:36 -0400
commit11bbb7d3ec9aa37b968017e2da62966c373b118e (patch)
treeb9f2e301f352294c7a498905a81ef8bb61d2b8a9
parent2937c649f4666d1b0aa0bd69eff6d0d0de8cbcb2 (diff)
downloadopus-11bbb7d3ec9aa37b968017e2da62966c373b118e.tar.gz
Boosting the high-band bitrate on transients for hybrid mode
-rw-r--r--celt/celt_encoder.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/celt/celt_encoder.c b/celt/celt_encoder.c
index 763adcfc..cb2f4c32 100644
--- a/celt/celt_encoder.c
+++ b/celt/celt_encoder.c
@@ -1939,10 +1939,13 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm,
/* Tonal frames (offset<100) need more bits than noisy (offset>100) ones. */
if (st->silk_info.offset < 100) target += 12 << BITRES >> (3-LM);
if (st->silk_info.offset > 100) target -= 18 << BITRES >> (3-LM);
+ /* Boosting bitrate on transients and vowels with significant temporal
+ spikes. */
+ target += MULT16_16_Q14(tf_estimate-QCONST16(.25f,14), (50<<BITRES));
/* If we have a strong transient, let's make sure it has enough bits to code
the first two bands, so that it can use folding rather than noise. */
if (tf_estimate > QCONST16(.7f,14))
- target = IMAX(base_target, 50<<BITRES);
+ target = IMAX(target, 50<<BITRES);
}
/* The current offset is removed from the target and the space used
so far is added*/