Let CBR use more bits for dynalloc
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Thu, 1 Jun 2017 07:08:58 +0000 (03:08 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Thu, 1 Jun 2017 07:08:58 +0000 (03:08 -0400)
It seems like letting CBR use up to 2/3 of the bit is still a win

celt/celt_encoder.c

index 72b6540..187cccc 100644 (file)
@@ -1076,11 +1076,11 @@ static opus_val16 dynalloc_analysis(const opus_val16 *bandLogE, const opus_val16
             boost = (int)SHR32(EXTEND32(follower[i])*width/6,DB_SHIFT);
             boost_bits = boost*6<<BITRES;
          }
             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))
          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;
             offsets[i] = cap-tot_boost;
             tot_boost = cap;
             break;