annotate mpegaudiotab.h @ 418:b2fb2081dab5 libavcodec

* somewhat more advanced test suit for dsp code - for now i386 only cd test ; make dsptest ; ./dsptest
author kabi
date Thu, 23 May 2002 13:34:22 +0000
parents 608c7f964bca
children 718a22dc121f
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.
986e461dc072 Initial revision
glantau
parents:
diff changeset
4 *
84
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 0
diff changeset
5 * Copyright (c) 2000, 2001 Gerard Lantau.
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
6 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
7 * The licence of this code is contained in file LICENCE found in the
986e461dc072 Initial revision
glantau
parents:
diff changeset
8 * same archive
986e461dc072 Initial revision
glantau
parents:
diff changeset
9 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
10
986e461dc072 Initial revision
glantau
parents:
diff changeset
11 #define SQRT2 1.41421356237309514547
986e461dc072 Initial revision
glantau
parents:
diff changeset
12
986e461dc072 Initial revision
glantau
parents:
diff changeset
13 static const int costab32[30] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
14 FIX(0.54119610014619701222),
986e461dc072 Initial revision
glantau
parents:
diff changeset
15 FIX(1.3065629648763763537),
986e461dc072 Initial revision
glantau
parents:
diff changeset
16
986e461dc072 Initial revision
glantau
parents:
diff changeset
17 FIX(0.50979557910415917998),
986e461dc072 Initial revision
glantau
parents:
diff changeset
18 FIX(2.5629154477415054814),
986e461dc072 Initial revision
glantau
parents:
diff changeset
19 FIX(0.89997622313641556513),
986e461dc072 Initial revision
glantau
parents:
diff changeset
20 FIX(0.60134488693504528634),
986e461dc072 Initial revision
glantau
parents:
diff changeset
21
986e461dc072 Initial revision
glantau
parents:
diff changeset
22 FIX(0.5024192861881556782),
986e461dc072 Initial revision
glantau
parents:
diff changeset
23 FIX(5.1011486186891552563),
986e461dc072 Initial revision
glantau
parents:
diff changeset
24 FIX(0.78815462345125020249),
986e461dc072 Initial revision
glantau
parents:
diff changeset
25 FIX(0.64682178335999007679),
986e461dc072 Initial revision
glantau
parents:
diff changeset
26 FIX(0.56694403481635768927),
986e461dc072 Initial revision
glantau
parents:
diff changeset
27 FIX(1.0606776859903470633),
986e461dc072 Initial revision
glantau
parents:
diff changeset
28 FIX(1.7224470982383341955),
986e461dc072 Initial revision
glantau
parents:
diff changeset
29 FIX(0.52249861493968885462),
986e461dc072 Initial revision
glantau
parents:
diff changeset
30
986e461dc072 Initial revision
glantau
parents:
diff changeset
31 FIX(10.19000812354803287),
986e461dc072 Initial revision
glantau
parents:
diff changeset
32 FIX(0.674808341455005678),
986e461dc072 Initial revision
glantau
parents:
diff changeset
33 FIX(1.1694399334328846596),
986e461dc072 Initial revision
glantau
parents:
diff changeset
34 FIX(0.53104259108978413284),
986e461dc072 Initial revision
glantau
parents:
diff changeset
35 FIX(2.0577810099534108446),
986e461dc072 Initial revision
glantau
parents:
diff changeset
36 FIX(0.58293496820613388554),
986e461dc072 Initial revision
glantau
parents:
diff changeset
37 FIX(0.83934964541552681272),
986e461dc072 Initial revision
glantau
parents:
diff changeset
38 FIX(0.50547095989754364798),
986e461dc072 Initial revision
glantau
parents:
diff changeset
39 FIX(3.4076084184687189804),
986e461dc072 Initial revision
glantau
parents:
diff changeset
40 FIX(0.62250412303566482475),
986e461dc072 Initial revision
glantau
parents:
diff changeset
41 FIX(0.97256823786196078263),
986e461dc072 Initial revision
glantau
parents:
diff changeset
42 FIX(0.51544730992262455249),
986e461dc072 Initial revision
glantau
parents:
diff changeset
43 FIX(1.4841646163141661852),
986e461dc072 Initial revision
glantau
parents:
diff changeset
44 FIX(0.5531038960344445421),
986e461dc072 Initial revision
glantau
parents:
diff changeset
45 FIX(0.74453627100229857749),
986e461dc072 Initial revision
glantau
parents:
diff changeset
46 FIX(0.5006029982351962726),
986e461dc072 Initial revision
glantau
parents:
diff changeset
47 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
48
986e461dc072 Initial revision
glantau
parents:
diff changeset
49 static const int bitinv32[32] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
50 0, 16, 8, 24, 4, 20, 12, 28,
986e461dc072 Initial revision
glantau
parents:
diff changeset
51 2, 18, 10, 26, 6, 22, 14, 30,
986e461dc072 Initial revision
glantau
parents:
diff changeset
52 1, 17, 9, 25, 5, 21, 13, 29,
986e461dc072 Initial revision
glantau
parents:
diff changeset
53 3, 19, 11, 27, 7, 23, 15, 31
986e461dc072 Initial revision
glantau
parents:
diff changeset
54 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
55
986e461dc072 Initial revision
glantau
parents:
diff changeset
56
84
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 0
diff changeset
57 static INT16 filter_bank[512];
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
58
986e461dc072 Initial revision
glantau
parents:
diff changeset
59 static int scale_factor_table[64];
986e461dc072 Initial revision
glantau
parents:
diff changeset
60 #ifdef USE_FLOATS
986e461dc072 Initial revision
glantau
parents:
diff changeset
61 static float scale_factor_inv_table[64];
986e461dc072 Initial revision
glantau
parents:
diff changeset
62 #else
986e461dc072 Initial revision
glantau
parents:
diff changeset
63 static INT8 scale_factor_shift[64];
986e461dc072 Initial revision
glantau
parents:
diff changeset
64 static unsigned short scale_factor_mult[64];
986e461dc072 Initial revision
glantau
parents:
diff changeset
65 #endif
986e461dc072 Initial revision
glantau
parents:
diff changeset
66 static unsigned char scale_diff_table[128];
986e461dc072 Initial revision
glantau
parents:
diff changeset
67
84
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 0
diff changeset
68 /* total number of bits per allocation group */
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 0
diff changeset
69 static unsigned short total_quant_bits[17];
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
70
986e461dc072 Initial revision
glantau
parents:
diff changeset
71 /* signal to noise ratio of each quantification step (could be
986e461dc072 Initial revision
glantau
parents:
diff changeset
72 computed from quant_steps[]). The values are dB multiplied by 10
986e461dc072 Initial revision
glantau
parents:
diff changeset
73 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
74 static unsigned short quant_snr[17] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
75 70, 110, 160, 208,
986e461dc072 Initial revision
glantau
parents:
diff changeset
76 253, 316, 378, 439,
986e461dc072 Initial revision
glantau
parents:
diff changeset
77 499, 559, 620, 680,
986e461dc072 Initial revision
glantau
parents:
diff changeset
78 740, 800, 861, 920,
986e461dc072 Initial revision
glantau
parents:
diff changeset
79 980
986e461dc072 Initial revision
glantau
parents:
diff changeset
80 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
81
986e461dc072 Initial revision
glantau
parents:
diff changeset
82 /* fixed psycho acoustic model. Values of SNR taken from the 'toolame'
986e461dc072 Initial revision
glantau
parents:
diff changeset
83 project */
84
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 0
diff changeset
84 static const float fixed_smr[SBLIMIT] = {
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
85 30, 17, 16, 10, 3, 12, 8, 2.5,
986e461dc072 Initial revision
glantau
parents:
diff changeset
86 5, 5, 6, 6, 5, 6, 10, 6,
986e461dc072 Initial revision
glantau
parents:
diff changeset
87 -4, -10, -21, -30, -42, -55, -68, -75,
986e461dc072 Initial revision
glantau
parents:
diff changeset
88 -75, -75, -75, -75, -91, -107, -110, -108
986e461dc072 Initial revision
glantau
parents:
diff changeset
89 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
90
84
608c7f964bca merged code and tables between encoder and decoder
glantau
parents: 0
diff changeset
91 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
92