ref: 1887401cca6b1bdf8ab892a3fd9038e281a7de8e
parent: 1b36d6c8b6f540f45e5258ae8864738d5b8e0a06
author: Jean-Marc Valin <[email protected]>
date: Wed Sep 1 06:07:12 EDT 2010
Converting allocation table to 1/32 bit/sample resolution.
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -93,17 +93,17 @@
};
static const unsigned char band_allocation[] = {
- /* 0 200 400 600 800 1k 1.2 1.4 1.6 2k 2.4 2.8 3.2 4k 4.8 5.6 6.8 8k 9.6 12k 15.6 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 10, 10, 14, 11, 10, 8, 6, 5, 10, 12, 13, 11, 8, 4, 2, 1, 0, 0, 0, 0, 0,
- 13, 10, 17, 16, 14, 12, 10, 8, 12, 14, 14, 12, 9, 5, 3, 2, 2, 1, 0, 0, 0,
- 17, 21, 23, 26, 24, 20, 17, 16, 17, 18, 16, 14, 11, 6, 3, 2, 2, 1, 1, 0, 0,
- 21, 21, 36, 32, 28, 24, 23, 23, 22, 18, 18, 14, 11, 7, 5, 5, 5, 3, 3, 0, 0,
- 31, 35, 40, 32, 30, 28, 26, 26, 25, 24, 19, 15, 15, 13, 9, 9, 8, 7, 5, 2, 0,
- 42, 46, 46, 37, 35, 34, 33, 32, 34, 35, 32, 31, 27, 24, 23, 23, 18, 14, 11, 7, 0,
- 46, 49, 46, 46, 42, 43, 44, 47, 50, 52, 51, 48, 39, 32, 27, 24, 22, 19, 17, 11, 5,
- 53, 53, 49, 48, 55, 66, 71, 71, 71, 65, 64, 64, 56, 47, 41, 37, 31, 24, 20, 16, 10,
- 60, 64, 74, 74, 87,103,106,102,101,100,101, 95, 80, 69, 63, 55, 47, 36, 26, 21, 15,
+/*0 200 400 600 800 1k 1.2 1.4 1.6 2k 2.4 2.8 3.2 4k 4.8 5.6 6.8 8k 9.6 12k 15.6 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 40, 40, 56, 44, 40, 32, 24, 20, 40, 48, 52, 44, 32, 16, 8, 4, 0, 0, 0, 0, 0,
+ 52, 40, 68, 64, 56, 48, 40, 32, 48, 56, 56, 48, 36, 20, 12, 8, 8, 4, 0, 0, 0,
+ 68, 84, 92,104, 96, 80, 68, 64, 68, 72, 64, 56, 44, 24, 12, 8, 8, 4, 4, 0, 0,
+ 84, 84,144,128,112, 96, 92, 92, 88, 72, 72, 56, 44, 28, 20, 20, 20, 12, 12, 0, 0,
+124,140,160,128,120,112,104,104,100, 96, 76, 60, 60, 52, 36, 36, 32, 28, 20, 8, 0,
+168,184,184,148,140,136,132,128,136,140,128,124,108, 96, 92, 92, 72, 56, 44, 28, 0,
+184,196,184,184,168,172,176,188,200,208,204,192,156,128,108, 96, 88, 76, 68, 44, 20,
+212,212,196,192,220,255,255,255,255,255,255,255,224,188,164,148,124, 96, 80, 64, 40,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,252,220,188,144,104, 84, 60,
};
static celt_int16 *compute_ebands(celt_int32 Fs, int frame_size, int res, int *nbEBands)
--- a/libcelt/rate.c
+++ b/libcelt/rate.c
@@ -255,9 +255,7 @@
for (j=start;j<end;j++)
{
int N = m->eBands[j+1]-m->eBands[j];
- bits1[j] = ((C*N*m->allocVectors[mid*len+j]<<LM) + offsets[j]);
- if (bits1[j] < 0)
- bits1[j] = 0;
+ bits1[j] = ((C*N*m->allocVectors[mid*len+j]<<LM>>2) + offsets[j]);
psum += bits1[j];
/*printf ("%d ", bits[j]);*/
}
@@ -272,12 +270,8 @@
for (j=start;j<end;j++)
{
int N = m->eBands[j+1]-m->eBands[j];
- bits1[j] = (C*N*m->allocVectors[lo*len+j]<<LM) + offsets[j];
- bits2[j] = (C*N*m->allocVectors[hi*len+j]<<LM) + offsets[j];
- if (bits1[j] < 0)
- bits1[j] = 0;
- if (bits2[j] < 0)
- bits2[j] = 0;
+ bits1[j] = (C*N*m->allocVectors[lo*len+j]<<LM>>2) + offsets[j];
+ bits2[j] = (C*N*m->allocVectors[hi*len+j]<<LM>>2) + offsets[j];
}
interp_bits2pulses(m, start, end, bits1, bits2, total, pulses, ebits, fine_priority, len, C, LM);
RESTORE_STACK;