2 * MPEG Audio common tables
3 * copyright (c) 2002 Fabrice Bellard
5 * This file is part of FFmpeg.
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 * mpeg audio layer common tables.
27 #include "mpegaudiodata.h"
30 const uint16_t avpriv_mpa_bitrate_tab[2][3][15] = {
31 { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 },
32 {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 },
33 {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } },
34 { {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256},
35 {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160},
36 {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160}
40 const uint16_t avpriv_mpa_freq_tab[3] = { 44100, 48000, 32000 };
42 /*******************************************************/
45 const int ff_mpa_sblimit_table[5] = { 27 , 30 , 8, 12 , 30 };
47 const int ff_mpa_quant_steps[17] = {
49 31, 63, 127, 255, 511,
50 1023, 2047, 4095, 8191, 16383,
54 /* we use a negative value if grouped */
55 const int ff_mpa_quant_bits[17] = {
62 /* encoding tables which give the quantization index. Note how it is
63 possible to store them efficiently ! */
64 static const unsigned char alloc_table_1[] = {
65 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
66 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
67 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
68 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
69 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
70 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
71 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
72 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
73 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
74 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
75 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
76 3, 0, 1, 2, 3, 4, 5, 16,
77 3, 0, 1, 2, 3, 4, 5, 16,
78 3, 0, 1, 2, 3, 4, 5, 16,
79 3, 0, 1, 2, 3, 4, 5, 16,
80 3, 0, 1, 2, 3, 4, 5, 16,
81 3, 0, 1, 2, 3, 4, 5, 16,
82 3, 0, 1, 2, 3, 4, 5, 16,
83 3, 0, 1, 2, 3, 4, 5, 16,
84 3, 0, 1, 2, 3, 4, 5, 16,
85 3, 0, 1, 2, 3, 4, 5, 16,
86 3, 0, 1, 2, 3, 4, 5, 16,
87 3, 0, 1, 2, 3, 4, 5, 16,
97 static const unsigned char alloc_table_3[] = {
98 4, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
99 4, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
100 3, 0, 1, 3, 4, 5, 6, 7,
101 3, 0, 1, 3, 4, 5, 6, 7,
102 3, 0, 1, 3, 4, 5, 6, 7,
103 3, 0, 1, 3, 4, 5, 6, 7,
104 3, 0, 1, 3, 4, 5, 6, 7,
105 3, 0, 1, 3, 4, 5, 6, 7,
106 3, 0, 1, 3, 4, 5, 6, 7,
107 3, 0, 1, 3, 4, 5, 6, 7,
108 3, 0, 1, 3, 4, 5, 6, 7,
109 3, 0, 1, 3, 4, 5, 6, 7,
112 static const unsigned char alloc_table_4[] = {
113 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
114 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
115 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
116 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
117 3, 0, 1, 3, 4, 5, 6, 7,
118 3, 0, 1, 3, 4, 5, 6, 7,
119 3, 0, 1, 3, 4, 5, 6, 7,
120 3, 0, 1, 3, 4, 5, 6, 7,
121 3, 0, 1, 3, 4, 5, 6, 7,
122 3, 0, 1, 3, 4, 5, 6, 7,
123 3, 0, 1, 3, 4, 5, 6, 7,
145 const unsigned char * const ff_mpa_alloc_tables[5] =
146 { alloc_table_1, alloc_table_1, alloc_table_3, alloc_table_3, alloc_table_4, };