annotate mpegaudiotab.h @ 9092:65f47b345904 libavcodec

Consider all packets in the parser, not just ones with timestamps, this should greatly simplify handling of packet pos.
author michael
date Mon, 02 Mar 2009 15:13:58 +0000
parents e9d9d946f213
children 7dd2a45249a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1 /*
986e461dc072 Initial revision
glantau
parents:
diff changeset
2 * mpeg audio layer 2 tables. Most of them come from the mpeg audio
986e461dc072 Initial revision
glantau
parents:
diff changeset
3 * specification.
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2753
diff changeset
4 *
8629
04423b2f6e0b cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents: 7760
diff changeset
5 * Copyright (c) 2000, 2001 Fabrice Bellard
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
6 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3670
diff changeset
7 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3670
diff changeset
8 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3670
diff changeset
9 * FFmpeg is free software; you can redistribute it and/or
3670
48ea0e1a4fdb The license of this file is LGPL, as clarified by Fabrice.
diego
parents: 2967
diff changeset
10 * modify it under the terms of the GNU Lesser General Public
48ea0e1a4fdb The license of this file is LGPL, as clarified by Fabrice.
diego
parents: 2967
diff changeset
11 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3670
diff changeset
12 * version 2.1 of the License, or (at your option) any later version.
3670
48ea0e1a4fdb The license of this file is LGPL, as clarified by Fabrice.
diego
parents: 2967
diff changeset
13 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3670
diff changeset
14 * FFmpeg is distributed in the hope that it will be useful,
3670
48ea0e1a4fdb The license of this file is LGPL, as clarified by Fabrice.
diego
parents: 2967
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
48ea0e1a4fdb The license of this file is LGPL, as clarified by Fabrice.
diego
parents: 2967
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
48ea0e1a4fdb The license of this file is LGPL, as clarified by Fabrice.
diego
parents: 2967
diff changeset
17 * Lesser General Public License for more details.
48ea0e1a4fdb The license of this file is LGPL, as clarified by Fabrice.
diego
parents: 2967
diff changeset
18 *
48ea0e1a4fdb The license of this file is LGPL, as clarified by Fabrice.
diego
parents: 2967
diff changeset
19 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3670
diff changeset
20 * License along with FFmpeg; if not, write to the Free Software
3670
48ea0e1a4fdb The license of this file is LGPL, as clarified by Fabrice.
diego
parents: 2967
diff changeset
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
22 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
23
1106
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
24 /**
8718
e9d9d946f213 Use full internal pathname in doxygen @file directives.
diego
parents: 8629
diff changeset
25 * @file libavcodec/mpegaudiotab.h
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2753
diff changeset
26 * mpeg audio layer 2 tables.
1106
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
27 * Most of them come from the mpeg audio specification.
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
28 */
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2753
diff changeset
29
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 5830
diff changeset
30 #ifndef AVCODEC_MPEGAUDIOTAB_H
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 5830
diff changeset
31 #define AVCODEC_MPEGAUDIOTAB_H
5163
9ecbfc0c82bf add multiple inclusion guards to headers
mru
parents: 5162
diff changeset
32
5162
4394344397d8 include all prerequisites in header files
mru
parents: 3947
diff changeset
33 #include <stdint.h>
4394344397d8 include all prerequisites in header files
mru
parents: 3947
diff changeset
34 #include "mpegaudio.h"
4394344397d8 include all prerequisites in header files
mru
parents: 3947
diff changeset
35
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
36 #define SQRT2 1.41421356237309514547
986e461dc072 Initial revision
glantau
parents:
diff changeset
37
986e461dc072 Initial revision
glantau
parents:
diff changeset
38 static const int costab32[30] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
39 FIX(0.54119610014619701222),
986e461dc072 Initial revision
glantau
parents:
diff changeset
40 FIX(1.3065629648763763537),
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2753
diff changeset
41
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
42 FIX(0.50979557910415917998),
986e461dc072 Initial revision
glantau
parents:
diff changeset
43 FIX(2.5629154477415054814),
986e461dc072 Initial revision
glantau
parents:
diff changeset
44 FIX(0.89997622313641556513),
986e461dc072 Initial revision
glantau
parents:
diff changeset
45 FIX(0.60134488693504528634),
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2753
diff changeset
46
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
47 FIX(0.5024192861881556782),
986e461dc072 Initial revision
glantau
parents:
diff changeset
48 FIX(5.1011486186891552563),
986e461dc072 Initial revision
glantau
parents:
diff changeset
49 FIX(0.78815462345125020249),
986e461dc072 Initial revision
glantau
parents:
diff changeset
50 FIX(0.64682178335999007679),
986e461dc072 Initial revision
glantau
parents:
diff changeset
51 FIX(0.56694403481635768927),
986e461dc072 Initial revision
glantau
parents:
diff changeset
52 FIX(1.0606776859903470633),
986e461dc072 Initial revision
glantau
parents:
diff changeset
53 FIX(1.7224470982383341955),
986e461dc072 Initial revision
glantau
parents:
diff changeset
54 FIX(0.52249861493968885462),
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2753
diff changeset
55
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
56 FIX(10.19000812354803287),
986e461dc072 Initial revision
glantau
parents:
diff changeset
57 FIX(0.674808341455005678),
986e461dc072 Initial revision
glantau
parents:
diff changeset
58 FIX(1.1694399334328846596),
986e461dc072 Initial revision
glantau
parents:
diff changeset
59 FIX(0.53104259108978413284),
986e461dc072 Initial revision
glantau
parents:
diff changeset
60 FIX(2.0577810099534108446),
986e461dc072 Initial revision
glantau
parents:
diff changeset
61 FIX(0.58293496820613388554),
986e461dc072 Initial revision
glantau
parents:
diff changeset
62 FIX(0.83934964541552681272),
986e461dc072 Initial revision
glantau
parents:
diff changeset
63 FIX(0.50547095989754364798),
986e461dc072 Initial revision
glantau
parents:
diff changeset
64 FIX(3.4076084184687189804),
986e461dc072 Initial revision
glantau
parents:
diff changeset
65 FIX(0.62250412303566482475),
986e461dc072 Initial revision
glantau
parents:
diff changeset
66 FIX(0.97256823786196078263),
986e461dc072 Initial revision
glantau
parents:
diff changeset
67 FIX(0.51544730992262455249),
986e461dc072 Initial revision
glantau
parents:
diff changeset
68 FIX(1.4841646163141661852),
986e461dc072 Initial revision
glantau
parents:
diff changeset
69 FIX(0.5531038960344445421),
986e461dc072 Initial revision
glantau
parents:
diff changeset
70 FIX(0.74453627100229857749),
986e461dc072 Initial revision
glantau
parents:
diff changeset
71 FIX(0.5006029982351962726),
986e461dc072 Initial revision
glantau
parents:
diff changeset
72 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
73
986e461dc072 Initial revision
glantau
parents:
diff changeset
74 static const int bitinv32[32] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
75 0, 16, 8, 24, 4, 20, 12, 28,
986e461dc072 Initial revision
glantau
parents:
diff changeset
76 2, 18, 10, 26, 6, 22, 14, 30,
986e461dc072 Initial revision
glantau
parents:
diff changeset
77 1, 17, 9, 25, 5, 21, 13, 29,
986e461dc072 Initial revision
glantau
parents:
diff changeset
78 3, 19, 11, 27, 7, 23, 15, 31
986e461dc072 Initial revision
glantau
parents:
diff changeset
79 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
80
986e461dc072 Initial revision
glantau
parents:
diff changeset
81
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 429
diff changeset
82 static int16_t filter_bank[512];
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
83
986e461dc072 Initial revision
glantau
parents:
diff changeset
84 static int scale_factor_table[64];
986e461dc072 Initial revision
glantau
parents:
diff changeset
85 #ifdef USE_FLOATS
986e461dc072 Initial revision
glantau
parents:
diff changeset
86 static float scale_factor_inv_table[64];
986e461dc072 Initial revision
glantau
parents:
diff changeset
87 #else
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 429
diff changeset
88 static int8_t scale_factor_shift[64];
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
89 static unsigned short scale_factor_mult[64];
986e461dc072 Initial revision
glantau
parents:
diff changeset
90 #endif
986e461dc072 Initial revision
glantau
parents:
diff changeset
91 static unsigned char scale_diff_table[128];
986e461dc072 Initial revision
glantau
parents:
diff changeset
92
84
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 0
diff changeset
93 /* total number of bits per allocation group */
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 0
diff changeset
94 static unsigned short total_quant_bits[17];
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
95
986e461dc072 Initial revision
glantau
parents:
diff changeset
96 /* signal to noise ratio of each quantification step (could be
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2753
diff changeset
97 computed from quant_steps[]). The values are dB multiplied by 10
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
98 */
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2753
diff changeset
99 static const unsigned short quant_snr[17] = {
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
100 70, 110, 160, 208,
986e461dc072 Initial revision
glantau
parents:
diff changeset
101 253, 316, 378, 439,
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2753
diff changeset
102 499, 559, 620, 680,
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2753
diff changeset
103 740, 800, 861, 920,
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
104 980
986e461dc072 Initial revision
glantau
parents:
diff changeset
105 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
106
986e461dc072 Initial revision
glantau
parents:
diff changeset
107 /* fixed psycho acoustic model. Values of SNR taken from the 'toolame'
986e461dc072 Initial revision
glantau
parents:
diff changeset
108 project */
84
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 0
diff changeset
109 static const float fixed_smr[SBLIMIT] = {
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
110 30, 17, 16, 10, 3, 12, 8, 2.5,
986e461dc072 Initial revision
glantau
parents:
diff changeset
111 5, 5, 6, 6, 5, 6, 10, 6,
986e461dc072 Initial revision
glantau
parents:
diff changeset
112 -4, -10, -21, -30, -42, -55, -68, -75,
986e461dc072 Initial revision
glantau
parents:
diff changeset
113 -75, -75, -75, -75, -91, -107, -110, -108
986e461dc072 Initial revision
glantau
parents:
diff changeset
114 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
115
84
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 0
diff changeset
116 static const unsigned char nb_scale_factors[4] = { 3, 2, 1, 2 };
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 0
diff changeset
117
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 5830
diff changeset
118 #endif /* AVCODEC_MPEGAUDIOTAB_H */