shithub: opus

Download patch

ref: 44a96007b2fc64f366c031a277082c9beaf61b21
parent: 9743bf38ca3b51d722e5033518bf00a8be5d8829
author: Jean-Marc Valin <[email protected]>
date: Fri Nov 5 07:39:50 EDT 2010

Minor tuning

--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -620,8 +620,6 @@
          trim_index-=2;
       else if (sum > QCONST16(.8f,10))
          trim_index-=1;
-      else if (sum < QCONST16(.4f,10))
-         trim_index+=1;
    }
 #if 0
    float diff=0;
--- a/libcelt/rate.c
+++ b/libcelt/rate.c
@@ -236,12 +236,13 @@
       /* If we rounded down, make it a candidate for final fine energy pass */
       fine_priority[j] = ebits[j]*(den<<BITRES) >= bits[j]+offset;
 
-      /* For N=1, all bits go to fine energy except for a single sign bit */
-      if (N==1)
-         ebits[j] = (bits[j]/C >> BITRES)-1;
       /* Make sure the first bit is spent on fine energy */
       if (ebits[j] < 1)
          ebits[j] = 1;
+      /* For N=1, all bits go to fine energy except for a single sign bit
+         This takes precedence over giving the first bit to fine energy */
+      if (N==1)
+         ebits[j] = (bits[j]/C >> BITRES)-1;
 
       /* Make sure not to bust */
       if (C*ebits[j] > (bits[j]>>BITRES))