Increasing resolution of the alloc trim
diff --git a/libcelt/celt.c b/libcelt/celt.c
index f6370ae..3c11061 100644
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -53,7 +53,8 @@
 #include <stdarg.h>
 #include "plc.h"
 
-static const int trim_cdf[7] = {0, 4, 11, 65, 119, 125, 128};
+static const int trim_cdf[12] = {0, 2, 4, 9, 19, 41, 87, 109, 119, 124, 126, 128};
+
 #define COMBFILTER_MAXPERIOD 1024
 #define COMBFILTER_MINPERIOD 16
 
@@ -599,7 +600,7 @@
       const celt_word16 *bandLogE, int nbEBands, int LM, int C, int N0)
 {
    int i;
-   int trim_index = 2;
+   int trim_index = 5;
    if (C==2)
    {
       celt_word16 sum = 0; /* Q10 */
@@ -615,8 +616,10 @@
       sum = MULT16_16_Q15(QCONST16(1.f/8, 15), sum);
       /*printf ("%f\n", sum);*/
       if (sum > QCONST16(.995f,10))
-         trim_index-=3;
+         trim_index-=4;
       else if (sum > QCONST16(.92f,10))
+         trim_index-=3;
+      else if (sum > QCONST16(.85f,10))
          trim_index-=2;
       else if (sum > QCONST16(.8f,10))
          trim_index-=1;
diff --git a/libcelt/rate.c b/libcelt/rate.c
index b01b396..5e0d764 100644
--- a/libcelt/rate.c
+++ b/libcelt/rate.c
@@ -289,7 +289,7 @@
       thresh[j] = 2*(C*(m->eBands[j+1]-m->eBands[j])<<LM<<BITRES)>>3;
    /* Tilt of the allocation curve */
    for (j=start;j<end;j++)
-      trim_offset[j] = C*(m->eBands[j+1]-m->eBands[j])*(2*alloc_trim-1-2*LM)*(m->nbEBands-j-1)
+      trim_offset[j] = C*(m->eBands[j+1]-m->eBands[j])*(alloc_trim-2-2*LM)*(m->nbEBands-j-1)
             <<(LM+BITRES)>>6;
 
    lo = 0;