ref: 9037757ceba0b49f192e992b471c424920327ea4
parent: c40addcb043ea33528d4f15e16143c74f3ac4a7d
author: Jean-Marc Valin <[email protected]>
date: Fri Oct 22 11:12:01 EDT 2010
Tuning the allocation trim
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -572,11 +572,14 @@
trim_index-=3;
else if (sum > QCONST16(.92,10))
trim_index-=2;
- else if (sum > QCONST16(.75,10))
+ else if (sum > QCONST16(.8,10))
trim_index-=1;
+ else if (sum < QCONST16(.4,10))
+ trim_index+=1;
}
#if 0
float diff=0;
+ int c;
for (c=0;c<C;c++)
{
for (i=0;i<nbEBands-1;i++)
@@ -590,8 +593,8 @@
trim_index--;
if (diff > 8)
trim_index--;
- /*if (diff < -10)
- trim_index++;*/
+ if (diff < -4)
+ trim_index++;
#endif
if (trim_index<0)
trim_index = 0;
--- a/libcelt/rate.c
+++ b/libcelt/rate.c
@@ -278,8 +278,10 @@
ALLOC(thresh, len, int);
ALLOC(trim_offset, len, int);
+ /* Below this threshold, we don't allocate any PVQ bits */
for (j=start;j<end;j++)
thresh[j] = 3*(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])*(alloc_trim-3)*(m->nbEBands-j-1)
<<(LM+BITRES)>>5;