shithub: opus

Download patch

ref: 454330873e1c6b10b389bdcd40530c23dee33bae
parent: aef369f536ecb89ab94c2c6bc6b6e0a767fab39d
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Wed May 31 23:08:58 EDT 2017

Let CBR use more bits for dynalloc

It seems like letting CBR use up to 2/3 of the bit is still a win

--- a/celt/celt_encoder.c
+++ b/celt/celt_encoder.c
@@ -1076,11 +1076,11 @@
             boost = (int)SHR32(EXTEND32(follower[i])*width/6,DB_SHIFT);
             boost_bits = boost*6<<BITRES;
          }
-         /* For CBR and non-transient CVBR frames, limit dynalloc to 1/4 of the bits */
+         /* For CBR and non-transient CVBR frames, limit dynalloc to 2/3 of the bits */
          if ((!vbr || (constrained_vbr&&!isTransient))
-               && (tot_boost+boost_bits)>>BITRES>>3 > effectiveBytes/4)
+               && (tot_boost+boost_bits)>>BITRES>>3 > 2*effectiveBytes/3)
          {
-            opus_int32 cap = ((effectiveBytes/4)<<BITRES<<3);
+            opus_int32 cap = ((2*effectiveBytes/3)<<BITRES<<3);
             offsets[i] = cap-tot_boost;
             tot_boost = cap;
             break;