Bit allocation wotk.
Mimimum resolution is now 1/4 bit/sample instead of 3/8. The allocation
tilt now gives more LF bits for small frame sizes. There's also a new
"alternate" allocation that should soon replace the current one.
diff --git a/libcelt/modes.c b/libcelt/modes.c
index 0732e55..33a7723 100644
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -65,50 +65,21 @@
#else
-#if 1
-/* Alternate tuning based on exp_tuning_knobs from 2010/10/21:
- 87 5 25 14 300
-120 5 25 16 400
-125 5 25 17 500
-130 5 24 18 600
-130 5 24 19 920
-140 7 24 20 1240
-170 7 20 21 2000
-120 5 20 21 4000
- */
-
+/* Alternate tuning (partially derived from Vorbis) */
#define BITALLOC_SIZE 9
/* Bit allocation table in units of 1/32 bit/sample (0.1875 dB SNR) */
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,
- 99, 99, 90, 84, 78, 71, 65, 58, 51, 45, 39, 32, 26, 20, 1, 0, 0, 0, 0, 0, 0,
-124,124,109, 98, 88, 77, 71, 65, 59, 52, 46, 40, 34, 27, 21, 15, 1, 0, 0, 0, 0,
-132,132,117,107, 97, 87, 80, 74, 68, 62, 55, 49, 43, 37, 30, 23, 17, 1, 1, 0, 0,
-138,138,123,112,102, 91, 85, 79, 73, 67, 61, 55, 49, 43, 37, 31, 25, 19, 1, 0, 0,
-152,152,139,130,120,110,104, 98, 92, 86, 80, 74, 68, 62, 56, 50, 44, 38, 32, 8, 0,
-167,167,154,145,136,127,117,108,102, 96, 90, 84, 78, 72, 66, 60, 54, 48, 42, 36, 2,
-215,215,194,180,165,151,137,121,116,111,106,101, 96, 91, 86, 81, 76, 71, 66, 61, 56,
-240,240,239,233,225,218,211,203,198,193,188,183,178,173,168,163,158,153,148,143,138,
+110,100, 90, 84, 78, 71, 65, 58, 51, 45, 39, 32, 26, 20, 12, 0, 0, 0, 0, 0, 0,
+124,116,109, 98, 88, 77, 71, 65, 59, 52, 46, 40, 34, 27, 21, 15, 12, 0, 0, 0, 0,
+132,125,117,107, 97, 87, 80, 74, 68, 62, 55, 49, 43, 37, 30, 23, 17, 12, 1, 0, 0,
+134,127,120,114,103, 97, 91, 85, 78, 72, 66, 60, 54, 47, 41, 35, 29, 23, 16, 10, 1,
+144,137,130,124,113,107,101, 95, 88, 82, 76, 70, 64, 57, 51, 45, 39, 33, 26, 20, 2,
+152,145,138,132,123,117,111,105, 98, 92, 86, 80, 74, 67, 61, 55, 49, 43, 36, 30, 4,
+172,165,158,152,143,137,131,125,118,112,106,100, 94, 87, 81, 75, 69, 63, 56, 50, 12,
+200,200,200,200,200,200,200,200,198,193,188,183,178,173,168,163,158,153,148,143,138,
};
-
-#else
-/* Alternate tuning (partially derived from Vorbis) */
-#define BITALLOC_SIZE 11
-/* Bit allocation table in units of 1/32 bit/sample (0.1875 dB SNR) */
-static const unsigned char band_allocation[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 85, 85, 75, 70, 63, 55, 50, 45, 40, 35, 33, 28, 15, 1, 0, 0, 0, 0, 0, 0, 0,
-108,105, 96, 88, 83, 77, 72, 66, 59, 53, 49, 44, 41, 37, 30, 27, 1, 0, 0, 0, 0,
-120,117,108,100, 95, 89, 84, 78, 71, 65, 61, 56, 53, 49, 42, 34, 30, 25, 1, 0, 0,
-136,131,123,118,109, 99, 93, 87, 81, 75, 69, 66, 61, 56, 50, 45, 40, 35, 32, 1, 1,
-151,148,138,131,122,113,105,102, 96, 92, 85, 82, 76, 68, 63, 58, 51, 44, 38, 27, 8,
-171,168,158,147,139,130,123,119,111,108,103, 99, 91, 82, 78, 75, 66, 55, 48, 36, 12,
-187,184,174,163,155,146,139,135,127,124,119,115,107, 98, 94, 91, 82, 71, 64, 52, 28,
-203,200,191,181,174,166,159,156,149,147,143,139,132,124,121,119,110,100, 94, 83, 60,
-219,216,207,197,190,183,176,173,166,164,161,157,150,142,139,138,129,119,113,102, 80,
-229,229,224,222,223,224,224,225,222,221,221,220,220,219,218,200,178,154,146,130,102,
-};
-#endif
#endif
#ifdef STATIC_MODES