Libav
|
00001 /* 00002 * mpeg audio layer 2 tables. Most of them come from the mpeg audio 00003 * specification. 00004 * 00005 * Copyright (c) 2000, 2001 Fabrice Bellard 00006 * 00007 * This file is part of FFmpeg. 00008 * 00009 * FFmpeg is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2.1 of the License, or (at your option) any later version. 00013 * 00014 * FFmpeg is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with FFmpeg; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00022 */ 00023 00030 #ifndef AVCODEC_MPEGAUDIOTAB_H 00031 #define AVCODEC_MPEGAUDIOTAB_H 00032 00033 #include <stdint.h> 00034 #include "mpegaudio.h" 00035 00036 #define SQRT2 1.41421356237309514547 00037 00038 static const int costab32[30] = { 00039 FIX(0.54119610014619701222), 00040 FIX(1.3065629648763763537), 00041 00042 FIX(0.50979557910415917998), 00043 FIX(2.5629154477415054814), 00044 FIX(0.89997622313641556513), 00045 FIX(0.60134488693504528634), 00046 00047 FIX(0.5024192861881556782), 00048 FIX(5.1011486186891552563), 00049 FIX(0.78815462345125020249), 00050 FIX(0.64682178335999007679), 00051 FIX(0.56694403481635768927), 00052 FIX(1.0606776859903470633), 00053 FIX(1.7224470982383341955), 00054 FIX(0.52249861493968885462), 00055 00056 FIX(10.19000812354803287), 00057 FIX(0.674808341455005678), 00058 FIX(1.1694399334328846596), 00059 FIX(0.53104259108978413284), 00060 FIX(2.0577810099534108446), 00061 FIX(0.58293496820613388554), 00062 FIX(0.83934964541552681272), 00063 FIX(0.50547095989754364798), 00064 FIX(3.4076084184687189804), 00065 FIX(0.62250412303566482475), 00066 FIX(0.97256823786196078263), 00067 FIX(0.51544730992262455249), 00068 FIX(1.4841646163141661852), 00069 FIX(0.5531038960344445421), 00070 FIX(0.74453627100229857749), 00071 FIX(0.5006029982351962726), 00072 }; 00073 00074 static const int bitinv32[32] = { 00075 0, 16, 8, 24, 4, 20, 12, 28, 00076 2, 18, 10, 26, 6, 22, 14, 30, 00077 1, 17, 9, 25, 5, 21, 13, 29, 00078 3, 19, 11, 27, 7, 23, 15, 31 00079 }; 00080 00081 00082 static int16_t filter_bank[512]; 00083 00084 static int scale_factor_table[64]; 00085 #ifdef USE_FLOATS 00086 static float scale_factor_inv_table[64]; 00087 #else 00088 static int8_t scale_factor_shift[64]; 00089 static unsigned short scale_factor_mult[64]; 00090 #endif 00091 static unsigned char scale_diff_table[128]; 00092 00093 /* total number of bits per allocation group */ 00094 static unsigned short total_quant_bits[17]; 00095 00096 /* signal to noise ratio of each quantification step (could be 00097 computed from quant_steps[]). The values are dB multiplied by 10 00098 */ 00099 static const unsigned short quant_snr[17] = { 00100 70, 110, 160, 208, 00101 253, 316, 378, 439, 00102 499, 559, 620, 680, 00103 740, 800, 861, 920, 00104 980 00105 }; 00106 00107 /* fixed psycho acoustic model. Values of SNR taken from the 'toolame' 00108 project */ 00109 static const float fixed_smr[SBLIMIT] = { 00110 30, 17, 16, 10, 3, 12, 8, 2.5, 00111 5, 5, 6, 6, 5, 6, 10, 6, 00112 -4, -10, -21, -30, -42, -55, -68, -75, 00113 -75, -75, -75, -75, -91, -107, -110, -108 00114 }; 00115 00116 static const unsigned char nb_scale_factors[4] = { 3, 2, 1, 2 }; 00117 00118 #endif /* AVCODEC_MPEGAUDIOTAB_H */