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-29 15:21:31 -0400
commit50a79d6075b163d52ee93c0e37b595da8d8107a1 (patch)
tree0776ace8257a752ea5f7ab42c25b3b5fe9889a17
parent07e5b764408a836f7a5a4efdd39ea0b3e4eae10c (diff)
downloadopus-50a79d6075b163d52ee93c0e37b595da8d8107a1.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 544b7bc3..7c949ccb 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*/