Libav
|
00001 /* 00002 * MPEG Audio common tables 00003 * copyright (c) 2002 Fabrice Bellard 00004 * 00005 * This file is part of FFmpeg. 00006 * 00007 * FFmpeg is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * FFmpeg is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with FFmpeg; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 00027 #include "mpegaudiodata.h" 00028 00029 00030 const uint16_t ff_mpa_bitrate_tab[2][3][15] = { 00031 { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 }, 00032 {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 }, 00033 {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } }, 00034 { {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256}, 00035 {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160}, 00036 {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160} 00037 } 00038 }; 00039 00040 const uint16_t ff_mpa_freq_tab[3] = { 44100, 48000, 32000 }; 00041 00042 /*******************************************************/ 00043 /* half mpeg encoding window (full precision) */ 00044 const int32_t ff_mpa_enwindow[257] = { 00045 0, -1, -1, -1, -1, -1, -1, -2, 00046 -2, -2, -2, -3, -3, -4, -4, -5, 00047 -5, -6, -7, -7, -8, -9, -10, -11, 00048 -13, -14, -16, -17, -19, -21, -24, -26, 00049 -29, -31, -35, -38, -41, -45, -49, -53, 00050 -58, -63, -68, -73, -79, -85, -91, -97, 00051 -104, -111, -117, -125, -132, -139, -147, -154, 00052 -161, -169, -176, -183, -190, -196, -202, -208, 00053 213, 218, 222, 225, 227, 228, 228, 227, 00054 224, 221, 215, 208, 200, 189, 177, 163, 00055 146, 127, 106, 83, 57, 29, -2, -36, 00056 -72, -111, -153, -197, -244, -294, -347, -401, 00057 -459, -519, -581, -645, -711, -779, -848, -919, 00058 -991, -1064, -1137, -1210, -1283, -1356, -1428, -1498, 00059 -1567, -1634, -1698, -1759, -1817, -1870, -1919, -1962, 00060 -2001, -2032, -2057, -2075, -2085, -2087, -2080, -2063, 00061 2037, 2000, 1952, 1893, 1822, 1739, 1644, 1535, 00062 1414, 1280, 1131, 970, 794, 605, 402, 185, 00063 -45, -288, -545, -814, -1095, -1388, -1692, -2006, 00064 -2330, -2663, -3004, -3351, -3705, -4063, -4425, -4788, 00065 -5153, -5517, -5879, -6237, -6589, -6935, -7271, -7597, 00066 -7910, -8209, -8491, -8755, -8998, -9219, -9416, -9585, 00067 -9727, -9838, -9916, -9959, -9966, -9935, -9863, -9750, 00068 -9592, -9389, -9139, -8840, -8492, -8092, -7640, -7134, 00069 6574, 5959, 5288, 4561, 3776, 2935, 2037, 1082, 00070 70, -998, -2122, -3300, -4533, -5818, -7154, -8540, 00071 -9975,-11455,-12980,-14548,-16155,-17799,-19478,-21189, 00072 -22929,-24694,-26482,-28289,-30112,-31947,-33791,-35640, 00073 -37489,-39336,-41176,-43006,-44821,-46617,-48390,-50137, 00074 -51853,-53534,-55178,-56778,-58333,-59838,-61289,-62684, 00075 -64019,-65290,-66494,-67629,-68692,-69679,-70590,-71420, 00076 -72169,-72835,-73415,-73908,-74313,-74630,-74856,-74992, 00077 75038, 00078 }; 00079 00080 /*******************************************************/ 00081 /* layer 2 tables */ 00082 00083 const int ff_mpa_sblimit_table[5] = { 27 , 30 , 8, 12 , 30 }; 00084 00085 const int ff_mpa_quant_steps[17] = { 00086 3, 5, 7, 9, 15, 00087 31, 63, 127, 255, 511, 00088 1023, 2047, 4095, 8191, 16383, 00089 32767, 65535 00090 }; 00091 00092 /* we use a negative value if grouped */ 00093 const int ff_mpa_quant_bits[17] = { 00094 -5, -7, 3, -10, 4, 00095 5, 6, 7, 8, 9, 00096 10, 11, 12, 13, 14, 00097 15, 16 00098 }; 00099 00100 /* encoding tables which give the quantization index. Note how it is 00101 possible to store them efficiently ! */ 00102 static const unsigned char alloc_table_1[] = { 00103 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 00104 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 00105 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 00106 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, 00107 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, 00108 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, 00109 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, 00110 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, 00111 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, 00112 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, 00113 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, 00114 3, 0, 1, 2, 3, 4, 5, 16, 00115 3, 0, 1, 2, 3, 4, 5, 16, 00116 3, 0, 1, 2, 3, 4, 5, 16, 00117 3, 0, 1, 2, 3, 4, 5, 16, 00118 3, 0, 1, 2, 3, 4, 5, 16, 00119 3, 0, 1, 2, 3, 4, 5, 16, 00120 3, 0, 1, 2, 3, 4, 5, 16, 00121 3, 0, 1, 2, 3, 4, 5, 16, 00122 3, 0, 1, 2, 3, 4, 5, 16, 00123 3, 0, 1, 2, 3, 4, 5, 16, 00124 3, 0, 1, 2, 3, 4, 5, 16, 00125 3, 0, 1, 2, 3, 4, 5, 16, 00126 2, 0, 1, 16, 00127 2, 0, 1, 16, 00128 2, 0, 1, 16, 00129 2, 0, 1, 16, 00130 2, 0, 1, 16, 00131 2, 0, 1, 16, 00132 2, 0, 1, 16, 00133 }; 00134 00135 static const unsigned char alloc_table_3[] = { 00136 4, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 00137 4, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 00138 3, 0, 1, 3, 4, 5, 6, 7, 00139 3, 0, 1, 3, 4, 5, 6, 7, 00140 3, 0, 1, 3, 4, 5, 6, 7, 00141 3, 0, 1, 3, 4, 5, 6, 7, 00142 3, 0, 1, 3, 4, 5, 6, 7, 00143 3, 0, 1, 3, 4, 5, 6, 7, 00144 3, 0, 1, 3, 4, 5, 6, 7, 00145 3, 0, 1, 3, 4, 5, 6, 7, 00146 3, 0, 1, 3, 4, 5, 6, 7, 00147 3, 0, 1, 3, 4, 5, 6, 7, 00148 }; 00149 00150 static const unsigned char alloc_table_4[] = { 00151 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 00152 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 00153 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 00154 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 00155 3, 0, 1, 3, 4, 5, 6, 7, 00156 3, 0, 1, 3, 4, 5, 6, 7, 00157 3, 0, 1, 3, 4, 5, 6, 7, 00158 3, 0, 1, 3, 4, 5, 6, 7, 00159 3, 0, 1, 3, 4, 5, 6, 7, 00160 3, 0, 1, 3, 4, 5, 6, 7, 00161 3, 0, 1, 3, 4, 5, 6, 7, 00162 2, 0, 1, 3, 00163 2, 0, 1, 3, 00164 2, 0, 1, 3, 00165 2, 0, 1, 3, 00166 2, 0, 1, 3, 00167 2, 0, 1, 3, 00168 2, 0, 1, 3, 00169 2, 0, 1, 3, 00170 2, 0, 1, 3, 00171 2, 0, 1, 3, 00172 2, 0, 1, 3, 00173 2, 0, 1, 3, 00174 2, 0, 1, 3, 00175 2, 0, 1, 3, 00176 2, 0, 1, 3, 00177 2, 0, 1, 3, 00178 2, 0, 1, 3, 00179 2, 0, 1, 3, 00180 2, 0, 1, 3, 00181 }; 00182 00183 const unsigned char * const ff_mpa_alloc_tables[5] = 00184 { alloc_table_1, alloc_table_1, alloc_table_3, alloc_table_3, alloc_table_4, };