shithub: opus

Download patch

ref: 78fc664c0c339c5fa73409fca56126cc65452566
parent: 34da05b30d4947b54c1aafb2dbca8e91f58afaf0
author: Jean-Marc Valin <[email protected]>
date: Tue May 31 13:54:20 EDT 2016

Boosting the high-band bitrate on transients for hybrid mode

--- a/celt/celt_encoder.c
+++ b/celt/celt_encoder.c
@@ -1939,10 +1939,13 @@
         /* 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*/