Libav 0.7.1
|
00001 /* 00002 * QDM2 compatible decoder 00003 * Copyright (c) 2003 Ewald Snel 00004 * Copyright (c) 2005 Benjamin Larsson 00005 * Copyright (c) 2005 Alex Beregszaszi 00006 * Copyright (c) 2005 Roberto Togni 00007 * 00008 * This file is part of Libav. 00009 * 00010 * Libav is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * Libav is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with Libav; if not, write to the Free Software 00022 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00023 */ 00024 00030 #ifndef AVCODEC_QDM2DATA_H 00031 #define AVCODEC_QDM2DATA_H 00032 00033 #include <stdint.h> 00034 00037 /* values in this table range from -1..23; adjust retrieved value by -1 */ 00038 static const uint16_t vlc_tab_level_huffcodes[24] = { 00039 0x037c, 0x0004, 0x003c, 0x004c, 0x003a, 0x002c, 0x001c, 0x001a, 00040 0x0024, 0x0014, 0x0001, 0x0002, 0x0000, 0x0003, 0x0007, 0x0005, 00041 0x0006, 0x0008, 0x0009, 0x000a, 0x000c, 0x00fc, 0x007c, 0x017c 00042 }; 00043 00044 static const uint8_t vlc_tab_level_huffbits[24] = { 00045 10, 6, 7, 7, 6, 6, 6, 6, 6, 5, 4, 4, 4, 3, 3, 3, 3, 4, 4, 5, 7, 8, 9, 10 00046 }; 00047 00048 /* values in this table range from -1..36; adjust retrieved value by -1 */ 00049 static const uint16_t vlc_tab_diff_huffcodes[37] = { 00050 0x1c57, 0x0004, 0x0000, 0x0001, 0x0003, 0x0002, 0x000f, 0x000e, 00051 0x0007, 0x0016, 0x0037, 0x0027, 0x0026, 0x0066, 0x0006, 0x0097, 00052 0x0046, 0x01c6, 0x0017, 0x0786, 0x0086, 0x0257, 0x00d7, 0x0357, 00053 0x00c6, 0x0386, 0x0186, 0x0000, 0x0157, 0x0c57, 0x0057, 0x0000, 00054 0x0b86, 0x0000, 0x1457, 0x0000, 0x0457 00055 }; 00056 00057 static const uint8_t vlc_tab_diff_huffbits[37] = { 00058 13, 3, 3, 2, 3, 3, 4, 4, 6, 5, 6, 6, 7, 7, 8, 8, 00059 8, 9, 8, 11, 9, 10, 8, 10, 9, 12, 10, 0, 10, 13, 11, 0, 00060 12, 0, 13, 0, 13 00061 }; 00062 00063 /* values in this table range from -1..5; adjust retrieved value by -1 */ 00064 static const uint8_t vlc_tab_run_huffcodes[6] = { 00065 0x1f, 0x00, 0x01, 0x03, 0x07, 0x0f 00066 }; 00067 00068 static const uint8_t vlc_tab_run_huffbits[6] = { 00069 5, 1, 2, 3, 4, 5 00070 }; 00071 00072 /* values in this table range from -1..19; adjust retrieved value by -1 */ 00073 static const uint16_t vlc_tab_tone_level_idx_hi1_huffcodes[20] = { 00074 0x5714, 0x000c, 0x0002, 0x0001, 0x0000, 0x0004, 0x0034, 0x0054, 00075 0x0094, 0x0014, 0x0114, 0x0214, 0x0314, 0x0614, 0x0e14, 0x0f14, 00076 0x2714, 0x0714, 0x1714, 0x3714 00077 }; 00078 00079 static const uint8_t vlc_tab_tone_level_idx_hi1_huffbits[20] = { 00080 15, 4, 2, 1, 3, 5, 6, 7, 8, 10, 10, 11, 11, 12, 12, 12, 14, 14, 15, 14 00081 }; 00082 00083 /* values in this table range from -1..23; adjust retrieved value by -1 */ 00084 static const uint16_t vlc_tab_tone_level_idx_mid_huffcodes[24] = { 00085 0x0fea, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 00086 0x0000, 0x0000, 0x0000, 0x0000, 0x03ea, 0x00ea, 0x002a, 0x001a, 00087 0x0006, 0x0001, 0x0000, 0x0002, 0x000a, 0x006a, 0x01ea, 0x07ea 00088 }; 00089 00090 static const uint8_t vlc_tab_tone_level_idx_mid_huffbits[24] = { 00091 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 9, 7, 5, 3, 1, 2, 4, 6, 8, 10, 12 00092 }; 00093 00094 /* values in this table range from -1..23; adjust retrieved value by -1 */ 00095 static const uint16_t vlc_tab_tone_level_idx_hi2_huffcodes[24] = { 00096 0x0664, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0064, 0x00e4, 00097 0x00a4, 0x0068, 0x0004, 0x0008, 0x0014, 0x0018, 0x0000, 0x0001, 00098 0x0002, 0x0003, 0x000c, 0x0028, 0x0024, 0x0164, 0x0000, 0x0264 00099 }; 00100 00101 static const uint8_t vlc_tab_tone_level_idx_hi2_huffbits[24] = { 00102 11, 0, 0, 0, 0, 0, 10, 8, 8, 7, 6, 6, 5, 5, 4, 2, 2, 2, 4, 7, 8, 9, 0, 11 00103 }; 00104 00105 /* values in this table range from -1..8; adjust retrieved value by -1 */ 00106 static const uint8_t vlc_tab_type30_huffcodes[9] = { 00107 0x3c, 0x06, 0x00, 0x01, 0x03, 0x02, 0x04, 0x0c, 0x1c 00108 }; 00109 00110 static const uint8_t vlc_tab_type30_huffbits[9] = { 00111 6, 3, 3, 2, 2, 3, 4, 5, 6 00112 }; 00113 00114 /* values in this table range from -1..9; adjust retrieved value by -1 */ 00115 static const uint8_t vlc_tab_type34_huffcodes[10] = { 00116 0x18, 0x00, 0x01, 0x04, 0x05, 0x07, 0x03, 0x02, 0x06, 0x08 00117 }; 00118 00119 static const uint8_t vlc_tab_type34_huffbits[10] = { 00120 5, 4, 3, 3, 3, 3, 3, 3, 3, 5 00121 }; 00122 00123 /* values in this table range from -1..22; adjust retrieved value by -1 */ 00124 static const uint16_t vlc_tab_fft_tone_offset_0_huffcodes[23] = { 00125 0x038e, 0x0001, 0x0000, 0x0022, 0x000a, 0x0006, 0x0012, 0x0002, 00126 0x001e, 0x003e, 0x0056, 0x0016, 0x000e, 0x0032, 0x0072, 0x0042, 00127 0x008e, 0x004e, 0x00f2, 0x002e, 0x0036, 0x00c2, 0x018e 00128 }; 00129 00130 static const uint8_t vlc_tab_fft_tone_offset_0_huffbits[23] = { 00131 10, 1, 2, 6, 4, 5, 6, 7, 6, 6, 7, 7, 8, 7, 8, 8, 9, 7, 8, 6, 6, 8, 10 00132 }; 00133 00134 /* values in this table range from -1..27; adjust retrieved value by -1 */ 00135 static const uint16_t vlc_tab_fft_tone_offset_1_huffcodes[28] = { 00136 0x07a4, 0x0001, 0x0020, 0x0012, 0x001c, 0x0008, 0x0006, 0x0010, 00137 0x0000, 0x0014, 0x0004, 0x0032, 0x0070, 0x000c, 0x0002, 0x003a, 00138 0x001a, 0x002c, 0x002a, 0x0022, 0x0024, 0x000a, 0x0064, 0x0030, 00139 0x0062, 0x00a4, 0x01a4, 0x03a4 00140 }; 00141 00142 static const uint8_t vlc_tab_fft_tone_offset_1_huffbits[28] = { 00143 11, 1, 6, 6, 5, 4, 3, 6, 6, 5, 6, 6, 7, 6, 6, 6, 00144 6, 6, 6, 7, 8, 6, 7, 7, 7, 9, 10, 11 00145 }; 00146 00147 /* values in this table range from -1..31; adjust retrieved value by -1 */ 00148 static const uint16_t vlc_tab_fft_tone_offset_2_huffcodes[32] = { 00149 0x1760, 0x0001, 0x0000, 0x0082, 0x000c, 0x0006, 0x0003, 0x0007, 00150 0x0008, 0x0004, 0x0010, 0x0012, 0x0022, 0x001a, 0x0000, 0x0020, 00151 0x000a, 0x0040, 0x004a, 0x006a, 0x002a, 0x0042, 0x0002, 0x0060, 00152 0x00aa, 0x00e0, 0x00c2, 0x01c2, 0x0160, 0x0360, 0x0760, 0x0f60 00153 }; 00154 00155 static const uint8_t vlc_tab_fft_tone_offset_2_huffbits[32] = { 00156 13, 2, 0, 8, 4, 3, 3, 3, 4, 4, 5, 5, 6, 5, 7, 7, 00157 7, 7, 7, 7, 8, 8, 8, 9, 8, 8, 9, 9, 10, 11, 13, 12 00158 }; 00159 00160 /* values in this table range from -1..34; adjust retrieved value by -1 */ 00161 static const uint16_t vlc_tab_fft_tone_offset_3_huffcodes[35] = { 00162 0x33ea, 0x0005, 0x0000, 0x000c, 0x0000, 0x0006, 0x0003, 0x0008, 00163 0x0002, 0x0001, 0x0004, 0x0007, 0x001a, 0x000f, 0x001c, 0x002c, 00164 0x000a, 0x001d, 0x002d, 0x002a, 0x000d, 0x004c, 0x008c, 0x006a, 00165 0x00cd, 0x004d, 0x00ea, 0x020c, 0x030c, 0x010c, 0x01ea, 0x07ea, 00166 0x0bea, 0x03ea, 0x13ea 00167 }; 00168 00169 static const uint8_t vlc_tab_fft_tone_offset_3_huffbits[35] = { 00170 14, 4, 0, 10, 4, 3, 3, 4, 4, 3, 4, 4, 5, 4, 5, 6, 00171 6, 5, 6, 7, 7, 7, 8, 8, 8, 8, 9, 10, 10, 10, 10, 11, 00172 12, 13, 14 00173 }; 00174 00175 /* values in this table range from -1..37; adjust retrieved value by -1 */ 00176 static const uint16_t vlc_tab_fft_tone_offset_4_huffcodes[38] = { 00177 0x5282, 0x0016, 0x0000, 0x0136, 0x0004, 0x0000, 0x0007, 0x000a, 00178 0x000e, 0x0003, 0x0001, 0x000d, 0x0006, 0x0009, 0x0012, 0x0005, 00179 0x0025, 0x0022, 0x0015, 0x0002, 0x0076, 0x0035, 0x0042, 0x00c2, 00180 0x0182, 0x00b6, 0x0036, 0x03c2, 0x0482, 0x01c2, 0x0682, 0x0882, 00181 0x0a82, 0x0082, 0x0282, 0x1282, 0x3282, 0x2282 00182 }; 00183 00184 static const uint8_t vlc_tab_fft_tone_offset_4_huffbits[38] = { 00185 15, 6, 0, 9, 3, 3, 3, 4, 4, 3, 4, 4, 5, 4, 5, 6, 00186 6, 6, 6, 8, 7, 6, 8, 9, 9, 8, 9, 10, 11, 10, 11, 12, 00187 12, 12, 14, 15, 14, 14 00188 }; 00189 00192 /* values in this table range from -1..27; adjust retrieved value by -1 */ 00193 static const uint16_t fft_level_exp_alt_huffcodes[28] = { 00194 0x1ec6, 0x0006, 0x00c2, 0x0142, 0x0242, 0x0246, 0x00c6, 0x0046, 00195 0x0042, 0x0146, 0x00a2, 0x0062, 0x0026, 0x0016, 0x000e, 0x0005, 00196 0x0004, 0x0003, 0x0000, 0x0001, 0x000a, 0x0012, 0x0002, 0x0022, 00197 0x01c6, 0x02c6, 0x06c6, 0x0ec6 00198 }; 00199 00200 static const uint8_t fft_level_exp_alt_huffbits[28] = { 00201 13, 7, 8, 9, 10, 10, 10, 10, 10, 9, 8, 7, 6, 5, 4, 3, 00202 3, 2, 3, 3, 4, 5, 7, 8, 9, 11, 12, 13 00203 }; 00204 00205 /* values in this table range from -1..19; adjust retrieved value by -1 */ 00206 static const uint16_t fft_level_exp_huffcodes[20] = { 00207 0x0f24, 0x0001, 0x0002, 0x0000, 0x0006, 0x0005, 0x0007, 0x000c, 00208 0x000b, 0x0014, 0x0013, 0x0004, 0x0003, 0x0023, 0x0064, 0x00a4, 00209 0x0024, 0x0124, 0x0324, 0x0724 00210 }; 00211 00212 static const uint8_t fft_level_exp_huffbits[20] = { 00213 12, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 8, 9, 10, 11, 12 00214 }; 00215 00216 /* values in this table range from -1..6; adjust retrieved value by -1 */ 00217 static const uint8_t fft_stereo_exp_huffcodes[7] = { 00218 0x3e, 0x01, 0x00, 0x02, 0x06, 0x0e, 0x1e 00219 }; 00220 00221 static const uint8_t fft_stereo_exp_huffbits[7] = { 00222 6, 1, 2, 3, 4, 5, 6 00223 }; 00224 00225 /* values in this table range from -1..8; adjust retrieved value by -1 */ 00226 static const uint8_t fft_stereo_phase_huffcodes[9] = { 00227 0x35, 0x02, 0x00, 0x01, 0x0d, 0x15, 0x05, 0x09, 0x03 00228 }; 00229 00230 static const uint8_t fft_stereo_phase_huffbits[9] = { 00231 6, 2, 2, 4, 4, 6, 5, 4, 2 00232 }; 00233 00234 static const int fft_cutoff_index_table[4][2] = { 00235 { 1, 2 }, {-1, 0 }, {-1,-2 }, { 0, 0 } 00236 }; 00237 00238 static const int16_t fft_level_index_table[256] = { 00239 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 00240 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00241 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 00242 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 00243 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 00244 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 00245 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 00246 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 00247 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 00248 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 00249 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 00250 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 00251 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 00252 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 00253 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 00254 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 00255 }; 00256 00257 static const uint8_t last_coeff[3] = { 00258 4, 7, 10 00259 }; 00260 00261 static const uint8_t coeff_per_sb_for_avg[3][30] = { 00262 { 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, 00263 { 0, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }, 00264 { 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9 } 00265 }; 00266 00267 static const uint32_t dequant_table[3][10][30] = { 00268 { { 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00269 { 0, 256, 256, 205, 154, 102, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00270 { 0, 0, 0, 51, 102, 154, 205, 256, 238, 219, 201, 183, 165, 146, 128, 110, 91, 73, 55, 37, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00271 { 0, 0, 0, 0, 0, 0, 0, 0, 18, 37, 55, 73, 91, 110, 128, 146, 165, 183, 201, 219, 238, 256, 228, 199, 171, 142, 114, 85, 57, 28 }, 00272 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00273 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00274 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00275 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00276 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00277 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, 00278 { { 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00279 { 0, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00280 { 0, 0, 256, 171, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00281 { 0, 0, 0, 85, 171, 256, 171, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00282 { 0, 0, 0, 0, 0, 0, 85, 171, 256, 219, 183, 146, 110, 73, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00283 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, 73, 110, 146, 183, 219, 256, 228, 199, 171, 142, 114, 85, 57, 28, 0, 0, 0, 0, 0, 0 }, 00284 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 57, 85, 114, 142, 171, 199, 228, 256, 213, 171, 128, 85, 43 }, 00285 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00286 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00287 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, 00288 { { 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00289 { 0, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00290 { 0, 0, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00291 { 0, 0, 0, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00292 { 0, 0, 0, 0, 256, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00293 { 0, 0, 0, 0, 0, 0, 256, 171, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00294 { 0, 0, 0, 0, 0, 0, 0, 85, 171, 256, 192, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00295 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 128, 192, 256, 205, 154, 102, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00296 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 102, 154, 205, 256, 213, 171, 128, 85, 43, 0, 0, 0, 0, 0, 0 }, 00297 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 85, 128, 171, 213, 256, 213, 171, 128, 85, 43 } } 00298 }; 00299 00300 static const uint8_t coeff_per_sb_for_dequant[3][30] = { 00301 { 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, 00302 { 0, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6 }, 00303 { 0, 1, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9 } 00304 }; 00305 00306 /* first index is subband, 2nd index is 0, 1 or 3 (2 is unused) */ 00307 static const int8_t tone_level_idx_offset_table[30][4] = { 00308 { -50, -50, 0, -50 }, 00309 { -50, -50, 0, -50 }, 00310 { -50, -9, 0, -19 }, 00311 { -16, -6, 0, -12 }, 00312 { -11, -4, 0, -8 }, 00313 { -8, -3, 0, -6 }, 00314 { -7, -3, 0, -5 }, 00315 { -6, -2, 0, -4 }, 00316 { -5, -2, 0, -3 }, 00317 { -4, -1, 0, -3 }, 00318 { -4, -1, 0, -2 }, 00319 { -3, -1, 0, -2 }, 00320 { -3, -1, 0, -2 }, 00321 { -3, -1, 0, -2 }, 00322 { -2, -1, 0, -1 }, 00323 { -2, -1, 0, -1 }, 00324 { -2, -1, 0, -1 }, 00325 { -2, 0, 0, -1 }, 00326 { -2, 0, 0, -1 }, 00327 { -1, 0, 0, -1 }, 00328 { -1, 0, 0, -1 }, 00329 { -1, 0, 0, -1 }, 00330 { -1, 0, 0, -1 }, 00331 { -1, 0, 0, -1 }, 00332 { -1, 0, 0, -1 }, 00333 { -1, 0, 0, -1 }, 00334 { -1, 0, 0, 0 }, 00335 { -1, 0, 0, 0 }, 00336 { -1, 0, 0, 0 }, 00337 { -1, 0, 0, 0 } 00338 }; 00339 00340 /* all my samples have 1st index 0 or 1 */ 00341 /* second index is subband, only indexes 0-29 seem to be used */ 00342 static const int8_t coding_method_table[5][30] = { 00343 { 34, 30, 24, 24, 16, 16, 16, 16, 10, 10, 10, 10, 10, 10, 10, 00344 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 00345 }, 00346 { 34, 30, 24, 24, 16, 16, 16, 16, 10, 10, 10, 10, 10, 10, 10, 00347 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 00348 }, 00349 { 34, 30, 30, 30, 24, 24, 16, 16, 16, 16, 16, 16, 10, 10, 10, 00350 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 00351 }, 00352 { 34, 34, 30, 30, 24, 24, 24, 24, 16, 16, 16, 16, 16, 16, 16, 00353 16, 16, 16, 16, 16, 16, 16, 10, 10, 10, 10, 10, 10, 10, 10 00354 }, 00355 { 34, 34, 30, 30, 30, 30, 30, 30, 24, 24, 24, 24, 24, 24, 24, 00356 24, 24, 24, 24, 24, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 00357 }, 00358 }; 00359 00360 static const int vlc_stage3_values[60] = { 00361 0, 1, 2, 3, 4, 6, 8, 10, 12, 16, 20, 24, 00362 28, 36, 44, 52, 60, 76, 92, 108, 124, 156, 188, 220, 00363 252, 316, 380, 444, 508, 636, 764, 892, 1020, 1276, 1532, 1788, 00364 2044, 2556, 3068, 3580, 4092, 5116, 6140, 7164, 8188, 10236, 12284, 14332, 00365 16380, 20476, 24572, 28668, 32764, 40956, 49148, 57340, 65532, 81916, 98300,114684 00366 }; 00367 00368 static const float fft_tone_sample_table[4][16][5] = { 00369 { { .0100000000f,-.0037037037f,-.0020000000f,-.0069444444f,-.0018416207f }, 00370 { .0416666667f, .0000000000f, .0000000000f,-.0208333333f,-.0123456791f }, 00371 { .1250000000f, .0558035709f, .0330687836f,-.0164473690f,-.0097465888f }, 00372 { .1562500000f, .0625000000f, .0370370370f,-.0062500000f,-.0037037037f }, 00373 { .1996007860f, .0781250000f, .0462962948f, .0022727272f, .0013468013f }, 00374 { .2000000000f, .0625000000f, .0370370373f, .0208333333f, .0074074073f }, 00375 { .2127659619f, .0555555556f, .0329218097f, .0208333333f, .0123456791f }, 00376 { .2173913121f, .0473484844f, .0280583613f, .0347222239f, .0205761325f }, 00377 { .2173913121f, .0347222239f, .0205761325f, .0473484844f, .0280583613f }, 00378 { .2127659619f, .0208333333f, .0123456791f, .0555555556f, .0329218097f }, 00379 { .2000000000f, .0208333333f, .0074074073f, .0625000000f, .0370370370f }, 00380 { .1996007860f, .0022727272f, .0013468013f, .0781250000f, .0462962948f }, 00381 { .1562500000f,-.0062500000f,-.0037037037f, .0625000000f, .0370370370f }, 00382 { .1250000000f,-.0164473690f,-.0097465888f, .0558035709f, .0330687836f }, 00383 { .0416666667f,-.0208333333f,-.0123456791f, .0000000000f, .0000000000f }, 00384 { .0100000000f,-.0069444444f,-.0018416207f,-.0037037037f,-.0020000000f } }, 00385 00386 { { .0050000000f,-.0200000000f, .0125000000f,-.3030303030f, .0020000000f }, 00387 { .1041666642f, .0400000000f,-.0250000000f, .0333333333f,-.0200000000f }, 00388 { .1250000000f, .0100000000f, .0142857144f,-.0500000007f,-.0200000000f }, 00389 { .1562500000f,-.0006250000f,-.00049382716f,-.000625000f,-.00049382716f }, 00390 { .1562500000f,-.0006250000f,-.00049382716f,-.000625000f,-.00049382716f }, 00391 { .1250000000f,-.0500000000f,-.0200000000f, .0100000000f, .0142857144f }, 00392 { .1041666667f, .0333333333f,-.0200000000f, .0400000000f,-.0250000000f }, 00393 { .0050000000f,-.3030303030f, .0020000001f,-.0200000000f, .0125000000f }, 00394 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00395 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00396 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00397 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00398 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00399 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00400 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00401 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f } }, 00402 00403 { { .1428571492f, .1250000000f,-.0285714287f,-.0357142873f, .0208333333f }, 00404 { .1818181818f, .0588235296f, .0333333333f, .0212765951f, .0100000000f }, 00405 { .1818181818f, .0212765951f, .0100000000f, .0588235296f, .0333333333f }, 00406 { .1428571492f,-.0357142873f, .0208333333f, .1250000000f,-.0285714287f }, 00407 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00408 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00409 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00410 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00411 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00412 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00413 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00414 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00415 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00416 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00417 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00418 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f } }, 00419 00420 { { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00421 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00422 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00423 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00424 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00425 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00426 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00427 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00428 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00429 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00430 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00431 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00432 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00433 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00434 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, 00435 { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f } } 00436 }; 00437 00438 static const float fft_tone_level_table[2][64] = { { 00439 /* pow ~ (i > 46) ? 0 : (((((i & 1) ? 431 : 304) << (i >> 1))) / 1024.0); */ 00440 0.17677669f, 0.42677650f, 0.60355347f, 0.85355347f, 00441 1.20710683f, 1.68359375f, 2.37500000f, 3.36718750f, 00442 4.75000000f, 6.73437500f, 9.50000000f, 13.4687500f, 00443 19.0000000f, 26.9375000f, 38.0000000f, 53.8750000f, 00444 76.0000000f, 107.750000f, 152.000000f, 215.500000f, 00445 304.000000f, 431.000000f, 608.000000f, 862.000000f, 00446 1216.00000f, 1724.00000f, 2432.00000f, 3448.00000f, 00447 4864.00000f, 6896.00000f, 9728.00000f, 13792.0000f, 00448 19456.0000f, 27584.0000f, 38912.0000f, 55168.0000f, 00449 77824.0000f, 110336.000f, 155648.000f, 220672.000f, 00450 311296.000f, 441344.000f, 622592.000f, 882688.000f, 00451 1245184.00f, 1765376.00f, 2490368.00f, 0.00000000f, 00452 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 00453 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 00454 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 00455 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 00456 }, { 00457 /* pow = (i > 45) ? 0 : ((((i & 1) ? 431 : 304) << (i >> 1)) / 512.0); */ 00458 0.59375000f, 0.84179688f, 1.18750000f, 1.68359375f, 00459 2.37500000f, 3.36718750f, 4.75000000f, 6.73437500f, 00460 9.50000000f, 13.4687500f, 19.0000000f, 26.9375000f, 00461 38.0000000f, 53.8750000f, 76.0000000f, 107.750000f, 00462 152.000000f, 215.500000f, 304.000000f, 431.000000f, 00463 608.000000f, 862.000000f, 1216.00000f, 1724.00000f, 00464 2432.00000f, 3448.00000f, 4864.00000f, 6896.00000f, 00465 9728.00000f, 13792.0000f, 19456.0000f, 27584.0000f, 00466 38912.0000f, 55168.0000f, 77824.0000f, 110336.000f, 00467 155648.000f, 220672.000f, 311296.000f, 441344.000f, 00468 622592.000f, 882688.000f, 1245184.00f, 1765376.00f, 00469 2490368.00f, 3530752.00f, 0.00000000f, 0.00000000f, 00470 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 00471 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 00472 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 00473 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f 00474 } }; 00475 00476 static const float fft_tone_envelope_table[4][31] = { 00477 { .009607375f, .038060248f, .084265202f, .146446645f, .222214907f, .308658302f, 00478 .402454883f, .500000060f, .597545207f, .691341758f, .777785182f, .853553414f, 00479 .915734828f, .961939812f, .990392685f, 1.00000000f, .990392625f, .961939752f, 00480 .915734768f, .853553295f, .777785063f, .691341639f, .597545087f, .500000000f, 00481 .402454853f, .308658272f, .222214878f, .146446615f, .084265172f, .038060218f, 00482 .009607345f }, 00483 { .038060248f, .146446645f, .308658302f, .500000060f, .691341758f, .853553414f, 00484 .961939812f, 1.00000000f, .961939752f, .853553295f, .691341639f, .500000000f, 00485 .308658272f, .146446615f, .038060218f, .000000000f, .000000000f, .000000000f, 00486 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, 00487 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, 00488 .000000000f }, 00489 { .146446645f, .500000060f, .853553414f, 1.00000000f, .853553295f, .500000000f, 00490 .146446615f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, 00491 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, 00492 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, 00493 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, 00494 .000000000f }, 00495 { .500000060f, 1.00000000f, .500000000f, .000000000f, .000000000f, .000000000f, 00496 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, 00497 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, 00498 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, 00499 .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, 00500 .000000000f } 00501 }; 00502 00503 static const float sb_noise_attenuation[32] = { 00504 0.0f, 0.0f, 0.3f, 0.4f, 0.5f, 0.7f, 1.0f, 1.0f, 00505 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 00506 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 00507 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 00508 }; 00509 00510 static const uint8_t fft_subpackets[32] = { 00511 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 00512 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0 00513 }; 00514 00515 /* first index is joined_stereo, second index is 0 or 2 (1 is unused) */ 00516 static const float dequant_1bit[2][3] = { 00517 {-0.920000f, 0.000000f, 0.920000f }, 00518 {-0.890000f, 0.000000f, 0.890000f } 00519 }; 00520 00521 static const float type30_dequant[8] = { 00522 -1.0f,-0.625f,-0.291666656732559f,0.0f, 00523 0.25f,0.5f,0.75f,1.0f, 00524 }; 00525 00526 static const float type34_delta[10] = { // FIXME: covers 8 entries.. 00527 -1.0f,-0.60947573184967f,-0.333333343267441f,-0.138071194291115f,0.0f, 00528 0.138071194291115f,0.333333343267441f,0.60947573184967f,1.0f,0.0f, 00529 }; 00530 00531 #endif /* AVCODEC_QDM2DATA_H */