Increase caps/allocation accuracy.

This stores the caps array in 32nd bits/sample instead of 1/2 bits
 scaled by LM and the channel count, which is slightly less
 less accurate for the last two bands, and much more accurate for
 all the other bands.
A constant offset is subtracted to allow it to represent values
 larger than 255 in 8 bits (the range of unoffset values is
 77...304).
In addition, this replaces the last modeline in the allocation table
 with the caps array, allowing the initial interpolation to
 allocate 8 bits/sample or more, which was otherwise impossible.
This commit is contained in:
Timothy B. Terriberry 2011-02-01 17:41:12 -08:00 committed by Jean-Marc Valin
parent 424eb74279
commit ce6d0904a1
5 changed files with 25 additions and 18 deletions

View file

@ -66,7 +66,7 @@ static const unsigned char band_allocation[] = {
#else
/* Alternate tuning (partially derived from Vorbis) */
#define BITALLOC_SIZE 12
#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 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 */
@ -81,7 +81,6 @@ static const unsigned char band_allocation[] = {
162,155,148,142,133,127,121,115,108,102, 96, 90, 84, 77, 71, 65, 59, 53, 46, 30, 1,
172,165,158,152,143,137,131,125,118,112,106,100, 94, 87, 81, 75, 69, 63, 56, 45, 20,
200,200,200,200,200,200,200,200,198,193,188,183,178,173,168,163,158,153,148,129,104,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,251,251,239,204,129,104,
};
#endif