33 files changed, 799 insertions, 342 deletions
diff --git a/core/multimedia/opieplayer/libmad/D.dat b/core/multimedia/opieplayer/libmad/D.dat index c3ee74c..89b01da 100644 --- a/core/multimedia/opieplayer/libmad/D.dat +++ b/core/multimedia/opieplayer/libmad/D.dat | |||
@@ -1,607 +1,607 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * These are the coefficients for the subband synthesis window. This is a | 23 | * These are the coefficients for the subband synthesis window. This is a |
24 | * reordered version of Table B.3 from ISO/IEC 11172-3. | 24 | * reordered version of Table B.3 from ISO/IEC 11172-3. |
25 | * | 25 | * |
26 | * Every value is parameterized so that shift optimizations can be made at | 26 | * Every value is parameterized so that shift optimizations can be made at |
27 | * compile-time. For example, every value can be right-shifted 12 bits to | 27 | * compile-time. For example, every value can be right-shifted 12 bits to |
28 | * minimize multiply instruction times without any loss of accuracy. | 28 | * minimize multiply instruction times without any loss of accuracy. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | { PRESHIFT(0x00000000) /* 0.000000000 */,/* 0 */ | 31 | { PRESHIFT(0x00000000) /* 0.000000000 */,/* 0 */ |
32 | -PRESHIFT(0x0001d000) /* -0.000442505 */, | 32 | -PRESHIFT(0x0001d000) /* -0.000442505 */, |
33 | PRESHIFT(0x000d5000) /* 0.003250122 */, | 33 | PRESHIFT(0x000d5000) /* 0.003250122 */, |
34 | -PRESHIFT(0x001cb000) /* -0.007003784 */, | 34 | -PRESHIFT(0x001cb000) /* -0.007003784 */, |
35 | PRESHIFT(0x007f5000) /* 0.031082153 */, | 35 | PRESHIFT(0x007f5000) /* 0.031082153 */, |
36 | -PRESHIFT(0x01421000) /* -0.078628540 */, | 36 | -PRESHIFT(0x01421000) /* -0.078628540 */, |
37 | PRESHIFT(0x019ae000) /* 0.100311279 */, | 37 | PRESHIFT(0x019ae000) /* 0.100311279 */, |
38 | -PRESHIFT(0x09271000) /* -0.572036743 */, | 38 | -PRESHIFT(0x09271000) /* -0.572036743 */, |
39 | PRESHIFT(0x1251e000) /* 1.144989014 */, | 39 | PRESHIFT(0x1251e000) /* 1.144989014 */, |
40 | PRESHIFT(0x09271000) /* 0.572036743 */, | 40 | PRESHIFT(0x09271000) /* 0.572036743 */, |
41 | PRESHIFT(0x019ae000) /* 0.100311279 */, | 41 | PRESHIFT(0x019ae000) /* 0.100311279 */, |
42 | PRESHIFT(0x01421000) /* 0.078628540 */, | 42 | PRESHIFT(0x01421000) /* 0.078628540 */, |
43 | PRESHIFT(0x007f5000) /* 0.031082153 */, | 43 | PRESHIFT(0x007f5000) /* 0.031082153 */, |
44 | PRESHIFT(0x001cb000) /* 0.007003784 */, | 44 | PRESHIFT(0x001cb000) /* 0.007003784 */, |
45 | PRESHIFT(0x000d5000) /* 0.003250122 */, | 45 | PRESHIFT(0x000d5000) /* 0.003250122 */, |
46 | PRESHIFT(0x0001d000) /* 0.000442505 */, | 46 | PRESHIFT(0x0001d000) /* 0.000442505 */, |
47 | 47 | ||
48 | PRESHIFT(0x00000000) /* 0.000000000 */, | 48 | PRESHIFT(0x00000000) /* 0.000000000 */, |
49 | -PRESHIFT(0x0001d000) /* -0.000442505 */, | 49 | -PRESHIFT(0x0001d000) /* -0.000442505 */, |
50 | PRESHIFT(0x000d5000) /* 0.003250122 */, | 50 | PRESHIFT(0x000d5000) /* 0.003250122 */, |
51 | -PRESHIFT(0x001cb000) /* -0.007003784 */, | 51 | -PRESHIFT(0x001cb000) /* -0.007003784 */, |
52 | PRESHIFT(0x007f5000) /* 0.031082153 */, | 52 | PRESHIFT(0x007f5000) /* 0.031082153 */, |
53 | -PRESHIFT(0x01421000) /* -0.078628540 */, | 53 | -PRESHIFT(0x01421000) /* -0.078628540 */, |
54 | PRESHIFT(0x019ae000) /* 0.100311279 */, | 54 | PRESHIFT(0x019ae000) /* 0.100311279 */, |
55 | -PRESHIFT(0x09271000) /* -0.572036743 */, | 55 | -PRESHIFT(0x09271000) /* -0.572036743 */, |
56 | PRESHIFT(0x1251e000) /* 1.144989014 */, | 56 | PRESHIFT(0x1251e000) /* 1.144989014 */, |
57 | PRESHIFT(0x09271000) /* 0.572036743 */, | 57 | PRESHIFT(0x09271000) /* 0.572036743 */, |
58 | PRESHIFT(0x019ae000) /* 0.100311279 */, | 58 | PRESHIFT(0x019ae000) /* 0.100311279 */, |
59 | PRESHIFT(0x01421000) /* 0.078628540 */, | 59 | PRESHIFT(0x01421000) /* 0.078628540 */, |
60 | PRESHIFT(0x007f5000) /* 0.031082153 */, | 60 | PRESHIFT(0x007f5000) /* 0.031082153 */, |
61 | PRESHIFT(0x001cb000) /* 0.007003784 */, | 61 | PRESHIFT(0x001cb000) /* 0.007003784 */, |
62 | PRESHIFT(0x000d5000) /* 0.003250122 */, | 62 | PRESHIFT(0x000d5000) /* 0.003250122 */, |
63 | PRESHIFT(0x0001d000) /* 0.000442505 */ }, | 63 | PRESHIFT(0x0001d000) /* 0.000442505 */ }, |
64 | 64 | ||
65 | { -PRESHIFT(0x00001000) /* -0.000015259 */,/* 1 */ | 65 | { -PRESHIFT(0x00001000) /* -0.000015259 */,/* 1 */ |
66 | -PRESHIFT(0x0001f000) /* -0.000473022 */, | 66 | -PRESHIFT(0x0001f000) /* -0.000473022 */, |
67 | PRESHIFT(0x000da000) /* 0.003326416 */, | 67 | PRESHIFT(0x000da000) /* 0.003326416 */, |
68 | -PRESHIFT(0x00207000) /* -0.007919312 */, | 68 | -PRESHIFT(0x00207000) /* -0.007919312 */, |
69 | PRESHIFT(0x007d0000) /* 0.030517578 */, | 69 | PRESHIFT(0x007d0000) /* 0.030517578 */, |
70 | -PRESHIFT(0x0158d000) /* -0.084182739 */, | 70 | -PRESHIFT(0x0158d000) /* -0.084182739 */, |
71 | PRESHIFT(0x01747000) /* 0.090927124 */, | 71 | PRESHIFT(0x01747000) /* 0.090927124 */, |
72 | -PRESHIFT(0x099a8000) /* -0.600219727 */, | 72 | -PRESHIFT(0x099a8000) /* -0.600219727 */, |
73 | PRESHIFT(0x124f0000) /* 1.144287109 */, | 73 | PRESHIFT(0x124f0000) /* 1.144287109 */, |
74 | PRESHIFT(0x08b38000) /* 0.543823242 */, | 74 | PRESHIFT(0x08b38000) /* 0.543823242 */, |
75 | PRESHIFT(0x01bde000) /* 0.108856201 */, | 75 | PRESHIFT(0x01bde000) /* 0.108856201 */, |
76 | PRESHIFT(0x012b4000) /* 0.073059082 */, | 76 | PRESHIFT(0x012b4000) /* 0.073059082 */, |
77 | PRESHIFT(0x0080f000) /* 0.031478882 */, | 77 | PRESHIFT(0x0080f000) /* 0.031478882 */, |
78 | PRESHIFT(0x00191000) /* 0.006118774 */, | 78 | PRESHIFT(0x00191000) /* 0.006118774 */, |
79 | PRESHIFT(0x000d0000) /* 0.003173828 */, | 79 | PRESHIFT(0x000d0000) /* 0.003173828 */, |
80 | PRESHIFT(0x0001a000) /* 0.000396729 */, | 80 | PRESHIFT(0x0001a000) /* 0.000396729 */, |
81 | 81 | ||
82 | -PRESHIFT(0x00001000) /* -0.000015259 */, | 82 | -PRESHIFT(0x00001000) /* -0.000015259 */, |
83 | -PRESHIFT(0x0001f000) /* -0.000473022 */, | 83 | -PRESHIFT(0x0001f000) /* -0.000473022 */, |
84 | PRESHIFT(0x000da000) /* 0.003326416 */, | 84 | PRESHIFT(0x000da000) /* 0.003326416 */, |
85 | -PRESHIFT(0x00207000) /* -0.007919312 */, | 85 | -PRESHIFT(0x00207000) /* -0.007919312 */, |
86 | PRESHIFT(0x007d0000) /* 0.030517578 */, | 86 | PRESHIFT(0x007d0000) /* 0.030517578 */, |
87 | -PRESHIFT(0x0158d000) /* -0.084182739 */, | 87 | -PRESHIFT(0x0158d000) /* -0.084182739 */, |
88 | PRESHIFT(0x01747000) /* 0.090927124 */, | 88 | PRESHIFT(0x01747000) /* 0.090927124 */, |
89 | -PRESHIFT(0x099a8000) /* -0.600219727 */, | 89 | -PRESHIFT(0x099a8000) /* -0.600219727 */, |
90 | PRESHIFT(0x124f0000) /* 1.144287109 */, | 90 | PRESHIFT(0x124f0000) /* 1.144287109 */, |
91 | PRESHIFT(0x08b38000) /* 0.543823242 */, | 91 | PRESHIFT(0x08b38000) /* 0.543823242 */, |
92 | PRESHIFT(0x01bde000) /* 0.108856201 */, | 92 | PRESHIFT(0x01bde000) /* 0.108856201 */, |
93 | PRESHIFT(0x012b4000) /* 0.073059082 */, | 93 | PRESHIFT(0x012b4000) /* 0.073059082 */, |
94 | PRESHIFT(0x0080f000) /* 0.031478882 */, | 94 | PRESHIFT(0x0080f000) /* 0.031478882 */, |
95 | PRESHIFT(0x00191000) /* 0.006118774 */, | 95 | PRESHIFT(0x00191000) /* 0.006118774 */, |
96 | PRESHIFT(0x000d0000) /* 0.003173828 */, | 96 | PRESHIFT(0x000d0000) /* 0.003173828 */, |
97 | PRESHIFT(0x0001a000) /* 0.000396729 */ }, | 97 | PRESHIFT(0x0001a000) /* 0.000396729 */ }, |
98 | 98 | ||
99 | { -PRESHIFT(0x00001000) /* -0.000015259 */,/* 2 */ | 99 | { -PRESHIFT(0x00001000) /* -0.000015259 */,/* 2 */ |
100 | -PRESHIFT(0x00023000) /* -0.000534058 */, | 100 | -PRESHIFT(0x00023000) /* -0.000534058 */, |
101 | PRESHIFT(0x000de000) /* 0.003387451 */, | 101 | PRESHIFT(0x000de000) /* 0.003387451 */, |
102 | -PRESHIFT(0x00245000) /* -0.008865356 */, | 102 | -PRESHIFT(0x00245000) /* -0.008865356 */, |
103 | PRESHIFT(0x007a0000) /* 0.029785156 */, | 103 | PRESHIFT(0x007a0000) /* 0.029785156 */, |
104 | -PRESHIFT(0x016f7000) /* -0.089706421 */, | 104 | -PRESHIFT(0x016f7000) /* -0.089706421 */, |
105 | PRESHIFT(0x014a8000) /* 0.080688477 */, | 105 | PRESHIFT(0x014a8000) /* 0.080688477 */, |
106 | -PRESHIFT(0x0a0d8000) /* -0.628295898 */, | 106 | -PRESHIFT(0x0a0d8000) /* -0.628295898 */, |
107 | PRESHIFT(0x12468000) /* 1.142211914 */, | 107 | PRESHIFT(0x12468000) /* 1.142211914 */, |
108 | PRESHIFT(0x083ff000) /* 0.515609741 */, | 108 | PRESHIFT(0x083ff000) /* 0.515609741 */, |
109 | PRESHIFT(0x01dd8000) /* 0.116577148 */, | 109 | PRESHIFT(0x01dd8000) /* 0.116577148 */, |
110 | PRESHIFT(0x01149000) /* 0.067520142 */, | 110 | PRESHIFT(0x01149000) /* 0.067520142 */, |
111 | PRESHIFT(0x00820000) /* 0.031738281 */, | 111 | PRESHIFT(0x00820000) /* 0.031738281 */, |
112 | PRESHIFT(0x0015b000) /* 0.005294800 */, | 112 | PRESHIFT(0x0015b000) /* 0.005294800 */, |
113 | PRESHIFT(0x000ca000) /* 0.003082275 */, | 113 | PRESHIFT(0x000ca000) /* 0.003082275 */, |
114 | PRESHIFT(0x00018000) /* 0.000366211 */, | 114 | PRESHIFT(0x00018000) /* 0.000366211 */, |
115 | 115 | ||
116 | -PRESHIFT(0x00001000) /* -0.000015259 */, | 116 | -PRESHIFT(0x00001000) /* -0.000015259 */, |
117 | -PRESHIFT(0x00023000) /* -0.000534058 */, | 117 | -PRESHIFT(0x00023000) /* -0.000534058 */, |
118 | PRESHIFT(0x000de000) /* 0.003387451 */, | 118 | PRESHIFT(0x000de000) /* 0.003387451 */, |
119 | -PRESHIFT(0x00245000) /* -0.008865356 */, | 119 | -PRESHIFT(0x00245000) /* -0.008865356 */, |
120 | PRESHIFT(0x007a0000) /* 0.029785156 */, | 120 | PRESHIFT(0x007a0000) /* 0.029785156 */, |
121 | -PRESHIFT(0x016f7000) /* -0.089706421 */, | 121 | -PRESHIFT(0x016f7000) /* -0.089706421 */, |
122 | PRESHIFT(0x014a8000) /* 0.080688477 */, | 122 | PRESHIFT(0x014a8000) /* 0.080688477 */, |
123 | -PRESHIFT(0x0a0d8000) /* -0.628295898 */, | 123 | -PRESHIFT(0x0a0d8000) /* -0.628295898 */, |
124 | PRESHIFT(0x12468000) /* 1.142211914 */, | 124 | PRESHIFT(0x12468000) /* 1.142211914 */, |
125 | PRESHIFT(0x083ff000) /* 0.515609741 */, | 125 | PRESHIFT(0x083ff000) /* 0.515609741 */, |
126 | PRESHIFT(0x01dd8000) /* 0.116577148 */, | 126 | PRESHIFT(0x01dd8000) /* 0.116577148 */, |
127 | PRESHIFT(0x01149000) /* 0.067520142 */, | 127 | PRESHIFT(0x01149000) /* 0.067520142 */, |
128 | PRESHIFT(0x00820000) /* 0.031738281 */, | 128 | PRESHIFT(0x00820000) /* 0.031738281 */, |
129 | PRESHIFT(0x0015b000) /* 0.005294800 */, | 129 | PRESHIFT(0x0015b000) /* 0.005294800 */, |
130 | PRESHIFT(0x000ca000) /* 0.003082275 */, | 130 | PRESHIFT(0x000ca000) /* 0.003082275 */, |
131 | PRESHIFT(0x00018000) /* 0.000366211 */ }, | 131 | PRESHIFT(0x00018000) /* 0.000366211 */ }, |
132 | 132 | ||
133 | { -PRESHIFT(0x00001000) /* -0.000015259 */,/* 3 */ | 133 | { -PRESHIFT(0x00001000) /* -0.000015259 */,/* 3 */ |
134 | -PRESHIFT(0x00026000) /* -0.000579834 */, | 134 | -PRESHIFT(0x00026000) /* -0.000579834 */, |
135 | PRESHIFT(0x000e1000) /* 0.003433228 */, | 135 | PRESHIFT(0x000e1000) /* 0.003433228 */, |
136 | -PRESHIFT(0x00285000) /* -0.009841919 */, | 136 | -PRESHIFT(0x00285000) /* -0.009841919 */, |
137 | PRESHIFT(0x00765000) /* 0.028884888 */, | 137 | PRESHIFT(0x00765000) /* 0.028884888 */, |
138 | -PRESHIFT(0x0185d000) /* -0.095169067 */, | 138 | -PRESHIFT(0x0185d000) /* -0.095169067 */, |
139 | PRESHIFT(0x011d1000) /* 0.069595337 */, | 139 | PRESHIFT(0x011d1000) /* 0.069595337 */, |
140 | -PRESHIFT(0x0a7fe000) /* -0.656219482 */, | 140 | -PRESHIFT(0x0a7fe000) /* -0.656219482 */, |
141 | PRESHIFT(0x12386000) /* 1.138763428 */, | 141 | PRESHIFT(0x12386000) /* 1.138763428 */, |
142 | PRESHIFT(0x07ccb000) /* 0.487472534 */, | 142 | PRESHIFT(0x07ccb000) /* 0.487472534 */, |
143 | PRESHIFT(0x01f9c000) /* 0.123474121 */, | 143 | PRESHIFT(0x01f9c000) /* 0.123474121 */, |
144 | PRESHIFT(0x00fdf000) /* 0.061996460 */, | 144 | PRESHIFT(0x00fdf000) /* 0.061996460 */, |
145 | PRESHIFT(0x00827000) /* 0.031845093 */, | 145 | PRESHIFT(0x00827000) /* 0.031845093 */, |
146 | PRESHIFT(0x00126000) /* 0.004486084 */, | 146 | PRESHIFT(0x00126000) /* 0.004486084 */, |
147 | PRESHIFT(0x000c4000) /* 0.002990723 */, | 147 | PRESHIFT(0x000c4000) /* 0.002990723 */, |
148 | PRESHIFT(0x00015000) /* 0.000320435 */, | 148 | PRESHIFT(0x00015000) /* 0.000320435 */, |
149 | 149 | ||
150 | -PRESHIFT(0x00001000) /* -0.000015259 */, | 150 | -PRESHIFT(0x00001000) /* -0.000015259 */, |
151 | -PRESHIFT(0x00026000) /* -0.000579834 */, | 151 | -PRESHIFT(0x00026000) /* -0.000579834 */, |
152 | PRESHIFT(0x000e1000) /* 0.003433228 */, | 152 | PRESHIFT(0x000e1000) /* 0.003433228 */, |
153 | -PRESHIFT(0x00285000) /* -0.009841919 */, | 153 | -PRESHIFT(0x00285000) /* -0.009841919 */, |
154 | PRESHIFT(0x00765000) /* 0.028884888 */, | 154 | PRESHIFT(0x00765000) /* 0.028884888 */, |
155 | -PRESHIFT(0x0185d000) /* -0.095169067 */, | 155 | -PRESHIFT(0x0185d000) /* -0.095169067 */, |
156 | PRESHIFT(0x011d1000) /* 0.069595337 */, | 156 | PRESHIFT(0x011d1000) /* 0.069595337 */, |
157 | -PRESHIFT(0x0a7fe000) /* -0.656219482 */, | 157 | -PRESHIFT(0x0a7fe000) /* -0.656219482 */, |
158 | PRESHIFT(0x12386000) /* 1.138763428 */, | 158 | PRESHIFT(0x12386000) /* 1.138763428 */, |
159 | PRESHIFT(0x07ccb000) /* 0.487472534 */, | 159 | PRESHIFT(0x07ccb000) /* 0.487472534 */, |
160 | PRESHIFT(0x01f9c000) /* 0.123474121 */, | 160 | PRESHIFT(0x01f9c000) /* 0.123474121 */, |
161 | PRESHIFT(0x00fdf000) /* 0.061996460 */, | 161 | PRESHIFT(0x00fdf000) /* 0.061996460 */, |
162 | PRESHIFT(0x00827000) /* 0.031845093 */, | 162 | PRESHIFT(0x00827000) /* 0.031845093 */, |
163 | PRESHIFT(0x00126000) /* 0.004486084 */, | 163 | PRESHIFT(0x00126000) /* 0.004486084 */, |
164 | PRESHIFT(0x000c4000) /* 0.002990723 */, | 164 | PRESHIFT(0x000c4000) /* 0.002990723 */, |
165 | PRESHIFT(0x00015000) /* 0.000320435 */ }, | 165 | PRESHIFT(0x00015000) /* 0.000320435 */ }, |
166 | 166 | ||
167 | { -PRESHIFT(0x00001000) /* -0.000015259 */,/* 4 */ | 167 | { -PRESHIFT(0x00001000) /* -0.000015259 */,/* 4 */ |
168 | -PRESHIFT(0x00029000) /* -0.000625610 */, | 168 | -PRESHIFT(0x00029000) /* -0.000625610 */, |
169 | PRESHIFT(0x000e3000) /* 0.003463745 */, | 169 | PRESHIFT(0x000e3000) /* 0.003463745 */, |
170 | -PRESHIFT(0x002c7000) /* -0.010848999 */, | 170 | -PRESHIFT(0x002c7000) /* -0.010848999 */, |
171 | PRESHIFT(0x0071e000) /* 0.027801514 */, | 171 | PRESHIFT(0x0071e000) /* 0.027801514 */, |
172 | -PRESHIFT(0x019bd000) /* -0.100540161 */, | 172 | -PRESHIFT(0x019bd000) /* -0.100540161 */, |
173 | PRESHIFT(0x00ec0000) /* 0.057617187 */, | 173 | PRESHIFT(0x00ec0000) /* 0.057617187 */, |
174 | -PRESHIFT(0x0af15000) /* -0.683914185 */, | 174 | -PRESHIFT(0x0af15000) /* -0.683914185 */, |
175 | PRESHIFT(0x12249000) /* 1.133926392 */, | 175 | PRESHIFT(0x12249000) /* 1.133926392 */, |
176 | PRESHIFT(0x075a0000) /* 0.459472656 */, | 176 | PRESHIFT(0x075a0000) /* 0.459472656 */, |
177 | PRESHIFT(0x0212c000) /* 0.129577637 */, | 177 | PRESHIFT(0x0212c000) /* 0.129577637 */, |
178 | PRESHIFT(0x00e79000) /* 0.056533813 */, | 178 | PRESHIFT(0x00e79000) /* 0.056533813 */, |
179 | PRESHIFT(0x00825000) /* 0.031814575 */, | 179 | PRESHIFT(0x00825000) /* 0.031814575 */, |
180 | PRESHIFT(0x000f4000) /* 0.003723145 */, | 180 | PRESHIFT(0x000f4000) /* 0.003723145 */, |
181 | PRESHIFT(0x000be000) /* 0.002899170 */, | 181 | PRESHIFT(0x000be000) /* 0.002899170 */, |
182 | PRESHIFT(0x00013000) /* 0.000289917 */, | 182 | PRESHIFT(0x00013000) /* 0.000289917 */, |
183 | 183 | ||
184 | -PRESHIFT(0x00001000) /* -0.000015259 */, | 184 | -PRESHIFT(0x00001000) /* -0.000015259 */, |
185 | -PRESHIFT(0x00029000) /* -0.000625610 */, | 185 | -PRESHIFT(0x00029000) /* -0.000625610 */, |
186 | PRESHIFT(0x000e3000) /* 0.003463745 */, | 186 | PRESHIFT(0x000e3000) /* 0.003463745 */, |
187 | -PRESHIFT(0x002c7000) /* -0.010848999 */, | 187 | -PRESHIFT(0x002c7000) /* -0.010848999 */, |
188 | PRESHIFT(0x0071e000) /* 0.027801514 */, | 188 | PRESHIFT(0x0071e000) /* 0.027801514 */, |
189 | -PRESHIFT(0x019bd000) /* -0.100540161 */, | 189 | -PRESHIFT(0x019bd000) /* -0.100540161 */, |
190 | PRESHIFT(0x00ec0000) /* 0.057617187 */, | 190 | PRESHIFT(0x00ec0000) /* 0.057617187 */, |
191 | -PRESHIFT(0x0af15000) /* -0.683914185 */, | 191 | -PRESHIFT(0x0af15000) /* -0.683914185 */, |
192 | PRESHIFT(0x12249000) /* 1.133926392 */, | 192 | PRESHIFT(0x12249000) /* 1.133926392 */, |
193 | PRESHIFT(0x075a0000) /* 0.459472656 */, | 193 | PRESHIFT(0x075a0000) /* 0.459472656 */, |
194 | PRESHIFT(0x0212c000) /* 0.129577637 */, | 194 | PRESHIFT(0x0212c000) /* 0.129577637 */, |
195 | PRESHIFT(0x00e79000) /* 0.056533813 */, | 195 | PRESHIFT(0x00e79000) /* 0.056533813 */, |
196 | PRESHIFT(0x00825000) /* 0.031814575 */, | 196 | PRESHIFT(0x00825000) /* 0.031814575 */, |
197 | PRESHIFT(0x000f4000) /* 0.003723145 */, | 197 | PRESHIFT(0x000f4000) /* 0.003723145 */, |
198 | PRESHIFT(0x000be000) /* 0.002899170 */, | 198 | PRESHIFT(0x000be000) /* 0.002899170 */, |
199 | PRESHIFT(0x00013000) /* 0.000289917 */ }, | 199 | PRESHIFT(0x00013000) /* 0.000289917 */ }, |
200 | 200 | ||
201 | { -PRESHIFT(0x00001000) /* -0.000015259 */,/* 5 */ | 201 | { -PRESHIFT(0x00001000) /* -0.000015259 */,/* 5 */ |
202 | -PRESHIFT(0x0002d000) /* -0.000686646 */, | 202 | -PRESHIFT(0x0002d000) /* -0.000686646 */, |
203 | PRESHIFT(0x000e4000) /* 0.003479004 */, | 203 | PRESHIFT(0x000e4000) /* 0.003479004 */, |
204 | -PRESHIFT(0x0030b000) /* -0.011886597 */, | 204 | -PRESHIFT(0x0030b000) /* -0.011886597 */, |
205 | PRESHIFT(0x006cb000) /* 0.026535034 */, | 205 | PRESHIFT(0x006cb000) /* 0.026535034 */, |
206 | -PRESHIFT(0x01b17000) /* -0.105819702 */, | 206 | -PRESHIFT(0x01b17000) /* -0.105819702 */, |
207 | PRESHIFT(0x00b77000) /* 0.044784546 */, | 207 | PRESHIFT(0x00b77000) /* 0.044784546 */, |
208 | -PRESHIFT(0x0b619000) /* -0.711318970 */, | 208 | -PRESHIFT(0x0b619000) /* -0.711318970 */, |
209 | PRESHIFT(0x120b4000) /* 1.127746582 */, | 209 | PRESHIFT(0x120b4000) /* 1.127746582 */, |
210 | PRESHIFT(0x06e81000) /* 0.431655884 */, | 210 | PRESHIFT(0x06e81000) /* 0.431655884 */, |
211 | PRESHIFT(0x02288000) /* 0.134887695 */, | 211 | PRESHIFT(0x02288000) /* 0.134887695 */, |
212 | PRESHIFT(0x00d17000) /* 0.051132202 */, | 212 | PRESHIFT(0x00d17000) /* 0.051132202 */, |
213 | PRESHIFT(0x0081b000) /* 0.031661987 */, | 213 | PRESHIFT(0x0081b000) /* 0.031661987 */, |
214 | PRESHIFT(0x000c5000) /* 0.003005981 */, | 214 | PRESHIFT(0x000c5000) /* 0.003005981 */, |
215 | PRESHIFT(0x000b7000) /* 0.002792358 */, | 215 | PRESHIFT(0x000b7000) /* 0.002792358 */, |
216 | PRESHIFT(0x00011000) /* 0.000259399 */, | 216 | PRESHIFT(0x00011000) /* 0.000259399 */, |
217 | 217 | ||
218 | -PRESHIFT(0x00001000) /* -0.000015259 */, | 218 | -PRESHIFT(0x00001000) /* -0.000015259 */, |
219 | -PRESHIFT(0x0002d000) /* -0.000686646 */, | 219 | -PRESHIFT(0x0002d000) /* -0.000686646 */, |
220 | PRESHIFT(0x000e4000) /* 0.003479004 */, | 220 | PRESHIFT(0x000e4000) /* 0.003479004 */, |
221 | -PRESHIFT(0x0030b000) /* -0.011886597 */, | 221 | -PRESHIFT(0x0030b000) /* -0.011886597 */, |
222 | PRESHIFT(0x006cb000) /* 0.026535034 */, | 222 | PRESHIFT(0x006cb000) /* 0.026535034 */, |
223 | -PRESHIFT(0x01b17000) /* -0.105819702 */, | 223 | -PRESHIFT(0x01b17000) /* -0.105819702 */, |
224 | PRESHIFT(0x00b77000) /* 0.044784546 */, | 224 | PRESHIFT(0x00b77000) /* 0.044784546 */, |
225 | -PRESHIFT(0x0b619000) /* -0.711318970 */, | 225 | -PRESHIFT(0x0b619000) /* -0.711318970 */, |
226 | PRESHIFT(0x120b4000) /* 1.127746582 */, | 226 | PRESHIFT(0x120b4000) /* 1.127746582 */, |
227 | PRESHIFT(0x06e81000) /* 0.431655884 */, | 227 | PRESHIFT(0x06e81000) /* 0.431655884 */, |
228 | PRESHIFT(0x02288000) /* 0.134887695 */, | 228 | PRESHIFT(0x02288000) /* 0.134887695 */, |
229 | PRESHIFT(0x00d17000) /* 0.051132202 */, | 229 | PRESHIFT(0x00d17000) /* 0.051132202 */, |
230 | PRESHIFT(0x0081b000) /* 0.031661987 */, | 230 | PRESHIFT(0x0081b000) /* 0.031661987 */, |
231 | PRESHIFT(0x000c5000) /* 0.003005981 */, | 231 | PRESHIFT(0x000c5000) /* 0.003005981 */, |
232 | PRESHIFT(0x000b7000) /* 0.002792358 */, | 232 | PRESHIFT(0x000b7000) /* 0.002792358 */, |
233 | PRESHIFT(0x00011000) /* 0.000259399 */ }, | 233 | PRESHIFT(0x00011000) /* 0.000259399 */ }, |
234 | 234 | ||
235 | { -PRESHIFT(0x00001000) /* -0.000015259 */,/* 6 */ | 235 | { -PRESHIFT(0x00001000) /* -0.000015259 */,/* 6 */ |
236 | -PRESHIFT(0x00031000) /* -0.000747681 */, | 236 | -PRESHIFT(0x00031000) /* -0.000747681 */, |
237 | PRESHIFT(0x000e4000) /* 0.003479004 */, | 237 | PRESHIFT(0x000e4000) /* 0.003479004 */, |
238 | -PRESHIFT(0x00350000) /* -0.012939453 */, | 238 | -PRESHIFT(0x00350000) /* -0.012939453 */, |
239 | PRESHIFT(0x0066c000) /* 0.025085449 */, | 239 | PRESHIFT(0x0066c000) /* 0.025085449 */, |
240 | -PRESHIFT(0x01c67000) /* -0.110946655 */, | 240 | -PRESHIFT(0x01c67000) /* -0.110946655 */, |
241 | PRESHIFT(0x007f5000) /* 0.031082153 */, | 241 | PRESHIFT(0x007f5000) /* 0.031082153 */, |
242 | -PRESHIFT(0x0bd06000) /* -0.738372803 */, | 242 | -PRESHIFT(0x0bd06000) /* -0.738372803 */, |
243 | PRESHIFT(0x11ec7000) /* 1.120223999 */, | 243 | PRESHIFT(0x11ec7000) /* 1.120223999 */, |
244 | PRESHIFT(0x06772000) /* 0.404083252 */, | 244 | PRESHIFT(0x06772000) /* 0.404083252 */, |
245 | PRESHIFT(0x023b3000) /* 0.139450073 */, | 245 | PRESHIFT(0x023b3000) /* 0.139450073 */, |
246 | PRESHIFT(0x00bbc000) /* 0.045837402 */, | 246 | PRESHIFT(0x00bbc000) /* 0.045837402 */, |
247 | PRESHIFT(0x00809000) /* 0.031387329 */, | 247 | PRESHIFT(0x00809000) /* 0.031387329 */, |
248 | PRESHIFT(0x00099000) /* 0.002334595 */, | 248 | PRESHIFT(0x00099000) /* 0.002334595 */, |
249 | PRESHIFT(0x000b0000) /* 0.002685547 */, | 249 | PRESHIFT(0x000b0000) /* 0.002685547 */, |
250 | PRESHIFT(0x00010000) /* 0.000244141 */, | 250 | PRESHIFT(0x00010000) /* 0.000244141 */, |
251 | 251 | ||
252 | -PRESHIFT(0x00001000) /* -0.000015259 */, | 252 | -PRESHIFT(0x00001000) /* -0.000015259 */, |
253 | -PRESHIFT(0x00031000) /* -0.000747681 */, | 253 | -PRESHIFT(0x00031000) /* -0.000747681 */, |
254 | PRESHIFT(0x000e4000) /* 0.003479004 */, | 254 | PRESHIFT(0x000e4000) /* 0.003479004 */, |
255 | -PRESHIFT(0x00350000) /* -0.012939453 */, | 255 | -PRESHIFT(0x00350000) /* -0.012939453 */, |
256 | PRESHIFT(0x0066c000) /* 0.025085449 */, | 256 | PRESHIFT(0x0066c000) /* 0.025085449 */, |
257 | -PRESHIFT(0x01c67000) /* -0.110946655 */, | 257 | -PRESHIFT(0x01c67000) /* -0.110946655 */, |
258 | PRESHIFT(0x007f5000) /* 0.031082153 */, | 258 | PRESHIFT(0x007f5000) /* 0.031082153 */, |
259 | -PRESHIFT(0x0bd06000) /* -0.738372803 */, | 259 | -PRESHIFT(0x0bd06000) /* -0.738372803 */, |
260 | PRESHIFT(0x11ec7000) /* 1.120223999 */, | 260 | PRESHIFT(0x11ec7000) /* 1.120223999 */, |
261 | PRESHIFT(0x06772000) /* 0.404083252 */, | 261 | PRESHIFT(0x06772000) /* 0.404083252 */, |
262 | PRESHIFT(0x023b3000) /* 0.139450073 */, | 262 | PRESHIFT(0x023b3000) /* 0.139450073 */, |
263 | PRESHIFT(0x00bbc000) /* 0.045837402 */, | 263 | PRESHIFT(0x00bbc000) /* 0.045837402 */, |
264 | PRESHIFT(0x00809000) /* 0.031387329 */, | 264 | PRESHIFT(0x00809000) /* 0.031387329 */, |
265 | PRESHIFT(0x00099000) /* 0.002334595 */, | 265 | PRESHIFT(0x00099000) /* 0.002334595 */, |
266 | PRESHIFT(0x000b0000) /* 0.002685547 */, | 266 | PRESHIFT(0x000b0000) /* 0.002685547 */, |
267 | PRESHIFT(0x00010000) /* 0.000244141 */ }, | 267 | PRESHIFT(0x00010000) /* 0.000244141 */ }, |
268 | 268 | ||
269 | { -PRESHIFT(0x00002000) /* -0.000030518 */,/* 7 */ | 269 | { -PRESHIFT(0x00002000) /* -0.000030518 */,/* 7 */ |
270 | -PRESHIFT(0x00035000) /* -0.000808716 */, | 270 | -PRESHIFT(0x00035000) /* -0.000808716 */, |
271 | PRESHIFT(0x000e3000) /* 0.003463745 */, | 271 | PRESHIFT(0x000e3000) /* 0.003463745 */, |
272 | -PRESHIFT(0x00397000) /* -0.014022827 */, | 272 | -PRESHIFT(0x00397000) /* -0.014022827 */, |
273 | PRESHIFT(0x005ff000) /* 0.023422241 */, | 273 | PRESHIFT(0x005ff000) /* 0.023422241 */, |
274 | -PRESHIFT(0x01dad000) /* -0.115921021 */, | 274 | -PRESHIFT(0x01dad000) /* -0.115921021 */, |
275 | PRESHIFT(0x0043a000) /* 0.016510010 */, | 275 | PRESHIFT(0x0043a000) /* 0.016510010 */, |
276 | -PRESHIFT(0x0c3d9000) /* -0.765029907 */, | 276 | -PRESHIFT(0x0c3d9000) /* -0.765029907 */, |
277 | PRESHIFT(0x11c83000) /* 1.111373901 */, | 277 | PRESHIFT(0x11c83000) /* 1.111373901 */, |
278 | PRESHIFT(0x06076000) /* 0.376800537 */, | 278 | PRESHIFT(0x06076000) /* 0.376800537 */, |
279 | PRESHIFT(0x024ad000) /* 0.143264771 */, | 279 | PRESHIFT(0x024ad000) /* 0.143264771 */, |
280 | PRESHIFT(0x00a67000) /* 0.040634155 */, | 280 | PRESHIFT(0x00a67000) /* 0.040634155 */, |
281 | PRESHIFT(0x007f0000) /* 0.031005859 */, | 281 | PRESHIFT(0x007f0000) /* 0.031005859 */, |
282 | PRESHIFT(0x0006f000) /* 0.001693726 */, | 282 | PRESHIFT(0x0006f000) /* 0.001693726 */, |
283 | PRESHIFT(0x000a9000) /* 0.002578735 */, | 283 | PRESHIFT(0x000a9000) /* 0.002578735 */, |
284 | PRESHIFT(0x0000e000) /* 0.000213623 */, | 284 | PRESHIFT(0x0000e000) /* 0.000213623 */, |
285 | 285 | ||
286 | -PRESHIFT(0x00002000) /* -0.000030518 */, | 286 | -PRESHIFT(0x00002000) /* -0.000030518 */, |
287 | -PRESHIFT(0x00035000) /* -0.000808716 */, | 287 | -PRESHIFT(0x00035000) /* -0.000808716 */, |
288 | PRESHIFT(0x000e3000) /* 0.003463745 */, | 288 | PRESHIFT(0x000e3000) /* 0.003463745 */, |
289 | -PRESHIFT(0x00397000) /* -0.014022827 */, | 289 | -PRESHIFT(0x00397000) /* -0.014022827 */, |
290 | PRESHIFT(0x005ff000) /* 0.023422241 */, | 290 | PRESHIFT(0x005ff000) /* 0.023422241 */, |
291 | -PRESHIFT(0x01dad000) /* -0.115921021 */, | 291 | -PRESHIFT(0x01dad000) /* -0.115921021 */, |
292 | PRESHIFT(0x0043a000) /* 0.016510010 */, | 292 | PRESHIFT(0x0043a000) /* 0.016510010 */, |
293 | -PRESHIFT(0x0c3d9000) /* -0.765029907 */, | 293 | -PRESHIFT(0x0c3d9000) /* -0.765029907 */, |
294 | PRESHIFT(0x11c83000) /* 1.111373901 */, | 294 | PRESHIFT(0x11c83000) /* 1.111373901 */, |
295 | PRESHIFT(0x06076000) /* 0.376800537 */, | 295 | PRESHIFT(0x06076000) /* 0.376800537 */, |
296 | PRESHIFT(0x024ad000) /* 0.143264771 */, | 296 | PRESHIFT(0x024ad000) /* 0.143264771 */, |
297 | PRESHIFT(0x00a67000) /* 0.040634155 */, | 297 | PRESHIFT(0x00a67000) /* 0.040634155 */, |
298 | PRESHIFT(0x007f0000) /* 0.031005859 */, | 298 | PRESHIFT(0x007f0000) /* 0.031005859 */, |
299 | PRESHIFT(0x0006f000) /* 0.001693726 */, | 299 | PRESHIFT(0x0006f000) /* 0.001693726 */, |
300 | PRESHIFT(0x000a9000) /* 0.002578735 */, | 300 | PRESHIFT(0x000a9000) /* 0.002578735 */, |
301 | PRESHIFT(0x0000e000) /* 0.000213623 */ }, | 301 | PRESHIFT(0x0000e000) /* 0.000213623 */ }, |
302 | 302 | ||
303 | { -PRESHIFT(0x00002000) /* -0.000030518 */,/* 8 */ | 303 | { -PRESHIFT(0x00002000) /* -0.000030518 */,/* 8 */ |
304 | -PRESHIFT(0x0003a000) /* -0.000885010 */, | 304 | -PRESHIFT(0x0003a000) /* -0.000885010 */, |
305 | PRESHIFT(0x000e0000) /* 0.003417969 */, | 305 | PRESHIFT(0x000e0000) /* 0.003417969 */, |
306 | -PRESHIFT(0x003df000) /* -0.015121460 */, | 306 | -PRESHIFT(0x003df000) /* -0.015121460 */, |
307 | PRESHIFT(0x00586000) /* 0.021575928 */, | 307 | PRESHIFT(0x00586000) /* 0.021575928 */, |
308 | -PRESHIFT(0x01ee6000) /* -0.120697021 */, | 308 | -PRESHIFT(0x01ee6000) /* -0.120697021 */, |
309 | PRESHIFT(0x00046000) /* 0.001068115 */, | 309 | PRESHIFT(0x00046000) /* 0.001068115 */, |
310 | -PRESHIFT(0x0ca8d000) /* -0.791213989 */, | 310 | -PRESHIFT(0x0ca8d000) /* -0.791213989 */, |
311 | PRESHIFT(0x119e9000) /* 1.101211548 */, | 311 | PRESHIFT(0x119e9000) /* 1.101211548 */, |
312 | PRESHIFT(0x05991000) /* 0.349868774 */, | 312 | PRESHIFT(0x05991000) /* 0.349868774 */, |
313 | PRESHIFT(0x02578000) /* 0.146362305 */, | 313 | PRESHIFT(0x02578000) /* 0.146362305 */, |
314 | PRESHIFT(0x0091a000) /* 0.035552979 */, | 314 | PRESHIFT(0x0091a000) /* 0.035552979 */, |
315 | PRESHIFT(0x007d1000) /* 0.030532837 */, | 315 | PRESHIFT(0x007d1000) /* 0.030532837 */, |
316 | PRESHIFT(0x00048000) /* 0.001098633 */, | 316 | PRESHIFT(0x00048000) /* 0.001098633 */, |
317 | PRESHIFT(0x000a1000) /* 0.002456665 */, | 317 | PRESHIFT(0x000a1000) /* 0.002456665 */, |
318 | PRESHIFT(0x0000d000) /* 0.000198364 */, | 318 | PRESHIFT(0x0000d000) /* 0.000198364 */, |
319 | 319 | ||
320 | -PRESHIFT(0x00002000) /* -0.000030518 */, | 320 | -PRESHIFT(0x00002000) /* -0.000030518 */, |
321 | -PRESHIFT(0x0003a000) /* -0.000885010 */, | 321 | -PRESHIFT(0x0003a000) /* -0.000885010 */, |
322 | PRESHIFT(0x000e0000) /* 0.003417969 */, | 322 | PRESHIFT(0x000e0000) /* 0.003417969 */, |
323 | -PRESHIFT(0x003df000) /* -0.015121460 */, | 323 | -PRESHIFT(0x003df000) /* -0.015121460 */, |
324 | PRESHIFT(0x00586000) /* 0.021575928 */, | 324 | PRESHIFT(0x00586000) /* 0.021575928 */, |
325 | -PRESHIFT(0x01ee6000) /* -0.120697021 */, | 325 | -PRESHIFT(0x01ee6000) /* -0.120697021 */, |
326 | PRESHIFT(0x00046000) /* 0.001068115 */, | 326 | PRESHIFT(0x00046000) /* 0.001068115 */, |
327 | -PRESHIFT(0x0ca8d000) /* -0.791213989 */, | 327 | -PRESHIFT(0x0ca8d000) /* -0.791213989 */, |
328 | PRESHIFT(0x119e9000) /* 1.101211548 */, | 328 | PRESHIFT(0x119e9000) /* 1.101211548 */, |
329 | PRESHIFT(0x05991000) /* 0.349868774 */, | 329 | PRESHIFT(0x05991000) /* 0.349868774 */, |
330 | PRESHIFT(0x02578000) /* 0.146362305 */, | 330 | PRESHIFT(0x02578000) /* 0.146362305 */, |
331 | PRESHIFT(0x0091a000) /* 0.035552979 */, | 331 | PRESHIFT(0x0091a000) /* 0.035552979 */, |
332 | PRESHIFT(0x007d1000) /* 0.030532837 */, | 332 | PRESHIFT(0x007d1000) /* 0.030532837 */, |
333 | PRESHIFT(0x00048000) /* 0.001098633 */, | 333 | PRESHIFT(0x00048000) /* 0.001098633 */, |
334 | PRESHIFT(0x000a1000) /* 0.002456665 */, | 334 | PRESHIFT(0x000a1000) /* 0.002456665 */, |
335 | PRESHIFT(0x0000d000) /* 0.000198364 */ }, | 335 | PRESHIFT(0x0000d000) /* 0.000198364 */ }, |
336 | 336 | ||
337 | { -PRESHIFT(0x00002000) /* -0.000030518 */,/* 9 */ | 337 | { -PRESHIFT(0x00002000) /* -0.000030518 */,/* 9 */ |
338 | -PRESHIFT(0x0003f000) /* -0.000961304 */, | 338 | -PRESHIFT(0x0003f000) /* -0.000961304 */, |
339 | PRESHIFT(0x000dd000) /* 0.003372192 */, | 339 | PRESHIFT(0x000dd000) /* 0.003372192 */, |
340 | -PRESHIFT(0x00428000) /* -0.016235352 */, | 340 | -PRESHIFT(0x00428000) /* -0.016235352 */, |
341 | PRESHIFT(0x00500000) /* 0.019531250 */, | 341 | PRESHIFT(0x00500000) /* 0.019531250 */, |
342 | -PRESHIFT(0x02011000) /* -0.125259399 */, | 342 | -PRESHIFT(0x02011000) /* -0.125259399 */, |
343 | -PRESHIFT(0x003e6000) /* -0.015228271 */, | 343 | -PRESHIFT(0x003e6000) /* -0.015228271 */, |
344 | -PRESHIFT(0x0d11e000) /* -0.816864014 */, | 344 | -PRESHIFT(0x0d11e000) /* -0.816864014 */, |
345 | PRESHIFT(0x116fc000) /* 1.089782715 */, | 345 | PRESHIFT(0x116fc000) /* 1.089782715 */, |
346 | PRESHIFT(0x052c5000) /* 0.323318481 */, | 346 | PRESHIFT(0x052c5000) /* 0.323318481 */, |
347 | PRESHIFT(0x02616000) /* 0.148773193 */, | 347 | PRESHIFT(0x02616000) /* 0.148773193 */, |
348 | PRESHIFT(0x007d6000) /* 0.030609131 */, | 348 | PRESHIFT(0x007d6000) /* 0.030609131 */, |
349 | PRESHIFT(0x007aa000) /* 0.029937744 */, | 349 | PRESHIFT(0x007aa000) /* 0.029937744 */, |
350 | PRESHIFT(0x00024000) /* 0.000549316 */, | 350 | PRESHIFT(0x00024000) /* 0.000549316 */, |
351 | PRESHIFT(0x0009a000) /* 0.002349854 */, | 351 | PRESHIFT(0x0009a000) /* 0.002349854 */, |
352 | PRESHIFT(0x0000b000) /* 0.000167847 */, | 352 | PRESHIFT(0x0000b000) /* 0.000167847 */, |
353 | 353 | ||
354 | -PRESHIFT(0x00002000) /* -0.000030518 */, | 354 | -PRESHIFT(0x00002000) /* -0.000030518 */, |
355 | -PRESHIFT(0x0003f000) /* -0.000961304 */, | 355 | -PRESHIFT(0x0003f000) /* -0.000961304 */, |
356 | PRESHIFT(0x000dd000) /* 0.003372192 */, | 356 | PRESHIFT(0x000dd000) /* 0.003372192 */, |
357 | -PRESHIFT(0x00428000) /* -0.016235352 */, | 357 | -PRESHIFT(0x00428000) /* -0.016235352 */, |
358 | PRESHIFT(0x00500000) /* 0.019531250 */, | 358 | PRESHIFT(0x00500000) /* 0.019531250 */, |
359 | -PRESHIFT(0x02011000) /* -0.125259399 */, | 359 | -PRESHIFT(0x02011000) /* -0.125259399 */, |
360 | -PRESHIFT(0x003e6000) /* -0.015228271 */, | 360 | -PRESHIFT(0x003e6000) /* -0.015228271 */, |
361 | -PRESHIFT(0x0d11e000) /* -0.816864014 */, | 361 | -PRESHIFT(0x0d11e000) /* -0.816864014 */, |
362 | PRESHIFT(0x116fc000) /* 1.089782715 */, | 362 | PRESHIFT(0x116fc000) /* 1.089782715 */, |
363 | PRESHIFT(0x052c5000) /* 0.323318481 */, | 363 | PRESHIFT(0x052c5000) /* 0.323318481 */, |
364 | PRESHIFT(0x02616000) /* 0.148773193 */, | 364 | PRESHIFT(0x02616000) /* 0.148773193 */, |
365 | PRESHIFT(0x007d6000) /* 0.030609131 */, | 365 | PRESHIFT(0x007d6000) /* 0.030609131 */, |
366 | PRESHIFT(0x007aa000) /* 0.029937744 */, | 366 | PRESHIFT(0x007aa000) /* 0.029937744 */, |
367 | PRESHIFT(0x00024000) /* 0.000549316 */, | 367 | PRESHIFT(0x00024000) /* 0.000549316 */, |
368 | PRESHIFT(0x0009a000) /* 0.002349854 */, | 368 | PRESHIFT(0x0009a000) /* 0.002349854 */, |
369 | PRESHIFT(0x0000b000) /* 0.000167847 */ }, | 369 | PRESHIFT(0x0000b000) /* 0.000167847 */ }, |
370 | 370 | ||
371 | { -PRESHIFT(0x00002000) /* -0.000030518 */,/* 10 */ | 371 | { -PRESHIFT(0x00002000) /* -0.000030518 */,/* 10 */ |
372 | -PRESHIFT(0x00044000) /* -0.001037598 */, | 372 | -PRESHIFT(0x00044000) /* -0.001037598 */, |
373 | PRESHIFT(0x000d7000) /* 0.003280640 */, | 373 | PRESHIFT(0x000d7000) /* 0.003280640 */, |
374 | -PRESHIFT(0x00471000) /* -0.017349243 */, | 374 | -PRESHIFT(0x00471000) /* -0.017349243 */, |
375 | PRESHIFT(0x0046b000) /* 0.017257690 */, | 375 | PRESHIFT(0x0046b000) /* 0.017257690 */, |
376 | -PRESHIFT(0x0212b000) /* -0.129562378 */, | 376 | -PRESHIFT(0x0212b000) /* -0.129562378 */, |
377 | -PRESHIFT(0x0084a000) /* -0.032379150 */, | 377 | -PRESHIFT(0x0084a000) /* -0.032379150 */, |
378 | -PRESHIFT(0x0d78a000) /* -0.841949463 */, | 378 | -PRESHIFT(0x0d78a000) /* -0.841949463 */, |
379 | PRESHIFT(0x113be000) /* 1.077117920 */, | 379 | PRESHIFT(0x113be000) /* 1.077117920 */, |
380 | PRESHIFT(0x04c16000) /* 0.297210693 */, | 380 | PRESHIFT(0x04c16000) /* 0.297210693 */, |
381 | PRESHIFT(0x02687000) /* 0.150497437 */, | 381 | PRESHIFT(0x02687000) /* 0.150497437 */, |
382 | PRESHIFT(0x0069c000) /* 0.025817871 */, | 382 | PRESHIFT(0x0069c000) /* 0.025817871 */, |
383 | PRESHIFT(0x0077f000) /* 0.029281616 */, | 383 | PRESHIFT(0x0077f000) /* 0.029281616 */, |
384 | PRESHIFT(0x00002000) /* 0.000030518 */, | 384 | PRESHIFT(0x00002000) /* 0.000030518 */, |
385 | PRESHIFT(0x00093000) /* 0.002243042 */, | 385 | PRESHIFT(0x00093000) /* 0.002243042 */, |
386 | PRESHIFT(0x0000a000) /* 0.000152588 */, | 386 | PRESHIFT(0x0000a000) /* 0.000152588 */, |
387 | 387 | ||
388 | -PRESHIFT(0x00002000) /* -0.000030518 */, | 388 | -PRESHIFT(0x00002000) /* -0.000030518 */, |
389 | -PRESHIFT(0x00044000) /* -0.001037598 */, | 389 | -PRESHIFT(0x00044000) /* -0.001037598 */, |
390 | PRESHIFT(0x000d7000) /* 0.003280640 */, | 390 | PRESHIFT(0x000d7000) /* 0.003280640 */, |
391 | -PRESHIFT(0x00471000) /* -0.017349243 */, | 391 | -PRESHIFT(0x00471000) /* -0.017349243 */, |
392 | PRESHIFT(0x0046b000) /* 0.017257690 */, | 392 | PRESHIFT(0x0046b000) /* 0.017257690 */, |
393 | -PRESHIFT(0x0212b000) /* -0.129562378 */, | 393 | -PRESHIFT(0x0212b000) /* -0.129562378 */, |
394 | -PRESHIFT(0x0084a000) /* -0.032379150 */, | 394 | -PRESHIFT(0x0084a000) /* -0.032379150 */, |
395 | -PRESHIFT(0x0d78a000) /* -0.841949463 */, | 395 | -PRESHIFT(0x0d78a000) /* -0.841949463 */, |
396 | PRESHIFT(0x113be000) /* 1.077117920 */, | 396 | PRESHIFT(0x113be000) /* 1.077117920 */, |
397 | PRESHIFT(0x04c16000) /* 0.297210693 */, | 397 | PRESHIFT(0x04c16000) /* 0.297210693 */, |
398 | PRESHIFT(0x02687000) /* 0.150497437 */, | 398 | PRESHIFT(0x02687000) /* 0.150497437 */, |
399 | PRESHIFT(0x0069c000) /* 0.025817871 */, | 399 | PRESHIFT(0x0069c000) /* 0.025817871 */, |
400 | PRESHIFT(0x0077f000) /* 0.029281616 */, | 400 | PRESHIFT(0x0077f000) /* 0.029281616 */, |
401 | PRESHIFT(0x00002000) /* 0.000030518 */, | 401 | PRESHIFT(0x00002000) /* 0.000030518 */, |
402 | PRESHIFT(0x00093000) /* 0.002243042 */, | 402 | PRESHIFT(0x00093000) /* 0.002243042 */, |
403 | PRESHIFT(0x0000a000) /* 0.000152588 */ }, | 403 | PRESHIFT(0x0000a000) /* 0.000152588 */ }, |
404 | 404 | ||
405 | { -PRESHIFT(0x00003000) /* -0.000045776 */,/* 11 */ | 405 | { -PRESHIFT(0x00003000) /* -0.000045776 */,/* 11 */ |
406 | -PRESHIFT(0x00049000) /* -0.001113892 */, | 406 | -PRESHIFT(0x00049000) /* -0.001113892 */, |
407 | PRESHIFT(0x000d0000) /* 0.003173828 */, | 407 | PRESHIFT(0x000d0000) /* 0.003173828 */, |
408 | -PRESHIFT(0x004ba000) /* -0.018463135 */, | 408 | -PRESHIFT(0x004ba000) /* -0.018463135 */, |
409 | PRESHIFT(0x003ca000) /* 0.014801025 */, | 409 | PRESHIFT(0x003ca000) /* 0.014801025 */, |
410 | -PRESHIFT(0x02233000) /* -0.133590698 */, | 410 | -PRESHIFT(0x02233000) /* -0.133590698 */, |
411 | -PRESHIFT(0x00ce4000) /* -0.050354004 */, | 411 | -PRESHIFT(0x00ce4000) /* -0.050354004 */, |
412 | -PRESHIFT(0x0ddca000) /* -0.866363525 */, | 412 | -PRESHIFT(0x0ddca000) /* -0.866363525 */, |
413 | PRESHIFT(0x1102f000) /* 1.063217163 */, | 413 | PRESHIFT(0x1102f000) /* 1.063217163 */, |
414 | PRESHIFT(0x04587000) /* 0.271591187 */, | 414 | PRESHIFT(0x04587000) /* 0.271591187 */, |
415 | PRESHIFT(0x026cf000) /* 0.151596069 */, | 415 | PRESHIFT(0x026cf000) /* 0.151596069 */, |
416 | PRESHIFT(0x0056c000) /* 0.021179199 */, | 416 | PRESHIFT(0x0056c000) /* 0.021179199 */, |
417 | PRESHIFT(0x0074e000) /* 0.028533936 */, | 417 | PRESHIFT(0x0074e000) /* 0.028533936 */, |
418 | -PRESHIFT(0x0001d000) /* -0.000442505 */, | 418 | -PRESHIFT(0x0001d000) /* -0.000442505 */, |
419 | PRESHIFT(0x0008b000) /* 0.002120972 */, | 419 | PRESHIFT(0x0008b000) /* 0.002120972 */, |
420 | PRESHIFT(0x00009000) /* 0.000137329 */, | 420 | PRESHIFT(0x00009000) /* 0.000137329 */, |
421 | 421 | ||
422 | -PRESHIFT(0x00003000) /* -0.000045776 */, | 422 | -PRESHIFT(0x00003000) /* -0.000045776 */, |
423 | -PRESHIFT(0x00049000) /* -0.001113892 */, | 423 | -PRESHIFT(0x00049000) /* -0.001113892 */, |
424 | PRESHIFT(0x000d0000) /* 0.003173828 */, | 424 | PRESHIFT(0x000d0000) /* 0.003173828 */, |
425 | -PRESHIFT(0x004ba000) /* -0.018463135 */, | 425 | -PRESHIFT(0x004ba000) /* -0.018463135 */, |
426 | PRESHIFT(0x003ca000) /* 0.014801025 */, | 426 | PRESHIFT(0x003ca000) /* 0.014801025 */, |
427 | -PRESHIFT(0x02233000) /* -0.133590698 */, | 427 | -PRESHIFT(0x02233000) /* -0.133590698 */, |
428 | -PRESHIFT(0x00ce4000) /* -0.050354004 */, | 428 | -PRESHIFT(0x00ce4000) /* -0.050354004 */, |
429 | -PRESHIFT(0x0ddca000) /* -0.866363525 */, | 429 | -PRESHIFT(0x0ddca000) /* -0.866363525 */, |
430 | PRESHIFT(0x1102f000) /* 1.063217163 */, | 430 | PRESHIFT(0x1102f000) /* 1.063217163 */, |
431 | PRESHIFT(0x04587000) /* 0.271591187 */, | 431 | PRESHIFT(0x04587000) /* 0.271591187 */, |
432 | PRESHIFT(0x026cf000) /* 0.151596069 */, | 432 | PRESHIFT(0x026cf000) /* 0.151596069 */, |
433 | PRESHIFT(0x0056c000) /* 0.021179199 */, | 433 | PRESHIFT(0x0056c000) /* 0.021179199 */, |
434 | PRESHIFT(0x0074e000) /* 0.028533936 */, | 434 | PRESHIFT(0x0074e000) /* 0.028533936 */, |
435 | -PRESHIFT(0x0001d000) /* -0.000442505 */, | 435 | -PRESHIFT(0x0001d000) /* -0.000442505 */, |
436 | PRESHIFT(0x0008b000) /* 0.002120972 */, | 436 | PRESHIFT(0x0008b000) /* 0.002120972 */, |
437 | PRESHIFT(0x00009000) /* 0.000137329 */ }, | 437 | PRESHIFT(0x00009000) /* 0.000137329 */ }, |
438 | 438 | ||
439 | { -PRESHIFT(0x00003000) /* -0.000045776 */,/* 12 */ | 439 | { -PRESHIFT(0x00003000) /* -0.000045776 */,/* 12 */ |
440 | -PRESHIFT(0x0004f000) /* -0.001205444 */, | 440 | -PRESHIFT(0x0004f000) /* -0.001205444 */, |
441 | PRESHIFT(0x000c8000) /* 0.003051758 */, | 441 | PRESHIFT(0x000c8000) /* 0.003051758 */, |
442 | -PRESHIFT(0x00503000) /* -0.019577026 */, | 442 | -PRESHIFT(0x00503000) /* -0.019577026 */, |
443 | PRESHIFT(0x0031a000) /* 0.012115479 */, | 443 | PRESHIFT(0x0031a000) /* 0.012115479 */, |
444 | -PRESHIFT(0x02326000) /* -0.137298584 */, | 444 | -PRESHIFT(0x02326000) /* -0.137298584 */, |
445 | -PRESHIFT(0x011b5000) /* -0.069168091 */, | 445 | -PRESHIFT(0x011b5000) /* -0.069168091 */, |
446 | -PRESHIFT(0x0e3dd000) /* -0.890090942 */, | 446 | -PRESHIFT(0x0e3dd000) /* -0.890090942 */, |
447 | PRESHIFT(0x10c54000) /* 1.048156738 */, | 447 | PRESHIFT(0x10c54000) /* 1.048156738 */, |
448 | PRESHIFT(0x03f1b000) /* 0.246505737 */, | 448 | PRESHIFT(0x03f1b000) /* 0.246505737 */, |
449 | PRESHIFT(0x026ee000) /* 0.152069092 */, | 449 | PRESHIFT(0x026ee000) /* 0.152069092 */, |
450 | PRESHIFT(0x00447000) /* 0.016708374 */, | 450 | PRESHIFT(0x00447000) /* 0.016708374 */, |
451 | PRESHIFT(0x00719000) /* 0.027725220 */, | 451 | PRESHIFT(0x00719000) /* 0.027725220 */, |
452 | -PRESHIFT(0x00039000) /* -0.000869751 */, | 452 | -PRESHIFT(0x00039000) /* -0.000869751 */, |
453 | PRESHIFT(0x00084000) /* 0.002014160 */, | 453 | PRESHIFT(0x00084000) /* 0.002014160 */, |
454 | PRESHIFT(0x00008000) /* 0.000122070 */, | 454 | PRESHIFT(0x00008000) /* 0.000122070 */, |
455 | 455 | ||
456 | -PRESHIFT(0x00003000) /* -0.000045776 */, | 456 | -PRESHIFT(0x00003000) /* -0.000045776 */, |
457 | -PRESHIFT(0x0004f000) /* -0.001205444 */, | 457 | -PRESHIFT(0x0004f000) /* -0.001205444 */, |
458 | PRESHIFT(0x000c8000) /* 0.003051758 */, | 458 | PRESHIFT(0x000c8000) /* 0.003051758 */, |
459 | -PRESHIFT(0x00503000) /* -0.019577026 */, | 459 | -PRESHIFT(0x00503000) /* -0.019577026 */, |
460 | PRESHIFT(0x0031a000) /* 0.012115479 */, | 460 | PRESHIFT(0x0031a000) /* 0.012115479 */, |
461 | -PRESHIFT(0x02326000) /* -0.137298584 */, | 461 | -PRESHIFT(0x02326000) /* -0.137298584 */, |
462 | -PRESHIFT(0x011b5000) /* -0.069168091 */, | 462 | -PRESHIFT(0x011b5000) /* -0.069168091 */, |
463 | -PRESHIFT(0x0e3dd000) /* -0.890090942 */, | 463 | -PRESHIFT(0x0e3dd000) /* -0.890090942 */, |
464 | PRESHIFT(0x10c54000) /* 1.048156738 */, | 464 | PRESHIFT(0x10c54000) /* 1.048156738 */, |
465 | PRESHIFT(0x03f1b000) /* 0.246505737 */, | 465 | PRESHIFT(0x03f1b000) /* 0.246505737 */, |
466 | PRESHIFT(0x026ee000) /* 0.152069092 */, | 466 | PRESHIFT(0x026ee000) /* 0.152069092 */, |
467 | PRESHIFT(0x00447000) /* 0.016708374 */, | 467 | PRESHIFT(0x00447000) /* 0.016708374 */, |
468 | PRESHIFT(0x00719000) /* 0.027725220 */, | 468 | PRESHIFT(0x00719000) /* 0.027725220 */, |
469 | -PRESHIFT(0x00039000) /* -0.000869751 */, | 469 | -PRESHIFT(0x00039000) /* -0.000869751 */, |
470 | PRESHIFT(0x00084000) /* 0.002014160 */, | 470 | PRESHIFT(0x00084000) /* 0.002014160 */, |
471 | PRESHIFT(0x00008000) /* 0.000122070 */ }, | 471 | PRESHIFT(0x00008000) /* 0.000122070 */ }, |
472 | 472 | ||
473 | { -PRESHIFT(0x00004000) /* -0.000061035 */,/* 13 */ | 473 | { -PRESHIFT(0x00004000) /* -0.000061035 */,/* 13 */ |
474 | -PRESHIFT(0x00055000) /* -0.001296997 */, | 474 | -PRESHIFT(0x00055000) /* -0.001296997 */, |
475 | PRESHIFT(0x000bd000) /* 0.002883911 */, | 475 | PRESHIFT(0x000bd000) /* 0.002883911 */, |
476 | -PRESHIFT(0x0054c000) /* -0.020690918 */, | 476 | -PRESHIFT(0x0054c000) /* -0.020690918 */, |
477 | PRESHIFT(0x0025d000) /* 0.009231567 */, | 477 | PRESHIFT(0x0025d000) /* 0.009231567 */, |
478 | -PRESHIFT(0x02403000) /* -0.140670776 */, | 478 | -PRESHIFT(0x02403000) /* -0.140670776 */, |
479 | -PRESHIFT(0x016ba000) /* -0.088775635 */, | 479 | -PRESHIFT(0x016ba000) /* -0.088775635 */, |
480 | -PRESHIFT(0x0e9be000) /* -0.913055420 */, | 480 | -PRESHIFT(0x0e9be000) /* -0.913055420 */, |
481 | PRESHIFT(0x1082d000) /* 1.031936646 */, | 481 | PRESHIFT(0x1082d000) /* 1.031936646 */, |
482 | PRESHIFT(0x038d4000) /* 0.221984863 */, | 482 | PRESHIFT(0x038d4000) /* 0.221984863 */, |
483 | PRESHIFT(0x026e7000) /* 0.151962280 */, | 483 | PRESHIFT(0x026e7000) /* 0.151962280 */, |
484 | PRESHIFT(0x0032e000) /* 0.012420654 */, | 484 | PRESHIFT(0x0032e000) /* 0.012420654 */, |
485 | PRESHIFT(0x006df000) /* 0.026840210 */, | 485 | PRESHIFT(0x006df000) /* 0.026840210 */, |
486 | -PRESHIFT(0x00053000) /* -0.001266479 */, | 486 | -PRESHIFT(0x00053000) /* -0.001266479 */, |
487 | PRESHIFT(0x0007d000) /* 0.001907349 */, | 487 | PRESHIFT(0x0007d000) /* 0.001907349 */, |
488 | PRESHIFT(0x00007000) /* 0.000106812 */, | 488 | PRESHIFT(0x00007000) /* 0.000106812 */, |
489 | 489 | ||
490 | -PRESHIFT(0x00004000) /* -0.000061035 */, | 490 | -PRESHIFT(0x00004000) /* -0.000061035 */, |
491 | -PRESHIFT(0x00055000) /* -0.001296997 */, | 491 | -PRESHIFT(0x00055000) /* -0.001296997 */, |
492 | PRESHIFT(0x000bd000) /* 0.002883911 */, | 492 | PRESHIFT(0x000bd000) /* 0.002883911 */, |
493 | -PRESHIFT(0x0054c000) /* -0.020690918 */, | 493 | -PRESHIFT(0x0054c000) /* -0.020690918 */, |
494 | PRESHIFT(0x0025d000) /* 0.009231567 */, | 494 | PRESHIFT(0x0025d000) /* 0.009231567 */, |
495 | -PRESHIFT(0x02403000) /* -0.140670776 */, | 495 | -PRESHIFT(0x02403000) /* -0.140670776 */, |
496 | -PRESHIFT(0x016ba000) /* -0.088775635 */, | 496 | -PRESHIFT(0x016ba000) /* -0.088775635 */, |
497 | -PRESHIFT(0x0e9be000) /* -0.913055420 */, | 497 | -PRESHIFT(0x0e9be000) /* -0.913055420 */, |
498 | PRESHIFT(0x1082d000) /* 1.031936646 */, | 498 | PRESHIFT(0x1082d000) /* 1.031936646 */, |
499 | PRESHIFT(0x038d4000) /* 0.221984863 */, | 499 | PRESHIFT(0x038d4000) /* 0.221984863 */, |
500 | PRESHIFT(0x026e7000) /* 0.151962280 */, | 500 | PRESHIFT(0x026e7000) /* 0.151962280 */, |
501 | PRESHIFT(0x0032e000) /* 0.012420654 */, | 501 | PRESHIFT(0x0032e000) /* 0.012420654 */, |
502 | PRESHIFT(0x006df000) /* 0.026840210 */, | 502 | PRESHIFT(0x006df000) /* 0.026840210 */, |
503 | -PRESHIFT(0x00053000) /* -0.001266479 */, | 503 | -PRESHIFT(0x00053000) /* -0.001266479 */, |
504 | PRESHIFT(0x0007d000) /* 0.001907349 */, | 504 | PRESHIFT(0x0007d000) /* 0.001907349 */, |
505 | PRESHIFT(0x00007000) /* 0.000106812 */ }, | 505 | PRESHIFT(0x00007000) /* 0.000106812 */ }, |
506 | 506 | ||
507 | { -PRESHIFT(0x00004000) /* -0.000061035 */,/* 14 */ | 507 | { -PRESHIFT(0x00004000) /* -0.000061035 */,/* 14 */ |
508 | -PRESHIFT(0x0005b000) /* -0.001388550 */, | 508 | -PRESHIFT(0x0005b000) /* -0.001388550 */, |
509 | PRESHIFT(0x000b1000) /* 0.002700806 */, | 509 | PRESHIFT(0x000b1000) /* 0.002700806 */, |
510 | -PRESHIFT(0x00594000) /* -0.021789551 */, | 510 | -PRESHIFT(0x00594000) /* -0.021789551 */, |
511 | PRESHIFT(0x00192000) /* 0.006134033 */, | 511 | PRESHIFT(0x00192000) /* 0.006134033 */, |
512 | -PRESHIFT(0x024c8000) /* -0.143676758 */, | 512 | -PRESHIFT(0x024c8000) /* -0.143676758 */, |
513 | -PRESHIFT(0x01bf2000) /* -0.109161377 */, | 513 | -PRESHIFT(0x01bf2000) /* -0.109161377 */, |
514 | -PRESHIFT(0x0ef69000) /* -0.935195923 */, | 514 | -PRESHIFT(0x0ef69000) /* -0.935195923 */, |
515 | PRESHIFT(0x103be000) /* 1.014617920 */, | 515 | PRESHIFT(0x103be000) /* 1.014617920 */, |
516 | PRESHIFT(0x032b4000) /* 0.198059082 */, | 516 | PRESHIFT(0x032b4000) /* 0.198059082 */, |
517 | PRESHIFT(0x026bc000) /* 0.151306152 */, | 517 | PRESHIFT(0x026bc000) /* 0.151306152 */, |
518 | PRESHIFT(0x00221000) /* 0.008316040 */, | 518 | PRESHIFT(0x00221000) /* 0.008316040 */, |
519 | PRESHIFT(0x006a2000) /* 0.025909424 */, | 519 | PRESHIFT(0x006a2000) /* 0.025909424 */, |
520 | -PRESHIFT(0x0006a000) /* -0.001617432 */, | 520 | -PRESHIFT(0x0006a000) /* -0.001617432 */, |
521 | PRESHIFT(0x00075000) /* 0.001785278 */, | 521 | PRESHIFT(0x00075000) /* 0.001785278 */, |
522 | PRESHIFT(0x00007000) /* 0.000106812 */, | 522 | PRESHIFT(0x00007000) /* 0.000106812 */, |
523 | 523 | ||
524 | -PRESHIFT(0x00004000) /* -0.000061035 */, | 524 | -PRESHIFT(0x00004000) /* -0.000061035 */, |
525 | -PRESHIFT(0x0005b000) /* -0.001388550 */, | 525 | -PRESHIFT(0x0005b000) /* -0.001388550 */, |
526 | PRESHIFT(0x000b1000) /* 0.002700806 */, | 526 | PRESHIFT(0x000b1000) /* 0.002700806 */, |
527 | -PRESHIFT(0x00594000) /* -0.021789551 */, | 527 | -PRESHIFT(0x00594000) /* -0.021789551 */, |
528 | PRESHIFT(0x00192000) /* 0.006134033 */, | 528 | PRESHIFT(0x00192000) /* 0.006134033 */, |
529 | -PRESHIFT(0x024c8000) /* -0.143676758 */, | 529 | -PRESHIFT(0x024c8000) /* -0.143676758 */, |
530 | -PRESHIFT(0x01bf2000) /* -0.109161377 */, | 530 | -PRESHIFT(0x01bf2000) /* -0.109161377 */, |
531 | -PRESHIFT(0x0ef69000) /* -0.935195923 */, | 531 | -PRESHIFT(0x0ef69000) /* -0.935195923 */, |
532 | PRESHIFT(0x103be000) /* 1.014617920 */, | 532 | PRESHIFT(0x103be000) /* 1.014617920 */, |
533 | PRESHIFT(0x032b4000) /* 0.198059082 */, | 533 | PRESHIFT(0x032b4000) /* 0.198059082 */, |
534 | PRESHIFT(0x026bc000) /* 0.151306152 */, | 534 | PRESHIFT(0x026bc000) /* 0.151306152 */, |
535 | PRESHIFT(0x00221000) /* 0.008316040 */, | 535 | PRESHIFT(0x00221000) /* 0.008316040 */, |
536 | PRESHIFT(0x006a2000) /* 0.025909424 */, | 536 | PRESHIFT(0x006a2000) /* 0.025909424 */, |
537 | -PRESHIFT(0x0006a000) /* -0.001617432 */, | 537 | -PRESHIFT(0x0006a000) /* -0.001617432 */, |
538 | PRESHIFT(0x00075000) /* 0.001785278 */, | 538 | PRESHIFT(0x00075000) /* 0.001785278 */, |
539 | PRESHIFT(0x00007000) /* 0.000106812 */ }, | 539 | PRESHIFT(0x00007000) /* 0.000106812 */ }, |
540 | 540 | ||
541 | { -PRESHIFT(0x00005000) /* -0.000076294 */,/* 15 */ | 541 | { -PRESHIFT(0x00005000) /* -0.000076294 */,/* 15 */ |
542 | -PRESHIFT(0x00061000) /* -0.001480103 */, | 542 | -PRESHIFT(0x00061000) /* -0.001480103 */, |
543 | PRESHIFT(0x000a3000) /* 0.002487183 */, | 543 | PRESHIFT(0x000a3000) /* 0.002487183 */, |
544 | -PRESHIFT(0x005da000) /* -0.022857666 */, | 544 | -PRESHIFT(0x005da000) /* -0.022857666 */, |
545 | PRESHIFT(0x000b9000) /* 0.002822876 */, | 545 | PRESHIFT(0x000b9000) /* 0.002822876 */, |
546 | -PRESHIFT(0x02571000) /* -0.146255493 */, | 546 | -PRESHIFT(0x02571000) /* -0.146255493 */, |
547 | -PRESHIFT(0x0215c000) /* -0.130310059 */, | 547 | -PRESHIFT(0x0215c000) /* -0.130310059 */, |
548 | -PRESHIFT(0x0f4dc000) /* -0.956481934 */, | 548 | -PRESHIFT(0x0f4dc000) /* -0.956481934 */, |
549 | PRESHIFT(0x0ff0a000) /* 0.996246338 */, | 549 | PRESHIFT(0x0ff0a000) /* 0.996246338 */, |
550 | PRESHIFT(0x02cbf000) /* 0.174789429 */, | 550 | PRESHIFT(0x02cbf000) /* 0.174789429 */, |
551 | PRESHIFT(0x0266e000) /* 0.150115967 */, | 551 | PRESHIFT(0x0266e000) /* 0.150115967 */, |
552 | PRESHIFT(0x00120000) /* 0.004394531 */, | 552 | PRESHIFT(0x00120000) /* 0.004394531 */, |
553 | PRESHIFT(0x00662000) /* 0.024932861 */, | 553 | PRESHIFT(0x00662000) /* 0.024932861 */, |
554 | -PRESHIFT(0x0007f000) /* -0.001937866 */, | 554 | -PRESHIFT(0x0007f000) /* -0.001937866 */, |
555 | PRESHIFT(0x0006f000) /* 0.001693726 */, | 555 | PRESHIFT(0x0006f000) /* 0.001693726 */, |
556 | PRESHIFT(0x00006000) /* 0.000091553 */, | 556 | PRESHIFT(0x00006000) /* 0.000091553 */, |
557 | 557 | ||
558 | -PRESHIFT(0x00005000) /* -0.000076294 */, | 558 | -PRESHIFT(0x00005000) /* -0.000076294 */, |
559 | -PRESHIFT(0x00061000) /* -0.001480103 */, | 559 | -PRESHIFT(0x00061000) /* -0.001480103 */, |
560 | PRESHIFT(0x000a3000) /* 0.002487183 */, | 560 | PRESHIFT(0x000a3000) /* 0.002487183 */, |
561 | -PRESHIFT(0x005da000) /* -0.022857666 */, | 561 | -PRESHIFT(0x005da000) /* -0.022857666 */, |
562 | PRESHIFT(0x000b9000) /* 0.002822876 */, | 562 | PRESHIFT(0x000b9000) /* 0.002822876 */, |
563 | -PRESHIFT(0x02571000) /* -0.146255493 */, | 563 | -PRESHIFT(0x02571000) /* -0.146255493 */, |
564 | -PRESHIFT(0x0215c000) /* -0.130310059 */, | 564 | -PRESHIFT(0x0215c000) /* -0.130310059 */, |
565 | -PRESHIFT(0x0f4dc000) /* -0.956481934 */, | 565 | -PRESHIFT(0x0f4dc000) /* -0.956481934 */, |
566 | PRESHIFT(0x0ff0a000) /* 0.996246338 */, | 566 | PRESHIFT(0x0ff0a000) /* 0.996246338 */, |
567 | PRESHIFT(0x02cbf000) /* 0.174789429 */, | 567 | PRESHIFT(0x02cbf000) /* 0.174789429 */, |
568 | PRESHIFT(0x0266e000) /* 0.150115967 */, | 568 | PRESHIFT(0x0266e000) /* 0.150115967 */, |
569 | PRESHIFT(0x00120000) /* 0.004394531 */, | 569 | PRESHIFT(0x00120000) /* 0.004394531 */, |
570 | PRESHIFT(0x00662000) /* 0.024932861 */, | 570 | PRESHIFT(0x00662000) /* 0.024932861 */, |
571 | -PRESHIFT(0x0007f000) /* -0.001937866 */, | 571 | -PRESHIFT(0x0007f000) /* -0.001937866 */, |
572 | PRESHIFT(0x0006f000) /* 0.001693726 */, | 572 | PRESHIFT(0x0006f000) /* 0.001693726 */, |
573 | PRESHIFT(0x00006000) /* 0.000091553 */ }, | 573 | PRESHIFT(0x00006000) /* 0.000091553 */ }, |
574 | 574 | ||
575 | { -PRESHIFT(0x00005000) /* -0.000076294 */,/* 16 */ | 575 | { -PRESHIFT(0x00005000) /* -0.000076294 */,/* 16 */ |
576 | -PRESHIFT(0x00068000) /* -0.001586914 */, | 576 | -PRESHIFT(0x00068000) /* -0.001586914 */, |
577 | PRESHIFT(0x00092000) /* 0.002227783 */, | 577 | PRESHIFT(0x00092000) /* 0.002227783 */, |
578 | -PRESHIFT(0x0061f000) /* -0.023910522 */, | 578 | -PRESHIFT(0x0061f000) /* -0.023910522 */, |
579 | -PRESHIFT(0x0002d000) /* -0.000686646 */, | 579 | -PRESHIFT(0x0002d000) /* -0.000686646 */, |
580 | -PRESHIFT(0x025ff000) /* -0.148422241 */, | 580 | -PRESHIFT(0x025ff000) /* -0.148422241 */, |
581 | -PRESHIFT(0x026f7000) /* -0.152206421 */, | 581 | -PRESHIFT(0x026f7000) /* -0.152206421 */, |
582 | -PRESHIFT(0x0fa13000) /* -0.976852417 */, | 582 | -PRESHIFT(0x0fa13000) /* -0.976852417 */, |
583 | PRESHIFT(0x0fa13000) /* 0.976852417 */, | 583 | PRESHIFT(0x0fa13000) /* 0.976852417 */, |
584 | PRESHIFT(0x026f7000) /* 0.152206421 */, | 584 | PRESHIFT(0x026f7000) /* 0.152206421 */, |
585 | PRESHIFT(0x025ff000) /* 0.148422241 */, | 585 | PRESHIFT(0x025ff000) /* 0.148422241 */, |
586 | PRESHIFT(0x0002d000) /* 0.000686646 */, | 586 | PRESHIFT(0x0002d000) /* 0.000686646 */, |
587 | PRESHIFT(0x0061f000) /* 0.023910522 */, | 587 | PRESHIFT(0x0061f000) /* 0.023910522 */, |
588 | -PRESHIFT(0x00092000) /* -0.002227783 */, | 588 | -PRESHIFT(0x00092000) /* -0.002227783 */, |
589 | PRESHIFT(0x00068000) /* 0.001586914 */, | 589 | PRESHIFT(0x00068000) /* 0.001586914 */, |
590 | PRESHIFT(0x00005000) /* 0.000076294 */, | 590 | PRESHIFT(0x00005000) /* 0.000076294 */, |
591 | 591 | ||
592 | -PRESHIFT(0x00005000) /* -0.000076294 */, | 592 | -PRESHIFT(0x00005000) /* -0.000076294 */, |
593 | -PRESHIFT(0x00068000) /* -0.001586914 */, | 593 | -PRESHIFT(0x00068000) /* -0.001586914 */, |
594 | PRESHIFT(0x00092000) /* 0.002227783 */, | 594 | PRESHIFT(0x00092000) /* 0.002227783 */, |
595 | -PRESHIFT(0x0061f000) /* -0.023910522 */, | 595 | -PRESHIFT(0x0061f000) /* -0.023910522 */, |
596 | -PRESHIFT(0x0002d000) /* -0.000686646 */, | 596 | -PRESHIFT(0x0002d000) /* -0.000686646 */, |
597 | -PRESHIFT(0x025ff000) /* -0.148422241 */, | 597 | -PRESHIFT(0x025ff000) /* -0.148422241 */, |
598 | -PRESHIFT(0x026f7000) /* -0.152206421 */, | 598 | -PRESHIFT(0x026f7000) /* -0.152206421 */, |
599 | -PRESHIFT(0x0fa13000) /* -0.976852417 */, | 599 | -PRESHIFT(0x0fa13000) /* -0.976852417 */, |
600 | PRESHIFT(0x0fa13000) /* 0.976852417 */, | 600 | PRESHIFT(0x0fa13000) /* 0.976852417 */, |
601 | PRESHIFT(0x026f7000) /* 0.152206421 */, | 601 | PRESHIFT(0x026f7000) /* 0.152206421 */, |
602 | PRESHIFT(0x025ff000) /* 0.148422241 */, | 602 | PRESHIFT(0x025ff000) /* 0.148422241 */, |
603 | PRESHIFT(0x0002d000) /* 0.000686646 */, | 603 | PRESHIFT(0x0002d000) /* 0.000686646 */, |
604 | PRESHIFT(0x0061f000) /* 0.023910522 */, | 604 | PRESHIFT(0x0061f000) /* 0.023910522 */, |
605 | -PRESHIFT(0x00092000) /* -0.002227783 */, | 605 | -PRESHIFT(0x00092000) /* -0.002227783 */, |
606 | PRESHIFT(0x00068000) /* 0.001586914 */, | 606 | PRESHIFT(0x00068000) /* 0.001586914 */, |
607 | PRESHIFT(0x00005000) /* 0.000076294 */ } | 607 | PRESHIFT(0x00005000) /* 0.000076294 */ } |
diff --git a/core/multimedia/opieplayer/libmad/bit.c b/core/multimedia/opieplayer/libmad/bit.c index 4a4661b..568d204 100644 --- a/core/multimedia/opieplayer/libmad/bit.c +++ b/core/multimedia/opieplayer/libmad/bit.c | |||
@@ -1,237 +1,237 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifdef HAVE_CONFIG_H | 22 | # ifdef HAVE_CONFIG_H |
23 | # include "libmad_config.h" | 23 | # include "libmad_config.h" |
24 | # endif | 24 | # endif |
25 | 25 | ||
26 | # include "libmad_global.h" | 26 | # include "libmad_global.h" |
27 | 27 | ||
28 | # ifdef HAVE_LIMITS_H | 28 | # ifdef HAVE_LIMITS_H |
29 | # include <limits.h> | 29 | # include <limits.h> |
30 | # else | 30 | # else |
31 | # define CHAR_BIT 8 | 31 | # define CHAR_BIT 8 |
32 | # endif | 32 | # endif |
33 | 33 | ||
34 | # include "bit.h" | 34 | # include "bit.h" |
35 | 35 | ||
36 | /* | 36 | /* |
37 | * This is the lookup table for computing the CRC-check word. | 37 | * This is the lookup table for computing the CRC-check word. |
38 | * As described in section 2.4.3.1 and depicted in Figure A.9 | 38 | * As described in section 2.4.3.1 and depicted in Figure A.9 |
39 | * of ISO/IEC 11172-3, the generator polynomial is: | 39 | * of ISO/IEC 11172-3, the generator polynomial is: |
40 | * | 40 | * |
41 | * G(X) = X^16 + X^15 + X^2 + 1 | 41 | * G(X) = X^16 + X^15 + X^2 + 1 |
42 | */ | 42 | */ |
43 | static | 43 | static |
44 | unsigned short const crc_table[256] = { | 44 | unsigned short const crc_table[256] = { |
45 | 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011, | 45 | 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011, |
46 | 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022, | 46 | 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022, |
47 | 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072, | 47 | 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072, |
48 | 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041, | 48 | 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041, |
49 | 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2, | 49 | 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2, |
50 | 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1, | 50 | 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1, |
51 | 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1, | 51 | 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1, |
52 | 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082, | 52 | 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082, |
53 | 53 | ||
54 | 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192, | 54 | 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192, |
55 | 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1, | 55 | 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1, |
56 | 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1, | 56 | 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1, |
57 | 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2, | 57 | 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2, |
58 | 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151, | 58 | 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151, |
59 | 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162, | 59 | 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162, |
60 | 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132, | 60 | 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132, |
61 | 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101, | 61 | 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101, |
62 | 62 | ||
63 | 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312, | 63 | 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312, |
64 | 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321, | 64 | 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321, |
65 | 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371, | 65 | 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371, |
66 | 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342, | 66 | 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342, |
67 | 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1, | 67 | 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1, |
68 | 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2, | 68 | 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2, |
69 | 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2, | 69 | 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2, |
70 | 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381, | 70 | 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381, |
71 | 71 | ||
72 | 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291, | 72 | 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291, |
73 | 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2, | 73 | 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2, |
74 | 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2, | 74 | 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2, |
75 | 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1, | 75 | 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1, |
76 | 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252, | 76 | 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252, |
77 | 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261, | 77 | 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261, |
78 | 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231, | 78 | 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231, |
79 | 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202 | 79 | 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202 |
80 | }; | 80 | }; |
81 | 81 | ||
82 | # define CRC_POLY 0x8005 | 82 | # define CRC_POLY 0x8005 |
83 | 83 | ||
84 | /* | 84 | /* |
85 | * NAME:bit->init() | 85 | * NAME:bit->init() |
86 | * DESCRIPTION:initialize bit pointer struct | 86 | * DESCRIPTION:initialize bit pointer struct |
87 | */ | 87 | */ |
88 | void mad_bit_init(struct mad_bitptr *bitptr, unsigned char const *byte) | 88 | void mad_bit_init(struct mad_bitptr *bitptr, unsigned char const *byte) |
89 | { | 89 | { |
90 | bitptr->byte = byte; | 90 | bitptr->byte = byte; |
91 | bitptr->cache = 0; | 91 | bitptr->cache = 0; |
92 | bitptr->left = CHAR_BIT; | 92 | bitptr->left = CHAR_BIT; |
93 | } | 93 | } |
94 | 94 | ||
95 | /* | 95 | /* |
96 | * NAME:bit->length() | 96 | * NAME:bit->length() |
97 | * DESCRIPTION:return number of bits between start and end points | 97 | * DESCRIPTION:return number of bits between start and end points |
98 | */ | 98 | */ |
99 | unsigned int mad_bit_length(struct mad_bitptr const *begin, | 99 | unsigned int mad_bit_length(struct mad_bitptr const *begin, |
100 | struct mad_bitptr const *end) | 100 | struct mad_bitptr const *end) |
101 | { | 101 | { |
102 | return begin->left + | 102 | return begin->left + |
103 | CHAR_BIT * (end->byte - (begin->byte + 1)) + (CHAR_BIT - end->left); | 103 | CHAR_BIT * (end->byte - (begin->byte + 1)) + (CHAR_BIT - end->left); |
104 | } | 104 | } |
105 | 105 | ||
106 | /* | 106 | /* |
107 | * NAME:bit->nextbyte() | 107 | * NAME:bit->nextbyte() |
108 | * DESCRIPTION:return pointer to next unprocessed byte | 108 | * DESCRIPTION:return pointer to next unprocessed byte |
109 | */ | 109 | */ |
110 | unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *bitptr) | 110 | unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *bitptr) |
111 | { | 111 | { |
112 | return bitptr->left == CHAR_BIT ? bitptr->byte : bitptr->byte + 1; | 112 | return bitptr->left == CHAR_BIT ? bitptr->byte : bitptr->byte + 1; |
113 | } | 113 | } |
114 | 114 | ||
115 | /* | 115 | /* |
116 | * NAME:bit->skip() | 116 | * NAME:bit->skip() |
117 | * DESCRIPTION:advance bit pointer | 117 | * DESCRIPTION:advance bit pointer |
118 | */ | 118 | */ |
119 | void mad_bit_skip(struct mad_bitptr *bitptr, unsigned int len) | 119 | void mad_bit_skip(struct mad_bitptr *bitptr, unsigned int len) |
120 | { | 120 | { |
121 | bitptr->byte += len / CHAR_BIT; | 121 | bitptr->byte += len / CHAR_BIT; |
122 | bitptr->left -= len % CHAR_BIT; | 122 | bitptr->left -= len % CHAR_BIT; |
123 | 123 | ||
124 | if (bitptr->left > CHAR_BIT) { | 124 | if (bitptr->left > CHAR_BIT) { |
125 | bitptr->byte++; | 125 | bitptr->byte++; |
126 | bitptr->left += CHAR_BIT; | 126 | bitptr->left += CHAR_BIT; |
127 | } | 127 | } |
128 | 128 | ||
129 | if (bitptr->left < CHAR_BIT) | 129 | if (bitptr->left < CHAR_BIT) |
130 | bitptr->cache = *bitptr->byte; | 130 | bitptr->cache = *bitptr->byte; |
131 | } | 131 | } |
132 | 132 | ||
133 | /* | 133 | /* |
134 | * NAME:bit->read() | 134 | * NAME:bit->read() |
135 | * DESCRIPTION:read an arbitrary number of bits and return their UIMSBF value | 135 | * DESCRIPTION:read an arbitrary number of bits and return their UIMSBF value |
136 | */ | 136 | */ |
137 | unsigned long mad_bit_read(struct mad_bitptr *bitptr, unsigned int len) | 137 | unsigned long mad_bit_read(struct mad_bitptr *bitptr, unsigned int len) |
138 | { | 138 | { |
139 | register unsigned long value; | 139 | register unsigned long value; |
140 | 140 | ||
141 | if (bitptr->left == CHAR_BIT) | 141 | if (bitptr->left == CHAR_BIT) |
142 | bitptr->cache = *bitptr->byte; | 142 | bitptr->cache = *bitptr->byte; |
143 | 143 | ||
144 | if (len < bitptr->left) { | 144 | if (len < bitptr->left) { |
145 | value = (bitptr->cache & ((1 << bitptr->left) - 1)) >> | 145 | value = (bitptr->cache & ((1 << bitptr->left) - 1)) >> |
146 | (bitptr->left - len); | 146 | (bitptr->left - len); |
147 | bitptr->left -= len; | 147 | bitptr->left -= len; |
148 | 148 | ||
149 | return value; | 149 | return value; |
150 | } | 150 | } |
151 | 151 | ||
152 | /* remaining bits in current byte */ | 152 | /* remaining bits in current byte */ |
153 | 153 | ||
154 | value = bitptr->cache & ((1 << bitptr->left) - 1); | 154 | value = bitptr->cache & ((1 << bitptr->left) - 1); |
155 | len -= bitptr->left; | 155 | len -= bitptr->left; |
156 | 156 | ||
157 | bitptr->byte++; | 157 | bitptr->byte++; |
158 | bitptr->left = CHAR_BIT; | 158 | bitptr->left = CHAR_BIT; |
159 | 159 | ||
160 | /* more bytes */ | 160 | /* more bytes */ |
161 | 161 | ||
162 | while (len >= CHAR_BIT) { | 162 | while (len >= CHAR_BIT) { |
163 | value = (value << CHAR_BIT) | *bitptr->byte++; | 163 | value = (value << CHAR_BIT) | *bitptr->byte++; |
164 | len -= CHAR_BIT; | 164 | len -= CHAR_BIT; |
165 | } | 165 | } |
166 | 166 | ||
167 | if (len > 0) { | 167 | if (len > 0) { |
168 | bitptr->cache = *bitptr->byte; | 168 | bitptr->cache = *bitptr->byte; |
169 | 169 | ||
170 | value = (value << len) | (bitptr->cache >> (CHAR_BIT - len)); | 170 | value = (value << len) | (bitptr->cache >> (CHAR_BIT - len)); |
171 | bitptr->left -= len; | 171 | bitptr->left -= len; |
172 | } | 172 | } |
173 | 173 | ||
174 | return value; | 174 | return value; |
175 | } | 175 | } |
176 | 176 | ||
177 | # if 0 | 177 | # if 0 |
178 | /* | 178 | /* |
179 | * NAME:bit->write() | 179 | * NAME:bit->write() |
180 | * DESCRIPTION:write an arbitrary number of bits | 180 | * DESCRIPTION:write an arbitrary number of bits |
181 | */ | 181 | */ |
182 | void mad_bit_write(struct mad_bitptr *bitptr, unsigned int len, | 182 | void mad_bit_write(struct mad_bitptr *bitptr, unsigned int len, |
183 | unsigned long value) | 183 | unsigned long value) |
184 | { | 184 | { |
185 | unsigned char *ptr; | 185 | unsigned char *ptr; |
186 | 186 | ||
187 | ptr = (unsigned char *) bitptr->byte; | 187 | ptr = (unsigned char *) bitptr->byte; |
188 | 188 | ||
189 | /* ... */ | 189 | /* ... */ |
190 | } | 190 | } |
191 | # endif | 191 | # endif |
192 | 192 | ||
193 | /* | 193 | /* |
194 | * NAME:bit->crc() | 194 | * NAME:bit->crc() |
195 | * DESCRIPTION:compute CRC-check word | 195 | * DESCRIPTION:compute CRC-check word |
196 | */ | 196 | */ |
197 | unsigned short mad_bit_crc(struct mad_bitptr bitptr, unsigned int len, | 197 | unsigned short mad_bit_crc(struct mad_bitptr bitptr, unsigned int len, |
198 | unsigned short init) | 198 | unsigned short init) |
199 | { | 199 | { |
200 | register unsigned int crc; | 200 | register unsigned int crc; |
201 | 201 | ||
202 | for (crc = init; len >= 32; len -= 32) { | 202 | for (crc = init; len >= 32; len -= 32) { |
203 | register unsigned long data; | 203 | register unsigned long data; |
204 | 204 | ||
205 | data = mad_bit_read(&bitptr, 32); | 205 | data = mad_bit_read(&bitptr, 32); |
206 | 206 | ||
207 | crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 24)) & 0xff]; | 207 | crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 24)) & 0xff]; |
208 | crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 16)) & 0xff]; | 208 | crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 16)) & 0xff]; |
209 | crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 8)) & 0xff]; | 209 | crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 8)) & 0xff]; |
210 | crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 0)) & 0xff]; | 210 | crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 0)) & 0xff]; |
211 | } | 211 | } |
212 | 212 | ||
213 | switch (len / 8) { | 213 | switch (len / 8) { |
214 | case 3: crc = (crc << 8) ^ | 214 | case 3: crc = (crc << 8) ^ |
215 | crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; | 215 | crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; |
216 | case 2: crc = (crc << 8) ^ | 216 | case 2: crc = (crc << 8) ^ |
217 | crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; | 217 | crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; |
218 | case 1: crc = (crc << 8) ^ | 218 | case 1: crc = (crc << 8) ^ |
219 | crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; | 219 | crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; |
220 | 220 | ||
221 | len %= 8; | 221 | len %= 8; |
222 | 222 | ||
223 | case 0: break; | 223 | case 0: break; |
224 | } | 224 | } |
225 | 225 | ||
226 | while (len--) { | 226 | while (len--) { |
227 | register unsigned int msb; | 227 | register unsigned int msb; |
228 | 228 | ||
229 | msb = mad_bit_read(&bitptr, 1) ^ (crc >> 15); | 229 | msb = mad_bit_read(&bitptr, 1) ^ (crc >> 15); |
230 | 230 | ||
231 | crc <<= 1; | 231 | crc <<= 1; |
232 | if (msb & 1) | 232 | if (msb & 1) |
233 | crc ^= CRC_POLY; | 233 | crc ^= CRC_POLY; |
234 | } | 234 | } |
235 | 235 | ||
236 | return crc & 0xffff; | 236 | return crc & 0xffff; |
237 | } | 237 | } |
diff --git a/core/multimedia/opieplayer/libmad/bit.h b/core/multimedia/opieplayer/libmad/bit.h index 3448d40..22ae66c 100644 --- a/core/multimedia/opieplayer/libmad/bit.h +++ b/core/multimedia/opieplayer/libmad/bit.h | |||
@@ -1,47 +1,47 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifndef LIBMAD_BIT_H | 22 | # ifndef LIBMAD_BIT_H |
23 | # define LIBMAD_BIT_H | 23 | # define LIBMAD_BIT_H |
24 | 24 | ||
25 | struct mad_bitptr { | 25 | struct mad_bitptr { |
26 | unsigned char const *byte; | 26 | unsigned char const *byte; |
27 | unsigned short cache; | 27 | unsigned short cache; |
28 | unsigned short left; | 28 | unsigned short left; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | void mad_bit_init(struct mad_bitptr *, unsigned char const *); | 31 | void mad_bit_init(struct mad_bitptr *, unsigned char const *); |
32 | 32 | ||
33 | # define mad_bit_finish(bitptr) /* nothing */ | 33 | # define mad_bit_finish(bitptr) /* nothing */ |
34 | 34 | ||
35 | unsigned int mad_bit_length(struct mad_bitptr const *, | 35 | unsigned int mad_bit_length(struct mad_bitptr const *, |
36 | struct mad_bitptr const *); | 36 | struct mad_bitptr const *); |
37 | 37 | ||
38 | # define mad_bit_bitsleft(bitptr) ((bitptr)->left) | 38 | # define mad_bit_bitsleft(bitptr) ((bitptr)->left) |
39 | unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); | 39 | unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); |
40 | 40 | ||
41 | void mad_bit_skip(struct mad_bitptr *, unsigned int); | 41 | void mad_bit_skip(struct mad_bitptr *, unsigned int); |
42 | unsigned long mad_bit_read(struct mad_bitptr *, unsigned int); | 42 | unsigned long mad_bit_read(struct mad_bitptr *, unsigned int); |
43 | void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long); | 43 | void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long); |
44 | 44 | ||
45 | unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short); | 45 | unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short); |
46 | 46 | ||
47 | # endif | 47 | # endif |
diff --git a/core/multimedia/opieplayer/libmad/decoder.c b/core/multimedia/opieplayer/libmad/decoder.c index b2b6cbb..d039bfb 100644 --- a/core/multimedia/opieplayer/libmad/decoder.c +++ b/core/multimedia/opieplayer/libmad/decoder.c | |||
@@ -1,570 +1,582 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifdef HAVE_CONFIG_H | 22 | # ifdef HAVE_CONFIG_H |
23 | # include "libmad_config.h" | 23 | # include "libmad_config.h" |
24 | # endif | 24 | # endif |
25 | 25 | ||
26 | # include "libmad_global.h" | 26 | # include "libmad_global.h" |
27 | 27 | ||
28 | # ifdef HAVE_SYS_TYPES_H | 28 | # ifdef HAVE_SYS_TYPES_H |
29 | # include <sys/types.h> | 29 | # include <sys/types.h> |
30 | # endif | 30 | # endif |
31 | 31 | ||
32 | # ifdef HAVE_SYS_WAIT_H | 32 | # ifdef HAVE_SYS_WAIT_H |
33 | # include <sys/wait.h> | 33 | # include <sys/wait.h> |
34 | # endif | 34 | # endif |
35 | 35 | ||
36 | # ifdef HAVE_UNISTD_H | 36 | # ifdef HAVE_UNISTD_H |
37 | # include <unistd.h> | 37 | # include <unistd.h> |
38 | # endif | 38 | # endif |
39 | 39 | ||
40 | # ifdef HAVE_FCNTL_H | 40 | # ifdef HAVE_FCNTL_H |
41 | # include <fcntl.h> | 41 | # include <fcntl.h> |
42 | # endif | 42 | # endif |
43 | 43 | ||
44 | # include <stdlib.h> | 44 | # include <stdlib.h> |
45 | 45 | ||
46 | # ifdef HAVE_ERRNO_H | 46 | # ifdef HAVE_ERRNO_H |
47 | # include <errno.h> | 47 | # include <errno.h> |
48 | # endif | 48 | # endif |
49 | 49 | ||
50 | # include "stream.h" | 50 | # include "stream.h" |
51 | # include "frame.h" | 51 | # include "frame.h" |
52 | # include "synth.h" | 52 | # include "synth.h" |
53 | # include "decoder.h" | 53 | # include "decoder.h" |
54 | 54 | ||
55 | /* | ||
56 | * NAME:decoder->init() | ||
57 | * DESCRIPTION:initialize a decoder object with callback routines | ||
58 | */ | ||
55 | void mad_decoder_init(struct mad_decoder *decoder, void *data, | 59 | void mad_decoder_init(struct mad_decoder *decoder, void *data, |
56 | enum mad_flow (*input_func)(void *, | 60 | enum mad_flow (*input_func)(void *, |
57 | struct mad_stream *), | 61 | struct mad_stream *), |
58 | enum mad_flow (*header_func)(void *, | 62 | enum mad_flow (*header_func)(void *, |
59 | struct mad_header const *), | 63 | struct mad_header const *), |
60 | enum mad_flow (*filter_func)(void *, | 64 | enum mad_flow (*filter_func)(void *, |
61 | struct mad_stream const *, | 65 | struct mad_stream const *, |
62 | struct mad_frame *), | 66 | struct mad_frame *), |
63 | enum mad_flow (*output_func)(void *, | 67 | enum mad_flow (*output_func)(void *, |
64 | struct mad_header const *, | 68 | struct mad_header const *, |
65 | struct mad_pcm *), | 69 | struct mad_pcm *), |
66 | enum mad_flow (*error_func)(void *, | 70 | enum mad_flow (*error_func)(void *, |
67 | struct mad_stream *, | 71 | struct mad_stream *, |
68 | struct mad_frame *), | 72 | struct mad_frame *), |
69 | enum mad_flow (*message_func)(void *, | 73 | enum mad_flow (*message_func)(void *, |
70 | void *, unsigned int *)) | 74 | void *, unsigned int *)) |
71 | { | 75 | { |
72 | decoder->mode = -1; | 76 | decoder->mode = -1; |
73 | 77 | ||
74 | decoder->options = 0; | 78 | decoder->options = 0; |
75 | 79 | ||
76 | decoder->async.pid = 0; | 80 | decoder->async.pid = 0; |
77 | decoder->async.in = -1; | 81 | decoder->async.in = -1; |
78 | decoder->async.out = -1; | 82 | decoder->async.out = -1; |
79 | 83 | ||
80 | decoder->sync = 0; | 84 | decoder->sync = 0; |
81 | 85 | ||
82 | decoder->cb_data = data; | 86 | decoder->cb_data = data; |
83 | 87 | ||
84 | decoder->input_func = input_func; | 88 | decoder->input_func = input_func; |
85 | decoder->header_func = header_func; | 89 | decoder->header_func = header_func; |
86 | decoder->filter_func = filter_func; | 90 | decoder->filter_func = filter_func; |
87 | decoder->output_func = output_func; | 91 | decoder->output_func = output_func; |
88 | decoder->error_func = error_func; | 92 | decoder->error_func = error_func; |
89 | decoder->message_func = message_func; | 93 | decoder->message_func = message_func; |
90 | } | 94 | } |
91 | 95 | ||
92 | int mad_decoder_finish(struct mad_decoder *decoder) | 96 | int mad_decoder_finish(struct mad_decoder *decoder) |
93 | { | 97 | { |
94 | # if defined(USE_ASYNC) | 98 | # if defined(USE_ASYNC) |
95 | if (decoder->mode == MAD_DECODER_MODE_ASYNC && decoder->async.pid) { | 99 | if (decoder->mode == MAD_DECODER_MODE_ASYNC && decoder->async.pid) { |
96 | pid_t pid; | 100 | pid_t pid; |
97 | int status; | 101 | int status; |
98 | 102 | ||
99 | close(decoder->async.in); | 103 | close(decoder->async.in); |
100 | 104 | ||
101 | do | 105 | do |
102 | pid = waitpid(decoder->async.pid, &status, 0); | 106 | pid = waitpid(decoder->async.pid, &status, 0); |
103 | while (pid == -1 && errno == EINTR); | 107 | while (pid == -1 && errno == EINTR); |
104 | 108 | ||
105 | decoder->mode = -1; | 109 | decoder->mode = -1; |
106 | 110 | ||
107 | close(decoder->async.out); | 111 | close(decoder->async.out); |
108 | 112 | ||
109 | decoder->async.pid = 0; | 113 | decoder->async.pid = 0; |
110 | decoder->async.in = -1; | 114 | decoder->async.in = -1; |
111 | decoder->async.out = -1; | 115 | decoder->async.out = -1; |
112 | 116 | ||
113 | if (pid == -1) | 117 | if (pid == -1) |
114 | return -1; | 118 | return -1; |
115 | 119 | ||
116 | return (!WIFEXITED(status) || WEXITSTATUS(status)) ? -1 : 0; | 120 | return (!WIFEXITED(status) || WEXITSTATUS(status)) ? -1 : 0; |
117 | } | 121 | } |
118 | # endif | 122 | # endif |
119 | 123 | ||
120 | return 0; | 124 | return 0; |
121 | } | 125 | } |
122 | 126 | ||
123 | # if defined(USE_ASYNC) | 127 | # if defined(USE_ASYNC) |
124 | static | 128 | static |
125 | enum mad_flow send_io(int fd, void const *data, size_t len) | 129 | enum mad_flow send_io(int fd, void const *data, size_t len) |
126 | { | 130 | { |
127 | char const *ptr = data; | 131 | char const *ptr = data; |
128 | ssize_t count; | 132 | ssize_t count; |
129 | 133 | ||
130 | while (len) { | 134 | while (len) { |
131 | do | 135 | do |
132 | count = write(fd, ptr, len); | 136 | count = write(fd, ptr, len); |
133 | while (count == -1 && errno == EINTR); | 137 | while (count == -1 && errno == EINTR); |
134 | 138 | ||
135 | if (count == -1) | 139 | if (count == -1) |
136 | return MAD_FLOW_BREAK; | 140 | return MAD_FLOW_BREAK; |
137 | 141 | ||
138 | len -= count; | 142 | len -= count; |
139 | ptr += count; | 143 | ptr += count; |
140 | } | 144 | } |
141 | 145 | ||
142 | return MAD_FLOW_CONTINUE; | 146 | return MAD_FLOW_CONTINUE; |
143 | } | 147 | } |
144 | 148 | ||
145 | static | 149 | static |
146 | enum mad_flow receive_io(int fd, void *buffer, size_t len) | 150 | enum mad_flow receive_io(int fd, void *buffer, size_t len) |
147 | { | 151 | { |
148 | char *ptr = buffer; | 152 | char *ptr = buffer; |
149 | ssize_t count; | 153 | ssize_t count; |
150 | 154 | ||
151 | while (len) { | 155 | while (len) { |
152 | do | 156 | do |
153 | count = read(fd, ptr, len); | 157 | count = read(fd, ptr, len); |
154 | while (count == -1 && errno == EINTR); | 158 | while (count == -1 && errno == EINTR); |
155 | 159 | ||
156 | if (count == -1) | 160 | if (count == -1) |
157 | return (errno == EAGAIN) ? MAD_FLOW_IGNORE : MAD_FLOW_BREAK; | 161 | return (errno == EAGAIN) ? MAD_FLOW_IGNORE : MAD_FLOW_BREAK; |
158 | else if (count == 0) | 162 | else if (count == 0) |
159 | return MAD_FLOW_STOP; | 163 | return MAD_FLOW_STOP; |
160 | 164 | ||
161 | len -= count; | 165 | len -= count; |
162 | ptr += count; | 166 | ptr += count; |
163 | } | 167 | } |
164 | 168 | ||
165 | return MAD_FLOW_CONTINUE; | 169 | return MAD_FLOW_CONTINUE; |
166 | } | 170 | } |
167 | 171 | ||
168 | static | 172 | static |
169 | enum mad_flow receive_io_blocking(int fd, void *buffer, size_t len) | 173 | enum mad_flow receive_io_blocking(int fd, void *buffer, size_t len) |
170 | { | 174 | { |
171 | int flags, blocking; | 175 | int flags, blocking; |
172 | enum mad_flow result; | 176 | enum mad_flow result; |
173 | 177 | ||
174 | flags = fcntl(fd, F_GETFL); | 178 | flags = fcntl(fd, F_GETFL); |
175 | if (flags == -1) | 179 | if (flags == -1) |
176 | return MAD_FLOW_BREAK; | 180 | return MAD_FLOW_BREAK; |
177 | 181 | ||
178 | blocking = flags & ~O_NONBLOCK; | 182 | blocking = flags & ~O_NONBLOCK; |
179 | 183 | ||
180 | if (blocking != flags && | 184 | if (blocking != flags && |
181 | fcntl(fd, F_SETFL, blocking) == -1) | 185 | fcntl(fd, F_SETFL, blocking) == -1) |
182 | return MAD_FLOW_BREAK; | 186 | return MAD_FLOW_BREAK; |
183 | 187 | ||
184 | result = receive_io(fd, buffer, len); | 188 | result = receive_io(fd, buffer, len); |
185 | 189 | ||
186 | if (flags != blocking && | 190 | if (flags != blocking && |
187 | fcntl(fd, F_SETFL, flags) == -1) | 191 | fcntl(fd, F_SETFL, flags) == -1) |
188 | return MAD_FLOW_BREAK; | 192 | return MAD_FLOW_BREAK; |
189 | 193 | ||
190 | return result; | 194 | return result; |
191 | } | 195 | } |
192 | 196 | ||
193 | static | 197 | static |
194 | enum mad_flow send(int fd, void const *message, unsigned int size) | 198 | enum mad_flow send(int fd, void const *message, unsigned int size) |
195 | { | 199 | { |
196 | enum mad_flow result; | 200 | enum mad_flow result; |
197 | 201 | ||
198 | /* send size */ | 202 | /* send size */ |
199 | 203 | ||
200 | result = send_io(fd, &size, sizeof(size)); | 204 | result = send_io(fd, &size, sizeof(size)); |
201 | 205 | ||
202 | /* send message */ | 206 | /* send message */ |
203 | 207 | ||
204 | if (result == MAD_FLOW_CONTINUE) | 208 | if (result == MAD_FLOW_CONTINUE) |
205 | result = send_io(fd, message, size); | 209 | result = send_io(fd, message, size); |
206 | 210 | ||
207 | return result; | 211 | return result; |
208 | } | 212 | } |
209 | 213 | ||
210 | static | 214 | static |
211 | enum mad_flow receive(int fd, void **message, unsigned int *size) | 215 | enum mad_flow receive(int fd, void **message, unsigned int *size) |
212 | { | 216 | { |
213 | enum mad_flow result; | 217 | enum mad_flow result; |
214 | unsigned int actual; | 218 | unsigned int actual; |
215 | 219 | ||
216 | if (*message == 0) | 220 | if (*message == 0) |
217 | *size = 0; | 221 | *size = 0; |
218 | 222 | ||
219 | /* receive size */ | 223 | /* receive size */ |
220 | 224 | ||
221 | result = receive_io(fd, &actual, sizeof(actual)); | 225 | result = receive_io(fd, &actual, sizeof(actual)); |
222 | 226 | ||
223 | /* receive message */ | 227 | /* receive message */ |
224 | 228 | ||
225 | if (result == MAD_FLOW_CONTINUE) { | 229 | if (result == MAD_FLOW_CONTINUE) { |
226 | if (actual > *size) | 230 | if (actual > *size) |
227 | actual -= *size; | 231 | actual -= *size; |
228 | else { | 232 | else { |
229 | *size = actual; | 233 | *size = actual; |
230 | actual = 0; | 234 | actual = 0; |
231 | } | 235 | } |
232 | 236 | ||
233 | if (*size > 0) { | 237 | if (*size > 0) { |
234 | if (*message == 0) { | 238 | if (*message == 0) { |
235 | *message = malloc(*size); | 239 | *message = malloc(*size); |
236 | if (*message == 0) | 240 | if (*message == 0) |
237 | return MAD_FLOW_BREAK; | 241 | return MAD_FLOW_BREAK; |
238 | } | 242 | } |
239 | 243 | ||
240 | result = receive_io_blocking(fd, *message, *size); | 244 | result = receive_io_blocking(fd, *message, *size); |
241 | } | 245 | } |
242 | 246 | ||
243 | /* throw away remainder of message */ | 247 | /* throw away remainder of message */ |
244 | 248 | ||
245 | while (actual && result == MAD_FLOW_CONTINUE) { | 249 | while (actual && result == MAD_FLOW_CONTINUE) { |
246 | char sink[256]; | 250 | char sink[256]; |
247 | unsigned int len; | 251 | unsigned int len; |
248 | 252 | ||
249 | len = actual > sizeof(sink) ? sizeof(sink) : actual; | 253 | len = actual > sizeof(sink) ? sizeof(sink) : actual; |
250 | 254 | ||
251 | result = receive_io_blocking(fd, sink, len); | 255 | result = receive_io_blocking(fd, sink, len); |
252 | 256 | ||
253 | actual -= len; | 257 | actual -= len; |
254 | } | 258 | } |
255 | } | 259 | } |
256 | 260 | ||
257 | return result; | 261 | return result; |
258 | } | 262 | } |
259 | 263 | ||
260 | static | 264 | static |
261 | enum mad_flow check_message(struct mad_decoder *decoder) | 265 | enum mad_flow check_message(struct mad_decoder *decoder) |
262 | { | 266 | { |
263 | enum mad_flow result; | 267 | enum mad_flow result; |
264 | void *message = 0; | 268 | void *message = 0; |
265 | unsigned int size; | 269 | unsigned int size; |
266 | 270 | ||
267 | result = receive(decoder->async.in, &message, &size); | 271 | result = receive(decoder->async.in, &message, &size); |
268 | 272 | ||
269 | if (result == MAD_FLOW_CONTINUE) { | 273 | if (result == MAD_FLOW_CONTINUE) { |
270 | if (decoder->message_func == 0) | 274 | if (decoder->message_func == 0) |
271 | size = 0; | 275 | size = 0; |
272 | else { | 276 | else { |
273 | result = decoder->message_func(decoder->cb_data, message, &size); | 277 | result = decoder->message_func(decoder->cb_data, message, &size); |
274 | 278 | ||
275 | if (result == MAD_FLOW_IGNORE || | 279 | if (result == MAD_FLOW_IGNORE || |
276 | result == MAD_FLOW_BREAK) | 280 | result == MAD_FLOW_BREAK) |
277 | size = 0; | 281 | size = 0; |
278 | } | 282 | } |
279 | 283 | ||
280 | if (send(decoder->async.out, message, size) != MAD_FLOW_CONTINUE) | 284 | if (send(decoder->async.out, message, size) != MAD_FLOW_CONTINUE) |
281 | result = MAD_FLOW_BREAK; | 285 | result = MAD_FLOW_BREAK; |
282 | } | 286 | } |
283 | 287 | ||
284 | if (message) | 288 | if (message) |
285 | free(message); | 289 | free(message); |
286 | 290 | ||
287 | return result; | 291 | return result; |
288 | } | 292 | } |
289 | # endif | 293 | # endif |
290 | 294 | ||
291 | static | 295 | static |
292 | enum mad_flow error_default(void *data, struct mad_stream *stream, | 296 | enum mad_flow error_default(void *data, struct mad_stream *stream, |
293 | struct mad_frame *frame) | 297 | struct mad_frame *frame) |
294 | { | 298 | { |
295 | int *bad_last_frame = data; | 299 | int *bad_last_frame = data; |
296 | 300 | ||
297 | switch (stream->error) { | 301 | switch (stream->error) { |
298 | case MAD_ERROR_BADCRC: | 302 | case MAD_ERROR_BADCRC: |
299 | if (*bad_last_frame) | 303 | if (*bad_last_frame) |
300 | mad_frame_mute(frame); | 304 | mad_frame_mute(frame); |
301 | else | 305 | else |
302 | *bad_last_frame = 1; | 306 | *bad_last_frame = 1; |
303 | 307 | ||
304 | return MAD_FLOW_IGNORE; | 308 | return MAD_FLOW_IGNORE; |
305 | 309 | ||
306 | default: | 310 | default: |
307 | return MAD_FLOW_CONTINUE; | 311 | return MAD_FLOW_CONTINUE; |
308 | } | 312 | } |
309 | } | 313 | } |
310 | 314 | ||
311 | static | 315 | static |
312 | int run_sync(struct mad_decoder *decoder) | 316 | int run_sync(struct mad_decoder *decoder) |
313 | { | 317 | { |
314 | enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); | 318 | enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); |
315 | void *error_data; | 319 | void *error_data; |
316 | int bad_last_frame = 0; | 320 | int bad_last_frame = 0; |
317 | struct mad_stream *stream; | 321 | struct mad_stream *stream; |
318 | struct mad_frame *frame; | 322 | struct mad_frame *frame; |
319 | struct mad_synth *synth; | 323 | struct mad_synth *synth; |
320 | int result = 0; | 324 | int result = 0; |
321 | 325 | ||
322 | if (decoder->input_func == 0) | 326 | if (decoder->input_func == 0) |
323 | return 0; | 327 | return 0; |
324 | 328 | ||
325 | if (decoder->error_func) { | 329 | if (decoder->error_func) { |
326 | error_func = decoder->error_func; | 330 | error_func = decoder->error_func; |
327 | error_data = decoder->cb_data; | 331 | error_data = decoder->cb_data; |
328 | } | 332 | } |
329 | else { | 333 | else { |
330 | error_func = error_default; | 334 | error_func = error_default; |
331 | error_data = &bad_last_frame; | 335 | error_data = &bad_last_frame; |
332 | } | 336 | } |
333 | 337 | ||
334 | stream = &decoder->sync->stream; | 338 | stream = &decoder->sync->stream; |
335 | frame = &decoder->sync->frame; | 339 | frame = &decoder->sync->frame; |
336 | synth = &decoder->sync->synth; | 340 | synth = &decoder->sync->synth; |
337 | 341 | ||
338 | mad_stream_init(stream); | 342 | mad_stream_init(stream); |
339 | mad_frame_init(frame); | 343 | mad_frame_init(frame); |
340 | mad_synth_init(synth); | 344 | mad_synth_init(synth); |
341 | 345 | ||
342 | mad_stream_options(stream, decoder->options); | 346 | mad_stream_options(stream, decoder->options); |
343 | 347 | ||
344 | do { | 348 | do { |
345 | switch (decoder->input_func(decoder->cb_data, stream)) { | 349 | switch (decoder->input_func(decoder->cb_data, stream)) { |
346 | case MAD_FLOW_STOP: | 350 | case MAD_FLOW_STOP: |
347 | goto done; | 351 | goto done; |
348 | case MAD_FLOW_BREAK: | 352 | case MAD_FLOW_BREAK: |
349 | goto fail; | 353 | goto fail; |
350 | case MAD_FLOW_IGNORE: | 354 | case MAD_FLOW_IGNORE: |
351 | continue; | 355 | continue; |
352 | case MAD_FLOW_CONTINUE: | 356 | case MAD_FLOW_CONTINUE: |
353 | break; | 357 | break; |
354 | } | 358 | } |
355 | 359 | ||
356 | while (1) { | 360 | while (1) { |
357 | # if defined(USE_ASYNC) | 361 | # if defined(USE_ASYNC) |
358 | if (decoder->mode == MAD_DECODER_MODE_ASYNC) { | 362 | if (decoder->mode == MAD_DECODER_MODE_ASYNC) { |
359 | switch (check_message(decoder)) { | 363 | switch (check_message(decoder)) { |
360 | case MAD_FLOW_IGNORE: | 364 | case MAD_FLOW_IGNORE: |
361 | case MAD_FLOW_CONTINUE: | 365 | case MAD_FLOW_CONTINUE: |
362 | break; | 366 | break; |
363 | case MAD_FLOW_BREAK: | 367 | case MAD_FLOW_BREAK: |
364 | goto fail; | 368 | goto fail; |
365 | case MAD_FLOW_STOP: | 369 | case MAD_FLOW_STOP: |
366 | goto done; | 370 | goto done; |
367 | } | 371 | } |
368 | } | 372 | } |
369 | # endif | 373 | # endif |
370 | 374 | ||
371 | if (decoder->header_func) { | 375 | if (decoder->header_func) { |
372 | if (mad_header_decode(&frame->header, stream) == -1) { | 376 | if (mad_header_decode(&frame->header, stream) == -1) { |
373 | if (!MAD_RECOVERABLE(stream->error)) | 377 | if (!MAD_RECOVERABLE(stream->error)) |
374 | break; | 378 | break; |
375 | 379 | ||
376 | switch (error_func(error_data, stream, frame)) { | 380 | switch (error_func(error_data, stream, frame)) { |
377 | case MAD_FLOW_STOP: | 381 | case MAD_FLOW_STOP: |
378 | goto done; | 382 | goto done; |
379 | case MAD_FLOW_BREAK: | 383 | case MAD_FLOW_BREAK: |
380 | goto fail; | 384 | goto fail; |
381 | case MAD_FLOW_IGNORE: | 385 | case MAD_FLOW_IGNORE: |
382 | case MAD_FLOW_CONTINUE: | 386 | case MAD_FLOW_CONTINUE: |
383 | default: | 387 | default: |
384 | continue; | 388 | continue; |
385 | } | 389 | } |
386 | } | 390 | } |
387 | 391 | ||
388 | switch (decoder->header_func(decoder->cb_data, &frame->header)) { | 392 | switch (decoder->header_func(decoder->cb_data, &frame->header)) { |
389 | case MAD_FLOW_STOP: | 393 | case MAD_FLOW_STOP: |
390 | goto done; | 394 | goto done; |
391 | case MAD_FLOW_BREAK: | 395 | case MAD_FLOW_BREAK: |
392 | goto fail; | 396 | goto fail; |
393 | case MAD_FLOW_IGNORE: | 397 | case MAD_FLOW_IGNORE: |
394 | continue; | 398 | continue; |
395 | case MAD_FLOW_CONTINUE: | 399 | case MAD_FLOW_CONTINUE: |
396 | break; | 400 | break; |
397 | } | 401 | } |
398 | } | 402 | } |
399 | 403 | ||
400 | if (mad_frame_decode(frame, stream) == -1) { | 404 | if (mad_frame_decode(frame, stream) == -1) { |
401 | if (!MAD_RECOVERABLE(stream->error)) | 405 | if (!MAD_RECOVERABLE(stream->error)) |
402 | break; | 406 | break; |
403 | 407 | ||
404 | switch (error_func(error_data, stream, frame)) { | 408 | switch (error_func(error_data, stream, frame)) { |
405 | case MAD_FLOW_STOP: | 409 | case MAD_FLOW_STOP: |
406 | goto done; | 410 | goto done; |
407 | case MAD_FLOW_BREAK: | 411 | case MAD_FLOW_BREAK: |
408 | goto fail; | 412 | goto fail; |
409 | case MAD_FLOW_IGNORE: | 413 | case MAD_FLOW_IGNORE: |
410 | break; | 414 | break; |
411 | case MAD_FLOW_CONTINUE: | 415 | case MAD_FLOW_CONTINUE: |
412 | default: | 416 | default: |
413 | continue; | 417 | continue; |
414 | } | 418 | } |
415 | } | 419 | } |
416 | else | 420 | else |
417 | bad_last_frame = 0; | 421 | bad_last_frame = 0; |
418 | 422 | ||
419 | if (decoder->filter_func) { | 423 | if (decoder->filter_func) { |
420 | switch (decoder->filter_func(decoder->cb_data, stream, frame)) { | 424 | switch (decoder->filter_func(decoder->cb_data, stream, frame)) { |
421 | case MAD_FLOW_STOP: | 425 | case MAD_FLOW_STOP: |
422 | goto done; | 426 | goto done; |
423 | case MAD_FLOW_BREAK: | 427 | case MAD_FLOW_BREAK: |
424 | goto fail; | 428 | goto fail; |
425 | case MAD_FLOW_IGNORE: | 429 | case MAD_FLOW_IGNORE: |
426 | continue; | 430 | continue; |
427 | case MAD_FLOW_CONTINUE: | 431 | case MAD_FLOW_CONTINUE: |
428 | break; | 432 | break; |
429 | } | 433 | } |
430 | } | 434 | } |
431 | 435 | ||
432 | mad_synth_frame(synth, frame); | 436 | mad_synth_frame(synth, frame); |
433 | 437 | ||
434 | if (decoder->output_func) { | 438 | if (decoder->output_func) { |
435 | switch (decoder->output_func(decoder->cb_data, | 439 | switch (decoder->output_func(decoder->cb_data, |
436 | &frame->header, &synth->pcm)) { | 440 | &frame->header, &synth->pcm)) { |
437 | case MAD_FLOW_STOP: | 441 | case MAD_FLOW_STOP: |
438 | goto done; | 442 | goto done; |
439 | case MAD_FLOW_BREAK: | 443 | case MAD_FLOW_BREAK: |
440 | goto fail; | 444 | goto fail; |
441 | case MAD_FLOW_IGNORE: | 445 | case MAD_FLOW_IGNORE: |
442 | case MAD_FLOW_CONTINUE: | 446 | case MAD_FLOW_CONTINUE: |
443 | break; | 447 | break; |
444 | } | 448 | } |
445 | } | 449 | } |
446 | } | 450 | } |
447 | } | 451 | } |
448 | while (stream->error == MAD_ERROR_BUFLEN); | 452 | while (stream->error == MAD_ERROR_BUFLEN); |
449 | 453 | ||
450 | fail: | 454 | fail: |
451 | result = -1; | 455 | result = -1; |
452 | 456 | ||
453 | done: | 457 | done: |
454 | mad_synth_finish(synth); | 458 | mad_synth_finish(synth); |
455 | mad_frame_finish(frame); | 459 | mad_frame_finish(frame); |
456 | mad_stream_finish(stream); | 460 | mad_stream_finish(stream); |
457 | 461 | ||
458 | return result; | 462 | return result; |
459 | } | 463 | } |
460 | 464 | ||
461 | # if defined(USE_ASYNC) | 465 | # if defined(USE_ASYNC) |
462 | static | 466 | static |
463 | int run_async(struct mad_decoder *decoder) | 467 | int run_async(struct mad_decoder *decoder) |
464 | { | 468 | { |
465 | pid_t pid; | 469 | pid_t pid; |
466 | int ptoc[2], ctop[2], flags; | 470 | int ptoc[2], ctop[2], flags; |
467 | 471 | ||
468 | if (pipe(ptoc) == -1) | 472 | if (pipe(ptoc) == -1) |
469 | return -1; | 473 | return -1; |
470 | 474 | ||
471 | if (pipe(ctop) == -1) { | 475 | if (pipe(ctop) == -1) { |
472 | close(ptoc[0]); | 476 | close(ptoc[0]); |
473 | close(ptoc[1]); | 477 | close(ptoc[1]); |
474 | return -1; | 478 | return -1; |
475 | } | 479 | } |
476 | 480 | ||
477 | flags = fcntl(ptoc[0], F_GETFL); | 481 | flags = fcntl(ptoc[0], F_GETFL); |
478 | if (flags == -1 || | 482 | if (flags == -1 || |
479 | fcntl(ptoc[0], F_SETFL, flags | O_NONBLOCK) == -1) { | 483 | fcntl(ptoc[0], F_SETFL, flags | O_NONBLOCK) == -1) { |
480 | close(ctop[0]); | 484 | close(ctop[0]); |
481 | close(ctop[1]); | 485 | close(ctop[1]); |
482 | close(ptoc[0]); | 486 | close(ptoc[0]); |
483 | close(ptoc[1]); | 487 | close(ptoc[1]); |
484 | return -1; | 488 | return -1; |
485 | } | 489 | } |
486 | 490 | ||
487 | pid = fork(); | 491 | pid = fork(); |
488 | if (pid == -1) { | 492 | if (pid == -1) { |
489 | close(ctop[0]); | 493 | close(ctop[0]); |
490 | close(ctop[1]); | 494 | close(ctop[1]); |
491 | close(ptoc[0]); | 495 | close(ptoc[0]); |
492 | close(ptoc[1]); | 496 | close(ptoc[1]); |
493 | return -1; | 497 | return -1; |
494 | } | 498 | } |
495 | 499 | ||
496 | decoder->async.pid = pid; | 500 | decoder->async.pid = pid; |
497 | 501 | ||
498 | if (pid) { | 502 | if (pid) { |
499 | /* parent */ | 503 | /* parent */ |
500 | 504 | ||
501 | close(ptoc[0]); | 505 | close(ptoc[0]); |
502 | close(ctop[1]); | 506 | close(ctop[1]); |
503 | 507 | ||
504 | decoder->async.in = ctop[0]; | 508 | decoder->async.in = ctop[0]; |
505 | decoder->async.out = ptoc[1]; | 509 | decoder->async.out = ptoc[1]; |
506 | 510 | ||
507 | return 0; | 511 | return 0; |
508 | } | 512 | } |
509 | 513 | ||
510 | /* child */ | 514 | /* child */ |
511 | 515 | ||
512 | close(ptoc[1]); | 516 | close(ptoc[1]); |
513 | close(ctop[0]); | 517 | close(ctop[0]); |
514 | 518 | ||
515 | decoder->async.in = ptoc[0]; | 519 | decoder->async.in = ptoc[0]; |
516 | decoder->async.out = ctop[1]; | 520 | decoder->async.out = ctop[1]; |
517 | 521 | ||
518 | _exit(run_sync(decoder)); | 522 | _exit(run_sync(decoder)); |
519 | 523 | ||
520 | /* not reached */ | 524 | /* not reached */ |
521 | return -1; | 525 | return -1; |
522 | } | 526 | } |
523 | # endif | 527 | # endif |
524 | 528 | ||
529 | /* | ||
530 | * NAME:decoder->run() | ||
531 | * DESCRIPTION:run the decoder thread either synchronously or asynchronously | ||
532 | */ | ||
525 | int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode) | 533 | int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode) |
526 | { | 534 | { |
527 | int result; | 535 | int result; |
528 | int (*run)(struct mad_decoder *) = 0; | 536 | int (*run)(struct mad_decoder *) = 0; |
529 | 537 | ||
530 | switch (decoder->mode = mode) { | 538 | switch (decoder->mode = mode) { |
531 | case MAD_DECODER_MODE_SYNC: | 539 | case MAD_DECODER_MODE_SYNC: |
532 | run = run_sync; | 540 | run = run_sync; |
533 | break; | 541 | break; |
534 | 542 | ||
535 | case MAD_DECODER_MODE_ASYNC: | 543 | case MAD_DECODER_MODE_ASYNC: |
536 | # if defined(USE_ASYNC) | 544 | # if defined(USE_ASYNC) |
537 | run = run_async; | 545 | run = run_async; |
538 | # endif | 546 | # endif |
539 | break; | 547 | break; |
540 | } | 548 | } |
541 | 549 | ||
542 | if (run == 0) | 550 | if (run == 0) |
543 | return -1; | 551 | return -1; |
544 | 552 | ||
545 | decoder->sync = malloc(sizeof(*decoder->sync)); | 553 | decoder->sync = malloc(sizeof(*decoder->sync)); |
546 | if (decoder->sync == 0) | 554 | if (decoder->sync == 0) |
547 | return -1; | 555 | return -1; |
548 | 556 | ||
549 | result = run(decoder); | 557 | result = run(decoder); |
550 | 558 | ||
551 | free(decoder->sync); | 559 | free(decoder->sync); |
552 | decoder->sync = 0; | 560 | decoder->sync = 0; |
553 | 561 | ||
554 | return result; | 562 | return result; |
555 | } | 563 | } |
556 | 564 | ||
565 | /* | ||
566 | * NAME:decoder->message() | ||
567 | * DESCRIPTION:send a message to and receive a reply from the decoder process | ||
568 | */ | ||
557 | int mad_decoder_message(struct mad_decoder *decoder, | 569 | int mad_decoder_message(struct mad_decoder *decoder, |
558 | void *message, unsigned int *len) | 570 | void *message, unsigned int *len) |
559 | { | 571 | { |
560 | # if defined(USE_ASYNC) | 572 | # if defined(USE_ASYNC) |
561 | if (decoder->mode != MAD_DECODER_MODE_ASYNC || | 573 | if (decoder->mode != MAD_DECODER_MODE_ASYNC || |
562 | send(decoder->async.out, message, *len) != MAD_FLOW_CONTINUE || | 574 | send(decoder->async.out, message, *len) != MAD_FLOW_CONTINUE || |
563 | receive(decoder->async.in, &message, len) != MAD_FLOW_CONTINUE) | 575 | receive(decoder->async.in, &message, len) != MAD_FLOW_CONTINUE) |
564 | return -1; | 576 | return -1; |
565 | 577 | ||
566 | return 0; | 578 | return 0; |
567 | # else | 579 | # else |
568 | return -1; | 580 | return -1; |
569 | # endif | 581 | # endif |
570 | } | 582 | } |
diff --git a/core/multimedia/opieplayer/libmad/decoder.h b/core/multimedia/opieplayer/libmad/decoder.h index f34150d..714e72c 100644 --- a/core/multimedia/opieplayer/libmad/decoder.h +++ b/core/multimedia/opieplayer/libmad/decoder.h | |||
@@ -1,91 +1,91 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifndef LIBMAD_DECODER_H | 22 | # ifndef LIBMAD_DECODER_H |
23 | # define LIBMAD_DECODER_H | 23 | # define LIBMAD_DECODER_H |
24 | 24 | ||
25 | # include "stream.h" | 25 | # include "stream.h" |
26 | # include "frame.h" | 26 | # include "frame.h" |
27 | # include "synth.h" | 27 | # include "synth.h" |
28 | 28 | ||
29 | enum mad_decoder_mode { | 29 | enum mad_decoder_mode { |
30 | MAD_DECODER_MODE_SYNC = 0, | 30 | MAD_DECODER_MODE_SYNC = 0, |
31 | MAD_DECODER_MODE_ASYNC | 31 | MAD_DECODER_MODE_ASYNC |
32 | }; | 32 | }; |
33 | 33 | ||
34 | enum mad_flow { | 34 | enum mad_flow { |
35 | MAD_FLOW_CONTINUE = 0x0000,/* continue normally */ | 35 | MAD_FLOW_CONTINUE = 0x0000,/* continue normally */ |
36 | MAD_FLOW_STOP = 0x0010,/* stop decoding normally */ | 36 | MAD_FLOW_STOP = 0x0010,/* stop decoding normally */ |
37 | MAD_FLOW_BREAK = 0x0011,/* stop decoding and signal an error */ | 37 | MAD_FLOW_BREAK = 0x0011,/* stop decoding and signal an error */ |
38 | MAD_FLOW_IGNORE = 0x0020/* ignore the current frame */ | 38 | MAD_FLOW_IGNORE = 0x0020/* ignore the current frame */ |
39 | }; | 39 | }; |
40 | 40 | ||
41 | struct mad_decoder { | 41 | struct mad_decoder { |
42 | enum mad_decoder_mode mode; | 42 | enum mad_decoder_mode mode; |
43 | 43 | ||
44 | int options; | 44 | int options; |
45 | 45 | ||
46 | struct { | 46 | struct { |
47 | long pid; | 47 | long pid; |
48 | int in; | 48 | int in; |
49 | int out; | 49 | int out; |
50 | } async; | 50 | } async; |
51 | 51 | ||
52 | struct { | 52 | struct { |
53 | struct mad_stream stream; | 53 | struct mad_stream stream; |
54 | struct mad_frame frame; | 54 | struct mad_frame frame; |
55 | struct mad_synth synth; | 55 | struct mad_synth synth; |
56 | } *sync; | 56 | } *sync; |
57 | 57 | ||
58 | void *cb_data; | 58 | void *cb_data; |
59 | 59 | ||
60 | enum mad_flow (*input_func)(void *, struct mad_stream *); | 60 | enum mad_flow (*input_func)(void *, struct mad_stream *); |
61 | enum mad_flow (*header_func)(void *, struct mad_header const *); | 61 | enum mad_flow (*header_func)(void *, struct mad_header const *); |
62 | enum mad_flow (*filter_func)(void *, | 62 | enum mad_flow (*filter_func)(void *, |
63 | struct mad_stream const *, struct mad_frame *); | 63 | struct mad_stream const *, struct mad_frame *); |
64 | enum mad_flow (*output_func)(void *, | 64 | enum mad_flow (*output_func)(void *, |
65 | struct mad_header const *, struct mad_pcm *); | 65 | struct mad_header const *, struct mad_pcm *); |
66 | enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); | 66 | enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); |
67 | enum mad_flow (*message_func)(void *, void *, unsigned int *); | 67 | enum mad_flow (*message_func)(void *, void *, unsigned int *); |
68 | }; | 68 | }; |
69 | 69 | ||
70 | void mad_decoder_init(struct mad_decoder *, void *, | 70 | void mad_decoder_init(struct mad_decoder *, void *, |
71 | enum mad_flow (*)(void *, struct mad_stream *), | 71 | enum mad_flow (*)(void *, struct mad_stream *), |
72 | enum mad_flow (*)(void *, struct mad_header const *), | 72 | enum mad_flow (*)(void *, struct mad_header const *), |
73 | enum mad_flow (*)(void *, | 73 | enum mad_flow (*)(void *, |
74 | struct mad_stream const *, | 74 | struct mad_stream const *, |
75 | struct mad_frame *), | 75 | struct mad_frame *), |
76 | enum mad_flow (*)(void *, | 76 | enum mad_flow (*)(void *, |
77 | struct mad_header const *, | 77 | struct mad_header const *, |
78 | struct mad_pcm *), | 78 | struct mad_pcm *), |
79 | enum mad_flow (*)(void *, | 79 | enum mad_flow (*)(void *, |
80 | struct mad_stream *, | 80 | struct mad_stream *, |
81 | struct mad_frame *), | 81 | struct mad_frame *), |
82 | enum mad_flow (*)(void *, void *, unsigned int *)); | 82 | enum mad_flow (*)(void *, void *, unsigned int *)); |
83 | int mad_decoder_finish(struct mad_decoder *); | 83 | int mad_decoder_finish(struct mad_decoder *); |
84 | 84 | ||
85 | # define mad_decoder_options(decoder, opts) \ | 85 | # define mad_decoder_options(decoder, opts) \ |
86 | ((void) ((decoder)->options = (opts))) | 86 | ((void) ((decoder)->options = (opts))) |
87 | 87 | ||
88 | int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode); | 88 | int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode); |
89 | int mad_decoder_message(struct mad_decoder *, void *, unsigned int *); | 89 | int mad_decoder_message(struct mad_decoder *, void *, unsigned int *); |
90 | 90 | ||
91 | # endif | 91 | # endif |
diff --git a/core/multimedia/opieplayer/libmad/fixed.c b/core/multimedia/opieplayer/libmad/fixed.c index af1e87e..e71418a 100644 --- a/core/multimedia/opieplayer/libmad/fixed.c +++ b/core/multimedia/opieplayer/libmad/fixed.c | |||
@@ -1,37 +1,81 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifdef HAVE_CONFIG_H | 22 | # ifdef HAVE_CONFIG_H |
23 | # include "libmad_config.h" | 23 | # include "libmad_config.h" |
24 | # endif | 24 | # endif |
25 | 25 | ||
26 | # include "libmad_global.h" | 26 | # include "libmad_global.h" |
27 | 27 | ||
28 | # include "fixed.h" | 28 | # include "fixed.h" |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * NAME:fixed->abs() | 31 | * NAME:fixed->abs() |
32 | * DESCRIPTION:return absolute value of a fixed-point number | 32 | * DESCRIPTION:return absolute value of a fixed-point number |
33 | */ | 33 | */ |
34 | mad_fixed_t mad_f_abs(mad_fixed_t x) | 34 | mad_fixed_t mad_f_abs(mad_fixed_t x) |
35 | { | 35 | { |
36 | return x < 0 ? -x : x; | 36 | return x < 0 ? -x : x; |
37 | } | 37 | } |
38 | |||
39 | /* | ||
40 | * NAME:fixed->div() | ||
41 | * DESCRIPTION:perform division using fixed-point math | ||
42 | */ | ||
43 | mad_fixed_t mad_f_div(mad_fixed_t x, mad_fixed_t y) | ||
44 | { | ||
45 | mad_fixed_t q, r; | ||
46 | unsigned int bits; | ||
47 | |||
48 | q = mad_f_abs(x / y); | ||
49 | |||
50 | if (x < 0) { | ||
51 | x = -x; | ||
52 | y = -y; | ||
53 | } | ||
54 | |||
55 | r = x % y; | ||
56 | |||
57 | if (y < 0) { | ||
58 | x = -x; | ||
59 | y = -y; | ||
60 | } | ||
61 | |||
62 | if (q > mad_f_intpart(MAD_F_MAX) && | ||
63 | !(q == -mad_f_intpart(MAD_F_MIN) && r == 0 && (x < 0) != (y < 0))) | ||
64 | return 0; | ||
65 | |||
66 | for (bits = MAD_F_FRACBITS; bits && r; --bits) { | ||
67 | q <<= 1, r <<= 1; | ||
68 | if (r >= y) | ||
69 | r -= y, ++q; | ||
70 | } | ||
71 | |||
72 | /* round */ | ||
73 | if (2 * r >= y) | ||
74 | ++q; | ||
75 | |||
76 | /* fix sign */ | ||
77 | if ((x < 0) != (y < 0)) | ||
78 | q = -q; | ||
79 | |||
80 | return q << bits; | ||
81 | } | ||
diff --git a/core/multimedia/opieplayer/libmad/fixed.h b/core/multimedia/opieplayer/libmad/fixed.h index c9b98ca..baa7dc5 100644 --- a/core/multimedia/opieplayer/libmad/fixed.h +++ b/core/multimedia/opieplayer/libmad/fixed.h | |||
@@ -1,476 +1,499 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifndef LIBMAD_FIXED_H | 22 | # ifndef LIBMAD_FIXED_H |
23 | # define LIBMAD_FIXED_H | 23 | # define LIBMAD_FIXED_H |
24 | 24 | ||
25 | # if SIZEOF_INT >= 4 | 25 | # if SIZEOF_INT >= 4 |
26 | typedef signed int mad_fixed_t; | 26 | typedef signed int mad_fixed_t; |
27 | 27 | ||
28 | typedef signed int mad_fixed64hi_t; | 28 | typedef signed int mad_fixed64hi_t; |
29 | typedef unsigned int mad_fixed64lo_t; | 29 | typedef unsigned int mad_fixed64lo_t; |
30 | # else | 30 | # else |
31 | typedef signed long mad_fixed_t; | 31 | typedef signed long mad_fixed_t; |
32 | 32 | ||
33 | typedef signed long mad_fixed64hi_t; | 33 | typedef signed long mad_fixed64hi_t; |
34 | typedef unsigned long mad_fixed64lo_t; | 34 | typedef unsigned long mad_fixed64lo_t; |
35 | # endif | 35 | # endif |
36 | 36 | ||
37 | # if defined(_MSC_VER) | 37 | # if defined(_MSC_VER) |
38 | # define mad_fixed64_t signed __int64 | 38 | # define mad_fixed64_t signed __int64 |
39 | # elif 1 || defined(__GNUC__) | 39 | # elif 1 || defined(__GNUC__) |
40 | # define mad_fixed64_t signed long long | 40 | # define mad_fixed64_t signed long long |
41 | # endif | 41 | # endif |
42 | 42 | ||
43 | # if defined(FPM_FLOAT) | 43 | # if defined(FPM_FLOAT) |
44 | typedef double mad_sample_t; | 44 | typedef double mad_sample_t; |
45 | # else | 45 | # else |
46 | typedef mad_fixed_t mad_sample_t; | 46 | typedef mad_fixed_t mad_sample_t; |
47 | # endif | 47 | # endif |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * Fixed-point format: 0xABBBBBBB | 50 | * Fixed-point format: 0xABBBBBBB |
51 | * A == whole part (sign + 3 bits) | 51 | * A == whole part (sign + 3 bits) |
52 | * B == fractional part (28 bits) | 52 | * B == fractional part (28 bits) |
53 | * | 53 | * |
54 | * Values are signed two's complement, so the effective range is: | 54 | * Values are signed two's complement, so the effective range is: |
55 | * 0x80000000 to 0x7fffffff | 55 | * 0x80000000 to 0x7fffffff |
56 | * -8.0 to +7.9999999962747097015380859375 | 56 | * -8.0 to +7.9999999962747097015380859375 |
57 | * | 57 | * |
58 | * The smallest representable value is: | 58 | * The smallest representable value is: |
59 | * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9) | 59 | * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9) |
60 | * | 60 | * |
61 | * 28 bits of fractional accuracy represent about | 61 | * 28 bits of fractional accuracy represent about |
62 | * 8.6 digits of decimal accuracy. | 62 | * 8.6 digits of decimal accuracy. |
63 | * | 63 | * |
64 | * Fixed-point numbers can be added or subtracted as normal | 64 | * Fixed-point numbers can be added or subtracted as normal |
65 | * integers, but multiplication requires shifting the 64-bit result | 65 | * integers, but multiplication requires shifting the 64-bit result |
66 | * from 56 fractional bits back to 28 (and rounding.) | 66 | * from 56 fractional bits back to 28 (and rounding.) |
67 | * | 67 | * |
68 | * Changing the definition of MAD_F_FRACBITS is only partially | 68 | * Changing the definition of MAD_F_FRACBITS is only partially |
69 | * supported, and must be done with care. | 69 | * supported, and must be done with care. |
70 | */ | 70 | */ |
71 | 71 | ||
72 | # define MAD_F_FRACBITS 28 | 72 | # define MAD_F_FRACBITS 28 |
73 | 73 | ||
74 | # if MAD_F_FRACBITS == 28 | 74 | # if MAD_F_FRACBITS == 28 |
75 | # define MAD_F(x) ((mad_fixed_t) (x##L)) | 75 | # define MAD_F(x) ((mad_fixed_t) (x##L)) |
76 | # else | 76 | # else |
77 | # if MAD_F_FRACBITS < 28 | 77 | # if MAD_F_FRACBITS < 28 |
78 | # warning "MAD_F_FRACBITS < 28" | 78 | # warning "MAD_F_FRACBITS < 28" |
79 | # define MAD_F(x) ((mad_fixed_t) \ | 79 | # define MAD_F(x) ((mad_fixed_t) \ |
80 | (((x##L) + \ | 80 | (((x##L) + \ |
81 | (1L << (28 - MAD_F_FRACBITS - 1))) >> \ | 81 | (1L << (28 - MAD_F_FRACBITS - 1))) >> \ |
82 | (28 - MAD_F_FRACBITS))) | 82 | (28 - MAD_F_FRACBITS))) |
83 | # elif MAD_F_FRACBITS > 28 | 83 | # elif MAD_F_FRACBITS > 28 |
84 | # error "MAD_F_FRACBITS > 28 not currently supported" | 84 | # error "MAD_F_FRACBITS > 28 not currently supported" |
85 | # define MAD_F(x) ((mad_fixed_t) \ | 85 | # define MAD_F(x) ((mad_fixed_t) \ |
86 | ((x##L) << (MAD_F_FRACBITS - 28))) | 86 | ((x##L) << (MAD_F_FRACBITS - 28))) |
87 | # endif | 87 | # endif |
88 | # endif | 88 | # endif |
89 | 89 | ||
90 | # define MAD_F_MIN ((mad_fixed_t) -0x80000000L) | 90 | # define MAD_F_MIN ((mad_fixed_t) -0x80000000L) |
91 | # define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) | 91 | # define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) |
92 | 92 | ||
93 | # define MAD_F_ONE MAD_F(0x10000000) | 93 | # define MAD_F_ONE MAD_F(0x10000000) |
94 | 94 | ||
95 | # define mad_f_tofixed(x)((mad_fixed_t) \ | 95 | # define mad_f_tofixed(x)((mad_fixed_t) \ |
96 | ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) | 96 | ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) |
97 | # define mad_f_todouble(x)((double) \ | 97 | # define mad_f_todouble(x)((double) \ |
98 | ((x) / (double) (1L << MAD_F_FRACBITS))) | 98 | ((x) / (double) (1L << MAD_F_FRACBITS))) |
99 | 99 | ||
100 | # define mad_f_intpart(x)((x) >> MAD_F_FRACBITS) | 100 | # define mad_f_intpart(x)((x) >> MAD_F_FRACBITS) |
101 | # define mad_f_fracpart(x)((x) & ((1L << MAD_F_FRACBITS) - 1)) | 101 | # define mad_f_fracpart(x)((x) & ((1L << MAD_F_FRACBITS) - 1)) |
102 | /* (x should be positive) */ | 102 | /* (x should be positive) */ |
103 | 103 | ||
104 | # define mad_f_fromint(x)((x) << MAD_F_FRACBITS) | 104 | # define mad_f_fromint(x)((x) << MAD_F_FRACBITS) |
105 | 105 | ||
106 | # define mad_f_add(x, y)((x) + (y)) | 106 | # define mad_f_add(x, y)((x) + (y)) |
107 | # define mad_f_sub(x, y)((x) - (y)) | 107 | # define mad_f_sub(x, y)((x) - (y)) |
108 | 108 | ||
109 | # if defined(FPM_FLOAT) | 109 | # if defined(FPM_FLOAT) |
110 | # error "FPM_FLOAT not yet supported" | 110 | # error "FPM_FLOAT not yet supported" |
111 | 111 | ||
112 | # undef MAD_F | 112 | # undef MAD_F |
113 | # define MAD_F(x) mad_f_todouble(x) | 113 | # define MAD_F(x) mad_f_todouble(x) |
114 | 114 | ||
115 | # define mad_f_mul(x, y)((x) * (y)) | 115 | # define mad_f_mul(x, y)((x) * (y)) |
116 | # define mad_f_scale64 | 116 | # define mad_f_scale64 |
117 | 117 | ||
118 | # undef ASO_ZEROCHECK | 118 | # undef ASO_ZEROCHECK |
119 | 119 | ||
120 | # elif defined(FPM_64BIT) | 120 | # elif defined(FPM_64BIT) |
121 | 121 | ||
122 | /* | 122 | /* |
123 | * This version should be the most accurate if 64-bit types are supported by | 123 | * This version should be the most accurate if 64-bit types are supported by |
124 | * the compiler, although it may not be the most efficient. | 124 | * the compiler, although it may not be the most efficient. |
125 | */ | 125 | */ |
126 | # if defined(OPT_ACCURACY) | 126 | # if defined(OPT_ACCURACY) |
127 | # define mad_f_mul(x, y) \ | 127 | # define mad_f_mul(x, y) \ |
128 | ((mad_fixed_t) \ | 128 | ((mad_fixed_t) \ |
129 | ((((mad_fixed64_t) (x) * (y)) + \ | 129 | ((((mad_fixed64_t) (x) * (y)) + \ |
130 | (1L << (MAD_F_SCALEBITS - 1))) >> MAD_F_SCALEBITS)) | 130 | (1L << (MAD_F_SCALEBITS - 1))) >> MAD_F_SCALEBITS)) |
131 | # else | 131 | # else |
132 | # define mad_f_mul(x, y) \ | 132 | # define mad_f_mul(x, y) \ |
133 | ((mad_fixed_t) (((mad_fixed64_t) (x) * (y)) >> MAD_F_SCALEBITS)) | 133 | ((mad_fixed_t) (((mad_fixed64_t) (x) * (y)) >> MAD_F_SCALEBITS)) |
134 | # endif | 134 | # endif |
135 | 135 | ||
136 | # define MAD_F_SCALEBITS MAD_F_FRACBITS | 136 | # define MAD_F_SCALEBITS MAD_F_FRACBITS |
137 | 137 | ||
138 | /* --- Intel --------------------------------------------------------------- */ | 138 | /* --- Intel --------------------------------------------------------------- */ |
139 | 139 | ||
140 | # elif defined(FPM_INTEL) | 140 | # elif defined(FPM_INTEL) |
141 | 141 | ||
142 | # if defined(_MSC_VER) | 142 | # if defined(_MSC_VER) |
143 | # pragma warning(push) | 143 | # pragma warning(push) |
144 | # pragma warning(disable: 4035) /* no return value */ | 144 | # pragma warning(disable: 4035) /* no return value */ |
145 | static __forceinline | 145 | static __forceinline |
146 | mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | 146 | mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) |
147 | { | 147 | { |
148 | enum { | 148 | enum { |
149 | fracbits = MAD_F_FRACBITS | 149 | fracbits = MAD_F_FRACBITS |
150 | }; | 150 | }; |
151 | 151 | ||
152 | __asm { | 152 | __asm { |
153 | mov eax, x | 153 | mov eax, x |
154 | imul y | 154 | imul y |
155 | shrd eax, edx, fracbits | 155 | shrd eax, edx, fracbits |
156 | } | 156 | } |
157 | 157 | ||
158 | /* implicit return of eax */ | 158 | /* implicit return of eax */ |
159 | } | 159 | } |
160 | # pragma warning(pop) | 160 | # pragma warning(pop) |
161 | 161 | ||
162 | # define mad_f_mul mad_f_mul_inline | 162 | # define mad_f_mul mad_f_mul_inline |
163 | # define mad_f_scale64 | 163 | # define mad_f_scale64 |
164 | # else | 164 | # else |
165 | /* | 165 | /* |
166 | * This Intel version is fast and accurate; the disposition of the least | 166 | * This Intel version is fast and accurate; the disposition of the least |
167 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). | 167 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). |
168 | */ | 168 | */ |
169 | # define MAD_F_MLX(hi, lo, x, y) \ | 169 | # define MAD_F_MLX(hi, lo, x, y) \ |
170 | asm ("imull %3" \ | 170 | asm ("imull %3" \ |
171 | : "=a" (lo), "=d" (hi) \ | 171 | : "=a" (lo), "=d" (hi) \ |
172 | : "%a" (x), "rm" (y) \ | 172 | : "%a" (x), "rm" (y) \ |
173 | : "cc") | 173 | : "cc") |
174 | 174 | ||
175 | # if defined(OPT_ACCURACY) | 175 | # if defined(OPT_ACCURACY) |
176 | /* | 176 | /* |
177 | * This gives best accuracy but is not very fast. | 177 | * This gives best accuracy but is not very fast. |
178 | */ | 178 | */ |
179 | # define MAD_F_MLA(hi, lo, x, y) \ | 179 | # define MAD_F_MLA(hi, lo, x, y) \ |
180 | ({ mad_fixed64hi_t __hi; \ | 180 | ({ mad_fixed64hi_t __hi; \ |
181 | mad_fixed64lo_t __lo; \ | 181 | mad_fixed64lo_t __lo; \ |
182 | MAD_F_MLX(__hi, __lo, (x), (y)); \ | 182 | MAD_F_MLX(__hi, __lo, (x), (y)); \ |
183 | asm ("addl %2,%0\n\t" \ | 183 | asm ("addl %2,%0\n\t" \ |
184 | "adcl %3,%1" \ | 184 | "adcl %3,%1" \ |
185 | : "=rm" (lo), "=rm" (hi) \ | 185 | : "=rm" (lo), "=rm" (hi) \ |
186 | : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ | 186 | : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ |
187 | : "cc"); \ | 187 | : "cc"); \ |
188 | }) | 188 | }) |
189 | # endif /* OPT_ACCURACY */ | 189 | # endif /* OPT_ACCURACY */ |
190 | 190 | ||
191 | # if defined(OPT_ACCURACY) | 191 | # if defined(OPT_ACCURACY) |
192 | /* | 192 | /* |
193 | * Surprisingly, this is faster than SHRD followed by ADC. | 193 | * Surprisingly, this is faster than SHRD followed by ADC. |
194 | */ | 194 | */ |
195 | # define mad_f_scale64(hi, lo) \ | 195 | # define mad_f_scale64(hi, lo) \ |
196 | ({ mad_fixed64hi_t __hi_; \ | 196 | ({ mad_fixed64hi_t __hi_; \ |
197 | mad_fixed64lo_t __lo_; \ | 197 | mad_fixed64lo_t __lo_; \ |
198 | mad_fixed_t __result; \ | 198 | mad_fixed_t __result; \ |
199 | asm ("addl %4,%2\n\t" \ | 199 | asm ("addl %4,%2\n\t" \ |
200 | "adcl %5,%3" \ | 200 | "adcl %5,%3" \ |
201 | : "=rm" (__lo_), "=rm" (__hi_) \ | 201 | : "=rm" (__lo_), "=rm" (__hi_) \ |
202 | : "0" (lo), "1" (hi), \ | 202 | : "0" (lo), "1" (hi), \ |
203 | "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ | 203 | "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ |
204 | : "cc"); \ | 204 | : "cc"); \ |
205 | asm ("shrdl %3,%2,%1" \ | 205 | asm ("shrdl %3,%2,%1" \ |
206 | : "=rm" (__result) \ | 206 | : "=rm" (__result) \ |
207 | : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ | 207 | : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ |
208 | : "cc"); \ | 208 | : "cc"); \ |
209 | __result; \ | 209 | __result; \ |
210 | }) | 210 | }) |
211 | # elif defined(OPT_INTEL) | ||
212 | /* | ||
213 | * Alternate Intel scaling that may or may not perform better. | ||
214 | */ | ||
215 | # define mad_f_scale64(hi, lo) \ | ||
216 | ({ mad_fixed_t __result; \ | ||
217 | asm ("shrl %3,%1\n\t" \ | ||
218 | "shll %4,%2\n\t" \ | ||
219 | "orl %2,%1" \ | ||
220 | : "=rm" (__result) \ | ||
221 | : "0" (lo), "r" (hi), \ | ||
222 | "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ | ||
223 | : "cc"); \ | ||
224 | __result; \ | ||
225 | }) | ||
211 | # else | 226 | # else |
212 | # define mad_f_scale64(hi, lo) \ | 227 | # define mad_f_scale64(hi, lo) \ |
213 | ({ mad_fixed_t __result; \ | 228 | ({ mad_fixed_t __result; \ |
214 | asm ("shrdl %3,%2,%1" \ | 229 | asm ("shrdl %3,%2,%1" \ |
215 | : "=rm" (__result) \ | 230 | : "=rm" (__result) \ |
216 | : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ | 231 | : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ |
217 | : "cc"); \ | 232 | : "cc"); \ |
218 | __result; \ | 233 | __result; \ |
219 | }) | 234 | }) |
220 | # endif /* OPT_ACCURACY */ | 235 | # endif /* OPT_ACCURACY */ |
221 | 236 | ||
222 | # define MAD_F_SCALEBITS MAD_F_FRACBITS | 237 | # define MAD_F_SCALEBITS MAD_F_FRACBITS |
223 | # endif | 238 | # endif |
224 | 239 | ||
225 | /* --- ARM ----------------------------------------------------------------- */ | 240 | /* --- ARM ----------------------------------------------------------------- */ |
226 | 241 | ||
227 | # elif defined(FPM_ARM) | 242 | # elif defined(FPM_ARM) |
228 | 243 | ||
229 | /* | 244 | /* |
230 | * This ARM V4 version is as accurate as FPM_64BIT but much faster. The | 245 | * This ARM V4 version is as accurate as FPM_64BIT but much faster. The |
231 | * least significant bit is properly rounded at no CPU cycle cost! | 246 | * least significant bit is properly rounded at no CPU cycle cost! |
232 | */ | 247 | */ |
233 | # if 1 | 248 | # if 1 |
234 | /* | 249 | /* |
235 | * There's a bug somewhere, possibly in the compiler, that sometimes makes | 250 | * This is faster than the default implementation via MAD_F_MLX() and |
236 | * this necessary instead of the default implementation via MAD_F_MLX and | 251 | * mad_f_scale64(). |
237 | * mad_f_scale64. It may be related to the use (or lack) of | ||
238 | * -finline-functions and/or -fstrength-reduce. | ||
239 | * | ||
240 | * This is also apparently faster than MAD_F_MLX/mad_f_scale64. | ||
241 | */ | 252 | */ |
242 | # define mad_f_mul(x, y) \ | 253 | # define mad_f_mul(x, y) \ |
243 | ({ mad_fixed64hi_t __hi; \ | 254 | ({ mad_fixed64hi_t __hi; \ |
244 | mad_fixed64lo_t __lo; \ | 255 | mad_fixed64lo_t __lo; \ |
245 | mad_fixed_t __result; \ | 256 | mad_fixed_t __result; \ |
246 | asm ("smull%0, %1, %3, %4\n\t" \ | 257 | asm ("smull%0, %1, %3, %4\n\t" \ |
247 | "movs%0, %0, lsr %5\n\t" \ | 258 | "movs%0, %0, lsr %5\n\t" \ |
248 | "adc%2, %0, %1, lsl %6" \ | 259 | "adc%2, %0, %1, lsl %6" \ |
249 | : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ | 260 | : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ |
250 | : "%r" (x), "r" (y), \ | 261 | : "%r" (x), "r" (y), \ |
251 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ | 262 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ |
252 | : "cc"); \ | 263 | : "cc"); \ |
253 | __result; \ | 264 | __result; \ |
254 | }) | 265 | }) |
255 | # endif | 266 | # endif |
256 | 267 | ||
257 | # define MAD_F_MLX(hi, lo, x, y) \ | 268 | # define MAD_F_MLX(hi, lo, x, y) \ |
258 | asm ("smull%0, %1, %2, %3" \ | 269 | asm ("smull%0, %1, %2, %3" \ |
259 | : "=&r" (lo), "=&r" (hi) \ | 270 | : "=&r" (lo), "=&r" (hi) \ |
260 | : "%r" (x), "r" (y)) | 271 | : "%r" (x), "r" (y)) |
261 | 272 | ||
262 | # define MAD_F_MLA(hi, lo, x, y) \ | 273 | # define MAD_F_MLA(hi, lo, x, y) \ |
263 | asm ("smlal%0, %1, %2, %3" \ | 274 | asm ("smlal%0, %1, %2, %3" \ |
264 | : "+r" (lo), "+r" (hi) \ | 275 | : "+r" (lo), "+r" (hi) \ |
265 | : "%r" (x), "r" (y)) | 276 | : "%r" (x), "r" (y)) |
266 | 277 | ||
267 | # define MAD_F_MLN(hi, lo) \ | 278 | # define MAD_F_MLN(hi, lo) \ |
268 | asm ("rsbs%0, %2, #0\n\t" \ | 279 | asm ("rsbs%0, %2, #0\n\t" \ |
269 | "rsc%1, %3, #0" \ | 280 | "rsc%1, %3, #0" \ |
270 | : "=r" (lo), "=r" (hi) \ | 281 | : "=r" (lo), "=r" (hi) \ |
271 | : "0" (lo), "1" (hi) \ | 282 | : "0" (lo), "1" (hi) \ |
272 | : "cc") | 283 | : "cc") |
273 | 284 | ||
274 | # define mad_f_scale64(hi, lo) \ | 285 | # define mad_f_scale64(hi, lo) \ |
275 | ({ mad_fixed_t __result; \ | 286 | ({ mad_fixed_t __result; \ |
276 | asm ("movs%0, %1, lsr %3\n\t" \ | 287 | asm ("movs%0, %1, lsr %3\n\t" \ |
277 | "adc%0, %0, %2, lsl %4" \ | 288 | "adc%0, %0, %2, lsl %4" \ |
278 | : "=r" (__result) \ | 289 | : "=&r" (__result) \ |
279 | : "r" (lo), "r" (hi), \ | 290 | : "r" (lo), "r" (hi), \ |
280 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ | 291 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ |
281 | : "cc"); \ | 292 | : "cc"); \ |
282 | __result; \ | 293 | __result; \ |
283 | }) | 294 | }) |
284 | 295 | ||
285 | # define MAD_F_SCALEBITS MAD_F_FRACBITS | 296 | # define MAD_F_SCALEBITS MAD_F_FRACBITS |
286 | 297 | ||
287 | /* --- MIPS ---------------------------------------------------------------- */ | 298 | /* --- MIPS ---------------------------------------------------------------- */ |
288 | 299 | ||
289 | # elif defined(FPM_MIPS) | 300 | # elif defined(FPM_MIPS) |
290 | 301 | ||
291 | /* | 302 | /* |
292 | * This MIPS version is fast and accurate; the disposition of the least | 303 | * This MIPS version is fast and accurate; the disposition of the least |
293 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). | 304 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). |
294 | */ | 305 | */ |
295 | # define MAD_F_MLX(hi, lo, x, y) \ | 306 | # define MAD_F_MLX(hi, lo, x, y) \ |
296 | asm ("mult%2,%3" \ | 307 | asm ("mult%2,%3" \ |
297 | : "=l" (lo), "=h" (hi) \ | 308 | : "=l" (lo), "=h" (hi) \ |
298 | : "%r" (x), "r" (y)) | 309 | : "%r" (x), "r" (y)) |
299 | 310 | ||
300 | # if defined(HAVE_MADD_ASM) | 311 | # if defined(HAVE_MADD_ASM) |
301 | # define MAD_F_MLA(hi, lo, x, y) \ | 312 | # define MAD_F_MLA(hi, lo, x, y) \ |
302 | asm ("madd%2,%3" \ | 313 | asm ("madd%2,%3" \ |
303 | : "+l" (lo), "+h" (hi) \ | 314 | : "+l" (lo), "+h" (hi) \ |
304 | : "%r" (x), "r" (y)) | 315 | : "%r" (x), "r" (y)) |
305 | # elif defined(HAVE_MADD16_ASM) | 316 | # elif defined(HAVE_MADD16_ASM) |
306 | /* | 317 | /* |
307 | * This loses significant accuracy due to the 16-bit integer limit in the | 318 | * This loses significant accuracy due to the 16-bit integer limit in the |
308 | * multiply/accumulate instruction. | 319 | * multiply/accumulate instruction. |
309 | */ | 320 | */ |
310 | # define MAD_F_ML0(hi, lo, x, y) \ | 321 | # define MAD_F_ML0(hi, lo, x, y) \ |
311 | asm ("mult%2,%3" \ | 322 | asm ("mult%2,%3" \ |
312 | : "=l" (lo), "=h" (hi) \ | 323 | : "=l" (lo), "=h" (hi) \ |
313 | : "%r" ((x) >> 12), "r" ((y) >> 16)) | 324 | : "%r" ((x) >> 12), "r" ((y) >> 16)) |
314 | # define MAD_F_MLA(hi, lo, x, y) \ | 325 | # define MAD_F_MLA(hi, lo, x, y) \ |
315 | asm ("madd16%2,%3" \ | 326 | asm ("madd16%2,%3" \ |
316 | : "+l" (lo), "+h" (hi) \ | 327 | : "+l" (lo), "+h" (hi) \ |
317 | : "%r" ((x) >> 12), "r" ((y) >> 16)) | 328 | : "%r" ((x) >> 12), "r" ((y) >> 16)) |
318 | # define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) | 329 | # define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) |
319 | # endif | 330 | # endif |
320 | 331 | ||
321 | # if defined(OPT_SPEED) | 332 | # if defined(OPT_SPEED) |
322 | # define mad_f_scale64(hi, lo) \ | 333 | # define mad_f_scale64(hi, lo) \ |
323 | ((mad_fixed_t) ((hi) << (32 - MAD_F_SCALEBITS))) | 334 | ((mad_fixed_t) ((hi) << (32 - MAD_F_SCALEBITS))) |
324 | # define MAD_F_SCALEBITS MAD_F_FRACBITS | 335 | # define MAD_F_SCALEBITS MAD_F_FRACBITS |
325 | # endif | 336 | # endif |
326 | 337 | ||
327 | /* --- SPARC --------------------------------------------------------------- */ | 338 | /* --- SPARC --------------------------------------------------------------- */ |
328 | 339 | ||
329 | # elif defined(FPM_SPARC) | 340 | # elif defined(FPM_SPARC) |
330 | 341 | ||
331 | /* | 342 | /* |
332 | * This SPARC V8 version is fast and accurate; the disposition of the least | 343 | * This SPARC V8 version is fast and accurate; the disposition of the least |
333 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). | 344 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). |
334 | */ | 345 | */ |
335 | # define MAD_F_MLX(hi, lo, x, y) \ | 346 | # define MAD_F_MLX(hi, lo, x, y) \ |
336 | asm ("smul %2, %3, %0\n\t" \ | 347 | asm ("smul %2, %3, %0\n\t" \ |
337 | "rd %%y, %1" \ | 348 | "rd %%y, %1" \ |
338 | : "=r" (lo), "=r" (hi) \ | 349 | : "=r" (lo), "=r" (hi) \ |
339 | : "%r" (x), "rI" (y)) | 350 | : "%r" (x), "rI" (y)) |
340 | 351 | ||
341 | /* --- PowerPC ------------------------------------------------------------- */ | 352 | /* --- PowerPC ------------------------------------------------------------- */ |
342 | 353 | ||
343 | # elif defined(FPM_PPC) | 354 | # elif defined(FPM_PPC) |
344 | 355 | ||
345 | /* | 356 | /* |
346 | * This PowerPC version is tuned for the 4xx embedded processors. It is | 357 | * This PowerPC version is fast and accurate; the disposition of the least |
347 | * effectively a tuned version of FPM_64BIT. It is a little faster and just | 358 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). |
348 | * as accurate. The disposition of the least significant bit depends on | ||
349 | * OPT_ACCURACY via mad_f_scale64(). | ||
350 | */ | 359 | */ |
351 | # define MAD_F_MLX(hi, lo, x, y) \ | 360 | # define MAD_F_MLX(hi, lo, x, y) \ |
352 | asm ("mulhw %1, %2, %3\n\t" \ | 361 | do { \ |
353 | "mullw %0, %2, %3" \ | 362 | asm ("mullw %0,%1,%2" \ |
354 | : "=&r" (lo), "=&r" (hi) \ | 363 | : "=r" (lo) \ |
355 | : "%r" (x), "r" (y)) | 364 | : "%r" (x), "r" (y)); \ |
365 | asm ("mulhw %0,%1,%2" \ | ||
366 | : "=r" (hi) \ | ||
367 | : "%r" (x), "r" (y)); \ | ||
368 | } \ | ||
369 | while (0) | ||
356 | 370 | ||
357 | # define MAD_F_MLA(hi, lo, x, y) \ | 371 | # if defined(OPT_ACCURACY) |
372 | /* | ||
373 | * This gives best accuracy but is not very fast. | ||
374 | */ | ||
375 | # define MAD_F_MLA(hi, lo, x, y) \ | ||
358 | ({ mad_fixed64hi_t __hi; \ | 376 | ({ mad_fixed64hi_t __hi; \ |
359 | mad_fixed64lo_t __lo; \ | 377 | mad_fixed64lo_t __lo; \ |
360 | MAD_F_MLX(__hi, __lo, (x), (y)); \ | 378 | MAD_F_MLX(__hi, __lo, (x), (y)); \ |
361 | asm ("addc %0, %2, %3\n\t" \ | 379 | asm ("addc %0,%2,%3\n\t" \ |
362 | "adde %1, %4, %5" \ | 380 | "adde %1,%4,%5" \ |
363 | : "=r" (lo), "=r" (hi) \ | 381 | : "=r" (lo), "=r" (hi) \ |
364 | : "%r" (__lo), "0" (lo), "%r" (__hi), "1" (hi)); \ | 382 | : "%r" (lo), "r" (__lo), \ |
383 | "%r" (hi), "r" (__hi) \ | ||
384 | : "xer"); \ | ||
365 | }) | 385 | }) |
386 | # endif | ||
366 | 387 | ||
367 | # if defined(OPT_ACCURACY) | 388 | # if defined(OPT_ACCURACY) |
368 | /* | 389 | /* |
369 | * This is accurate and ~2 - 2.5 times slower than the unrounded version. | 390 | * This is slower than the truncating version below it. |
370 | * | ||
371 | * The __volatile__ improves the generated code by another 5% (fewer spills | ||
372 | * to memory); eventually they should be removed. | ||
373 | */ | 391 | */ |
374 | # define mad_f_scale64(hi, lo) \ | 392 | # define mad_f_scale64(hi, lo) \ |
375 | ({ mad_fixed_t __result; \ | 393 | ({ mad_fixed_t __result, __round; \ |
376 | mad_fixed64hi_t __hi_; \ | 394 | asm ("rotrwi %0,%1,%2" \ |
377 | mad_fixed64lo_t __lo_; \ | 395 | : "=r" (__result) \ |
378 | asm __volatile__ ("addc %0, %2, %4\n\t" \ | 396 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ |
379 | "addze %1, %3" \ | 397 | asm ("extrwi %0,%1,1,0" \ |
380 | : "=r" (__lo_), "=r" (__hi_) \ | 398 | : "=r" (__round) \ |
381 | : "r" (lo), "r" (hi), "r" (1 << (MAD_F_SCALEBITS - 1))); \ | 399 | : "r" (__result)); \ |
382 | asm __volatile__ ("rlwinm %0, %2,32-%3,0,%3-1\n\t" \ | 400 | asm ("insrwi %0,%1,%2,0" \ |
383 | "rlwimi %0, %1,32-%3,%3,31" \ | 401 | : "+r" (__result) \ |
384 | : "=&r" (__result) \ | 402 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ |
385 | : "r" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS)); \ | 403 | asm ("add %0,%1,%2" \ |
386 | __result; \ | 404 | : "=r" (__result) \ |
405 | : "%r" (__result), "r" (__round)); \ | ||
406 | __result; \ | ||
387 | }) | 407 | }) |
388 | # else | 408 | # else |
389 | # define mad_f_scale64(hi, lo) \ | 409 | # define mad_f_scale64(hi, lo) \ |
390 | ({ mad_fixed_t __result; \ | 410 | ({ mad_fixed_t __result; \ |
391 | asm ("rlwinm %0, %2,32-%3,0,%3-1\n\t" \ | 411 | asm ("rotrwi %0,%1,%2" \ |
392 | "rlwimi %0, %1,32-%3,%3,31" \ | ||
393 | : "=r" (__result) \ | 412 | : "=r" (__result) \ |
394 | : "r" (lo), "r" (hi), "I" (MAD_F_SCALEBITS)); \ | 413 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ |
395 | __result; \ | 414 | asm ("insrwi %0,%1,%2,0" \ |
415 | : "+r" (__result) \ | ||
416 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ | ||
417 | __result; \ | ||
396 | }) | 418 | }) |
397 | # endif /* OPT_ACCURACY */ | 419 | # endif |
398 | 420 | ||
399 | # define MAD_F_SCALEBITS MAD_F_FRACBITS | 421 | # define MAD_F_SCALEBITS MAD_F_FRACBITS |
400 | 422 | ||
401 | /* --- Default ------------------------------------------------------------- */ | 423 | /* --- Default ------------------------------------------------------------- */ |
402 | 424 | ||
403 | # elif defined(FPM_DEFAULT) | 425 | # elif defined(FPM_DEFAULT) |
404 | 426 | ||
405 | /* | 427 | /* |
406 | * This version is the most portable but it loses significant accuracy. | 428 | * This version is the most portable but it loses significant accuracy. |
407 | * Furthermore, accuracy is biased against the second argument, so care | 429 | * Furthermore, accuracy is biased against the second argument, so care |
408 | * should be taken when ordering operands. | 430 | * should be taken when ordering operands. |
409 | * | 431 | * |
410 | * The scale factors are constant as this is not used with SSO. | 432 | * The scale factors are constant as this is not used with SSO. |
411 | * | 433 | * |
412 | * Pre-rounding is required to stay within the limits of compliance. | 434 | * Pre-rounding is required to stay within the limits of compliance. |
413 | */ | 435 | */ |
414 | # if defined(OPT_SPEED) | 436 | # if defined(OPT_SPEED) |
415 | # define mad_f_mul(x, y)(((x) >> 12) * ((y) >> 16)) | 437 | # define mad_f_mul(x, y)(((x) >> 12) * ((y) >> 16)) |
416 | # else | 438 | # else |
417 | # define mad_f_mul(x, y)((((x) + (1L << 11)) >> 12) * \ | 439 | # define mad_f_mul(x, y)((((x) + (1L << 11)) >> 12) * \ |
418 | (((y) + (1L << 15)) >> 16)) | 440 | (((y) + (1L << 15)) >> 16)) |
419 | # endif | 441 | # endif |
420 | 442 | ||
421 | /* ------------------------------------------------------------------------- */ | 443 | /* ------------------------------------------------------------------------- */ |
422 | 444 | ||
423 | # else | 445 | # else |
424 | # error "no FPM selected" | 446 | # error "no FPM selected" |
425 | # endif | 447 | # endif |
426 | 448 | ||
427 | /* default implementations */ | 449 | /* default implementations */ |
428 | 450 | ||
429 | # if !defined(mad_f_mul) | 451 | # if !defined(mad_f_mul) |
430 | # define mad_f_mul(x, y) \ | 452 | # define mad_f_mul(x, y) \ |
431 | ({ mad_fixed64hi_t __hi; \ | 453 | ({ register mad_fixed64hi_t __hi; \ |
432 | mad_fixed64lo_t __lo; \ | 454 | register mad_fixed64lo_t __lo; \ |
433 | MAD_F_MLX(__hi, __lo, (x), (y)); \ | 455 | MAD_F_MLX(__hi, __lo, (x), (y)); \ |
434 | mad_f_scale64(__hi, __lo); \ | 456 | mad_f_scale64(__hi, __lo); \ |
435 | }) | 457 | }) |
436 | # endif | 458 | # endif |
437 | 459 | ||
438 | # if !defined(MAD_F_MLA) | 460 | # if !defined(MAD_F_MLA) |
439 | # define MAD_F_ML0(hi, lo, x, y)((lo) = mad_f_mul((x), (y))) | 461 | # define MAD_F_ML0(hi, lo, x, y)((lo) = mad_f_mul((x), (y))) |
440 | # define MAD_F_MLA(hi, lo, x, y)((lo) += mad_f_mul((x), (y))) | 462 | # define MAD_F_MLA(hi, lo, x, y)((lo) += mad_f_mul((x), (y))) |
441 | # define MAD_F_MLN(hi, lo) ((lo) = -(lo)) | 463 | # define MAD_F_MLN(hi, lo) ((lo) = -(lo)) |
442 | # define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) | 464 | # define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) |
443 | # endif | 465 | # endif |
444 | 466 | ||
445 | # if !defined(MAD_F_ML0) | 467 | # if !defined(MAD_F_ML0) |
446 | # define MAD_F_ML0(hi, lo, x, y)MAD_F_MLX((hi), (lo), (x), (y)) | 468 | # define MAD_F_ML0(hi, lo, x, y)MAD_F_MLX((hi), (lo), (x), (y)) |
447 | # endif | 469 | # endif |
448 | 470 | ||
449 | # if !defined(MAD_F_MLN) | 471 | # if !defined(MAD_F_MLN) |
450 | # define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) | 472 | # define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) |
451 | # endif | 473 | # endif |
452 | 474 | ||
453 | # if !defined(MAD_F_MLZ) | 475 | # if !defined(MAD_F_MLZ) |
454 | # define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) | 476 | # define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) |
455 | # endif | 477 | # endif |
456 | 478 | ||
457 | # if !defined(mad_f_scale64) | 479 | # if !defined(mad_f_scale64) |
458 | # if defined(OPT_ACCURACY) | 480 | # if defined(OPT_ACCURACY) |
459 | # define mad_f_scale64(hi, lo) \ | 481 | # define mad_f_scale64(hi, lo) \ |
460 | ((((mad_fixed_t) \ | 482 | ((((mad_fixed_t) \ |
461 | (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \ | 483 | (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \ |
462 | ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) | 484 | ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) |
463 | # else | 485 | # else |
464 | # define mad_f_scale64(hi, lo) \ | 486 | # define mad_f_scale64(hi, lo) \ |
465 | ((mad_fixed_t) \ | 487 | ((mad_fixed_t) \ |
466 | (((hi) << (32 - MAD_F_SCALEBITS)) | \ | 488 | (((hi) << (32 - MAD_F_SCALEBITS)) | \ |
467 | ((lo) >> MAD_F_SCALEBITS))) | 489 | ((lo) >> MAD_F_SCALEBITS))) |
468 | # endif | 490 | # endif |
469 | # define MAD_F_SCALEBITS MAD_F_FRACBITS | 491 | # define MAD_F_SCALEBITS MAD_F_FRACBITS |
470 | # endif | 492 | # endif |
471 | 493 | ||
472 | /* miscellaneous C routines */ | 494 | /* C routines */ |
473 | 495 | ||
474 | mad_fixed_t mad_f_abs(mad_fixed_t); | 496 | mad_fixed_t mad_f_abs(mad_fixed_t); |
497 | mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t); | ||
475 | 498 | ||
476 | # endif | 499 | # endif |
diff --git a/core/multimedia/opieplayer/libmad/frame.c b/core/multimedia/opieplayer/libmad/frame.c index bf15e7f..3aacb56 100644 --- a/core/multimedia/opieplayer/libmad/frame.c +++ b/core/multimedia/opieplayer/libmad/frame.c | |||
@@ -1,499 +1,503 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifdef HAVE_CONFIG_H | 22 | # ifdef HAVE_CONFIG_H |
23 | # include "libmad_config.h" | 23 | # include "libmad_config.h" |
24 | # endif | 24 | # endif |
25 | 25 | ||
26 | # include "libmad_global.h" | 26 | # include "libmad_global.h" |
27 | 27 | ||
28 | # include <stdlib.h> | 28 | # include <stdlib.h> |
29 | 29 | ||
30 | # include "bit.h" | 30 | # include "bit.h" |
31 | # include "stream.h" | 31 | # include "stream.h" |
32 | # include "frame.h" | 32 | # include "frame.h" |
33 | # include "timer.h" | 33 | # include "timer.h" |
34 | # include "layer12.h" | 34 | # include "layer12.h" |
35 | # include "layer3.h" | 35 | # include "layer3.h" |
36 | 36 | ||
37 | static | 37 | static |
38 | unsigned long const bitrate_table[5][15] = { | 38 | unsigned long const bitrate_table[5][15] = { |
39 | /* MPEG-1 */ | 39 | /* MPEG-1 */ |
40 | { 0, 32000, 64000, 96000, 128000, 160000, 192000, 224000, /* Layer I */ | 40 | { 0, 32000, 64000, 96000, 128000, 160000, 192000, 224000, /* Layer I */ |
41 | 256000, 288000, 320000, 352000, 384000, 416000, 448000 }, | 41 | 256000, 288000, 320000, 352000, 384000, 416000, 448000 }, |
42 | { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer II */ | 42 | { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer II */ |
43 | 128000, 160000, 192000, 224000, 256000, 320000, 384000 }, | 43 | 128000, 160000, 192000, 224000, 256000, 320000, 384000 }, |
44 | { 0, 32000, 40000, 48000, 56000, 64000, 80000, 96000, /* Layer III */ | 44 | { 0, 32000, 40000, 48000, 56000, 64000, 80000, 96000, /* Layer III */ |
45 | 112000, 128000, 160000, 192000, 224000, 256000, 320000 }, | 45 | 112000, 128000, 160000, 192000, 224000, 256000, 320000 }, |
46 | 46 | ||
47 | /* MPEG-2 LSF */ | 47 | /* MPEG-2 LSF */ |
48 | { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer I */ | 48 | { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer I */ |
49 | 128000, 144000, 160000, 176000, 192000, 224000, 256000 }, | 49 | 128000, 144000, 160000, 176000, 192000, 224000, 256000 }, |
50 | { 0, 8000, 16000, 24000, 32000, 40000, 48000, 56000, /* Layers */ | 50 | { 0, 8000, 16000, 24000, 32000, 40000, 48000, 56000, /* Layers */ |
51 | 64000, 80000, 96000, 112000, 128000, 144000, 160000 } /* II & III */ | 51 | 64000, 80000, 96000, 112000, 128000, 144000, 160000 } /* II & III */ |
52 | }; | 52 | }; |
53 | 53 | ||
54 | static | 54 | static |
55 | unsigned int const samplerate_table[3] = { 44100, 48000, 32000 }; | 55 | unsigned int const samplerate_table[3] = { 44100, 48000, 32000 }; |
56 | 56 | ||
57 | static | 57 | static |
58 | int (*const decoder_table[3])(struct mad_stream *, struct mad_frame *) = { | 58 | int (*const decoder_table[3])(struct mad_stream *, struct mad_frame *) = { |
59 | mad_layer_I, | 59 | mad_layer_I, |
60 | mad_layer_II, | 60 | mad_layer_II, |
61 | mad_layer_III | 61 | mad_layer_III |
62 | }; | 62 | }; |
63 | 63 | ||
64 | /* | 64 | /* |
65 | * NAME:header->init() | 65 | * NAME:header->init() |
66 | * DESCRIPTION:initialize header struct | 66 | * DESCRIPTION:initialize header struct |
67 | */ | 67 | */ |
68 | void mad_header_init(struct mad_header *header) | 68 | void mad_header_init(struct mad_header *header) |
69 | { | 69 | { |
70 | header->layer = 0; | 70 | header->layer = 0; |
71 | header->mode = 0; | 71 | header->mode = 0; |
72 | header->mode_extension = 0; | 72 | header->mode_extension = 0; |
73 | header->emphasis = 0; | 73 | header->emphasis = 0; |
74 | 74 | ||
75 | header->bitrate = 0; | 75 | header->bitrate = 0; |
76 | header->samplerate = 0; | 76 | header->samplerate = 0; |
77 | 77 | ||
78 | header->crc_check = 0; | 78 | header->crc_check = 0; |
79 | header->crc_target = 0; | 79 | header->crc_target = 0; |
80 | 80 | ||
81 | header->flags = 0; | 81 | header->flags = 0; |
82 | header->private_bits = 0; | 82 | header->private_bits = 0; |
83 | 83 | ||
84 | header->duration = mad_timer_zero; | 84 | header->duration = mad_timer_zero; |
85 | } | 85 | } |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * NAME:frame->init() | 88 | * NAME:frame->init() |
89 | * DESCRIPTION:initialize frame struct | 89 | * DESCRIPTION:initialize frame struct |
90 | */ | 90 | */ |
91 | void mad_frame_init(struct mad_frame *frame) | 91 | void mad_frame_init(struct mad_frame *frame) |
92 | { | 92 | { |
93 | mad_header_init(&frame->header); | 93 | mad_header_init(&frame->header); |
94 | 94 | ||
95 | frame->options = 0; | 95 | frame->options = 0; |
96 | 96 | ||
97 | frame->overlap = 0; | 97 | frame->overlap = 0; |
98 | mad_frame_mute(frame); | 98 | mad_frame_mute(frame); |
99 | } | 99 | } |
100 | 100 | ||
101 | /* | 101 | /* |
102 | * NAME:frame->finish() | 102 | * NAME:frame->finish() |
103 | * DESCRIPTION:deallocate any dynamic memory associated with frame | 103 | * DESCRIPTION:deallocate any dynamic memory associated with frame |
104 | */ | 104 | */ |
105 | void mad_frame_finish(struct mad_frame *frame) | 105 | void mad_frame_finish(struct mad_frame *frame) |
106 | { | 106 | { |
107 | mad_header_finish(&frame->header); | 107 | mad_header_finish(&frame->header); |
108 | 108 | ||
109 | if (frame->overlap) { | 109 | if (frame->overlap) { |
110 | free(frame->overlap); | 110 | free(frame->overlap); |
111 | frame->overlap = 0; | 111 | frame->overlap = 0; |
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 | ||
115 | /* | 115 | /* |
116 | * NAME:decode_header() | 116 | * NAME:decode_header() |
117 | * DESCRIPTION:read header data and following CRC word | 117 | * DESCRIPTION:read header data and following CRC word |
118 | */ | 118 | */ |
119 | static | 119 | static |
120 | int decode_header(struct mad_header *header, struct mad_stream *stream) | 120 | int decode_header(struct mad_header *header, struct mad_stream *stream) |
121 | { | 121 | { |
122 | unsigned int index; | 122 | unsigned int index; |
123 | 123 | ||
124 | header->flags = 0; | 124 | header->flags = 0; |
125 | header->private_bits = 0; | 125 | header->private_bits = 0; |
126 | 126 | ||
127 | /* header() */ | 127 | /* header() */ |
128 | 128 | ||
129 | /* syncword */ | 129 | /* syncword */ |
130 | mad_bit_skip(&stream->ptr, 11); | 130 | mad_bit_skip(&stream->ptr, 11); |
131 | 131 | ||
132 | /* MPEG 2.5 indicator (really part of syncword) */ | 132 | /* MPEG 2.5 indicator (really part of syncword) */ |
133 | if (mad_bit_read(&stream->ptr, 1) == 0) | 133 | if (mad_bit_read(&stream->ptr, 1) == 0) |
134 | header->flags |= MAD_FLAG_MPEG_2_5_EXT; | 134 | header->flags |= MAD_FLAG_MPEG_2_5_EXT; |
135 | 135 | ||
136 | /* ID */ | 136 | /* ID */ |
137 | if (mad_bit_read(&stream->ptr, 1) == 0) | 137 | if (mad_bit_read(&stream->ptr, 1) == 0) |
138 | header->flags |= MAD_FLAG_LSF_EXT; | 138 | header->flags |= MAD_FLAG_LSF_EXT; |
139 | else if (header->flags & MAD_FLAG_MPEG_2_5_EXT) { | 139 | else if (header->flags & MAD_FLAG_MPEG_2_5_EXT) { |
140 | stream->error = MAD_ERROR_LOSTSYNC; | 140 | stream->error = MAD_ERROR_LOSTSYNC; |
141 | return -1; | 141 | return -1; |
142 | } | 142 | } |
143 | 143 | ||
144 | /* layer */ | 144 | /* layer */ |
145 | header->layer = 4 - mad_bit_read(&stream->ptr, 2); | 145 | header->layer = 4 - mad_bit_read(&stream->ptr, 2); |
146 | 146 | ||
147 | if (header->layer == 4) { | 147 | if (header->layer == 4) { |
148 | stream->error = MAD_ERROR_BADLAYER; | 148 | stream->error = MAD_ERROR_BADLAYER; |
149 | return -1; | 149 | return -1; |
150 | } | 150 | } |
151 | 151 | ||
152 | /* protection_bit */ | 152 | /* protection_bit */ |
153 | if (mad_bit_read(&stream->ptr, 1) == 0) { | 153 | if (mad_bit_read(&stream->ptr, 1) == 0) { |
154 | header->flags |= MAD_FLAG_PROTECTION; | 154 | header->flags |= MAD_FLAG_PROTECTION; |
155 | header->crc_check = mad_bit_crc(stream->ptr, 16, 0xffff); | 155 | header->crc_check = mad_bit_crc(stream->ptr, 16, 0xffff); |
156 | } | 156 | } |
157 | 157 | ||
158 | /* bitrate_index */ | 158 | /* bitrate_index */ |
159 | index = mad_bit_read(&stream->ptr, 4); | 159 | index = mad_bit_read(&stream->ptr, 4); |
160 | 160 | ||
161 | if (index == 15) { | 161 | if (index == 15) { |
162 | stream->error = MAD_ERROR_BADBITRATE; | 162 | stream->error = MAD_ERROR_BADBITRATE; |
163 | return -1; | 163 | return -1; |
164 | } | 164 | } |
165 | 165 | ||
166 | if (header->flags & MAD_FLAG_LSF_EXT) | 166 | if (header->flags & MAD_FLAG_LSF_EXT) |
167 | header->bitrate = bitrate_table[3 + (header->layer >> 1)][index]; | 167 | header->bitrate = bitrate_table[3 + (header->layer >> 1)][index]; |
168 | else | 168 | else |
169 | header->bitrate = bitrate_table[header->layer - 1][index]; | 169 | header->bitrate = bitrate_table[header->layer - 1][index]; |
170 | 170 | ||
171 | /* sampling_frequency */ | 171 | /* sampling_frequency */ |
172 | index = mad_bit_read(&stream->ptr, 2); | 172 | index = mad_bit_read(&stream->ptr, 2); |
173 | 173 | ||
174 | if (index == 3) { | 174 | if (index == 3) { |
175 | stream->error = MAD_ERROR_BADSAMPLERATE; | 175 | stream->error = MAD_ERROR_BADSAMPLERATE; |
176 | return -1; | 176 | return -1; |
177 | } | 177 | } |
178 | 178 | ||
179 | header->samplerate = samplerate_table[index]; | 179 | header->samplerate = samplerate_table[index]; |
180 | 180 | ||
181 | if (header->flags & MAD_FLAG_LSF_EXT) { | 181 | if (header->flags & MAD_FLAG_LSF_EXT) { |
182 | header->samplerate /= 2; | 182 | header->samplerate /= 2; |
183 | 183 | ||
184 | if (header->flags & MAD_FLAG_MPEG_2_5_EXT) | 184 | if (header->flags & MAD_FLAG_MPEG_2_5_EXT) |
185 | header->samplerate /= 2; | 185 | header->samplerate /= 2; |
186 | } | 186 | } |
187 | 187 | ||
188 | /* padding_bit */ | 188 | /* padding_bit */ |
189 | if (mad_bit_read(&stream->ptr, 1)) | 189 | if (mad_bit_read(&stream->ptr, 1)) |
190 | header->flags |= MAD_FLAG_PADDING; | 190 | header->flags |= MAD_FLAG_PADDING; |
191 | 191 | ||
192 | /* private_bit */ | 192 | /* private_bit */ |
193 | if (mad_bit_read(&stream->ptr, 1)) | 193 | if (mad_bit_read(&stream->ptr, 1)) |
194 | header->private_bits |= MAD_PRIVATE_HEADER; | 194 | header->private_bits |= MAD_PRIVATE_HEADER; |
195 | 195 | ||
196 | /* mode */ | 196 | /* mode */ |
197 | header->mode = 3 - mad_bit_read(&stream->ptr, 2); | 197 | header->mode = 3 - mad_bit_read(&stream->ptr, 2); |
198 | 198 | ||
199 | /* mode_extension */ | 199 | /* mode_extension */ |
200 | header->mode_extension = mad_bit_read(&stream->ptr, 2); | 200 | header->mode_extension = mad_bit_read(&stream->ptr, 2); |
201 | 201 | ||
202 | /* copyright */ | 202 | /* copyright */ |
203 | if (mad_bit_read(&stream->ptr, 1)) | 203 | if (mad_bit_read(&stream->ptr, 1)) |
204 | header->flags |= MAD_FLAG_COPYRIGHT; | 204 | header->flags |= MAD_FLAG_COPYRIGHT; |
205 | 205 | ||
206 | /* original/copy */ | 206 | /* original/copy */ |
207 | if (mad_bit_read(&stream->ptr, 1)) | 207 | if (mad_bit_read(&stream->ptr, 1)) |
208 | header->flags |= MAD_FLAG_ORIGINAL; | 208 | header->flags |= MAD_FLAG_ORIGINAL; |
209 | 209 | ||
210 | /* emphasis */ | 210 | /* emphasis */ |
211 | header->emphasis = mad_bit_read(&stream->ptr, 2); | 211 | header->emphasis = mad_bit_read(&stream->ptr, 2); |
212 | 212 | ||
213 | if (header->emphasis == 2) { | 213 | # if defined(OPT_STRICT) |
214 | /* | ||
215 | * ISO/IEC 11172-3 says this is a reserved emphasis value, but | ||
216 | * streams exist which use it anyway. Since the value is not important | ||
217 | * to the decoder proper, we allow it unless OPT_STRICT is defined. | ||
218 | */ | ||
219 | if (header->emphasis == MAD_EMPHASIS_RESERVED) { | ||
214 | stream->error = MAD_ERROR_BADEMPHASIS; | 220 | stream->error = MAD_ERROR_BADEMPHASIS; |
215 | return -1; | 221 | return -1; |
216 | } | 222 | } |
223 | # endif | ||
217 | 224 | ||
218 | /* error_check() */ | 225 | /* error_check() */ |
219 | 226 | ||
220 | /* crc_check */ | 227 | /* crc_check */ |
221 | if (header->flags & MAD_FLAG_PROTECTION) | 228 | if (header->flags & MAD_FLAG_PROTECTION) |
222 | header->crc_target = mad_bit_read(&stream->ptr, 16); | 229 | header->crc_target = mad_bit_read(&stream->ptr, 16); |
223 | 230 | ||
224 | return 0; | 231 | return 0; |
225 | } | 232 | } |
226 | 233 | ||
227 | /* | 234 | /* |
228 | * NAME:free_bitrate() | 235 | * NAME:free_bitrate() |
229 | * DESCRIPTION:attempt to discover the bitstream's free bitrate | 236 | * DESCRIPTION:attempt to discover the bitstream's free bitrate |
230 | */ | 237 | */ |
231 | static | 238 | static |
232 | int free_bitrate(struct mad_stream *stream, struct mad_header const *header) | 239 | int free_bitrate(struct mad_stream *stream, struct mad_header const *header) |
233 | { | 240 | { |
234 | struct mad_bitptr keep_ptr; | 241 | struct mad_bitptr keep_ptr; |
235 | unsigned long rate = 0; | 242 | unsigned long rate = 0; |
236 | unsigned int pad_slot, slots_per_frame; | 243 | unsigned int pad_slot, slots_per_frame; |
237 | unsigned char const *ptr = 0; | 244 | unsigned char const *ptr = 0; |
238 | 245 | ||
239 | keep_ptr = stream->ptr; | 246 | keep_ptr = stream->ptr; |
240 | 247 | ||
241 | pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0; | 248 | pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0; |
242 | slots_per_frame = (header->layer == MAD_LAYER_III && | 249 | slots_per_frame = (header->layer == MAD_LAYER_III && |
243 | (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; | 250 | (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; |
244 | 251 | ||
245 | while (mad_stream_sync(stream) == 0) { | 252 | while (mad_stream_sync(stream) == 0) { |
246 | struct mad_stream peek_stream; | 253 | struct mad_stream peek_stream; |
247 | struct mad_header peek_header; | 254 | struct mad_header peek_header; |
248 | 255 | ||
249 | peek_stream = *stream; | 256 | peek_stream = *stream; |
250 | peek_header = *header; | 257 | peek_header = *header; |
251 | 258 | ||
252 | if (decode_header(&peek_header, &peek_stream) == 0 && | 259 | if (decode_header(&peek_header, &peek_stream) == 0 && |
253 | peek_header.layer == header->layer && | 260 | peek_header.layer == header->layer && |
254 | peek_header.samplerate == header->samplerate) { | 261 | peek_header.samplerate == header->samplerate) { |
255 | unsigned int N; | 262 | unsigned int N; |
256 | 263 | ||
257 | ptr = mad_bit_nextbyte(&stream->ptr); | 264 | ptr = mad_bit_nextbyte(&stream->ptr); |
258 | 265 | ||
259 | N = ptr - stream->this_frame; | 266 | N = ptr - stream->this_frame; |
260 | 267 | ||
261 | if (header->layer == MAD_LAYER_I) { | 268 | if (header->layer == MAD_LAYER_I) { |
262 | rate = (unsigned long) header->samplerate * | 269 | rate = (unsigned long) header->samplerate * |
263 | (N - 4 * pad_slot + 4) / 48 / 1000; | 270 | (N - 4 * pad_slot + 4) / 48 / 1000; |
264 | } | 271 | } |
265 | else { | 272 | else { |
266 | rate = (unsigned long) header->samplerate * | 273 | rate = (unsigned long) header->samplerate * |
267 | (N - pad_slot + 1) / slots_per_frame / 1000; | 274 | (N - pad_slot + 1) / slots_per_frame / 1000; |
268 | } | 275 | } |
269 | 276 | ||
270 | if (rate >= 8) | 277 | if (rate >= 8) |
271 | break; | 278 | break; |
272 | } | 279 | } |
273 | 280 | ||
274 | mad_bit_skip(&stream->ptr, 8); | 281 | mad_bit_skip(&stream->ptr, 8); |
275 | } | 282 | } |
276 | 283 | ||
277 | stream->ptr = keep_ptr; | 284 | stream->ptr = keep_ptr; |
278 | 285 | ||
279 | if (rate < 8 || (header->layer == MAD_LAYER_III && rate > 640)) { | 286 | if (rate < 8 || (header->layer == MAD_LAYER_III && rate > 640)) { |
280 | stream->error = MAD_ERROR_LOSTSYNC; | 287 | stream->error = MAD_ERROR_LOSTSYNC; |
281 | return -1; | 288 | return -1; |
282 | } | 289 | } |
283 | 290 | ||
284 | stream->freerate = rate * 1000; | 291 | stream->freerate = rate * 1000; |
285 | 292 | ||
286 | # if 0 && defined(DEBUG) | ||
287 | fprintf(stderr, "free bitrate == %lu\n", stream->freerate); | ||
288 | # endif | ||
289 | |||
290 | return 0; | 293 | return 0; |
291 | } | 294 | } |
292 | 295 | ||
293 | /* | 296 | /* |
294 | * NAME:header->decode() | 297 | * NAME:header->decode() |
295 | * DESCRIPTION:read the next frame header from the stream | 298 | * DESCRIPTION:read the next frame header from the stream |
296 | */ | 299 | */ |
297 | int mad_header_decode(struct mad_header *header, struct mad_stream *stream) | 300 | int mad_header_decode(struct mad_header *header, struct mad_stream *stream) |
298 | { | 301 | { |
299 | register unsigned char const *ptr, *end; | 302 | register unsigned char const *ptr, *end; |
300 | unsigned int pad_slot, N; | 303 | unsigned int pad_slot, N; |
301 | 304 | ||
302 | ptr = stream->next_frame; | 305 | ptr = stream->next_frame; |
303 | end = stream->bufend; | 306 | end = stream->bufend; |
304 | 307 | ||
305 | if (ptr == 0) { | 308 | if (ptr == 0) { |
306 | stream->error = MAD_ERROR_BUFPTR; | 309 | stream->error = MAD_ERROR_BUFPTR; |
307 | goto fail; | 310 | goto fail; |
308 | } | 311 | } |
309 | 312 | ||
310 | /* stream skip */ | 313 | /* stream skip */ |
311 | if (stream->skiplen) { | 314 | if (stream->skiplen) { |
312 | if (!stream->sync) | 315 | if (!stream->sync) |
313 | ptr = stream->this_frame; | 316 | ptr = stream->this_frame; |
314 | 317 | ||
315 | if (end - ptr < stream->skiplen) { | 318 | if (end - ptr < stream->skiplen) { |
316 | stream->skiplen -= end - ptr; | 319 | stream->skiplen -= end - ptr; |
317 | stream->next_frame = end; | 320 | stream->next_frame = end; |
318 | 321 | ||
319 | stream->error = MAD_ERROR_BUFLEN; | 322 | stream->error = MAD_ERROR_BUFLEN; |
320 | goto fail; | 323 | goto fail; |
321 | } | 324 | } |
322 | 325 | ||
323 | ptr += stream->skiplen; | 326 | ptr += stream->skiplen; |
324 | stream->skiplen = 0; | 327 | stream->skiplen = 0; |
325 | 328 | ||
326 | stream->sync = 1; | 329 | stream->sync = 1; |
327 | } | 330 | } |
328 | 331 | ||
329 | sync: | 332 | sync: |
330 | /* synchronize */ | 333 | /* synchronize */ |
331 | if (stream->sync) { | 334 | if (stream->sync) { |
332 | if (end - ptr < MAD_BUFFER_GUARD) { | 335 | if (end - ptr < MAD_BUFFER_GUARD) { |
333 | stream->next_frame = ptr; | 336 | stream->next_frame = ptr; |
334 | 337 | ||
335 | stream->error = MAD_ERROR_BUFLEN; | 338 | stream->error = MAD_ERROR_BUFLEN; |
336 | goto fail; | 339 | goto fail; |
337 | } | 340 | } |
338 | else if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) { | 341 | else if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) { |
339 | /* mark point where frame sync word was expected */ | 342 | /* mark point where frame sync word was expected */ |
340 | stream->this_frame = ptr; | 343 | stream->this_frame = ptr; |
341 | stream->next_frame = ptr + 1; | 344 | stream->next_frame = ptr + 1; |
342 | 345 | ||
343 | stream->error = MAD_ERROR_LOSTSYNC; | 346 | stream->error = MAD_ERROR_LOSTSYNC; |
344 | goto fail; | 347 | goto fail; |
345 | } | 348 | } |
346 | } | 349 | } |
347 | else { | 350 | else { |
348 | mad_bit_init(&stream->ptr, ptr); | 351 | mad_bit_init(&stream->ptr, ptr); |
349 | 352 | ||
350 | if (mad_stream_sync(stream) == -1) { | 353 | if (mad_stream_sync(stream) == -1) { |
351 | if (end - stream->next_frame >= MAD_BUFFER_GUARD) | 354 | if (end - stream->next_frame >= MAD_BUFFER_GUARD) |
352 | stream->next_frame = end - MAD_BUFFER_GUARD; | 355 | stream->next_frame = end - MAD_BUFFER_GUARD; |
353 | 356 | ||
354 | stream->error = MAD_ERROR_BUFLEN; | 357 | stream->error = MAD_ERROR_BUFLEN; |
355 | goto fail; | 358 | goto fail; |
356 | } | 359 | } |
357 | 360 | ||
358 | ptr = mad_bit_nextbyte(&stream->ptr); | 361 | ptr = mad_bit_nextbyte(&stream->ptr); |
359 | } | 362 | } |
360 | 363 | ||
361 | /* begin processing */ | 364 | /* begin processing */ |
362 | stream->this_frame = ptr; | 365 | stream->this_frame = ptr; |
363 | stream->next_frame = ptr + 1; /* possibly bogus sync word */ | 366 | stream->next_frame = ptr + 1; /* possibly bogus sync word */ |
364 | 367 | ||
365 | mad_bit_init(&stream->ptr, stream->this_frame); | 368 | mad_bit_init(&stream->ptr, stream->this_frame); |
366 | 369 | ||
367 | if (decode_header(header, stream) == -1) | 370 | if (decode_header(header, stream) == -1) |
368 | goto fail; | 371 | goto fail; |
369 | 372 | ||
370 | /* calculate frame duration */ | 373 | /* calculate frame duration */ |
371 | mad_timer_set(&header->duration, 0, | 374 | mad_timer_set(&header->duration, 0, |
372 | 32 * MAD_NSBSAMPLES(header), header->samplerate); | 375 | 32 * MAD_NSBSAMPLES(header), header->samplerate); |
373 | 376 | ||
374 | /* calculate free bit rate */ | 377 | /* calculate free bit rate */ |
375 | if (header->bitrate == 0) { | 378 | if (header->bitrate == 0) { |
376 | if ((stream->freerate == 0 || !stream->sync) && | 379 | if ((stream->freerate == 0 || !stream->sync || |
380 | (header->layer == MAD_LAYER_III && stream->freerate > 640000)) && | ||
377 | free_bitrate(stream, header) == -1) | 381 | free_bitrate(stream, header) == -1) |
378 | goto fail; | 382 | goto fail; |
379 | 383 | ||
380 | header->bitrate = stream->freerate; | 384 | header->bitrate = stream->freerate; |
381 | header->flags |= MAD_FLAG_FREEFORMAT; | 385 | header->flags |= MAD_FLAG_FREEFORMAT; |
382 | } | 386 | } |
383 | 387 | ||
384 | /* calculate beginning of next frame */ | 388 | /* calculate beginning of next frame */ |
385 | pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0; | 389 | pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0; |
386 | 390 | ||
387 | if (header->layer == MAD_LAYER_I) | 391 | if (header->layer == MAD_LAYER_I) |
388 | N = ((12 * header->bitrate / header->samplerate) + pad_slot) * 4; | 392 | N = ((12 * header->bitrate / header->samplerate) + pad_slot) * 4; |
389 | else { | 393 | else { |
390 | unsigned int slots_per_frame; | 394 | unsigned int slots_per_frame; |
391 | 395 | ||
392 | slots_per_frame = (header->layer == MAD_LAYER_III && | 396 | slots_per_frame = (header->layer == MAD_LAYER_III && |
393 | (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; | 397 | (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; |
394 | 398 | ||
395 | N = (slots_per_frame * header->bitrate / header->samplerate) + pad_slot; | 399 | N = (slots_per_frame * header->bitrate / header->samplerate) + pad_slot; |
396 | } | 400 | } |
397 | 401 | ||
398 | /* verify there is enough data left in buffer to decode this frame */ | 402 | /* verify there is enough data left in buffer to decode this frame */ |
399 | if (N + MAD_BUFFER_GUARD > end - stream->this_frame) { | 403 | if (N + MAD_BUFFER_GUARD > end - stream->this_frame) { |
400 | stream->next_frame = stream->this_frame; | 404 | stream->next_frame = stream->this_frame; |
401 | 405 | ||
402 | stream->error = MAD_ERROR_BUFLEN; | 406 | stream->error = MAD_ERROR_BUFLEN; |
403 | goto fail; | 407 | goto fail; |
404 | } | 408 | } |
405 | 409 | ||
406 | stream->next_frame = stream->this_frame + N; | 410 | stream->next_frame = stream->this_frame + N; |
407 | 411 | ||
408 | if (!stream->sync) { | 412 | if (!stream->sync) { |
409 | /* check that a valid frame header follows this frame */ | 413 | /* check that a valid frame header follows this frame */ |
410 | 414 | ||
411 | ptr = stream->next_frame; | 415 | ptr = stream->next_frame; |
412 | if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) { | 416 | if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) { |
413 | ptr = stream->next_frame = stream->this_frame + 1; | 417 | ptr = stream->next_frame = stream->this_frame + 1; |
414 | goto sync; | 418 | goto sync; |
415 | } | 419 | } |
416 | 420 | ||
417 | stream->sync = 1; | 421 | stream->sync = 1; |
418 | } | 422 | } |
419 | 423 | ||
420 | header->flags |= MAD_FLAG_INCOMPLETE; | 424 | header->flags |= MAD_FLAG_INCOMPLETE; |
421 | 425 | ||
422 | return 0; | 426 | return 0; |
423 | 427 | ||
424 | fail: | 428 | fail: |
425 | stream->sync = 0; | 429 | stream->sync = 0; |
426 | 430 | ||
427 | return -1; | 431 | return -1; |
428 | } | 432 | } |
429 | 433 | ||
430 | /* | 434 | /* |
431 | * NAME:frame->decode() | 435 | * NAME:frame->decode() |
432 | * DESCRIPTION:decode a single frame from a bitstream | 436 | * DESCRIPTION:decode a single frame from a bitstream |
433 | */ | 437 | */ |
434 | int mad_frame_decode(struct mad_frame *frame, struct mad_stream *stream) | 438 | int mad_frame_decode(struct mad_frame *frame, struct mad_stream *stream) |
435 | { | 439 | { |
436 | frame->options = stream->options; | 440 | frame->options = stream->options; |
437 | 441 | ||
438 | /* header() */ | 442 | /* header() */ |
439 | /* error_check() */ | 443 | /* error_check() */ |
440 | 444 | ||
441 | if (!(frame->header.flags & MAD_FLAG_INCOMPLETE) && | 445 | if (!(frame->header.flags & MAD_FLAG_INCOMPLETE) && |
442 | mad_header_decode(&frame->header, stream) == -1) | 446 | mad_header_decode(&frame->header, stream) == -1) |
443 | goto fail; | 447 | goto fail; |
444 | 448 | ||
445 | /* audio_data() */ | 449 | /* audio_data() */ |
446 | 450 | ||
447 | frame->header.flags &= ~MAD_FLAG_INCOMPLETE; | 451 | frame->header.flags &= ~MAD_FLAG_INCOMPLETE; |
448 | 452 | ||
449 | if (decoder_table[frame->header.layer - 1](stream, frame) == -1) { | 453 | if (decoder_table[frame->header.layer - 1](stream, frame) == -1) { |
450 | if (!MAD_RECOVERABLE(stream->error)) | 454 | if (!MAD_RECOVERABLE(stream->error)) |
451 | stream->next_frame = stream->this_frame; | 455 | stream->next_frame = stream->this_frame; |
452 | 456 | ||
453 | goto fail; | 457 | goto fail; |
454 | } | 458 | } |
455 | 459 | ||
456 | /* ancillary_data() */ | 460 | /* ancillary_data() */ |
457 | 461 | ||
458 | if (frame->header.layer != MAD_LAYER_III) { | 462 | if (frame->header.layer != MAD_LAYER_III) { |
459 | struct mad_bitptr next_frame; | 463 | struct mad_bitptr next_frame; |
460 | 464 | ||
461 | mad_bit_init(&next_frame, stream->next_frame); | 465 | mad_bit_init(&next_frame, stream->next_frame); |
462 | 466 | ||
463 | stream->anc_ptr = stream->ptr; | 467 | stream->anc_ptr = stream->ptr; |
464 | stream->anc_bitlen = mad_bit_length(&stream->ptr, &next_frame); | 468 | stream->anc_bitlen = mad_bit_length(&stream->ptr, &next_frame); |
465 | 469 | ||
466 | mad_bit_finish(&next_frame); | 470 | mad_bit_finish(&next_frame); |
467 | } | 471 | } |
468 | 472 | ||
469 | return 0; | 473 | return 0; |
470 | 474 | ||
471 | fail: | 475 | fail: |
472 | stream->anc_bitlen = 0; | 476 | stream->anc_bitlen = 0; |
473 | return -1; | 477 | return -1; |
474 | } | 478 | } |
475 | 479 | ||
476 | /* | 480 | /* |
477 | * NAME:frame->mute() | 481 | * NAME:frame->mute() |
478 | * DESCRIPTION:zero all subband values so the frame becomes silent | 482 | * DESCRIPTION:zero all subband values so the frame becomes silent |
479 | */ | 483 | */ |
480 | void mad_frame_mute(struct mad_frame *frame) | 484 | void mad_frame_mute(struct mad_frame *frame) |
481 | { | 485 | { |
482 | unsigned int s, sb; | 486 | unsigned int s, sb; |
483 | 487 | ||
484 | for (s = 0; s < 36; ++s) { | 488 | for (s = 0; s < 36; ++s) { |
485 | for (sb = 0; sb < 32; ++sb) { | 489 | for (sb = 0; sb < 32; ++sb) { |
486 | frame->sbsample[0][s][sb] = | 490 | frame->sbsample[0][s][sb] = |
487 | frame->sbsample[1][s][sb] = 0; | 491 | frame->sbsample[1][s][sb] = 0; |
488 | } | 492 | } |
489 | } | 493 | } |
490 | 494 | ||
491 | if (frame->overlap) { | 495 | if (frame->overlap) { |
492 | for (s = 0; s < 18; ++s) { | 496 | for (s = 0; s < 18; ++s) { |
493 | for (sb = 0; sb < 32; ++sb) { | 497 | for (sb = 0; sb < 32; ++sb) { |
494 | (*frame->overlap)[0][sb][s] = | 498 | (*frame->overlap)[0][sb][s] = |
495 | (*frame->overlap)[1][sb][s] = 0; | 499 | (*frame->overlap)[1][sb][s] = 0; |
496 | } | 500 | } |
497 | } | 501 | } |
498 | } | 502 | } |
499 | } | 503 | } |
diff --git a/core/multimedia/opieplayer/libmad/frame.h b/core/multimedia/opieplayer/libmad/frame.h index 3b8e454..dce573d 100644 --- a/core/multimedia/opieplayer/libmad/frame.h +++ b/core/multimedia/opieplayer/libmad/frame.h | |||
@@ -1,117 +1,118 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifndef LIBMAD_FRAME_H | 22 | # ifndef LIBMAD_FRAME_H |
23 | # define LIBMAD_FRAME_H | 23 | # define LIBMAD_FRAME_H |
24 | 24 | ||
25 | # include "fixed.h" | 25 | # include "fixed.h" |
26 | # include "timer.h" | 26 | # include "timer.h" |
27 | # include "stream.h" | 27 | # include "stream.h" |
28 | 28 | ||
29 | enum mad_layer { | 29 | enum mad_layer { |
30 | MAD_LAYER_I = 1, /* Layer I */ | 30 | MAD_LAYER_I = 1, /* Layer I */ |
31 | MAD_LAYER_II = 2, /* Layer II */ | 31 | MAD_LAYER_II = 2, /* Layer II */ |
32 | MAD_LAYER_III = 3 /* Layer III */ | 32 | MAD_LAYER_III = 3 /* Layer III */ |
33 | }; | 33 | }; |
34 | 34 | ||
35 | enum mad_mode { | 35 | enum mad_mode { |
36 | MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */ | 36 | MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */ |
37 | MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */ | 37 | MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */ |
38 | MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */ | 38 | MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */ |
39 | MAD_MODE_STEREO = 3 /* normal LR stereo */ | 39 | MAD_MODE_STEREO = 3 /* normal LR stereo */ |
40 | }; | 40 | }; |
41 | 41 | ||
42 | enum mad_emphasis { | 42 | enum mad_emphasis { |
43 | MAD_EMPHASIS_NONE = 0, /* no emphasis */ | 43 | MAD_EMPHASIS_NONE = 0, /* no emphasis */ |
44 | MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ | 44 | MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ |
45 | MAD_EMPHASIS_CCITT_J_17 = 3 /* CCITT J.17 emphasis */ | 45 | MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */ |
46 | MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */ | ||
46 | }; | 47 | }; |
47 | 48 | ||
48 | struct mad_header { | 49 | struct mad_header { |
49 | enum mad_layer layer; /* audio layer (1, 2, or 3) */ | 50 | enum mad_layer layer; /* audio layer (1, 2, or 3) */ |
50 | enum mad_mode mode; /* channel mode (see above) */ | 51 | enum mad_mode mode; /* channel mode (see above) */ |
51 | int mode_extension; /* additional mode info */ | 52 | int mode_extension; /* additional mode info */ |
52 | enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ | 53 | enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ |
53 | 54 | ||
54 | unsigned long bitrate; /* stream bitrate (bps) */ | 55 | unsigned long bitrate; /* stream bitrate (bps) */ |
55 | unsigned int samplerate; /* sampling frequency (Hz) */ | 56 | unsigned int samplerate; /* sampling frequency (Hz) */ |
56 | 57 | ||
57 | unsigned short crc_check; /* frame CRC accumulator */ | 58 | unsigned short crc_check; /* frame CRC accumulator */ |
58 | unsigned short crc_target; /* final target CRC checksum */ | 59 | unsigned short crc_target; /* final target CRC checksum */ |
59 | 60 | ||
60 | int flags; /* flags (see below) */ | 61 | int flags; /* flags (see below) */ |
61 | int private_bits; /* private bits (see below) */ | 62 | int private_bits; /* private bits (see below) */ |
62 | 63 | ||
63 | mad_timer_t duration; /* audio playing time of frame */ | 64 | mad_timer_t duration; /* audio playing time of frame */ |
64 | }; | 65 | }; |
65 | 66 | ||
66 | struct mad_frame { | 67 | struct mad_frame { |
67 | struct mad_header header; /* MPEG audio header */ | 68 | struct mad_header header; /* MPEG audio header */ |
68 | 69 | ||
69 | int options; /* decoding options (from stream) */ | 70 | int options; /* decoding options (from stream) */ |
70 | 71 | ||
71 | mad_fixed_t sbsample[2][36][32];/* synthesis subband filter samples */ | 72 | mad_fixed_t sbsample[2][36][32];/* synthesis subband filter samples */ |
72 | mad_fixed_t (*overlap)[2][32][18];/* Layer III block overlap data */ | 73 | mad_fixed_t (*overlap)[2][32][18];/* Layer III block overlap data */ |
73 | }; | 74 | }; |
74 | 75 | ||
75 | # define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) | 76 | # define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) |
76 | # define MAD_NSBSAMPLES(header) \ | 77 | # define MAD_NSBSAMPLES(header) \ |
77 | ((header)->layer == MAD_LAYER_I ? 12 : \ | 78 | ((header)->layer == MAD_LAYER_I ? 12 : \ |
78 | (((header)->layer == MAD_LAYER_III && \ | 79 | (((header)->layer == MAD_LAYER_III && \ |
79 | ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36)) | 80 | ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36)) |
80 | 81 | ||
81 | enum { | 82 | enum { |
82 | MAD_FLAG_NPRIVATE_III = 0x0007,/* number of Layer III private bits */ | 83 | MAD_FLAG_NPRIVATE_III = 0x0007,/* number of Layer III private bits */ |
83 | MAD_FLAG_INCOMPLETE = 0x0008,/* header but not data is decoded */ | 84 | MAD_FLAG_INCOMPLETE = 0x0008,/* header but not data is decoded */ |
84 | 85 | ||
85 | MAD_FLAG_PROTECTION = 0x0010,/* frame has CRC protection */ | 86 | MAD_FLAG_PROTECTION = 0x0010,/* frame has CRC protection */ |
86 | MAD_FLAG_COPYRIGHT = 0x0020,/* frame is copyright */ | 87 | MAD_FLAG_COPYRIGHT = 0x0020,/* frame is copyright */ |
87 | MAD_FLAG_ORIGINAL = 0x0040,/* frame is original (else copy) */ | 88 | MAD_FLAG_ORIGINAL = 0x0040,/* frame is original (else copy) */ |
88 | MAD_FLAG_PADDING = 0x0080,/* frame has additional slot */ | 89 | MAD_FLAG_PADDING = 0x0080,/* frame has additional slot */ |
89 | 90 | ||
90 | MAD_FLAG_I_STEREO = 0x0100,/* uses intensity joint stereo */ | 91 | MAD_FLAG_I_STEREO = 0x0100,/* uses intensity joint stereo */ |
91 | MAD_FLAG_MS_STEREO = 0x0200,/* uses middle/side joint stereo */ | 92 | MAD_FLAG_MS_STEREO = 0x0200,/* uses middle/side joint stereo */ |
92 | MAD_FLAG_FREEFORMAT = 0x0400,/* uses free format bitrate */ | 93 | MAD_FLAG_FREEFORMAT = 0x0400,/* uses free format bitrate */ |
93 | 94 | ||
94 | MAD_FLAG_LSF_EXT = 0x1000,/* lower sampling freq. extension */ | 95 | MAD_FLAG_LSF_EXT = 0x1000,/* lower sampling freq. extension */ |
95 | MAD_FLAG_MC_EXT = 0x2000,/* multichannel audio extension */ | 96 | MAD_FLAG_MC_EXT = 0x2000,/* multichannel audio extension */ |
96 | MAD_FLAG_MPEG_2_5_EXT = 0x4000/* MPEG 2.5 (unofficial) extension */ | 97 | MAD_FLAG_MPEG_2_5_EXT = 0x4000/* MPEG 2.5 (unofficial) extension */ |
97 | }; | 98 | }; |
98 | 99 | ||
99 | enum { | 100 | enum { |
100 | MAD_PRIVATE_HEADER = 0x0100,/* header private bit */ | 101 | MAD_PRIVATE_HEADER = 0x0100,/* header private bit */ |
101 | MAD_PRIVATE_III = 0x001f/* Layer III private bits (up to 5) */ | 102 | MAD_PRIVATE_III = 0x001f/* Layer III private bits (up to 5) */ |
102 | }; | 103 | }; |
103 | 104 | ||
104 | void mad_header_init(struct mad_header *); | 105 | void mad_header_init(struct mad_header *); |
105 | 106 | ||
106 | # define mad_header_finish(header) /* nothing */ | 107 | # define mad_header_finish(header) /* nothing */ |
107 | 108 | ||
108 | int mad_header_decode(struct mad_header *, struct mad_stream *); | 109 | int mad_header_decode(struct mad_header *, struct mad_stream *); |
109 | 110 | ||
110 | void mad_frame_init(struct mad_frame *); | 111 | void mad_frame_init(struct mad_frame *); |
111 | void mad_frame_finish(struct mad_frame *); | 112 | void mad_frame_finish(struct mad_frame *); |
112 | 113 | ||
113 | int mad_frame_decode(struct mad_frame *, struct mad_stream *); | 114 | int mad_frame_decode(struct mad_frame *, struct mad_stream *); |
114 | 115 | ||
115 | void mad_frame_mute(struct mad_frame *); | 116 | void mad_frame_mute(struct mad_frame *); |
116 | 117 | ||
117 | # endif | 118 | # endif |
diff --git a/core/multimedia/opieplayer/libmad/huffman.c b/core/multimedia/opieplayer/libmad/huffman.c index 5ea6547..684409e 100644 --- a/core/multimedia/opieplayer/libmad/huffman.c +++ b/core/multimedia/opieplayer/libmad/huffman.c | |||
@@ -1,1138 +1,1149 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifdef HAVE_CONFIG_H | 22 | # ifdef HAVE_CONFIG_H |
23 | # include "libmad_config.h" | 23 | # include "libmad_config.h" |
24 | # endif | 24 | # endif |
25 | 25 | ||
26 | # include "libmad_global.h" | 26 | # include "libmad_global.h" |
27 | 27 | ||
28 | # include "huffman.h" | 28 | # include "huffman.h" |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * These are the Huffman code words for Layer III. | 31 | * These are the Huffman code words for Layer III. |
32 | * The data for these tables are derived from Table B.7 of ISO/IEC 11172-3. | 32 | * The data for these tables are derived from Table B.7 of ISO/IEC 11172-3. |
33 | * | 33 | * |
34 | * These tables support decoding up to 4 Huffman code bits at a time. | 34 | * These tables support decoding up to 4 Huffman code bits at a time. |
35 | */ | 35 | */ |
36 | 36 | ||
37 | # if defined(__GNUC__) | 37 | # if defined(__GNUC__) || \ |
38 | # define PTR(offs, bits){ ptr: { 0, bits, offs } } | 38 | (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901) |
39 | # define V(v, w, x, y, hlen){ value: { 1, hlen, v, w, x, y } } | 39 | # define PTR(offs, bits){ .ptr = { 0, bits, offs } } |
40 | # define V(v, w, x, y, hlen){ .value = { 1, hlen, v, w, x, y } } | ||
40 | # else | 41 | # else |
41 | # define PTR(offs, bits){ { 0, bits, offs } } | 42 | # define PTR(offs, bits){ { 0, bits, offs } } |
42 | # define V(v, w, x, y, hlen){ { 1, hlen, (v << 0) | (w << 1) | \ | 43 | # if defined(WORDS_BIGENDIAN) |
43 | (x << 2) | (y << 3) } } | 44 | # define V(v, w, x, y, hlen){ { 1, hlen, (v << 11) | (w << 10) | \ |
45 | (x << 9) | (y << 8) } } | ||
46 | # else | ||
47 | # define V(v, w, x, y, hlen){ { 1, hlen, (v << 0) | (w << 1) | \ | ||
48 | (x << 2) | (y << 3) } } | ||
49 | # endif | ||
44 | # endif | 50 | # endif |
45 | 51 | ||
46 | static | 52 | static |
47 | union huffquad const hufftabA[] = { | 53 | union huffquad const hufftabA[] = { |
48 | /* 0000 */ PTR(16, 2), | 54 | /* 0000 */ PTR(16, 2), |
49 | /* 0001 */ PTR(20, 2), | 55 | /* 0001 */ PTR(20, 2), |
50 | /* 0010 */ PTR(24, 1), | 56 | /* 0010 */ PTR(24, 1), |
51 | /* 0011 */ PTR(26, 1), | 57 | /* 0011 */ PTR(26, 1), |
52 | /* 0100 */ V(0, 0, 1, 0, 4), | 58 | /* 0100 */ V(0, 0, 1, 0, 4), |
53 | /* 0101 */ V(0, 0, 0, 1, 4), | 59 | /* 0101 */ V(0, 0, 0, 1, 4), |
54 | /* 0110 */ V(0, 1, 0, 0, 4), | 60 | /* 0110 */ V(0, 1, 0, 0, 4), |
55 | /* 0111 */ V(1, 0, 0, 0, 4), | 61 | /* 0111 */ V(1, 0, 0, 0, 4), |
56 | /* 1000 */ V(0, 0, 0, 0, 1), | 62 | /* 1000 */ V(0, 0, 0, 0, 1), |
57 | /* 1001 */ V(0, 0, 0, 0, 1), | 63 | /* 1001 */ V(0, 0, 0, 0, 1), |
58 | /* 1010 */ V(0, 0, 0, 0, 1), | 64 | /* 1010 */ V(0, 0, 0, 0, 1), |
59 | /* 1011 */ V(0, 0, 0, 0, 1), | 65 | /* 1011 */ V(0, 0, 0, 0, 1), |
60 | /* 1100 */ V(0, 0, 0, 0, 1), | 66 | /* 1100 */ V(0, 0, 0, 0, 1), |
61 | /* 1101 */ V(0, 0, 0, 0, 1), | 67 | /* 1101 */ V(0, 0, 0, 0, 1), |
62 | /* 1110 */ V(0, 0, 0, 0, 1), | 68 | /* 1110 */ V(0, 0, 0, 0, 1), |
63 | /* 1111 */ V(0, 0, 0, 0, 1), | 69 | /* 1111 */ V(0, 0, 0, 0, 1), |
64 | 70 | ||
65 | /* 0000 ... */ | 71 | /* 0000 ... */ |
66 | /* 00 */ V(1, 0, 1, 1, 2),/* 16 */ | 72 | /* 00 */ V(1, 0, 1, 1, 2),/* 16 */ |
67 | /* 01 */ V(1, 1, 1, 1, 2), | 73 | /* 01 */ V(1, 1, 1, 1, 2), |
68 | /* 10 */ V(1, 1, 0, 1, 2), | 74 | /* 10 */ V(1, 1, 0, 1, 2), |
69 | /* 11 */ V(1, 1, 1, 0, 2), | 75 | /* 11 */ V(1, 1, 1, 0, 2), |
70 | 76 | ||
71 | /* 0001 ... */ | 77 | /* 0001 ... */ |
72 | /* 00 */ V(0, 1, 1, 1, 2),/* 20 */ | 78 | /* 00 */ V(0, 1, 1, 1, 2),/* 20 */ |
73 | /* 01 */ V(0, 1, 0, 1, 2), | 79 | /* 01 */ V(0, 1, 0, 1, 2), |
74 | /* 10 */ V(1, 0, 0, 1, 1), | 80 | /* 10 */ V(1, 0, 0, 1, 1), |
75 | /* 11 */ V(1, 0, 0, 1, 1), | 81 | /* 11 */ V(1, 0, 0, 1, 1), |
76 | 82 | ||
77 | /* 0010 ... */ | 83 | /* 0010 ... */ |
78 | /* 0 */ V(0, 1, 1, 0, 1),/* 24 */ | 84 | /* 0 */ V(0, 1, 1, 0, 1),/* 24 */ |
79 | /* 1 */ V(0, 0, 1, 1, 1), | 85 | /* 1 */ V(0, 0, 1, 1, 1), |
80 | 86 | ||
81 | /* 0011 ... */ | 87 | /* 0011 ... */ |
82 | /* 0 */ V(1, 0, 1, 0, 1),/* 26 */ | 88 | /* 0 */ V(1, 0, 1, 0, 1),/* 26 */ |
83 | /* 1 */ V(1, 1, 0, 0, 1) | 89 | /* 1 */ V(1, 1, 0, 0, 1) |
84 | }; | 90 | }; |
85 | 91 | ||
86 | static | 92 | static |
87 | union huffquad const hufftabB[] = { | 93 | union huffquad const hufftabB[] = { |
88 | /* 0000 */ V(1, 1, 1, 1, 4), | 94 | /* 0000 */ V(1, 1, 1, 1, 4), |
89 | /* 0001 */ V(1, 1, 1, 0, 4), | 95 | /* 0001 */ V(1, 1, 1, 0, 4), |
90 | /* 0010 */ V(1, 1, 0, 1, 4), | 96 | /* 0010 */ V(1, 1, 0, 1, 4), |
91 | /* 0011 */ V(1, 1, 0, 0, 4), | 97 | /* 0011 */ V(1, 1, 0, 0, 4), |
92 | /* 0100 */ V(1, 0, 1, 1, 4), | 98 | /* 0100 */ V(1, 0, 1, 1, 4), |
93 | /* 0101 */ V(1, 0, 1, 0, 4), | 99 | /* 0101 */ V(1, 0, 1, 0, 4), |
94 | /* 0110 */ V(1, 0, 0, 1, 4), | 100 | /* 0110 */ V(1, 0, 0, 1, 4), |
95 | /* 0111 */ V(1, 0, 0, 0, 4), | 101 | /* 0111 */ V(1, 0, 0, 0, 4), |
96 | /* 1000 */ V(0, 1, 1, 1, 4), | 102 | /* 1000 */ V(0, 1, 1, 1, 4), |
97 | /* 1001 */ V(0, 1, 1, 0, 4), | 103 | /* 1001 */ V(0, 1, 1, 0, 4), |
98 | /* 1010 */ V(0, 1, 0, 1, 4), | 104 | /* 1010 */ V(0, 1, 0, 1, 4), |
99 | /* 1011 */ V(0, 1, 0, 0, 4), | 105 | /* 1011 */ V(0, 1, 0, 0, 4), |
100 | /* 1100 */ V(0, 0, 1, 1, 4), | 106 | /* 1100 */ V(0, 0, 1, 1, 4), |
101 | /* 1101 */ V(0, 0, 1, 0, 4), | 107 | /* 1101 */ V(0, 0, 1, 0, 4), |
102 | /* 1110 */ V(0, 0, 0, 1, 4), | 108 | /* 1110 */ V(0, 0, 0, 1, 4), |
103 | /* 1111 */ V(0, 0, 0, 0, 4) | 109 | /* 1111 */ V(0, 0, 0, 0, 4) |
104 | }; | 110 | }; |
105 | 111 | ||
106 | # undef V | 112 | # undef V |
107 | # undef PTR | 113 | # undef PTR |
108 | 114 | ||
109 | # if defined(__GNUC__) | 115 | # if defined(__GNUC__) || \ |
110 | # define PTR(offs, bits){ ptr: { 0, bits, offs } } | 116 | (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901) |
111 | # define V(x, y, hlen) { value: { 1, hlen, x, y } } | 117 | # define PTR(offs, bits){ .ptr = { 0, bits, offs } } |
118 | # define V(x, y, hlen) { .value = { 1, hlen, x, y } } | ||
112 | # else | 119 | # else |
113 | # define PTR(offs, bits){ { 0, bits, offs } } | 120 | # define PTR(offs, bits){ { 0, bits, offs } } |
114 | # define V(x, y, hlen) { { 1, hlen, (x << 0) | (y << 4) } } | 121 | # if defined(WORDS_BIGENDIAN) |
122 | # define V(x, y, hlen){ { 1, hlen, (x << 8) | (y << 4) } } | ||
123 | # else | ||
124 | # define V(x, y, hlen){ { 1, hlen, (x << 0) | (y << 4) } } | ||
125 | # endif | ||
115 | # endif | 126 | # endif |
116 | 127 | ||
117 | static | 128 | static |
118 | union huffpair const hufftab0[] = { | 129 | union huffpair const hufftab0[] = { |
119 | /* */ V(0, 0, 0) | 130 | /* */ V(0, 0, 0) |
120 | }; | 131 | }; |
121 | 132 | ||
122 | static | 133 | static |
123 | union huffpair const hufftab1[] = { | 134 | union huffpair const hufftab1[] = { |
124 | /* 000 */ V(1, 1, 3), | 135 | /* 000 */ V(1, 1, 3), |
125 | /* 001 */ V(0, 1, 3), | 136 | /* 001 */ V(0, 1, 3), |
126 | /* 010 */ V(1, 0, 2), | 137 | /* 010 */ V(1, 0, 2), |
127 | /* 011 */ V(1, 0, 2), | 138 | /* 011 */ V(1, 0, 2), |
128 | /* 100 */ V(0, 0, 1), | 139 | /* 100 */ V(0, 0, 1), |
129 | /* 101 */ V(0, 0, 1), | 140 | /* 101 */ V(0, 0, 1), |
130 | /* 110 */ V(0, 0, 1), | 141 | /* 110 */ V(0, 0, 1), |
131 | /* 111 */ V(0, 0, 1) | 142 | /* 111 */ V(0, 0, 1) |
132 | }; | 143 | }; |
133 | 144 | ||
134 | static | 145 | static |
135 | union huffpair const hufftab2[] = { | 146 | union huffpair const hufftab2[] = { |
136 | /* 000 */ PTR(8, 3), | 147 | /* 000 */ PTR(8, 3), |
137 | /* 001 */ V(1, 1, 3), | 148 | /* 001 */ V(1, 1, 3), |
138 | /* 010 */ V(0, 1, 3), | 149 | /* 010 */ V(0, 1, 3), |
139 | /* 011 */ V(1, 0, 3), | 150 | /* 011 */ V(1, 0, 3), |
140 | /* 100 */ V(0, 0, 1), | 151 | /* 100 */ V(0, 0, 1), |
141 | /* 101 */ V(0, 0, 1), | 152 | /* 101 */ V(0, 0, 1), |
142 | /* 110 */ V(0, 0, 1), | 153 | /* 110 */ V(0, 0, 1), |
143 | /* 111 */ V(0, 0, 1), | 154 | /* 111 */ V(0, 0, 1), |
144 | 155 | ||
145 | /* 000 ... */ | 156 | /* 000 ... */ |
146 | /* 000 */ V(2, 2, 3),/* 8 */ | 157 | /* 000 */ V(2, 2, 3),/* 8 */ |
147 | /* 001 */ V(0, 2, 3), | 158 | /* 001 */ V(0, 2, 3), |
148 | /* 010 */ V(1, 2, 2), | 159 | /* 010 */ V(1, 2, 2), |
149 | /* 011 */ V(1, 2, 2), | 160 | /* 011 */ V(1, 2, 2), |
150 | /* 100 */ V(2, 1, 2), | 161 | /* 100 */ V(2, 1, 2), |
151 | /* 101 */ V(2, 1, 2), | 162 | /* 101 */ V(2, 1, 2), |
152 | /* 110 */ V(2, 0, 2), | 163 | /* 110 */ V(2, 0, 2), |
153 | /* 111 */ V(2, 0, 2) | 164 | /* 111 */ V(2, 0, 2) |
154 | }; | 165 | }; |
155 | 166 | ||
156 | static | 167 | static |
157 | union huffpair const hufftab3[] = { | 168 | union huffpair const hufftab3[] = { |
158 | /* 000 */ PTR(8, 3), | 169 | /* 000 */ PTR(8, 3), |
159 | /* 001 */ V(1, 0, 3), | 170 | /* 001 */ V(1, 0, 3), |
160 | /* 010 */ V(1, 1, 2), | 171 | /* 010 */ V(1, 1, 2), |
161 | /* 011 */ V(1, 1, 2), | 172 | /* 011 */ V(1, 1, 2), |
162 | /* 100 */ V(0, 1, 2), | 173 | /* 100 */ V(0, 1, 2), |
163 | /* 101 */ V(0, 1, 2), | 174 | /* 101 */ V(0, 1, 2), |
164 | /* 110 */ V(0, 0, 2), | 175 | /* 110 */ V(0, 0, 2), |
165 | /* 111 */ V(0, 0, 2), | 176 | /* 111 */ V(0, 0, 2), |
166 | 177 | ||
167 | /* 000 ... */ | 178 | /* 000 ... */ |
168 | /* 000 */ V(2, 2, 3),/* 8 */ | 179 | /* 000 */ V(2, 2, 3),/* 8 */ |
169 | /* 001 */ V(0, 2, 3), | 180 | /* 001 */ V(0, 2, 3), |
170 | /* 010 */ V(1, 2, 2), | 181 | /* 010 */ V(1, 2, 2), |
171 | /* 011 */ V(1, 2, 2), | 182 | /* 011 */ V(1, 2, 2), |
172 | /* 100 */ V(2, 1, 2), | 183 | /* 100 */ V(2, 1, 2), |
173 | /* 101 */ V(2, 1, 2), | 184 | /* 101 */ V(2, 1, 2), |
174 | /* 110 */ V(2, 0, 2), | 185 | /* 110 */ V(2, 0, 2), |
175 | /* 111 */ V(2, 0, 2) | 186 | /* 111 */ V(2, 0, 2) |
176 | }; | 187 | }; |
177 | 188 | ||
178 | static | 189 | static |
179 | union huffpair const hufftab5[] = { | 190 | union huffpair const hufftab5[] = { |
180 | /* 000 */ PTR(8, 4), | 191 | /* 000 */ PTR(8, 4), |
181 | /* 001 */ V(1, 1, 3), | 192 | /* 001 */ V(1, 1, 3), |
182 | /* 010 */ V(0, 1, 3), | 193 | /* 010 */ V(0, 1, 3), |
183 | /* 011 */ V(1, 0, 3), | 194 | /* 011 */ V(1, 0, 3), |
184 | /* 100 */ V(0, 0, 1), | 195 | /* 100 */ V(0, 0, 1), |
185 | /* 101 */ V(0, 0, 1), | 196 | /* 101 */ V(0, 0, 1), |
186 | /* 110 */ V(0, 0, 1), | 197 | /* 110 */ V(0, 0, 1), |
187 | /* 111 */ V(0, 0, 1), | 198 | /* 111 */ V(0, 0, 1), |
188 | 199 | ||
189 | /* 000 ... */ | 200 | /* 000 ... */ |
190 | /* 0000 */ PTR(24, 1),/* 8 */ | 201 | /* 0000 */ PTR(24, 1),/* 8 */ |
191 | /* 0001 */ V(3, 2, 4), | 202 | /* 0001 */ V(3, 2, 4), |
192 | /* 0010 */ V(3, 1, 3), | 203 | /* 0010 */ V(3, 1, 3), |
193 | /* 0011 */ V(3, 1, 3), | 204 | /* 0011 */ V(3, 1, 3), |
194 | /* 0100 */ V(1, 3, 4), | 205 | /* 0100 */ V(1, 3, 4), |
195 | /* 0101 */ V(0, 3, 4), | 206 | /* 0101 */ V(0, 3, 4), |
196 | /* 0110 */ V(3, 0, 4), | 207 | /* 0110 */ V(3, 0, 4), |
197 | /* 0111 */ V(2, 2, 4), | 208 | /* 0111 */ V(2, 2, 4), |
198 | /* 1000 */ V(1, 2, 3), | 209 | /* 1000 */ V(1, 2, 3), |
199 | /* 1001 */ V(1, 2, 3), | 210 | /* 1001 */ V(1, 2, 3), |
200 | /* 1010 */ V(2, 1, 3), | 211 | /* 1010 */ V(2, 1, 3), |
201 | /* 1011 */ V(2, 1, 3), | 212 | /* 1011 */ V(2, 1, 3), |
202 | /* 1100 */ V(0, 2, 3), | 213 | /* 1100 */ V(0, 2, 3), |
203 | /* 1101 */ V(0, 2, 3), | 214 | /* 1101 */ V(0, 2, 3), |
204 | /* 1110 */ V(2, 0, 3), | 215 | /* 1110 */ V(2, 0, 3), |
205 | /* 1111 */ V(2, 0, 3), | 216 | /* 1111 */ V(2, 0, 3), |
206 | 217 | ||
207 | /* 000 0000 ... */ | 218 | /* 000 0000 ... */ |
208 | /* 0 */ V(3, 3, 1),/* 24 */ | 219 | /* 0 */ V(3, 3, 1),/* 24 */ |
209 | /* 1 */ V(2, 3, 1) | 220 | /* 1 */ V(2, 3, 1) |
210 | }; | 221 | }; |
211 | 222 | ||
212 | static | 223 | static |
213 | union huffpair const hufftab6[] = { | 224 | union huffpair const hufftab6[] = { |
214 | /* 0000 */ PTR(16, 3), | 225 | /* 0000 */ PTR(16, 3), |
215 | /* 0001 */ PTR(24, 1), | 226 | /* 0001 */ PTR(24, 1), |
216 | /* 0010 */ PTR(26, 1), | 227 | /* 0010 */ PTR(26, 1), |
217 | /* 0011 */ V(1, 2, 4), | 228 | /* 0011 */ V(1, 2, 4), |
218 | /* 0100 */ V(2, 1, 4), | 229 | /* 0100 */ V(2, 1, 4), |
219 | /* 0101 */ V(2, 0, 4), | 230 | /* 0101 */ V(2, 0, 4), |
220 | /* 0110 */ V(0, 1, 3), | 231 | /* 0110 */ V(0, 1, 3), |
221 | /* 0111 */ V(0, 1, 3), | 232 | /* 0111 */ V(0, 1, 3), |
222 | /* 1000 */ V(1, 1, 2), | 233 | /* 1000 */ V(1, 1, 2), |
223 | /* 1001 */ V(1, 1, 2), | 234 | /* 1001 */ V(1, 1, 2), |
224 | /* 1010 */ V(1, 1, 2), | 235 | /* 1010 */ V(1, 1, 2), |
225 | /* 1011 */ V(1, 1, 2), | 236 | /* 1011 */ V(1, 1, 2), |
226 | /* 1100 */ V(1, 0, 3), | 237 | /* 1100 */ V(1, 0, 3), |
227 | /* 1101 */ V(1, 0, 3), | 238 | /* 1101 */ V(1, 0, 3), |
228 | /* 1110 */ V(0, 0, 3), | 239 | /* 1110 */ V(0, 0, 3), |
229 | /* 1111 */ V(0, 0, 3), | 240 | /* 1111 */ V(0, 0, 3), |
230 | 241 | ||
231 | /* 0000 ... */ | 242 | /* 0000 ... */ |
232 | /* 000 */ V(3, 3, 3),/* 16 */ | 243 | /* 000 */ V(3, 3, 3),/* 16 */ |
233 | /* 001 */ V(0, 3, 3), | 244 | /* 001 */ V(0, 3, 3), |
234 | /* 010 */ V(2, 3, 2), | 245 | /* 010 */ V(2, 3, 2), |
235 | /* 011 */ V(2, 3, 2), | 246 | /* 011 */ V(2, 3, 2), |
236 | /* 100 */ V(3, 2, 2), | 247 | /* 100 */ V(3, 2, 2), |
237 | /* 101 */ V(3, 2, 2), | 248 | /* 101 */ V(3, 2, 2), |
238 | /* 110 */ V(3, 0, 2), | 249 | /* 110 */ V(3, 0, 2), |
239 | /* 111 */ V(3, 0, 2), | 250 | /* 111 */ V(3, 0, 2), |
240 | 251 | ||
241 | /* 0001 ... */ | 252 | /* 0001 ... */ |
242 | /* 0 */ V(1, 3, 1),/* 24 */ | 253 | /* 0 */ V(1, 3, 1),/* 24 */ |
243 | /* 1 */ V(3, 1, 1), | 254 | /* 1 */ V(3, 1, 1), |
244 | 255 | ||
245 | /* 0010 ... */ | 256 | /* 0010 ... */ |
246 | /* 0 */ V(2, 2, 1),/* 26 */ | 257 | /* 0 */ V(2, 2, 1),/* 26 */ |
247 | /* 1 */ V(0, 2, 1) | 258 | /* 1 */ V(0, 2, 1) |
248 | }; | 259 | }; |
249 | 260 | ||
250 | static | 261 | static |
251 | union huffpair const hufftab7[] = { | 262 | union huffpair const hufftab7[] = { |
252 | /* 0000 */ PTR(16, 4), | 263 | /* 0000 */ PTR(16, 4), |
253 | /* 0001 */ PTR(32, 4), | 264 | /* 0001 */ PTR(32, 4), |
254 | /* 0010 */ PTR(48, 2), | 265 | /* 0010 */ PTR(48, 2), |
255 | /* 0011 */ V(1, 1, 4), | 266 | /* 0011 */ V(1, 1, 4), |
256 | /* 0100 */ V(0, 1, 3), | 267 | /* 0100 */ V(0, 1, 3), |
257 | /* 0101 */ V(0, 1, 3), | 268 | /* 0101 */ V(0, 1, 3), |
258 | /* 0110 */ V(1, 0, 3), | 269 | /* 0110 */ V(1, 0, 3), |
259 | /* 0111 */ V(1, 0, 3), | 270 | /* 0111 */ V(1, 0, 3), |
260 | /* 1000 */ V(0, 0, 1), | 271 | /* 1000 */ V(0, 0, 1), |
261 | /* 1001 */ V(0, 0, 1), | 272 | /* 1001 */ V(0, 0, 1), |
262 | /* 1010 */ V(0, 0, 1), | 273 | /* 1010 */ V(0, 0, 1), |
263 | /* 1011 */ V(0, 0, 1), | 274 | /* 1011 */ V(0, 0, 1), |
264 | /* 1100 */ V(0, 0, 1), | 275 | /* 1100 */ V(0, 0, 1), |
265 | /* 1101 */ V(0, 0, 1), | 276 | /* 1101 */ V(0, 0, 1), |
266 | /* 1110 */ V(0, 0, 1), | 277 | /* 1110 */ V(0, 0, 1), |
267 | /* 1111 */ V(0, 0, 1), | 278 | /* 1111 */ V(0, 0, 1), |
268 | 279 | ||
269 | /* 0000 ... */ | 280 | /* 0000 ... */ |
270 | /* 0000 */ PTR(52, 2),/* 16 */ | 281 | /* 0000 */ PTR(52, 2),/* 16 */ |
271 | /* 0001 */ PTR(56, 1), | 282 | /* 0001 */ PTR(56, 1), |
272 | /* 0010 */ PTR(58, 1), | 283 | /* 0010 */ PTR(58, 1), |
273 | /* 0011 */ V(1, 5, 4), | 284 | /* 0011 */ V(1, 5, 4), |
274 | /* 0100 */ V(5, 1, 4), | 285 | /* 0100 */ V(5, 1, 4), |
275 | /* 0101 */ PTR(60, 1), | 286 | /* 0101 */ PTR(60, 1), |
276 | /* 0110 */ V(5, 0, 4), | 287 | /* 0110 */ V(5, 0, 4), |
277 | /* 0111 */ PTR(62, 1), | 288 | /* 0111 */ PTR(62, 1), |
278 | /* 1000 */ V(2, 4, 4), | 289 | /* 1000 */ V(2, 4, 4), |
279 | /* 1001 */ V(4, 2, 4), | 290 | /* 1001 */ V(4, 2, 4), |
280 | /* 1010 */ V(1, 4, 3), | 291 | /* 1010 */ V(1, 4, 3), |
281 | /* 1011 */ V(1, 4, 3), | 292 | /* 1011 */ V(1, 4, 3), |
282 | /* 1100 */ V(4, 1, 3), | 293 | /* 1100 */ V(4, 1, 3), |
283 | /* 1101 */ V(4, 1, 3), | 294 | /* 1101 */ V(4, 1, 3), |
284 | /* 1110 */ V(4, 0, 3), | 295 | /* 1110 */ V(4, 0, 3), |
285 | /* 1111 */ V(4, 0, 3), | 296 | /* 1111 */ V(4, 0, 3), |
286 | 297 | ||
287 | /* 0001 ... */ | 298 | /* 0001 ... */ |
288 | /* 0000 */ V(0, 4, 4),/* 32 */ | 299 | /* 0000 */ V(0, 4, 4),/* 32 */ |
289 | /* 0001 */ V(2, 3, 4), | 300 | /* 0001 */ V(2, 3, 4), |
290 | /* 0010 */ V(3, 2, 4), | 301 | /* 0010 */ V(3, 2, 4), |
291 | /* 0011 */ V(0, 3, 4), | 302 | /* 0011 */ V(0, 3, 4), |
292 | /* 0100 */ V(1, 3, 3), | 303 | /* 0100 */ V(1, 3, 3), |
293 | /* 0101 */ V(1, 3, 3), | 304 | /* 0101 */ V(1, 3, 3), |
294 | /* 0110 */ V(3, 1, 3), | 305 | /* 0110 */ V(3, 1, 3), |
295 | /* 0111 */ V(3, 1, 3), | 306 | /* 0111 */ V(3, 1, 3), |
296 | /* 1000 */ V(3, 0, 3), | 307 | /* 1000 */ V(3, 0, 3), |
297 | /* 1001 */ V(3, 0, 3), | 308 | /* 1001 */ V(3, 0, 3), |
298 | /* 1010 */ V(2, 2, 3), | 309 | /* 1010 */ V(2, 2, 3), |
299 | /* 1011 */ V(2, 2, 3), | 310 | /* 1011 */ V(2, 2, 3), |
300 | /* 1100 */ V(1, 2, 2), | 311 | /* 1100 */ V(1, 2, 2), |
301 | /* 1101 */ V(1, 2, 2), | 312 | /* 1101 */ V(1, 2, 2), |
302 | /* 1110 */ V(1, 2, 2), | 313 | /* 1110 */ V(1, 2, 2), |
303 | /* 1111 */ V(1, 2, 2), | 314 | /* 1111 */ V(1, 2, 2), |
304 | 315 | ||
305 | /* 0010 ... */ | 316 | /* 0010 ... */ |
306 | /* 00 */ V(2, 1, 1),/* 48 */ | 317 | /* 00 */ V(2, 1, 1),/* 48 */ |
307 | /* 01 */ V(2, 1, 1), | 318 | /* 01 */ V(2, 1, 1), |
308 | /* 10 */ V(0, 2, 2), | 319 | /* 10 */ V(0, 2, 2), |
309 | /* 11 */ V(2, 0, 2), | 320 | /* 11 */ V(2, 0, 2), |
310 | 321 | ||
311 | /* 0000 0000 ... */ | 322 | /* 0000 0000 ... */ |
312 | /* 00 */ V(5, 5, 2),/* 52 */ | 323 | /* 00 */ V(5, 5, 2),/* 52 */ |
313 | /* 01 */ V(4, 5, 2), | 324 | /* 01 */ V(4, 5, 2), |
314 | /* 10 */ V(5, 4, 2), | 325 | /* 10 */ V(5, 4, 2), |
315 | /* 11 */ V(5, 3, 2), | 326 | /* 11 */ V(5, 3, 2), |
316 | 327 | ||
317 | /* 0000 0001 ... */ | 328 | /* 0000 0001 ... */ |
318 | /* 0 */ V(3, 5, 1),/* 56 */ | 329 | /* 0 */ V(3, 5, 1),/* 56 */ |
319 | /* 1 */ V(4, 4, 1), | 330 | /* 1 */ V(4, 4, 1), |
320 | 331 | ||
321 | /* 0000 0010 ... */ | 332 | /* 0000 0010 ... */ |
322 | /* 0 */ V(2, 5, 1),/* 58 */ | 333 | /* 0 */ V(2, 5, 1),/* 58 */ |
323 | /* 1 */ V(5, 2, 1), | 334 | /* 1 */ V(5, 2, 1), |
324 | 335 | ||
325 | /* 0000 0101 ... */ | 336 | /* 0000 0101 ... */ |
326 | /* 0 */ V(0, 5, 1),/* 60 */ | 337 | /* 0 */ V(0, 5, 1),/* 60 */ |
327 | /* 1 */ V(3, 4, 1), | 338 | /* 1 */ V(3, 4, 1), |
328 | 339 | ||
329 | /* 0000 0111 ... */ | 340 | /* 0000 0111 ... */ |
330 | /* 0 */ V(4, 3, 1),/* 62 */ | 341 | /* 0 */ V(4, 3, 1),/* 62 */ |
331 | /* 1 */ V(3, 3, 1) | 342 | /* 1 */ V(3, 3, 1) |
332 | }; | 343 | }; |
333 | 344 | ||
334 | # if 0 | 345 | # if 0 |
335 | /* this version saves 8 entries (16 bytes) at the expense of | 346 | /* this version saves 8 entries (16 bytes) at the expense of |
336 | an extra lookup in 4 out of 36 cases */ | 347 | an extra lookup in 4 out of 36 cases */ |
337 | static | 348 | static |
338 | union huffpair const hufftab8[] = { | 349 | union huffpair const hufftab8[] = { |
339 | /* 0000 */ PTR(16, 4), | 350 | /* 0000 */ PTR(16, 4), |
340 | /* 0001 */ PTR(32, 2), | 351 | /* 0001 */ PTR(32, 2), |
341 | /* 0010 */ V(1, 2, 4), | 352 | /* 0010 */ V(1, 2, 4), |
342 | /* 0011 */ V(2, 1, 4), | 353 | /* 0011 */ V(2, 1, 4), |
343 | /* 0100 */ V(1, 1, 2), | 354 | /* 0100 */ V(1, 1, 2), |
344 | /* 0101 */ V(1, 1, 2), | 355 | /* 0101 */ V(1, 1, 2), |
345 | /* 0110 */ V(1, 1, 2), | 356 | /* 0110 */ V(1, 1, 2), |
346 | /* 0111 */ V(1, 1, 2), | 357 | /* 0111 */ V(1, 1, 2), |
347 | /* 1000 */ V(0, 1, 3), | 358 | /* 1000 */ V(0, 1, 3), |
348 | /* 1001 */ V(0, 1, 3), | 359 | /* 1001 */ V(0, 1, 3), |
349 | /* 1010 */ V(1, 0, 3), | 360 | /* 1010 */ V(1, 0, 3), |
350 | /* 1011 */ V(1, 0, 3), | 361 | /* 1011 */ V(1, 0, 3), |
351 | /* 1100 */ V(0, 0, 2), | 362 | /* 1100 */ V(0, 0, 2), |
352 | /* 1101 */ V(0, 0, 2), | 363 | /* 1101 */ V(0, 0, 2), |
353 | /* 1110 */ V(0, 0, 2), | 364 | /* 1110 */ V(0, 0, 2), |
354 | /* 1111 */ V(0, 0, 2), | 365 | /* 1111 */ V(0, 0, 2), |
355 | 366 | ||
356 | /* 0000 ... */ | 367 | /* 0000 ... */ |
357 | /* 0000 */ PTR(36, 3),/* 16 */ | 368 | /* 0000 */ PTR(36, 3),/* 16 */ |
358 | /* 0001 */ PTR(44, 2), | 369 | /* 0001 */ PTR(44, 2), |
359 | /* 0010 */ PTR(48, 1), | 370 | /* 0010 */ PTR(48, 1), |
360 | /* 0011 */ V(1, 5, 4), | 371 | /* 0011 */ V(1, 5, 4), |
361 | /* 0100 */ V(5, 1, 4), | 372 | /* 0100 */ V(5, 1, 4), |
362 | /* 0101 */ PTR(50, 1), | 373 | /* 0101 */ PTR(50, 1), |
363 | /* 0110 */ PTR(52, 1), | 374 | /* 0110 */ PTR(52, 1), |
364 | /* 0111 */ V(2, 4, 4), | 375 | /* 0111 */ V(2, 4, 4), |
365 | /* 1000 */ V(4, 2, 4), | 376 | /* 1000 */ V(4, 2, 4), |
366 | /* 1001 */ V(1, 4, 4), | 377 | /* 1001 */ V(1, 4, 4), |
367 | /* 1010 */ V(4, 1, 3), | 378 | /* 1010 */ V(4, 1, 3), |
368 | /* 1011 */ V(4, 1, 3), | 379 | /* 1011 */ V(4, 1, 3), |
369 | /* 1100 */ V(0, 4, 4), | 380 | /* 1100 */ V(0, 4, 4), |
370 | /* 1101 */ V(4, 0, 4), | 381 | /* 1101 */ V(4, 0, 4), |
371 | /* 1110 */ V(2, 3, 4), | 382 | /* 1110 */ V(2, 3, 4), |
372 | /* 1111 */ V(3, 2, 4), | 383 | /* 1111 */ V(3, 2, 4), |
373 | 384 | ||
374 | /* 0001 ... */ | 385 | /* 0001 ... */ |
375 | /* 00 */ PTR(54, 2),/* 32 */ | 386 | /* 00 */ PTR(54, 2),/* 32 */ |
376 | /* 01 */ V(2, 2, 2), | 387 | /* 01 */ V(2, 2, 2), |
377 | /* 10 */ V(0, 2, 2), | 388 | /* 10 */ V(0, 2, 2), |
378 | /* 11 */ V(2, 0, 2), | 389 | /* 11 */ V(2, 0, 2), |
379 | 390 | ||
380 | /* 0000 0000 ... */ | 391 | /* 0000 0000 ... */ |
381 | /* 000 */ V(5, 5, 3),/* 36 */ | 392 | /* 000 */ V(5, 5, 3),/* 36 */ |
382 | /* 001 */ V(5, 4, 3), | 393 | /* 001 */ V(5, 4, 3), |
383 | /* 010 */ V(4, 5, 2), | 394 | /* 010 */ V(4, 5, 2), |
384 | /* 011 */ V(4, 5, 2), | 395 | /* 011 */ V(4, 5, 2), |
385 | /* 100 */ V(5, 3, 1), | 396 | /* 100 */ V(5, 3, 1), |
386 | /* 101 */ V(5, 3, 1), | 397 | /* 101 */ V(5, 3, 1), |
387 | /* 110 */ V(5, 3, 1), | 398 | /* 110 */ V(5, 3, 1), |
388 | /* 111 */ V(5, 3, 1), | 399 | /* 111 */ V(5, 3, 1), |
389 | 400 | ||
390 | /* 0000 0001 ... */ | 401 | /* 0000 0001 ... */ |
391 | /* 00 */ V(3, 5, 2),/* 44 */ | 402 | /* 00 */ V(3, 5, 2),/* 44 */ |
392 | /* 01 */ V(4, 4, 2), | 403 | /* 01 */ V(4, 4, 2), |
393 | /* 10 */ V(2, 5, 1), | 404 | /* 10 */ V(2, 5, 1), |
394 | /* 11 */ V(2, 5, 1), | 405 | /* 11 */ V(2, 5, 1), |
395 | 406 | ||
396 | /* 0000 0010 ... */ | 407 | /* 0000 0010 ... */ |
397 | /* 0 */ V(5, 2, 1),/* 48 */ | 408 | /* 0 */ V(5, 2, 1),/* 48 */ |
398 | /* 1 */ V(0, 5, 1), | 409 | /* 1 */ V(0, 5, 1), |
399 | 410 | ||
400 | /* 0000 0101 ... */ | 411 | /* 0000 0101 ... */ |
401 | /* 0 */ V(3, 4, 1),/* 50 */ | 412 | /* 0 */ V(3, 4, 1),/* 50 */ |
402 | /* 1 */ V(4, 3, 1), | 413 | /* 1 */ V(4, 3, 1), |
403 | 414 | ||
404 | /* 0000 0110 ... */ | 415 | /* 0000 0110 ... */ |
405 | /* 0 */ V(5, 0, 1),/* 52 */ | 416 | /* 0 */ V(5, 0, 1),/* 52 */ |
406 | /* 1 */ V(3, 3, 1), | 417 | /* 1 */ V(3, 3, 1), |
407 | 418 | ||
408 | /* 0001 00 ... */ | 419 | /* 0001 00 ... */ |
409 | /* 00 */ V(1, 3, 2),/* 54 */ | 420 | /* 00 */ V(1, 3, 2),/* 54 */ |
410 | /* 01 */ V(3, 1, 2), | 421 | /* 01 */ V(3, 1, 2), |
411 | /* 10 */ V(0, 3, 2), | 422 | /* 10 */ V(0, 3, 2), |
412 | /* 11 */ V(3, 0, 2), | 423 | /* 11 */ V(3, 0, 2), |
413 | }; | 424 | }; |
414 | # else | 425 | # else |
415 | static | 426 | static |
416 | union huffpair const hufftab8[] = { | 427 | union huffpair const hufftab8[] = { |
417 | /* 0000 */ PTR(16, 4), | 428 | /* 0000 */ PTR(16, 4), |
418 | /* 0001 */ PTR(32, 4), | 429 | /* 0001 */ PTR(32, 4), |
419 | /* 0010 */ V(1, 2, 4), | 430 | /* 0010 */ V(1, 2, 4), |
420 | /* 0011 */ V(2, 1, 4), | 431 | /* 0011 */ V(2, 1, 4), |
421 | /* 0100 */ V(1, 1, 2), | 432 | /* 0100 */ V(1, 1, 2), |
422 | /* 0101 */ V(1, 1, 2), | 433 | /* 0101 */ V(1, 1, 2), |
423 | /* 0110 */ V(1, 1, 2), | 434 | /* 0110 */ V(1, 1, 2), |
424 | /* 0111 */ V(1, 1, 2), | 435 | /* 0111 */ V(1, 1, 2), |
425 | /* 1000 */ V(0, 1, 3), | 436 | /* 1000 */ V(0, 1, 3), |
426 | /* 1001 */ V(0, 1, 3), | 437 | /* 1001 */ V(0, 1, 3), |
427 | /* 1010 */ V(1, 0, 3), | 438 | /* 1010 */ V(1, 0, 3), |
428 | /* 1011 */ V(1, 0, 3), | 439 | /* 1011 */ V(1, 0, 3), |
429 | /* 1100 */ V(0, 0, 2), | 440 | /* 1100 */ V(0, 0, 2), |
430 | /* 1101 */ V(0, 0, 2), | 441 | /* 1101 */ V(0, 0, 2), |
431 | /* 1110 */ V(0, 0, 2), | 442 | /* 1110 */ V(0, 0, 2), |
432 | /* 1111 */ V(0, 0, 2), | 443 | /* 1111 */ V(0, 0, 2), |
433 | 444 | ||
434 | /* 0000 ... */ | 445 | /* 0000 ... */ |
435 | /* 0000 */ PTR(48, 3),/* 16 */ | 446 | /* 0000 */ PTR(48, 3),/* 16 */ |
436 | /* 0001 */ PTR(56, 2), | 447 | /* 0001 */ PTR(56, 2), |
437 | /* 0010 */ PTR(60, 1), | 448 | /* 0010 */ PTR(60, 1), |
438 | /* 0011 */ V(1, 5, 4), | 449 | /* 0011 */ V(1, 5, 4), |
439 | /* 0100 */ V(5, 1, 4), | 450 | /* 0100 */ V(5, 1, 4), |
440 | /* 0101 */ PTR(62, 1), | 451 | /* 0101 */ PTR(62, 1), |
441 | /* 0110 */ PTR(64, 1), | 452 | /* 0110 */ PTR(64, 1), |
442 | /* 0111 */ V(2, 4, 4), | 453 | /* 0111 */ V(2, 4, 4), |
443 | /* 1000 */ V(4, 2, 4), | 454 | /* 1000 */ V(4, 2, 4), |
444 | /* 1001 */ V(1, 4, 4), | 455 | /* 1001 */ V(1, 4, 4), |
445 | /* 1010 */ V(4, 1, 3), | 456 | /* 1010 */ V(4, 1, 3), |
446 | /* 1011 */ V(4, 1, 3), | 457 | /* 1011 */ V(4, 1, 3), |
447 | /* 1100 */ V(0, 4, 4), | 458 | /* 1100 */ V(0, 4, 4), |
448 | /* 1101 */ V(4, 0, 4), | 459 | /* 1101 */ V(4, 0, 4), |
449 | /* 1110 */ V(2, 3, 4), | 460 | /* 1110 */ V(2, 3, 4), |
450 | /* 1111 */ V(3, 2, 4), | 461 | /* 1111 */ V(3, 2, 4), |
451 | 462 | ||
452 | /* 0001 ... */ | 463 | /* 0001 ... */ |
453 | /* 0000 */ V(1, 3, 4),/* 32 */ | 464 | /* 0000 */ V(1, 3, 4),/* 32 */ |
454 | /* 0001 */ V(3, 1, 4), | 465 | /* 0001 */ V(3, 1, 4), |
455 | /* 0010 */ V(0, 3, 4), | 466 | /* 0010 */ V(0, 3, 4), |
456 | /* 0011 */ V(3, 0, 4), | 467 | /* 0011 */ V(3, 0, 4), |
457 | /* 0100 */ V(2, 2, 2), | 468 | /* 0100 */ V(2, 2, 2), |
458 | /* 0101 */ V(2, 2, 2), | 469 | /* 0101 */ V(2, 2, 2), |
459 | /* 0110 */ V(2, 2, 2), | 470 | /* 0110 */ V(2, 2, 2), |
460 | /* 0111 */ V(2, 2, 2), | 471 | /* 0111 */ V(2, 2, 2), |
461 | /* 1000 */ V(0, 2, 2), | 472 | /* 1000 */ V(0, 2, 2), |
462 | /* 1001 */ V(0, 2, 2), | 473 | /* 1001 */ V(0, 2, 2), |
463 | /* 1010 */ V(0, 2, 2), | 474 | /* 1010 */ V(0, 2, 2), |
464 | /* 1011 */ V(0, 2, 2), | 475 | /* 1011 */ V(0, 2, 2), |
465 | /* 1100 */ V(2, 0, 2), | 476 | /* 1100 */ V(2, 0, 2), |
466 | /* 1101 */ V(2, 0, 2), | 477 | /* 1101 */ V(2, 0, 2), |
467 | /* 1110 */ V(2, 0, 2), | 478 | /* 1110 */ V(2, 0, 2), |
468 | /* 1111 */ V(2, 0, 2), | 479 | /* 1111 */ V(2, 0, 2), |
469 | 480 | ||
470 | /* 0000 0000 ... */ | 481 | /* 0000 0000 ... */ |
471 | /* 000 */ V(5, 5, 3),/* 48 */ | 482 | /* 000 */ V(5, 5, 3),/* 48 */ |
472 | /* 001 */ V(5, 4, 3), | 483 | /* 001 */ V(5, 4, 3), |
473 | /* 010 */ V(4, 5, 2), | 484 | /* 010 */ V(4, 5, 2), |
474 | /* 011 */ V(4, 5, 2), | 485 | /* 011 */ V(4, 5, 2), |
475 | /* 100 */ V(5, 3, 1), | 486 | /* 100 */ V(5, 3, 1), |
476 | /* 101 */ V(5, 3, 1), | 487 | /* 101 */ V(5, 3, 1), |
477 | /* 110 */ V(5, 3, 1), | 488 | /* 110 */ V(5, 3, 1), |
478 | /* 111 */ V(5, 3, 1), | 489 | /* 111 */ V(5, 3, 1), |
479 | 490 | ||
480 | /* 0000 0001 ... */ | 491 | /* 0000 0001 ... */ |
481 | /* 00 */ V(3, 5, 2),/* 56 */ | 492 | /* 00 */ V(3, 5, 2),/* 56 */ |
482 | /* 01 */ V(4, 4, 2), | 493 | /* 01 */ V(4, 4, 2), |
483 | /* 10 */ V(2, 5, 1), | 494 | /* 10 */ V(2, 5, 1), |
484 | /* 11 */ V(2, 5, 1), | 495 | /* 11 */ V(2, 5, 1), |
485 | 496 | ||
486 | /* 0000 0010 ... */ | 497 | /* 0000 0010 ... */ |
487 | /* 0 */ V(5, 2, 1),/* 60 */ | 498 | /* 0 */ V(5, 2, 1),/* 60 */ |
488 | /* 1 */ V(0, 5, 1), | 499 | /* 1 */ V(0, 5, 1), |
489 | 500 | ||
490 | /* 0000 0101 ... */ | 501 | /* 0000 0101 ... */ |
491 | /* 0 */ V(3, 4, 1),/* 62 */ | 502 | /* 0 */ V(3, 4, 1),/* 62 */ |
492 | /* 1 */ V(4, 3, 1), | 503 | /* 1 */ V(4, 3, 1), |
493 | 504 | ||
494 | /* 0000 0110 ... */ | 505 | /* 0000 0110 ... */ |
495 | /* 0 */ V(5, 0, 1),/* 64 */ | 506 | /* 0 */ V(5, 0, 1),/* 64 */ |
496 | /* 1 */ V(3, 3, 1) | 507 | /* 1 */ V(3, 3, 1) |
497 | }; | 508 | }; |
498 | # endif | 509 | # endif |
499 | 510 | ||
500 | static | 511 | static |
501 | union huffpair const hufftab9[] = { | 512 | union huffpair const hufftab9[] = { |
502 | /* 0000 */ PTR(16, 4), | 513 | /* 0000 */ PTR(16, 4), |
503 | /* 0001 */ PTR(32, 3), | 514 | /* 0001 */ PTR(32, 3), |
504 | /* 0010 */ PTR(40, 2), | 515 | /* 0010 */ PTR(40, 2), |
505 | /* 0011 */ PTR(44, 2), | 516 | /* 0011 */ PTR(44, 2), |
506 | /* 0100 */ PTR(48, 1), | 517 | /* 0100 */ PTR(48, 1), |
507 | /* 0101 */ V(1, 2, 4), | 518 | /* 0101 */ V(1, 2, 4), |
508 | /* 0110 */ V(2, 1, 4), | 519 | /* 0110 */ V(2, 1, 4), |
509 | /* 0111 */ V(2, 0, 4), | 520 | /* 0111 */ V(2, 0, 4), |
510 | /* 1000 */ V(1, 1, 3), | 521 | /* 1000 */ V(1, 1, 3), |
511 | /* 1001 */ V(1, 1, 3), | 522 | /* 1001 */ V(1, 1, 3), |
512 | /* 1010 */ V(0, 1, 3), | 523 | /* 1010 */ V(0, 1, 3), |
513 | /* 1011 */ V(0, 1, 3), | 524 | /* 1011 */ V(0, 1, 3), |
514 | /* 1100 */ V(1, 0, 3), | 525 | /* 1100 */ V(1, 0, 3), |
515 | /* 1101 */ V(1, 0, 3), | 526 | /* 1101 */ V(1, 0, 3), |
516 | /* 1110 */ V(0, 0, 3), | 527 | /* 1110 */ V(0, 0, 3), |
517 | /* 1111 */ V(0, 0, 3), | 528 | /* 1111 */ V(0, 0, 3), |
518 | 529 | ||
519 | /* 0000 ... */ | 530 | /* 0000 ... */ |
520 | /* 0000 */ PTR(50, 1),/* 16 */ | 531 | /* 0000 */ PTR(50, 1),/* 16 */ |
521 | /* 0001 */ V(3, 5, 4), | 532 | /* 0001 */ V(3, 5, 4), |
522 | /* 0010 */ V(5, 3, 4), | 533 | /* 0010 */ V(5, 3, 4), |
523 | /* 0011 */ PTR(52, 1), | 534 | /* 0011 */ PTR(52, 1), |
524 | /* 0100 */ V(4, 4, 4), | 535 | /* 0100 */ V(4, 4, 4), |
525 | /* 0101 */ V(2, 5, 4), | 536 | /* 0101 */ V(2, 5, 4), |
526 | /* 0110 */ V(5, 2, 4), | 537 | /* 0110 */ V(5, 2, 4), |
527 | /* 0111 */ V(1, 5, 4), | 538 | /* 0111 */ V(1, 5, 4), |
528 | /* 1000 */ V(5, 1, 3), | 539 | /* 1000 */ V(5, 1, 3), |
529 | /* 1001 */ V(5, 1, 3), | 540 | /* 1001 */ V(5, 1, 3), |
530 | /* 1010 */ V(3, 4, 3), | 541 | /* 1010 */ V(3, 4, 3), |
531 | /* 1011 */ V(3, 4, 3), | 542 | /* 1011 */ V(3, 4, 3), |
532 | /* 1100 */ V(4, 3, 3), | 543 | /* 1100 */ V(4, 3, 3), |
533 | /* 1101 */ V(4, 3, 3), | 544 | /* 1101 */ V(4, 3, 3), |
534 | /* 1110 */ V(5, 0, 4), | 545 | /* 1110 */ V(5, 0, 4), |
535 | /* 1111 */ V(0, 4, 4), | 546 | /* 1111 */ V(0, 4, 4), |
536 | 547 | ||
537 | /* 0001 ... */ | 548 | /* 0001 ... */ |
538 | /* 000 */ V(2, 4, 3),/* 32 */ | 549 | /* 000 */ V(2, 4, 3),/* 32 */ |
539 | /* 001 */ V(4, 2, 3), | 550 | /* 001 */ V(4, 2, 3), |
540 | /* 010 */ V(3, 3, 3), | 551 | /* 010 */ V(3, 3, 3), |
541 | /* 011 */ V(4, 0, 3), | 552 | /* 011 */ V(4, 0, 3), |
542 | /* 100 */ V(1, 4, 2), | 553 | /* 100 */ V(1, 4, 2), |
543 | /* 101 */ V(1, 4, 2), | 554 | /* 101 */ V(1, 4, 2), |
544 | /* 110 */ V(4, 1, 2), | 555 | /* 110 */ V(4, 1, 2), |
545 | /* 111 */ V(4, 1, 2), | 556 | /* 111 */ V(4, 1, 2), |
546 | 557 | ||
547 | /* 0010 ... */ | 558 | /* 0010 ... */ |
548 | /* 00 */ V(2, 3, 2),/* 40 */ | 559 | /* 00 */ V(2, 3, 2),/* 40 */ |
549 | /* 01 */ V(3, 2, 2), | 560 | /* 01 */ V(3, 2, 2), |
550 | /* 10 */ V(1, 3, 1), | 561 | /* 10 */ V(1, 3, 1), |
551 | /* 11 */ V(1, 3, 1), | 562 | /* 11 */ V(1, 3, 1), |
552 | 563 | ||
553 | /* 0011 ... */ | 564 | /* 0011 ... */ |
554 | /* 00 */ V(3, 1, 1),/* 44 */ | 565 | /* 00 */ V(3, 1, 1),/* 44 */ |
555 | /* 01 */ V(3, 1, 1), | 566 | /* 01 */ V(3, 1, 1), |
556 | /* 10 */ V(0, 3, 2), | 567 | /* 10 */ V(0, 3, 2), |
557 | /* 11 */ V(3, 0, 2), | 568 | /* 11 */ V(3, 0, 2), |
558 | 569 | ||
559 | /* 0100 ... */ | 570 | /* 0100 ... */ |
560 | /* 0 */ V(2, 2, 1),/* 48 */ | 571 | /* 0 */ V(2, 2, 1),/* 48 */ |
561 | /* 1 */ V(0, 2, 1), | 572 | /* 1 */ V(0, 2, 1), |
562 | 573 | ||
563 | /* 0000 0000 ... */ | 574 | /* 0000 0000 ... */ |
564 | /* 0 */ V(5, 5, 1),/* 50 */ | 575 | /* 0 */ V(5, 5, 1),/* 50 */ |
565 | /* 1 */ V(4, 5, 1), | 576 | /* 1 */ V(4, 5, 1), |
566 | 577 | ||
567 | /* 0000 0011 ... */ | 578 | /* 0000 0011 ... */ |
568 | /* 0 */ V(5, 4, 1),/* 52 */ | 579 | /* 0 */ V(5, 4, 1),/* 52 */ |
569 | /* 1 */ V(0, 5, 1) | 580 | /* 1 */ V(0, 5, 1) |
570 | }; | 581 | }; |
571 | 582 | ||
572 | static | 583 | static |
573 | union huffpair const hufftab10[] = { | 584 | union huffpair const hufftab10[] = { |
574 | /* 0000 */ PTR(16, 4), | 585 | /* 0000 */ PTR(16, 4), |
575 | /* 0001 */ PTR(32, 4), | 586 | /* 0001 */ PTR(32, 4), |
576 | /* 0010 */ PTR(48, 2), | 587 | /* 0010 */ PTR(48, 2), |
577 | /* 0011 */ V(1, 1, 4), | 588 | /* 0011 */ V(1, 1, 4), |
578 | /* 0100 */ V(0, 1, 3), | 589 | /* 0100 */ V(0, 1, 3), |
579 | /* 0101 */ V(0, 1, 3), | 590 | /* 0101 */ V(0, 1, 3), |
580 | /* 0110 */ V(1, 0, 3), | 591 | /* 0110 */ V(1, 0, 3), |
581 | /* 0111 */ V(1, 0, 3), | 592 | /* 0111 */ V(1, 0, 3), |
582 | /* 1000 */ V(0, 0, 1), | 593 | /* 1000 */ V(0, 0, 1), |
583 | /* 1001 */ V(0, 0, 1), | 594 | /* 1001 */ V(0, 0, 1), |
584 | /* 1010 */ V(0, 0, 1), | 595 | /* 1010 */ V(0, 0, 1), |
585 | /* 1011 */ V(0, 0, 1), | 596 | /* 1011 */ V(0, 0, 1), |
586 | /* 1100 */ V(0, 0, 1), | 597 | /* 1100 */ V(0, 0, 1), |
587 | /* 1101 */ V(0, 0, 1), | 598 | /* 1101 */ V(0, 0, 1), |
588 | /* 1110 */ V(0, 0, 1), | 599 | /* 1110 */ V(0, 0, 1), |
589 | /* 1111 */ V(0, 0, 1), | 600 | /* 1111 */ V(0, 0, 1), |
590 | 601 | ||
591 | /* 0000 ... */ | 602 | /* 0000 ... */ |
592 | /* 0000 */ PTR(52, 3),/* 16 */ | 603 | /* 0000 */ PTR(52, 3),/* 16 */ |
593 | /* 0001 */ PTR(60, 2), | 604 | /* 0001 */ PTR(60, 2), |
594 | /* 0010 */ PTR(64, 3), | 605 | /* 0010 */ PTR(64, 3), |
595 | /* 0011 */ PTR(72, 1), | 606 | /* 0011 */ PTR(72, 1), |
596 | /* 0100 */ PTR(74, 2), | 607 | /* 0100 */ PTR(74, 2), |
597 | /* 0101 */ PTR(78, 2), | 608 | /* 0101 */ PTR(78, 2), |
598 | /* 0110 */ PTR(82, 2), | 609 | /* 0110 */ PTR(82, 2), |
599 | /* 0111 */ V(1, 7, 4), | 610 | /* 0111 */ V(1, 7, 4), |
600 | /* 1000 */ V(7, 1, 4), | 611 | /* 1000 */ V(7, 1, 4), |
601 | /* 1001 */ PTR(86, 1), | 612 | /* 1001 */ PTR(86, 1), |
602 | /* 1010 */ PTR(88, 2), | 613 | /* 1010 */ PTR(88, 2), |
603 | /* 1011 */ PTR(92, 2), | 614 | /* 1011 */ PTR(92, 2), |
604 | /* 1100 */ V(1, 6, 4), | 615 | /* 1100 */ V(1, 6, 4), |
605 | /* 1101 */ V(6, 1, 4), | 616 | /* 1101 */ V(6, 1, 4), |
606 | /* 1110 */ V(6, 0, 4), | 617 | /* 1110 */ V(6, 0, 4), |
607 | /* 1111 */ PTR(96, 1), | 618 | /* 1111 */ PTR(96, 1), |
608 | 619 | ||
609 | /* 0001 ... */ | 620 | /* 0001 ... */ |
610 | /* 0000 */ PTR(98, 1),/* 32 */ | 621 | /* 0000 */ PTR(98, 1),/* 32 */ |
611 | /* 0001 */ PTR(100, 1), | 622 | /* 0001 */ PTR(100, 1), |
612 | /* 0010 */ V(1, 4, 4), | 623 | /* 0010 */ V(1, 4, 4), |
613 | /* 0011 */ V(4, 1, 4), | 624 | /* 0011 */ V(4, 1, 4), |
614 | /* 0100 */ V(4, 0, 4), | 625 | /* 0100 */ V(4, 0, 4), |
615 | /* 0101 */ V(2, 3, 4), | 626 | /* 0101 */ V(2, 3, 4), |
616 | /* 0110 */ V(3, 2, 4), | 627 | /* 0110 */ V(3, 2, 4), |
617 | /* 0111 */ V(0, 3, 4), | 628 | /* 0111 */ V(0, 3, 4), |
618 | /* 1000 */ V(1, 3, 3), | 629 | /* 1000 */ V(1, 3, 3), |
619 | /* 1001 */ V(1, 3, 3), | 630 | /* 1001 */ V(1, 3, 3), |
620 | /* 1010 */ V(3, 1, 3), | 631 | /* 1010 */ V(3, 1, 3), |
621 | /* 1011 */ V(3, 1, 3), | 632 | /* 1011 */ V(3, 1, 3), |
622 | /* 1100 */ V(3, 0, 3), | 633 | /* 1100 */ V(3, 0, 3), |
623 | /* 1101 */ V(3, 0, 3), | 634 | /* 1101 */ V(3, 0, 3), |
624 | /* 1110 */ V(2, 2, 3), | 635 | /* 1110 */ V(2, 2, 3), |
625 | /* 1111 */ V(2, 2, 3), | 636 | /* 1111 */ V(2, 2, 3), |
626 | 637 | ||
627 | /* 0010 ... */ | 638 | /* 0010 ... */ |
628 | /* 00 */ V(1, 2, 2),/* 48 */ | 639 | /* 00 */ V(1, 2, 2),/* 48 */ |
629 | /* 01 */ V(2, 1, 2), | 640 | /* 01 */ V(2, 1, 2), |
630 | /* 10 */ V(0, 2, 2), | 641 | /* 10 */ V(0, 2, 2), |
631 | /* 11 */ V(2, 0, 2), | 642 | /* 11 */ V(2, 0, 2), |
632 | 643 | ||
633 | /* 0000 0000 ... */ | 644 | /* 0000 0000 ... */ |
634 | /* 000 */ V(7, 7, 3),/* 52 */ | 645 | /* 000 */ V(7, 7, 3),/* 52 */ |
635 | /* 001 */ V(6, 7, 3), | 646 | /* 001 */ V(6, 7, 3), |
636 | /* 010 */ V(7, 6, 3), | 647 | /* 010 */ V(7, 6, 3), |
637 | /* 011 */ V(5, 7, 3), | 648 | /* 011 */ V(5, 7, 3), |
638 | /* 100 */ V(7, 5, 3), | 649 | /* 100 */ V(7, 5, 3), |
639 | /* 101 */ V(6, 6, 3), | 650 | /* 101 */ V(6, 6, 3), |
640 | /* 110 */ V(4, 7, 2), | 651 | /* 110 */ V(4, 7, 2), |
641 | /* 111 */ V(4, 7, 2), | 652 | /* 111 */ V(4, 7, 2), |
642 | 653 | ||
643 | /* 0000 0001 ... */ | 654 | /* 0000 0001 ... */ |
644 | /* 00 */ V(7, 4, 2),/* 60 */ | 655 | /* 00 */ V(7, 4, 2),/* 60 */ |
645 | /* 01 */ V(5, 6, 2), | 656 | /* 01 */ V(5, 6, 2), |
646 | /* 10 */ V(6, 5, 2), | 657 | /* 10 */ V(6, 5, 2), |
647 | /* 11 */ V(3, 7, 2), | 658 | /* 11 */ V(3, 7, 2), |
648 | 659 | ||
649 | /* 0000 0010 ... */ | 660 | /* 0000 0010 ... */ |
650 | /* 000 */ V(7, 3, 2),/* 64 */ | 661 | /* 000 */ V(7, 3, 2),/* 64 */ |
651 | /* 001 */ V(7, 3, 2), | 662 | /* 001 */ V(7, 3, 2), |
652 | /* 010 */ V(4, 6, 2), | 663 | /* 010 */ V(4, 6, 2), |
653 | /* 011 */ V(4, 6, 2), | 664 | /* 011 */ V(4, 6, 2), |
654 | /* 100 */ V(5, 5, 3), | 665 | /* 100 */ V(5, 5, 3), |
655 | /* 101 */ V(5, 4, 3), | 666 | /* 101 */ V(5, 4, 3), |
656 | /* 110 */ V(6, 3, 2), | 667 | /* 110 */ V(6, 3, 2), |
657 | /* 111 */ V(6, 3, 2), | 668 | /* 111 */ V(6, 3, 2), |
658 | 669 | ||
659 | /* 0000 0011 ... */ | 670 | /* 0000 0011 ... */ |
660 | /* 0 */ V(2, 7, 1),/* 72 */ | 671 | /* 0 */ V(2, 7, 1),/* 72 */ |
661 | /* 1 */ V(7, 2, 1), | 672 | /* 1 */ V(7, 2, 1), |
662 | 673 | ||
663 | /* 0000 0100 ... */ | 674 | /* 0000 0100 ... */ |
664 | /* 00 */ V(6, 4, 2),/* 74 */ | 675 | /* 00 */ V(6, 4, 2),/* 74 */ |
665 | /* 01 */ V(0, 7, 2), | 676 | /* 01 */ V(0, 7, 2), |
666 | /* 10 */ V(7, 0, 1), | 677 | /* 10 */ V(7, 0, 1), |
667 | /* 11 */ V(7, 0, 1), | 678 | /* 11 */ V(7, 0, 1), |
668 | 679 | ||
669 | /* 0000 0101 ... */ | 680 | /* 0000 0101 ... */ |
670 | /* 00 */ V(6, 2, 1),/* 78 */ | 681 | /* 00 */ V(6, 2, 1),/* 78 */ |
671 | /* 01 */ V(6, 2, 1), | 682 | /* 01 */ V(6, 2, 1), |
672 | /* 10 */ V(4, 5, 2), | 683 | /* 10 */ V(4, 5, 2), |
673 | /* 11 */ V(3, 5, 2), | 684 | /* 11 */ V(3, 5, 2), |
674 | 685 | ||
675 | /* 0000 0110 ... */ | 686 | /* 0000 0110 ... */ |
676 | /* 00 */ V(0, 6, 1),/* 82 */ | 687 | /* 00 */ V(0, 6, 1),/* 82 */ |
677 | /* 01 */ V(0, 6, 1), | 688 | /* 01 */ V(0, 6, 1), |
678 | /* 10 */ V(5, 3, 2), | 689 | /* 10 */ V(5, 3, 2), |
679 | /* 11 */ V(4, 4, 2), | 690 | /* 11 */ V(4, 4, 2), |
680 | 691 | ||
681 | /* 0000 1001 ... */ | 692 | /* 0000 1001 ... */ |
682 | /* 0 */ V(3, 6, 1),/* 86 */ | 693 | /* 0 */ V(3, 6, 1),/* 86 */ |
683 | /* 1 */ V(2, 6, 1), | 694 | /* 1 */ V(2, 6, 1), |
684 | 695 | ||
685 | /* 0000 1010 ... */ | 696 | /* 0000 1010 ... */ |
686 | /* 00 */ V(2, 5, 2),/* 88 */ | 697 | /* 00 */ V(2, 5, 2),/* 88 */ |
687 | /* 01 */ V(5, 2, 2), | 698 | /* 01 */ V(5, 2, 2), |
688 | /* 10 */ V(1, 5, 1), | 699 | /* 10 */ V(1, 5, 1), |
689 | /* 11 */ V(1, 5, 1), | 700 | /* 11 */ V(1, 5, 1), |
690 | 701 | ||
691 | /* 0000 1011 ... */ | 702 | /* 0000 1011 ... */ |
692 | /* 00 */ V(5, 1, 1),/* 92 */ | 703 | /* 00 */ V(5, 1, 1),/* 92 */ |
693 | /* 01 */ V(5, 1, 1), | 704 | /* 01 */ V(5, 1, 1), |
694 | /* 10 */ V(3, 4, 2), | 705 | /* 10 */ V(3, 4, 2), |
695 | /* 11 */ V(4, 3, 2), | 706 | /* 11 */ V(4, 3, 2), |
696 | 707 | ||
697 | /* 0000 1111 ... */ | 708 | /* 0000 1111 ... */ |
698 | /* 0 */ V(0, 5, 1),/* 96 */ | 709 | /* 0 */ V(0, 5, 1),/* 96 */ |
699 | /* 1 */ V(5, 0, 1), | 710 | /* 1 */ V(5, 0, 1), |
700 | 711 | ||
701 | /* 0001 0000 ... */ | 712 | /* 0001 0000 ... */ |
702 | /* 0 */ V(2, 4, 1),/* 98 */ | 713 | /* 0 */ V(2, 4, 1),/* 98 */ |
703 | /* 1 */ V(4, 2, 1), | 714 | /* 1 */ V(4, 2, 1), |
704 | 715 | ||
705 | /* 0001 0001 ... */ | 716 | /* 0001 0001 ... */ |
706 | /* 0 */ V(3, 3, 1),/* 100 */ | 717 | /* 0 */ V(3, 3, 1),/* 100 */ |
707 | /* 1 */ V(0, 4, 1) | 718 | /* 1 */ V(0, 4, 1) |
708 | }; | 719 | }; |
709 | 720 | ||
710 | static | 721 | static |
711 | union huffpair const hufftab11[] = { | 722 | union huffpair const hufftab11[] = { |
712 | /* 0000 */ PTR(16, 4), | 723 | /* 0000 */ PTR(16, 4), |
713 | /* 0001 */ PTR(32, 4), | 724 | /* 0001 */ PTR(32, 4), |
714 | /* 0010 */ PTR(48, 4), | 725 | /* 0010 */ PTR(48, 4), |
715 | /* 0011 */ PTR(64, 3), | 726 | /* 0011 */ PTR(64, 3), |
716 | /* 0100 */ V(1, 2, 4), | 727 | /* 0100 */ V(1, 2, 4), |
717 | /* 0101 */ PTR(72, 1), | 728 | /* 0101 */ PTR(72, 1), |
718 | /* 0110 */ V(1, 1, 3), | 729 | /* 0110 */ V(1, 1, 3), |
719 | /* 0111 */ V(1, 1, 3), | 730 | /* 0111 */ V(1, 1, 3), |
720 | /* 1000 */ V(0, 1, 3), | 731 | /* 1000 */ V(0, 1, 3), |
721 | /* 1001 */ V(0, 1, 3), | 732 | /* 1001 */ V(0, 1, 3), |
722 | /* 1010 */ V(1, 0, 3), | 733 | /* 1010 */ V(1, 0, 3), |
723 | /* 1011 */ V(1, 0, 3), | 734 | /* 1011 */ V(1, 0, 3), |
724 | /* 1100 */ V(0, 0, 2), | 735 | /* 1100 */ V(0, 0, 2), |
725 | /* 1101 */ V(0, 0, 2), | 736 | /* 1101 */ V(0, 0, 2), |
726 | /* 1110 */ V(0, 0, 2), | 737 | /* 1110 */ V(0, 0, 2), |
727 | /* 1111 */ V(0, 0, 2), | 738 | /* 1111 */ V(0, 0, 2), |
728 | 739 | ||
729 | /* 0000 ... */ | 740 | /* 0000 ... */ |
730 | /* 0000 */ PTR(74, 2),/* 16 */ | 741 | /* 0000 */ PTR(74, 2),/* 16 */ |
731 | /* 0001 */ PTR(78, 3), | 742 | /* 0001 */ PTR(78, 3), |
732 | /* 0010 */ PTR(86, 2), | 743 | /* 0010 */ PTR(86, 2), |
733 | /* 0011 */ PTR(90, 1), | 744 | /* 0011 */ PTR(90, 1), |
734 | /* 0100 */ PTR(92, 2), | 745 | /* 0100 */ PTR(92, 2), |
735 | /* 0101 */ V(2, 7, 4), | 746 | /* 0101 */ V(2, 7, 4), |
736 | /* 0110 */ V(7, 2, 4), | 747 | /* 0110 */ V(7, 2, 4), |
737 | /* 0111 */ PTR(96, 1), | 748 | /* 0111 */ PTR(96, 1), |
738 | /* 1000 */ V(7, 1, 3), | 749 | /* 1000 */ V(7, 1, 3), |
739 | /* 1001 */ V(7, 1, 3), | 750 | /* 1001 */ V(7, 1, 3), |
740 | /* 1010 */ V(1, 7, 4), | 751 | /* 1010 */ V(1, 7, 4), |
741 | /* 1011 */ V(7, 0, 4), | 752 | /* 1011 */ V(7, 0, 4), |
742 | /* 1100 */ V(3, 6, 4), | 753 | /* 1100 */ V(3, 6, 4), |
743 | /* 1101 */ V(6, 3, 4), | 754 | /* 1101 */ V(6, 3, 4), |
744 | /* 1110 */ V(6, 0, 4), | 755 | /* 1110 */ V(6, 0, 4), |
745 | /* 1111 */ PTR(98, 1), | 756 | /* 1111 */ PTR(98, 1), |
746 | 757 | ||
747 | /* 0001 ... */ | 758 | /* 0001 ... */ |
748 | /* 0000 */ PTR(100, 1),/* 32 */ | 759 | /* 0000 */ PTR(100, 1),/* 32 */ |
749 | /* 0001 */ V(1, 5, 4), | 760 | /* 0001 */ V(1, 5, 4), |
750 | /* 0010 */ V(6, 2, 3), | 761 | /* 0010 */ V(6, 2, 3), |
751 | /* 0011 */ V(6, 2, 3), | 762 | /* 0011 */ V(6, 2, 3), |
752 | /* 0100 */ V(2, 6, 4), | 763 | /* 0100 */ V(2, 6, 4), |
753 | /* 0101 */ V(0, 6, 4), | 764 | /* 0101 */ V(0, 6, 4), |
754 | /* 0110 */ V(1, 6, 3), | 765 | /* 0110 */ V(1, 6, 3), |
755 | /* 0111 */ V(1, 6, 3), | 766 | /* 0111 */ V(1, 6, 3), |
756 | /* 1000 */ V(6, 1, 3), | 767 | /* 1000 */ V(6, 1, 3), |
757 | /* 1001 */ V(6, 1, 3), | 768 | /* 1001 */ V(6, 1, 3), |
758 | /* 1010 */ V(5, 1, 4), | 769 | /* 1010 */ V(5, 1, 4), |
759 | /* 1011 */ V(3, 4, 4), | 770 | /* 1011 */ V(3, 4, 4), |
760 | /* 1100 */ V(5, 0, 4), | 771 | /* 1100 */ V(5, 0, 4), |
761 | /* 1101 */ PTR(102, 1), | 772 | /* 1101 */ PTR(102, 1), |
762 | /* 1110 */ V(2, 4, 4), | 773 | /* 1110 */ V(2, 4, 4), |
763 | /* 1111 */ V(4, 2, 4), | 774 | /* 1111 */ V(4, 2, 4), |
764 | 775 | ||
765 | /* 0010 ... */ | 776 | /* 0010 ... */ |
766 | /* 0000 */ V(1, 4, 4),/* 48 */ | 777 | /* 0000 */ V(1, 4, 4),/* 48 */ |
767 | /* 0001 */ V(4, 1, 4), | 778 | /* 0001 */ V(4, 1, 4), |
768 | /* 0010 */ V(0, 4, 4), | 779 | /* 0010 */ V(0, 4, 4), |
769 | /* 0011 */ V(4, 0, 4), | 780 | /* 0011 */ V(4, 0, 4), |
770 | /* 0100 */ V(2, 3, 3), | 781 | /* 0100 */ V(2, 3, 3), |
771 | /* 0101 */ V(2, 3, 3), | 782 | /* 0101 */ V(2, 3, 3), |
772 | /* 0110 */ V(3, 2, 3), | 783 | /* 0110 */ V(3, 2, 3), |
773 | /* 0111 */ V(3, 2, 3), | 784 | /* 0111 */ V(3, 2, 3), |
774 | /* 1000 */ V(1, 3, 2), | 785 | /* 1000 */ V(1, 3, 2), |
775 | /* 1001 */ V(1, 3, 2), | 786 | /* 1001 */ V(1, 3, 2), |
776 | /* 1010 */ V(1, 3, 2), | 787 | /* 1010 */ V(1, 3, 2), |
777 | /* 1011 */ V(1, 3, 2), | 788 | /* 1011 */ V(1, 3, 2), |
778 | /* 1100 */ V(3, 1, 2), | 789 | /* 1100 */ V(3, 1, 2), |
779 | /* 1101 */ V(3, 1, 2), | 790 | /* 1101 */ V(3, 1, 2), |
780 | /* 1110 */ V(3, 1, 2), | 791 | /* 1110 */ V(3, 1, 2), |
781 | /* 1111 */ V(3, 1, 2), | 792 | /* 1111 */ V(3, 1, 2), |
782 | 793 | ||
783 | /* 0011 ... */ | 794 | /* 0011 ... */ |
784 | /* 000 */ V(0, 3, 3),/* 64 */ | 795 | /* 000 */ V(0, 3, 3),/* 64 */ |
785 | /* 001 */ V(3, 0, 3), | 796 | /* 001 */ V(3, 0, 3), |
786 | /* 010 */ V(2, 2, 2), | 797 | /* 010 */ V(2, 2, 2), |
787 | /* 011 */ V(2, 2, 2), | 798 | /* 011 */ V(2, 2, 2), |
788 | /* 100 */ V(2, 1, 1), | 799 | /* 100 */ V(2, 1, 1), |
789 | /* 101 */ V(2, 1, 1), | 800 | /* 101 */ V(2, 1, 1), |
790 | /* 110 */ V(2, 1, 1), | 801 | /* 110 */ V(2, 1, 1), |
791 | /* 111 */ V(2, 1, 1), | 802 | /* 111 */ V(2, 1, 1), |
792 | 803 | ||
793 | /* 0101 ... */ | 804 | /* 0101 ... */ |
794 | /* 0 */ V(0, 2, 1),/* 72 */ | 805 | /* 0 */ V(0, 2, 1),/* 72 */ |
795 | /* 1 */ V(2, 0, 1), | 806 | /* 1 */ V(2, 0, 1), |
796 | 807 | ||
797 | /* 0000 0000 ... */ | 808 | /* 0000 0000 ... */ |
798 | /* 00 */ V(7, 7, 2),/* 74 */ | 809 | /* 00 */ V(7, 7, 2),/* 74 */ |
799 | /* 01 */ V(6, 7, 2), | 810 | /* 01 */ V(6, 7, 2), |
800 | /* 10 */ V(7, 6, 2), | 811 | /* 10 */ V(7, 6, 2), |
801 | /* 11 */ V(7, 5, 2), | 812 | /* 11 */ V(7, 5, 2), |
802 | 813 | ||
803 | /* 0000 0001 ... */ | 814 | /* 0000 0001 ... */ |
804 | /* 000 */ V(6, 6, 2),/* 78 */ | 815 | /* 000 */ V(6, 6, 2),/* 78 */ |
805 | /* 001 */ V(6, 6, 2), | 816 | /* 001 */ V(6, 6, 2), |
806 | /* 010 */ V(4, 7, 2), | 817 | /* 010 */ V(4, 7, 2), |
807 | /* 011 */ V(4, 7, 2), | 818 | /* 011 */ V(4, 7, 2), |
808 | /* 100 */ V(7, 4, 2), | 819 | /* 100 */ V(7, 4, 2), |
809 | /* 101 */ V(7, 4, 2), | 820 | /* 101 */ V(7, 4, 2), |
810 | /* 110 */ V(5, 7, 3), | 821 | /* 110 */ V(5, 7, 3), |
811 | /* 111 */ V(5, 5, 3), | 822 | /* 111 */ V(5, 5, 3), |
812 | 823 | ||
813 | /* 0000 0010 ... */ | 824 | /* 0000 0010 ... */ |
814 | /* 00 */ V(5, 6, 2),/* 86 */ | 825 | /* 00 */ V(5, 6, 2),/* 86 */ |
815 | /* 01 */ V(6, 5, 2), | 826 | /* 01 */ V(6, 5, 2), |
816 | /* 10 */ V(3, 7, 1), | 827 | /* 10 */ V(3, 7, 1), |
817 | /* 11 */ V(3, 7, 1), | 828 | /* 11 */ V(3, 7, 1), |
818 | 829 | ||
819 | /* 0000 0011 ... */ | 830 | /* 0000 0011 ... */ |
820 | /* 0 */ V(7, 3, 1),/* 90 */ | 831 | /* 0 */ V(7, 3, 1),/* 90 */ |
821 | /* 1 */ V(4, 6, 1), | 832 | /* 1 */ V(4, 6, 1), |
822 | 833 | ||
823 | /* 0000 0100 ... */ | 834 | /* 0000 0100 ... */ |
824 | /* 00 */ V(4, 5, 2),/* 92 */ | 835 | /* 00 */ V(4, 5, 2),/* 92 */ |
825 | /* 01 */ V(5, 4, 2), | 836 | /* 01 */ V(5, 4, 2), |
826 | /* 10 */ V(3, 5, 2), | 837 | /* 10 */ V(3, 5, 2), |
827 | /* 11 */ V(5, 3, 2), | 838 | /* 11 */ V(5, 3, 2), |
828 | 839 | ||
829 | /* 0000 0111 ... */ | 840 | /* 0000 0111 ... */ |
830 | /* 0 */ V(6, 4, 1),/* 96 */ | 841 | /* 0 */ V(6, 4, 1),/* 96 */ |
831 | /* 1 */ V(0, 7, 1), | 842 | /* 1 */ V(0, 7, 1), |
832 | 843 | ||
833 | /* 0000 1111 ... */ | 844 | /* 0000 1111 ... */ |
834 | /* 0 */ V(4, 4, 1),/* 98 */ | 845 | /* 0 */ V(4, 4, 1),/* 98 */ |
835 | /* 1 */ V(2, 5, 1), | 846 | /* 1 */ V(2, 5, 1), |
836 | 847 | ||
837 | /* 0001 0000 ... */ | 848 | /* 0001 0000 ... */ |
838 | /* 0 */ V(5, 2, 1),/* 100 */ | 849 | /* 0 */ V(5, 2, 1),/* 100 */ |
839 | /* 1 */ V(0, 5, 1), | 850 | /* 1 */ V(0, 5, 1), |
840 | 851 | ||
841 | /* 0001 1101 ... */ | 852 | /* 0001 1101 ... */ |
842 | /* 0 */ V(4, 3, 1),/* 102 */ | 853 | /* 0 */ V(4, 3, 1),/* 102 */ |
843 | /* 1 */ V(3, 3, 1) | 854 | /* 1 */ V(3, 3, 1) |
844 | }; | 855 | }; |
845 | 856 | ||
846 | static | 857 | static |
847 | union huffpair const hufftab12[] = { | 858 | union huffpair const hufftab12[] = { |
848 | /* 0000 */ PTR(16, 4), | 859 | /* 0000 */ PTR(16, 4), |
849 | /* 0001 */ PTR(32, 4), | 860 | /* 0001 */ PTR(32, 4), |
850 | /* 0010 */ PTR(48, 4), | 861 | /* 0010 */ PTR(48, 4), |
851 | /* 0011 */ PTR(64, 2), | 862 | /* 0011 */ PTR(64, 2), |
852 | /* 0100 */ PTR(68, 3), | 863 | /* 0100 */ PTR(68, 3), |
853 | /* 0101 */ PTR(76, 1), | 864 | /* 0101 */ PTR(76, 1), |
854 | /* 0110 */ V(1, 2, 4), | 865 | /* 0110 */ V(1, 2, 4), |
855 | /* 0111 */ V(2, 1, 4), | 866 | /* 0111 */ V(2, 1, 4), |
856 | /* 1000 */ PTR(78, 1), | 867 | /* 1000 */ PTR(78, 1), |
857 | /* 1001 */ V(0, 0, 4), | 868 | /* 1001 */ V(0, 0, 4), |
858 | /* 1010 */ V(1, 1, 3), | 869 | /* 1010 */ V(1, 1, 3), |
859 | /* 1011 */ V(1, 1, 3), | 870 | /* 1011 */ V(1, 1, 3), |
860 | /* 1100 */ V(0, 1, 3), | 871 | /* 1100 */ V(0, 1, 3), |
861 | /* 1101 */ V(0, 1, 3), | 872 | /* 1101 */ V(0, 1, 3), |
862 | /* 1110 */ V(1, 0, 3), | 873 | /* 1110 */ V(1, 0, 3), |
863 | /* 1111 */ V(1, 0, 3), | 874 | /* 1111 */ V(1, 0, 3), |
864 | 875 | ||
865 | /* 0000 ... */ | 876 | /* 0000 ... */ |
866 | /* 0000 */ PTR(80, 2),/* 16 */ | 877 | /* 0000 */ PTR(80, 2),/* 16 */ |
867 | /* 0001 */ PTR(84, 1), | 878 | /* 0001 */ PTR(84, 1), |
868 | /* 0010 */ PTR(86, 1), | 879 | /* 0010 */ PTR(86, 1), |
869 | /* 0011 */ PTR(88, 1), | 880 | /* 0011 */ PTR(88, 1), |
870 | /* 0100 */ V(5, 6, 4), | 881 | /* 0100 */ V(5, 6, 4), |
871 | /* 0101 */ V(3, 7, 4), | 882 | /* 0101 */ V(3, 7, 4), |
872 | /* 0110 */ PTR(90, 1), | 883 | /* 0110 */ PTR(90, 1), |
873 | /* 0111 */ V(2, 7, 4), | 884 | /* 0111 */ V(2, 7, 4), |
874 | /* 1000 */ V(7, 2, 4), | 885 | /* 1000 */ V(7, 2, 4), |
875 | /* 1001 */ V(4, 6, 4), | 886 | /* 1001 */ V(4, 6, 4), |
876 | /* 1010 */ V(6, 4, 4), | 887 | /* 1010 */ V(6, 4, 4), |
877 | /* 1011 */ V(1, 7, 4), | 888 | /* 1011 */ V(1, 7, 4), |
878 | /* 1100 */ V(7, 1, 4), | 889 | /* 1100 */ V(7, 1, 4), |
879 | /* 1101 */ PTR(92, 1), | 890 | /* 1101 */ PTR(92, 1), |
880 | /* 1110 */ V(3, 6, 4), | 891 | /* 1110 */ V(3, 6, 4), |
881 | /* 1111 */ V(6, 3, 4), | 892 | /* 1111 */ V(6, 3, 4), |
882 | 893 | ||
883 | /* 0001 ... */ | 894 | /* 0001 ... */ |
884 | /* 0000 */ V(4, 5, 4),/* 32 */ | 895 | /* 0000 */ V(4, 5, 4),/* 32 */ |
885 | /* 0001 */ V(5, 4, 4), | 896 | /* 0001 */ V(5, 4, 4), |
886 | /* 0010 */ V(4, 4, 4), | 897 | /* 0010 */ V(4, 4, 4), |
887 | /* 0011 */ PTR(94, 1), | 898 | /* 0011 */ PTR(94, 1), |
888 | /* 0100 */ V(2, 6, 3), | 899 | /* 0100 */ V(2, 6, 3), |
889 | /* 0101 */ V(2, 6, 3), | 900 | /* 0101 */ V(2, 6, 3), |
890 | /* 0110 */ V(6, 2, 3), | 901 | /* 0110 */ V(6, 2, 3), |
891 | /* 0111 */ V(6, 2, 3), | 902 | /* 0111 */ V(6, 2, 3), |
892 | /* 1000 */ V(6, 1, 3), | 903 | /* 1000 */ V(6, 1, 3), |
893 | /* 1001 */ V(6, 1, 3), | 904 | /* 1001 */ V(6, 1, 3), |
894 | /* 1010 */ V(1, 6, 4), | 905 | /* 1010 */ V(1, 6, 4), |
895 | /* 1011 */ V(6, 0, 4), | 906 | /* 1011 */ V(6, 0, 4), |
896 | /* 1100 */ V(3, 5, 4), | 907 | /* 1100 */ V(3, 5, 4), |
897 | /* 1101 */ V(5, 3, 4), | 908 | /* 1101 */ V(5, 3, 4), |
898 | /* 1110 */ V(2, 5, 4), | 909 | /* 1110 */ V(2, 5, 4), |
899 | /* 1111 */ V(5, 2, 4), | 910 | /* 1111 */ V(5, 2, 4), |
900 | 911 | ||
901 | /* 0010 ... */ | 912 | /* 0010 ... */ |
902 | /* 0000 */ V(1, 5, 3),/* 48 */ | 913 | /* 0000 */ V(1, 5, 3),/* 48 */ |
903 | /* 0001 */ V(1, 5, 3), | 914 | /* 0001 */ V(1, 5, 3), |
904 | /* 0010 */ V(5, 1, 3), | 915 | /* 0010 */ V(5, 1, 3), |
905 | /* 0011 */ V(5, 1, 3), | 916 | /* 0011 */ V(5, 1, 3), |
906 | /* 0100 */ V(3, 4, 3), | 917 | /* 0100 */ V(3, 4, 3), |
907 | /* 0101 */ V(3, 4, 3), | 918 | /* 0101 */ V(3, 4, 3), |
908 | /* 0110 */ V(4, 3, 3), | 919 | /* 0110 */ V(4, 3, 3), |
909 | /* 0111 */ V(4, 3, 3), | 920 | /* 0111 */ V(4, 3, 3), |
910 | /* 1000 */ V(5, 0, 4), | 921 | /* 1000 */ V(5, 0, 4), |
911 | /* 1001 */ V(0, 4, 4), | 922 | /* 1001 */ V(0, 4, 4), |
912 | /* 1010 */ V(2, 4, 3), | 923 | /* 1010 */ V(2, 4, 3), |
913 | /* 1011 */ V(2, 4, 3), | 924 | /* 1011 */ V(2, 4, 3), |
914 | /* 1100 */ V(4, 2, 3), | 925 | /* 1100 */ V(4, 2, 3), |
915 | /* 1101 */ V(4, 2, 3), | 926 | /* 1101 */ V(4, 2, 3), |
916 | /* 1110 */ V(1, 4, 3), | 927 | /* 1110 */ V(1, 4, 3), |
917 | /* 1111 */ V(1, 4, 3), | 928 | /* 1111 */ V(1, 4, 3), |
918 | 929 | ||
919 | /* 0011 ... */ | 930 | /* 0011 ... */ |
920 | /* 00 */ V(3, 3, 2),/* 64 */ | 931 | /* 00 */ V(3, 3, 2),/* 64 */ |
921 | /* 01 */ V(4, 1, 2), | 932 | /* 01 */ V(4, 1, 2), |
922 | /* 10 */ V(2, 3, 2), | 933 | /* 10 */ V(2, 3, 2), |
923 | /* 11 */ V(3, 2, 2), | 934 | /* 11 */ V(3, 2, 2), |
924 | 935 | ||
925 | /* 0100 ... */ | 936 | /* 0100 ... */ |
926 | /* 000 */ V(4, 0, 3),/* 68 */ | 937 | /* 000 */ V(4, 0, 3),/* 68 */ |
927 | /* 001 */ V(0, 3, 3), | 938 | /* 001 */ V(0, 3, 3), |
928 | /* 010 */ V(3, 0, 2), | 939 | /* 010 */ V(3, 0, 2), |
929 | /* 011 */ V(3, 0, 2), | 940 | /* 011 */ V(3, 0, 2), |
930 | /* 100 */ V(1, 3, 1), | 941 | /* 100 */ V(1, 3, 1), |
931 | /* 101 */ V(1, 3, 1), | 942 | /* 101 */ V(1, 3, 1), |
932 | /* 110 */ V(1, 3, 1), | 943 | /* 110 */ V(1, 3, 1), |
933 | /* 111 */ V(1, 3, 1), | 944 | /* 111 */ V(1, 3, 1), |
934 | 945 | ||
935 | /* 0101 ... */ | 946 | /* 0101 ... */ |
936 | /* 0 */ V(3, 1, 1),/* 76 */ | 947 | /* 0 */ V(3, 1, 1),/* 76 */ |
937 | /* 1 */ V(2, 2, 1), | 948 | /* 1 */ V(2, 2, 1), |
938 | 949 | ||
939 | /* 1000 ... */ | 950 | /* 1000 ... */ |
940 | /* 0 */ V(0, 2, 1),/* 78 */ | 951 | /* 0 */ V(0, 2, 1),/* 78 */ |
941 | /* 1 */ V(2, 0, 1), | 952 | /* 1 */ V(2, 0, 1), |
942 | 953 | ||
943 | /* 0000 0000 ... */ | 954 | /* 0000 0000 ... */ |
944 | /* 00 */ V(7, 7, 2),/* 80 */ | 955 | /* 00 */ V(7, 7, 2),/* 80 */ |
945 | /* 01 */ V(6, 7, 2), | 956 | /* 01 */ V(6, 7, 2), |
946 | /* 10 */ V(7, 6, 1), | 957 | /* 10 */ V(7, 6, 1), |
947 | /* 11 */ V(7, 6, 1), | 958 | /* 11 */ V(7, 6, 1), |
948 | 959 | ||
949 | /* 0000 0001 ... */ | 960 | /* 0000 0001 ... */ |
950 | /* 0 */ V(5, 7, 1),/* 84 */ | 961 | /* 0 */ V(5, 7, 1),/* 84 */ |
951 | /* 1 */ V(7, 5, 1), | 962 | /* 1 */ V(7, 5, 1), |
952 | 963 | ||
953 | /* 0000 0010 ... */ | 964 | /* 0000 0010 ... */ |
954 | /* 0 */ V(6, 6, 1),/* 86 */ | 965 | /* 0 */ V(6, 6, 1),/* 86 */ |
955 | /* 1 */ V(4, 7, 1), | 966 | /* 1 */ V(4, 7, 1), |
956 | 967 | ||
957 | /* 0000 0011 ... */ | 968 | /* 0000 0011 ... */ |
958 | /* 0 */ V(7, 4, 1),/* 88 */ | 969 | /* 0 */ V(7, 4, 1),/* 88 */ |
959 | /* 1 */ V(6, 5, 1), | 970 | /* 1 */ V(6, 5, 1), |
960 | 971 | ||
961 | /* 0000 0110 ... */ | 972 | /* 0000 0110 ... */ |
962 | /* 0 */ V(7, 3, 1),/* 90 */ | 973 | /* 0 */ V(7, 3, 1),/* 90 */ |
963 | /* 1 */ V(5, 5, 1), | 974 | /* 1 */ V(5, 5, 1), |
964 | 975 | ||
965 | /* 0000 1101 ... */ | 976 | /* 0000 1101 ... */ |
966 | /* 0 */ V(0, 7, 1),/* 92 */ | 977 | /* 0 */ V(0, 7, 1),/* 92 */ |
967 | /* 1 */ V(7, 0, 1), | 978 | /* 1 */ V(7, 0, 1), |
968 | 979 | ||
969 | /* 0001 0011 ... */ | 980 | /* 0001 0011 ... */ |
970 | /* 0 */ V(0, 6, 1),/* 94 */ | 981 | /* 0 */ V(0, 6, 1),/* 94 */ |
971 | /* 1 */ V(0, 5, 1) | 982 | /* 1 */ V(0, 5, 1) |
972 | }; | 983 | }; |
973 | 984 | ||
974 | static | 985 | static |
975 | union huffpair const hufftab13[] = { | 986 | union huffpair const hufftab13[] = { |
976 | /* 0000 */ PTR(16, 4), | 987 | /* 0000 */ PTR(16, 4), |
977 | /* 0001 */ PTR(32, 4), | 988 | /* 0001 */ PTR(32, 4), |
978 | /* 0010 */ PTR(48, 4), | 989 | /* 0010 */ PTR(48, 4), |
979 | /* 0011 */ PTR(64, 2), | 990 | /* 0011 */ PTR(64, 2), |
980 | /* 0100 */ V(1, 1, 4), | 991 | /* 0100 */ V(1, 1, 4), |
981 | /* 0101 */ V(0, 1, 4), | 992 | /* 0101 */ V(0, 1, 4), |
982 | /* 0110 */ V(1, 0, 3), | 993 | /* 0110 */ V(1, 0, 3), |
983 | /* 0111 */ V(1, 0, 3), | 994 | /* 0111 */ V(1, 0, 3), |
984 | /* 1000 */ V(0, 0, 1), | 995 | /* 1000 */ V(0, 0, 1), |
985 | /* 1001 */ V(0, 0, 1), | 996 | /* 1001 */ V(0, 0, 1), |
986 | /* 1010 */ V(0, 0, 1), | 997 | /* 1010 */ V(0, 0, 1), |
987 | /* 1011 */ V(0, 0, 1), | 998 | /* 1011 */ V(0, 0, 1), |
988 | /* 1100 */ V(0, 0, 1), | 999 | /* 1100 */ V(0, 0, 1), |
989 | /* 1101 */ V(0, 0, 1), | 1000 | /* 1101 */ V(0, 0, 1), |
990 | /* 1110 */ V(0, 0, 1), | 1001 | /* 1110 */ V(0, 0, 1), |
991 | /* 1111 */ V(0, 0, 1), | 1002 | /* 1111 */ V(0, 0, 1), |
992 | 1003 | ||
993 | /* 0000 ... */ | 1004 | /* 0000 ... */ |
994 | /* 0000 */ PTR(68, 4),/* 16 */ | 1005 | /* 0000 */ PTR(68, 4),/* 16 */ |
995 | /* 0001 */ PTR(84, 4), | 1006 | /* 0001 */ PTR(84, 4), |
996 | /* 0010 */ PTR(100, 4), | 1007 | /* 0010 */ PTR(100, 4), |
997 | /* 0011 */ PTR(116, 4), | 1008 | /* 0011 */ PTR(116, 4), |
998 | /* 0100 */ PTR(132, 4), | 1009 | /* 0100 */ PTR(132, 4), |
999 | /* 0101 */ PTR(148, 4), | 1010 | /* 0101 */ PTR(148, 4), |
1000 | /* 0110 */ PTR(164, 3), | 1011 | /* 0110 */ PTR(164, 3), |
1001 | /* 0111 */ PTR(172, 3), | 1012 | /* 0111 */ PTR(172, 3), |
1002 | /* 1000 */ PTR(180, 3), | 1013 | /* 1000 */ PTR(180, 3), |
1003 | /* 1001 */ PTR(188, 3), | 1014 | /* 1001 */ PTR(188, 3), |
1004 | /* 1010 */ PTR(196, 3), | 1015 | /* 1010 */ PTR(196, 3), |
1005 | /* 1011 */ PTR(204, 3), | 1016 | /* 1011 */ PTR(204, 3), |
1006 | /* 1100 */ PTR(212, 1), | 1017 | /* 1100 */ PTR(212, 1), |
1007 | /* 1101 */ PTR(214, 2), | 1018 | /* 1101 */ PTR(214, 2), |
1008 | /* 1110 */ PTR(218, 3), | 1019 | /* 1110 */ PTR(218, 3), |
1009 | /* 1111 */ PTR(226, 1), | 1020 | /* 1111 */ PTR(226, 1), |
1010 | 1021 | ||
1011 | /* 0001 ... */ | 1022 | /* 0001 ... */ |
1012 | /* 0000 */ PTR(228, 2),/* 32 */ | 1023 | /* 0000 */ PTR(228, 2),/* 32 */ |
1013 | /* 0001 */ PTR(232, 2), | 1024 | /* 0001 */ PTR(232, 2), |
1014 | /* 0010 */ PTR(236, 2), | 1025 | /* 0010 */ PTR(236, 2), |
1015 | /* 0011 */ PTR(240, 2), | 1026 | /* 0011 */ PTR(240, 2), |
1016 | /* 0100 */ V(8, 1, 4), | 1027 | /* 0100 */ V(8, 1, 4), |
1017 | /* 0101 */ PTR(244, 1), | 1028 | /* 0101 */ PTR(244, 1), |
1018 | /* 0110 */ PTR(246, 1), | 1029 | /* 0110 */ PTR(246, 1), |
1019 | /* 0111 */ PTR(248, 1), | 1030 | /* 0111 */ PTR(248, 1), |
1020 | /* 1000 */ PTR(250, 2), | 1031 | /* 1000 */ PTR(250, 2), |
1021 | /* 1001 */ PTR(254, 1), | 1032 | /* 1001 */ PTR(254, 1), |
1022 | /* 1010 */ V(1, 5, 4), | 1033 | /* 1010 */ V(1, 5, 4), |
1023 | /* 1011 */ V(5, 1, 4), | 1034 | /* 1011 */ V(5, 1, 4), |
1024 | /* 1100 */ PTR(256, 1), | 1035 | /* 1100 */ PTR(256, 1), |
1025 | /* 1101 */ PTR(258, 1), | 1036 | /* 1101 */ PTR(258, 1), |
1026 | /* 1110 */ PTR(260, 1), | 1037 | /* 1110 */ PTR(260, 1), |
1027 | /* 1111 */ V(1, 4, 4), | 1038 | /* 1111 */ V(1, 4, 4), |
1028 | 1039 | ||
1029 | /* 0010 ... */ | 1040 | /* 0010 ... */ |
1030 | /* 0000 */ V(4, 1, 3),/* 48 */ | 1041 | /* 0000 */ V(4, 1, 3),/* 48 */ |
1031 | /* 0001 */ V(4, 1, 3), | 1042 | /* 0001 */ V(4, 1, 3), |
1032 | /* 0010 */ V(0, 4, 4), | 1043 | /* 0010 */ V(0, 4, 4), |
1033 | /* 0011 */ V(4, 0, 4), | 1044 | /* 0011 */ V(4, 0, 4), |
1034 | /* 0100 */ V(2, 3, 4), | 1045 | /* 0100 */ V(2, 3, 4), |
1035 | /* 0101 */ V(3, 2, 4), | 1046 | /* 0101 */ V(3, 2, 4), |
1036 | /* 0110 */ V(1, 3, 3), | 1047 | /* 0110 */ V(1, 3, 3), |
1037 | /* 0111 */ V(1, 3, 3), | 1048 | /* 0111 */ V(1, 3, 3), |
1038 | /* 1000 */ V(3, 1, 3), | 1049 | /* 1000 */ V(3, 1, 3), |
1039 | /* 1001 */ V(3, 1, 3), | 1050 | /* 1001 */ V(3, 1, 3), |
1040 | /* 1010 */ V(0, 3, 3), | 1051 | /* 1010 */ V(0, 3, 3), |
1041 | /* 1011 */ V(0, 3, 3), | 1052 | /* 1011 */ V(0, 3, 3), |
1042 | /* 1100 */ V(3, 0, 3), | 1053 | /* 1100 */ V(3, 0, 3), |
1043 | /* 1101 */ V(3, 0, 3), | 1054 | /* 1101 */ V(3, 0, 3), |
1044 | /* 1110 */ V(2, 2, 3), | 1055 | /* 1110 */ V(2, 2, 3), |
1045 | /* 1111 */ V(2, 2, 3), | 1056 | /* 1111 */ V(2, 2, 3), |
1046 | 1057 | ||
1047 | /* 0011 ... */ | 1058 | /* 0011 ... */ |
1048 | /* 00 */ V(1, 2, 2),/* 64 */ | 1059 | /* 00 */ V(1, 2, 2),/* 64 */ |
1049 | /* 01 */ V(2, 1, 2), | 1060 | /* 01 */ V(2, 1, 2), |
1050 | /* 10 */ V(0, 2, 2), | 1061 | /* 10 */ V(0, 2, 2), |
1051 | /* 11 */ V(2, 0, 2), | 1062 | /* 11 */ V(2, 0, 2), |
1052 | 1063 | ||
1053 | /* 0000 0000 ... */ | 1064 | /* 0000 0000 ... */ |
1054 | /* 0000 */ PTR(262, 4),/* 68 */ | 1065 | /* 0000 */ PTR(262, 4),/* 68 */ |
1055 | /* 0001 */ PTR(278, 4), | 1066 | /* 0001 */ PTR(278, 4), |
1056 | /* 0010 */ PTR(294, 4), | 1067 | /* 0010 */ PTR(294, 4), |
1057 | /* 0011 */ PTR(310, 3), | 1068 | /* 0011 */ PTR(310, 3), |
1058 | /* 0100 */ PTR(318, 2), | 1069 | /* 0100 */ PTR(318, 2), |
1059 | /* 0101 */ PTR(322, 2), | 1070 | /* 0101 */ PTR(322, 2), |
1060 | /* 0110 */ PTR(326, 3), | 1071 | /* 0110 */ PTR(326, 3), |
1061 | /* 0111 */ PTR(334, 2), | 1072 | /* 0111 */ PTR(334, 2), |
1062 | /* 1000 */ PTR(338, 1), | 1073 | /* 1000 */ PTR(338, 1), |
1063 | /* 1001 */ PTR(340, 2), | 1074 | /* 1001 */ PTR(340, 2), |
1064 | /* 1010 */ PTR(344, 2), | 1075 | /* 1010 */ PTR(344, 2), |
1065 | /* 1011 */ PTR(348, 2), | 1076 | /* 1011 */ PTR(348, 2), |
1066 | /* 1100 */ PTR(352, 2), | 1077 | /* 1100 */ PTR(352, 2), |
1067 | /* 1101 */ PTR(356, 2), | 1078 | /* 1101 */ PTR(356, 2), |
1068 | /* 1110 */ V(1, 15, 4), | 1079 | /* 1110 */ V(1, 15, 4), |
1069 | /* 1111 */ V(15, 1, 4), | 1080 | /* 1111 */ V(15, 1, 4), |
1070 | 1081 | ||
1071 | /* 0000 0001 ... */ | 1082 | /* 0000 0001 ... */ |
1072 | /* 0000 */ V(15, 0, 4),/* 84 */ | 1083 | /* 0000 */ V(15, 0, 4),/* 84 */ |
1073 | /* 0001 */ PTR(360, 1), | 1084 | /* 0001 */ PTR(360, 1), |
1074 | /* 0010 */ PTR(362, 1), | 1085 | /* 0010 */ PTR(362, 1), |
1075 | /* 0011 */ PTR(364, 1), | 1086 | /* 0011 */ PTR(364, 1), |
1076 | /* 0100 */ V(14, 2, 4), | 1087 | /* 0100 */ V(14, 2, 4), |
1077 | /* 0101 */ PTR(366, 1), | 1088 | /* 0101 */ PTR(366, 1), |
1078 | /* 0110 */ V(1, 14, 4), | 1089 | /* 0110 */ V(1, 14, 4), |
1079 | /* 0111 */ V(14, 1, 4), | 1090 | /* 0111 */ V(14, 1, 4), |
1080 | /* 1000 */ PTR(368, 1), | 1091 | /* 1000 */ PTR(368, 1), |
1081 | /* 1001 */ PTR(370, 1), | 1092 | /* 1001 */ PTR(370, 1), |
1082 | /* 1010 */ PTR(372, 1), | 1093 | /* 1010 */ PTR(372, 1), |
1083 | /* 1011 */ PTR(374, 1), | 1094 | /* 1011 */ PTR(374, 1), |
1084 | /* 1100 */ PTR(376, 1), | 1095 | /* 1100 */ PTR(376, 1), |
1085 | /* 1101 */ PTR(378, 1), | 1096 | /* 1101 */ PTR(378, 1), |
1086 | /* 1110 */ V(12, 6, 4), | 1097 | /* 1110 */ V(12, 6, 4), |
1087 | /* 1111 */ V(3, 13, 4), | 1098 | /* 1111 */ V(3, 13, 4), |
1088 | 1099 | ||
1089 | /* 0000 0010 ... */ | 1100 | /* 0000 0010 ... */ |
1090 | /* 0000 */ PTR(380, 1),/* 100 */ | 1101 | /* 0000 */ PTR(380, 1),/* 100 */ |
1091 | /* 0001 */ V(2, 13, 4), | 1102 | /* 0001 */ V(2, 13, 4), |
1092 | /* 0010 */ V(13, 2, 4), | 1103 | /* 0010 */ V(13, 2, 4), |
1093 | /* 0011 */ V(1, 13, 4), | 1104 | /* 0011 */ V(1, 13, 4), |
1094 | /* 0100 */ V(11, 7, 4), | 1105 | /* 0100 */ V(11, 7, 4), |
1095 | /* 0101 */ PTR(382, 1), | 1106 | /* 0101 */ PTR(382, 1), |
1096 | /* 0110 */ PTR(384, 1), | 1107 | /* 0110 */ PTR(384, 1), |
1097 | /* 0111 */ V(12, 3, 4), | 1108 | /* 0111 */ V(12, 3, 4), |
1098 | /* 1000 */ PTR(386, 1), | 1109 | /* 1000 */ PTR(386, 1), |
1099 | /* 1001 */ V(4, 11, 4), | 1110 | /* 1001 */ V(4, 11, 4), |
1100 | /* 1010 */ V(13, 1, 3), | 1111 | /* 1010 */ V(13, 1, 3), |
1101 | /* 1011 */ V(13, 1, 3), | 1112 | /* 1011 */ V(13, 1, 3), |
1102 | /* 1100 */ V(0, 13, 4), | 1113 | /* 1100 */ V(0, 13, 4), |
1103 | /* 1101 */ V(13, 0, 4), | 1114 | /* 1101 */ V(13, 0, 4), |
1104 | /* 1110 */ V(8, 10, 4), | 1115 | /* 1110 */ V(8, 10, 4), |
1105 | /* 1111 */ V(10, 8, 4), | 1116 | /* 1111 */ V(10, 8, 4), |
1106 | 1117 | ||
1107 | /* 0000 0011 ... */ | 1118 | /* 0000 0011 ... */ |
1108 | /* 0000 */ V(4, 12, 4),/* 116 */ | 1119 | /* 0000 */ V(4, 12, 4),/* 116 */ |
1109 | /* 0001 */ V(12, 4, 4), | 1120 | /* 0001 */ V(12, 4, 4), |
1110 | /* 0010 */ V(6, 11, 4), | 1121 | /* 0010 */ V(6, 11, 4), |
1111 | /* 0011 */ V(11, 6, 4), | 1122 | /* 0011 */ V(11, 6, 4), |
1112 | /* 0100 */ V(3, 12, 3), | 1123 | /* 0100 */ V(3, 12, 3), |
1113 | /* 0101 */ V(3, 12, 3), | 1124 | /* 0101 */ V(3, 12, 3), |
1114 | /* 0110 */ V(2, 12, 3), | 1125 | /* 0110 */ V(2, 12, 3), |
1115 | /* 0111 */ V(2, 12, 3), | 1126 | /* 0111 */ V(2, 12, 3), |
1116 | /* 1000 */ V(12, 2, 3), | 1127 | /* 1000 */ V(12, 2, 3), |
1117 | /* 1001 */ V(12, 2, 3), | 1128 | /* 1001 */ V(12, 2, 3), |
1118 | /* 1010 */ V(5, 11, 3), | 1129 | /* 1010 */ V(5, 11, 3), |
1119 | /* 1011 */ V(5, 11, 3), | 1130 | /* 1011 */ V(5, 11, 3), |
1120 | /* 1100 */ V(11, 5, 4), | 1131 | /* 1100 */ V(11, 5, 4), |
1121 | /* 1101 */ V(8, 9, 4), | 1132 | /* 1101 */ V(8, 9, 4), |
1122 | /* 1110 */ V(1, 12, 3), | 1133 | /* 1110 */ V(1, 12, 3), |
1123 | /* 1111 */ V(1, 12, 3), | 1134 | /* 1111 */ V(1, 12, 3), |
1124 | 1135 | ||
1125 | /* 0000 0100 ... */ | 1136 | /* 0000 0100 ... */ |
1126 | /* 0000 */ V(12, 1, 3),/* 132 */ | 1137 | /* 0000 */ V(12, 1, 3),/* 132 */ |
1127 | /* 0001 */ V(12, 1, 3), | 1138 | /* 0001 */ V(12, 1, 3), |
1128 | /* 0010 */ V(9, 8, 4), | 1139 | /* 0010 */ V(9, 8, 4), |
1129 | /* 0011 */ V(0, 12, 4), | 1140 | /* 0011 */ V(0, 12, 4), |
1130 | /* 0100 */ V(12, 0, 3), | 1141 | /* 0100 */ V(12, 0, 3), |
1131 | /* 0101 */ V(12, 0, 3), | 1142 | /* 0101 */ V(12, 0, 3), |
1132 | /* 0110 */ V(11, 4, 4), | 1143 | /* 0110 */ V(11, 4, 4), |
1133 | /* 0111 */ V(6, 10, 4), | 1144 | /* 0111 */ V(6, 10, 4), |
1134 | /* 1000 */ V(10, 6, 4), | 1145 | /* 1000 */ V(10, 6, 4), |
1135 | /* 1001 */ V(7, 9, 4), | 1146 | /* 1001 */ V(7, 9, 4), |
1136 | /* 1010 */ V(3, 11, 3), | 1147 | /* 1010 */ V(3, 11, 3), |
1137 | /* 1011 */ V(3, 11, 3), | 1148 | /* 1011 */ V(3, 11, 3), |
1138 | /* 1100 */ V(11, 3, 3), | 1149 | /* 1100 */ V(11, 3, 3), |
diff --git a/core/multimedia/opieplayer/libmad/huffman.h b/core/multimedia/opieplayer/libmad/huffman.h index d051949..e4c1b35 100644 --- a/core/multimedia/opieplayer/libmad/huffman.h +++ b/core/multimedia/opieplayer/libmad/huffman.h | |||
@@ -1,66 +1,66 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifndef LIBMAD_HUFFMAN_H | 22 | # ifndef LIBMAD_HUFFMAN_H |
23 | # define LIBMAD_HUFFMAN_H | 23 | # define LIBMAD_HUFFMAN_H |
24 | 24 | ||
25 | union huffquad { | 25 | union huffquad { |
26 | struct { | 26 | struct { |
27 | unsigned short final : 1; | 27 | unsigned short final : 1; |
28 | unsigned short bits : 3; | 28 | unsigned short bits : 3; |
29 | unsigned short offset : 12; | 29 | unsigned short offset : 12; |
30 | } ptr; | 30 | } ptr; |
31 | struct { | 31 | struct { |
32 | unsigned short final : 1; | 32 | unsigned short final : 1; |
33 | unsigned short hlen : 3; | 33 | unsigned short hlen : 3; |
34 | unsigned short v : 1; | 34 | unsigned short v : 1; |
35 | unsigned short w : 1; | 35 | unsigned short w : 1; |
36 | unsigned short x : 1; | 36 | unsigned short x : 1; |
37 | unsigned short y : 1; | 37 | unsigned short y : 1; |
38 | } value; | 38 | } value; |
39 | unsigned short final : 1; | 39 | unsigned short final : 1; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | union huffpair { | 42 | union huffpair { |
43 | struct { | 43 | struct { |
44 | unsigned short final : 1; | 44 | unsigned short final : 1; |
45 | unsigned short bits : 3; | 45 | unsigned short bits : 3; |
46 | unsigned short offset : 12; | 46 | unsigned short offset : 12; |
47 | } ptr; | 47 | } ptr; |
48 | struct { | 48 | struct { |
49 | unsigned short final : 1; | 49 | unsigned short final : 1; |
50 | unsigned short hlen : 3; | 50 | unsigned short hlen : 3; |
51 | unsigned short x : 4; | 51 | unsigned short x : 4; |
52 | unsigned short y : 4; | 52 | unsigned short y : 4; |
53 | } value; | 53 | } value; |
54 | unsigned short final : 1; | 54 | unsigned short final : 1; |
55 | }; | 55 | }; |
56 | 56 | ||
57 | struct hufftable { | 57 | struct hufftable { |
58 | union huffpair const *table; | 58 | union huffpair const *table; |
59 | unsigned short linbits; | 59 | unsigned short linbits; |
60 | unsigned short startbits; | 60 | unsigned short startbits; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | extern union huffquad const *const mad_huff_quad_table[2]; | 63 | extern union huffquad const *const mad_huff_quad_table[2]; |
64 | extern struct hufftable const mad_huff_pair_table[32]; | 64 | extern struct hufftable const mad_huff_pair_table[32]; |
65 | 65 | ||
66 | # endif | 66 | # endif |
diff --git a/core/multimedia/opieplayer/libmad/imdct_s.dat b/core/multimedia/opieplayer/libmad/imdct_s.dat index ed70446..e2d91a0 100644 --- a/core/multimedia/opieplayer/libmad/imdct_s.dat +++ b/core/multimedia/opieplayer/libmad/imdct_s.dat | |||
@@ -1,62 +1,62 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* 0 */ { MAD_F(0x09bd7ca0) /* 0.608761429 */, | 22 | /* 0 */ { MAD_F(0x09bd7ca0) /* 0.608761429 */, |
23 | -MAD_F(0x0ec835e8) /* -0.923879533 */, | 23 | -MAD_F(0x0ec835e8) /* -0.923879533 */, |
24 | -MAD_F(0x0216a2a2) /* -0.130526192 */, | 24 | -MAD_F(0x0216a2a2) /* -0.130526192 */, |
25 | MAD_F(0x0fdcf549) /* 0.991444861 */, | 25 | MAD_F(0x0fdcf549) /* 0.991444861 */, |
26 | -MAD_F(0x061f78aa) /* -0.382683432 */, | 26 | -MAD_F(0x061f78aa) /* -0.382683432 */, |
27 | -MAD_F(0x0cb19346) /* -0.793353340 */ }, | 27 | -MAD_F(0x0cb19346) /* -0.793353340 */ }, |
28 | 28 | ||
29 | /* 6 */ { -MAD_F(0x0cb19346) /* -0.793353340 */, | 29 | /* 6 */ { -MAD_F(0x0cb19346) /* -0.793353340 */, |
30 | MAD_F(0x061f78aa) /* 0.382683432 */, | 30 | MAD_F(0x061f78aa) /* 0.382683432 */, |
31 | MAD_F(0x0fdcf549) /* 0.991444861 */, | 31 | MAD_F(0x0fdcf549) /* 0.991444861 */, |
32 | MAD_F(0x0216a2a2) /* 0.130526192 */, | 32 | MAD_F(0x0216a2a2) /* 0.130526192 */, |
33 | -MAD_F(0x0ec835e8) /* -0.923879533 */, | 33 | -MAD_F(0x0ec835e8) /* -0.923879533 */, |
34 | -MAD_F(0x09bd7ca0) /* -0.608761429 */ }, | 34 | -MAD_F(0x09bd7ca0) /* -0.608761429 */ }, |
35 | 35 | ||
36 | /* 1 */ { MAD_F(0x061f78aa) /* 0.382683432 */, | 36 | /* 1 */ { MAD_F(0x061f78aa) /* 0.382683432 */, |
37 | -MAD_F(0x0ec835e8) /* -0.923879533 */, | 37 | -MAD_F(0x0ec835e8) /* -0.923879533 */, |
38 | MAD_F(0x0ec835e8) /* 0.923879533 */, | 38 | MAD_F(0x0ec835e8) /* 0.923879533 */, |
39 | -MAD_F(0x061f78aa) /* -0.382683432 */, | 39 | -MAD_F(0x061f78aa) /* -0.382683432 */, |
40 | -MAD_F(0x061f78aa) /* -0.382683432 */, | 40 | -MAD_F(0x061f78aa) /* -0.382683432 */, |
41 | MAD_F(0x0ec835e8) /* 0.923879533 */ }, | 41 | MAD_F(0x0ec835e8) /* 0.923879533 */ }, |
42 | 42 | ||
43 | /* 7 */ { -MAD_F(0x0ec835e8) /* -0.923879533 */, | 43 | /* 7 */ { -MAD_F(0x0ec835e8) /* -0.923879533 */, |
44 | -MAD_F(0x061f78aa) /* -0.382683432 */, | 44 | -MAD_F(0x061f78aa) /* -0.382683432 */, |
45 | MAD_F(0x061f78aa) /* 0.382683432 */, | 45 | MAD_F(0x061f78aa) /* 0.382683432 */, |
46 | MAD_F(0x0ec835e8) /* 0.923879533 */, | 46 | MAD_F(0x0ec835e8) /* 0.923879533 */, |
47 | MAD_F(0x0ec835e8) /* 0.923879533 */, | 47 | MAD_F(0x0ec835e8) /* 0.923879533 */, |
48 | MAD_F(0x061f78aa) /* 0.382683432 */ }, | 48 | MAD_F(0x061f78aa) /* 0.382683432 */ }, |
49 | 49 | ||
50 | /* 2 */ { MAD_F(0x0216a2a2) /* 0.130526192 */, | 50 | /* 2 */ { MAD_F(0x0216a2a2) /* 0.130526192 */, |
51 | -MAD_F(0x061f78aa) /* -0.382683432 */, | 51 | -MAD_F(0x061f78aa) /* -0.382683432 */, |
52 | MAD_F(0x09bd7ca0) /* 0.608761429 */, | 52 | MAD_F(0x09bd7ca0) /* 0.608761429 */, |
53 | -MAD_F(0x0cb19346) /* -0.793353340 */, | 53 | -MAD_F(0x0cb19346) /* -0.793353340 */, |
54 | MAD_F(0x0ec835e8) /* 0.923879533 */, | 54 | MAD_F(0x0ec835e8) /* 0.923879533 */, |
55 | -MAD_F(0x0fdcf549) /* -0.991444861 */ }, | 55 | -MAD_F(0x0fdcf549) /* -0.991444861 */ }, |
56 | 56 | ||
57 | /* 8 */ { -MAD_F(0x0fdcf549) /* -0.991444861 */, | 57 | /* 8 */ { -MAD_F(0x0fdcf549) /* -0.991444861 */, |
58 | -MAD_F(0x0ec835e8) /* -0.923879533 */, | 58 | -MAD_F(0x0ec835e8) /* -0.923879533 */, |
59 | -MAD_F(0x0cb19346) /* -0.793353340 */, | 59 | -MAD_F(0x0cb19346) /* -0.793353340 */, |
60 | -MAD_F(0x09bd7ca0) /* -0.608761429 */, | 60 | -MAD_F(0x09bd7ca0) /* -0.608761429 */, |
61 | -MAD_F(0x061f78aa) /* -0.382683432 */, | 61 | -MAD_F(0x061f78aa) /* -0.382683432 */, |
62 | -MAD_F(0x0216a2a2) /* -0.130526192 */ } | 62 | -MAD_F(0x0216a2a2) /* -0.130526192 */ } |
diff --git a/core/multimedia/opieplayer/libmad/layer12.c b/core/multimedia/opieplayer/libmad/layer12.c index d291174..512b6a5 100644 --- a/core/multimedia/opieplayer/libmad/layer12.c +++ b/core/multimedia/opieplayer/libmad/layer12.c | |||
@@ -1,496 +1,534 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifdef HAVE_CONFIG_H | 22 | # ifdef HAVE_CONFIG_H |
23 | # include "libmad_config.h" | 23 | # include "libmad_config.h" |
24 | # endif | 24 | # endif |
25 | 25 | ||
26 | # include "libmad_global.h" | 26 | # include "libmad_global.h" |
27 | 27 | ||
28 | # ifdef HAVE_LIMITS_H | 28 | # ifdef HAVE_LIMITS_H |
29 | # include <limits.h> | 29 | # include <limits.h> |
30 | # else | 30 | # else |
31 | # define CHAR_BIT 8 | 31 | # define CHAR_BIT 8 |
32 | # endif | 32 | # endif |
33 | 33 | ||
34 | # include "fixed.h" | 34 | # include "fixed.h" |
35 | # include "bit.h" | 35 | # include "bit.h" |
36 | # include "stream.h" | 36 | # include "stream.h" |
37 | # include "frame.h" | 37 | # include "frame.h" |
38 | # include "layer12.h" | 38 | # include "layer12.h" |
39 | 39 | ||
40 | /* | 40 | /* |
41 | * scalefactor table | 41 | * scalefactor table |
42 | * used in both Layer I and Layer II decoding | 42 | * used in both Layer I and Layer II decoding |
43 | */ | 43 | */ |
44 | static | 44 | static |
45 | mad_fixed_t const sf_table[63] = { | 45 | mad_fixed_t const sf_table[64] = { |
46 | # include "sf_table.dat" | 46 | # include "sf_table.dat" |
47 | }; | 47 | }; |
48 | 48 | ||
49 | /* --- Layer I ------------------------------------------------------------- */ | 49 | /* --- Layer I ------------------------------------------------------------- */ |
50 | 50 | ||
51 | /* linear scaling table */ | 51 | /* linear scaling table */ |
52 | static | 52 | static |
53 | mad_fixed_t const linear_table[14] = { | 53 | mad_fixed_t const linear_table[14] = { |
54 | MAD_F(0x15555555), /* 2^2 / (2^2 - 1) == 1.33333333333333 */ | 54 | MAD_F(0x15555555), /* 2^2 / (2^2 - 1) == 1.33333333333333 */ |
55 | MAD_F(0x12492492), /* 2^3 / (2^3 - 1) == 1.14285714285714 */ | 55 | MAD_F(0x12492492), /* 2^3 / (2^3 - 1) == 1.14285714285714 */ |
56 | MAD_F(0x11111111), /* 2^4 / (2^4 - 1) == 1.06666666666667 */ | 56 | MAD_F(0x11111111), /* 2^4 / (2^4 - 1) == 1.06666666666667 */ |
57 | MAD_F(0x10842108), /* 2^5 / (2^5 - 1) == 1.03225806451613 */ | 57 | MAD_F(0x10842108), /* 2^5 / (2^5 - 1) == 1.03225806451613 */ |
58 | MAD_F(0x10410410), /* 2^6 / (2^6 - 1) == 1.01587301587302 */ | 58 | MAD_F(0x10410410), /* 2^6 / (2^6 - 1) == 1.01587301587302 */ |
59 | MAD_F(0x10204081), /* 2^7 / (2^7 - 1) == 1.00787401574803 */ | 59 | MAD_F(0x10204081), /* 2^7 / (2^7 - 1) == 1.00787401574803 */ |
60 | MAD_F(0x10101010), /* 2^8 / (2^8 - 1) == 1.00392156862745 */ | 60 | MAD_F(0x10101010), /* 2^8 / (2^8 - 1) == 1.00392156862745 */ |
61 | MAD_F(0x10080402), /* 2^9 / (2^9 - 1) == 1.00195694716243 */ | 61 | MAD_F(0x10080402), /* 2^9 / (2^9 - 1) == 1.00195694716243 */ |
62 | MAD_F(0x10040100), /* 2^10 / (2^10 - 1) == 1.00097751710655 */ | 62 | MAD_F(0x10040100), /* 2^10 / (2^10 - 1) == 1.00097751710655 */ |
63 | MAD_F(0x10020040), /* 2^11 / (2^11 - 1) == 1.00048851978505 */ | 63 | MAD_F(0x10020040), /* 2^11 / (2^11 - 1) == 1.00048851978505 */ |
64 | MAD_F(0x10010010), /* 2^12 / (2^12 - 1) == 1.00024420024420 */ | 64 | MAD_F(0x10010010), /* 2^12 / (2^12 - 1) == 1.00024420024420 */ |
65 | MAD_F(0x10008004), /* 2^13 / (2^13 - 1) == 1.00012208521548 */ | 65 | MAD_F(0x10008004), /* 2^13 / (2^13 - 1) == 1.00012208521548 */ |
66 | MAD_F(0x10004001), /* 2^14 / (2^14 - 1) == 1.00006103888177 */ | 66 | MAD_F(0x10004001), /* 2^14 / (2^14 - 1) == 1.00006103888177 */ |
67 | MAD_F(0x10002000) /* 2^15 / (2^15 - 1) == 1.00003051850948 */ | 67 | MAD_F(0x10002000) /* 2^15 / (2^15 - 1) == 1.00003051850948 */ |
68 | }; | 68 | }; |
69 | 69 | ||
70 | /* | 70 | /* |
71 | * NAME:I_sample() | 71 | * NAME:I_sample() |
72 | * DESCRIPTION:decode one requantized Layer I sample from a bitstream | 72 | * DESCRIPTION:decode one requantized Layer I sample from a bitstream |
73 | */ | 73 | */ |
74 | static | 74 | static |
75 | mad_fixed_t I_sample(struct mad_bitptr *ptr, unsigned int nb) | 75 | mad_fixed_t I_sample(struct mad_bitptr *ptr, unsigned int nb) |
76 | { | 76 | { |
77 | mad_fixed_t sample; | 77 | mad_fixed_t sample; |
78 | 78 | ||
79 | sample = mad_bit_read(ptr, nb); | 79 | sample = mad_bit_read(ptr, nb); |
80 | 80 | ||
81 | /* invert most significant bit, extend sign, then scale to fixed format */ | 81 | /* invert most significant bit, extend sign, then scale to fixed format */ |
82 | 82 | ||
83 | sample ^= 1 << (nb - 1); | 83 | sample ^= 1 << (nb - 1); |
84 | sample |= -(sample & (1 << (nb - 1))); | 84 | sample |= -(sample & (1 << (nb - 1))); |
85 | 85 | ||
86 | sample <<= MAD_F_FRACBITS - (nb - 1); | 86 | sample <<= MAD_F_FRACBITS - (nb - 1); |
87 | 87 | ||
88 | /* requantize the sample */ | 88 | /* requantize the sample */ |
89 | 89 | ||
90 | /* s'' = (2^nb / (2^nb - 1)) * (s''' + 2^(-nb + 1)) */ | 90 | /* s'' = (2^nb / (2^nb - 1)) * (s''' + 2^(-nb + 1)) */ |
91 | 91 | ||
92 | sample += MAD_F_ONE >> (nb - 1); | 92 | sample += MAD_F_ONE >> (nb - 1); |
93 | 93 | ||
94 | return mad_f_mul(sample, linear_table[nb - 2]); | 94 | return mad_f_mul(sample, linear_table[nb - 2]); |
95 | 95 | ||
96 | /* s' = factor * s'' */ | 96 | /* s' = factor * s'' */ |
97 | /* (to be performed by caller) */ | 97 | /* (to be performed by caller) */ |
98 | } | 98 | } |
99 | 99 | ||
100 | /* | 100 | /* |
101 | * NAME:layer->I() | 101 | * NAME:layer->I() |
102 | * DESCRIPTION:decode a single Layer I frame | 102 | * DESCRIPTION:decode a single Layer I frame |
103 | */ | 103 | */ |
104 | int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) | 104 | int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) |
105 | { | 105 | { |
106 | struct mad_header *header = &frame->header; | 106 | struct mad_header *header = &frame->header; |
107 | unsigned int nch, bound, ch, s, sb, nb; | 107 | unsigned int nch, bound, ch, s, sb, nb; |
108 | unsigned char allocation[2][32], scalefactor[2][32]; | 108 | unsigned char allocation[2][32], scalefactor[2][32]; |
109 | 109 | ||
110 | nch = MAD_NCHANNELS(header); | 110 | nch = MAD_NCHANNELS(header); |
111 | 111 | ||
112 | bound = 32; | 112 | bound = 32; |
113 | if (header->mode == MAD_MODE_JOINT_STEREO) { | 113 | if (header->mode == MAD_MODE_JOINT_STEREO) { |
114 | header->flags |= MAD_FLAG_I_STEREO; | 114 | header->flags |= MAD_FLAG_I_STEREO; |
115 | bound = 4 + header->mode_extension * 4; | 115 | bound = 4 + header->mode_extension * 4; |
116 | } | 116 | } |
117 | 117 | ||
118 | /* check CRC word */ | 118 | /* check CRC word */ |
119 | 119 | ||
120 | if (header->flags & MAD_FLAG_PROTECTION) { | 120 | if (header->flags & MAD_FLAG_PROTECTION) { |
121 | header->crc_check = | 121 | header->crc_check = |
122 | mad_bit_crc(stream->ptr, 4 * (bound * nch + (32 - bound)), | 122 | mad_bit_crc(stream->ptr, 4 * (bound * nch + (32 - bound)), |
123 | header->crc_check); | 123 | header->crc_check); |
124 | 124 | ||
125 | if (header->crc_check != header->crc_target && | 125 | if (header->crc_check != header->crc_target && |
126 | !(frame->options & MAD_OPTION_IGNORECRC)) { | 126 | !(frame->options & MAD_OPTION_IGNORECRC)) { |
127 | stream->error = MAD_ERROR_BADCRC; | 127 | stream->error = MAD_ERROR_BADCRC; |
128 | return -1; | 128 | return -1; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
132 | /* decode bit allocations */ | 132 | /* decode bit allocations */ |
133 | 133 | ||
134 | for (sb = 0; sb < bound; ++sb) { | 134 | for (sb = 0; sb < bound; ++sb) { |
135 | for (ch = 0; ch < nch; ++ch) { | 135 | for (ch = 0; ch < nch; ++ch) { |
136 | nb = mad_bit_read(&stream->ptr, 4); | 136 | nb = mad_bit_read(&stream->ptr, 4); |
137 | 137 | ||
138 | if (nb == 15) { | 138 | if (nb == 15) { |
139 | stream->error = MAD_ERROR_BADBITALLOC; | 139 | stream->error = MAD_ERROR_BADBITALLOC; |
140 | return -1; | 140 | return -1; |
141 | } | 141 | } |
142 | 142 | ||
143 | allocation[ch][sb] = nb ? nb + 1 : 0; | 143 | allocation[ch][sb] = nb ? nb + 1 : 0; |
144 | } | 144 | } |
145 | } | 145 | } |
146 | 146 | ||
147 | for (sb = bound; sb < 32; ++sb) { | 147 | for (sb = bound; sb < 32; ++sb) { |
148 | nb = mad_bit_read(&stream->ptr, 4); | 148 | nb = mad_bit_read(&stream->ptr, 4); |
149 | 149 | ||
150 | if (nb == 15) { | 150 | if (nb == 15) { |
151 | stream->error = MAD_ERROR_BADBITALLOC; | 151 | stream->error = MAD_ERROR_BADBITALLOC; |
152 | return -1; | 152 | return -1; |
153 | } | 153 | } |
154 | 154 | ||
155 | allocation[0][sb] = | 155 | allocation[0][sb] = |
156 | allocation[1][sb] = nb ? nb + 1 : 0; | 156 | allocation[1][sb] = nb ? nb + 1 : 0; |
157 | } | 157 | } |
158 | 158 | ||
159 | /* decode scalefactors */ | 159 | /* decode scalefactors */ |
160 | 160 | ||
161 | for (sb = 0; sb < 32; ++sb) { | 161 | for (sb = 0; sb < 32; ++sb) { |
162 | for (ch = 0; ch < nch; ++ch) { | 162 | for (ch = 0; ch < nch; ++ch) { |
163 | if (allocation[ch][sb]) { | 163 | if (allocation[ch][sb]) { |
164 | scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6); | 164 | scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6); |
165 | 165 | ||
166 | # if defined(OPT_STRICT) | ||
167 | /* | ||
168 | * Scalefactor index 63 does not appear in Table B.1 of | ||
169 | * ISO/IEC 11172-3. Nonetheless, other implementations accept it, | ||
170 | * so we only reject it if OPT_STRICT is defined. | ||
171 | */ | ||
166 | if (scalefactor[ch][sb] == 63) { | 172 | if (scalefactor[ch][sb] == 63) { |
167 | stream->error = MAD_ERROR_BADSCALEFACTOR; | 173 | stream->error = MAD_ERROR_BADSCALEFACTOR; |
168 | return -1; | 174 | return -1; |
169 | } | 175 | } |
176 | # endif | ||
170 | } | 177 | } |
171 | } | 178 | } |
172 | } | 179 | } |
173 | 180 | ||
174 | /* decode samples */ | 181 | /* decode samples */ |
175 | 182 | ||
176 | for (s = 0; s < 12; ++s) { | 183 | for (s = 0; s < 12; ++s) { |
177 | for (sb = 0; sb < bound; ++sb) { | 184 | for (sb = 0; sb < bound; ++sb) { |
178 | for (ch = 0; ch < nch; ++ch) { | 185 | for (ch = 0; ch < nch; ++ch) { |
179 | nb = allocation[ch][sb]; | 186 | nb = allocation[ch][sb]; |
180 | frame->sbsample[ch][s][sb] = nb ? | 187 | frame->sbsample[ch][s][sb] = nb ? |
181 | mad_f_mul(I_sample(&stream->ptr, nb), | 188 | mad_f_mul(I_sample(&stream->ptr, nb), |
182 | sf_table[scalefactor[ch][sb]]) : 0; | 189 | sf_table[scalefactor[ch][sb]]) : 0; |
183 | } | 190 | } |
184 | } | 191 | } |
185 | 192 | ||
186 | for (sb = bound; sb < 32; ++sb) { | 193 | for (sb = bound; sb < 32; ++sb) { |
187 | if ((nb = allocation[0][sb])) { | 194 | if ((nb = allocation[0][sb])) { |
188 | mad_fixed_t sample; | 195 | mad_fixed_t sample; |
189 | 196 | ||
190 | sample = I_sample(&stream->ptr, nb); | 197 | sample = I_sample(&stream->ptr, nb); |
191 | 198 | ||
192 | for (ch = 0; ch < nch; ++ch) { | 199 | for (ch = 0; ch < nch; ++ch) { |
193 | frame->sbsample[ch][s][sb] = | 200 | frame->sbsample[ch][s][sb] = |
194 | mad_f_mul(sample, sf_table[scalefactor[ch][sb]]); | 201 | mad_f_mul(sample, sf_table[scalefactor[ch][sb]]); |
195 | } | 202 | } |
196 | } | 203 | } |
197 | else { | 204 | else { |
198 | for (ch = 0; ch < nch; ++ch) | 205 | for (ch = 0; ch < nch; ++ch) |
199 | frame->sbsample[ch][s][sb] = 0; | 206 | frame->sbsample[ch][s][sb] = 0; |
200 | } | 207 | } |
201 | } | 208 | } |
202 | } | 209 | } |
203 | 210 | ||
204 | return 0; | 211 | return 0; |
205 | } | 212 | } |
206 | 213 | ||
207 | /* --- Layer II ------------------------------------------------------------ */ | 214 | /* --- Layer II ------------------------------------------------------------ */ |
208 | 215 | ||
209 | /* possible quantization per subband table */ | 216 | /* possible quantization per subband table */ |
210 | static | 217 | static |
211 | struct { | 218 | struct { |
212 | unsigned int sblimit; | 219 | unsigned int sblimit; |
213 | unsigned char const offsets[30]; | 220 | unsigned char const offsets[30]; |
214 | } const sbquant_table[5] = { | 221 | } const sbquant_table[5] = { |
215 | /* ISO/IEC 11172-3 Table B.2a */ | 222 | /* ISO/IEC 11172-3 Table B.2a */ |
216 | { 27, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3,/* 0 */ | 223 | { 27, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3,/* 0 */ |
217 | 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0 } }, | 224 | 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0 } }, |
218 | /* ISO/IEC 11172-3 Table B.2b */ | 225 | /* ISO/IEC 11172-3 Table B.2b */ |
219 | { 30, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3,/* 1 */ | 226 | { 30, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3,/* 1 */ |
220 | 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0 } }, | 227 | 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0 } }, |
221 | /* ISO/IEC 11172-3 Table B.2c */ | 228 | /* ISO/IEC 11172-3 Table B.2c */ |
222 | { 8, { 5, 5, 2, 2, 2, 2, 2, 2 } }, /* 2 */ | 229 | { 8, { 5, 5, 2, 2, 2, 2, 2, 2 } }, /* 2 */ |
223 | /* ISO/IEC 11172-3 Table B.2d */ | 230 | /* ISO/IEC 11172-3 Table B.2d */ |
224 | { 12, { 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }, /* 3 */ | 231 | { 12, { 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }, /* 3 */ |
225 | /* ISO/IEC 13818-3 Table B.1 */ | 232 | /* ISO/IEC 13818-3 Table B.1 */ |
226 | { 30, { 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1,/* 4 */ | 233 | { 30, { 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1,/* 4 */ |
227 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } } | 234 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } } |
228 | }; | 235 | }; |
229 | 236 | ||
230 | /* bit allocation table */ | 237 | /* bit allocation table */ |
231 | static | 238 | static |
232 | struct { | 239 | struct { |
233 | unsigned short nbal; | 240 | unsigned short nbal; |
234 | unsigned short offset; | 241 | unsigned short offset; |
235 | } const bitalloc_table[8] = { | 242 | } const bitalloc_table[8] = { |
236 | { 2, 0 }, /* 0 */ | 243 | { 2, 0 }, /* 0 */ |
237 | { 2, 3 }, /* 1 */ | 244 | { 2, 3 }, /* 1 */ |
238 | { 3, 3 }, /* 2 */ | 245 | { 3, 3 }, /* 2 */ |
239 | { 3, 1 }, /* 3 */ | 246 | { 3, 1 }, /* 3 */ |
240 | { 4, 2 }, /* 4 */ | 247 | { 4, 2 }, /* 4 */ |
241 | { 4, 3 }, /* 5 */ | 248 | { 4, 3 }, /* 5 */ |
242 | { 4, 4 }, /* 6 */ | 249 | { 4, 4 }, /* 6 */ |
243 | { 4, 5 } /* 7 */ | 250 | { 4, 5 } /* 7 */ |
244 | }; | 251 | }; |
245 | 252 | ||
246 | /* offsets into quantization class table */ | 253 | /* offsets into quantization class table */ |
247 | static | 254 | static |
248 | unsigned char const offset_table[6][15] = { | 255 | unsigned char const offset_table[6][15] = { |
249 | { 0, 1, 16 }, /* 0 */ | 256 | { 0, 1, 16 }, /* 0 */ |
250 | { 0, 1, 2, 3, 4, 5, 16 }, /* 1 */ | 257 | { 0, 1, 2, 3, 4, 5, 16 }, /* 1 */ |
251 | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, /* 2 */ | 258 | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, /* 2 */ |
252 | { 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, /* 3 */ | 259 | { 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, /* 3 */ |
253 | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16 }, /* 4 */ | 260 | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16 }, /* 4 */ |
254 | { 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 } /* 5 */ | 261 | { 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 } /* 5 */ |
255 | }; | 262 | }; |
256 | 263 | ||
257 | /* quantization class table */ | 264 | /* quantization class table */ |
258 | static | 265 | static |
259 | struct quantclass { | 266 | struct quantclass { |
260 | unsigned short nlevels; | 267 | unsigned short nlevels; |
261 | unsigned char group; | 268 | unsigned char group; |
262 | unsigned char bits; | 269 | unsigned char bits; |
263 | mad_fixed_t C; | 270 | mad_fixed_t C; |
264 | mad_fixed_t D; | 271 | mad_fixed_t D; |
265 | } const qc_table[17] = { | 272 | } const qc_table[17] = { |
266 | # include "qc_table.dat" | 273 | # include "qc_table.dat" |
267 | }; | 274 | }; |
268 | 275 | ||
269 | /* | 276 | /* |
270 | * NAME:II_samples() | 277 | * NAME:II_samples() |
271 | * DESCRIPTION:decode three requantized Layer II samples from a bitstream | 278 | * DESCRIPTION:decode three requantized Layer II samples from a bitstream |
272 | */ | 279 | */ |
273 | static | 280 | static |
274 | void II_samples(struct mad_bitptr *ptr, | 281 | void II_samples(struct mad_bitptr *ptr, |
275 | struct quantclass const *quantclass, | 282 | struct quantclass const *quantclass, |
276 | mad_fixed_t output[3]) | 283 | mad_fixed_t output[3]) |
277 | { | 284 | { |
278 | unsigned int nb, s, sample[3]; | 285 | unsigned int nb, s, sample[3]; |
279 | 286 | ||
280 | if ((nb = quantclass->group)) { | 287 | if ((nb = quantclass->group)) { |
281 | unsigned int c, nlevels; | 288 | unsigned int c, nlevels; |
282 | 289 | ||
283 | /* degrouping */ | 290 | /* degrouping */ |
284 | c = mad_bit_read(ptr, quantclass->bits); | 291 | c = mad_bit_read(ptr, quantclass->bits); |
285 | nlevels = quantclass->nlevels; | 292 | nlevels = quantclass->nlevels; |
286 | 293 | ||
287 | for (s = 0; s < 3; ++s) { | 294 | for (s = 0; s < 3; ++s) { |
288 | sample[s] = c % nlevels; | 295 | sample[s] = c % nlevels; |
289 | c /= nlevels; | 296 | c /= nlevels; |
290 | } | 297 | } |
291 | } | 298 | } |
292 | else { | 299 | else { |
293 | nb = quantclass->bits; | 300 | nb = quantclass->bits; |
294 | 301 | ||
295 | for (s = 0; s < 3; ++s) | 302 | for (s = 0; s < 3; ++s) |
296 | sample[s] = mad_bit_read(ptr, nb); | 303 | sample[s] = mad_bit_read(ptr, nb); |
297 | } | 304 | } |
298 | 305 | ||
299 | for (s = 0; s < 3; ++s) { | 306 | for (s = 0; s < 3; ++s) { |
300 | mad_fixed_t requantized; | 307 | mad_fixed_t requantized; |
301 | 308 | ||
302 | /* invert most significant bit, extend sign, then scale to fixed format */ | 309 | /* invert most significant bit, extend sign, then scale to fixed format */ |
303 | 310 | ||
304 | requantized = sample[s] ^ (1 << (nb - 1)); | 311 | requantized = sample[s] ^ (1 << (nb - 1)); |
305 | requantized |= -(requantized & (1 << (nb - 1))); | 312 | requantized |= -(requantized & (1 << (nb - 1))); |
306 | 313 | ||
307 | requantized <<= MAD_F_FRACBITS - (nb - 1); | 314 | requantized <<= MAD_F_FRACBITS - (nb - 1); |
308 | 315 | ||
309 | /* requantize the sample */ | 316 | /* requantize the sample */ |
310 | 317 | ||
311 | /* s'' = C * (s''' + D) */ | 318 | /* s'' = C * (s''' + D) */ |
312 | 319 | ||
313 | output[s] = mad_f_mul(requantized + quantclass->D, quantclass->C); | 320 | output[s] = mad_f_mul(requantized + quantclass->D, quantclass->C); |
314 | 321 | ||
315 | /* s' = factor * s'' */ | 322 | /* s' = factor * s'' */ |
316 | /* (to be performed by caller) */ | 323 | /* (to be performed by caller) */ |
317 | } | 324 | } |
318 | } | 325 | } |
319 | 326 | ||
320 | /* | 327 | /* |
321 | * NAME:layer->II() | 328 | * NAME:layer->II() |
322 | * DESCRIPTION:decode a single Layer II frame | 329 | * DESCRIPTION:decode a single Layer II frame |
323 | */ | 330 | */ |
324 | int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) | 331 | int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) |
325 | { | 332 | { |
326 | struct mad_header *header = &frame->header; | 333 | struct mad_header *header = &frame->header; |
327 | struct mad_bitptr start; | 334 | struct mad_bitptr start; |
328 | unsigned int index, sblimit, nbal, nch, bound, gr, ch, s, sb; | 335 | unsigned int index, sblimit, nbal, nch, bound, gr, ch, s, sb; |
329 | unsigned char const *offsets; | 336 | unsigned char const *offsets; |
330 | unsigned char allocation[2][32], scfsi[2][32], scalefactor[2][32][3]; | 337 | unsigned char allocation[2][32], scfsi[2][32], scalefactor[2][32][3]; |
331 | mad_fixed_t samples[3]; | 338 | mad_fixed_t samples[3]; |
332 | 339 | ||
333 | nch = MAD_NCHANNELS(header); | 340 | nch = MAD_NCHANNELS(header); |
334 | 341 | ||
335 | if (header->flags & MAD_FLAG_LSF_EXT) | 342 | if (header->flags & MAD_FLAG_LSF_EXT) |
336 | index = 4; | 343 | index = 4; |
344 | else if (header->flags & MAD_FLAG_FREEFORMAT) | ||
345 | goto freeformat; | ||
337 | else { | 346 | else { |
338 | switch (nch == 2 ? header->bitrate / 2 : header->bitrate) { | 347 | unsigned long bitrate_per_channel; |
339 | case 32000: | 348 | |
340 | case 48000: | 349 | bitrate_per_channel = header->bitrate; |
341 | index = (header->samplerate == 32000) ? 3 : 2; | 350 | if (nch == 2) { |
342 | break; | 351 | bitrate_per_channel /= 2; |
352 | |||
353 | # if defined(OPT_STRICT) | ||
354 | /* | ||
355 | * ISO/IEC 11172-3 allows only single channel mode for 32, 48, 56, and | ||
356 | * 80 kbps bitrates in Layer II, but some encoders ignore this | ||
357 | * restriction. We enforce it if OPT_STRICT is defined. | ||
358 | */ | ||
359 | if (bitrate_per_channel <= 28000 || bitrate_per_channel == 40000) { | ||
360 | stream->error = MAD_ERROR_BADMODE; | ||
361 | return -1; | ||
362 | } | ||
363 | # endif | ||
364 | } | ||
365 | else { /* nch == 1 */ | ||
366 | if (bitrate_per_channel > 192000) { | ||
367 | /* | ||
368 | * ISO/IEC 11172-3 does not allow single channel mode for 224, 256, | ||
369 | * 320, or 384 kbps bitrates in Layer II. | ||
370 | */ | ||
371 | stream->error = MAD_ERROR_BADMODE; | ||
372 | return -1; | ||
373 | } | ||
374 | } | ||
343 | 375 | ||
344 | case 56000: | 376 | if (bitrate_per_channel <= 48000) |
345 | case 64000: | 377 | index = (header->samplerate == 32000) ? 3 : 2; |
346 | case 80000: | 378 | else if (bitrate_per_channel <= 80000) |
347 | index = 0; | 379 | index = 0; |
348 | break; | 380 | else { |
349 | 381 | freeformat: | |
350 | default: | ||
351 | index = (header->samplerate == 48000) ? 0 : 1; | 382 | index = (header->samplerate == 48000) ? 0 : 1; |
352 | } | 383 | } |
353 | } | 384 | } |
354 | 385 | ||
355 | sblimit = sbquant_table[index].sblimit; | 386 | sblimit = sbquant_table[index].sblimit; |
356 | offsets = sbquant_table[index].offsets; | 387 | offsets = sbquant_table[index].offsets; |
357 | 388 | ||
358 | bound = 32; | 389 | bound = 32; |
359 | if (header->mode == MAD_MODE_JOINT_STEREO) { | 390 | if (header->mode == MAD_MODE_JOINT_STEREO) { |
360 | header->flags |= MAD_FLAG_I_STEREO; | 391 | header->flags |= MAD_FLAG_I_STEREO; |
361 | bound = 4 + header->mode_extension * 4; | 392 | bound = 4 + header->mode_extension * 4; |
362 | } | 393 | } |
363 | 394 | ||
364 | if (bound > sblimit) | 395 | if (bound > sblimit) |
365 | bound = sblimit; | 396 | bound = sblimit; |
366 | 397 | ||
367 | start = stream->ptr; | 398 | start = stream->ptr; |
368 | 399 | ||
369 | /* decode bit allocations */ | 400 | /* decode bit allocations */ |
370 | 401 | ||
371 | for (sb = 0; sb < bound; ++sb) { | 402 | for (sb = 0; sb < bound; ++sb) { |
372 | nbal = bitalloc_table[offsets[sb]].nbal; | 403 | nbal = bitalloc_table[offsets[sb]].nbal; |
373 | 404 | ||
374 | for (ch = 0; ch < nch; ++ch) | 405 | for (ch = 0; ch < nch; ++ch) |
375 | allocation[ch][sb] = mad_bit_read(&stream->ptr, nbal); | 406 | allocation[ch][sb] = mad_bit_read(&stream->ptr, nbal); |
376 | } | 407 | } |
377 | 408 | ||
378 | for (sb = bound; sb < sblimit; ++sb) { | 409 | for (sb = bound; sb < sblimit; ++sb) { |
379 | nbal = bitalloc_table[offsets[sb]].nbal; | 410 | nbal = bitalloc_table[offsets[sb]].nbal; |
380 | 411 | ||
381 | allocation[0][sb] = | 412 | allocation[0][sb] = |
382 | allocation[1][sb] = mad_bit_read(&stream->ptr, nbal); | 413 | allocation[1][sb] = mad_bit_read(&stream->ptr, nbal); |
383 | } | 414 | } |
384 | 415 | ||
385 | /* decode scalefactor selection info */ | 416 | /* decode scalefactor selection info */ |
386 | 417 | ||
387 | for (sb = 0; sb < sblimit; ++sb) { | 418 | for (sb = 0; sb < sblimit; ++sb) { |
388 | for (ch = 0; ch < nch; ++ch) { | 419 | for (ch = 0; ch < nch; ++ch) { |
389 | if (allocation[ch][sb]) | 420 | if (allocation[ch][sb]) |
390 | scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2); | 421 | scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2); |
391 | } | 422 | } |
392 | } | 423 | } |
393 | 424 | ||
394 | /* check CRC word */ | 425 | /* check CRC word */ |
395 | 426 | ||
396 | if (header->flags & MAD_FLAG_PROTECTION) { | 427 | if (header->flags & MAD_FLAG_PROTECTION) { |
397 | header->crc_check = | 428 | header->crc_check = |
398 | mad_bit_crc(start, mad_bit_length(&start, &stream->ptr), | 429 | mad_bit_crc(start, mad_bit_length(&start, &stream->ptr), |
399 | header->crc_check); | 430 | header->crc_check); |
400 | 431 | ||
401 | if (header->crc_check != header->crc_target && | 432 | if (header->crc_check != header->crc_target && |
402 | !(frame->options & MAD_OPTION_IGNORECRC)) { | 433 | !(frame->options & MAD_OPTION_IGNORECRC)) { |
403 | stream->error = MAD_ERROR_BADCRC; | 434 | stream->error = MAD_ERROR_BADCRC; |
404 | return -1; | 435 | return -1; |
405 | } | 436 | } |
406 | } | 437 | } |
407 | 438 | ||
408 | /* decode scalefactors */ | 439 | /* decode scalefactors */ |
409 | 440 | ||
410 | for (sb = 0; sb < sblimit; ++sb) { | 441 | for (sb = 0; sb < sblimit; ++sb) { |
411 | for (ch = 0; ch < nch; ++ch) { | 442 | for (ch = 0; ch < nch; ++ch) { |
412 | if (allocation[ch][sb]) { | 443 | if (allocation[ch][sb]) { |
413 | scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6); | 444 | scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6); |
414 | 445 | ||
415 | switch (scfsi[ch][sb]) { | 446 | switch (scfsi[ch][sb]) { |
416 | case 2: | 447 | case 2: |
417 | scalefactor[ch][sb][2] = | 448 | scalefactor[ch][sb][2] = |
418 | scalefactor[ch][sb][1] = | 449 | scalefactor[ch][sb][1] = |
419 | scalefactor[ch][sb][0]; | 450 | scalefactor[ch][sb][0]; |
420 | break; | 451 | break; |
421 | 452 | ||
422 | case 0: | 453 | case 0: |
423 | scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6); | 454 | scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6); |
424 | /* fall through */ | 455 | /* fall through */ |
425 | 456 | ||
426 | case 1: | 457 | case 1: |
427 | case 3: | 458 | case 3: |
428 | scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6); | 459 | scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6); |
429 | } | 460 | } |
430 | 461 | ||
431 | if (scfsi[ch][sb] & 1) | 462 | if (scfsi[ch][sb] & 1) |
432 | scalefactor[ch][sb][1] = scalefactor[ch][sb][scfsi[ch][sb] - 1]; | 463 | scalefactor[ch][sb][1] = scalefactor[ch][sb][scfsi[ch][sb] - 1]; |
433 | 464 | ||
465 | # if defined(OPT_STRICT) | ||
466 | /* | ||
467 | * Scalefactor index 63 does not appear in Table B.1 of | ||
468 | * ISO/IEC 11172-3. Nonetheless, other implementations accept it, | ||
469 | * so we only reject it if OPT_STRICT is defined. | ||
470 | */ | ||
434 | if (scalefactor[ch][sb][0] == 63 || | 471 | if (scalefactor[ch][sb][0] == 63 || |
435 | scalefactor[ch][sb][1] == 63 || | 472 | scalefactor[ch][sb][1] == 63 || |
436 | scalefactor[ch][sb][2] == 63) { | 473 | scalefactor[ch][sb][2] == 63) { |
437 | stream->error = MAD_ERROR_BADSCALEFACTOR; | 474 | stream->error = MAD_ERROR_BADSCALEFACTOR; |
438 | return -1; | 475 | return -1; |
439 | } | 476 | } |
477 | # endif | ||
440 | } | 478 | } |
441 | } | 479 | } |
442 | } | 480 | } |
443 | 481 | ||
444 | /* decode samples */ | 482 | /* decode samples */ |
445 | 483 | ||
446 | for (gr = 0; gr < 12; ++gr) { | 484 | for (gr = 0; gr < 12; ++gr) { |
447 | for (sb = 0; sb < bound; ++sb) { | 485 | for (sb = 0; sb < bound; ++sb) { |
448 | for (ch = 0; ch < nch; ++ch) { | 486 | for (ch = 0; ch < nch; ++ch) { |
449 | if ((index = allocation[ch][sb])) { | 487 | if ((index = allocation[ch][sb])) { |
450 | index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1]; | 488 | index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1]; |
451 | 489 | ||
452 | II_samples(&stream->ptr, &qc_table[index], samples); | 490 | II_samples(&stream->ptr, &qc_table[index], samples); |
453 | 491 | ||
454 | for (s = 0; s < 3; ++s) { | 492 | for (s = 0; s < 3; ++s) { |
455 | frame->sbsample[ch][3 * gr + s][sb] = | 493 | frame->sbsample[ch][3 * gr + s][sb] = |
456 | mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); | 494 | mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); |
457 | } | 495 | } |
458 | } | 496 | } |
459 | else { | 497 | else { |
460 | for (s = 0; s < 3; ++s) | 498 | for (s = 0; s < 3; ++s) |
461 | frame->sbsample[ch][3 * gr + s][sb] = 0; | 499 | frame->sbsample[ch][3 * gr + s][sb] = 0; |
462 | } | 500 | } |
463 | } | 501 | } |
464 | } | 502 | } |
465 | 503 | ||
466 | for (sb = bound; sb < sblimit; ++sb) { | 504 | for (sb = bound; sb < sblimit; ++sb) { |
467 | if ((index = allocation[0][sb])) { | 505 | if ((index = allocation[0][sb])) { |
468 | index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1]; | 506 | index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1]; |
469 | 507 | ||
470 | II_samples(&stream->ptr, &qc_table[index], samples); | 508 | II_samples(&stream->ptr, &qc_table[index], samples); |
471 | 509 | ||
472 | for (ch = 0; ch < nch; ++ch) { | 510 | for (ch = 0; ch < nch; ++ch) { |
473 | for (s = 0; s < 3; ++s) { | 511 | for (s = 0; s < 3; ++s) { |
474 | frame->sbsample[ch][3 * gr + s][sb] = | 512 | frame->sbsample[ch][3 * gr + s][sb] = |
475 | mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); | 513 | mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); |
476 | } | 514 | } |
477 | } | 515 | } |
478 | } | 516 | } |
479 | else { | 517 | else { |
480 | for (ch = 0; ch < nch; ++ch) { | 518 | for (ch = 0; ch < nch; ++ch) { |
481 | for (s = 0; s < 3; ++s) | 519 | for (s = 0; s < 3; ++s) |
482 | frame->sbsample[ch][3 * gr + s][sb] = 0; | 520 | frame->sbsample[ch][3 * gr + s][sb] = 0; |
483 | } | 521 | } |
484 | } | 522 | } |
485 | } | 523 | } |
486 | 524 | ||
487 | for (ch = 0; ch < nch; ++ch) { | 525 | for (ch = 0; ch < nch; ++ch) { |
488 | for (s = 0; s < 3; ++s) { | 526 | for (s = 0; s < 3; ++s) { |
489 | for (sb = sblimit; sb < 32; ++sb) | 527 | for (sb = sblimit; sb < 32; ++sb) |
490 | frame->sbsample[ch][3 * gr + s][sb] = 0; | 528 | frame->sbsample[ch][3 * gr + s][sb] = 0; |
491 | } | 529 | } |
492 | } | 530 | } |
493 | } | 531 | } |
494 | 532 | ||
495 | return 0; | 533 | return 0; |
496 | } | 534 | } |
diff --git a/core/multimedia/opieplayer/libmad/layer12.h b/core/multimedia/opieplayer/libmad/layer12.h index c673726..3fe6bd8 100644 --- a/core/multimedia/opieplayer/libmad/layer12.h +++ b/core/multimedia/opieplayer/libmad/layer12.h | |||
@@ -1,31 +1,31 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifndef LIBMAD_LAYER12_H | 22 | # ifndef LIBMAD_LAYER12_H |
23 | # define LIBMAD_LAYER12_H | 23 | # define LIBMAD_LAYER12_H |
24 | 24 | ||
25 | # include "stream.h" | 25 | # include "stream.h" |
26 | # include "frame.h" | 26 | # include "frame.h" |
27 | 27 | ||
28 | int mad_layer_I(struct mad_stream *, struct mad_frame *); | 28 | int mad_layer_I(struct mad_stream *, struct mad_frame *); |
29 | int mad_layer_II(struct mad_stream *, struct mad_frame *); | 29 | int mad_layer_II(struct mad_stream *, struct mad_frame *); |
30 | 30 | ||
31 | # endif | 31 | # endif |
diff --git a/core/multimedia/opieplayer/libmad/layer3.c b/core/multimedia/opieplayer/libmad/layer3.c index 03f13fe..3c5dd9e 100644 --- a/core/multimedia/opieplayer/libmad/layer3.c +++ b/core/multimedia/opieplayer/libmad/layer3.c | |||
@@ -1,2502 +1,2698 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifdef HAVE_CONFIG_H | 22 | # ifdef HAVE_CONFIG_H |
23 | # include "libmad_config.h" | 23 | # include "libmad_config.h" |
24 | # endif | 24 | # endif |
25 | 25 | ||
26 | # include "libmad_global.h" | 26 | # include "libmad_global.h" |
27 | 27 | ||
28 | # include <stdlib.h> | 28 | # include <stdlib.h> |
29 | # include <string.h> | 29 | # include <string.h> |
30 | 30 | ||
31 | # ifdef HAVE_ASSERT_H | 31 | # ifdef HAVE_ASSERT_H |
32 | # include <assert.h> | 32 | # include <assert.h> |
33 | # endif | 33 | # endif |
34 | 34 | ||
35 | # ifdef HAVE_LIMITS_H | 35 | # ifdef HAVE_LIMITS_H |
36 | # include <limits.h> | 36 | # include <limits.h> |
37 | # else | 37 | # else |
38 | # define CHAR_BIT 8 | 38 | # define CHAR_BIT 8 |
39 | # endif | 39 | # endif |
40 | 40 | ||
41 | # include "fixed.h" | 41 | # include "fixed.h" |
42 | # include "bit.h" | 42 | # include "bit.h" |
43 | # include "stream.h" | 43 | # include "stream.h" |
44 | # include "frame.h" | 44 | # include "frame.h" |
45 | # include "huffman.h" | 45 | # include "huffman.h" |
46 | # include "layer3.h" | 46 | # include "layer3.h" |
47 | 47 | ||
48 | /* --- Layer III ----------------------------------------------------------- */ | 48 | /* --- Layer III ----------------------------------------------------------- */ |
49 | 49 | ||
50 | enum { | 50 | enum { |
51 | count1table_select = 0x01, | 51 | count1table_select = 0x01, |
52 | scalefac_scale = 0x02, | 52 | scalefac_scale = 0x02, |
53 | preflag = 0x04, | 53 | preflag = 0x04, |
54 | mixed_block_flag = 0x08 | 54 | mixed_block_flag = 0x08 |
55 | }; | 55 | }; |
56 | 56 | ||
57 | enum { | 57 | enum { |
58 | I_STEREO = 0x1, | 58 | I_STEREO = 0x1, |
59 | MS_STEREO = 0x2 | 59 | MS_STEREO = 0x2 |
60 | }; | 60 | }; |
61 | 61 | ||
62 | struct sideinfo { | 62 | struct sideinfo { |
63 | unsigned int main_data_begin; | 63 | unsigned int main_data_begin; |
64 | unsigned int private_bits; | 64 | unsigned int private_bits; |
65 | 65 | ||
66 | unsigned char scfsi[2]; | 66 | unsigned char scfsi[2]; |
67 | 67 | ||
68 | struct granule { | 68 | struct granule { |
69 | struct channel { | 69 | struct channel { |
70 | /* from side info */ | 70 | /* from side info */ |
71 | unsigned short part2_3_length; | 71 | unsigned short part2_3_length; |
72 | unsigned short big_values; | 72 | unsigned short big_values; |
73 | unsigned short global_gain; | 73 | unsigned short global_gain; |
74 | unsigned short scalefac_compress; | 74 | unsigned short scalefac_compress; |
75 | 75 | ||
76 | unsigned char flags; | 76 | unsigned char flags; |
77 | unsigned char block_type; | 77 | unsigned char block_type; |
78 | unsigned char table_select[3]; | 78 | unsigned char table_select[3]; |
79 | unsigned char subblock_gain[3]; | 79 | unsigned char subblock_gain[3]; |
80 | unsigned char region0_count; | 80 | unsigned char region0_count; |
81 | unsigned char region1_count; | 81 | unsigned char region1_count; |
82 | 82 | ||
83 | /* from main_data */ | 83 | /* from main_data */ |
84 | unsigned char scalefac[39];/* scalefac_l and/or scalefac_s */ | 84 | unsigned char scalefac[39];/* scalefac_l and/or scalefac_s */ |
85 | } ch[2]; | 85 | } ch[2]; |
86 | } gr[2]; | 86 | } gr[2]; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | /* | 89 | /* |
90 | * scalefactor bit lengths | 90 | * scalefactor bit lengths |
91 | * derived from section 2.4.2.7 of ISO/IEC 11172-3 | 91 | * derived from section 2.4.2.7 of ISO/IEC 11172-3 |
92 | */ | 92 | */ |
93 | static | 93 | static |
94 | struct { | 94 | struct { |
95 | unsigned char slen1; | 95 | unsigned char slen1; |
96 | unsigned char slen2; | 96 | unsigned char slen2; |
97 | } const sflen_table[16] = { | 97 | } const sflen_table[16] = { |
98 | { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 }, | 98 | { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 }, |
99 | { 3, 0 }, { 1, 1 }, { 1, 2 }, { 1, 3 }, | 99 | { 3, 0 }, { 1, 1 }, { 1, 2 }, { 1, 3 }, |
100 | { 2, 1 }, { 2, 2 }, { 2, 3 }, { 3, 1 }, | 100 | { 2, 1 }, { 2, 2 }, { 2, 3 }, { 3, 1 }, |
101 | { 3, 2 }, { 3, 3 }, { 4, 2 }, { 4, 3 } | 101 | { 3, 2 }, { 3, 3 }, { 4, 2 }, { 4, 3 } |
102 | }; | 102 | }; |
103 | 103 | ||
104 | /* | 104 | /* |
105 | * number of LSF scalefactor band values | 105 | * number of LSF scalefactor band values |
106 | * derived from section 2.4.3.2 of ISO/IEC 13818-3 | 106 | * derived from section 2.4.3.2 of ISO/IEC 13818-3 |
107 | */ | 107 | */ |
108 | static | 108 | static |
109 | unsigned char const nsfb_table[6][3][4] = { | 109 | unsigned char const nsfb_table[6][3][4] = { |
110 | { { 6, 5, 5, 5 }, | 110 | { { 6, 5, 5, 5 }, |
111 | { 9, 9, 9, 9 }, | 111 | { 9, 9, 9, 9 }, |
112 | { 6, 9, 9, 9 } }, | 112 | { 6, 9, 9, 9 } }, |
113 | 113 | ||
114 | { { 6, 5, 7, 3 }, | 114 | { { 6, 5, 7, 3 }, |
115 | { 9, 9, 12, 6 }, | 115 | { 9, 9, 12, 6 }, |
116 | { 6, 9, 12, 6 } }, | 116 | { 6, 9, 12, 6 } }, |
117 | 117 | ||
118 | { { 11, 10, 0, 0 }, | 118 | { { 11, 10, 0, 0 }, |
119 | { 18, 18, 0, 0 }, | 119 | { 18, 18, 0, 0 }, |
120 | { 15, 18, 0, 0 } }, | 120 | { 15, 18, 0, 0 } }, |
121 | 121 | ||
122 | { { 7, 7, 7, 0 }, | 122 | { { 7, 7, 7, 0 }, |
123 | { 12, 12, 12, 0 }, | 123 | { 12, 12, 12, 0 }, |
124 | { 6, 15, 12, 0 } }, | 124 | { 6, 15, 12, 0 } }, |
125 | 125 | ||
126 | { { 6, 6, 6, 3 }, | 126 | { { 6, 6, 6, 3 }, |
127 | { 12, 9, 9, 6 }, | 127 | { 12, 9, 9, 6 }, |
128 | { 6, 12, 9, 6 } }, | 128 | { 6, 12, 9, 6 } }, |
129 | 129 | ||
130 | { { 8, 8, 5, 0 }, | 130 | { { 8, 8, 5, 0 }, |
131 | { 15, 12, 9, 0 }, | 131 | { 15, 12, 9, 0 }, |
132 | { 6, 18, 9, 0 } } | 132 | { 6, 18, 9, 0 } } |
133 | }; | 133 | }; |
134 | 134 | ||
135 | /* | 135 | /* |
136 | * MPEG-1 scalefactor band widths | 136 | * MPEG-1 scalefactor band widths |
137 | * derived from Table B.8 of ISO/IEC 11172-3 | 137 | * derived from Table B.8 of ISO/IEC 11172-3 |
138 | */ | 138 | */ |
139 | static | 139 | static |
140 | unsigned char const sfb_48000_long[] = { | 140 | unsigned char const sfb_48000_long[] = { |
141 | 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10, | 141 | 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10, |
142 | 12, 16, 18, 22, 28, 34, 40, 46, 54, 54, 192 | 142 | 12, 16, 18, 22, 28, 34, 40, 46, 54, 54, 192 |
143 | }; | 143 | }; |
144 | 144 | ||
145 | static | 145 | static |
146 | unsigned char const sfb_44100_long[] = { | 146 | unsigned char const sfb_44100_long[] = { |
147 | 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10, | 147 | 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10, |
148 | 12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158 | 148 | 12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158 |
149 | }; | 149 | }; |
150 | 150 | ||
151 | static | 151 | static |
152 | unsigned char const sfb_32000_long[] = { | 152 | unsigned char const sfb_32000_long[] = { |
153 | 4, 4, 4, 4, 4, 4, 6, 6, 8, 10, 12, | 153 | 4, 4, 4, 4, 4, 4, 6, 6, 8, 10, 12, |
154 | 16, 20, 24, 30, 38, 46, 56, 68, 84, 102, 26 | 154 | 16, 20, 24, 30, 38, 46, 56, 68, 84, 102, 26 |
155 | }; | 155 | }; |
156 | 156 | ||
157 | static | 157 | static |
158 | unsigned char const sfb_48000_short[] = { | 158 | unsigned char const sfb_48000_short[] = { |
159 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, | 159 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, |
160 | 6, 6, 6, 6, 6, 10, 10, 10, 12, 12, 12, 14, 14, | 160 | 6, 6, 6, 6, 6, 10, 10, 10, 12, 12, 12, 14, 14, |
161 | 14, 16, 16, 16, 20, 20, 20, 26, 26, 26, 66, 66, 66 | 161 | 14, 16, 16, 16, 20, 20, 20, 26, 26, 26, 66, 66, 66 |
162 | }; | 162 | }; |
163 | 163 | ||
164 | static | 164 | static |
165 | unsigned char const sfb_44100_short[] = { | 165 | unsigned char const sfb_44100_short[] = { |
166 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, | 166 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, |
167 | 6, 6, 8, 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, | 167 | 6, 6, 8, 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, |
168 | 14, 18, 18, 18, 22, 22, 22, 30, 30, 30, 56, 56, 56 | 168 | 14, 18, 18, 18, 22, 22, 22, 30, 30, 30, 56, 56, 56 |
169 | }; | 169 | }; |
170 | 170 | ||
171 | static | 171 | static |
172 | unsigned char const sfb_32000_short[] = { | 172 | unsigned char const sfb_32000_short[] = { |
173 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, | 173 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, |
174 | 6, 6, 8, 8, 8, 12, 12, 12, 16, 16, 16, 20, 20, | 174 | 6, 6, 8, 8, 8, 12, 12, 12, 16, 16, 16, 20, 20, |
175 | 20, 26, 26, 26, 34, 34, 34, 42, 42, 42, 12, 12, 12 | 175 | 20, 26, 26, 26, 34, 34, 34, 42, 42, 42, 12, 12, 12 |
176 | }; | 176 | }; |
177 | 177 | ||
178 | static | 178 | static |
179 | unsigned char const sfb_48000_mixed[] = { | 179 | unsigned char const sfb_48000_mixed[] = { |
180 | /* long */ 4, 4, 4, 4, 4, 4, 6, 6, | 180 | /* long */ 4, 4, 4, 4, 4, 4, 6, 6, |
181 | /* short */ 4, 4, 4, 6, 6, 6, 6, 6, 6, 10, | 181 | /* short */ 4, 4, 4, 6, 6, 6, 6, 6, 6, 10, |
182 | 10, 10, 12, 12, 12, 14, 14, 14, 16, 16, | 182 | 10, 10, 12, 12, 12, 14, 14, 14, 16, 16, |
183 | 16, 20, 20, 20, 26, 26, 26, 66, 66, 66 | 183 | 16, 20, 20, 20, 26, 26, 26, 66, 66, 66 |
184 | }; | 184 | }; |
185 | 185 | ||
186 | static | 186 | static |
187 | unsigned char const sfb_44100_mixed[] = { | 187 | unsigned char const sfb_44100_mixed[] = { |
188 | /* long */ 4, 4, 4, 4, 4, 4, 6, 6, | 188 | /* long */ 4, 4, 4, 4, 4, 4, 6, 6, |
189 | /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 10, | 189 | /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 10, |
190 | 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, | 190 | 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, |
191 | 18, 22, 22, 22, 30, 30, 30, 56, 56, 56 | 191 | 18, 22, 22, 22, 30, 30, 30, 56, 56, 56 |
192 | }; | 192 | }; |
193 | 193 | ||
194 | static | 194 | static |
195 | unsigned char const sfb_32000_mixed[] = { | 195 | unsigned char const sfb_32000_mixed[] = { |
196 | /* long */ 4, 4, 4, 4, 4, 4, 6, 6, | 196 | /* long */ 4, 4, 4, 4, 4, 4, 6, 6, |
197 | /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 12, | 197 | /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 12, |
198 | 12, 12, 16, 16, 16, 20, 20, 20, 26, 26, | 198 | 12, 12, 16, 16, 16, 20, 20, 20, 26, 26, |
199 | 26, 34, 34, 34, 42, 42, 42, 12, 12, 12 | 199 | 26, 34, 34, 34, 42, 42, 42, 12, 12, 12 |
200 | }; | 200 | }; |
201 | 201 | ||
202 | /* | 202 | /* |
203 | * MPEG-2 scalefactor band widths | 203 | * MPEG-2 scalefactor band widths |
204 | * derived from Table B.2 of ISO/IEC 13818-3 | 204 | * derived from Table B.2 of ISO/IEC 13818-3 |
205 | */ | 205 | */ |
206 | static | 206 | static |
207 | unsigned char const sfb_24000_long[] = { | 207 | unsigned char const sfb_24000_long[] = { |
208 | 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, | 208 | 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, |
209 | 18, 22, 26, 32, 38, 46, 54, 62, 70, 76, 36 | 209 | 18, 22, 26, 32, 38, 46, 54, 62, 70, 76, 36 |
210 | }; | 210 | }; |
211 | 211 | ||
212 | static | 212 | static |
213 | unsigned char const sfb_22050_long[] = { | 213 | unsigned char const sfb_22050_long[] = { |
214 | 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, | 214 | 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, |
215 | 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54 | 215 | 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54 |
216 | }; | 216 | }; |
217 | 217 | ||
218 | # define sfb_16000_long sfb_22050_long | 218 | # define sfb_16000_long sfb_22050_long |
219 | 219 | ||
220 | static | 220 | static |
221 | unsigned char const sfb_24000_short[] = { | 221 | unsigned char const sfb_24000_short[] = { |
222 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, | 222 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, |
223 | 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, | 223 | 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, |
224 | 18, 24, 24, 24, 32, 32, 32, 44, 44, 44, 12, 12, 12 | 224 | 18, 24, 24, 24, 32, 32, 32, 44, 44, 44, 12, 12, 12 |
225 | }; | 225 | }; |
226 | 226 | ||
227 | static | 227 | static |
228 | unsigned char const sfb_22050_short[] = { | 228 | unsigned char const sfb_22050_short[] = { |
229 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, | 229 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, |
230 | 6, 6, 8, 8, 8, 10, 10, 10, 14, 14, 14, 18, 18, | 230 | 6, 6, 8, 8, 8, 10, 10, 10, 14, 14, 14, 18, 18, |
231 | 18, 26, 26, 26, 32, 32, 32, 42, 42, 42, 18, 18, 18 | 231 | 18, 26, 26, 26, 32, 32, 32, 42, 42, 42, 18, 18, 18 |
232 | }; | 232 | }; |
233 | 233 | ||
234 | static | 234 | static |
235 | unsigned char const sfb_16000_short[] = { | 235 | unsigned char const sfb_16000_short[] = { |
236 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, | 236 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, |
237 | 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, | 237 | 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, |
238 | 18, 24, 24, 24, 30, 30, 30, 40, 40, 40, 18, 18, 18 | 238 | 18, 24, 24, 24, 30, 30, 30, 40, 40, 40, 18, 18, 18 |
239 | }; | 239 | }; |
240 | 240 | ||
241 | static | 241 | static |
242 | unsigned char const sfb_24000_mixed[] = { | 242 | unsigned char const sfb_24000_mixed[] = { |
243 | /* long */ 6, 6, 6, 6, 6, 6, | 243 | /* long */ 6, 6, 6, 6, 6, 6, |
244 | /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12, | 244 | /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12, |
245 | 12, 12, 14, 14, 14, 18, 18, 18, 24, 24, | 245 | 12, 12, 14, 14, 14, 18, 18, 18, 24, 24, |
246 | 24, 32, 32, 32, 44, 44, 44, 12, 12, 12 | 246 | 24, 32, 32, 32, 44, 44, 44, 12, 12, 12 |
247 | }; | 247 | }; |
248 | 248 | ||
249 | static | 249 | static |
250 | unsigned char const sfb_22050_mixed[] = { | 250 | unsigned char const sfb_22050_mixed[] = { |
251 | /* long */ 6, 6, 6, 6, 6, 6, | 251 | /* long */ 6, 6, 6, 6, 6, 6, |
252 | /* short */ 6, 6, 6, 6, 6, 6, 8, 8, 8, 10, | 252 | /* short */ 6, 6, 6, 6, 6, 6, 8, 8, 8, 10, |
253 | 10, 10, 14, 14, 14, 18, 18, 18, 26, 26, | 253 | 10, 10, 14, 14, 14, 18, 18, 18, 26, 26, |
254 | 26, 32, 32, 32, 42, 42, 42, 18, 18, 18 | 254 | 26, 32, 32, 32, 42, 42, 42, 18, 18, 18 |
255 | }; | 255 | }; |
256 | 256 | ||
257 | static | 257 | static |
258 | unsigned char const sfb_16000_mixed[] = { | 258 | unsigned char const sfb_16000_mixed[] = { |
259 | /* long */ 6, 6, 6, 6, 6, 6, | 259 | /* long */ 6, 6, 6, 6, 6, 6, |
260 | /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12, | 260 | /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12, |
261 | 12, 12, 14, 14, 14, 18, 18, 18, 24, 24, | 261 | 12, 12, 14, 14, 14, 18, 18, 18, 24, 24, |
262 | 24, 30, 30, 30, 40, 40, 40, 18, 18, 18 | 262 | 24, 30, 30, 30, 40, 40, 40, 18, 18, 18 |
263 | }; | 263 | }; |
264 | 264 | ||
265 | /* | 265 | /* |
266 | * MPEG 2.5 scalefactor band widths | 266 | * MPEG 2.5 scalefactor band widths |
267 | * derived from public sources | 267 | * derived from public sources |
268 | */ | 268 | */ |
269 | # define sfb_12000_long sfb_16000_long | 269 | # define sfb_12000_long sfb_16000_long |
270 | # define sfb_11025_long sfb_12000_long | 270 | # define sfb_11025_long sfb_12000_long |
271 | 271 | ||
272 | static | 272 | static |
273 | unsigned char const sfb_8000_long[] = { | 273 | unsigned char const sfb_8000_long[] = { |
274 | 12, 12, 12, 12, 12, 12, 16, 20, 24, 28, 32, | 274 | 12, 12, 12, 12, 12, 12, 16, 20, 24, 28, 32, |
275 | 40, 48, 56, 64, 76, 90, 2, 2, 2, 2, 2 | 275 | 40, 48, 56, 64, 76, 90, 2, 2, 2, 2, 2 |
276 | }; | 276 | }; |
277 | 277 | ||
278 | # define sfb_12000_short sfb_16000_short | 278 | # define sfb_12000_short sfb_16000_short |
279 | # define sfb_11025_short sfb_12000_short | 279 | # define sfb_11025_short sfb_12000_short |
280 | 280 | ||
281 | static | 281 | static |
282 | unsigned char const sfb_8000_short[] = { | 282 | unsigned char const sfb_8000_short[] = { |
283 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 16, | 283 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 16, |
284 | 16, 16, 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36, | 284 | 16, 16, 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36, |
285 | 36, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26 | 285 | 36, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26 |
286 | }; | 286 | }; |
287 | 287 | ||
288 | # define sfb_12000_mixed sfb_16000_mixed | 288 | # define sfb_12000_mixed sfb_16000_mixed |
289 | # define sfb_11025_mixed sfb_12000_mixed | 289 | # define sfb_11025_mixed sfb_12000_mixed |
290 | 290 | ||
291 | /* the 8000 Hz short block scalefactor bands do not break after the first 36 | 291 | /* the 8000 Hz short block scalefactor bands do not break after |
292 | frequency lines, so this is probably wrong */ | 292 | the first 36 frequency lines, so this is probably wrong */ |
293 | static | 293 | static |
294 | unsigned char const sfb_8000_mixed[] = { | 294 | unsigned char const sfb_8000_mixed[] = { |
295 | /* long */ 12, 12, 12, | 295 | /* long */ 12, 12, 12, |
296 | /* short */ 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16, | 296 | /* short */ 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16, |
297 | 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36, 36, | 297 | 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36, 36, |
298 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26 | 298 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26 |
299 | }; | 299 | }; |
300 | 300 | ||
301 | static | 301 | static |
302 | struct { | 302 | struct { |
303 | unsigned char const *l; | 303 | unsigned char const *l; |
304 | unsigned char const *s; | 304 | unsigned char const *s; |
305 | unsigned char const *m; | 305 | unsigned char const *m; |
306 | } const sfbwidth_table[9] = { | 306 | } const sfbwidth_table[9] = { |
307 | { sfb_48000_long, sfb_48000_short, sfb_48000_mixed }, | 307 | { sfb_48000_long, sfb_48000_short, sfb_48000_mixed }, |
308 | { sfb_44100_long, sfb_44100_short, sfb_44100_mixed }, | 308 | { sfb_44100_long, sfb_44100_short, sfb_44100_mixed }, |
309 | { sfb_32000_long, sfb_32000_short, sfb_32000_mixed }, | 309 | { sfb_32000_long, sfb_32000_short, sfb_32000_mixed }, |
310 | { sfb_24000_long, sfb_24000_short, sfb_24000_mixed }, | 310 | { sfb_24000_long, sfb_24000_short, sfb_24000_mixed }, |
311 | { sfb_22050_long, sfb_22050_short, sfb_22050_mixed }, | 311 | { sfb_22050_long, sfb_22050_short, sfb_22050_mixed }, |
312 | { sfb_16000_long, sfb_16000_short, sfb_16000_mixed }, | 312 | { sfb_16000_long, sfb_16000_short, sfb_16000_mixed }, |
313 | { sfb_12000_long, sfb_12000_short, sfb_12000_mixed }, | 313 | { sfb_12000_long, sfb_12000_short, sfb_12000_mixed }, |
314 | { sfb_11025_long, sfb_11025_short, sfb_11025_mixed }, | 314 | { sfb_11025_long, sfb_11025_short, sfb_11025_mixed }, |
315 | { sfb_8000_long, sfb_8000_short, sfb_8000_mixed } | 315 | { sfb_8000_long, sfb_8000_short, sfb_8000_mixed } |
316 | }; | 316 | }; |
317 | 317 | ||
318 | /* | 318 | /* |
319 | * scalefactor band preemphasis (used only when preflag is set) | 319 | * scalefactor band preemphasis (used only when preflag is set) |
320 | * derived from Table B.6 of ISO/IEC 11172-3 | 320 | * derived from Table B.6 of ISO/IEC 11172-3 |
321 | */ | 321 | */ |
322 | static | 322 | static |
323 | unsigned char const pretab[22] = { | 323 | unsigned char const pretab[22] = { |
324 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0 | 324 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0 |
325 | }; | 325 | }; |
326 | 326 | ||
327 | /* | 327 | /* |
328 | * table for requantization | 328 | * table for requantization |
329 | * | 329 | * |
330 | * rq_table[x].mantissa * 2^(rq_table[x].exponent) = x^(4/3) | 330 | * rq_table[x].mantissa * 2^(rq_table[x].exponent) = x^(4/3) |
331 | */ | 331 | */ |
332 | static | 332 | static |
333 | struct fixedfloat { | 333 | struct fixedfloat { |
334 | unsigned long mantissa : 27; | 334 | unsigned long mantissa : 27; |
335 | unsigned short exponent : 5; | 335 | unsigned short exponent : 5; |
336 | } const rq_table[8207] = { | 336 | } const rq_table[8207] = { |
337 | # include "rq_table.dat" | 337 | # include "rq_table.dat" |
338 | }; | 338 | }; |
339 | 339 | ||
340 | /* | 340 | /* |
341 | * fractional powers of two | 341 | * fractional powers of two |
342 | * used for requantization and joint stereo decoding | 342 | * used for requantization and joint stereo decoding |
343 | * | 343 | * |
344 | * root_table[3 + x] = 2^(x/4) | 344 | * root_table[3 + x] = 2^(x/4) |
345 | */ | 345 | */ |
346 | static | 346 | static |
347 | mad_fixed_t const root_table[7] = { | 347 | mad_fixed_t const root_table[7] = { |
348 | MAD_F(0x09837f05) /* 2^(-3/4) == 0.59460355750136 */, | 348 | MAD_F(0x09837f05) /* 2^(-3/4) == 0.59460355750136 */, |
349 | MAD_F(0x0b504f33) /* 2^(-2/4) == 0.70710678118655 */, | 349 | MAD_F(0x0b504f33) /* 2^(-2/4) == 0.70710678118655 */, |
350 | MAD_F(0x0d744fcd) /* 2^(-1/4) == 0.84089641525371 */, | 350 | MAD_F(0x0d744fcd) /* 2^(-1/4) == 0.84089641525371 */, |
351 | MAD_F(0x10000000) /* 2^( 0/4) == 1.00000000000000 */, | 351 | MAD_F(0x10000000) /* 2^( 0/4) == 1.00000000000000 */, |
352 | MAD_F(0x1306fe0a) /* 2^(+1/4) == 1.18920711500272 */, | 352 | MAD_F(0x1306fe0a) /* 2^(+1/4) == 1.18920711500272 */, |
353 | MAD_F(0x16a09e66) /* 2^(+2/4) == 1.41421356237310 */, | 353 | MAD_F(0x16a09e66) /* 2^(+2/4) == 1.41421356237310 */, |
354 | MAD_F(0x1ae89f99) /* 2^(+3/4) == 1.68179283050743 */ | 354 | MAD_F(0x1ae89f99) /* 2^(+3/4) == 1.68179283050743 */ |
355 | }; | 355 | }; |
356 | 356 | ||
357 | /* | 357 | /* |
358 | * coefficients for aliasing reduction | 358 | * coefficients for aliasing reduction |
359 | * derived from Table B.9 of ISO/IEC 11172-3 | 359 | * derived from Table B.9 of ISO/IEC 11172-3 |
360 | * | 360 | * |
361 | * c[] = { -0.6, -0.535, -0.33, -0.185, -0.095, -0.041, -0.0142, -0.0037 } | 361 | * c[] = { -0.6, -0.535, -0.33, -0.185, -0.095, -0.041, -0.0142, -0.0037 } |
362 | * cs[i] = 1 / sqrt(1 + c[i]^2) | 362 | * cs[i] = 1 / sqrt(1 + c[i]^2) |
363 | * ca[i] = c[i] / sqrt(1 + c[i]^2) | 363 | * ca[i] = c[i] / sqrt(1 + c[i]^2) |
364 | */ | 364 | */ |
365 | static | 365 | static |
366 | mad_fixed_t const cs[8] = { | 366 | mad_fixed_t const cs[8] = { |
367 | +MAD_F(0x0db84a81) /* +0.857492926 */, +MAD_F(0x0e1b9d7f) /* +0.881741997 */, | 367 | +MAD_F(0x0db84a81) /* +0.857492926 */, +MAD_F(0x0e1b9d7f) /* +0.881741997 */, |
368 | +MAD_F(0x0f31adcf) /* +0.949628649 */, +MAD_F(0x0fbba815) /* +0.983314592 */, | 368 | +MAD_F(0x0f31adcf) /* +0.949628649 */, +MAD_F(0x0fbba815) /* +0.983314592 */, |
369 | +MAD_F(0x0feda417) /* +0.995517816 */, +MAD_F(0x0ffc8fc8) /* +0.999160558 */, | 369 | +MAD_F(0x0feda417) /* +0.995517816 */, +MAD_F(0x0ffc8fc8) /* +0.999160558 */, |
370 | +MAD_F(0x0fff964c) /* +0.999899195 */, +MAD_F(0x0ffff8d3) /* +0.999993155 */ | 370 | +MAD_F(0x0fff964c) /* +0.999899195 */, +MAD_F(0x0ffff8d3) /* +0.999993155 */ |
371 | }; | 371 | }; |
372 | 372 | ||
373 | static | 373 | static |
374 | mad_fixed_t const ca[8] = { | 374 | mad_fixed_t const ca[8] = { |
375 | -MAD_F(0x083b5fe7) /* -0.514495755 */, -MAD_F(0x078c36d2) /* -0.471731969 */, | 375 | -MAD_F(0x083b5fe7) /* -0.514495755 */, -MAD_F(0x078c36d2) /* -0.471731969 */, |
376 | -MAD_F(0x05039814) /* -0.313377454 */, -MAD_F(0x02e91dd1) /* -0.181913200 */, | 376 | -MAD_F(0x05039814) /* -0.313377454 */, -MAD_F(0x02e91dd1) /* -0.181913200 */, |
377 | -MAD_F(0x0183603a) /* -0.094574193 */, -MAD_F(0x00a7cb87) /* -0.040965583 */, | 377 | -MAD_F(0x0183603a) /* -0.094574193 */, -MAD_F(0x00a7cb87) /* -0.040965583 */, |
378 | -MAD_F(0x003a2847) /* -0.014198569 */, -MAD_F(0x000f27b4) /* -0.003699975 */ | 378 | -MAD_F(0x003a2847) /* -0.014198569 */, -MAD_F(0x000f27b4) /* -0.003699975 */ |
379 | }; | 379 | }; |
380 | 380 | ||
381 | /* | 381 | /* |
382 | * IMDCT coefficients for short blocks | 382 | * IMDCT coefficients for short blocks |
383 | * derived from section 2.4.3.4.10.2 of ISO/IEC 11172-3 | 383 | * derived from section 2.4.3.4.10.2 of ISO/IEC 11172-3 |
384 | * | 384 | * |
385 | * imdct_s[i/even][k] = cos((PI / 24) * (2 * (i / 2) + 7) * (2 * k + 1)) | 385 | * imdct_s[i/even][k] = cos((PI / 24) * (2 * (i / 2) + 7) * (2 * k + 1)) |
386 | * imdct_s[i /odd][k] = cos((PI / 24) * (2 * (6 + (i-1)/2) + 7) * (2 * k + 1)) | 386 | * imdct_s[i /odd][k] = cos((PI / 24) * (2 * (6 + (i-1)/2) + 7) * (2 * k + 1)) |
387 | */ | 387 | */ |
388 | static | 388 | static |
389 | mad_fixed_t const imdct_s[6][6] = { | 389 | mad_fixed_t const imdct_s[6][6] = { |
390 | # include "imdct_s.dat" | 390 | # include "imdct_s.dat" |
391 | }; | 391 | }; |
392 | 392 | ||
393 | # if !defined(ASO_IMDCT) | 393 | # if !defined(ASO_IMDCT) |
394 | /* | 394 | /* |
395 | * windowing coefficients for long blocks | 395 | * windowing coefficients for long blocks |
396 | * derived from section 2.4.3.4.10.3 of ISO/IEC 11172-3 | 396 | * derived from section 2.4.3.4.10.3 of ISO/IEC 11172-3 |
397 | * | 397 | * |
398 | * window_l[i] = sin((PI / 36) * (i + 1/2)) | 398 | * window_l[i] = sin((PI / 36) * (i + 1/2)) |
399 | */ | 399 | */ |
400 | static | 400 | static |
401 | mad_fixed_t const window_l[36] = { | 401 | mad_fixed_t const window_l[36] = { |
402 | MAD_F(0x00b2aa3e) /* 0.043619387 */, MAD_F(0x0216a2a2) /* 0.130526192 */, | 402 | MAD_F(0x00b2aa3e) /* 0.043619387 */, MAD_F(0x0216a2a2) /* 0.130526192 */, |
403 | MAD_F(0x03768962) /* 0.216439614 */, MAD_F(0x04cfb0e2) /* 0.300705800 */, | 403 | MAD_F(0x03768962) /* 0.216439614 */, MAD_F(0x04cfb0e2) /* 0.300705800 */, |
404 | MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x07635284) /* 0.461748613 */, | 404 | MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x07635284) /* 0.461748613 */, |
405 | MAD_F(0x0898c779) /* 0.537299608 */, MAD_F(0x09bd7ca0) /* 0.608761429 */, | 405 | MAD_F(0x0898c779) /* 0.537299608 */, MAD_F(0x09bd7ca0) /* 0.608761429 */, |
406 | MAD_F(0x0acf37ad) /* 0.675590208 */, MAD_F(0x0bcbe352) /* 0.737277337 */, | 406 | MAD_F(0x0acf37ad) /* 0.675590208 */, MAD_F(0x0bcbe352) /* 0.737277337 */, |
407 | MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x0d7e8807) /* 0.843391446 */, | 407 | MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x0d7e8807) /* 0.843391446 */, |
408 | 408 | ||
409 | MAD_F(0x0e313245) /* 0.887010833 */, MAD_F(0x0ec835e8) /* 0.923879533 */, | 409 | MAD_F(0x0e313245) /* 0.887010833 */, MAD_F(0x0ec835e8) /* 0.923879533 */, |
410 | MAD_F(0x0f426cb5) /* 0.953716951 */, MAD_F(0x0f9ee890) /* 0.976296007 */, | 410 | MAD_F(0x0f426cb5) /* 0.953716951 */, MAD_F(0x0f9ee890) /* 0.976296007 */, |
411 | MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ffc19fd) /* 0.999048222 */, | 411 | MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ffc19fd) /* 0.999048222 */, |
412 | MAD_F(0x0ffc19fd) /* 0.999048222 */, MAD_F(0x0fdcf549) /* 0.991444861 */, | 412 | MAD_F(0x0ffc19fd) /* 0.999048222 */, MAD_F(0x0fdcf549) /* 0.991444861 */, |
413 | MAD_F(0x0f9ee890) /* 0.976296007 */, MAD_F(0x0f426cb5) /* 0.953716951 */, | 413 | MAD_F(0x0f9ee890) /* 0.976296007 */, MAD_F(0x0f426cb5) /* 0.953716951 */, |
414 | MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0e313245) /* 0.887010833 */, | 414 | MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0e313245) /* 0.887010833 */, |
415 | 415 | ||
416 | MAD_F(0x0d7e8807) /* 0.843391446 */, MAD_F(0x0cb19346) /* 0.793353340 */, | 416 | MAD_F(0x0d7e8807) /* 0.843391446 */, MAD_F(0x0cb19346) /* 0.793353340 */, |
417 | MAD_F(0x0bcbe352) /* 0.737277337 */, MAD_F(0x0acf37ad) /* 0.675590208 */, | 417 | MAD_F(0x0bcbe352) /* 0.737277337 */, MAD_F(0x0acf37ad) /* 0.675590208 */, |
418 | MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0898c779) /* 0.537299608 */, | 418 | MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0898c779) /* 0.537299608 */, |
419 | MAD_F(0x07635284) /* 0.461748613 */, MAD_F(0x061f78aa) /* 0.382683432 */, | 419 | MAD_F(0x07635284) /* 0.461748613 */, MAD_F(0x061f78aa) /* 0.382683432 */, |
420 | MAD_F(0x04cfb0e2) /* 0.300705800 */, MAD_F(0x03768962) /* 0.216439614 */, | 420 | MAD_F(0x04cfb0e2) /* 0.300705800 */, MAD_F(0x03768962) /* 0.216439614 */, |
421 | MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x00b2aa3e) /* 0.043619387 */, | 421 | MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x00b2aa3e) /* 0.043619387 */, |
422 | }; | 422 | }; |
423 | # endif /* ASO_IMDCT */ | 423 | # endif /* ASO_IMDCT */ |
424 | 424 | ||
425 | /* | 425 | /* |
426 | * windowing coefficients for short blocks | 426 | * windowing coefficients for short blocks |
427 | * derived from section 2.4.3.4.10.3 of ISO/IEC 11172-3 | 427 | * derived from section 2.4.3.4.10.3 of ISO/IEC 11172-3 |
428 | * | 428 | * |
429 | * window_s[i] = sin((PI / 12) * (i + 1/2)) | 429 | * window_s[i] = sin((PI / 12) * (i + 1/2)) |
430 | */ | 430 | */ |
431 | static | 431 | static |
432 | mad_fixed_t const window_s[12] = { | 432 | mad_fixed_t const window_s[12] = { |
433 | MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x061f78aa) /* 0.382683432 */, | 433 | MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x061f78aa) /* 0.382683432 */, |
434 | MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0cb19346) /* 0.793353340 */, | 434 | MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0cb19346) /* 0.793353340 */, |
435 | MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0fdcf549) /* 0.991444861 */, | 435 | MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0fdcf549) /* 0.991444861 */, |
436 | MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ec835e8) /* 0.923879533 */, | 436 | MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ec835e8) /* 0.923879533 */, |
437 | MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x09bd7ca0) /* 0.608761429 */, | 437 | MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x09bd7ca0) /* 0.608761429 */, |
438 | MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x0216a2a2) /* 0.130526192 */, | 438 | MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x0216a2a2) /* 0.130526192 */, |
439 | }; | 439 | }; |
440 | 440 | ||
441 | /* | 441 | /* |
442 | * coefficients for intensity stereo processing | 442 | * coefficients for intensity stereo processing |
443 | * derived from section 2.4.3.4.9.3 of ISO/IEC 11172-3 | 443 | * derived from section 2.4.3.4.9.3 of ISO/IEC 11172-3 |
444 | * | 444 | * |
445 | * is_ratio[i] = tan(i * (PI / 12)) | 445 | * is_ratio[i] = tan(i * (PI / 12)) |
446 | * is_table[i] = is_ratio[i] / (1 + is_ratio[i]) | 446 | * is_table[i] = is_ratio[i] / (1 + is_ratio[i]) |
447 | */ | 447 | */ |
448 | static | 448 | static |
449 | mad_fixed_t const is_table[7] = { | 449 | mad_fixed_t const is_table[7] = { |
450 | MAD_F(0x00000000) /* 0.000000000 */, | 450 | MAD_F(0x00000000) /* 0.000000000 */, |
451 | MAD_F(0x0361962f) /* 0.211324865 */, | 451 | MAD_F(0x0361962f) /* 0.211324865 */, |
452 | MAD_F(0x05db3d74) /* 0.366025404 */, | 452 | MAD_F(0x05db3d74) /* 0.366025404 */, |
453 | MAD_F(0x08000000) /* 0.500000000 */, | 453 | MAD_F(0x08000000) /* 0.500000000 */, |
454 | MAD_F(0x0a24c28c) /* 0.633974596 */, | 454 | MAD_F(0x0a24c28c) /* 0.633974596 */, |
455 | MAD_F(0x0c9e69d1) /* 0.788675135 */, | 455 | MAD_F(0x0c9e69d1) /* 0.788675135 */, |
456 | MAD_F(0x10000000) /* 1.000000000 */ | 456 | MAD_F(0x10000000) /* 1.000000000 */ |
457 | }; | 457 | }; |
458 | 458 | ||
459 | /* | 459 | /* |
460 | * coefficients for LSF intensity stereo processing | 460 | * coefficients for LSF intensity stereo processing |
461 | * derived from section 2.4.3.2 of ISO/IEC 13818-3 | 461 | * derived from section 2.4.3.2 of ISO/IEC 13818-3 |
462 | * | 462 | * |
463 | * is_lsf_table[0][i] = (1 / sqrt(sqrt(2)))^(i + 1) | 463 | * is_lsf_table[0][i] = (1 / sqrt(sqrt(2)))^(i + 1) |
464 | * is_lsf_table[1][i] = (1 / sqrt(2))^(i + 1) | 464 | * is_lsf_table[1][i] = (1 / sqrt(2)) ^(i + 1) |
465 | */ | 465 | */ |
466 | static | 466 | static |
467 | mad_fixed_t const is_lsf_table[2][15] = { | 467 | mad_fixed_t const is_lsf_table[2][15] = { |
468 | { | 468 | { |
469 | MAD_F(0x0d744fcd) /* 0.840896415 */, | 469 | MAD_F(0x0d744fcd) /* 0.840896415 */, |
470 | MAD_F(0x0b504f33) /* 0.707106781 */, | 470 | MAD_F(0x0b504f33) /* 0.707106781 */, |
471 | MAD_F(0x09837f05) /* 0.594603558 */, | 471 | MAD_F(0x09837f05) /* 0.594603558 */, |
472 | MAD_F(0x08000000) /* 0.500000000 */, | 472 | MAD_F(0x08000000) /* 0.500000000 */, |
473 | MAD_F(0x06ba27e6) /* 0.420448208 */, | 473 | MAD_F(0x06ba27e6) /* 0.420448208 */, |
474 | MAD_F(0x05a8279a) /* 0.353553391 */, | 474 | MAD_F(0x05a8279a) /* 0.353553391 */, |
475 | MAD_F(0x04c1bf83) /* 0.297301779 */, | 475 | MAD_F(0x04c1bf83) /* 0.297301779 */, |
476 | MAD_F(0x04000000) /* 0.250000000 */, | 476 | MAD_F(0x04000000) /* 0.250000000 */, |
477 | MAD_F(0x035d13f3) /* 0.210224104 */, | 477 | MAD_F(0x035d13f3) /* 0.210224104 */, |
478 | MAD_F(0x02d413cd) /* 0.176776695 */, | 478 | MAD_F(0x02d413cd) /* 0.176776695 */, |
479 | MAD_F(0x0260dfc1) /* 0.148650889 */, | 479 | MAD_F(0x0260dfc1) /* 0.148650889 */, |
480 | MAD_F(0x02000000) /* 0.125000000 */, | 480 | MAD_F(0x02000000) /* 0.125000000 */, |
481 | MAD_F(0x01ae89fa) /* 0.105112052 */, | 481 | MAD_F(0x01ae89fa) /* 0.105112052 */, |
482 | MAD_F(0x016a09e6) /* 0.088388348 */, | 482 | MAD_F(0x016a09e6) /* 0.088388348 */, |
483 | MAD_F(0x01306fe1) /* 0.074325445 */ | 483 | MAD_F(0x01306fe1) /* 0.074325445 */ |
484 | }, { | 484 | }, { |
485 | MAD_F(0x0b504f33) /* 0.707106781 */, | 485 | MAD_F(0x0b504f33) /* 0.707106781 */, |
486 | MAD_F(0x08000000) /* 0.500000000 */, | 486 | MAD_F(0x08000000) /* 0.500000000 */, |
487 | MAD_F(0x05a8279a) /* 0.353553391 */, | 487 | MAD_F(0x05a8279a) /* 0.353553391 */, |
488 | MAD_F(0x04000000) /* 0.250000000 */, | 488 | MAD_F(0x04000000) /* 0.250000000 */, |
489 | MAD_F(0x02d413cd) /* 0.176776695 */, | 489 | MAD_F(0x02d413cd) /* 0.176776695 */, |
490 | MAD_F(0x02000000) /* 0.125000000 */, | 490 | MAD_F(0x02000000) /* 0.125000000 */, |
491 | MAD_F(0x016a09e6) /* 0.088388348 */, | 491 | MAD_F(0x016a09e6) /* 0.088388348 */, |
492 | MAD_F(0x01000000) /* 0.062500000 */, | 492 | MAD_F(0x01000000) /* 0.062500000 */, |
493 | MAD_F(0x00b504f3) /* 0.044194174 */, | 493 | MAD_F(0x00b504f3) /* 0.044194174 */, |
494 | MAD_F(0x00800000) /* 0.031250000 */, | 494 | MAD_F(0x00800000) /* 0.031250000 */, |
495 | MAD_F(0x005a827a) /* 0.022097087 */, | 495 | MAD_F(0x005a827a) /* 0.022097087 */, |
496 | MAD_F(0x00400000) /* 0.015625000 */, | 496 | MAD_F(0x00400000) /* 0.015625000 */, |
497 | MAD_F(0x002d413d) /* 0.011048543 */, | 497 | MAD_F(0x002d413d) /* 0.011048543 */, |
498 | MAD_F(0x00200000) /* 0.007812500 */, | 498 | MAD_F(0x00200000) /* 0.007812500 */, |
499 | MAD_F(0x0016a09e) /* 0.005524272 */ | 499 | MAD_F(0x0016a09e) /* 0.005524272 */ |
500 | } | 500 | } |
501 | }; | 501 | }; |
502 | 502 | ||
503 | /* | 503 | /* |
504 | * NAME:III_sideinfo() | 504 | * NAME:III_sideinfo() |
505 | * DESCRIPTION:decode frame side information from a bitstream | 505 | * DESCRIPTION:decode frame side information from a bitstream |
506 | */ | 506 | */ |
507 | static | 507 | static |
508 | enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch, | 508 | enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch, |
509 | int lsf, struct sideinfo *si, | 509 | int lsf, struct sideinfo *si, |
510 | unsigned int *data_bitlen, | 510 | unsigned int *data_bitlen, |
511 | unsigned int *priv_bitlen) | 511 | unsigned int *priv_bitlen) |
512 | { | 512 | { |
513 | unsigned int ngr, gr, ch, i; | 513 | unsigned int ngr, gr, ch, i; |
514 | enum mad_error result = MAD_ERROR_NONE; | 514 | enum mad_error result = MAD_ERROR_NONE; |
515 | 515 | ||
516 | *data_bitlen = 0; | 516 | *data_bitlen = 0; |
517 | *priv_bitlen = lsf ? ((nch == 1) ? 1 : 2) : ((nch == 1) ? 5 : 3); | 517 | *priv_bitlen = lsf ? ((nch == 1) ? 1 : 2) : ((nch == 1) ? 5 : 3); |
518 | 518 | ||
519 | si->main_data_begin = mad_bit_read(ptr, lsf ? 8 : 9); | 519 | si->main_data_begin = mad_bit_read(ptr, lsf ? 8 : 9); |
520 | si->private_bits = mad_bit_read(ptr, *priv_bitlen); | 520 | si->private_bits = mad_bit_read(ptr, *priv_bitlen); |
521 | 521 | ||
522 | ngr = 1; | 522 | ngr = 1; |
523 | if (!lsf) { | 523 | if (!lsf) { |
524 | ngr = 2; | 524 | ngr = 2; |
525 | 525 | ||
526 | for (ch = 0; ch < nch; ++ch) | 526 | for (ch = 0; ch < nch; ++ch) |
527 | si->scfsi[ch] = mad_bit_read(ptr, 4); | 527 | si->scfsi[ch] = mad_bit_read(ptr, 4); |
528 | } | 528 | } |
529 | 529 | ||
530 | for (gr = 0; gr < ngr; ++gr) { | 530 | for (gr = 0; gr < ngr; ++gr) { |
531 | struct granule *granule = &si->gr[gr]; | 531 | struct granule *granule = &si->gr[gr]; |
532 | 532 | ||
533 | for (ch = 0; ch < nch; ++ch) { | 533 | for (ch = 0; ch < nch; ++ch) { |
534 | struct channel *channel = &granule->ch[ch]; | 534 | struct channel *channel = &granule->ch[ch]; |
535 | 535 | ||
536 | channel->part2_3_length = mad_bit_read(ptr, 12); | 536 | channel->part2_3_length = mad_bit_read(ptr, 12); |
537 | channel->big_values = mad_bit_read(ptr, 9); | 537 | channel->big_values = mad_bit_read(ptr, 9); |
538 | channel->global_gain = mad_bit_read(ptr, 8); | 538 | channel->global_gain = mad_bit_read(ptr, 8); |
539 | channel->scalefac_compress = mad_bit_read(ptr, lsf ? 9 : 4); | 539 | channel->scalefac_compress = mad_bit_read(ptr, lsf ? 9 : 4); |
540 | 540 | ||
541 | *data_bitlen += channel->part2_3_length; | 541 | *data_bitlen += channel->part2_3_length; |
542 | 542 | ||
543 | if (channel->big_values > 288 && result == 0) | 543 | if (channel->big_values > 288 && result == 0) |
544 | result = MAD_ERROR_BADBIGVALUES; | 544 | result = MAD_ERROR_BADBIGVALUES; |
545 | 545 | ||
546 | channel->flags = 0; | 546 | channel->flags = 0; |
547 | 547 | ||
548 | /* window_switching_flag */ | 548 | /* window_switching_flag */ |
549 | if (mad_bit_read(ptr, 1)) { | 549 | if (mad_bit_read(ptr, 1)) { |
550 | channel->block_type = mad_bit_read(ptr, 2); | 550 | channel->block_type = mad_bit_read(ptr, 2); |
551 | 551 | ||
552 | if (channel->block_type == 0 && result == 0) | 552 | if (channel->block_type == 0 && result == 0) |
553 | result = MAD_ERROR_BADBLOCKTYPE; | 553 | result = MAD_ERROR_BADBLOCKTYPE; |
554 | 554 | ||
555 | if (!lsf && channel->block_type == 2 && si->scfsi[ch] && result == 0) | 555 | if (!lsf && channel->block_type == 2 && si->scfsi[ch] && result == 0) |
556 | result = MAD_ERROR_BADSCFSI; | 556 | result = MAD_ERROR_BADSCFSI; |
557 | 557 | ||
558 | channel->region0_count = 7; | 558 | channel->region0_count = 7; |
559 | channel->region1_count = 36; | 559 | channel->region1_count = 36; |
560 | 560 | ||
561 | if (mad_bit_read(ptr, 1)) | 561 | if (mad_bit_read(ptr, 1)) |
562 | channel->flags |= mixed_block_flag; | 562 | channel->flags |= mixed_block_flag; |
563 | else if (channel->block_type == 2) | 563 | else if (channel->block_type == 2) |
564 | channel->region0_count = 8; | 564 | channel->region0_count = 8; |
565 | 565 | ||
566 | for (i = 0; i < 2; ++i) | 566 | for (i = 0; i < 2; ++i) |
567 | channel->table_select[i] = mad_bit_read(ptr, 5); | 567 | channel->table_select[i] = mad_bit_read(ptr, 5); |
568 | 568 | ||
569 | # if defined(DEBUG) | 569 | # if defined(DEBUG) |
570 | channel->table_select[2] = 4; /* not used */ | 570 | channel->table_select[2] = 4; /* not used */ |
571 | # endif | 571 | # endif |
572 | 572 | ||
573 | for (i = 0; i < 3; ++i) | 573 | for (i = 0; i < 3; ++i) |
574 | channel->subblock_gain[i] = mad_bit_read(ptr, 3); | 574 | channel->subblock_gain[i] = mad_bit_read(ptr, 3); |
575 | } | 575 | } |
576 | else { | 576 | else { |
577 | channel->block_type = 0; | 577 | channel->block_type = 0; |
578 | 578 | ||
579 | for (i = 0; i < 3; ++i) | 579 | for (i = 0; i < 3; ++i) |
580 | channel->table_select[i] = mad_bit_read(ptr, 5); | 580 | channel->table_select[i] = mad_bit_read(ptr, 5); |
581 | 581 | ||
582 | channel->region0_count = mad_bit_read(ptr, 4); | 582 | channel->region0_count = mad_bit_read(ptr, 4); |
583 | channel->region1_count = mad_bit_read(ptr, 3); | 583 | channel->region1_count = mad_bit_read(ptr, 3); |
584 | } | 584 | } |
585 | 585 | ||
586 | /* [preflag,] scalefac_scale, count1table_select */ | 586 | /* [preflag,] scalefac_scale, count1table_select */ |
587 | channel->flags |= mad_bit_read(ptr, lsf ? 2 : 3); | 587 | channel->flags |= mad_bit_read(ptr, lsf ? 2 : 3); |
588 | } | 588 | } |
589 | } | 589 | } |
590 | 590 | ||
591 | return result; | 591 | return result; |
592 | } | 592 | } |
593 | 593 | ||
594 | /* | 594 | /* |
595 | * NAME:III_scalefactors_lsf() | 595 | * NAME:III_scalefactors_lsf() |
596 | * DESCRIPTION:decode channel scalefactors for LSF from a bitstream | 596 | * DESCRIPTION:decode channel scalefactors for LSF from a bitstream |
597 | */ | 597 | */ |
598 | static | 598 | static |
599 | unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr, | 599 | unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr, |
600 | struct channel *channel, | 600 | struct channel *channel, |
601 | struct channel *gr1ch, int mode_extension) | 601 | struct channel *gr1ch, int mode_extension) |
602 | { | 602 | { |
603 | struct mad_bitptr start; | 603 | struct mad_bitptr start; |
604 | unsigned int scalefac_compress, index, slen[4], part, n, i; | 604 | unsigned int scalefac_compress, index, slen[4], part, n, i; |
605 | unsigned char const *nsfb; | 605 | unsigned char const *nsfb; |
606 | 606 | ||
607 | start = *ptr; | 607 | start = *ptr; |
608 | 608 | ||
609 | scalefac_compress = channel->scalefac_compress; | 609 | scalefac_compress = channel->scalefac_compress; |
610 | index = (channel->block_type == 2) ? | 610 | index = (channel->block_type == 2) ? |
611 | ((channel->flags & mixed_block_flag) ? 2 : 1) : 0; | 611 | ((channel->flags & mixed_block_flag) ? 2 : 1) : 0; |
612 | 612 | ||
613 | if (!((mode_extension & I_STEREO) && gr1ch)) { | 613 | if (!((mode_extension & I_STEREO) && gr1ch)) { |
614 | if (scalefac_compress < 400) { | 614 | if (scalefac_compress < 400) { |
615 | slen[0] = (scalefac_compress >> 4) / 5; | 615 | slen[0] = (scalefac_compress >> 4) / 5; |
616 | slen[1] = (scalefac_compress >> 4) % 5; | 616 | slen[1] = (scalefac_compress >> 4) % 5; |
617 | slen[2] = (scalefac_compress % 16) >> 2; | 617 | slen[2] = (scalefac_compress % 16) >> 2; |
618 | slen[3] = scalefac_compress % 4; | 618 | slen[3] = scalefac_compress % 4; |
619 | 619 | ||
620 | nsfb = nsfb_table[0][index]; | 620 | nsfb = nsfb_table[0][index]; |
621 | } | 621 | } |
622 | else if (scalefac_compress < 500) { | 622 | else if (scalefac_compress < 500) { |
623 | scalefac_compress -= 400; | 623 | scalefac_compress -= 400; |
624 | 624 | ||
625 | slen[0] = (scalefac_compress >> 2) / 5; | 625 | slen[0] = (scalefac_compress >> 2) / 5; |
626 | slen[1] = (scalefac_compress >> 2) % 5; | 626 | slen[1] = (scalefac_compress >> 2) % 5; |
627 | slen[2] = scalefac_compress % 4; | 627 | slen[2] = scalefac_compress % 4; |
628 | slen[3] = 0; | 628 | slen[3] = 0; |
629 | 629 | ||
630 | nsfb = nsfb_table[1][index]; | 630 | nsfb = nsfb_table[1][index]; |
631 | } | 631 | } |
632 | else { | 632 | else { |
633 | scalefac_compress -= 500; | 633 | scalefac_compress -= 500; |
634 | 634 | ||
635 | slen[0] = scalefac_compress / 3; | 635 | slen[0] = scalefac_compress / 3; |
636 | slen[1] = scalefac_compress % 3; | 636 | slen[1] = scalefac_compress % 3; |
637 | slen[2] = 0; | 637 | slen[2] = 0; |
638 | slen[3] = 0; | 638 | slen[3] = 0; |
639 | 639 | ||
640 | channel->flags |= preflag; | 640 | channel->flags |= preflag; |
641 | 641 | ||
642 | nsfb = nsfb_table[2][index]; | 642 | nsfb = nsfb_table[2][index]; |
643 | } | 643 | } |
644 | 644 | ||
645 | n = 0; | 645 | n = 0; |
646 | for (part = 0; part < 4; ++part) { | 646 | for (part = 0; part < 4; ++part) { |
647 | for (i = 0; i < nsfb[part]; ++i) | 647 | for (i = 0; i < nsfb[part]; ++i) |
648 | channel->scalefac[n++] = mad_bit_read(ptr, slen[part]); | 648 | channel->scalefac[n++] = mad_bit_read(ptr, slen[part]); |
649 | } | 649 | } |
650 | 650 | ||
651 | while (n < 39) | 651 | while (n < 39) |
652 | channel->scalefac[n++] = 0; | 652 | channel->scalefac[n++] = 0; |
653 | } | 653 | } |
654 | else { /* (mode_extension & I_STEREO) && gr1ch (i.e. ch == 1) */ | 654 | else { /* (mode_extension & I_STEREO) && gr1ch (i.e. ch == 1) */ |
655 | scalefac_compress >>= 1; | 655 | scalefac_compress >>= 1; |
656 | 656 | ||
657 | if (scalefac_compress < 180) { | 657 | if (scalefac_compress < 180) { |
658 | slen[0] = scalefac_compress / 36; | 658 | slen[0] = scalefac_compress / 36; |
659 | slen[1] = (scalefac_compress % 36) / 6; | 659 | slen[1] = (scalefac_compress % 36) / 6; |
660 | slen[2] = (scalefac_compress % 36) % 6; | 660 | slen[2] = (scalefac_compress % 36) % 6; |
661 | slen[3] = 0; | 661 | slen[3] = 0; |
662 | 662 | ||
663 | nsfb = nsfb_table[3][index]; | 663 | nsfb = nsfb_table[3][index]; |
664 | } | 664 | } |
665 | else if (scalefac_compress < 244) { | 665 | else if (scalefac_compress < 244) { |
666 | scalefac_compress -= 180; | 666 | scalefac_compress -= 180; |
667 | 667 | ||
668 | slen[0] = (scalefac_compress % 64) >> 4; | 668 | slen[0] = (scalefac_compress % 64) >> 4; |
669 | slen[1] = (scalefac_compress % 16) >> 2; | 669 | slen[1] = (scalefac_compress % 16) >> 2; |
670 | slen[2] = scalefac_compress % 4; | 670 | slen[2] = scalefac_compress % 4; |
671 | slen[3] = 0; | 671 | slen[3] = 0; |
672 | 672 | ||
673 | nsfb = nsfb_table[4][index]; | 673 | nsfb = nsfb_table[4][index]; |
674 | } | 674 | } |
675 | else { | 675 | else { |
676 | scalefac_compress -= 244; | 676 | scalefac_compress -= 244; |
677 | 677 | ||
678 | slen[0] = scalefac_compress / 3; | 678 | slen[0] = scalefac_compress / 3; |
679 | slen[1] = scalefac_compress % 3; | 679 | slen[1] = scalefac_compress % 3; |
680 | slen[2] = 0; | 680 | slen[2] = 0; |
681 | slen[3] = 0; | 681 | slen[3] = 0; |
682 | 682 | ||
683 | nsfb = nsfb_table[5][index]; | 683 | nsfb = nsfb_table[5][index]; |
684 | } | 684 | } |
685 | 685 | ||
686 | n = 0; | 686 | n = 0; |
687 | for (part = 0; part < 4; ++part) { | 687 | for (part = 0; part < 4; ++part) { |
688 | unsigned int max, is_pos; | 688 | unsigned int max, is_pos; |
689 | 689 | ||
690 | max = (1 << slen[part]) - 1; | 690 | max = (1 << slen[part]) - 1; |
691 | 691 | ||
692 | for (i = 0; i < nsfb[part]; ++i) { | 692 | for (i = 0; i < nsfb[part]; ++i) { |
693 | is_pos = mad_bit_read(ptr, slen[part]); | 693 | is_pos = mad_bit_read(ptr, slen[part]); |
694 | 694 | ||
695 | channel->scalefac[n] = is_pos; | 695 | channel->scalefac[n] = is_pos; |
696 | gr1ch->scalefac[n++] = (is_pos == max); | 696 | gr1ch->scalefac[n++] = (is_pos == max); |
697 | } | 697 | } |
698 | } | 698 | } |
699 | 699 | ||
700 | while (n < 39) { | 700 | while (n < 39) { |
701 | channel->scalefac[n] = 0; | 701 | channel->scalefac[n] = 0; |
702 | gr1ch->scalefac[n++] = 0; /* apparently not illegal */ | 702 | gr1ch->scalefac[n++] = 0; /* apparently not illegal */ |
703 | } | 703 | } |
704 | } | 704 | } |
705 | 705 | ||
706 | return mad_bit_length(&start, ptr); | 706 | return mad_bit_length(&start, ptr); |
707 | } | 707 | } |
708 | 708 | ||
709 | /* | 709 | /* |
710 | * NAME:III_scalefactors() | 710 | * NAME:III_scalefactors() |
711 | * DESCRIPTION:decode channel scalefactors of one granule from a bitstream | 711 | * DESCRIPTION:decode channel scalefactors of one granule from a bitstream |
712 | */ | 712 | */ |
713 | static | 713 | static |
714 | unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel, | 714 | unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel, |
715 | struct channel const *gr0ch, unsigned int scfsi) | 715 | struct channel const *gr0ch, unsigned int scfsi) |
716 | { | 716 | { |
717 | struct mad_bitptr start; | 717 | struct mad_bitptr start; |
718 | unsigned int slen1, slen2, sfbi; | 718 | unsigned int slen1, slen2, sfbi; |
719 | 719 | ||
720 | start = *ptr; | 720 | start = *ptr; |
721 | 721 | ||
722 | slen1 = sflen_table[channel->scalefac_compress].slen1; | 722 | slen1 = sflen_table[channel->scalefac_compress].slen1; |
723 | slen2 = sflen_table[channel->scalefac_compress].slen2; | 723 | slen2 = sflen_table[channel->scalefac_compress].slen2; |
724 | 724 | ||
725 | if (channel->block_type == 2) { | 725 | if (channel->block_type == 2) { |
726 | unsigned int nsfb; | 726 | unsigned int nsfb; |
727 | 727 | ||
728 | sfbi = 0; | 728 | sfbi = 0; |
729 | 729 | ||
730 | nsfb = (channel->flags & mixed_block_flag) ? 8 + 3 * 3 : 6 * 3; | 730 | nsfb = (channel->flags & mixed_block_flag) ? 8 + 3 * 3 : 6 * 3; |
731 | while (nsfb--) | 731 | while (nsfb--) |
732 | channel->scalefac[sfbi++] = mad_bit_read(ptr, slen1); | 732 | channel->scalefac[sfbi++] = mad_bit_read(ptr, slen1); |
733 | 733 | ||
734 | nsfb = 6 * 3; | 734 | nsfb = 6 * 3; |
735 | while (nsfb--) | 735 | while (nsfb--) |
736 | channel->scalefac[sfbi++] = mad_bit_read(ptr, slen2); | 736 | channel->scalefac[sfbi++] = mad_bit_read(ptr, slen2); |
737 | 737 | ||
738 | nsfb = 1 * 3; | 738 | nsfb = 1 * 3; |
739 | while (nsfb--) | 739 | while (nsfb--) |
740 | channel->scalefac[sfbi++] = 0; | 740 | channel->scalefac[sfbi++] = 0; |
741 | } | 741 | } |
742 | else { /* channel->block_type != 2 */ | 742 | else { /* channel->block_type != 2 */ |
743 | if (scfsi & 0x8) { | 743 | if (scfsi & 0x8) { |
744 | for (sfbi = 0; sfbi < 6; ++sfbi) | 744 | for (sfbi = 0; sfbi < 6; ++sfbi) |
745 | channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; | 745 | channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; |
746 | } | 746 | } |
747 | else { | 747 | else { |
748 | for (sfbi = 0; sfbi < 6; ++sfbi) | 748 | for (sfbi = 0; sfbi < 6; ++sfbi) |
749 | channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); | 749 | channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); |
750 | } | 750 | } |
751 | 751 | ||
752 | if (scfsi & 0x4) { | 752 | if (scfsi & 0x4) { |
753 | for (sfbi = 6; sfbi < 11; ++sfbi) | 753 | for (sfbi = 6; sfbi < 11; ++sfbi) |
754 | channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; | 754 | channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; |
755 | } | 755 | } |
756 | else { | 756 | else { |
757 | for (sfbi = 6; sfbi < 11; ++sfbi) | 757 | for (sfbi = 6; sfbi < 11; ++sfbi) |
758 | channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); | 758 | channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); |
759 | } | 759 | } |
760 | 760 | ||
761 | if (scfsi & 0x2) { | 761 | if (scfsi & 0x2) { |
762 | for (sfbi = 11; sfbi < 16; ++sfbi) | 762 | for (sfbi = 11; sfbi < 16; ++sfbi) |
763 | channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; | 763 | channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; |
764 | } | 764 | } |
765 | else { | 765 | else { |
766 | for (sfbi = 11; sfbi < 16; ++sfbi) | 766 | for (sfbi = 11; sfbi < 16; ++sfbi) |
767 | channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); | 767 | channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); |
768 | } | 768 | } |
769 | 769 | ||
770 | if (scfsi & 0x1) { | 770 | if (scfsi & 0x1) { |
771 | for (sfbi = 16; sfbi < 21; ++sfbi) | 771 | for (sfbi = 16; sfbi < 21; ++sfbi) |
772 | channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; | 772 | channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; |
773 | } | 773 | } |
774 | else { | 774 | else { |
775 | for (sfbi = 16; sfbi < 21; ++sfbi) | 775 | for (sfbi = 16; sfbi < 21; ++sfbi) |
776 | channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); | 776 | channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); |
777 | } | 777 | } |
778 | 778 | ||
779 | channel->scalefac[21] = 0; | 779 | channel->scalefac[21] = 0; |
780 | } | 780 | } |
781 | 781 | ||
782 | return mad_bit_length(&start, ptr); | 782 | return mad_bit_length(&start, ptr); |
783 | } | 783 | } |
784 | 784 | ||
785 | /* | 785 | /* |
786 | * The Layer III formula for requantization and scaling is defined by | 786 | * The Layer III formula for requantization and scaling is defined by |
787 | * section 2.4.3.4.7.1 of ISO/IEC 11172-3, as follows: | 787 | * section 2.4.3.4.7.1 of ISO/IEC 11172-3, as follows: |
788 | * | 788 | * |
789 | * long blocks: | 789 | * long blocks: |
790 | * xr[i] = sign(is[i]) * abs(is[i])^(4/3) * | 790 | * xr[i] = sign(is[i]) * abs(is[i])^(4/3) * |
791 | * 2^((1/4) * (global_gain - 210)) * | 791 | * 2^((1/4) * (global_gain - 210)) * |
792 | * 2^-(scalefac_multiplier * | 792 | * 2^-(scalefac_multiplier * |
793 | * (scalefac_l[sfb] + preflag * pretab[sfb])) | 793 | * (scalefac_l[sfb] + preflag * pretab[sfb])) |
794 | * | 794 | * |
795 | * short blocks: | 795 | * short blocks: |
796 | * xr[i] = sign(is[i]) * abs(is[i])^(4/3) * | 796 | * xr[i] = sign(is[i]) * abs(is[i])^(4/3) * |
797 | * 2^((1/4) * (global_gain - 210 - 8 * subblock_gain[w])) * | 797 | * 2^((1/4) * (global_gain - 210 - 8 * subblock_gain[w])) * |
798 | * 2^-(scalefac_multiplier * scalefac_s[sfb][w]) | 798 | * 2^-(scalefac_multiplier * scalefac_s[sfb][w]) |
799 | * | 799 | * |
800 | * where: | 800 | * where: |
801 | * scalefac_multiplier = (scalefac_scale + 1) / 2 | 801 | * scalefac_multiplier = (scalefac_scale + 1) / 2 |
802 | * | 802 | * |
803 | * The routines III_exponents() and III_requantize() facilitate this | 803 | * The routines III_exponents() and III_requantize() facilitate this |
804 | * calculation. | 804 | * calculation. |
805 | */ | 805 | */ |
806 | 806 | ||
807 | /* | 807 | /* |
808 | * NAME:III_exponents() | 808 | * NAME:III_exponents() |
809 | * DESCRIPTION:calculate scalefactor exponents | 809 | * DESCRIPTION:calculate scalefactor exponents |
810 | */ | 810 | */ |
811 | static | 811 | static |
812 | void III_exponents(struct channel const *channel, | 812 | void III_exponents(struct channel const *channel, |
813 | unsigned char const *sfbwidth, signed int exponents[39]) | 813 | unsigned char const *sfbwidth, signed int exponents[39]) |
814 | { | 814 | { |
815 | signed int gain; | 815 | signed int gain; |
816 | unsigned int scalefac_multiplier, sfbi; | 816 | unsigned int scalefac_multiplier, sfbi; |
817 | 817 | ||
818 | gain = (signed int) channel->global_gain - 210; | 818 | gain = (signed int) channel->global_gain - 210; |
819 | scalefac_multiplier = (channel->flags & scalefac_scale) ? 2 : 1; | 819 | scalefac_multiplier = (channel->flags & scalefac_scale) ? 2 : 1; |
820 | 820 | ||
821 | if (channel->block_type == 2) { | 821 | if (channel->block_type == 2) { |
822 | unsigned int l; | 822 | unsigned int l; |
823 | signed int gain0, gain1, gain2; | 823 | signed int gain0, gain1, gain2; |
824 | 824 | ||
825 | sfbi = l = 0; | 825 | sfbi = l = 0; |
826 | 826 | ||
827 | if (channel->flags & mixed_block_flag) { | 827 | if (channel->flags & mixed_block_flag) { |
828 | unsigned int premask; | 828 | unsigned int premask; |
829 | 829 | ||
830 | premask = (channel->flags & preflag) ? ~0 : 0; | 830 | premask = (channel->flags & preflag) ? ~0 : 0; |
831 | 831 | ||
832 | /* long block subbands 0-1 */ | 832 | /* long block subbands 0-1 */ |
833 | 833 | ||
834 | while (l < 36) { | 834 | while (l < 36) { |
835 | exponents[sfbi] = gain - | 835 | exponents[sfbi] = gain - |
836 | (signed int) ((channel->scalefac[sfbi] + (pretab[sfbi] & premask)) << | 836 | (signed int) ((channel->scalefac[sfbi] + (pretab[sfbi] & premask)) << |
837 | scalefac_multiplier); | 837 | scalefac_multiplier); |
838 | 838 | ||
839 | l += sfbwidth[sfbi++]; | 839 | l += sfbwidth[sfbi++]; |
840 | } | 840 | } |
841 | } | 841 | } |
842 | 842 | ||
843 | /* this is probably wrong for 8000 Hz short/mixed blocks */ | 843 | /* this is probably wrong for 8000 Hz short/mixed blocks */ |
844 | 844 | ||
845 | gain0 = gain - 8 * (signed int) channel->subblock_gain[0]; | 845 | gain0 = gain - 8 * (signed int) channel->subblock_gain[0]; |
846 | gain1 = gain - 8 * (signed int) channel->subblock_gain[1]; | 846 | gain1 = gain - 8 * (signed int) channel->subblock_gain[1]; |
847 | gain2 = gain - 8 * (signed int) channel->subblock_gain[2]; | 847 | gain2 = gain - 8 * (signed int) channel->subblock_gain[2]; |
848 | 848 | ||
849 | while (l < 576) { | 849 | while (l < 576) { |
850 | exponents[sfbi + 0] = gain0 - | 850 | exponents[sfbi + 0] = gain0 - |
851 | (signed int) (channel->scalefac[sfbi + 0] << scalefac_multiplier); | 851 | (signed int) (channel->scalefac[sfbi + 0] << scalefac_multiplier); |
852 | exponents[sfbi + 1] = gain1 - | 852 | exponents[sfbi + 1] = gain1 - |
853 | (signed int) (channel->scalefac[sfbi + 1] << scalefac_multiplier); | 853 | (signed int) (channel->scalefac[sfbi + 1] << scalefac_multiplier); |
854 | exponents[sfbi + 2] = gain2 - | 854 | exponents[sfbi + 2] = gain2 - |
855 | (signed int) (channel->scalefac[sfbi + 2] << scalefac_multiplier); | 855 | (signed int) (channel->scalefac[sfbi + 2] << scalefac_multiplier); |
856 | 856 | ||
857 | l += 3 * sfbwidth[sfbi]; | 857 | l += 3 * sfbwidth[sfbi]; |
858 | sfbi += 3; | 858 | sfbi += 3; |
859 | } | 859 | } |
860 | } | 860 | } |
861 | else { /* channel->block_type != 2 */ | 861 | else { /* channel->block_type != 2 */ |
862 | if (channel->flags & preflag) { | 862 | if (channel->flags & preflag) { |
863 | for (sfbi = 0; sfbi < 22; ++sfbi) { | 863 | for (sfbi = 0; sfbi < 22; ++sfbi) { |
864 | exponents[sfbi] = gain - | 864 | exponents[sfbi] = gain - |
865 | (signed int) ((channel->scalefac[sfbi] + pretab[sfbi]) << | 865 | (signed int) ((channel->scalefac[sfbi] + pretab[sfbi]) << |
866 | scalefac_multiplier); | 866 | scalefac_multiplier); |
867 | } | 867 | } |
868 | } | 868 | } |
869 | else { | 869 | else { |
870 | for (sfbi = 0; sfbi < 22; ++sfbi) { | 870 | for (sfbi = 0; sfbi < 22; ++sfbi) { |
871 | exponents[sfbi] = gain - | 871 | exponents[sfbi] = gain - |
872 | (signed int) (channel->scalefac[sfbi] << scalefac_multiplier); | 872 | (signed int) (channel->scalefac[sfbi] << scalefac_multiplier); |
873 | } | 873 | } |
874 | } | 874 | } |
875 | } | 875 | } |
876 | } | 876 | } |
877 | 877 | ||
878 | /* | 878 | /* |
879 | * NAME:III_requantize() | 879 | * NAME:III_requantize() |
880 | * DESCRIPTION:requantize one (positive) value | 880 | * DESCRIPTION:requantize one (positive) value |
881 | */ | 881 | */ |
882 | static | 882 | static |
883 | mad_fixed_t III_requantize(unsigned int value, signed int exp) | 883 | mad_fixed_t III_requantize(unsigned int value, signed int exp) |
884 | { | 884 | { |
885 | mad_fixed_t requantized; | 885 | mad_fixed_t requantized; |
886 | signed int frac; | 886 | signed int frac; |
887 | struct fixedfloat const *power; | 887 | struct fixedfloat const *power; |
888 | 888 | ||
889 | frac = exp % 4; /* assumes sign(frac) == sign(exp) */ | 889 | frac = exp % 4; /* assumes sign(frac) == sign(exp) */ |
890 | exp /= 4; | 890 | exp /= 4; |
891 | 891 | ||
892 | power = &rq_table[value]; | 892 | power = &rq_table[value]; |
893 | requantized = power->mantissa; | 893 | requantized = power->mantissa; |
894 | exp += power->exponent; | 894 | exp += power->exponent; |
895 | 895 | ||
896 | if (exp < 0) { | 896 | if (exp < 0) { |
897 | if (-exp >= sizeof(mad_fixed_t) * CHAR_BIT) { | 897 | if (-exp >= sizeof(mad_fixed_t) * CHAR_BIT) { |
898 | /* underflow */ | 898 | /* underflow */ |
899 | requantized = 0; | 899 | requantized = 0; |
900 | } | 900 | } |
901 | else { | 901 | else { |
902 | requantized += 1L << (-exp - 1); | 902 | requantized += 1L << (-exp - 1); |
903 | requantized >>= -exp; | 903 | requantized >>= -exp; |
904 | } | 904 | } |
905 | } | 905 | } |
906 | else { | 906 | else { |
907 | if (exp >= 5) { | 907 | if (exp >= 5) { |
908 | /* overflow */ | 908 | /* overflow */ |
909 | # if defined(DEBUG) | 909 | # if defined(DEBUG) |
910 | fprintf(stderr, "requantize overflow (%f * 2^%d)\n", | 910 | fprintf(stderr, "requantize overflow (%f * 2^%d)\n", |
911 | mad_f_todouble(requantized), exp); | 911 | mad_f_todouble(requantized), exp); |
912 | # endif | 912 | # endif |
913 | requantized = MAD_F_MAX; | 913 | requantized = MAD_F_MAX; |
914 | } | 914 | } |
915 | else | 915 | else |
916 | requantized <<= exp; | 916 | requantized <<= exp; |
917 | } | 917 | } |
918 | 918 | ||
919 | return frac ? mad_f_mul(requantized, root_table[3 + frac]) : requantized; | 919 | return frac ? mad_f_mul(requantized, root_table[3 + frac]) : requantized; |
920 | } | 920 | } |
921 | 921 | ||
922 | /* we must take care that sz >= bits and sz < sizeof(long) lest bits == 0 */ | 922 | /* we must take care that sz >= bits and sz < sizeof(long) lest bits == 0 */ |
923 | # define MASK(cache, sz, bits)\ | 923 | # define MASK(cache, sz, bits)\ |
924 | (((cache) >> ((sz) - (bits))) & ((1 << (bits)) - 1)) | 924 | (((cache) >> ((sz) - (bits))) & ((1 << (bits)) - 1)) |
925 | # define MASK1BIT(cache, sz) \ | 925 | # define MASK1BIT(cache, sz) \ |
926 | ((cache) & (1 << ((sz) - 1))) | 926 | ((cache) & (1 << ((sz) - 1))) |
927 | 927 | ||
928 | /* | 928 | /* |
929 | * NAME:III_huffdecode() | 929 | * NAME:III_huffdecode() |
930 | * DESCRIPTION:decode Huffman code words of one channel of one granule | 930 | * DESCRIPTION:decode Huffman code words of one channel of one granule |
931 | */ | 931 | */ |
932 | static | 932 | static |
933 | enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xr[576], | 933 | enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xr[576], |
934 | struct channel *channel, | 934 | struct channel *channel, |
935 | unsigned char const *sfbwidth, | 935 | unsigned char const *sfbwidth, |
936 | unsigned int part2_length) | 936 | unsigned int part2_length) |
937 | { | 937 | { |
938 | signed int exponents[39], exp; | 938 | signed int exponents[39], exp; |
939 | signed int const *expptr; | 939 | signed int const *expptr; |
940 | struct mad_bitptr peek; | 940 | struct mad_bitptr peek; |
941 | signed int bits_left, cachesz; | 941 | signed int bits_left, cachesz; |
942 | register mad_fixed_t *xrptr; | 942 | register mad_fixed_t *xrptr; |
943 | mad_fixed_t const *sfbound; | 943 | mad_fixed_t const *sfbound; |
944 | register unsigned long bitcache; | 944 | register unsigned long bitcache; |
945 | 945 | ||
946 | bits_left = (signed) channel->part2_3_length - (signed) part2_length; | 946 | bits_left = (signed) channel->part2_3_length - (signed) part2_length; |
947 | if (bits_left < 0) | 947 | if (bits_left < 0) |
948 | return MAD_ERROR_BADPART3LEN; | 948 | return MAD_ERROR_BADPART3LEN; |
949 | 949 | ||
950 | III_exponents(channel, sfbwidth, exponents); | 950 | III_exponents(channel, sfbwidth, exponents); |
951 | 951 | ||
952 | peek = *ptr; | 952 | peek = *ptr; |
953 | mad_bit_skip(ptr, bits_left); | 953 | mad_bit_skip(ptr, bits_left); |
954 | 954 | ||
955 | /* align bit reads to byte boundaries */ | 955 | /* align bit reads to byte boundaries */ |
956 | cachesz = mad_bit_bitsleft(&peek); | 956 | cachesz = mad_bit_bitsleft(&peek); |
957 | cachesz += ((32 - 1 - 24) + (24 - cachesz)) & ~7; | 957 | cachesz += ((32 - 1 - 24) + (24 - cachesz)) & ~7; |
958 | 958 | ||
959 | bitcache = mad_bit_read(&peek, cachesz); | 959 | bitcache = mad_bit_read(&peek, cachesz); |
960 | bits_left -= cachesz; | 960 | bits_left -= cachesz; |
961 | 961 | ||
962 | xrptr = &xr[0]; | 962 | xrptr = &xr[0]; |
963 | 963 | ||
964 | /* big_values */ | 964 | /* big_values */ |
965 | { | 965 | { |
966 | unsigned int region, rcount; | 966 | unsigned int region, rcount; |
967 | struct hufftable const *entry; | 967 | struct hufftable const *entry; |
968 | union huffpair const *table; | 968 | union huffpair const *table; |
969 | unsigned int linbits, startbits, big_values, reqhits; | 969 | unsigned int linbits, startbits, big_values, reqhits; |
970 | mad_fixed_t reqcache[16]; | 970 | mad_fixed_t reqcache[16]; |
971 | 971 | ||
972 | sfbound = xrptr + *sfbwidth++; | 972 | sfbound = xrptr + *sfbwidth++; |
973 | rcount = channel->region0_count + 1; | 973 | rcount = channel->region0_count + 1; |
974 | 974 | ||
975 | entry = &mad_huff_pair_table[channel->table_select[region = 0]]; | 975 | entry = &mad_huff_pair_table[channel->table_select[region = 0]]; |
976 | table = entry->table; | 976 | table = entry->table; |
977 | linbits = entry->linbits; | 977 | linbits = entry->linbits; |
978 | startbits = entry->startbits; | 978 | startbits = entry->startbits; |
979 | 979 | ||
980 | if (table == 0) | 980 | if (table == 0) |
981 | return MAD_ERROR_BADHUFFTABLE; | 981 | return MAD_ERROR_BADHUFFTABLE; |
982 | 982 | ||
983 | expptr = &exponents[0]; | 983 | expptr = &exponents[0]; |
984 | exp = *expptr++; | 984 | exp = *expptr++; |
985 | reqhits = 0; | 985 | reqhits = 0; |
986 | 986 | ||
987 | big_values = channel->big_values; | 987 | big_values = channel->big_values; |
988 | 988 | ||
989 | while (big_values-- && cachesz + bits_left > 0) { | 989 | while (big_values-- && cachesz + bits_left > 0) { |
990 | union huffpair const *pair; | 990 | union huffpair const *pair; |
991 | unsigned int clumpsz, value; | 991 | unsigned int clumpsz, value; |
992 | register mad_fixed_t requantized; | 992 | register mad_fixed_t requantized; |
993 | 993 | ||
994 | if (xrptr == sfbound) { | 994 | if (xrptr == sfbound) { |
995 | sfbound += *sfbwidth++; | 995 | sfbound += *sfbwidth++; |
996 | 996 | ||
997 | /* change table if region boundary */ | 997 | /* change table if region boundary */ |
998 | 998 | ||
999 | if (--rcount == 0) { | 999 | if (--rcount == 0) { |
1000 | if (region == 0) | 1000 | if (region == 0) |
1001 | rcount = channel->region1_count + 1; | 1001 | rcount = channel->region1_count + 1; |
1002 | else | 1002 | else |
1003 | rcount = 0; /* all remaining */ | 1003 | rcount = 0; /* all remaining */ |
1004 | 1004 | ||
1005 | entry = &mad_huff_pair_table[channel->table_select[++region]]; | 1005 | entry = &mad_huff_pair_table[channel->table_select[++region]]; |
1006 | table = entry->table; | 1006 | table = entry->table; |
1007 | linbits = entry->linbits; | 1007 | linbits = entry->linbits; |
1008 | startbits = entry->startbits; | 1008 | startbits = entry->startbits; |
1009 | 1009 | ||
1010 | if (table == 0) | 1010 | if (table == 0) |
1011 | return MAD_ERROR_BADHUFFTABLE; | 1011 | return MAD_ERROR_BADHUFFTABLE; |
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | if (exp != *expptr) { | 1014 | if (exp != *expptr) { |
1015 | exp = *expptr; | 1015 | exp = *expptr; |
1016 | reqhits = 0; | 1016 | reqhits = 0; |
1017 | } | 1017 | } |
1018 | 1018 | ||
1019 | ++expptr; | 1019 | ++expptr; |
1020 | } | 1020 | } |
1021 | 1021 | ||
1022 | if (cachesz < 21) { | 1022 | if (cachesz < 21) { |
1023 | unsigned int bits; | 1023 | unsigned int bits; |
1024 | 1024 | ||
1025 | bits = ((32 - 1 - 21) + (21 - cachesz)) & ~7; | 1025 | bits = ((32 - 1 - 21) + (21 - cachesz)) & ~7; |
1026 | bitcache = (bitcache << bits) | mad_bit_read(&peek, bits); | 1026 | bitcache = (bitcache << bits) | mad_bit_read(&peek, bits); |
1027 | cachesz += bits; | 1027 | cachesz += bits; |
1028 | bits_left -= bits; | 1028 | bits_left -= bits; |
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | /* hcod (0..19) */ | 1031 | /* hcod (0..19) */ |
1032 | 1032 | ||
1033 | clumpsz = startbits; | 1033 | clumpsz = startbits; |
1034 | pair = &table[MASK(bitcache, cachesz, clumpsz)]; | 1034 | pair = &table[MASK(bitcache, cachesz, clumpsz)]; |
1035 | 1035 | ||
1036 | while (!pair->final) { | 1036 | while (!pair->final) { |
1037 | cachesz -= clumpsz; | 1037 | cachesz -= clumpsz; |
1038 | 1038 | ||
1039 | clumpsz = pair->ptr.bits; | 1039 | clumpsz = pair->ptr.bits; |
1040 | pair = &table[pair->ptr.offset + MASK(bitcache, cachesz, clumpsz)]; | 1040 | pair = &table[pair->ptr.offset + MASK(bitcache, cachesz, clumpsz)]; |
1041 | } | 1041 | } |
1042 | 1042 | ||
1043 | cachesz -= pair->value.hlen; | 1043 | cachesz -= pair->value.hlen; |
1044 | 1044 | ||
1045 | if (linbits) { | 1045 | if (linbits) { |
1046 | /* x (0..14) */ | 1046 | /* x (0..14) */ |
1047 | 1047 | ||
1048 | value = pair->value.x; | 1048 | value = pair->value.x; |
1049 | 1049 | ||
1050 | switch (value) { | 1050 | switch (value) { |
1051 | case 0: | 1051 | case 0: |
1052 | xrptr[0] = 0; | 1052 | xrptr[0] = 0; |
1053 | break; | 1053 | break; |
1054 | 1054 | ||
1055 | case 15: | 1055 | case 15: |
1056 | if (cachesz < linbits + 2) { | 1056 | if (cachesz < linbits + 2) { |
1057 | bitcache = (bitcache << 16) | mad_bit_read(&peek, 16); | 1057 | bitcache = (bitcache << 16) | mad_bit_read(&peek, 16); |
1058 | cachesz += 16; | 1058 | cachesz += 16; |
1059 | bits_left -= 16; | 1059 | bits_left -= 16; |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | value += MASK(bitcache, cachesz, linbits); | 1062 | value += MASK(bitcache, cachesz, linbits); |
1063 | cachesz -= linbits; | 1063 | cachesz -= linbits; |
1064 | 1064 | ||
1065 | requantized = III_requantize(value, exp); | 1065 | requantized = III_requantize(value, exp); |
1066 | goto x_final; | 1066 | goto x_final; |
1067 | 1067 | ||
1068 | default: | 1068 | default: |
1069 | if (reqhits & (1 << value)) | 1069 | if (reqhits & (1 << value)) |
1070 | requantized = reqcache[value]; | 1070 | requantized = reqcache[value]; |
1071 | else { | 1071 | else { |
1072 | reqhits |= (1 << value); | 1072 | reqhits |= (1 << value); |
1073 | requantized = reqcache[value] = III_requantize(value, exp); | 1073 | requantized = reqcache[value] = III_requantize(value, exp); |
1074 | } | 1074 | } |
1075 | 1075 | ||
1076 | x_final: | 1076 | x_final: |
1077 | xrptr[0] = MASK1BIT(bitcache, cachesz--) ? | 1077 | xrptr[0] = MASK1BIT(bitcache, cachesz--) ? |
1078 | -requantized : requantized; | 1078 | -requantized : requantized; |
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | /* y (0..14) */ | 1081 | /* y (0..14) */ |
1082 | 1082 | ||
1083 | value = pair->value.y; | 1083 | value = pair->value.y; |
1084 | 1084 | ||
1085 | switch (value) { | 1085 | switch (value) { |
1086 | case 0: | 1086 | case 0: |
1087 | xrptr[1] = 0; | 1087 | xrptr[1] = 0; |
1088 | break; | 1088 | break; |
1089 | 1089 | ||
1090 | case 15: | 1090 | case 15: |
1091 | if (cachesz < linbits + 1) { | 1091 | if (cachesz < linbits + 1) { |
1092 | bitcache = (bitcache << 16) | mad_bit_read(&peek, 16); | 1092 | bitcache = (bitcache << 16) | mad_bit_read(&peek, 16); |
1093 | cachesz += 16; | 1093 | cachesz += 16; |
1094 | bits_left -= 16; | 1094 | bits_left -= 16; |
1095 | } | 1095 | } |
1096 | 1096 | ||
1097 | value += MASK(bitcache, cachesz, linbits); | 1097 | value += MASK(bitcache, cachesz, linbits); |
1098 | cachesz -= linbits; | 1098 | cachesz -= linbits; |
1099 | 1099 | ||
1100 | requantized = III_requantize(value, exp); | 1100 | requantized = III_requantize(value, exp); |
1101 | goto y_final; | 1101 | goto y_final; |
1102 | 1102 | ||
1103 | default: | 1103 | default: |
1104 | if (reqhits & (1 << value)) | 1104 | if (reqhits & (1 << value)) |
1105 | requantized = reqcache[value]; | 1105 | requantized = reqcache[value]; |
1106 | else { | 1106 | else { |
1107 | reqhits |= (1 << value); | 1107 | reqhits |= (1 << value); |
1108 | requantized = reqcache[value] = III_requantize(value, exp); | 1108 | requantized = reqcache[value] = III_requantize(value, exp); |
1109 | } | 1109 | } |
1110 | 1110 | ||
1111 | y_final: | 1111 | y_final: |
1112 | xrptr[1] = MASK1BIT(bitcache, cachesz--) ? | 1112 | xrptr[1] = MASK1BIT(bitcache, cachesz--) ? |
1113 | -requantized : requantized; | 1113 | -requantized : requantized; |
1114 | } | 1114 | } |
1115 | } | 1115 | } |
1116 | else { | 1116 | else { |
1117 | /* x (0..1) */ | 1117 | /* x (0..1) */ |
1118 | 1118 | ||
1119 | value = pair->value.x; | 1119 | value = pair->value.x; |
1120 | 1120 | ||
1121 | if (value == 0) | 1121 | if (value == 0) |
1122 | xrptr[0] = 0; | 1122 | xrptr[0] = 0; |
1123 | else { | 1123 | else { |
1124 | if (reqhits & (1 << value)) | 1124 | if (reqhits & (1 << value)) |
1125 | requantized = reqcache[value]; | 1125 | requantized = reqcache[value]; |
1126 | else { | 1126 | else { |
1127 | reqhits |= (1 << value); | 1127 | reqhits |= (1 << value); |
1128 | requantized = reqcache[value] = III_requantize(value, exp); | 1128 | requantized = reqcache[value] = III_requantize(value, exp); |
1129 | } | 1129 | } |
1130 | 1130 | ||
1131 | xrptr[0] = MASK1BIT(bitcache, cachesz--) ? | 1131 | xrptr[0] = MASK1BIT(bitcache, cachesz--) ? |
1132 | -requantized : requantized; | 1132 | -requantized : requantized; |
1133 | } | 1133 | } |
1134 | 1134 | ||
1135 | /* y (0..1) */ | 1135 | /* y (0..1) */ |
1136 | 1136 | ||
1137 | value = pair->value.y; | 1137 | value = pair->value.y; |
1138 | 1138 | ||
1139 | if (value == 0) | 1139 | if (value == 0) |
1140 | xrptr[1] = 0; | 1140 | xrptr[1] = 0; |
1141 | else { | 1141 | else { |
1142 | if (reqhits & (1 << value)) | 1142 | if (reqhits & (1 << value)) |
1143 | requantized = reqcache[value]; | 1143 | requantized = reqcache[value]; |
1144 | else { | 1144 | else { |
1145 | reqhits |= (1 << value); | 1145 | reqhits |= (1 << value); |
1146 | requantized = reqcache[value] = III_requantize(value, exp); | 1146 | requantized = reqcache[value] = III_requantize(value, exp); |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | xrptr[1] = MASK1BIT(bitcache, cachesz--) ? | 1149 | xrptr[1] = MASK1BIT(bitcache, cachesz--) ? |
1150 | -requantized : requantized; | 1150 | -requantized : requantized; |
1151 | } | 1151 | } |
1152 | } | 1152 | } |
1153 | 1153 | ||
1154 | xrptr += 2; | 1154 | xrptr += 2; |
1155 | } | 1155 | } |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | if (cachesz + bits_left < 0) | 1158 | if (cachesz + bits_left < 0) |
1159 | return MAD_ERROR_BADHUFFDATA; /* big_values overrun */ | 1159 | return MAD_ERROR_BADHUFFDATA; /* big_values overrun */ |
1160 | 1160 | ||
1161 | /* count1 */ | 1161 | /* count1 */ |
1162 | { | 1162 | { |
1163 | union huffquad const *table; | 1163 | union huffquad const *table; |
1164 | register mad_fixed_t requantized; | 1164 | register mad_fixed_t requantized; |
1165 | 1165 | ||
1166 | table = mad_huff_quad_table[channel->flags & count1table_select]; | 1166 | table = mad_huff_quad_table[channel->flags & count1table_select]; |
1167 | 1167 | ||
1168 | requantized = III_requantize(1, exp); | 1168 | requantized = III_requantize(1, exp); |
1169 | 1169 | ||
1170 | while (cachesz + bits_left > 0 && xrptr <= &xr[572]) { | 1170 | while (cachesz + bits_left > 0 && xrptr <= &xr[572]) { |
1171 | union huffquad const *quad; | 1171 | union huffquad const *quad; |
1172 | 1172 | ||
1173 | /* hcod (1..6) */ | 1173 | /* hcod (1..6) */ |
1174 | 1174 | ||
1175 | if (cachesz < 10) { | 1175 | if (cachesz < 10) { |
1176 | bitcache = (bitcache << 16) | mad_bit_read(&peek, 16); | 1176 | bitcache = (bitcache << 16) | mad_bit_read(&peek, 16); |
1177 | cachesz += 16; | 1177 | cachesz += 16; |
1178 | bits_left -= 16; | 1178 | bits_left -= 16; |
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | quad = &table[MASK(bitcache, cachesz, 4)]; | 1181 | quad = &table[MASK(bitcache, cachesz, 4)]; |
1182 | 1182 | ||
1183 | /* quad tables guaranteed to have at most one extra lookup */ | 1183 | /* quad tables guaranteed to have at most one extra lookup */ |
1184 | if (!quad->final) { | 1184 | if (!quad->final) { |
1185 | cachesz -= 4; | 1185 | cachesz -= 4; |
1186 | 1186 | ||
1187 | quad = &table[quad->ptr.offset + | 1187 | quad = &table[quad->ptr.offset + |
1188 | MASK(bitcache, cachesz, quad->ptr.bits)]; | 1188 | MASK(bitcache, cachesz, quad->ptr.bits)]; |
1189 | } | 1189 | } |
1190 | 1190 | ||
1191 | cachesz -= quad->value.hlen; | 1191 | cachesz -= quad->value.hlen; |
1192 | 1192 | ||
1193 | if (xrptr == sfbound) { | 1193 | if (xrptr == sfbound) { |
1194 | sfbound += *sfbwidth++; | 1194 | sfbound += *sfbwidth++; |
1195 | 1195 | ||
1196 | if (exp != *expptr) { | 1196 | if (exp != *expptr) { |
1197 | exp = *expptr; | 1197 | exp = *expptr; |
1198 | requantized = III_requantize(1, exp); | 1198 | requantized = III_requantize(1, exp); |
1199 | } | 1199 | } |
1200 | 1200 | ||
1201 | ++expptr; | 1201 | ++expptr; |
1202 | } | 1202 | } |
1203 | 1203 | ||
1204 | /* v (0..1) */ | 1204 | /* v (0..1) */ |
1205 | 1205 | ||
1206 | xrptr[0] = quad->value.v ? | 1206 | xrptr[0] = quad->value.v ? |
1207 | (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; | 1207 | (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; |
1208 | 1208 | ||
1209 | /* w (0..1) */ | 1209 | /* w (0..1) */ |
1210 | 1210 | ||
1211 | xrptr[1] = quad->value.w ? | 1211 | xrptr[1] = quad->value.w ? |
1212 | (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; | 1212 | (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; |
1213 | 1213 | ||
1214 | xrptr += 2; | 1214 | xrptr += 2; |
1215 | 1215 | ||
1216 | if (xrptr == sfbound) { | 1216 | if (xrptr == sfbound) { |
1217 | sfbound += *sfbwidth++; | 1217 | sfbound += *sfbwidth++; |
1218 | 1218 | ||
1219 | if (exp != *expptr) { | 1219 | if (exp != *expptr) { |
1220 | exp = *expptr; | 1220 | exp = *expptr; |
1221 | requantized = III_requantize(1, exp); | 1221 | requantized = III_requantize(1, exp); |
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | ++expptr; | 1224 | ++expptr; |
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | /* x (0..1) */ | 1227 | /* x (0..1) */ |
1228 | 1228 | ||
1229 | xrptr[0] = quad->value.x ? | 1229 | xrptr[0] = quad->value.x ? |
1230 | (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; | 1230 | (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; |
1231 | 1231 | ||
1232 | /* y (0..1) */ | 1232 | /* y (0..1) */ |
1233 | 1233 | ||
1234 | xrptr[1] = quad->value.y ? | 1234 | xrptr[1] = quad->value.y ? |
1235 | (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; | 1235 | (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; |
1236 | 1236 | ||
1237 | xrptr += 2; | 1237 | xrptr += 2; |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | if (cachesz + bits_left < 0) { | 1240 | if (cachesz + bits_left < 0) { |
1241 | # if 0 && defined(DEBUG) | 1241 | # if 0 && defined(DEBUG) |
1242 | fprintf(stderr, "huffman count1 overrun (%d bits)\n", | 1242 | fprintf(stderr, "huffman count1 overrun (%d bits)\n", |
1243 | -(cachesz + bits_left)); | 1243 | -(cachesz + bits_left)); |
1244 | # endif | 1244 | # endif |
1245 | 1245 | ||
1246 | /* technically the bitstream is misformatted, but apparently | 1246 | /* technically the bitstream is misformatted, but apparently |
1247 | some encoders are just a bit sloppy with stuffing bits */ | 1247 | some encoders are just a bit sloppy with stuffing bits */ |
1248 | 1248 | ||
1249 | xrptr -= 4; | 1249 | xrptr -= 4; |
1250 | } | 1250 | } |
1251 | } | 1251 | } |
1252 | 1252 | ||
1253 | assert(-bits_left <= MAD_BUFFER_GUARD * CHAR_BIT); | 1253 | assert(-bits_left <= MAD_BUFFER_GUARD * CHAR_BIT); |
1254 | 1254 | ||
1255 | # if 0 && defined(DEBUG) | 1255 | # if 0 && defined(DEBUG) |
1256 | if (bits_left < 0) | 1256 | if (bits_left < 0) |
1257 | fprintf(stderr, "read %d bits too many\n", -bits_left); | 1257 | fprintf(stderr, "read %d bits too many\n", -bits_left); |
1258 | else if (cachesz + bits_left > 0) | 1258 | else if (cachesz + bits_left > 0) |
1259 | fprintf(stderr, "%d stuffing bits\n", cachesz + bits_left); | 1259 | fprintf(stderr, "%d stuffing bits\n", cachesz + bits_left); |
1260 | # endif | 1260 | # endif |
1261 | 1261 | ||
1262 | /* rzero */ | 1262 | /* rzero */ |
1263 | while (xrptr < &xr[576]) { | 1263 | while (xrptr < &xr[576]) { |
1264 | xrptr[0] = 0; | 1264 | xrptr[0] = 0; |
1265 | xrptr[1] = 0; | 1265 | xrptr[1] = 0; |
1266 | 1266 | ||
1267 | xrptr += 2; | 1267 | xrptr += 2; |
1268 | } | 1268 | } |
1269 | 1269 | ||
1270 | return MAD_ERROR_NONE; | 1270 | return MAD_ERROR_NONE; |
1271 | } | 1271 | } |
1272 | 1272 | ||
1273 | # undef MASK | 1273 | # undef MASK |
1274 | # undef MASK1BIT | 1274 | # undef MASK1BIT |
1275 | 1275 | ||
1276 | /* | 1276 | /* |
1277 | * NAME:III_reorder() | 1277 | * NAME:III_reorder() |
1278 | * DESCRIPTION:reorder frequency lines of a short block into subband order | 1278 | * DESCRIPTION:reorder frequency lines of a short block into subband order |
1279 | */ | 1279 | */ |
1280 | static | 1280 | static |
1281 | void III_reorder(mad_fixed_t xr[576], struct channel const *channel, | 1281 | void III_reorder(mad_fixed_t xr[576], struct channel const *channel, |
1282 | unsigned char const sfbwidth[39]) | 1282 | unsigned char const sfbwidth[39]) |
1283 | { | 1283 | { |
1284 | mad_fixed_t tmp[32][3][6]; | 1284 | mad_fixed_t tmp[32][3][6]; |
1285 | unsigned int sb, l, f, w, sbw[3], sw[3]; | 1285 | unsigned int sb, l, f, w, sbw[3], sw[3]; |
1286 | 1286 | ||
1287 | /* this is probably wrong for 8000 Hz mixed blocks */ | 1287 | /* this is probably wrong for 8000 Hz mixed blocks */ |
1288 | 1288 | ||
1289 | sb = 0; | 1289 | sb = 0; |
1290 | if (channel->flags & mixed_block_flag) { | 1290 | if (channel->flags & mixed_block_flag) { |
1291 | sb = 2; | 1291 | sb = 2; |
1292 | 1292 | ||
1293 | l = 0; | 1293 | l = 0; |
1294 | while (l < 36) | 1294 | while (l < 36) |
1295 | l += *sfbwidth++; | 1295 | l += *sfbwidth++; |
1296 | } | 1296 | } |
1297 | 1297 | ||
1298 | for (w = 0; w < 3; ++w) { | 1298 | for (w = 0; w < 3; ++w) { |
1299 | sbw[w] = sb; | 1299 | sbw[w] = sb; |
1300 | sw[w] = 0; | 1300 | sw[w] = 0; |
1301 | } | 1301 | } |
1302 | 1302 | ||
1303 | f = *sfbwidth++; | 1303 | f = *sfbwidth++; |
1304 | w = 0; | 1304 | w = 0; |
1305 | 1305 | ||
1306 | for (l = 18 * sb; l < 576; ++l) { | 1306 | for (l = 18 * sb; l < 576; ++l) { |
1307 | if (f-- == 0) { | 1307 | if (f-- == 0) { |
1308 | f = *sfbwidth++ - 1; | 1308 | f = *sfbwidth++ - 1; |
1309 | w = (w + 1) % 3; | 1309 | w = (w + 1) % 3; |
1310 | } | 1310 | } |
1311 | 1311 | ||
1312 | tmp[sbw[w]][w][sw[w]++] = xr[l]; | 1312 | tmp[sbw[w]][w][sw[w]++] = xr[l]; |
1313 | 1313 | ||
1314 | if (sw[w] == 6) { | 1314 | if (sw[w] == 6) { |
1315 | sw[w] = 0; | 1315 | sw[w] = 0; |
1316 | ++sbw[w]; | 1316 | ++sbw[w]; |
1317 | } | 1317 | } |
1318 | } | 1318 | } |
1319 | 1319 | ||
1320 | memcpy(&xr[18 * sb], &tmp[sb], (576 - 18 * sb) * sizeof(mad_fixed_t)); | 1320 | memcpy(&xr[18 * sb], &tmp[sb], (576 - 18 * sb) * sizeof(mad_fixed_t)); |
1321 | } | 1321 | } |
1322 | 1322 | ||
1323 | /* | 1323 | /* |
1324 | * NAME:III_stereo() | 1324 | * NAME:III_stereo() |
1325 | * DESCRIPTION:perform joint stereo processing on a granule | 1325 | * DESCRIPTION:perform joint stereo processing on a granule |
1326 | */ | 1326 | */ |
1327 | static | 1327 | static |
1328 | enum mad_error III_stereo(mad_fixed_t xr[2][576], | 1328 | enum mad_error III_stereo(mad_fixed_t xr[2][576], |
1329 | struct granule const *granule, | 1329 | struct granule const *granule, |
1330 | struct mad_header *header, | 1330 | struct mad_header *header, |
1331 | unsigned char const *sfbwidth) | 1331 | unsigned char const *sfbwidth) |
1332 | { | 1332 | { |
1333 | short modes[39]; | 1333 | short modes[39]; |
1334 | unsigned int sfbi, l, n, i; | 1334 | unsigned int sfbi, l, n, i; |
1335 | 1335 | ||
1336 | if (granule->ch[0].block_type != | 1336 | if (granule->ch[0].block_type != |
1337 | granule->ch[1].block_type || | 1337 | granule->ch[1].block_type || |
1338 | (granule->ch[0].flags & mixed_block_flag) != | 1338 | (granule->ch[0].flags & mixed_block_flag) != |
1339 | (granule->ch[1].flags & mixed_block_flag)) | 1339 | (granule->ch[1].flags & mixed_block_flag)) |
1340 | return MAD_ERROR_BADSTEREO; | 1340 | return MAD_ERROR_BADSTEREO; |
1341 | 1341 | ||
1342 | for (i = 0; i < 39; ++i) | 1342 | for (i = 0; i < 39; ++i) |
1343 | modes[i] = header->mode_extension; | 1343 | modes[i] = header->mode_extension; |
1344 | 1344 | ||
1345 | /* intensity stereo */ | 1345 | /* intensity stereo */ |
1346 | 1346 | ||
1347 | if (header->mode_extension & I_STEREO) { | 1347 | if (header->mode_extension & I_STEREO) { |
1348 | struct channel const *right_ch = &granule->ch[1]; | 1348 | struct channel const *right_ch = &granule->ch[1]; |
1349 | mad_fixed_t const *right_xr = xr[1]; | 1349 | mad_fixed_t const *right_xr = xr[1]; |
1350 | unsigned int is_pos; | 1350 | unsigned int is_pos; |
1351 | 1351 | ||
1352 | header->flags |= MAD_FLAG_I_STEREO; | 1352 | header->flags |= MAD_FLAG_I_STEREO; |
1353 | 1353 | ||
1354 | /* first determine which scalefactor bands are to be processed */ | 1354 | /* first determine which scalefactor bands are to be processed */ |
1355 | 1355 | ||
1356 | if (right_ch->block_type == 2) { | 1356 | if (right_ch->block_type == 2) { |
1357 | unsigned int lower, start, max, bound[3], w; | 1357 | unsigned int lower, start, max, bound[3], w; |
1358 | 1358 | ||
1359 | lower = start = max = bound[0] = bound[1] = bound[2] = 0; | 1359 | lower = start = max = bound[0] = bound[1] = bound[2] = 0; |
1360 | 1360 | ||
1361 | sfbi = l = 0; | 1361 | sfbi = l = 0; |
1362 | 1362 | ||
1363 | if (right_ch->flags & mixed_block_flag) { | 1363 | if (right_ch->flags & mixed_block_flag) { |
1364 | while (l < 36) { | 1364 | while (l < 36) { |
1365 | n = sfbwidth[sfbi++]; | 1365 | n = sfbwidth[sfbi++]; |
1366 | 1366 | ||
1367 | for (i = 0; i < n; ++i) { | 1367 | for (i = 0; i < n; ++i) { |
1368 | if (right_xr[i]) { | 1368 | if (right_xr[i]) { |
1369 | lower = sfbi; | 1369 | lower = sfbi; |
1370 | break; | 1370 | break; |
1371 | } | 1371 | } |
1372 | } | 1372 | } |
1373 | 1373 | ||
1374 | right_xr += n; | 1374 | right_xr += n; |
1375 | l += n; | 1375 | l += n; |
1376 | } | 1376 | } |
1377 | 1377 | ||
1378 | start = sfbi; | 1378 | start = sfbi; |
1379 | } | 1379 | } |
1380 | 1380 | ||
1381 | w = 0; | 1381 | w = 0; |
1382 | while (l < 576) { | 1382 | while (l < 576) { |
1383 | n = sfbwidth[sfbi++]; | 1383 | n = sfbwidth[sfbi++]; |
1384 | 1384 | ||
1385 | for (i = 0; i < n; ++i) { | 1385 | for (i = 0; i < n; ++i) { |
1386 | if (right_xr[i]) { | 1386 | if (right_xr[i]) { |
1387 | max = bound[w] = sfbi; | 1387 | max = bound[w] = sfbi; |
1388 | break; | 1388 | break; |
1389 | } | 1389 | } |
1390 | } | 1390 | } |
1391 | 1391 | ||
1392 | right_xr += n; | 1392 | right_xr += n; |
1393 | l += n; | 1393 | l += n; |
1394 | w = (w + 1) % 3; | 1394 | w = (w + 1) % 3; |
1395 | } | 1395 | } |
1396 | 1396 | ||
1397 | if (max) | 1397 | if (max) |
1398 | lower = start; | 1398 | lower = start; |
1399 | 1399 | ||
1400 | /* long blocks */ | 1400 | /* long blocks */ |
1401 | 1401 | ||
1402 | for (i = 0; i < lower; ++i) | 1402 | for (i = 0; i < lower; ++i) |
1403 | modes[i] = header->mode_extension & ~I_STEREO; | 1403 | modes[i] = header->mode_extension & ~I_STEREO; |
1404 | 1404 | ||
1405 | /* short blocks */ | 1405 | /* short blocks */ |
1406 | 1406 | ||
1407 | w = 0; | 1407 | w = 0; |
1408 | for (i = start; i < max; ++i) { | 1408 | for (i = start; i < max; ++i) { |
1409 | if (i < bound[w]) | 1409 | if (i < bound[w]) |
1410 | modes[i] = header->mode_extension & ~I_STEREO; | 1410 | modes[i] = header->mode_extension & ~I_STEREO; |
1411 | 1411 | ||
1412 | w = (w + 1) % 3; | 1412 | w = (w + 1) % 3; |
1413 | } | 1413 | } |
1414 | } | 1414 | } |
1415 | else { /* right_ch->block_type != 2 */ | 1415 | else { /* right_ch->block_type != 2 */ |
1416 | unsigned int bound; | 1416 | unsigned int bound; |
1417 | 1417 | ||
1418 | bound = 0; | 1418 | bound = 0; |
1419 | for (sfbi = l = 0; l < 576; l += n) { | 1419 | for (sfbi = l = 0; l < 576; l += n) { |
1420 | n = sfbwidth[sfbi++]; | 1420 | n = sfbwidth[sfbi++]; |
1421 | 1421 | ||
1422 | for (i = 0; i < n; ++i) { | 1422 | for (i = 0; i < n; ++i) { |
1423 | if (right_xr[i]) { | 1423 | if (right_xr[i]) { |
1424 | bound = sfbi; | 1424 | bound = sfbi; |
1425 | break; | 1425 | break; |
1426 | } | 1426 | } |
1427 | } | 1427 | } |
1428 | 1428 | ||
1429 | right_xr += n; | 1429 | right_xr += n; |
1430 | } | 1430 | } |
1431 | 1431 | ||
1432 | for (i = 0; i < bound; ++i) | 1432 | for (i = 0; i < bound; ++i) |
1433 | modes[i] = header->mode_extension & ~I_STEREO; | 1433 | modes[i] = header->mode_extension & ~I_STEREO; |
1434 | } | 1434 | } |
1435 | 1435 | ||
1436 | /* now do the actual processing */ | 1436 | /* now do the actual processing */ |
1437 | 1437 | ||
1438 | if (header->flags & MAD_FLAG_LSF_EXT) { | 1438 | if (header->flags & MAD_FLAG_LSF_EXT) { |
1439 | unsigned char const *illegal_pos = granule[1].ch[1].scalefac; | 1439 | unsigned char const *illegal_pos = granule[1].ch[1].scalefac; |
1440 | mad_fixed_t const *lsf_scale; | 1440 | mad_fixed_t const *lsf_scale; |
1441 | 1441 | ||
1442 | /* intensity_scale */ | 1442 | /* intensity_scale */ |
1443 | lsf_scale = is_lsf_table[right_ch->scalefac_compress & 0x1]; | 1443 | lsf_scale = is_lsf_table[right_ch->scalefac_compress & 0x1]; |
1444 | 1444 | ||
1445 | for (sfbi = l = 0; l < 576; ++sfbi, l += n) { | 1445 | for (sfbi = l = 0; l < 576; ++sfbi, l += n) { |
1446 | n = sfbwidth[sfbi]; | 1446 | n = sfbwidth[sfbi]; |
1447 | 1447 | ||
1448 | if (!(modes[sfbi] & I_STEREO)) | 1448 | if (!(modes[sfbi] & I_STEREO)) |
1449 | continue; | 1449 | continue; |
1450 | 1450 | ||
1451 | if (illegal_pos[sfbi]) { | 1451 | if (illegal_pos[sfbi]) { |
1452 | modes[sfbi] &= ~I_STEREO; | 1452 | modes[sfbi] &= ~I_STEREO; |
1453 | continue; | 1453 | continue; |
1454 | } | 1454 | } |
1455 | 1455 | ||
1456 | is_pos = right_ch->scalefac[sfbi]; | 1456 | is_pos = right_ch->scalefac[sfbi]; |
1457 | 1457 | ||
1458 | for (i = 0; i < n; ++i) { | 1458 | for (i = 0; i < n; ++i) { |
1459 | register mad_fixed_t left; | 1459 | register mad_fixed_t left; |
1460 | 1460 | ||
1461 | left = xr[0][l + i]; | 1461 | left = xr[0][l + i]; |
1462 | 1462 | ||
1463 | if (is_pos == 0) | 1463 | if (is_pos == 0) |
1464 | xr[1][l + i] = left; | 1464 | xr[1][l + i] = left; |
1465 | else { | 1465 | else { |
1466 | register mad_fixed_t opposite; | 1466 | register mad_fixed_t opposite; |
1467 | 1467 | ||
1468 | opposite = mad_f_mul(left, lsf_scale[(is_pos - 1) / 2]); | 1468 | opposite = mad_f_mul(left, lsf_scale[(is_pos - 1) / 2]); |
1469 | 1469 | ||
1470 | if (is_pos & 1) { | 1470 | if (is_pos & 1) { |
1471 | xr[0][l + i] = opposite; | 1471 | xr[0][l + i] = opposite; |
1472 | xr[1][l + i] = left; | 1472 | xr[1][l + i] = left; |
1473 | } | 1473 | } |
1474 | else | 1474 | else |
1475 | xr[1][l + i] = opposite; | 1475 | xr[1][l + i] = opposite; |
1476 | } | 1476 | } |
1477 | } | 1477 | } |
1478 | } | 1478 | } |
1479 | } | 1479 | } |
1480 | else { /* !(header->flags & MAD_FLAG_LSF_EXT) */ | 1480 | else { /* !(header->flags & MAD_FLAG_LSF_EXT) */ |
1481 | for (sfbi = l = 0; l < 576; ++sfbi, l += n) { | 1481 | for (sfbi = l = 0; l < 576; ++sfbi, l += n) { |
1482 | n = sfbwidth[sfbi]; | 1482 | n = sfbwidth[sfbi]; |
1483 | 1483 | ||
1484 | if (!(modes[sfbi] & I_STEREO)) | 1484 | if (!(modes[sfbi] & I_STEREO)) |
1485 | continue; | 1485 | continue; |
1486 | 1486 | ||
1487 | is_pos = right_ch->scalefac[sfbi]; | 1487 | is_pos = right_ch->scalefac[sfbi]; |
1488 | 1488 | ||
1489 | if (is_pos >= 7) { /* illegal intensity position */ | 1489 | if (is_pos >= 7) { /* illegal intensity position */ |
1490 | modes[sfbi] &= ~I_STEREO; | 1490 | modes[sfbi] &= ~I_STEREO; |
1491 | continue; | 1491 | continue; |
1492 | } | 1492 | } |
1493 | 1493 | ||
1494 | for (i = 0; i < n; ++i) { | 1494 | for (i = 0; i < n; ++i) { |
1495 | register mad_fixed_t left; | 1495 | register mad_fixed_t left; |
1496 | 1496 | ||
1497 | left = xr[0][l + i]; | 1497 | left = xr[0][l + i]; |
1498 | 1498 | ||
1499 | xr[0][l + i] = mad_f_mul(left, is_table[ is_pos]); | 1499 | xr[0][l + i] = mad_f_mul(left, is_table[ is_pos]); |
1500 | xr[1][l + i] = mad_f_mul(left, is_table[6 - is_pos]); | 1500 | xr[1][l + i] = mad_f_mul(left, is_table[6 - is_pos]); |
1501 | } | 1501 | } |
1502 | } | 1502 | } |
1503 | } | 1503 | } |
1504 | } | 1504 | } |
1505 | 1505 | ||
1506 | /* middle/side stereo */ | 1506 | /* middle/side stereo */ |
1507 | 1507 | ||
1508 | if (header->mode_extension & MS_STEREO) { | 1508 | if (header->mode_extension & MS_STEREO) { |
1509 | register mad_fixed_t invsqrt2; | 1509 | register mad_fixed_t invsqrt2; |
1510 | 1510 | ||
1511 | header->flags |= MAD_FLAG_MS_STEREO; | 1511 | header->flags |= MAD_FLAG_MS_STEREO; |
1512 | 1512 | ||
1513 | invsqrt2 = root_table[3 + -2]; | 1513 | invsqrt2 = root_table[3 + -2]; |
1514 | 1514 | ||
1515 | for (sfbi = l = 0; l < 576; ++sfbi, l += n) { | 1515 | for (sfbi = l = 0; l < 576; ++sfbi, l += n) { |
1516 | n = sfbwidth[sfbi]; | 1516 | n = sfbwidth[sfbi]; |
1517 | 1517 | ||
1518 | if (modes[sfbi] != MS_STEREO) | 1518 | if (modes[sfbi] != MS_STEREO) |
1519 | continue; | 1519 | continue; |
1520 | 1520 | ||
1521 | for (i = 0; i < n; ++i) { | 1521 | for (i = 0; i < n; ++i) { |
1522 | register mad_fixed_t m, s; | 1522 | register mad_fixed_t m, s; |
1523 | 1523 | ||
1524 | m = xr[0][l + i]; | 1524 | m = xr[0][l + i]; |
1525 | s = xr[1][l + i]; | 1525 | s = xr[1][l + i]; |
1526 | 1526 | ||
1527 | xr[0][l + i] = mad_f_mul(m + s, invsqrt2); /* l = (m + s) / sqrt(2) */ | 1527 | xr[0][l + i] = mad_f_mul(m + s, invsqrt2); /* l = (m + s) / sqrt(2) */ |
1528 | xr[1][l + i] = mad_f_mul(m - s, invsqrt2); /* r = (m - s) / sqrt(2) */ | 1528 | xr[1][l + i] = mad_f_mul(m - s, invsqrt2); /* r = (m - s) / sqrt(2) */ |
1529 | } | 1529 | } |
1530 | } | 1530 | } |
1531 | } | 1531 | } |
1532 | 1532 | ||
1533 | return MAD_ERROR_NONE; | 1533 | return MAD_ERROR_NONE; |
1534 | } | 1534 | } |
1535 | 1535 | ||
1536 | /* | 1536 | /* |
1537 | * NAME:III_aliasreduce() | 1537 | * NAME:III_aliasreduce() |
1538 | * DESCRIPTION:perform frequency line alias reduction | 1538 | * DESCRIPTION:perform frequency line alias reduction |
1539 | */ | 1539 | */ |
1540 | static | 1540 | static |
1541 | void III_aliasreduce(mad_fixed_t xr[576], int lines) | 1541 | void III_aliasreduce(mad_fixed_t xr[576], int lines) |
1542 | { | 1542 | { |
1543 | mad_fixed_t const *bound; | 1543 | mad_fixed_t const *bound; |
1544 | int i; | 1544 | int i; |
1545 | 1545 | ||
1546 | bound = &xr[lines]; | 1546 | bound = &xr[lines]; |
1547 | for (xr += 18; xr < bound; xr += 18) { | 1547 | for (xr += 18; xr < bound; xr += 18) { |
1548 | for (i = 0; i < 8; ++i) { | 1548 | for (i = 0; i < 8; ++i) { |
1549 | register mad_fixed_t a, b; | 1549 | register mad_fixed_t a, b; |
1550 | register mad_fixed64hi_t hi; | 1550 | register mad_fixed64hi_t hi; |
1551 | register mad_fixed64lo_t lo; | 1551 | register mad_fixed64lo_t lo; |
1552 | 1552 | ||
1553 | a = xr[-1 - i]; | 1553 | a = xr[-1 - i]; |
1554 | b = xr[ i]; | 1554 | b = xr[ i]; |
1555 | 1555 | ||
1556 | # if defined(ASO_ZEROCHECK) | 1556 | # if defined(ASO_ZEROCHECK) |
1557 | if (a | b) { | 1557 | if (a | b) { |
1558 | # endif | 1558 | # endif |
1559 | MAD_F_ML0(hi, lo, a, cs[i]); | 1559 | MAD_F_ML0(hi, lo, a, cs[i]); |
1560 | MAD_F_MLA(hi, lo, -b, ca[i]); | 1560 | MAD_F_MLA(hi, lo, -b, ca[i]); |
1561 | 1561 | ||
1562 | xr[-1 - i] = MAD_F_MLZ(hi, lo); | 1562 | xr[-1 - i] = MAD_F_MLZ(hi, lo); |
1563 | 1563 | ||
1564 | MAD_F_ML0(hi, lo, b, cs[i]); | 1564 | MAD_F_ML0(hi, lo, b, cs[i]); |
1565 | MAD_F_MLA(hi, lo, a, ca[i]); | 1565 | MAD_F_MLA(hi, lo, a, ca[i]); |
1566 | 1566 | ||
1567 | xr[ i] = MAD_F_MLZ(hi, lo); | 1567 | xr[ i] = MAD_F_MLZ(hi, lo); |
1568 | # if defined(ASO_ZEROCHECK) | 1568 | # if defined(ASO_ZEROCHECK) |
1569 | } | 1569 | } |
1570 | # endif | 1570 | # endif |
1571 | } | 1571 | } |
1572 | } | 1572 | } |
1573 | } | 1573 | } |
1574 | 1574 | ||
1575 | # if defined(ASO_IMDCT) | 1575 | # if defined(ASO_IMDCT) |
1576 | void III_imdct_l(mad_fixed_t const [18], mad_fixed_t [36], unsigned int); | 1576 | void III_imdct_l(mad_fixed_t const [18], mad_fixed_t [36], unsigned int); |
1577 | # else | 1577 | # else |
1578 | # if 1 | ||
1579 | static | ||
1580 | void fastsdct(mad_fixed_t const x[9], mad_fixed_t y[18]) | ||
1581 | { | ||
1582 | mad_fixed_t a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12; | ||
1583 | mad_fixed_t a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25; | ||
1584 | mad_fixed_t m0, m1, m2, m3, m4, m5, m6, m7; | ||
1585 | |||
1586 | enum { | ||
1587 | c0 = MAD_F(0x1f838b8d), /* 2 * cos( 1 * PI / 18) */ | ||
1588 | c1 = MAD_F(0x1bb67ae8), /* 2 * cos( 3 * PI / 18) */ | ||
1589 | c2 = MAD_F(0x18836fa3), /* 2 * cos( 4 * PI / 18) */ | ||
1590 | c3 = MAD_F(0x1491b752), /* 2 * cos( 5 * PI / 18) */ | ||
1591 | c4 = MAD_F(0x0af1d43a), /* 2 * cos( 7 * PI / 18) */ | ||
1592 | c5 = MAD_F(0x058e86a0), /* 2 * cos( 8 * PI / 18) */ | ||
1593 | c6 = -MAD_F(0x1e11f642) /* 2 * cos(16 * PI / 18) */ | ||
1594 | }; | ||
1595 | |||
1596 | a0 = x[3] + x[5]; | ||
1597 | a1 = x[3] - x[5]; | ||
1598 | a2 = x[6] + x[2]; | ||
1599 | a3 = x[6] - x[2]; | ||
1600 | a4 = x[1] + x[7]; | ||
1601 | a5 = x[1] - x[7]; | ||
1602 | a6 = x[8] + x[0]; | ||
1603 | a7 = x[8] - x[0]; | ||
1604 | |||
1605 | a8 = a0 + a2; | ||
1606 | a9 = a0 - a2; | ||
1607 | a10 = a0 - a6; | ||
1608 | a11 = a2 - a6; | ||
1609 | a12 = a8 + a6; | ||
1610 | a13 = a1 - a3; | ||
1611 | a14 = a13 + a7; | ||
1612 | a15 = a3 + a7; | ||
1613 | a16 = a1 - a7; | ||
1614 | a17 = a1 + a3; | ||
1615 | |||
1616 | m0 = mad_f_mul(a17, -c3); | ||
1617 | m1 = mad_f_mul(a16, -c0); | ||
1618 | m2 = mad_f_mul(a15, -c4); | ||
1619 | m3 = mad_f_mul(a14, -c1); | ||
1620 | m4 = mad_f_mul(a5, -c1); | ||
1621 | m5 = mad_f_mul(a11, -c6); | ||
1622 | m6 = mad_f_mul(a10, -c5); | ||
1623 | m7 = mad_f_mul(a9, -c2); | ||
1624 | |||
1625 | a18 = x[4] + a4; | ||
1626 | a19 = 2 * x[4] - a4; | ||
1627 | a20 = a19 + m5; | ||
1628 | a21 = a19 - m5; | ||
1629 | a22 = a19 + m6; | ||
1630 | a23 = m4 + m2; | ||
1631 | a24 = m4 - m2; | ||
1632 | a25 = m4 + m1; | ||
1633 | |||
1634 | /* output to every other slot for convenience */ | ||
1635 | |||
1636 | y[ 0] = a18 + a12; | ||
1637 | y[ 2] = m0 - a25; | ||
1638 | y[ 4] = m7 - a20; | ||
1639 | y[ 6] = m3; | ||
1640 | y[ 8] = a21 - m6; | ||
1641 | y[10] = a24 - m1; | ||
1642 | y[12] = a12 - 2 * a18; | ||
1643 | y[14] = a23 + m0; | ||
1644 | y[16] = a22 + m7; | ||
1645 | } | ||
1646 | |||
1647 | static inline | ||
1648 | void sdctII(mad_fixed_t const x[18], mad_fixed_t X[18]) | ||
1649 | { | ||
1650 | mad_fixed_t tmp[9]; | ||
1651 | int i; | ||
1652 | |||
1653 | /* scale[i] = 2 * cos(PI * (2 * i + 1) / (2 * 18)) */ | ||
1654 | static mad_fixed_t const scale[9] = { | ||
1655 | MAD_F(0x1fe0d3b4), MAD_F(0x1ee8dd47), MAD_F(0x1d007930), | ||
1656 | MAD_F(0x1a367e59), MAD_F(0x16a09e66), MAD_F(0x125abcf8), | ||
1657 | MAD_F(0x0d8616bc), MAD_F(0x08483ee1), MAD_F(0x02c9fad7) | ||
1658 | }; | ||
1659 | |||
1660 | /* divide the 18-point SDCT-II into two 9-point SDCT-IIs */ | ||
1661 | |||
1662 | /* even input butterfly */ | ||
1663 | |||
1664 | for (i = 0; i < 9; i += 3) { | ||
1665 | tmp[i + 0] = x[i + 0] + x[18 - (i + 0) - 1]; | ||
1666 | tmp[i + 1] = x[i + 1] + x[18 - (i + 1) - 1]; | ||
1667 | tmp[i + 2] = x[i + 2] + x[18 - (i + 2) - 1]; | ||
1668 | } | ||
1669 | |||
1670 | fastsdct(tmp, &X[0]); | ||
1671 | |||
1672 | /* odd input butterfly and scaling */ | ||
1673 | |||
1674 | for (i = 0; i < 9; i += 3) { | ||
1675 | tmp[i + 0] = mad_f_mul(x[i + 0] - x[18 - (i + 0) - 1], scale[i + 0]); | ||
1676 | tmp[i + 1] = mad_f_mul(x[i + 1] - x[18 - (i + 1) - 1], scale[i + 1]); | ||
1677 | tmp[i + 2] = mad_f_mul(x[i + 2] - x[18 - (i + 2) - 1], scale[i + 2]); | ||
1678 | } | ||
1679 | |||
1680 | fastsdct(tmp, &X[1]); | ||
1681 | |||
1682 | /* output accumulation */ | ||
1683 | |||
1684 | for (i = 3; i < 18; i += 8) { | ||
1685 | X[i + 0] -= X[(i + 0) - 2]; | ||
1686 | X[i + 2] -= X[(i + 2) - 2]; | ||
1687 | X[i + 4] -= X[(i + 4) - 2]; | ||
1688 | X[i + 6] -= X[(i + 6) - 2]; | ||
1689 | } | ||
1690 | } | ||
1691 | |||
1692 | static inline | ||
1693 | void dctIV(mad_fixed_t const y[18], mad_fixed_t X[18]) | ||
1694 | { | ||
1695 | mad_fixed_t tmp[18]; | ||
1696 | int i; | ||
1697 | |||
1698 | /* scale[i] = 2 * cos(PI * (2 * i + 1) / (4 * 18)) */ | ||
1699 | static mad_fixed_t const scale[18] = { | ||
1700 | MAD_F(0x1ff833fa), MAD_F(0x1fb9ea93), MAD_F(0x1f3dd120), | ||
1701 | MAD_F(0x1e84d969), MAD_F(0x1d906bcf), MAD_F(0x1c62648b), | ||
1702 | MAD_F(0x1afd100f), MAD_F(0x1963268b), MAD_F(0x1797c6a4), | ||
1703 | MAD_F(0x159e6f5b), MAD_F(0x137af940), MAD_F(0x11318ef3), | ||
1704 | MAD_F(0x0ec6a507), MAD_F(0x0c3ef153), MAD_F(0x099f61c5), | ||
1705 | MAD_F(0x06ed12c5), MAD_F(0x042d4544), MAD_F(0x0165547c) | ||
1706 | }; | ||
1707 | |||
1708 | /* scaling */ | ||
1709 | |||
1710 | for (i = 0; i < 18; i += 3) { | ||
1711 | tmp[i + 0] = mad_f_mul(y[i + 0], scale[i + 0]); | ||
1712 | tmp[i + 1] = mad_f_mul(y[i + 1], scale[i + 1]); | ||
1713 | tmp[i + 2] = mad_f_mul(y[i + 2], scale[i + 2]); | ||
1714 | } | ||
1715 | |||
1716 | /* SDCT-II */ | ||
1717 | |||
1718 | sdctII(tmp, X); | ||
1719 | |||
1720 | /* scale reduction and output accumulation */ | ||
1721 | |||
1722 | X[0] /= 2; | ||
1723 | for (i = 1; i < 17; i += 4) { | ||
1724 | X[i + 0] = X[i + 0] / 2 - X[(i + 0) - 1]; | ||
1725 | X[i + 1] = X[i + 1] / 2 - X[(i + 1) - 1]; | ||
1726 | X[i + 2] = X[i + 2] / 2 - X[(i + 2) - 1]; | ||
1727 | X[i + 3] = X[i + 3] / 2 - X[(i + 3) - 1]; | ||
1728 | } | ||
1729 | X[17] = X[17] / 2 - X[16]; | ||
1730 | } | ||
1731 | |||
1732 | /* | ||
1733 | * NAME:imdct36 | ||
1734 | * DESCRIPTION:perform X[18]->x[36] IMDCT using Szu-Wei Lee's fast algorithm | ||
1735 | */ | ||
1736 | static inline | ||
1737 | void imdct36(mad_fixed_t const x[18], mad_fixed_t y[36]) | ||
1738 | { | ||
1739 | mad_fixed_t tmp[18]; | ||
1740 | int i; | ||
1741 | |||
1742 | /* DCT-IV */ | ||
1743 | |||
1744 | dctIV(x, tmp); | ||
1745 | |||
1746 | /* convert 18-point DCT-IV to 36-point IMDCT */ | ||
1747 | |||
1748 | for (i = 0; i < 9; i += 3) { | ||
1749 | y[i + 0] = tmp[9 + (i + 0)]; | ||
1750 | y[i + 1] = tmp[9 + (i + 1)]; | ||
1751 | y[i + 2] = tmp[9 + (i + 2)]; | ||
1752 | } | ||
1753 | for (i = 9; i < 27; i += 3) { | ||
1754 | y[i + 0] = -tmp[36 - (9 + (i + 0)) - 1]; | ||
1755 | y[i + 1] = -tmp[36 - (9 + (i + 1)) - 1]; | ||
1756 | y[i + 2] = -tmp[36 - (9 + (i + 2)) - 1]; | ||
1757 | } | ||
1758 | for (i = 27; i < 36; i += 3) { | ||
1759 | y[i + 0] = -tmp[(i + 0) - 27]; | ||
1760 | y[i + 1] = -tmp[(i + 1) - 27]; | ||
1761 | y[i + 2] = -tmp[(i + 2) - 27]; | ||
1762 | } | ||
1763 | } | ||
1764 | # else | ||
1578 | /* | 1765 | /* |
1579 | * NAME:imdct36 | 1766 | * NAME:imdct36 |
1580 | * DESCRIPTION:perform X[18]->x[36] IMDCT | 1767 | * DESCRIPTION:perform X[18]->x[36] IMDCT |
1581 | */ | 1768 | */ |
1582 | static inline | 1769 | static inline |
1583 | void imdct36(mad_fixed_t const X[18], mad_fixed_t x[36]) | 1770 | void imdct36(mad_fixed_t const X[18], mad_fixed_t x[36]) |
1584 | { | 1771 | { |
1585 | mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7; | 1772 | mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7; |
1586 | mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15; | 1773 | mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15; |
1587 | register mad_fixed64hi_t hi; | 1774 | register mad_fixed64hi_t hi; |
1588 | register mad_fixed64lo_t lo; | 1775 | register mad_fixed64lo_t lo; |
1589 | 1776 | ||
1590 | MAD_F_ML0(hi, lo, X[4], MAD_F(0x0ec835e8)); | 1777 | MAD_F_ML0(hi, lo, X[4], MAD_F(0x0ec835e8)); |
1591 | MAD_F_MLA(hi, lo, X[13], MAD_F(0x061f78aa)); | 1778 | MAD_F_MLA(hi, lo, X[13], MAD_F(0x061f78aa)); |
1592 | 1779 | ||
1593 | t6 = MAD_F_MLZ(hi, lo); | 1780 | t6 = MAD_F_MLZ(hi, lo); |
1594 | 1781 | ||
1595 | MAD_F_MLA(hi, lo, (t14 = X[1] - X[10]), -MAD_F(0x061f78aa)); | 1782 | MAD_F_MLA(hi, lo, (t14 = X[1] - X[10]), -MAD_F(0x061f78aa)); |
1596 | MAD_F_MLA(hi, lo, (t15 = X[7] + X[16]), -MAD_F(0x0ec835e8)); | 1783 | MAD_F_MLA(hi, lo, (t15 = X[7] + X[16]), -MAD_F(0x0ec835e8)); |
1597 | 1784 | ||
1598 | t0 = MAD_F_MLZ(hi, lo); | 1785 | t0 = MAD_F_MLZ(hi, lo); |
1599 | 1786 | ||
1600 | MAD_F_MLA(hi, lo, (t8 = X[0] - X[11] - X[12]), MAD_F(0x0216a2a2)); | 1787 | MAD_F_MLA(hi, lo, (t8 = X[0] - X[11] - X[12]), MAD_F(0x0216a2a2)); |
1601 | MAD_F_MLA(hi, lo, (t9 = X[2] - X[9] - X[14]), MAD_F(0x09bd7ca0)); | 1788 | MAD_F_MLA(hi, lo, (t9 = X[2] - X[9] - X[14]), MAD_F(0x09bd7ca0)); |
1602 | MAD_F_MLA(hi, lo, (t10 = X[3] - X[8] - X[15]), -MAD_F(0x0cb19346)); | 1789 | MAD_F_MLA(hi, lo, (t10 = X[3] - X[8] - X[15]), -MAD_F(0x0cb19346)); |
1603 | MAD_F_MLA(hi, lo, (t11 = X[5] - X[6] - X[17]), -MAD_F(0x0fdcf549)); | 1790 | MAD_F_MLA(hi, lo, (t11 = X[5] - X[6] - X[17]), -MAD_F(0x0fdcf549)); |
1604 | 1791 | ||
1605 | x[7] = MAD_F_MLZ(hi, lo); | 1792 | x[7] = MAD_F_MLZ(hi, lo); |
1606 | x[10] = -x[7]; | 1793 | x[10] = -x[7]; |
1607 | 1794 | ||
1608 | MAD_F_ML0(hi, lo, t8, -MAD_F(0x0cb19346)); | 1795 | MAD_F_ML0(hi, lo, t8, -MAD_F(0x0cb19346)); |
1609 | MAD_F_MLA(hi, lo, t9, MAD_F(0x0fdcf549)); | 1796 | MAD_F_MLA(hi, lo, t9, MAD_F(0x0fdcf549)); |
1610 | MAD_F_MLA(hi, lo, t10, MAD_F(0x0216a2a2)); | 1797 | MAD_F_MLA(hi, lo, t10, MAD_F(0x0216a2a2)); |
1611 | MAD_F_MLA(hi, lo, t11, -MAD_F(0x09bd7ca0)); | 1798 | MAD_F_MLA(hi, lo, t11, -MAD_F(0x09bd7ca0)); |
1612 | 1799 | ||
1613 | x[19] = x[34] = MAD_F_MLZ(hi, lo) - t0; | 1800 | x[19] = x[34] = MAD_F_MLZ(hi, lo) - t0; |
1614 | 1801 | ||
1615 | t12 = X[0] - X[3] + X[8] - X[11] - X[12] + X[15]; | 1802 | t12 = X[0] - X[3] + X[8] - X[11] - X[12] + X[15]; |
1616 | t13 = X[2] + X[5] - X[6] - X[9] - X[14] - X[17]; | 1803 | t13 = X[2] + X[5] - X[6] - X[9] - X[14] - X[17]; |
1617 | 1804 | ||
1618 | MAD_F_ML0(hi, lo, t12, -MAD_F(0x0ec835e8)); | 1805 | MAD_F_ML0(hi, lo, t12, -MAD_F(0x0ec835e8)); |
1619 | MAD_F_MLA(hi, lo, t13, MAD_F(0x061f78aa)); | 1806 | MAD_F_MLA(hi, lo, t13, MAD_F(0x061f78aa)); |
1620 | 1807 | ||
1621 | x[22] = x[31] = MAD_F_MLZ(hi, lo) + t0; | 1808 | x[22] = x[31] = MAD_F_MLZ(hi, lo) + t0; |
1622 | 1809 | ||
1623 | MAD_F_ML0(hi, lo, X[1], -MAD_F(0x09bd7ca0)); | 1810 | MAD_F_ML0(hi, lo, X[1], -MAD_F(0x09bd7ca0)); |
1624 | MAD_F_MLA(hi, lo, X[7], MAD_F(0x0216a2a2)); | 1811 | MAD_F_MLA(hi, lo, X[7], MAD_F(0x0216a2a2)); |
1625 | MAD_F_MLA(hi, lo, X[10], -MAD_F(0x0fdcf549)); | 1812 | MAD_F_MLA(hi, lo, X[10], -MAD_F(0x0fdcf549)); |
1626 | MAD_F_MLA(hi, lo, X[16], MAD_F(0x0cb19346)); | 1813 | MAD_F_MLA(hi, lo, X[16], MAD_F(0x0cb19346)); |
1627 | 1814 | ||
1628 | t1 = MAD_F_MLZ(hi, lo) + t6; | 1815 | t1 = MAD_F_MLZ(hi, lo) + t6; |
1629 | 1816 | ||
1630 | MAD_F_ML0(hi, lo, X[0], MAD_F(0x03768962)); | 1817 | MAD_F_ML0(hi, lo, X[0], MAD_F(0x03768962)); |
1631 | MAD_F_MLA(hi, lo, X[2], MAD_F(0x0e313245)); | 1818 | MAD_F_MLA(hi, lo, X[2], MAD_F(0x0e313245)); |
1632 | MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0ffc19fd)); | 1819 | MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0ffc19fd)); |
1633 | MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0acf37ad)); | 1820 | MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0acf37ad)); |
1634 | MAD_F_MLA(hi, lo, X[6], MAD_F(0x04cfb0e2)); | 1821 | MAD_F_MLA(hi, lo, X[6], MAD_F(0x04cfb0e2)); |
1635 | MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0898c779)); | 1822 | MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0898c779)); |
1636 | MAD_F_MLA(hi, lo, X[9], MAD_F(0x0d7e8807)); | 1823 | MAD_F_MLA(hi, lo, X[9], MAD_F(0x0d7e8807)); |
1637 | MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f426cb5)); | 1824 | MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f426cb5)); |
1638 | MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0bcbe352)); | 1825 | MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0bcbe352)); |
1639 | MAD_F_MLA(hi, lo, X[14], MAD_F(0x00b2aa3e)); | 1826 | MAD_F_MLA(hi, lo, X[14], MAD_F(0x00b2aa3e)); |
1640 | MAD_F_MLA(hi, lo, X[15], -MAD_F(0x07635284)); | 1827 | MAD_F_MLA(hi, lo, X[15], -MAD_F(0x07635284)); |
1641 | MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0f9ee890)); | 1828 | MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0f9ee890)); |
1642 | 1829 | ||
1643 | x[6] = MAD_F_MLZ(hi, lo) + t1; | 1830 | x[6] = MAD_F_MLZ(hi, lo) + t1; |
1644 | x[11] = -x[6]; | 1831 | x[11] = -x[6]; |
1645 | 1832 | ||
1646 | MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f426cb5)); | 1833 | MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f426cb5)); |
1647 | MAD_F_MLA(hi, lo, X[2], -MAD_F(0x00b2aa3e)); | 1834 | MAD_F_MLA(hi, lo, X[2], -MAD_F(0x00b2aa3e)); |
1648 | MAD_F_MLA(hi, lo, X[3], MAD_F(0x0898c779)); | 1835 | MAD_F_MLA(hi, lo, X[3], MAD_F(0x0898c779)); |
1649 | MAD_F_MLA(hi, lo, X[5], MAD_F(0x0f9ee890)); | 1836 | MAD_F_MLA(hi, lo, X[5], MAD_F(0x0f9ee890)); |
1650 | MAD_F_MLA(hi, lo, X[6], MAD_F(0x0acf37ad)); | 1837 | MAD_F_MLA(hi, lo, X[6], MAD_F(0x0acf37ad)); |
1651 | MAD_F_MLA(hi, lo, X[8], -MAD_F(0x07635284)); | 1838 | MAD_F_MLA(hi, lo, X[8], -MAD_F(0x07635284)); |
1652 | MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0e313245)); | 1839 | MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0e313245)); |
1653 | MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0bcbe352)); | 1840 | MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0bcbe352)); |
1654 | MAD_F_MLA(hi, lo, X[12], -MAD_F(0x03768962)); | 1841 | MAD_F_MLA(hi, lo, X[12], -MAD_F(0x03768962)); |
1655 | MAD_F_MLA(hi, lo, X[14], MAD_F(0x0d7e8807)); | 1842 | MAD_F_MLA(hi, lo, X[14], MAD_F(0x0d7e8807)); |
1656 | MAD_F_MLA(hi, lo, X[15], MAD_F(0x0ffc19fd)); | 1843 | MAD_F_MLA(hi, lo, X[15], MAD_F(0x0ffc19fd)); |
1657 | MAD_F_MLA(hi, lo, X[17], MAD_F(0x04cfb0e2)); | 1844 | MAD_F_MLA(hi, lo, X[17], MAD_F(0x04cfb0e2)); |
1658 | 1845 | ||
1659 | x[23] = x[30] = MAD_F_MLZ(hi, lo) + t1; | 1846 | x[23] = x[30] = MAD_F_MLZ(hi, lo) + t1; |
1660 | 1847 | ||
1661 | MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0bcbe352)); | 1848 | MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0bcbe352)); |
1662 | MAD_F_MLA(hi, lo, X[2], MAD_F(0x0d7e8807)); | 1849 | MAD_F_MLA(hi, lo, X[2], MAD_F(0x0d7e8807)); |
1663 | MAD_F_MLA(hi, lo, X[3], -MAD_F(0x07635284)); | 1850 | MAD_F_MLA(hi, lo, X[3], -MAD_F(0x07635284)); |
1664 | MAD_F_MLA(hi, lo, X[5], MAD_F(0x04cfb0e2)); | 1851 | MAD_F_MLA(hi, lo, X[5], MAD_F(0x04cfb0e2)); |
1665 | MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f9ee890)); | 1852 | MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f9ee890)); |
1666 | MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0ffc19fd)); | 1853 | MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0ffc19fd)); |
1667 | MAD_F_MLA(hi, lo, X[9], -MAD_F(0x00b2aa3e)); | 1854 | MAD_F_MLA(hi, lo, X[9], -MAD_F(0x00b2aa3e)); |
1668 | MAD_F_MLA(hi, lo, X[11], MAD_F(0x03768962)); | 1855 | MAD_F_MLA(hi, lo, X[11], MAD_F(0x03768962)); |
1669 | MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0f426cb5)); | 1856 | MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0f426cb5)); |
1670 | MAD_F_MLA(hi, lo, X[14], MAD_F(0x0e313245)); | 1857 | MAD_F_MLA(hi, lo, X[14], MAD_F(0x0e313245)); |
1671 | MAD_F_MLA(hi, lo, X[15], MAD_F(0x0898c779)); | 1858 | MAD_F_MLA(hi, lo, X[15], MAD_F(0x0898c779)); |
1672 | MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0acf37ad)); | 1859 | MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0acf37ad)); |
1673 | 1860 | ||
1674 | x[18] = x[35] = MAD_F_MLZ(hi, lo) - t1; | 1861 | x[18] = x[35] = MAD_F_MLZ(hi, lo) - t1; |
1675 | 1862 | ||
1676 | MAD_F_ML0(hi, lo, X[4], MAD_F(0x061f78aa)); | 1863 | MAD_F_ML0(hi, lo, X[4], MAD_F(0x061f78aa)); |
1677 | MAD_F_MLA(hi, lo, X[13], -MAD_F(0x0ec835e8)); | 1864 | MAD_F_MLA(hi, lo, X[13], -MAD_F(0x0ec835e8)); |
1678 | 1865 | ||
1679 | t7 = MAD_F_MLZ(hi, lo); | 1866 | t7 = MAD_F_MLZ(hi, lo); |
1680 | 1867 | ||
1681 | MAD_F_MLA(hi, lo, X[1], -MAD_F(0x0cb19346)); | 1868 | MAD_F_MLA(hi, lo, X[1], -MAD_F(0x0cb19346)); |
1682 | MAD_F_MLA(hi, lo, X[7], MAD_F(0x0fdcf549)); | 1869 | MAD_F_MLA(hi, lo, X[7], MAD_F(0x0fdcf549)); |
1683 | MAD_F_MLA(hi, lo, X[10], MAD_F(0x0216a2a2)); | 1870 | MAD_F_MLA(hi, lo, X[10], MAD_F(0x0216a2a2)); |
1684 | MAD_F_MLA(hi, lo, X[16], -MAD_F(0x09bd7ca0)); | 1871 | MAD_F_MLA(hi, lo, X[16], -MAD_F(0x09bd7ca0)); |
1685 | 1872 | ||
1686 | t2 = MAD_F_MLZ(hi, lo); | 1873 | t2 = MAD_F_MLZ(hi, lo); |
1687 | 1874 | ||
1688 | MAD_F_MLA(hi, lo, X[0], MAD_F(0x04cfb0e2)); | 1875 | MAD_F_MLA(hi, lo, X[0], MAD_F(0x04cfb0e2)); |
1689 | MAD_F_MLA(hi, lo, X[2], MAD_F(0x0ffc19fd)); | 1876 | MAD_F_MLA(hi, lo, X[2], MAD_F(0x0ffc19fd)); |
1690 | MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0d7e8807)); | 1877 | MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0d7e8807)); |
1691 | MAD_F_MLA(hi, lo, X[5], MAD_F(0x03768962)); | 1878 | MAD_F_MLA(hi, lo, X[5], MAD_F(0x03768962)); |
1692 | MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0bcbe352)); | 1879 | MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0bcbe352)); |
1693 | MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0e313245)); | 1880 | MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0e313245)); |
1694 | MAD_F_MLA(hi, lo, X[9], MAD_F(0x07635284)); | 1881 | MAD_F_MLA(hi, lo, X[9], MAD_F(0x07635284)); |
1695 | MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0acf37ad)); | 1882 | MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0acf37ad)); |
1696 | MAD_F_MLA(hi, lo, X[12], MAD_F(0x0f9ee890)); | 1883 | MAD_F_MLA(hi, lo, X[12], MAD_F(0x0f9ee890)); |
1697 | MAD_F_MLA(hi, lo, X[14], MAD_F(0x0898c779)); | 1884 | MAD_F_MLA(hi, lo, X[14], MAD_F(0x0898c779)); |
1698 | MAD_F_MLA(hi, lo, X[15], MAD_F(0x00b2aa3e)); | 1885 | MAD_F_MLA(hi, lo, X[15], MAD_F(0x00b2aa3e)); |
1699 | MAD_F_MLA(hi, lo, X[17], MAD_F(0x0f426cb5)); | 1886 | MAD_F_MLA(hi, lo, X[17], MAD_F(0x0f426cb5)); |
1700 | 1887 | ||
1701 | x[5] = MAD_F_MLZ(hi, lo); | 1888 | x[5] = MAD_F_MLZ(hi, lo); |
1702 | x[12] = -x[5]; | 1889 | x[12] = -x[5]; |
1703 | 1890 | ||
1704 | MAD_F_ML0(hi, lo, X[0], MAD_F(0x0acf37ad)); | 1891 | MAD_F_ML0(hi, lo, X[0], MAD_F(0x0acf37ad)); |
1705 | MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0898c779)); | 1892 | MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0898c779)); |
1706 | MAD_F_MLA(hi, lo, X[3], MAD_F(0x0e313245)); | 1893 | MAD_F_MLA(hi, lo, X[3], MAD_F(0x0e313245)); |
1707 | MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0f426cb5)); | 1894 | MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0f426cb5)); |
1708 | MAD_F_MLA(hi, lo, X[6], -MAD_F(0x03768962)); | 1895 | MAD_F_MLA(hi, lo, X[6], -MAD_F(0x03768962)); |
1709 | MAD_F_MLA(hi, lo, X[8], MAD_F(0x00b2aa3e)); | 1896 | MAD_F_MLA(hi, lo, X[8], MAD_F(0x00b2aa3e)); |
1710 | MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0ffc19fd)); | 1897 | MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0ffc19fd)); |
1711 | MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f9ee890)); | 1898 | MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f9ee890)); |
1712 | MAD_F_MLA(hi, lo, X[12], -MAD_F(0x04cfb0e2)); | 1899 | MAD_F_MLA(hi, lo, X[12], -MAD_F(0x04cfb0e2)); |
1713 | MAD_F_MLA(hi, lo, X[14], MAD_F(0x07635284)); | 1900 | MAD_F_MLA(hi, lo, X[14], MAD_F(0x07635284)); |
1714 | MAD_F_MLA(hi, lo, X[15], MAD_F(0x0d7e8807)); | 1901 | MAD_F_MLA(hi, lo, X[15], MAD_F(0x0d7e8807)); |
1715 | MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0bcbe352)); | 1902 | MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0bcbe352)); |
1716 | 1903 | ||
1717 | x[0] = MAD_F_MLZ(hi, lo) + t2; | 1904 | x[0] = MAD_F_MLZ(hi, lo) + t2; |
1718 | x[17] = -x[0]; | 1905 | x[17] = -x[0]; |
1719 | 1906 | ||
1720 | MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f9ee890)); | 1907 | MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f9ee890)); |
1721 | MAD_F_MLA(hi, lo, X[2], -MAD_F(0x07635284)); | 1908 | MAD_F_MLA(hi, lo, X[2], -MAD_F(0x07635284)); |
1722 | MAD_F_MLA(hi, lo, X[3], -MAD_F(0x00b2aa3e)); | 1909 | MAD_F_MLA(hi, lo, X[3], -MAD_F(0x00b2aa3e)); |
1723 | MAD_F_MLA(hi, lo, X[5], MAD_F(0x0bcbe352)); | 1910 | MAD_F_MLA(hi, lo, X[5], MAD_F(0x0bcbe352)); |
1724 | MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f426cb5)); | 1911 | MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f426cb5)); |
1725 | MAD_F_MLA(hi, lo, X[8], MAD_F(0x0d7e8807)); | 1912 | MAD_F_MLA(hi, lo, X[8], MAD_F(0x0d7e8807)); |
1726 | MAD_F_MLA(hi, lo, X[9], MAD_F(0x0898c779)); | 1913 | MAD_F_MLA(hi, lo, X[9], MAD_F(0x0898c779)); |
1727 | MAD_F_MLA(hi, lo, X[11], -MAD_F(0x04cfb0e2)); | 1914 | MAD_F_MLA(hi, lo, X[11], -MAD_F(0x04cfb0e2)); |
1728 | MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0acf37ad)); | 1915 | MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0acf37ad)); |
1729 | MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0ffc19fd)); | 1916 | MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0ffc19fd)); |
1730 | MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0e313245)); | 1917 | MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0e313245)); |
1731 | MAD_F_MLA(hi, lo, X[17], -MAD_F(0x03768962)); | 1918 | MAD_F_MLA(hi, lo, X[17], -MAD_F(0x03768962)); |
1732 | 1919 | ||
1733 | x[24] = x[29] = MAD_F_MLZ(hi, lo) + t2; | 1920 | x[24] = x[29] = MAD_F_MLZ(hi, lo) + t2; |
1734 | 1921 | ||
1735 | MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0216a2a2)); | 1922 | MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0216a2a2)); |
1736 | MAD_F_MLA(hi, lo, X[7], -MAD_F(0x09bd7ca0)); | 1923 | MAD_F_MLA(hi, lo, X[7], -MAD_F(0x09bd7ca0)); |
1737 | MAD_F_MLA(hi, lo, X[10], MAD_F(0x0cb19346)); | 1924 | MAD_F_MLA(hi, lo, X[10], MAD_F(0x0cb19346)); |
1738 | MAD_F_MLA(hi, lo, X[16], MAD_F(0x0fdcf549)); | 1925 | MAD_F_MLA(hi, lo, X[16], MAD_F(0x0fdcf549)); |
1739 | 1926 | ||
1740 | t3 = MAD_F_MLZ(hi, lo) + t7; | 1927 | t3 = MAD_F_MLZ(hi, lo) + t7; |
1741 | 1928 | ||
1742 | MAD_F_ML0(hi, lo, X[0], MAD_F(0x00b2aa3e)); | 1929 | MAD_F_ML0(hi, lo, X[0], MAD_F(0x00b2aa3e)); |
1743 | MAD_F_MLA(hi, lo, X[2], MAD_F(0x03768962)); | 1930 | MAD_F_MLA(hi, lo, X[2], MAD_F(0x03768962)); |
1744 | MAD_F_MLA(hi, lo, X[3], -MAD_F(0x04cfb0e2)); | 1931 | MAD_F_MLA(hi, lo, X[3], -MAD_F(0x04cfb0e2)); |
1745 | MAD_F_MLA(hi, lo, X[5], -MAD_F(0x07635284)); | 1932 | MAD_F_MLA(hi, lo, X[5], -MAD_F(0x07635284)); |
1746 | MAD_F_MLA(hi, lo, X[6], MAD_F(0x0898c779)); | 1933 | MAD_F_MLA(hi, lo, X[6], MAD_F(0x0898c779)); |
1747 | MAD_F_MLA(hi, lo, X[8], MAD_F(0x0acf37ad)); | 1934 | MAD_F_MLA(hi, lo, X[8], MAD_F(0x0acf37ad)); |
1748 | MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0bcbe352)); | 1935 | MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0bcbe352)); |
1749 | MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0d7e8807)); | 1936 | MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0d7e8807)); |
1750 | MAD_F_MLA(hi, lo, X[12], MAD_F(0x0e313245)); | 1937 | MAD_F_MLA(hi, lo, X[12], MAD_F(0x0e313245)); |
1751 | MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f426cb5)); | 1938 | MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f426cb5)); |
1752 | MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0f9ee890)); | 1939 | MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0f9ee890)); |
1753 | MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0ffc19fd)); | 1940 | MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0ffc19fd)); |
1754 | 1941 | ||
1755 | x[8] = MAD_F_MLZ(hi, lo) + t3; | 1942 | x[8] = MAD_F_MLZ(hi, lo) + t3; |
1756 | x[9] = -x[8]; | 1943 | x[9] = -x[8]; |
1757 | 1944 | ||
1758 | MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0e313245)); | 1945 | MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0e313245)); |
1759 | MAD_F_MLA(hi, lo, X[2], MAD_F(0x0bcbe352)); | 1946 | MAD_F_MLA(hi, lo, X[2], MAD_F(0x0bcbe352)); |
1760 | MAD_F_MLA(hi, lo, X[3], MAD_F(0x0f9ee890)); | 1947 | MAD_F_MLA(hi, lo, X[3], MAD_F(0x0f9ee890)); |
1761 | MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0898c779)); | 1948 | MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0898c779)); |
1762 | MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0ffc19fd)); | 1949 | MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0ffc19fd)); |
1763 | MAD_F_MLA(hi, lo, X[8], MAD_F(0x04cfb0e2)); | 1950 | MAD_F_MLA(hi, lo, X[8], MAD_F(0x04cfb0e2)); |
1764 | MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f426cb5)); | 1951 | MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f426cb5)); |
1765 | MAD_F_MLA(hi, lo, X[11], -MAD_F(0x00b2aa3e)); | 1952 | MAD_F_MLA(hi, lo, X[11], -MAD_F(0x00b2aa3e)); |
1766 | MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0d7e8807)); | 1953 | MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0d7e8807)); |
1767 | MAD_F_MLA(hi, lo, X[14], -MAD_F(0x03768962)); | 1954 | MAD_F_MLA(hi, lo, X[14], -MAD_F(0x03768962)); |
1768 | MAD_F_MLA(hi, lo, X[15], MAD_F(0x0acf37ad)); | 1955 | MAD_F_MLA(hi, lo, X[15], MAD_F(0x0acf37ad)); |
1769 | MAD_F_MLA(hi, lo, X[17], MAD_F(0x07635284)); | 1956 | MAD_F_MLA(hi, lo, X[17], MAD_F(0x07635284)); |
1770 | 1957 | ||
1771 | x[21] = x[32] = MAD_F_MLZ(hi, lo) + t3; | 1958 | x[21] = x[32] = MAD_F_MLZ(hi, lo) + t3; |
1772 | 1959 | ||
1773 | MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0d7e8807)); | 1960 | MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0d7e8807)); |
1774 | MAD_F_MLA(hi, lo, X[2], MAD_F(0x0f426cb5)); | 1961 | MAD_F_MLA(hi, lo, X[2], MAD_F(0x0f426cb5)); |
1775 | MAD_F_MLA(hi, lo, X[3], MAD_F(0x0acf37ad)); | 1962 | MAD_F_MLA(hi, lo, X[3], MAD_F(0x0acf37ad)); |
1776 | MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0ffc19fd)); | 1963 | MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0ffc19fd)); |
1777 | MAD_F_MLA(hi, lo, X[6], -MAD_F(0x07635284)); | 1964 | MAD_F_MLA(hi, lo, X[6], -MAD_F(0x07635284)); |
1778 | MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f9ee890)); | 1965 | MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f9ee890)); |
1779 | MAD_F_MLA(hi, lo, X[9], MAD_F(0x03768962)); | 1966 | MAD_F_MLA(hi, lo, X[9], MAD_F(0x03768962)); |
1780 | MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0e313245)); | 1967 | MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0e313245)); |
1781 | MAD_F_MLA(hi, lo, X[12], MAD_F(0x00b2aa3e)); | 1968 | MAD_F_MLA(hi, lo, X[12], MAD_F(0x00b2aa3e)); |
1782 | MAD_F_MLA(hi, lo, X[14], MAD_F(0x0bcbe352)); | 1969 | MAD_F_MLA(hi, lo, X[14], MAD_F(0x0bcbe352)); |
1783 | MAD_F_MLA(hi, lo, X[15], -MAD_F(0x04cfb0e2)); | 1970 | MAD_F_MLA(hi, lo, X[15], -MAD_F(0x04cfb0e2)); |
1784 | MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0898c779)); | 1971 | MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0898c779)); |
1785 | 1972 | ||
1786 | x[20] = x[33] = MAD_F_MLZ(hi, lo) - t3; | 1973 | x[20] = x[33] = MAD_F_MLZ(hi, lo) - t3; |
1787 | 1974 | ||
1788 | MAD_F_ML0(hi, lo, t14, -MAD_F(0x0ec835e8)); | 1975 | MAD_F_ML0(hi, lo, t14, -MAD_F(0x0ec835e8)); |
1789 | MAD_F_MLA(hi, lo, t15, MAD_F(0x061f78aa)); | 1976 | MAD_F_MLA(hi, lo, t15, MAD_F(0x061f78aa)); |
1790 | 1977 | ||
1791 | t4 = MAD_F_MLZ(hi, lo) - t7; | 1978 | t4 = MAD_F_MLZ(hi, lo) - t7; |
1792 | 1979 | ||
1793 | MAD_F_ML0(hi, lo, t12, MAD_F(0x061f78aa)); | 1980 | MAD_F_ML0(hi, lo, t12, MAD_F(0x061f78aa)); |
1794 | MAD_F_MLA(hi, lo, t13, MAD_F(0x0ec835e8)); | 1981 | MAD_F_MLA(hi, lo, t13, MAD_F(0x0ec835e8)); |
1795 | 1982 | ||
1796 | x[4] = MAD_F_MLZ(hi, lo) + t4; | 1983 | x[4] = MAD_F_MLZ(hi, lo) + t4; |
1797 | x[13] = -x[4]; | 1984 | x[13] = -x[4]; |
1798 | 1985 | ||
1799 | MAD_F_ML0(hi, lo, t8, MAD_F(0x09bd7ca0)); | 1986 | MAD_F_ML0(hi, lo, t8, MAD_F(0x09bd7ca0)); |
1800 | MAD_F_MLA(hi, lo, t9, -MAD_F(0x0216a2a2)); | 1987 | MAD_F_MLA(hi, lo, t9, -MAD_F(0x0216a2a2)); |
1801 | MAD_F_MLA(hi, lo, t10, MAD_F(0x0fdcf549)); | 1988 | MAD_F_MLA(hi, lo, t10, MAD_F(0x0fdcf549)); |
1802 | MAD_F_MLA(hi, lo, t11, -MAD_F(0x0cb19346)); | 1989 | MAD_F_MLA(hi, lo, t11, -MAD_F(0x0cb19346)); |
1803 | 1990 | ||
1804 | x[1] = MAD_F_MLZ(hi, lo) + t4; | 1991 | x[1] = MAD_F_MLZ(hi, lo) + t4; |
1805 | x[16] = -x[1]; | 1992 | x[16] = -x[1]; |
1806 | 1993 | ||
1807 | MAD_F_ML0(hi, lo, t8, -MAD_F(0x0fdcf549)); | 1994 | MAD_F_ML0(hi, lo, t8, -MAD_F(0x0fdcf549)); |
1808 | MAD_F_MLA(hi, lo, t9, -MAD_F(0x0cb19346)); | 1995 | MAD_F_MLA(hi, lo, t9, -MAD_F(0x0cb19346)); |
1809 | MAD_F_MLA(hi, lo, t10, -MAD_F(0x09bd7ca0)); | 1996 | MAD_F_MLA(hi, lo, t10, -MAD_F(0x09bd7ca0)); |
1810 | MAD_F_MLA(hi, lo, t11, -MAD_F(0x0216a2a2)); | 1997 | MAD_F_MLA(hi, lo, t11, -MAD_F(0x0216a2a2)); |
1811 | 1998 | ||
1812 | x[25] = x[28] = MAD_F_MLZ(hi, lo) + t4; | 1999 | x[25] = x[28] = MAD_F_MLZ(hi, lo) + t4; |
1813 | 2000 | ||
1814 | MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0fdcf549)); | 2001 | MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0fdcf549)); |
1815 | MAD_F_MLA(hi, lo, X[7], -MAD_F(0x0cb19346)); | 2002 | MAD_F_MLA(hi, lo, X[7], -MAD_F(0x0cb19346)); |
1816 | MAD_F_MLA(hi, lo, X[10], -MAD_F(0x09bd7ca0)); | 2003 | MAD_F_MLA(hi, lo, X[10], -MAD_F(0x09bd7ca0)); |
1817 | MAD_F_MLA(hi, lo, X[16], -MAD_F(0x0216a2a2)); | 2004 | MAD_F_MLA(hi, lo, X[16], -MAD_F(0x0216a2a2)); |
1818 | 2005 | ||
1819 | t5 = MAD_F_MLZ(hi, lo) - t6; | 2006 | t5 = MAD_F_MLZ(hi, lo) - t6; |
1820 | 2007 | ||
1821 | MAD_F_ML0(hi, lo, X[0], MAD_F(0x0898c779)); | 2008 | MAD_F_ML0(hi, lo, X[0], MAD_F(0x0898c779)); |
1822 | MAD_F_MLA(hi, lo, X[2], MAD_F(0x04cfb0e2)); | 2009 | MAD_F_MLA(hi, lo, X[2], MAD_F(0x04cfb0e2)); |
1823 | MAD_F_MLA(hi, lo, X[3], MAD_F(0x0bcbe352)); | 2010 | MAD_F_MLA(hi, lo, X[3], MAD_F(0x0bcbe352)); |
1824 | MAD_F_MLA(hi, lo, X[5], MAD_F(0x00b2aa3e)); | 2011 | MAD_F_MLA(hi, lo, X[5], MAD_F(0x00b2aa3e)); |
1825 | MAD_F_MLA(hi, lo, X[6], MAD_F(0x0e313245)); | 2012 | MAD_F_MLA(hi, lo, X[6], MAD_F(0x0e313245)); |
1826 | MAD_F_MLA(hi, lo, X[8], -MAD_F(0x03768962)); | 2013 | MAD_F_MLA(hi, lo, X[8], -MAD_F(0x03768962)); |
1827 | MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f9ee890)); | 2014 | MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f9ee890)); |
1828 | MAD_F_MLA(hi, lo, X[11], -MAD_F(0x07635284)); | 2015 | MAD_F_MLA(hi, lo, X[11], -MAD_F(0x07635284)); |
1829 | MAD_F_MLA(hi, lo, X[12], MAD_F(0x0ffc19fd)); | 2016 | MAD_F_MLA(hi, lo, X[12], MAD_F(0x0ffc19fd)); |
1830 | MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0acf37ad)); | 2017 | MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0acf37ad)); |
1831 | MAD_F_MLA(hi, lo, X[15], MAD_F(0x0f426cb5)); | 2018 | MAD_F_MLA(hi, lo, X[15], MAD_F(0x0f426cb5)); |
1832 | MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0d7e8807)); | 2019 | MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0d7e8807)); |
1833 | 2020 | ||
1834 | x[2] = MAD_F_MLZ(hi, lo) + t5; | 2021 | x[2] = MAD_F_MLZ(hi, lo) + t5; |
1835 | x[15] = -x[2]; | 2022 | x[15] = -x[2]; |
1836 | 2023 | ||
1837 | MAD_F_ML0(hi, lo, X[0], MAD_F(0x07635284)); | 2024 | MAD_F_ML0(hi, lo, X[0], MAD_F(0x07635284)); |
1838 | MAD_F_MLA(hi, lo, X[2], MAD_F(0x0acf37ad)); | 2025 | MAD_F_MLA(hi, lo, X[2], MAD_F(0x0acf37ad)); |
1839 | MAD_F_MLA(hi, lo, X[3], MAD_F(0x03768962)); | 2026 | MAD_F_MLA(hi, lo, X[3], MAD_F(0x03768962)); |
1840 | MAD_F_MLA(hi, lo, X[5], MAD_F(0x0d7e8807)); | 2027 | MAD_F_MLA(hi, lo, X[5], MAD_F(0x0d7e8807)); |
1841 | MAD_F_MLA(hi, lo, X[6], -MAD_F(0x00b2aa3e)); | 2028 | MAD_F_MLA(hi, lo, X[6], -MAD_F(0x00b2aa3e)); |
1842 | MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f426cb5)); | 2029 | MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f426cb5)); |
1843 | MAD_F_MLA(hi, lo, X[9], -MAD_F(0x04cfb0e2)); | 2030 | MAD_F_MLA(hi, lo, X[9], -MAD_F(0x04cfb0e2)); |
1844 | MAD_F_MLA(hi, lo, X[11], MAD_F(0x0ffc19fd)); | 2031 | MAD_F_MLA(hi, lo, X[11], MAD_F(0x0ffc19fd)); |
1845 | MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0898c779)); | 2032 | MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0898c779)); |
1846 | MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f9ee890)); | 2033 | MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f9ee890)); |
1847 | MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0bcbe352)); | 2034 | MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0bcbe352)); |
1848 | MAD_F_MLA(hi, lo, X[17], MAD_F(0x0e313245)); | 2035 | MAD_F_MLA(hi, lo, X[17], MAD_F(0x0e313245)); |
1849 | 2036 | ||
1850 | x[3] = MAD_F_MLZ(hi, lo) + t5; | 2037 | x[3] = MAD_F_MLZ(hi, lo) + t5; |
1851 | x[14] = -x[3]; | 2038 | x[14] = -x[3]; |
1852 | 2039 | ||
1853 | MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0ffc19fd)); | 2040 | MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0ffc19fd)); |
1854 | MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0f9ee890)); | 2041 | MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0f9ee890)); |
1855 | MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0f426cb5)); | 2042 | MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0f426cb5)); |
1856 | MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0e313245)); | 2043 | MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0e313245)); |
1857 | MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0d7e8807)); | 2044 | MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0d7e8807)); |
1858 | MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0bcbe352)); | 2045 | MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0bcbe352)); |
1859 | MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0acf37ad)); | 2046 | MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0acf37ad)); |
1860 | MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0898c779)); | 2047 | MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0898c779)); |
1861 | MAD_F_MLA(hi, lo, X[12], -MAD_F(0x07635284)); | 2048 | MAD_F_MLA(hi, lo, X[12], -MAD_F(0x07635284)); |
1862 | MAD_F_MLA(hi, lo, X[14], -MAD_F(0x04cfb0e2)); | 2049 | MAD_F_MLA(hi, lo, X[14], -MAD_F(0x04cfb0e2)); |
1863 | MAD_F_MLA(hi, lo, X[15], -MAD_F(0x03768962)); | 2050 | MAD_F_MLA(hi, lo, X[15], -MAD_F(0x03768962)); |
1864 | MAD_F_MLA(hi, lo, X[17], -MAD_F(0x00b2aa3e)); | 2051 | MAD_F_MLA(hi, lo, X[17], -MAD_F(0x00b2aa3e)); |
1865 | 2052 | ||
1866 | x[26] = x[27] = MAD_F_MLZ(hi, lo) + t5; | 2053 | x[26] = x[27] = MAD_F_MLZ(hi, lo) + t5; |
1867 | } | 2054 | } |
2055 | # endif | ||
1868 | 2056 | ||
1869 | /* | 2057 | /* |
1870 | * NAME:III_imdct_l() | 2058 | * NAME:III_imdct_l() |
1871 | * DESCRIPTION:perform IMDCT and windowing for long blocks | 2059 | * DESCRIPTION:perform IMDCT and windowing for long blocks |
1872 | */ | 2060 | */ |
1873 | static | 2061 | static |
1874 | void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36], | 2062 | void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36], |
1875 | unsigned int block_type) | 2063 | unsigned int block_type) |
1876 | { | 2064 | { |
1877 | unsigned int i; | 2065 | unsigned int i; |
1878 | 2066 | ||
1879 | /* IMDCT */ | 2067 | /* IMDCT */ |
1880 | 2068 | ||
1881 | imdct36(X, z); | 2069 | imdct36(X, z); |
1882 | 2070 | ||
1883 | /* windowing */ | 2071 | /* windowing */ |
1884 | 2072 | ||
1885 | switch (block_type) { | 2073 | switch (block_type) { |
1886 | case 0: /* normal window */ | 2074 | case 0: /* normal window */ |
1887 | # if defined(ASO_INTERLEAVE1) | 2075 | # if defined(ASO_INTERLEAVE1) |
1888 | { | 2076 | { |
1889 | register mad_fixed_t tmp1, tmp2; | 2077 | register mad_fixed_t tmp1, tmp2; |
1890 | 2078 | ||
1891 | tmp1 = window_l[0]; | 2079 | tmp1 = window_l[0]; |
1892 | tmp2 = window_l[1]; | 2080 | tmp2 = window_l[1]; |
1893 | 2081 | ||
1894 | for (i = 0; i < 34; i += 2) { | 2082 | for (i = 0; i < 34; i += 2) { |
1895 | z[i + 0] = mad_f_mul(z[i + 0], tmp1); | 2083 | z[i + 0] = mad_f_mul(z[i + 0], tmp1); |
1896 | tmp1 = window_l[i + 2]; | 2084 | tmp1 = window_l[i + 2]; |
1897 | z[i + 1] = mad_f_mul(z[i + 1], tmp2); | 2085 | z[i + 1] = mad_f_mul(z[i + 1], tmp2); |
1898 | tmp2 = window_l[i + 3]; | 2086 | tmp2 = window_l[i + 3]; |
1899 | } | 2087 | } |
1900 | 2088 | ||
1901 | z[34] = mad_f_mul(z[34], tmp1); | 2089 | z[34] = mad_f_mul(z[34], tmp1); |
1902 | z[35] = mad_f_mul(z[35], tmp2); | 2090 | z[35] = mad_f_mul(z[35], tmp2); |
1903 | } | 2091 | } |
1904 | # elif defined(ASO_INTERLEAVE2) | 2092 | # elif defined(ASO_INTERLEAVE2) |
1905 | { | 2093 | { |
1906 | register mad_fixed_t tmp1, tmp2; | 2094 | register mad_fixed_t tmp1, tmp2; |
1907 | 2095 | ||
1908 | tmp1 = z[0]; | 2096 | tmp1 = z[0]; |
1909 | tmp2 = window_l[0]; | 2097 | tmp2 = window_l[0]; |
1910 | 2098 | ||
1911 | for (i = 0; i < 35; ++i) { | 2099 | for (i = 0; i < 35; ++i) { |
1912 | z[i] = mad_f_mul(tmp1, tmp2); | 2100 | z[i] = mad_f_mul(tmp1, tmp2); |
1913 | tmp1 = z[i + 1]; | 2101 | tmp1 = z[i + 1]; |
1914 | tmp2 = window_l[i + 1]; | 2102 | tmp2 = window_l[i + 1]; |
1915 | } | 2103 | } |
1916 | 2104 | ||
1917 | z[35] = mad_f_mul(tmp1, tmp2); | 2105 | z[35] = mad_f_mul(tmp1, tmp2); |
1918 | } | 2106 | } |
1919 | # elif 1 | 2107 | # elif 1 |
1920 | for (i = 0; i < 36; i += 4) { | 2108 | for (i = 0; i < 36; i += 4) { |
1921 | z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]); | 2109 | z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]); |
1922 | z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]); | 2110 | z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]); |
1923 | z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]); | 2111 | z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]); |
1924 | z[i + 3] = mad_f_mul(z[i + 3], window_l[i + 3]); | 2112 | z[i + 3] = mad_f_mul(z[i + 3], window_l[i + 3]); |
1925 | } | 2113 | } |
1926 | # else | 2114 | # else |
1927 | for (i = 0; i < 36; ++i) z[i] = mad_f_mul(z[i], window_l[i]); | 2115 | for (i = 0; i < 36; ++i) z[i] = mad_f_mul(z[i], window_l[i]); |
1928 | # endif | 2116 | # endif |
1929 | break; | 2117 | break; |
1930 | 2118 | ||
1931 | case 1: /* start block */ | 2119 | case 1: /* start block */ |
1932 | for (i = 0; i < 18; ++i) z[i] = mad_f_mul(z[i], window_l[i]); | 2120 | for (i = 0; i < 18; i += 3) { |
2121 | z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]); | ||
2122 | z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]); | ||
2123 | z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]); | ||
2124 | } | ||
1933 | /* (i = 18; i < 24; ++i) z[i] unchanged */ | 2125 | /* (i = 18; i < 24; ++i) z[i] unchanged */ |
1934 | for (i = 24; i < 30; ++i) z[i] = mad_f_mul(z[i], window_s[i - 18]); | 2126 | for (i = 24; i < 30; ++i) z[i] = mad_f_mul(z[i], window_s[i - 18]); |
1935 | for (i = 30; i < 36; ++i) z[i] = 0; | 2127 | for (i = 30; i < 36; ++i) z[i] = 0; |
1936 | break; | 2128 | break; |
1937 | 2129 | ||
1938 | case 3: /* stop block */ | 2130 | case 3: /* stop block */ |
1939 | for (i = 0; i < 6; ++i) z[i] = 0; | 2131 | for (i = 0; i < 6; ++i) z[i] = 0; |
1940 | for (i = 6; i < 12; ++i) z[i] = mad_f_mul(z[i], window_s[i - 6]); | 2132 | for (i = 6; i < 12; ++i) z[i] = mad_f_mul(z[i], window_s[i - 6]); |
1941 | /* (i = 12; i < 18; ++i) z[i] unchanged */ | 2133 | /* (i = 12; i < 18; ++i) z[i] unchanged */ |
1942 | for (i = 18; i < 36; ++i) z[i] = mad_f_mul(z[i], window_l[i]); | 2134 | for (i = 18; i < 36; i += 3) { |
2135 | z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]); | ||
2136 | z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]); | ||
2137 | z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]); | ||
2138 | } | ||
1943 | break; | 2139 | break; |
1944 | } | 2140 | } |
1945 | } | 2141 | } |
1946 | # endif /* ASO_IMDCT */ | 2142 | # endif /* ASO_IMDCT */ |
1947 | 2143 | ||
1948 | /* | 2144 | /* |
1949 | * NAME:III_imdct_s() | 2145 | * NAME:III_imdct_s() |
1950 | * DESCRIPTION:perform IMDCT and windowing for short blocks | 2146 | * DESCRIPTION:perform IMDCT and windowing for short blocks |
1951 | */ | 2147 | */ |
1952 | static | 2148 | static |
1953 | void III_imdct_s(mad_fixed_t const X[18], mad_fixed_t z[36]) | 2149 | void III_imdct_s(mad_fixed_t const X[18], mad_fixed_t z[36]) |
1954 | { | 2150 | { |
1955 | mad_fixed_t y[36], *yptr; | 2151 | mad_fixed_t y[36], *yptr; |
1956 | mad_fixed_t const *wptr; | 2152 | mad_fixed_t const *wptr; |
1957 | int w, i; | 2153 | int w, i; |
1958 | register mad_fixed64hi_t hi; | 2154 | register mad_fixed64hi_t hi; |
1959 | register mad_fixed64lo_t lo; | 2155 | register mad_fixed64lo_t lo; |
1960 | 2156 | ||
1961 | /* IMDCT */ | 2157 | /* IMDCT */ |
1962 | 2158 | ||
1963 | yptr = &y[0]; | 2159 | yptr = &y[0]; |
1964 | 2160 | ||
1965 | for (w = 0; w < 3; ++w) { | 2161 | for (w = 0; w < 3; ++w) { |
1966 | register mad_fixed_t const (*s)[6]; | 2162 | register mad_fixed_t const (*s)[6]; |
1967 | 2163 | ||
1968 | s = imdct_s; | 2164 | s = imdct_s; |
1969 | 2165 | ||
1970 | for (i = 0; i < 3; ++i) { | 2166 | for (i = 0; i < 3; ++i) { |
1971 | MAD_F_ML0(hi, lo, X[0], (*s)[0]); | 2167 | MAD_F_ML0(hi, lo, X[0], (*s)[0]); |
1972 | MAD_F_MLA(hi, lo, X[1], (*s)[1]); | 2168 | MAD_F_MLA(hi, lo, X[1], (*s)[1]); |
1973 | MAD_F_MLA(hi, lo, X[2], (*s)[2]); | 2169 | MAD_F_MLA(hi, lo, X[2], (*s)[2]); |
1974 | MAD_F_MLA(hi, lo, X[3], (*s)[3]); | 2170 | MAD_F_MLA(hi, lo, X[3], (*s)[3]); |
1975 | MAD_F_MLA(hi, lo, X[4], (*s)[4]); | 2171 | MAD_F_MLA(hi, lo, X[4], (*s)[4]); |
1976 | MAD_F_MLA(hi, lo, X[5], (*s)[5]); | 2172 | MAD_F_MLA(hi, lo, X[5], (*s)[5]); |
1977 | 2173 | ||
1978 | yptr[i + 0] = MAD_F_MLZ(hi, lo); | 2174 | yptr[i + 0] = MAD_F_MLZ(hi, lo); |
1979 | yptr[5 - i] = -yptr[i + 0]; | 2175 | yptr[5 - i] = -yptr[i + 0]; |
1980 | 2176 | ||
1981 | ++s; | 2177 | ++s; |
1982 | 2178 | ||
1983 | MAD_F_ML0(hi, lo, X[0], (*s)[0]); | 2179 | MAD_F_ML0(hi, lo, X[0], (*s)[0]); |
1984 | MAD_F_MLA(hi, lo, X[1], (*s)[1]); | 2180 | MAD_F_MLA(hi, lo, X[1], (*s)[1]); |
1985 | MAD_F_MLA(hi, lo, X[2], (*s)[2]); | 2181 | MAD_F_MLA(hi, lo, X[2], (*s)[2]); |
1986 | MAD_F_MLA(hi, lo, X[3], (*s)[3]); | 2182 | MAD_F_MLA(hi, lo, X[3], (*s)[3]); |
1987 | MAD_F_MLA(hi, lo, X[4], (*s)[4]); | 2183 | MAD_F_MLA(hi, lo, X[4], (*s)[4]); |
1988 | MAD_F_MLA(hi, lo, X[5], (*s)[5]); | 2184 | MAD_F_MLA(hi, lo, X[5], (*s)[5]); |
1989 | 2185 | ||
1990 | yptr[ i + 6] = MAD_F_MLZ(hi, lo); | 2186 | yptr[ i + 6] = MAD_F_MLZ(hi, lo); |
1991 | yptr[11 - i] = yptr[i + 6]; | 2187 | yptr[11 - i] = yptr[i + 6]; |
1992 | 2188 | ||
1993 | ++s; | 2189 | ++s; |
1994 | } | 2190 | } |
1995 | 2191 | ||
1996 | yptr += 12; | 2192 | yptr += 12; |
1997 | X += 6; | 2193 | X += 6; |
1998 | } | 2194 | } |
1999 | 2195 | ||
2000 | /* windowing, overlapping and concatenation */ | 2196 | /* windowing, overlapping and concatenation */ |
2001 | 2197 | ||
2002 | yptr = &y[0]; | 2198 | yptr = &y[0]; |
2003 | wptr = &window_s[0]; | 2199 | wptr = &window_s[0]; |
2004 | 2200 | ||
2005 | for (i = 0; i < 6; ++i) { | 2201 | for (i = 0; i < 6; ++i) { |
2006 | z[i + 0] = 0; | 2202 | z[i + 0] = 0; |
2007 | z[i + 6] = mad_f_mul(yptr[ 0 + 0], wptr[0]); | 2203 | z[i + 6] = mad_f_mul(yptr[ 0 + 0], wptr[0]); |
2008 | 2204 | ||
2009 | MAD_F_ML0(hi, lo, yptr[ 0 + 6], wptr[6]); | 2205 | MAD_F_ML0(hi, lo, yptr[ 0 + 6], wptr[6]); |
2010 | MAD_F_MLA(hi, lo, yptr[12 + 0], wptr[0]); | 2206 | MAD_F_MLA(hi, lo, yptr[12 + 0], wptr[0]); |
2011 | 2207 | ||
2012 | z[i + 12] = MAD_F_MLZ(hi, lo); | 2208 | z[i + 12] = MAD_F_MLZ(hi, lo); |
2013 | 2209 | ||
2014 | MAD_F_ML0(hi, lo, yptr[12 + 6], wptr[6]); | 2210 | MAD_F_ML0(hi, lo, yptr[12 + 6], wptr[6]); |
2015 | MAD_F_MLA(hi, lo, yptr[24 + 0], wptr[0]); | 2211 | MAD_F_MLA(hi, lo, yptr[24 + 0], wptr[0]); |
2016 | 2212 | ||
2017 | z[i + 18] = MAD_F_MLZ(hi, lo); | 2213 | z[i + 18] = MAD_F_MLZ(hi, lo); |
2018 | 2214 | ||
2019 | z[i + 24] = mad_f_mul(yptr[24 + 6], wptr[6]); | 2215 | z[i + 24] = mad_f_mul(yptr[24 + 6], wptr[6]); |
2020 | z[i + 30] = 0; | 2216 | z[i + 30] = 0; |
2021 | 2217 | ||
2022 | ++yptr; | 2218 | ++yptr; |
2023 | ++wptr; | 2219 | ++wptr; |
2024 | } | 2220 | } |
2025 | } | 2221 | } |
2026 | 2222 | ||
2027 | /* | 2223 | /* |
2028 | * NAME:III_overlap() | 2224 | * NAME:III_overlap() |
2029 | * DESCRIPTION:perform overlap-add of windowed IMDCT outputs | 2225 | * DESCRIPTION:perform overlap-add of windowed IMDCT outputs |
2030 | */ | 2226 | */ |
2031 | static | 2227 | static |
2032 | void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], | 2228 | void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], |
2033 | mad_fixed_t sample[18][32], unsigned int sb) | 2229 | mad_fixed_t sample[18][32], unsigned int sb) |
2034 | { | 2230 | { |
2035 | unsigned int i; | 2231 | unsigned int i; |
2036 | 2232 | ||
2037 | # if defined(ASO_INTERLEAVE2) | 2233 | # if defined(ASO_INTERLEAVE2) |
2038 | { | 2234 | { |
2039 | register mad_fixed_t tmp1, tmp2; | 2235 | register mad_fixed_t tmp1, tmp2; |
2040 | 2236 | ||
2041 | tmp1 = overlap[0]; | 2237 | tmp1 = overlap[0]; |
2042 | tmp2 = overlap[1]; | 2238 | tmp2 = overlap[1]; |
2043 | 2239 | ||
2044 | for (i = 0; i < 16; i += 2) { | 2240 | for (i = 0; i < 16; i += 2) { |
2045 | sample[i + 0][sb] = output[i + 0] + tmp1; | 2241 | sample[i + 0][sb] = output[i + 0 + 0] + tmp1; |
2046 | overlap[i + 0] = output[i + 0 + 18]; | 2242 | overlap[i + 0] = output[i + 0 + 18]; |
2047 | tmp1 = overlap[i + 2]; | 2243 | tmp1 = overlap[i + 2]; |
2048 | 2244 | ||
2049 | sample[i + 1][sb] = output[i + 1] + tmp2; | 2245 | sample[i + 1][sb] = output[i + 1 + 0] + tmp2; |
2050 | overlap[i + 1] = output[i + 1 + 18]; | 2246 | overlap[i + 1] = output[i + 1 + 18]; |
2051 | tmp2 = overlap[i + 3]; | 2247 | tmp2 = overlap[i + 3]; |
2052 | } | 2248 | } |
2053 | 2249 | ||
2054 | sample[16][sb] = output[16] + tmp1; | 2250 | sample[16][sb] = output[16 + 0] + tmp1; |
2055 | overlap[16] = output[16 + 18]; | 2251 | overlap[16] = output[16 + 18]; |
2056 | sample[17][sb] = output[17] + tmp2; | 2252 | sample[17][sb] = output[17 + 0] + tmp2; |
2057 | overlap[17] = output[17 + 18]; | 2253 | overlap[17] = output[17 + 18]; |
2058 | } | 2254 | } |
2059 | # elif 0 | 2255 | # elif 0 |
2060 | for (i = 0; i < 18; i += 2) { | 2256 | for (i = 0; i < 18; i += 2) { |
2061 | sample[i + 0][sb] = output[i + 0] + overlap[i + 0]; | 2257 | sample[i + 0][sb] = output[i + 0 + 0] + overlap[i + 0]; |
2062 | overlap[i + 0] = output[i + 0 + 18]; | 2258 | overlap[i + 0] = output[i + 0 + 18]; |
2063 | 2259 | ||
2064 | sample[i + 1][sb] = output[i + 1] + overlap[i + 1]; | 2260 | sample[i + 1][sb] = output[i + 1 + 0] + overlap[i + 1]; |
2065 | overlap[i + 1] = output[i + 1 + 18]; | 2261 | overlap[i + 1] = output[i + 1 + 18]; |
2066 | } | 2262 | } |
2067 | # else | 2263 | # else |
2068 | for (i = 0; i < 18; ++i) { | 2264 | for (i = 0; i < 18; ++i) { |
2069 | sample[i][sb] = output[i] + overlap[i]; | 2265 | sample[i][sb] = output[i + 0] + overlap[i]; |
2070 | overlap[i] = output[i + 18]; | 2266 | overlap[i] = output[i + 18]; |
2071 | } | 2267 | } |
2072 | # endif | 2268 | # endif |
2073 | } | 2269 | } |
2074 | 2270 | ||
2075 | /* | 2271 | /* |
2076 | * NAME:III_overlap_z() | 2272 | * NAME:III_overlap_z() |
2077 | * DESCRIPTION:perform "overlap-add" of zero IMDCT outputs | 2273 | * DESCRIPTION:perform "overlap-add" of zero IMDCT outputs |
2078 | */ | 2274 | */ |
2079 | static inline | 2275 | static inline |
2080 | void III_overlap_z(mad_fixed_t overlap[18], | 2276 | void III_overlap_z(mad_fixed_t overlap[18], |
2081 | mad_fixed_t sample[18][32], unsigned int sb) | 2277 | mad_fixed_t sample[18][32], unsigned int sb) |
2082 | { | 2278 | { |
2083 | unsigned int i; | 2279 | unsigned int i; |
2084 | 2280 | ||
2085 | # if defined(ASO_INTERLEAVE2) | 2281 | # if defined(ASO_INTERLEAVE2) |
2086 | { | 2282 | { |
2087 | register mad_fixed_t tmp1, tmp2; | 2283 | register mad_fixed_t tmp1, tmp2; |
2088 | 2284 | ||
2089 | tmp1 = overlap[0]; | 2285 | tmp1 = overlap[0]; |
2090 | tmp2 = overlap[1]; | 2286 | tmp2 = overlap[1]; |
2091 | 2287 | ||
2092 | for (i = 0; i < 16; i += 2) { | 2288 | for (i = 0; i < 16; i += 2) { |
2093 | sample[i + 0][sb] = tmp1; | 2289 | sample[i + 0][sb] = tmp1; |
2094 | overlap[i + 0] = 0; | 2290 | overlap[i + 0] = 0; |
2095 | tmp1 = overlap[i + 2]; | 2291 | tmp1 = overlap[i + 2]; |
2096 | 2292 | ||
2097 | sample[i + 1][sb] = tmp2; | 2293 | sample[i + 1][sb] = tmp2; |
2098 | overlap[i + 1] = 0; | 2294 | overlap[i + 1] = 0; |
2099 | tmp2 = overlap[i + 3]; | 2295 | tmp2 = overlap[i + 3]; |
2100 | } | 2296 | } |
2101 | 2297 | ||
2102 | sample[16][sb] = tmp1; | 2298 | sample[16][sb] = tmp1; |
2103 | overlap[16] = 0; | 2299 | overlap[16] = 0; |
2104 | sample[17][sb] = tmp2; | 2300 | sample[17][sb] = tmp2; |
2105 | overlap[17] = 0; | 2301 | overlap[17] = 0; |
2106 | } | 2302 | } |
2107 | # else | 2303 | # else |
2108 | for (i = 0; i < 18; ++i) { | 2304 | for (i = 0; i < 18; ++i) { |
2109 | sample[i][sb] = overlap[i]; | 2305 | sample[i][sb] = overlap[i]; |
2110 | overlap[i] = 0; | 2306 | overlap[i] = 0; |
2111 | } | 2307 | } |
2112 | # endif | 2308 | # endif |
2113 | } | 2309 | } |
2114 | 2310 | ||
2115 | /* | 2311 | /* |
2116 | * NAME:III_freqinver() | 2312 | * NAME:III_freqinver() |
2117 | * DESCRIPTION:perform subband frequency inversion for odd sample lines | 2313 | * DESCRIPTION:perform subband frequency inversion for odd sample lines |
2118 | */ | 2314 | */ |
2119 | static | 2315 | static |
2120 | void III_freqinver(mad_fixed_t sample[18][32], unsigned int sb) | 2316 | void III_freqinver(mad_fixed_t sample[18][32], unsigned int sb) |
2121 | { | 2317 | { |
2122 | unsigned int i; | 2318 | unsigned int i; |
2123 | 2319 | ||
2124 | # if 1 || defined(ASO_INTERLEAVE1) || defined(ASO_INTERLEAVE2) | 2320 | # if 1 || defined(ASO_INTERLEAVE1) || defined(ASO_INTERLEAVE2) |
2125 | { | 2321 | { |
2126 | register mad_fixed_t tmp1, tmp2; | 2322 | register mad_fixed_t tmp1, tmp2; |
2127 | 2323 | ||
2128 | tmp1 = sample[1][sb]; | 2324 | tmp1 = sample[1][sb]; |
2129 | tmp2 = sample[3][sb]; | 2325 | tmp2 = sample[3][sb]; |
2130 | 2326 | ||
2131 | for (i = 1; i < 13; i += 4) { | 2327 | for (i = 1; i < 13; i += 4) { |
2132 | sample[i + 0][sb] = -tmp1; | 2328 | sample[i + 0][sb] = -tmp1; |
2133 | tmp1 = sample[i + 4][sb]; | 2329 | tmp1 = sample[i + 4][sb]; |
2134 | sample[i + 2][sb] = -tmp2; | 2330 | sample[i + 2][sb] = -tmp2; |
2135 | tmp2 = sample[i + 6][sb]; | 2331 | tmp2 = sample[i + 6][sb]; |
2136 | } | 2332 | } |
2137 | 2333 | ||
2138 | sample[13][sb] = -tmp1; | 2334 | sample[13][sb] = -tmp1; |
2139 | tmp1 = sample[17][sb]; | 2335 | tmp1 = sample[17][sb]; |
2140 | sample[15][sb] = -tmp2; | 2336 | sample[15][sb] = -tmp2; |
2141 | sample[17][sb] = -tmp1; | 2337 | sample[17][sb] = -tmp1; |
2142 | } | 2338 | } |
2143 | # else | 2339 | # else |
2144 | for (i = 1; i < 18; i += 2) | 2340 | for (i = 1; i < 18; i += 2) |
2145 | sample[i][sb] = -sample[i][sb]; | 2341 | sample[i][sb] = -sample[i][sb]; |
2146 | # endif | 2342 | # endif |
2147 | } | 2343 | } |
2148 | 2344 | ||
2149 | /* | 2345 | /* |
2150 | * NAME:III_decode() | 2346 | * NAME:III_decode() |
2151 | * DESCRIPTION:decode frame main_data | 2347 | * DESCRIPTION:decode frame main_data |
2152 | */ | 2348 | */ |
2153 | static | 2349 | static |
2154 | enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, | 2350 | enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, |
2155 | struct sideinfo *si, unsigned int nch) | 2351 | struct sideinfo *si, unsigned int nch) |
2156 | { | 2352 | { |
2157 | struct mad_header *header = &frame->header; | 2353 | struct mad_header *header = &frame->header; |
2158 | unsigned int sfreqi, ngr, gr; | 2354 | unsigned int sfreqi, ngr, gr; |
2159 | 2355 | ||
2160 | { | 2356 | { |
2161 | unsigned int sfreq; | 2357 | unsigned int sfreq; |
2162 | 2358 | ||
2163 | sfreq = header->samplerate; | 2359 | sfreq = header->samplerate; |
2164 | if (header->flags & MAD_FLAG_MPEG_2_5_EXT) | 2360 | if (header->flags & MAD_FLAG_MPEG_2_5_EXT) |
2165 | sfreq *= 2; | 2361 | sfreq *= 2; |
2166 | 2362 | ||
2167 | /* 48000 => 0, 44100 => 1, 32000 => 2, | 2363 | /* 48000 => 0, 44100 => 1, 32000 => 2, |
2168 | 24000 => 3, 22050 => 4, 16000 => 5 */ | 2364 | 24000 => 3, 22050 => 4, 16000 => 5 */ |
2169 | sfreqi = ((sfreq >> 7) & 0x000f) + | 2365 | sfreqi = ((sfreq >> 7) & 0x000f) + |
2170 | ((sfreq >> 15) & 0x0001) - 8; | 2366 | ((sfreq >> 15) & 0x0001) - 8; |
2171 | 2367 | ||
2172 | if (header->flags & MAD_FLAG_MPEG_2_5_EXT) | 2368 | if (header->flags & MAD_FLAG_MPEG_2_5_EXT) |
2173 | sfreqi += 3; | 2369 | sfreqi += 3; |
2174 | } | 2370 | } |
2175 | 2371 | ||
2176 | /* scalefactors, Huffman decoding, requantization */ | 2372 | /* scalefactors, Huffman decoding, requantization */ |
2177 | 2373 | ||
2178 | ngr = (header->flags & MAD_FLAG_LSF_EXT) ? 1 : 2; | 2374 | ngr = (header->flags & MAD_FLAG_LSF_EXT) ? 1 : 2; |
2179 | 2375 | ||
2180 | for (gr = 0; gr < ngr; ++gr) { | 2376 | for (gr = 0; gr < ngr; ++gr) { |
2181 | struct granule *granule = &si->gr[gr]; | 2377 | struct granule *granule = &si->gr[gr]; |
2182 | unsigned char const *sfbwidth[2]; | 2378 | unsigned char const *sfbwidth[2]; |
2183 | mad_fixed_t xr[2][576]; | 2379 | mad_fixed_t xr[2][576]; |
2184 | unsigned int ch; | 2380 | unsigned int ch; |
2185 | enum mad_error error; | 2381 | enum mad_error error; |
2186 | 2382 | ||
2187 | for (ch = 0; ch < nch; ++ch) { | 2383 | for (ch = 0; ch < nch; ++ch) { |
2188 | struct channel *channel = &granule->ch[ch]; | 2384 | struct channel *channel = &granule->ch[ch]; |
2189 | unsigned int part2_length; | 2385 | unsigned int part2_length; |
2190 | 2386 | ||
2191 | sfbwidth[ch] = sfbwidth_table[sfreqi].l; | 2387 | sfbwidth[ch] = sfbwidth_table[sfreqi].l; |
2192 | if (channel->block_type == 2) { | 2388 | if (channel->block_type == 2) { |
2193 | sfbwidth[ch] = (channel->flags & mixed_block_flag) ? | 2389 | sfbwidth[ch] = (channel->flags & mixed_block_flag) ? |
2194 | sfbwidth_table[sfreqi].m : sfbwidth_table[sfreqi].s; | 2390 | sfbwidth_table[sfreqi].m : sfbwidth_table[sfreqi].s; |
2195 | } | 2391 | } |
2196 | 2392 | ||
2197 | if (header->flags & MAD_FLAG_LSF_EXT) { | 2393 | if (header->flags & MAD_FLAG_LSF_EXT) { |
2198 | part2_length = III_scalefactors_lsf(ptr, channel, | 2394 | part2_length = III_scalefactors_lsf(ptr, channel, |
2199 | ch == 0 ? 0 : &si->gr[1].ch[1], | 2395 | ch == 0 ? 0 : &si->gr[1].ch[1], |
2200 | header->mode_extension); | 2396 | header->mode_extension); |
2201 | } | 2397 | } |
2202 | else { | 2398 | else { |
2203 | part2_length = III_scalefactors(ptr, channel, &si->gr[0].ch[ch], | 2399 | part2_length = III_scalefactors(ptr, channel, &si->gr[0].ch[ch], |
2204 | gr == 0 ? 0 : si->scfsi[ch]); | 2400 | gr == 0 ? 0 : si->scfsi[ch]); |
2205 | } | 2401 | } |
2206 | 2402 | ||
2207 | error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part2_length); | 2403 | error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part2_length); |
2208 | if (error) | 2404 | if (error) |
2209 | return error; | 2405 | return error; |
2210 | } | 2406 | } |
2211 | 2407 | ||
2212 | /* joint stereo processing */ | 2408 | /* joint stereo processing */ |
2213 | 2409 | ||
2214 | if (header->mode == MAD_MODE_JOINT_STEREO && header->mode_extension) { | 2410 | if (header->mode == MAD_MODE_JOINT_STEREO && header->mode_extension) { |
2215 | error = III_stereo(xr, granule, header, sfbwidth[0]); | 2411 | error = III_stereo(xr, granule, header, sfbwidth[0]); |
2216 | if (error) | 2412 | if (error) |
2217 | return error; | 2413 | return error; |
2218 | } | 2414 | } |
2219 | 2415 | ||
2220 | /* reordering, alias reduction, IMDCT, overlap-add, frequency inversion */ | 2416 | /* reordering, alias reduction, IMDCT, overlap-add, frequency inversion */ |
2221 | 2417 | ||
2222 | for (ch = 0; ch < nch; ++ch) { | 2418 | for (ch = 0; ch < nch; ++ch) { |
2223 | struct channel const *channel = &granule->ch[ch]; | 2419 | struct channel const *channel = &granule->ch[ch]; |
2224 | mad_fixed_t (*sample)[32] = &frame->sbsample[ch][18 * gr]; | 2420 | mad_fixed_t (*sample)[32] = &frame->sbsample[ch][18 * gr]; |
2225 | unsigned int sb, l, i, sblimit; | 2421 | unsigned int sb, l, i, sblimit; |
2226 | mad_fixed_t output[36]; | 2422 | mad_fixed_t output[36]; |
2227 | 2423 | ||
2228 | if (channel->block_type == 2) { | 2424 | if (channel->block_type == 2) { |
2229 | III_reorder(xr[ch], channel, sfbwidth[ch]); | 2425 | III_reorder(xr[ch], channel, sfbwidth[ch]); |
2230 | 2426 | ||
2231 | # if !defined(OPT_STRICT) | 2427 | # if !defined(OPT_STRICT) |
2232 | /* | 2428 | /* |
2233 | * According to ISO/IEC 11172-3, "Alias reduction is not applied for | 2429 | * According to ISO/IEC 11172-3, "Alias reduction is not applied for |
2234 | * granules with block_type == 2 (short block)." However, other | 2430 | * granules with block_type == 2 (short block)." However, other |
2235 | * sources suggest alias reduction should indeed be performed on the | 2431 | * sources suggest alias reduction should indeed be performed on the |
2236 | * lower two subbands of mixed blocks. Most other implementations do | 2432 | * lower two subbands of mixed blocks. Most other implementations do |
2237 | * this, so by default we will too. | 2433 | * this, so by default we will too. |
2238 | */ | 2434 | */ |
2239 | if (channel->flags & mixed_block_flag) | 2435 | if (channel->flags & mixed_block_flag) |
2240 | III_aliasreduce(xr[ch], 36); | 2436 | III_aliasreduce(xr[ch], 36); |
2241 | # endif | 2437 | # endif |
2242 | } | 2438 | } |
2243 | else | 2439 | else |
2244 | III_aliasreduce(xr[ch], 576); | 2440 | III_aliasreduce(xr[ch], 576); |
2245 | 2441 | ||
2246 | l = 0; | 2442 | l = 0; |
2247 | 2443 | ||
2248 | /* subbands 0-1 */ | 2444 | /* subbands 0-1 */ |
2249 | 2445 | ||
2250 | if (channel->block_type != 2 || (channel->flags & mixed_block_flag)) { | 2446 | if (channel->block_type != 2 || (channel->flags & mixed_block_flag)) { |
2251 | unsigned int block_type; | 2447 | unsigned int block_type; |
2252 | 2448 | ||
2253 | block_type = channel->block_type; | 2449 | block_type = channel->block_type; |
2254 | if (channel->flags & mixed_block_flag) | 2450 | if (channel->flags & mixed_block_flag) |
2255 | block_type = 0; | 2451 | block_type = 0; |
2256 | 2452 | ||
2257 | /* long blocks */ | 2453 | /* long blocks */ |
2258 | for (sb = 0; sb < 2; ++sb, l += 18) { | 2454 | for (sb = 0; sb < 2; ++sb, l += 18) { |
2259 | III_imdct_l(&xr[ch][l], output, block_type); | 2455 | III_imdct_l(&xr[ch][l], output, block_type); |
2260 | III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); | 2456 | III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); |
2261 | } | 2457 | } |
2262 | } | 2458 | } |
2263 | else { | 2459 | else { |
2264 | /* short blocks */ | 2460 | /* short blocks */ |
2265 | for (sb = 0; sb < 2; ++sb, l += 18) { | 2461 | for (sb = 0; sb < 2; ++sb, l += 18) { |
2266 | III_imdct_s(&xr[ch][l], output); | 2462 | III_imdct_s(&xr[ch][l], output); |
2267 | III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); | 2463 | III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); |
2268 | } | 2464 | } |
2269 | } | 2465 | } |
2270 | 2466 | ||
2271 | III_freqinver(sample, 1); | 2467 | III_freqinver(sample, 1); |
2272 | 2468 | ||
2273 | /* (nonzero) subbands 2-31 */ | 2469 | /* (nonzero) subbands 2-31 */ |
2274 | 2470 | ||
2275 | i = 576; | 2471 | i = 576; |
2276 | while (i > 36 && xr[ch][i - 1] == 0) | 2472 | while (i > 36 && xr[ch][i - 1] == 0) |
2277 | --i; | 2473 | --i; |
2278 | 2474 | ||
2279 | sblimit = 32 - (576 - i) / 18; | 2475 | sblimit = 32 - (576 - i) / 18; |
2280 | 2476 | ||
2281 | if (channel->block_type != 2) { | 2477 | if (channel->block_type != 2) { |
2282 | /* long blocks */ | 2478 | /* long blocks */ |
2283 | for (sb = 2; sb < sblimit; ++sb, l += 18) { | 2479 | for (sb = 2; sb < sblimit; ++sb, l += 18) { |
2284 | III_imdct_l(&xr[ch][l], output, channel->block_type); | 2480 | III_imdct_l(&xr[ch][l], output, channel->block_type); |
2285 | III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); | 2481 | III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); |
2286 | 2482 | ||
2287 | if (sb & 1) | 2483 | if (sb & 1) |
2288 | III_freqinver(sample, sb); | 2484 | III_freqinver(sample, sb); |
2289 | } | 2485 | } |
2290 | } | 2486 | } |
2291 | else { | 2487 | else { |
2292 | /* short blocks */ | 2488 | /* short blocks */ |
2293 | for (sb = 2; sb < sblimit; ++sb, l += 18) { | 2489 | for (sb = 2; sb < sblimit; ++sb, l += 18) { |
2294 | III_imdct_s(&xr[ch][l], output); | 2490 | III_imdct_s(&xr[ch][l], output); |
2295 | III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); | 2491 | III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); |
2296 | 2492 | ||
2297 | if (sb & 1) | 2493 | if (sb & 1) |
2298 | III_freqinver(sample, sb); | 2494 | III_freqinver(sample, sb); |
2299 | } | 2495 | } |
2300 | } | 2496 | } |
2301 | 2497 | ||
2302 | /* remaining (zero) subbands */ | 2498 | /* remaining (zero) subbands */ |
2303 | 2499 | ||
2304 | for (sb = sblimit; sb < 32; ++sb) { | 2500 | for (sb = sblimit; sb < 32; ++sb) { |
2305 | III_overlap_z((*frame->overlap)[ch][sb], sample, sb); | 2501 | III_overlap_z((*frame->overlap)[ch][sb], sample, sb); |
2306 | 2502 | ||
2307 | if (sb & 1) | 2503 | if (sb & 1) |
2308 | III_freqinver(sample, sb); | 2504 | III_freqinver(sample, sb); |
2309 | } | 2505 | } |
2310 | } | 2506 | } |
2311 | } | 2507 | } |
2312 | 2508 | ||
2313 | return MAD_ERROR_NONE; | 2509 | return MAD_ERROR_NONE; |
2314 | } | 2510 | } |
2315 | 2511 | ||
2316 | /* | 2512 | /* |
2317 | * NAME:layer->III() | 2513 | * NAME:layer->III() |
2318 | * DESCRIPTION:decode a single Layer III frame | 2514 | * DESCRIPTION:decode a single Layer III frame |
2319 | */ | 2515 | */ |
2320 | int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) | 2516 | int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) |
2321 | { | 2517 | { |
2322 | struct mad_header *header = &frame->header; | 2518 | struct mad_header *header = &frame->header; |
2323 | unsigned int nch, priv_bitlen, next_md_begin = 0; | 2519 | unsigned int nch, priv_bitlen, next_md_begin = 0; |
2324 | unsigned int si_len, data_bitlen, md_len; | 2520 | unsigned int si_len, data_bitlen, md_len; |
2325 | unsigned int frame_space, frame_used, frame_free; | 2521 | unsigned int frame_space, frame_used, frame_free; |
2326 | struct mad_bitptr ptr; | 2522 | struct mad_bitptr ptr; |
2327 | struct sideinfo si; | 2523 | struct sideinfo si; |
2328 | enum mad_error error; | 2524 | enum mad_error error; |
2329 | int result = 0; | 2525 | int result = 0; |
2330 | 2526 | ||
2331 | /* allocate Layer III dynamic structures */ | 2527 | /* allocate Layer III dynamic structures */ |
2332 | 2528 | ||
2333 | if (stream->main_data == 0) { | 2529 | if (stream->main_data == 0) { |
2334 | stream->main_data = malloc(MAD_BUFFER_MDLEN); | 2530 | stream->main_data = malloc(MAD_BUFFER_MDLEN); |
2335 | if (stream->main_data == 0) { | 2531 | if (stream->main_data == 0) { |
2336 | stream->error = MAD_ERROR_NOMEM; | 2532 | stream->error = MAD_ERROR_NOMEM; |
2337 | return -1; | 2533 | return -1; |
2338 | } | 2534 | } |
2339 | } | 2535 | } |
2340 | 2536 | ||
2341 | if (frame->overlap == 0) { | 2537 | if (frame->overlap == 0) { |
2342 | frame->overlap = calloc(2 * 32 * 18, sizeof(mad_fixed_t)); | 2538 | frame->overlap = calloc(2 * 32 * 18, sizeof(mad_fixed_t)); |
2343 | if (frame->overlap == 0) { | 2539 | if (frame->overlap == 0) { |
2344 | stream->error = MAD_ERROR_NOMEM; | 2540 | stream->error = MAD_ERROR_NOMEM; |
2345 | return -1; | 2541 | return -1; |
2346 | } | 2542 | } |
2347 | } | 2543 | } |
2348 | 2544 | ||
2349 | nch = MAD_NCHANNELS(header); | 2545 | nch = MAD_NCHANNELS(header); |
2350 | si_len = (header->flags & MAD_FLAG_LSF_EXT) ? | 2546 | si_len = (header->flags & MAD_FLAG_LSF_EXT) ? |
2351 | (nch == 1 ? 9 : 17) : (nch == 1 ? 17 : 32); | 2547 | (nch == 1 ? 9 : 17) : (nch == 1 ? 17 : 32); |
2352 | 2548 | ||
2353 | /* check frame sanity */ | 2549 | /* check frame sanity */ |
2354 | 2550 | ||
2355 | if (stream->next_frame - mad_bit_nextbyte(&stream->ptr) < | 2551 | if (stream->next_frame - mad_bit_nextbyte(&stream->ptr) < |
2356 | (signed int) si_len) { | 2552 | (signed int) si_len) { |
2357 | stream->error = MAD_ERROR_BADFRAMELEN; | 2553 | stream->error = MAD_ERROR_BADFRAMELEN; |
2358 | stream->md_len = 0; | 2554 | stream->md_len = 0; |
2359 | return -1; | 2555 | return -1; |
2360 | } | 2556 | } |
2361 | 2557 | ||
2362 | /* check CRC word */ | 2558 | /* check CRC word */ |
2363 | 2559 | ||
2364 | if (header->flags & MAD_FLAG_PROTECTION) { | 2560 | if (header->flags & MAD_FLAG_PROTECTION) { |
2365 | header->crc_check = | 2561 | header->crc_check = |
2366 | mad_bit_crc(stream->ptr, si_len * CHAR_BIT, header->crc_check); | 2562 | mad_bit_crc(stream->ptr, si_len * CHAR_BIT, header->crc_check); |
2367 | 2563 | ||
2368 | if (header->crc_check != header->crc_target && | 2564 | if (header->crc_check != header->crc_target && |
2369 | !(frame->options & MAD_OPTION_IGNORECRC)) { | 2565 | !(frame->options & MAD_OPTION_IGNORECRC)) { |
2370 | stream->error = MAD_ERROR_BADCRC; | 2566 | stream->error = MAD_ERROR_BADCRC; |
2371 | result = -1; | 2567 | result = -1; |
2372 | } | 2568 | } |
2373 | } | 2569 | } |
2374 | 2570 | ||
2375 | /* decode frame side information */ | 2571 | /* decode frame side information */ |
2376 | 2572 | ||
2377 | error = III_sideinfo(&stream->ptr, nch, header->flags & MAD_FLAG_LSF_EXT, | 2573 | error = III_sideinfo(&stream->ptr, nch, header->flags & MAD_FLAG_LSF_EXT, |
2378 | &si, &data_bitlen, &priv_bitlen); | 2574 | &si, &data_bitlen, &priv_bitlen); |
2379 | if (error && result == 0) { | 2575 | if (error && result == 0) { |
2380 | stream->error = error; | 2576 | stream->error = error; |
2381 | result = -1; | 2577 | result = -1; |
2382 | } | 2578 | } |
2383 | 2579 | ||
2384 | header->flags |= priv_bitlen; | 2580 | header->flags |= priv_bitlen; |
2385 | header->private_bits |= si.private_bits; | 2581 | header->private_bits |= si.private_bits; |
2386 | 2582 | ||
2387 | /* find main_data of next frame */ | 2583 | /* find main_data of next frame */ |
2388 | 2584 | ||
2389 | { | 2585 | { |
2390 | struct mad_bitptr peek; | 2586 | struct mad_bitptr peek; |
2391 | unsigned long header; | 2587 | unsigned long header; |
2392 | 2588 | ||
2393 | mad_bit_init(&peek, stream->next_frame); | 2589 | mad_bit_init(&peek, stream->next_frame); |
2394 | 2590 | ||
2395 | header = mad_bit_read(&peek, 32); | 2591 | header = mad_bit_read(&peek, 32); |
2396 | if ((header & 0xffe60000L) /* syncword | layer */ == 0xffe20000L) { | 2592 | if ((header & 0xffe60000L) /* syncword | layer */ == 0xffe20000L) { |
2397 | if (!(header & 0x00010000L)) /* protection_bit */ | 2593 | if (!(header & 0x00010000L)) /* protection_bit */ |
2398 | mad_bit_skip(&peek, 16); /* crc_check */ | 2594 | mad_bit_skip(&peek, 16); /* crc_check */ |
2399 | 2595 | ||
2400 | next_md_begin = | 2596 | next_md_begin = |
2401 | mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8); | 2597 | mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8); |
2402 | } | 2598 | } |
2403 | 2599 | ||
2404 | mad_bit_finish(&peek); | 2600 | mad_bit_finish(&peek); |
2405 | } | 2601 | } |
2406 | 2602 | ||
2407 | /* find main_data of this frame */ | 2603 | /* find main_data of this frame */ |
2408 | 2604 | ||
2409 | frame_space = stream->next_frame - mad_bit_nextbyte(&stream->ptr); | 2605 | frame_space = stream->next_frame - mad_bit_nextbyte(&stream->ptr); |
2410 | 2606 | ||
2411 | if (next_md_begin > si.main_data_begin + frame_space) | 2607 | if (next_md_begin > si.main_data_begin + frame_space) |
2412 | next_md_begin = 0; | 2608 | next_md_begin = 0; |
2413 | 2609 | ||
2414 | md_len = si.main_data_begin + frame_space - next_md_begin; | 2610 | md_len = si.main_data_begin + frame_space - next_md_begin; |
2415 | 2611 | ||
2416 | frame_used = 0; | 2612 | frame_used = 0; |
2417 | 2613 | ||
2418 | if (si.main_data_begin == 0) { | 2614 | if (si.main_data_begin == 0) { |
2419 | ptr = stream->ptr; | 2615 | ptr = stream->ptr; |
2420 | stream->md_len = 0; | 2616 | stream->md_len = 0; |
2421 | 2617 | ||
2422 | frame_used = md_len; | 2618 | frame_used = md_len; |
2423 | } | 2619 | } |
2424 | else { | 2620 | else { |
2425 | if (si.main_data_begin > stream->md_len) { | 2621 | if (si.main_data_begin > stream->md_len) { |
2426 | if (result == 0) { | 2622 | if (result == 0) { |
2427 | stream->error = MAD_ERROR_BADDATAPTR; | 2623 | stream->error = MAD_ERROR_BADDATAPTR; |
2428 | result = -1; | 2624 | result = -1; |
2429 | } | 2625 | } |
2430 | } | 2626 | } |
2431 | else { | 2627 | else { |
2432 | mad_bit_init(&ptr, | 2628 | mad_bit_init(&ptr, |
2433 | *stream->main_data + stream->md_len - si.main_data_begin); | 2629 | *stream->main_data + stream->md_len - si.main_data_begin); |
2434 | 2630 | ||
2435 | if (md_len > si.main_data_begin) { | 2631 | if (md_len > si.main_data_begin) { |
2436 | assert(stream->md_len + md_len - | 2632 | assert(stream->md_len + md_len - |
2437 | si.main_data_begin <= MAD_BUFFER_MDLEN); | 2633 | si.main_data_begin <= MAD_BUFFER_MDLEN); |
2438 | 2634 | ||
2439 | memcpy(*stream->main_data + stream->md_len, | 2635 | memcpy(*stream->main_data + stream->md_len, |
2440 | mad_bit_nextbyte(&stream->ptr), | 2636 | mad_bit_nextbyte(&stream->ptr), |
2441 | frame_used = md_len - si.main_data_begin); | 2637 | frame_used = md_len - si.main_data_begin); |
2442 | stream->md_len += frame_used; | 2638 | stream->md_len += frame_used; |
2443 | } | 2639 | } |
2444 | } | 2640 | } |
2445 | } | 2641 | } |
2446 | 2642 | ||
2447 | frame_free = frame_space - frame_used; | 2643 | frame_free = frame_space - frame_used; |
2448 | 2644 | ||
2449 | /* decode main_data */ | 2645 | /* decode main_data */ |
2450 | 2646 | ||
2451 | if (result == 0) { | 2647 | if (result == 0) { |
2452 | error = III_decode(&ptr, frame, &si, nch); | 2648 | error = III_decode(&ptr, frame, &si, nch); |
2453 | if (error) { | 2649 | if (error) { |
2454 | stream->error = error; | 2650 | stream->error = error; |
2455 | result = -1; | 2651 | result = -1; |
2456 | } | 2652 | } |
2457 | } | ||
2458 | 2653 | ||
2459 | /* designate ancillary bits */ | 2654 | /* designate ancillary bits */ |
2460 | 2655 | ||
2461 | stream->anc_ptr = ptr; | 2656 | stream->anc_ptr = ptr; |
2462 | stream->anc_bitlen = md_len * CHAR_BIT - data_bitlen; | 2657 | stream->anc_bitlen = md_len * CHAR_BIT - data_bitlen; |
2658 | } | ||
2463 | 2659 | ||
2464 | # if 0 && defined(DEBUG) | 2660 | # if 0 && defined(DEBUG) |
2465 | fprintf(stderr, | 2661 | fprintf(stderr, |
2466 | "main_data_begin:%u, md_len:%u, frame_free:%u, " | 2662 | "main_data_begin:%u, md_len:%u, frame_free:%u, " |
2467 | "data_bitlen:%u, anc_bitlen: %u\n", | 2663 | "data_bitlen:%u, anc_bitlen: %u\n", |
2468 | si.main_data_begin, md_len, frame_free, | 2664 | si.main_data_begin, md_len, frame_free, |
2469 | data_bitlen, stream->anc_bitlen); | 2665 | data_bitlen, stream->anc_bitlen); |
2470 | # endif | 2666 | # endif |
2471 | 2667 | ||
2472 | /* preload main_data buffer with up to 511 bytes for next frame(s) */ | 2668 | /* preload main_data buffer with up to 511 bytes for next frame(s) */ |
2473 | 2669 | ||
2474 | if (frame_free >= next_md_begin) { | 2670 | if (frame_free >= next_md_begin) { |
2475 | memcpy(*stream->main_data, | 2671 | memcpy(*stream->main_data, |
2476 | stream->next_frame - next_md_begin, next_md_begin); | 2672 | stream->next_frame - next_md_begin, next_md_begin); |
2477 | stream->md_len = next_md_begin; | 2673 | stream->md_len = next_md_begin; |
2478 | } | 2674 | } |
2479 | else { | 2675 | else { |
2480 | if (md_len < si.main_data_begin) { | 2676 | if (md_len < si.main_data_begin) { |
2481 | unsigned int extra; | 2677 | unsigned int extra; |
2482 | 2678 | ||
2483 | extra = si.main_data_begin - md_len; | 2679 | extra = si.main_data_begin - md_len; |
2484 | if (extra + frame_free > next_md_begin) | 2680 | if (extra + frame_free > next_md_begin) |
2485 | extra = next_md_begin - frame_free; | 2681 | extra = next_md_begin - frame_free; |
2486 | 2682 | ||
2487 | if (extra < stream->md_len) { | 2683 | if (extra < stream->md_len) { |
2488 | memmove(*stream->main_data, | 2684 | memmove(*stream->main_data, |
2489 | *stream->main_data + stream->md_len - extra, extra); | 2685 | *stream->main_data + stream->md_len - extra, extra); |
2490 | stream->md_len = extra; | 2686 | stream->md_len = extra; |
2491 | } | 2687 | } |
2492 | } | 2688 | } |
2493 | else | 2689 | else |
2494 | stream->md_len = 0; | 2690 | stream->md_len = 0; |
2495 | 2691 | ||
2496 | memcpy(*stream->main_data + stream->md_len, | 2692 | memcpy(*stream->main_data + stream->md_len, |
2497 | stream->next_frame - frame_free, frame_free); | 2693 | stream->next_frame - frame_free, frame_free); |
2498 | stream->md_len += frame_free; | 2694 | stream->md_len += frame_free; |
2499 | } | 2695 | } |
2500 | 2696 | ||
2501 | return result; | 2697 | return result; |
2502 | } | 2698 | } |
diff --git a/core/multimedia/opieplayer/libmad/layer3.h b/core/multimedia/opieplayer/libmad/layer3.h index c1a5c69..1594803 100644 --- a/core/multimedia/opieplayer/libmad/layer3.h +++ b/core/multimedia/opieplayer/libmad/layer3.h | |||
@@ -1,30 +1,30 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifndef LIBMAD_LAYER3_H | 22 | # ifndef LIBMAD_LAYER3_H |
23 | # define LIBMAD_LAYER3_H | 23 | # define LIBMAD_LAYER3_H |
24 | 24 | ||
25 | # include "stream.h" | 25 | # include "stream.h" |
26 | # include "frame.h" | 26 | # include "frame.h" |
27 | 27 | ||
28 | int mad_layer_III(struct mad_stream *, struct mad_frame *); | 28 | int mad_layer_III(struct mad_stream *, struct mad_frame *); |
29 | 29 | ||
30 | # endif | 30 | # endif |
diff --git a/core/multimedia/opieplayer/libmad/libmad.pro b/core/multimedia/opieplayer/libmad/libmad.pro index 46af87f..7c41a8f 100644 --- a/core/multimedia/opieplayer/libmad/libmad.pro +++ b/core/multimedia/opieplayer/libmad/libmad.pro | |||
@@ -1,53 +1,44 @@ | |||
1 | QMAKE_CFLAGS += $(if $(CONFIG_TARGET_X86),-DFPM_INTEL) \ | ||
2 | $(if $(CONFIG_TARGET_64BIT),-DFPM_64BIT) \ | ||
3 | $(if $(CONFIG_TARGET_IPAQ),-DFPM_ARM) \ | ||
4 | $(if $(CONFIG_TARGET_SHARP),-DFPM_ARM) | ||
5 | QMAKE_CXXFLAGS += $(if $(CONFIG_TARGET_X86),-DFPM_INTEL) \ | ||
6 | $(if $(CONFIG_TARGET_64BIT),-DFPM_64BIT) \ | ||
7 | $(if $(CONFIG_TARGET_IPAQ),-DFPM_ARM) \ | ||
8 | $(if $(CONFIG_TARGET_SHARP),-DFPM_ARM) | ||
9 | |||
10 | |||
1 | TEMPLATE = lib | 11 | TEMPLATE = lib |
2 | CONFIG += qt warn_on | 12 | CONFIG += qt warn_on release |
3 | HEADERS = libmad_version.h fixed.h bit.h timer.h stream.h frame.h synth.h decoder.h \ | 13 | HEADERS = libmad_version.h fixed.h bit.h timer.h stream.h frame.h synth.h decoder.h \ |
4 | layer12.h layer3.h huffman.h libmad_global.h mad.h libmadplugin.h libmadpluginimpl.h | 14 | layer12.h layer3.h huffman.h libmad_global.h mad.h libmadplugin.h libmadpluginimpl.h |
5 | SOURCES = version.c fixed.c bit.c timer.c stream.c frame.c synth.c decoder.c \ | 15 | SOURCES = version.c fixed.c bit.c timer.c stream.c frame.c synth.c decoder.c \ |
6 | layer12.c layer3.c huffman.c libmadplugin.cpp libmadpluginimpl.cpp | 16 | layer12.c layer3.c huffman.c libmadplugin.cpp libmadpluginimpl.cpp |
7 | TARGET = madplugin | 17 | TARGET = madplugin |
8 | DESTDIR = $(OPIEDIR)/plugins/codecs | 18 | DESTDIR = $(OPIEDIR)/plugins/codecs |
9 | INCLUDEPATH += $(OPIEDIR)/include .. | 19 | INCLUDEPATH += $(OPIEDIR)/include .. |
10 | DEPENDPATH += .. | 20 | DEPENDPATH += ../$(OPIEDIR)/include .. |
11 | LIBS += -lqpe -lm | 21 | LIBS += -lqpe -lm |
12 | VERSION = 1.0.0 | 22 | VERSION = 1.0.0 |
13 | 23 | ||
14 | include( $(OPIEDIR)/include.pro ) | 24 | TRANSLATIONS = ../../../../i18n/de/libmadplugin.ts \ |
15 | 25 | ../../../../i18n/nl/libmadplugin.ts \ | |
16 | DEFINES += FPM_INTEL | 26 | ../../../../i18n/da/libmadplugin.ts \ |
17 | 27 | ../../../../i18n/xx/libmadplugin.ts \ | |
18 | system(echo $QMAKESPEC | grep -s sharp) { | 28 | ../../../../i18n/en/libmadplugin.ts \ |
19 | DEFINES -= FPM_INTEL | 29 | ../../../../i18n/es/libmadplugin.ts \ |
20 | DEFINES += FPM_ARM | 30 | ../../../../i18n/fr/libmadplugin.ts \ |
21 | } | 31 | ../../../../i18n/hu/libmadplugin.ts \ |
22 | 32 | ../../../../i18n/ja/libmadplugin.ts \ | |
23 | system(echo $QMAKESPEC | grep -s ipaq) { | 33 | ../../../../i18n/ko/libmadplugin.ts \ |
24 | DEFINES -= FPM_INTEL | 34 | ../../../../i18n/no/libmadplugin.ts \ |
25 | DEFINES += FPM_ARM | 35 | ../../../../i18n/pl/libmadplugin.ts \ |
26 | } | 36 | ../../../../i18n/pt/libmadplugin.ts \ |
27 | 37 | ../../../../i18n/pt_BR/libmadplugin.ts \ | |
28 | system(echo $QMAKESPEC | grep -s mipsel) { | 38 | ../../../../i18n/sl/libmadplugin.ts \ |
29 | DEFINES -= FPM_INTEL | 39 | ../../../../i18n/zh_CN/libmadplugin.ts \ |
30 | DEFINES += FPM_MIPS | 40 | ../../../../i18n/zh_TW/libmadplugin.ts |
31 | } | 41 | |
32 | 42 | ||
33 | system(echo $QMAKESPEC | grep -s ramses) { | 43 | |
34 | DEFINES -= FPM_INTEL | 44 | include ( $(OPIEDIR)/include.pro ) |
35 | DEFINES += FPM_ARM | ||
36 | } | ||
37 | |||
38 | system(echo $QMAKESPEC | grep -s arm) { | ||
39 | DEFINES -= FPM_INTEL | ||
40 | DEFINES += FPM_ARM | ||
41 | } | ||
42 | |||
43 | system(echo $QMAKESPEC | grep -s simpad) { | ||
44 | DEFINES -= FPM_INTEL | ||
45 | DEFINES += FPM_ARM | ||
46 | } | ||
47 | |||
48 | system(echo $QMAKESPEC | grep -s yopy) { | ||
49 | DEFINES -= FPM_INTEL | ||
50 | DEFINES += FPM_ARM | ||
51 | } | ||
52 | |||
53 | |||
diff --git a/core/multimedia/opieplayer/libmad/libmad_global.h b/core/multimedia/opieplayer/libmad/libmad_global.h index 2c9c713..a3417b4 100644 --- a/core/multimedia/opieplayer/libmad/libmad_global.h +++ b/core/multimedia/opieplayer/libmad/libmad_global.h | |||
@@ -1,58 +1,58 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifndef LIBMAD_GLOBAL_H | 22 | # ifndef LIBMAD_GLOBAL_H |
23 | # define LIBMAD_GLOBAL_H | 23 | # define LIBMAD_GLOBAL_H |
24 | 24 | ||
25 | /* conditional debugging */ | 25 | /* conditional debugging */ |
26 | 26 | ||
27 | # if defined(DEBUG) && defined(NDEBUG) | 27 | # if defined(DEBUG) && defined(NDEBUG) |
28 | # error "cannot define both DEBUG and NDEBUG" | 28 | # error "cannot define both DEBUG and NDEBUG" |
29 | # endif | 29 | # endif |
30 | 30 | ||
31 | # if defined(DEBUG) | 31 | # if defined(DEBUG) |
32 | # include <stdio.h> | 32 | # include <stdio.h> |
33 | # endif | 33 | # endif |
34 | 34 | ||
35 | /* conditional features */ | 35 | /* conditional features */ |
36 | 36 | ||
37 | # if defined(OPT_SPEED) && defined(OPT_ACCURACY) | 37 | # if defined(OPT_SPEED) && defined(OPT_ACCURACY) |
38 | # error "cannot optimize for both speed and accuracy" | 38 | # error "cannot optimize for both speed and accuracy" |
39 | # endif | 39 | # endif |
40 | 40 | ||
41 | # if defined(OPT_SPEED) && !defined(OPT_SSO) | 41 | # if defined(OPT_SPEED) && !defined(OPT_SSO) |
42 | # define OPT_SSO 1 | 42 | # define OPT_SSO |
43 | # endif | 43 | # endif |
44 | 44 | ||
45 | # if defined(HAVE_UNISTD_H) && defined(HAVE_WAITPID) && \ | 45 | # if defined(HAVE_UNISTD_H) && defined(HAVE_WAITPID) && \ |
46 | defined(HAVE_FCNTL) && defined(HAVE_PIPE) && defined(HAVE_FORK) | 46 | defined(HAVE_FCNTL) && defined(HAVE_PIPE) && defined(HAVE_FORK) |
47 | # define USE_ASYNC | 47 | # define USE_ASYNC |
48 | # endif | 48 | # endif |
49 | 49 | ||
50 | # if !defined(HAVE_ASSERT_H) | 50 | # if !defined(HAVE_ASSERT_H) |
51 | # if defined(NDEBUG) | 51 | # if defined(NDEBUG) |
52 | # define assert(x)/* nothing */ | 52 | # define assert(x)/* nothing */ |
53 | # else | 53 | # else |
54 | # define assert(x)do { if (!(x)) abort(); } while (0) | 54 | # define assert(x)do { if (!(x)) abort(); } while (0) |
55 | # endif | 55 | # endif |
56 | # endif | 56 | # endif |
57 | 57 | ||
58 | # endif | 58 | # endif |
diff --git a/core/multimedia/opieplayer/libmad/libmad_version.h b/core/multimedia/opieplayer/libmad/libmad_version.h index 9e684a7..d40e425 100644 --- a/core/multimedia/opieplayer/libmad/libmad_version.h +++ b/core/multimedia/opieplayer/libmad/libmad_version.h | |||
@@ -1,47 +1,47 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifndef LIBMAD_VERSION_H | 22 | # ifndef LIBMAD_VERSION_H |
23 | # define LIBMAD_VERSION_H | 23 | # define LIBMAD_VERSION_H |
24 | 24 | ||
25 | # define MAD_VERSION_MAJOR0 | 25 | # define MAD_VERSION_MAJOR0 |
26 | # define MAD_VERSION_MINOR14 | 26 | # define MAD_VERSION_MINOR15 |
27 | # define MAD_VERSION_PATCH2 | 27 | # define MAD_VERSION_PATCH1 |
28 | # define MAD_VERSION_EXTRA" (beta)" | 28 | # define MAD_VERSION_EXTRA" (beta)" |
29 | 29 | ||
30 | # define MAD_VERSION_STRINGIZE(str)#str | 30 | # define MAD_VERSION_STRINGIZE(str)#str |
31 | # define MAD_VERSION_STRING(num)MAD_VERSION_STRINGIZE(num) | 31 | # define MAD_VERSION_STRING(num)MAD_VERSION_STRINGIZE(num) |
32 | 32 | ||
33 | # define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ | 33 | # define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ |
34 | MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ | 34 | MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ |
35 | MAD_VERSION_STRING(MAD_VERSION_PATCH) \ | 35 | MAD_VERSION_STRING(MAD_VERSION_PATCH) \ |
36 | MAD_VERSION_EXTRA | 36 | MAD_VERSION_EXTRA |
37 | 37 | ||
38 | # define MAD_PUBLISHYEAR"2000-2001" | 38 | # define MAD_PUBLISHYEAR"2000-2004" |
39 | # define MAD_AUTHOR "Robert Leslie" | 39 | # define MAD_AUTHOR "Underbit Technologies, Inc." |
40 | # define MAD_EMAIL "rob@mars.org" | 40 | # define MAD_EMAIL "info@underbit.com" |
41 | 41 | ||
42 | extern char const mad_version[]; | 42 | extern char const mad_version[]; |
43 | extern char const mad_copyright[]; | 43 | extern char const mad_copyright[]; |
44 | extern char const mad_author[]; | 44 | extern char const mad_author[]; |
45 | extern char const mad_build[]; | 45 | extern char const mad_build[]; |
46 | 46 | ||
47 | # endif | 47 | # endif |
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp index 7438a45..1989b4a 100644 --- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp +++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp | |||
@@ -1,873 +1,869 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // largly modified by Maximilian Reiss <max.reiss@gmx.de> | 20 | // largly modified by Maximilian Reiss <max.reiss@gmx.de> |
21 | 21 | ||
22 | #include "libmadplugin.h" | ||
23 | |||
24 | /* OPIE */ | ||
25 | #include <qpe/config.h> | ||
26 | #include <opie2/odebug.h> | ||
27 | |||
28 | /* QT */ | ||
29 | #include <qapplication.h> | ||
30 | #include <qmessagebox.h> | ||
31 | #include <qregexp.h> | ||
32 | |||
33 | /* STD */ | ||
34 | #include <stdio.h> | 22 | #include <stdio.h> |
35 | #include <stdarg.h> | 23 | #include <stdarg.h> |
36 | #include <stdlib.h> | 24 | #include <stdlib.h> |
37 | #include <sys/types.h> | 25 | #include <sys/types.h> |
38 | #include <sys/stat.h> | 26 | #include <sys/stat.h> |
39 | #include <fcntl.h> | 27 | #include <fcntl.h> |
40 | #include <unistd.h> | 28 | #include <unistd.h> |
41 | #include <string.h> | 29 | #include <string.h> |
42 | #include <ctype.h> | 30 | #include <ctype.h> |
43 | #include <errno.h> | 31 | #include <errno.h> |
44 | #include <time.h> | 32 | #include <time.h> |
45 | #include <locale.h> | 33 | #include <locale.h> |
46 | #include <math.h> | 34 | #include <math.h> |
47 | #include <assert.h> | 35 | #include <assert.h> |
48 | 36 | ||
37 | #include <qapplication.h> | ||
38 | #include <qmessagebox.h> | ||
39 | #include <qregexp.h> | ||
40 | |||
41 | #include <qpe/config.h> | ||
42 | |||
49 | // for network handling | 43 | // for network handling |
50 | #include <netinet/in.h> | 44 | #include <netinet/in.h> |
51 | #include <netdb.h> | 45 | #include <netdb.h> |
52 | #include <linux/limits.h> | 46 | #include <linux/limits.h> |
53 | #include <sys/socket.h> | 47 | #include <sys/socket.h> |
54 | #include <arpa/inet.h> | 48 | #include <arpa/inet.h> |
55 | #include <unistd.h> | 49 | #include <unistd.h> |
56 | 50 | ||
57 | 51 | ||
58 | //#define HAVE_MMAP | 52 | //#define HAVE_MMAP |
59 | 53 | ||
60 | #if defined(HAVE_MMAP) | 54 | #if defined(HAVE_MMAP) |
61 | # include <sys/mman.h> | 55 | # include <sys/mman.h> |
62 | #endif | 56 | #endif |
57 | #include "libmadplugin.h" | ||
63 | 58 | ||
64 | 59 | ||
65 | extern "C" { | 60 | extern "C" { |
66 | #include "mad.h" | 61 | #include "mad.h" |
67 | } | 62 | } |
68 | 63 | ||
69 | 64 | ||
70 | #define MPEG_BUFFER_SIZE 65536 | 65 | #define MPEG_BUFFER_SIZE 65536 |
71 | //#define MPEG_BUFFER_SIZE 32768 //16384 // 8192 | 66 | //#define MPEG_BUFFER_SIZE 32768 //16384 // 8192 |
72 | //#define debugMsg(a) qDebug(a) | 67 | //#define debugMsg(a) qDebug(a) |
73 | #define debugMsg(a) | 68 | #define debugMsg(a) |
74 | 69 | ||
75 | 70 | ||
76 | class Input { | 71 | class Input { |
77 | public: | 72 | public: |
78 | char const *path; | 73 | char const *path; |
79 | int fd; | 74 | int fd; |
80 | #if defined(HAVE_MMAP) | 75 | #if defined(HAVE_MMAP) |
81 | void *fdm; | 76 | void *fdm; |
82 | #endif | 77 | #endif |
83 | unsigned long fileLength; | 78 | unsigned long fileLength; |
84 | unsigned char *data; | 79 | unsigned char *data; |
85 | unsigned long length; | 80 | unsigned long length; |
86 | int eof; | 81 | int eof; |
87 | }; | 82 | }; |
88 | 83 | ||
89 | 84 | ||
90 | class Output { | 85 | class Output { |
91 | public: | 86 | public: |
92 | mad_fixed_t attenuate; | 87 | mad_fixed_t attenuate; |
93 | struct filter *filters; | 88 | struct filter *filters; |
94 | unsigned int channels_in; | 89 | unsigned int channels_in; |
95 | unsigned int channels_out; | 90 | unsigned int channels_out; |
96 | unsigned int speed_in; | 91 | unsigned int speed_in; |
97 | unsigned int speed_out; | 92 | unsigned int speed_out; |
98 | const char *path; | 93 | const char *path; |
99 | }; | 94 | }; |
100 | 95 | ||
101 | 96 | ||
102 | # if defined(HAVE_MMAP) | 97 | # if defined(HAVE_MMAP) |
103 | static void *map_file(int fd, unsigned long *length) | 98 | static void *map_file(int fd, unsigned long *length) |
104 | { | 99 | { |
105 | void *fdm; | 100 | void *fdm; |
106 | 101 | ||
107 | *length += MAD_BUFFER_GUARD; | 102 | *length += MAD_BUFFER_GUARD; |
108 | 103 | ||
109 | fdm = mmap(0, *length, PROT_READ, MAP_SHARED, fd, 0); | 104 | fdm = mmap(0, *length, PROT_READ, MAP_SHARED, fd, 0); |
110 | if (fdm == MAP_FAILED) | 105 | if (fdm == MAP_FAILED) |
111 | return 0; | 106 | return 0; |
112 | 107 | ||
113 | # if defined(HAVE_MADVISE) | 108 | # if defined(HAVE_MADVISE) |
114 | madvise(fdm, *length, MADV_SEQUENTIAL); | 109 | madvise(fdm, *length, MADV_SEQUENTIAL); |
115 | # endif | 110 | # endif |
116 | 111 | ||
117 | return fdm; | 112 | return fdm; |
118 | } | 113 | } |
119 | 114 | ||
120 | 115 | ||
121 | static int unmap_file(void *fdm, unsigned long length) | 116 | static int unmap_file(void *fdm, unsigned long length) |
122 | { | 117 | { |
123 | if (munmap(fdm, length) == -1) | 118 | if (munmap(fdm, length) == -1) |
124 | return -1; | 119 | return -1; |
125 | 120 | ||
126 | return 0; | 121 | return 0; |
127 | } | 122 | } |
128 | # endif | 123 | # endif |
129 | 124 | ||
130 | 125 | ||
131 | static inline QString tr( const char *str ) { | 126 | static inline QString tr( const char *str ) { |
132 | // Apparently this is okay from a plugin as it runs in the process space of the owner of the plugin | 127 | // Apparently this is okay from a plugin as it runs in the process space of the owner of the plugin |
133 | return qApp->translate( "OpiePlayer", str, "libmad strings for mp3 file info" ); | 128 | return qApp->translate( "OpiePlayer", str, "libmad strings for mp3 file info" ); |
134 | } | 129 | } |
135 | 130 | ||
136 | 131 | ||
137 | class LibMadPluginData { | 132 | class LibMadPluginData { |
138 | public: | 133 | public: |
139 | Input input; | 134 | Input input; |
140 | Output output; | 135 | Output output; |
141 | int bad_last_frame; | 136 | int bad_last_frame; |
142 | struct mad_stream stream; | 137 | struct mad_stream stream; |
143 | struct mad_frame frame; | 138 | struct mad_frame frame; |
144 | struct mad_synth synth; | 139 | struct mad_synth synth; |
145 | bool flush; | 140 | bool flush; |
146 | }; | 141 | }; |
147 | 142 | ||
148 | 143 | ||
149 | LibMadPlugin::LibMadPlugin() { | 144 | LibMadPlugin::LibMadPlugin() { |
150 | d = new LibMadPluginData; | 145 | d = new LibMadPluginData; |
151 | d->input.fd = 0; | 146 | d->input.fd = 0; |
152 | #if defined(HAVE_MMAP) | 147 | #if defined(HAVE_MMAP) |
153 | d->input.fdm = 0; | 148 | d->input.fdm = 0; |
154 | #endif | 149 | #endif |
155 | d->input.data = 0; | 150 | d->input.data = 0; |
156 | d->flush = TRUE; | 151 | d->flush = TRUE; |
157 | info = tr( "No Song Open" ); | 152 | info = tr( "No Song Open" ); |
158 | } | 153 | } |
159 | 154 | ||
160 | 155 | ||
161 | LibMadPlugin::~LibMadPlugin() { | 156 | LibMadPlugin::~LibMadPlugin() { |
162 | close(); | 157 | close(); |
163 | delete d; | 158 | delete d; |
164 | } | 159 | } |
165 | 160 | ||
166 | 161 | ||
167 | bool LibMadPlugin::isFileSupported( const QString& path ) { | 162 | bool LibMadPlugin::isFileSupported( const QString& path ) { |
168 | debugMsg( "LibMadPlugin::isFileSupported" ); | 163 | debugMsg( "LibMadPlugin::isFileSupported" ); |
169 | 164 | ||
170 | // Mpeg file extensions | 165 | // Mpeg file extensions |
171 | // "mp2","mp3","m1v","m2v","m2s","mpg","vob","mpeg","ac3" | 166 | // "mp2","mp3","m1v","m2v","m2s","mpg","vob","mpeg","ac3" |
172 | // Other media extensions | 167 | // Other media extensions |
173 | // "wav","mid","mod","s3m","ogg","avi","mov","sid" | 168 | // "wav","mid","mod","s3m","ogg","avi","mov","sid" |
174 | 169 | ||
175 | char *ext = strrchr( path.latin1(), '.' ); | 170 | char *ext = strrchr( path.latin1(), '.' ); |
176 | 171 | ||
177 | // Test file extension | 172 | // Test file extension |
178 | if ( ext ) { | 173 | if ( ext ) { |
179 | if ( strncasecmp(ext, ".mp2", 4) == 0 ) | 174 | if ( strncasecmp(ext, ".mp2", 4) == 0 ) |
180 | return TRUE; | 175 | return TRUE; |
181 | if ( strncasecmp(ext, ".mp3", 4) == 0 ) | 176 | if ( strncasecmp(ext, ".mp3", 4) == 0 ) |
182 | return TRUE; | 177 | return TRUE; |
183 | } | 178 | } |
184 | 179 | ||
185 | // UGLY - just for fast testing | 180 | // UGLY - just for fast testing |
186 | if ( path.left(4) == "http") { | 181 | if ( path.left(4) == "http") { |
187 | return TRUE; | 182 | return TRUE; |
188 | } | 183 | } |
189 | 184 | ||
190 | return FALSE; | 185 | return FALSE; |
191 | } | 186 | } |
192 | 187 | ||
193 | 188 | ||
194 | 189 | ||
195 | int LibMadPlugin::is_address_multicast(unsigned long address) { | 190 | int LibMadPlugin::is_address_multicast(unsigned long address) { |
196 | if ((address & 255) >= 224 && (address & 255) <= 239) | 191 | if ((address & 255) >= 224 && (address & 255) <= 239) |
197 | return (1); | 192 | return (1); |
198 | return (0); | 193 | return (0); |
199 | } | 194 | } |
200 | 195 | ||
201 | 196 | ||
202 | int LibMadPlugin::udp_open(char *address, int port) { | 197 | int LibMadPlugin::udp_open(char *address, int port) { |
203 | 198 | ||
204 | int enable = 1L; | 199 | int enable = 1L; |
205 | struct sockaddr_in stAddr; | 200 | struct sockaddr_in stAddr; |
206 | struct sockaddr_in stLclAddr; | 201 | struct sockaddr_in stLclAddr; |
207 | struct ip_mreq stMreq; | 202 | struct ip_mreq stMreq; |
208 | struct hostent *host; | 203 | struct hostent *host; |
209 | int sock; | 204 | int sock; |
210 | 205 | ||
211 | stAddr.sin_family = AF_INET; | 206 | stAddr.sin_family = AF_INET; |
212 | stAddr.sin_port = htons(port); | 207 | stAddr.sin_port = htons(port); |
213 | 208 | ||
214 | if ((host = gethostbyname(address)) == NULL) { | 209 | if ((host = gethostbyname(address)) == NULL) { |
215 | return (0); | 210 | return (0); |
216 | } | 211 | } |
217 | 212 | ||
218 | stAddr.sin_addr = *((struct in_addr *)host->h_addr_list[0]); | 213 | stAddr.sin_addr = *((struct in_addr *)host->h_addr_list[0]); |
219 | 214 | ||
220 | /* Create a UDP socket */ | 215 | /* Create a UDP socket */ |
221 | if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { | 216 | if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { |
222 | return (0); | 217 | return (0); |
223 | } | 218 | } |
224 | 219 | ||
225 | /* Allow multiple instance of the client to share the same address and port */ | 220 | /* Allow multiple instance of the client to share the same address and port */ |
226 | if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&enable, sizeof(unsigned long int)) < 0) { | 221 | if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&enable, sizeof(unsigned long int)) < 0) { |
227 | return (0); | 222 | return (0); |
228 | } | 223 | } |
229 | 224 | ||
230 | /* If the address is multicast, register to the multicast group */ | 225 | /* If the address is multicast, register to the multicast group */ |
231 | if (is_address_multicast(stAddr.sin_addr.s_addr)) { | 226 | if (is_address_multicast(stAddr.sin_addr.s_addr)) { |
232 | /* Bind the socket to port */ | 227 | /* Bind the socket to port */ |
233 | stLclAddr.sin_family = AF_INET; | 228 | stLclAddr.sin_family = AF_INET; |
234 | stLclAddr.sin_addr.s_addr = htonl(INADDR_ANY); | 229 | stLclAddr.sin_addr.s_addr = htonl(INADDR_ANY); |
235 | stLclAddr.sin_port = stAddr.sin_port; | 230 | stLclAddr.sin_port = stAddr.sin_port; |
236 | if (bind(sock, (struct sockaddr *)&stLclAddr, sizeof(stLclAddr)) < 0) { | 231 | if (bind(sock, (struct sockaddr *)&stLclAddr, sizeof(stLclAddr)) < 0) { |
237 | return (0); | 232 | return (0); |
238 | } | 233 | } |
239 | 234 | ||
240 | /* Register to a multicast address */ | 235 | /* Register to a multicast address */ |
241 | stMreq.imr_multiaddr.s_addr = stAddr.sin_addr.s_addr; | 236 | stMreq.imr_multiaddr.s_addr = stAddr.sin_addr.s_addr; |
242 | stMreq.imr_interface.s_addr = INADDR_ANY; | 237 | stMreq.imr_interface.s_addr = INADDR_ANY; |
243 | if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&stMreq, sizeof(stMreq)) < 0) { | 238 | if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&stMreq, sizeof(stMreq)) < 0) { |
244 | return (0); | 239 | return (0); |
245 | } | 240 | } |
246 | } else { | 241 | } else { |
247 | /* Bind the socket to port */ | 242 | /* Bind the socket to port */ |
248 | stLclAddr.sin_family = AF_INET; | 243 | stLclAddr.sin_family = AF_INET; |
249 | stLclAddr.sin_addr.s_addr = htonl(INADDR_ANY); | 244 | stLclAddr.sin_addr.s_addr = htonl(INADDR_ANY); |
250 | stLclAddr.sin_port = htons(0); | 245 | stLclAddr.sin_port = htons(0); |
251 | if (bind(sock, (struct sockaddr *)&stLclAddr, sizeof(stLclAddr)) < 0) { | 246 | if (bind(sock, (struct sockaddr *)&stLclAddr, sizeof(stLclAddr)) < 0) { |
252 | return (0); | 247 | return (0); |
253 | } | 248 | } |
254 | } | 249 | } |
255 | return (sock); | 250 | return (sock); |
256 | } | 251 | } |
257 | 252 | ||
258 | int LibMadPlugin::tcp_open(char *address, int port) { | 253 | int LibMadPlugin::tcp_open(char *address, int port) { |
259 | struct sockaddr_in stAddr; | 254 | struct sockaddr_in stAddr; |
260 | struct hostent *host; | 255 | struct hostent *host; |
261 | int sock; | 256 | int sock; |
262 | struct linger l; | 257 | struct linger l; |
263 | 258 | ||
264 | memset(&stAddr, 0, sizeof(stAddr)); | 259 | memset(&stAddr, 0, sizeof(stAddr)); |
265 | stAddr.sin_family = AF_INET; | 260 | stAddr.sin_family = AF_INET; |
266 | stAddr.sin_port = htons(port); | 261 | stAddr.sin_port = htons(port); |
267 | 262 | ||
268 | if ((host = gethostbyname(address)) == NULL) { | 263 | if ((host = gethostbyname(address)) == NULL) { |
269 | return (0); | 264 | return (0); |
270 | } | 265 | } |
271 | 266 | ||
272 | stAddr.sin_addr = *((struct in_addr *)host->h_addr_list[0]); | 267 | stAddr.sin_addr = *((struct in_addr *)host->h_addr_list[0]); |
273 | 268 | ||
274 | if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { | 269 | if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { |
275 | return (0); | 270 | return (0); |
276 | } | 271 | } |
277 | 272 | ||
278 | l.l_onoff = 1; | 273 | l.l_onoff = 1; |
279 | l.l_linger = 5; | 274 | l.l_linger = 5; |
280 | if (setsockopt(sock, SOL_SOCKET, SO_LINGER, (char *)&l, sizeof(l)) < 0) { | 275 | if (setsockopt(sock, SOL_SOCKET, SO_LINGER, (char *)&l, sizeof(l)) < 0) { |
281 | return (0); | 276 | return (0); |
282 | } | 277 | } |
283 | 278 | ||
284 | if (connect(sock, (struct sockaddr *)&stAddr, sizeof(stAddr)) < 0) { | 279 | if (connect(sock, (struct sockaddr *)&stAddr, sizeof(stAddr)) < 0) { |
285 | return (0); | 280 | return (0); |
286 | } | 281 | } |
287 | 282 | ||
288 | return (sock); | 283 | return (sock); |
289 | } | 284 | } |
290 | 285 | ||
291 | 286 | ||
292 | /** | 287 | /** |
293 | * Read a http line header. | 288 | * Read a http line header. |
294 | * This function read character by character. | 289 | * This function read character by character. |
295 | * @param tcp_sock the socket use to read the stream | 290 | * @param tcp_sock the socket use to read the stream |
296 | * @param buf a buffer to receive the data | 291 | * @param buf a buffer to receive the data |
297 | * @param size size of the buffer | 292 | * @param size size of the buffer |
298 | * @return the size of the stream read or -1 if an error occured | 293 | * @return the size of the stream read or -1 if an error occured |
299 | */ | 294 | */ |
300 | int LibMadPlugin::http_read_line(int tcp_sock, char *buf, int size) { | 295 | int LibMadPlugin::http_read_line(int tcp_sock, char *buf, int size) { |
301 | int offset = 0; | 296 | int offset = 0; |
302 | 297 | ||
303 | do { | 298 | do { |
304 | if (::read(tcp_sock, buf + offset, 1) < 0) | 299 | if (::read(tcp_sock, buf + offset, 1) < 0) |
305 | return -1; | 300 | return -1; |
306 | if (buf[offset] != '\r') /* Strip \r from answer */ | 301 | if (buf[offset] != '\r') /* Strip \r from answer */ |
307 | offset++; | 302 | offset++; |
308 | } while (offset < size - 1 && buf[offset - 1] != '\n'); | 303 | } while (offset < size - 1 && buf[offset - 1] != '\n'); |
309 | 304 | ||
310 | buf[offset] = 0; | 305 | buf[offset] = 0; |
311 | return offset; | 306 | return offset; |
312 | } | 307 | } |
313 | 308 | ||
314 | int LibMadPlugin::http_open(const QString& path ) { | 309 | int LibMadPlugin::http_open(const QString& path ) { |
315 | char *host; | 310 | char *host; |
316 | int port; | 311 | int port; |
317 | char *request; | 312 | char *request; |
318 | int tcp_sock; | 313 | int tcp_sock; |
319 | char http_request[PATH_MAX]; | 314 | char http_request[PATH_MAX]; |
320 | char filename[PATH_MAX]; | 315 | char filename[PATH_MAX]; |
321 | //char c; | 316 | //char c; |
322 | char *arg =strdup(path.latin1()); | 317 | char *arg =strdup(path.latin1()); |
323 | 318 | ||
324 | /* Check for URL syntax */ | 319 | /* Check for URL syntax */ |
325 | if (strncmp(arg, "http://", strlen("http://"))) { | 320 | if (strncmp(arg, "http://", strlen("http://"))) { |
326 | return (0); | 321 | return (0); |
327 | } | 322 | } |
328 | 323 | ||
329 | /* Parse URL */ | 324 | /* Parse URL */ |
330 | port = 80; | 325 | port = 80; |
331 | host = arg + strlen("http://"); | 326 | host = arg + strlen("http://"); |
332 | if ((request = strchr(host, '/')) == NULL) { | 327 | if ((request = strchr(host, '/')) == NULL) { |
333 | return (0); | 328 | return (0); |
334 | } | 329 | } |
335 | 330 | ||
336 | *request++ = 0; | 331 | *request++ = 0; |
337 | 332 | ||
338 | if (strchr(host, ':') != NULL) { /* port is specified */ | 333 | if (strchr(host, ':') != NULL) { /* port is specified */ |
339 | port = atoi(strchr(host, ':') + 1); | 334 | port = atoi(strchr(host, ':') + 1); |
340 | *strchr(host, ':') = 0; | 335 | *strchr(host, ':') = 0; |
341 | } | 336 | } |
342 | 337 | ||
343 | /* Open a TCP socket */ | 338 | /* Open a TCP socket */ |
344 | if (!(tcp_sock = tcp_open(host, port))) { | 339 | if (!(tcp_sock = tcp_open(host, port))) { |
345 | perror("http_open"); | 340 | perror("http_open"); |
346 | return (0); | 341 | return (0); |
347 | } | 342 | } |
348 | 343 | ||
349 | snprintf(filename, sizeof(filename) - strlen(host) - 75, "%s", request); | 344 | snprintf(filename, sizeof(filename) - strlen(host) - 75, "%s", request); |
350 | 345 | ||
351 | /* Send HTTP GET request */ | 346 | /* Send HTTP GET request */ |
352 | /* Please don't use a Agent know by shoutcast (Lynx, Mozilla) seems to be reconized and print | 347 | /* Please don't use a Agent know by shoutcast (Lynx, Mozilla) seems to be reconized and print |
353 | * a html page and not the stream */ | 348 | * a html page and not the stream */ |
354 | snprintf(http_request, sizeof(http_request), "GET /%s HTTP/1.0\r\n" | 349 | snprintf(http_request, sizeof(http_request), "GET /%s HTTP/1.0\r\n" |
355 | /* "User-Agent: Mozilla/2.0 (Win95; I)\r\n" */ | 350 | /* "User-Agent: Mozilla/2.0 (Win95; I)\r\n" */ |
356 | "Pragma: no-cache\r\n" "Host: %s\r\n" "Accept: */*\r\n" "\r\n", filename, host); | 351 | "Pragma: no-cache\r\n" "Host: %s\r\n" "Accept: */*\r\n" "\r\n", filename, host); |
357 | 352 | ||
358 | send(tcp_sock, http_request, strlen(http_request), 0); | 353 | send(tcp_sock, http_request, strlen(http_request), 0); |
359 | 354 | ||
360 | /* Parse server reply */ | 355 | /* Parse server reply */ |
361 | #if 0 | 356 | #if 0 |
362 | do | 357 | do |
363 | read(tcp_sock, &c, sizeof(char)); | 358 | read(tcp_sock, &c, sizeof(char)); |
364 | while (c != ' '); | 359 | while (c != ' '); |
365 | read(tcp_sock, http_request, 4 * sizeof(char)); | 360 | read(tcp_sock, http_request, 4 * sizeof(char)); |
366 | http_request[4] = 0; | 361 | http_request[4] = 0; |
367 | if (strcmp(http_request, "200 ")) { | 362 | if (strcmp(http_request, "200 ")) { |
368 | fprintf(stderr, "http_open: "); | 363 | fprintf(stderr, "http_open: "); |
369 | do { | 364 | do { |
370 | read(tcp_sock, &c, sizeof(char)); | 365 | read(tcp_sock, &c, sizeof(char)); |
371 | fprintf(stderr, "%c", c); | 366 | fprintf(stderr, "%c", c); |
372 | } while (c != '\r'); | 367 | } while (c != '\r'); |
373 | fprintf(stderr, "\n"); | 368 | fprintf(stderr, "\n"); |
374 | return (0); | 369 | return (0); |
375 | } | 370 | } |
376 | #endif | 371 | #endif |
377 | 372 | ||
378 | QString name; | 373 | QString name; |
379 | QString genre; | 374 | QString genre; |
380 | QString bitrate; | 375 | QString bitrate; |
381 | QString url; | 376 | QString url; |
382 | QString message = tr("Info: "); | 377 | QString message = tr("Info: "); |
383 | do { | 378 | do { |
384 | 379 | ||
385 | int len; | 380 | int len; |
386 | 381 | ||
387 | len = http_read_line(tcp_sock, http_request, sizeof(http_request)); | 382 | len = http_read_line(tcp_sock, http_request, sizeof(http_request)); |
388 | 383 | ||
389 | if (len == -1) { | 384 | if (len == -1) { |
390 | // odebug << "http_open: "+ QString(strerror(errno)) +"\n" << oendl; | 385 | // qDebug( "http_open: "+ QString(strerror(errno)) +"\n"); |
391 | return 0; | 386 | return 0; |
392 | } | 387 | } |
393 | 388 | ||
394 | if (QString(http_request).left(9) == "Location:") { | 389 | if (QString(http_request).left(9) == "Location:") { |
395 | /* redirect */ | 390 | /* redirect */ |
396 | ::close(tcp_sock); | 391 | ::close(tcp_sock); |
397 | http_request[strlen(http_request) - 1] = '\0'; | 392 | http_request[strlen(http_request) - 1] = '\0'; |
398 | return http_open(&http_request[10]); | 393 | return http_open(&http_request[10]); |
399 | } | 394 | } |
400 | 395 | ||
401 | if (QString(http_request).left(4) == "ICY ") { | 396 | if (QString(http_request).left(4) == "ICY ") { |
402 | /* This is shoutcast/icecast streaming */ | 397 | /* This is shoutcast/icecast streaming */ |
403 | if (strncmp(http_request + 4, "200 ", 4)) { | 398 | if (strncmp(http_request + 4, "200 ", 4)) { |
404 | // odebug << "http_open: " + QString(http_request) + "\n" << oendl; | 399 | // qDebug("http_open: " + QString(http_request) + "\n"); |
405 | return 0; | 400 | return 0; |
406 | } | 401 | } |
407 | } else if (QString(http_request).left(4) == "icy-") { | 402 | } else if (QString(http_request).left(4) == "icy-") { |
408 | /* we can have: icy-noticeX, icy-name, icy-genre, icy-url, icy-pub, icy-metaint, icy-br */ | 403 | /* we can have: icy-noticeX, icy-name, icy-genre, icy-url, icy-pub, icy-metaint, icy-br */ |
409 | if ( QString( http_request ).left( 8 ) == "icy-name" ) { | 404 | if ( QString( http_request ).left( 8 ) == "icy-name" ) { |
410 | name = tr("Name: ") + QString(http_request).mid(9, (QString(http_request).length())- 9 ); | 405 | name = tr("Name: ") + QString(http_request).mid(9, (QString(http_request).length())- 9 ); |
411 | } else if ( QString( http_request ).left( 9 ) == "icy-genre" ) { | 406 | } else if ( QString( http_request ).left( 9 ) == "icy-genre" ) { |
412 | genre = tr("Genre: ") + QString(http_request).mid(10, (QString(http_request).length())-10 ); | 407 | genre = tr("Genre: ") + QString(http_request).mid(10, (QString(http_request).length())-10 ); |
413 | } else if ( QString( http_request ).left( 6 ) == "icy-br" ) { | 408 | } else if ( QString( http_request ).left( 6 ) == "icy-br" ) { |
414 | bitrate = tr("Bitrate: ") + QString(http_request).mid(7, (QString(http_request).length())- 7 ); | 409 | bitrate = tr("Bitrate: ") + QString(http_request).mid(7, (QString(http_request).length())- 7 ); |
415 | } else if ( QString( http_request ).left( 7 ) == "icy-url" ) { | 410 | } else if ( QString( http_request ).left( 7 ) == "icy-url" ) { |
416 | url = tr("URL: ") + QString(http_request).mid(8, (QString(http_request).length())- 8 ); | 411 | url = tr("URL: ") + QString(http_request).mid(8, (QString(http_request).length())- 8 ); |
417 | } else if ( QString( http_request ).left( 10 ) == "icy-notice" ) { | 412 | } else if ( QString( http_request ).left( 10 ) == "icy-notice" ) { |
418 | message += QString(http_request).mid(11, QString(http_request).length()-11 ) ; | 413 | message += QString(http_request).mid(11, QString(http_request).length()-11 ) ; |
419 | } | 414 | } |
420 | } | 415 | } |
421 | } while (strcmp(http_request, "\n") != 0); | 416 | } while (strcmp(http_request, "\n") != 0); |
422 | 417 | ||
423 | info = QString(name + genre + url + bitrate + message).replace( QRegExp("\n"), " : " ); | 418 | info = QString(name + genre + url + bitrate + message).replace( QRegExp("\n"), " : " ); |
424 | 419 | ||
425 | // odebug << "Stream info: " + info << oendl; | 420 | // qDebug("Stream info: " + info); |
426 | 421 | ||
427 | return (tcp_sock); | 422 | return (tcp_sock); |
428 | } | 423 | } |
429 | 424 | ||
430 | 425 | ||
431 | 426 | ||
432 | bool LibMadPlugin::open( const QString& path ) { | 427 | bool LibMadPlugin::open( const QString& path ) { |
433 | debugMsg( "LibMadPlugin::open" ); | 428 | debugMsg( "LibMadPlugin::open" ); |
434 | Config cfg("OpiePlayer"); | 429 | Config cfg("OpiePlayer"); |
435 | cfg.setGroup("Options"); | 430 | cfg.setGroup("Options"); |
436 | bufferSize = cfg.readNumEntry("MPeg_BufferSize",MPEG_BUFFER_SIZE); | 431 | bufferSize = cfg.readNumEntry("MPeg_BufferSize",MPEG_BUFFER_SIZE); |
437 | // odebug << "buffer size is " << bufferSize << "" << oendl; | 432 | // qDebug("buffer size is %d", bufferSize); |
438 | d->bad_last_frame = 0; | 433 | d->bad_last_frame = 0; |
439 | d->flush = TRUE; | 434 | d->flush = TRUE; |
440 | info = QString( "" ); | 435 | info = QString( "" ); |
441 | 436 | ||
442 | //odebug << "Opening " << path << "" << oendl; | 437 | //qDebug( "Opening %s", path.latin1() ); |
443 | 438 | ||
444 | if (path.left( 4 ) == "http" ) { | 439 | if (path.left( 4 ) == "http" ) { |
445 | // in case of any error we get 0 here | 440 | // in case of any error we get 0 here |
446 | if ( !(http_open(path) == 0) ) { | 441 | if ( !(http_open(path) == 0) ) { |
447 | d->input.fd = http_open(path); | 442 | d->input.fd = http_open(path); |
448 | } else { | 443 | } else { |
449 | return FALSE; | 444 | return FALSE; |
450 | } | 445 | } |
451 | } else { | 446 | } else { |
452 | d->input.path = path.latin1(); | 447 | d->input.path = path.latin1(); |
453 | d->input.fd = ::open( d->input.path, O_RDONLY ); | 448 | d->input.fd = ::open( d->input.path, O_RDONLY ); |
454 | // thats a better place, since it should only seek for ID3 tags on mp3 files, not streams | 449 | // thats a better place, since it should only seek for ID3 tags on mp3 files, not streams |
455 | printID3Tags(); | 450 | printID3Tags(); |
456 | } | 451 | } |
457 | if (d->input.fd == -1) { | 452 | if (d->input.fd == -1) { |
458 | // odebug << "error opening " << d->input.path << "" << oendl; | 453 | // qDebug("error opening %s", d->input.path ); |
459 | return FALSE; | 454 | return FALSE; |
460 | } | 455 | } |
461 | 456 | ||
462 | struct stat stat; | 457 | struct stat stat; |
463 | if (fstat(d->input.fd, &stat) == -1) { | 458 | if (fstat(d->input.fd, &stat) == -1) { |
464 | // odebug << "error calling fstat" << oendl; return FALSE; | 459 | // qDebug("error calling fstat"); return FALSE; |
465 | } | 460 | } |
466 | if (S_ISREG(stat.st_mode) && stat.st_size > 0) | 461 | if (S_ISREG(stat.st_mode) && stat.st_size > 0) |
467 | d->input.fileLength = stat.st_size; | 462 | d->input.fileLength = stat.st_size; |
468 | else | 463 | else |
469 | d->input.fileLength = 0; | 464 | d->input.fileLength = 0; |
470 | 465 | ||
471 | #if defined(HAVE_MMAP) | 466 | #if defined(HAVE_MMAP) |
472 | if (S_ISREG(stat.st_mode) && stat.st_size > 0) { | 467 | if (S_ISREG(stat.st_mode) && stat.st_size > 0) { |
473 | d->input.length = stat.st_size; | 468 | d->input.length = stat.st_size; |
474 | d->input.fdm = map_file(d->input.fd, &d->input.length); | 469 | d->input.fdm = map_file(d->input.fd, &d->input.length); |
475 | if (d->input.fdm == 0) { | 470 | if (d->input.fdm == 0) { |
476 | // odebug << "error mmapping file" << oendl; return FALSE; | 471 | // qDebug("error mmapping file"); return FALSE; |
477 | } | 472 | } |
478 | d->input.data = (unsigned char *)d->input.fdm; | 473 | d->input.data = (unsigned char *)d->input.fdm; |
479 | } | 474 | } |
480 | #endif | 475 | #endif |
481 | 476 | ||
482 | if (d->input.data == 0) { | 477 | if (d->input.data == 0) { |
483 | d->input.data = (unsigned char *)malloc( bufferSize /*MPEG_BUFFER_SIZE*/); | 478 | d->input.data = (unsigned char *)malloc( bufferSize /*MPEG_BUFFER_SIZE*/); |
484 | if (d->input.data == 0) { | 479 | if (d->input.data == 0) { |
485 | // odebug << "error allocating input buffer" << oendl; | 480 | // qDebug("error allocating input buffer"); |
486 | return FALSE; | 481 | return FALSE; |
487 | } | 482 | } |
488 | d->input.length = 0; | 483 | d->input.length = 0; |
489 | } | 484 | } |
490 | 485 | ||
491 | d->input.eof = 0; | 486 | d->input.eof = 0; |
492 | 487 | ||
493 | mad_stream_init(&d->stream); | 488 | mad_stream_init(&d->stream); |
494 | mad_frame_init(&d->frame); | 489 | mad_frame_init(&d->frame); |
495 | mad_synth_init(&d->synth); | 490 | mad_synth_init(&d->synth); |
496 | 491 | ||
497 | return TRUE; | 492 | return TRUE; |
498 | } | 493 | } |
499 | 494 | ||
500 | 495 | ||
501 | bool LibMadPlugin::close() { | 496 | bool LibMadPlugin::close() { |
502 | debugMsg( "LibMadPlugin::close" ); | 497 | debugMsg( "LibMadPlugin::close" ); |
503 | 498 | ||
504 | int result = TRUE; | 499 | int result = TRUE; |
505 | 500 | ||
506 | mad_synth_finish(&d->synth); | 501 | mad_synth_finish(&d->synth); |
507 | mad_frame_finish(&d->frame); | 502 | mad_frame_finish(&d->frame); |
508 | mad_stream_finish(&d->stream); | 503 | mad_stream_finish(&d->stream); |
509 | 504 | ||
510 | #if defined(HAVE_MMAP) | 505 | #if defined(HAVE_MMAP) |
511 | if (d->input.fdm) { | 506 | if (d->input.fdm) { |
512 | if (unmap_file(d->input.fdm, d->input.length) == -1) { | 507 | if (unmap_file(d->input.fdm, d->input.length) == -1) { |
513 | // odebug << "error munmapping file" << oendl; | 508 | // qDebug("error munmapping file"); |
514 | result = FALSE; | 509 | result = FALSE; |
515 | } | 510 | } |
516 | d->input.fdm = 0; | 511 | d->input.fdm = 0; |
517 | d->input.data = 0; | 512 | d->input.data = 0; |
518 | } | 513 | } |
519 | #endif | 514 | #endif |
520 | 515 | ||
521 | if (d->input.data) { | 516 | if (d->input.data) { |
522 | free(d->input.data); | 517 | free(d->input.data); |
523 | d->input.data = 0; | 518 | d->input.data = 0; |
524 | } | 519 | } |
525 | 520 | ||
526 | if (::close(d->input.fd) == -1) { | 521 | if (::close(d->input.fd) == -1) { |
527 | // odebug << "error closing file " << d->input.path << "" << oendl; | 522 | // qDebug("error closing file %s", d->input.path); |
528 | result = FALSE; | 523 | result = FALSE; |
529 | } | 524 | } |
530 | 525 | ||
531 | d->input.fd = 0; | 526 | d->input.fd = 0; |
532 | 527 | ||
533 | return result; | 528 | return result; |
534 | } | 529 | } |
535 | 530 | ||
536 | 531 | ||
537 | bool LibMadPlugin::isOpen() { | 532 | bool LibMadPlugin::isOpen() { |
538 | debugMsg( "LibMadPlugin::isOpen" ); | 533 | debugMsg( "LibMadPlugin::isOpen" ); |
539 | return ( d->input.fd != 0 ); | 534 | return ( d->input.fd != 0 ); |
540 | } | 535 | } |
541 | 536 | ||
542 | 537 | ||
543 | int LibMadPlugin::audioStreams() { | 538 | int LibMadPlugin::audioStreams() { |
544 | debugMsg( "LibMadPlugin::audioStreams" ); | 539 | debugMsg( "LibMadPlugin::audioStreams" ); |
545 | return 1; | 540 | return 1; |
546 | } | 541 | } |
547 | 542 | ||
548 | 543 | ||
549 | int LibMadPlugin::audioChannels( int ) { | 544 | int LibMadPlugin::audioChannels( int ) { |
550 | debugMsg( "LibMadPlugin::audioChannels" ); | 545 | debugMsg( "LibMadPlugin::audioChannels" ); |
551 | /* | 546 | /* |
552 | long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); | 547 | long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); |
553 | odebug << "LibMadPlugin::audioChannels: " << d->frame.header.mode > 0 ? 2 : 1 << "" << oendl; | 548 | qDebug( "LibMadPlugin::audioChannels: %i", d->frame.header.mode > 0 ? 2 : 1 ); |
554 | return d->frame.header.mode > 0 ? 2 : 1; | 549 | return d->frame.header.mode > 0 ? 2 : 1; |
555 | */ | 550 | */ |
556 | return 2; | 551 | return 2; |
557 | } | 552 | } |
558 | 553 | ||
559 | 554 | ||
560 | int LibMadPlugin::audioFrequency( int ) { | 555 | int LibMadPlugin::audioFrequency( int ) { |
561 | debugMsg( "LibMadPlugin::audioFrequency" ); | 556 | debugMsg( "LibMadPlugin::audioFrequency" ); |
562 | long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); | 557 | long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); |
563 | // odebug << "LibMadPlugin::audioFrequency: " << d->frame.header.samplerate << "" << oendl; | 558 | // qDebug( "LibMadPlugin::audioFrequency: %i", d->frame.header.samplerate ); |
564 | return d->frame.header.samplerate; | 559 | return d->frame.header.samplerate; |
565 | } | 560 | } |
566 | 561 | ||
567 | 562 | ||
568 | int LibMadPlugin::audioSamples( int ) { | 563 | int LibMadPlugin::audioSamples( int ) { |
569 | debugMsg( "LibMadPlugin::audioSamples" ); | 564 | debugMsg( "LibMadPlugin::audioSamples" ); |
570 | 565 | ||
571 | long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); | 566 | long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); |
572 | mad_header_decode( (struct mad_header *)&d->frame.header, &d->stream ); | 567 | mad_header_decode( (struct mad_header *)&d->frame.header, &d->stream ); |
573 | /* | 568 | /* |
574 | odebug << "LibMadPlugin::audioSamples: " << d->frame.header.duration.seconds << "*" << d->frame.header.samplerate << oendl; | 569 | qDebug( "LibMadPlugin::audioSamples: %i*%i", d->frame.header.duration.seconds, |
570 | d->frame.header.samplerate ); | ||
575 | return d->frame.header.duration.seconds * d->frame.header.samplerate; | 571 | return d->frame.header.duration.seconds * d->frame.header.samplerate; |
576 | */ | 572 | */ |
577 | if ( d->frame.header.bitrate == 0 ) | 573 | if ( d->frame.header.bitrate == 0 ) |
578 | return 0; | 574 | return 0; |
579 | int samples = (d->input.fileLength / (d->frame.header.bitrate/8)) * d->frame.header.samplerate; | 575 | int samples = (d->input.fileLength / (d->frame.header.bitrate/8)) * d->frame.header.samplerate; |
580 | 576 | ||
581 | // odebug << "LibMadPlugin::audioSamples: " << (int)d->input.fileLength | 577 | // qDebug( "LibMadPlugin::audioSamples: %i * %i * 8 / %i", (int)d->input.fileLength, |
582 | // << " * " << (int)d->frame.header.samplerate << " * 8 / " << (int)d->frame.header.bitrate << oendl; | 578 | // (int)d->frame.header.samplerate, (int)d->frame.header.bitrate ); |
583 | // odebug << "LibMadPlugin::audioSamples: " << samples << "" << oendl; | 579 | // qDebug( "LibMadPlugin::audioSamples: %i", samples ); |
584 | 580 | ||
585 | return samples; | 581 | return samples; |
586 | 582 | ||
587 | // return 10000000; | 583 | // return 10000000; |
588 | } | 584 | } |
589 | 585 | ||
590 | 586 | ||
591 | bool LibMadPlugin::audioSetSample( long, int ) { | 587 | bool LibMadPlugin::audioSetSample( long, int ) { |
592 | debugMsg( "LibMadPlugin::audioSetSample" ); | 588 | debugMsg( "LibMadPlugin::audioSetSample" ); |
593 | 589 | ||
594 | // long totalSamples = audioSamples(0); | 590 | // long totalSamples = audioSamples(0); |
595 | // if ( totalSamples <= 1 ) | 591 | // if ( totalSamples <= 1 ) |
596 | // return FALSE; | 592 | // return FALSE; |
597 | 593 | ||
598 | // // Seek to requested position | 594 | // // Seek to requested position |
599 | // odebug << "seek pos: " << (int)((double)pos * d->input.fileLength / totalSamples) << "" << oendl; | 595 | // qDebug( "seek pos: %i", (int)((double)pos * d->input.fileLength / totalSamples) ); |
600 | // ::lseek( d->input.fd, (long)((double)pos * d->input.fileLength / totalSamples), SEEK_SET ); | 596 | // ::lseek( d->input.fd, (long)((double)pos * d->input.fileLength / totalSamples), SEEK_SET ); |
601 | // mad_stream_sync(&d->stream); | 597 | // mad_stream_sync(&d->stream); |
602 | 598 | ||
603 | // mad_stream_init(&d->stream); | 599 | // mad_stream_init(&d->stream); |
604 | // mad_frame_init(&d->frame); | 600 | // mad_frame_init(&d->frame); |
605 | // mad_synth_init(&d->synth); | 601 | // mad_synth_init(&d->synth); |
606 | 602 | ||
607 | // return TRUE; | 603 | // return TRUE; |
608 | debugMsg( "LibMadPlugin::audioSetSample" ); | 604 | debugMsg( "LibMadPlugin::audioSetSample" ); |
609 | return FALSE; | 605 | return FALSE; |
610 | } | 606 | } |
611 | 607 | ||
612 | 608 | ||
613 | long LibMadPlugin::audioGetSample( int ) { | 609 | long LibMadPlugin::audioGetSample( int ) { |
614 | debugMsg( "LibMadPlugin::audioGetSample" ); | 610 | debugMsg( "LibMadPlugin::audioGetSample" ); |
615 | return 0; | 611 | return 0; |
616 | } | 612 | } |
617 | 613 | ||
618 | /* | 614 | /* |
619 | bool LibMadPlugin::audioReadSamples( short *, int, long, int ) { | 615 | bool LibMadPlugin::audioReadSamples( short *, int, long, int ) { |
620 | debugMsg( "LibMadPlugin::audioReadSamples" ); | 616 | debugMsg( "LibMadPlugin::audioReadSamples" ); |
621 | return FALSE; | 617 | return FALSE; |
622 | } | 618 | } |
623 | 619 | ||
624 | 620 | ||
625 | bool LibMadPlugin::audioReReadSamples( short *, int, long, int ) { | 621 | bool LibMadPlugin::audioReReadSamples( short *, int, long, int ) { |
626 | debugMsg( "LibMadPlugin::audioReReadSamples" ); | 622 | debugMsg( "LibMadPlugin::audioReReadSamples" ); |
627 | return FALSE; | 623 | return FALSE; |
628 | } | 624 | } |
629 | */ | 625 | */ |
630 | 626 | ||
631 | bool LibMadPlugin::read() { | 627 | bool LibMadPlugin::read() { |
632 | debugMsg( "LibMadPlugin::read" ); | 628 | debugMsg( "LibMadPlugin::read" ); |
633 | int len; | 629 | int len; |
634 | 630 | ||
635 | if (d->input.eof) | 631 | if (d->input.eof) |
636 | return FALSE; | 632 | return FALSE; |
637 | 633 | ||
638 | #if defined(HAVE_MMAP) | 634 | #if defined(HAVE_MMAP) |
639 | if (d->input.fdm) { | 635 | if (d->input.fdm) { |
640 | unsigned long skip = 0; | 636 | unsigned long skip = 0; |
641 | 637 | ||
642 | if (d->stream.next_frame) { | 638 | if (d->stream.next_frame) { |
643 | struct stat stat; | 639 | struct stat stat; |
644 | 640 | ||
645 | if (fstat(d->input.fd, &stat) == -1) | 641 | if (fstat(d->input.fd, &stat) == -1) |
646 | return FALSE; | 642 | return FALSE; |
647 | 643 | ||
648 | if (stat.st_size + MAD_BUFFER_GUARD <= (signed)d->input.length) | 644 | if (stat.st_size + MAD_BUFFER_GUARD <= (signed)d->input.length) |
649 | return FALSE; | 645 | return FALSE; |
650 | 646 | ||
651 | // file size changed; update memory map | 647 | // file size changed; update memory map |
652 | skip = d->stream.next_frame - d->input.data; | 648 | skip = d->stream.next_frame - d->input.data; |
653 | 649 | ||
654 | if (unmap_file(d->input.fdm, d->input.length) == -1) { | 650 | if (unmap_file(d->input.fdm, d->input.length) == -1) { |
655 | d->input.fdm = 0; | 651 | d->input.fdm = 0; |
656 | d->input.data = 0; | 652 | d->input.data = 0; |
657 | return FALSE; | 653 | return FALSE; |
658 | } | 654 | } |
659 | 655 | ||
660 | d->input.length = stat.st_size; | 656 | d->input.length = stat.st_size; |
661 | 657 | ||
662 | d->input.fdm = map_file(d->input.fd, &d->input.length); | 658 | d->input.fdm = map_file(d->input.fd, &d->input.length); |
663 | if (d->input.fdm == 0) { | 659 | if (d->input.fdm == 0) { |
664 | d->input.data = 0; | 660 | d->input.data = 0; |
665 | return FALSE; | 661 | return FALSE; |
666 | } | 662 | } |
667 | 663 | ||
668 | d->input.data = (unsigned char *)d->input.fdm; | 664 | d->input.data = (unsigned char *)d->input.fdm; |
669 | } | 665 | } |
670 | 666 | ||
671 | mad_stream_buffer(&d->stream, d->input.data + skip, d->input.length - skip); | 667 | mad_stream_buffer(&d->stream, d->input.data + skip, d->input.length - skip); |
672 | 668 | ||
673 | } else | 669 | } else |
674 | #endif | 670 | #endif |
675 | { | 671 | { |
676 | if (d->stream.next_frame) { | 672 | if (d->stream.next_frame) { |
677 | memmove(d->input.data, d->stream.next_frame, | 673 | memmove(d->input.data, d->stream.next_frame, |
678 | d->input.length = &d->input.data[d->input.length] - d->stream.next_frame); | 674 | d->input.length = &d->input.data[d->input.length] - d->stream.next_frame); |
679 | } | 675 | } |
680 | 676 | ||
681 | do { | 677 | do { |
682 | len = ::read(d->input.fd, d->input.data + d->input.length, bufferSize /* MPEG_BUFFER_SIZE*/ - d->input.length); | 678 | len = ::read(d->input.fd, d->input.data + d->input.length, bufferSize /* MPEG_BUFFER_SIZE*/ - d->input.length); |
683 | } | 679 | } |
684 | while (len == -1 && errno == EINTR); | 680 | while (len == -1 && errno == EINTR); |
685 | 681 | ||
686 | if (len == -1) { | 682 | if (len == -1) { |
687 | // odebug << "error reading audio" << oendl; | 683 | // qDebug("error reading audio"); |
688 | return FALSE; | 684 | return FALSE; |
689 | } | 685 | } |
690 | else if (len == 0) { | 686 | else if (len == 0) { |
691 | d->input.eof = 1; | 687 | d->input.eof = 1; |
692 | 688 | ||
693 | assert(bufferSize /*MPEG_BUFFER_SIZE*/ - d->input.length >= MAD_BUFFER_GUARD); | 689 | assert(bufferSize /*MPEG_BUFFER_SIZE*/ - d->input.length >= MAD_BUFFER_GUARD); |
694 | 690 | ||
695 | while (len < MAD_BUFFER_GUARD) | 691 | while (len < MAD_BUFFER_GUARD) |
696 | d->input.data[d->input.length + len++] = 0; | 692 | d->input.data[d->input.length + len++] = 0; |
697 | } | 693 | } |
698 | 694 | ||
699 | mad_stream_buffer(&d->stream, d->input.data, d->input.length += len); | 695 | mad_stream_buffer(&d->stream, d->input.data, d->input.length += len); |
700 | } | 696 | } |
701 | 697 | ||
702 | return TRUE; | 698 | return TRUE; |
703 | } | 699 | } |
704 | 700 | ||
705 | 701 | ||
706 | static mad_fixed_t left_err, right_err; | 702 | static mad_fixed_t left_err, right_err; |
707 | static const int bits = 16; | 703 | static const int bits = 16; |
708 | static const int shift = MAD_F_FRACBITS + 1 - bits; | 704 | static const int shift = MAD_F_FRACBITS + 1 - bits; |
709 | 705 | ||
710 | 706 | ||
711 | inline long audio_linear_dither( mad_fixed_t sample, mad_fixed_t& error ) { | 707 | inline long audio_linear_dither( mad_fixed_t sample, mad_fixed_t& error ) { |
712 | sample += error; | 708 | sample += error; |
713 | mad_fixed_t quantized = (sample >= MAD_F_ONE) ? MAD_F_ONE - 1 : ( (sample < -MAD_F_ONE) ? -MAD_F_ONE : sample ); | 709 | mad_fixed_t quantized = (sample >= MAD_F_ONE) ? MAD_F_ONE - 1 : ( (sample < -MAD_F_ONE) ? -MAD_F_ONE : sample ); |
714 | quantized &= ~((1L << shift) - 1); | 710 | quantized &= ~((1L << shift) - 1); |
715 | error = sample - quantized; | 711 | error = sample - quantized; |
716 | return quantized >> shift; | 712 | return quantized >> shift; |
717 | } | 713 | } |
718 | 714 | ||
719 | 715 | ||
720 | inline void audio_pcm( short *data, unsigned int nsamples, mad_fixed_t *left, mad_fixed_t *right ) { | 716 | inline void audio_pcm( short *data, unsigned int nsamples, mad_fixed_t *left, mad_fixed_t *right ) { |
721 | if ( right ) { | 717 | if ( right ) { |
722 | while (nsamples--) { | 718 | while (nsamples--) { |
723 | data[0] = audio_linear_dither( *left++, left_err ); | 719 | data[0] = audio_linear_dither( *left++, left_err ); |
724 | data[1] = audio_linear_dither( *right++, right_err ); | 720 | data[1] = audio_linear_dither( *right++, right_err ); |
725 | data += 2; | 721 | data += 2; |
726 | } | 722 | } |
727 | } else { | 723 | } else { |
728 | while (nsamples--) { | 724 | while (nsamples--) { |
729 | data[0] = data[1] = audio_linear_dither( *left++, left_err ); | 725 | data[0] = data[1] = audio_linear_dither( *left++, left_err ); |
730 | data += 2; | 726 | data += 2; |
731 | } | 727 | } |
732 | } | 728 | } |
733 | } | 729 | } |
734 | 730 | ||
735 | 731 | ||
736 | bool LibMadPlugin::decode( short *output, long samples, long& samplesMade ) { | 732 | bool LibMadPlugin::decode( short *output, long samples, long& samplesMade ) { |
737 | debugMsg( "LibMadPlugin::decode" ); | 733 | debugMsg( "LibMadPlugin::decode" ); |
738 | 734 | ||
739 | static int buffered = 0; | 735 | static int buffered = 0; |
740 | static mad_fixed_t buffer[2][65536 * 2]; | 736 | static mad_fixed_t buffer[2][65536 * 2]; |
741 | int offset = buffered; | 737 | int offset = buffered; |
742 | samplesMade = 0; | 738 | samplesMade = 0; |
743 | 739 | ||
744 | static int maxBuffered = 8000; // 65536; | 740 | static int maxBuffered = 8000; // 65536; |
745 | 741 | ||
746 | if ( samples > maxBuffered ) { | 742 | if ( samples > maxBuffered ) { |
747 | samples = maxBuffered; | 743 | samples = maxBuffered; |
748 | } | 744 | } |
749 | 745 | ||
750 | if ( d->flush ) { | 746 | if ( d->flush ) { |
751 | buffered = 0; | 747 | buffered = 0; |
752 | offset = 0; | 748 | offset = 0; |
753 | d->flush = FALSE; | 749 | d->flush = FALSE; |
754 | } | 750 | } |
755 | 751 | ||
756 | while ( buffered < maxBuffered ) { | 752 | while ( buffered < maxBuffered ) { |
757 | 753 | ||
758 | while (mad_frame_decode(&d->frame, &d->stream) == -1) { | 754 | while (mad_frame_decode(&d->frame, &d->stream) == -1) { |
759 | if (!MAD_RECOVERABLE(d->stream.error)) { | 755 | if (!MAD_RECOVERABLE(d->stream.error)) { |
760 | debugMsg( "feed me" ); | 756 | debugMsg( "feed me" ); |
761 | return FALSE; // Feed me | 757 | return FALSE; // Feed me |
762 | } | 758 | } |
763 | if ( d->stream.error == MAD_ERROR_BADCRC ) { | 759 | if ( d->stream.error == MAD_ERROR_BADCRC ) { |
764 | mad_frame_mute(&d->frame); | 760 | mad_frame_mute(&d->frame); |
765 | // odebug << "error decoding, bad crc" << oendl; | 761 | // qDebug( "error decoding, bad crc" ); |
766 | } | 762 | } |
767 | } | 763 | } |
768 | 764 | ||
769 | mad_synth_frame(&d->synth, &d->frame); | 765 | mad_synth_frame(&d->synth, &d->frame); |
770 | int decodedSamples = d->synth.pcm.length; | 766 | int decodedSamples = d->synth.pcm.length; |
771 | memcpy( &(buffer[0][offset]), d->synth.pcm.samples[0], decodedSamples * sizeof(mad_fixed_t) ); | 767 | memcpy( &(buffer[0][offset]), d->synth.pcm.samples[0], decodedSamples * sizeof(mad_fixed_t) ); |
772 | if ( d->synth.pcm.channels == 2 ) | 768 | if ( d->synth.pcm.channels == 2 ) |
773 | memcpy( &(buffer[1][offset]), d->synth.pcm.samples[1], decodedSamples * sizeof(mad_fixed_t) ); | 769 | memcpy( &(buffer[1][offset]), d->synth.pcm.samples[1], decodedSamples * sizeof(mad_fixed_t) ); |
774 | offset += decodedSamples; | 770 | offset += decodedSamples; |
775 | buffered += decodedSamples; | 771 | buffered += decodedSamples; |
776 | } | 772 | } |
777 | 773 | ||
778 | //qApp->processEvents(); | 774 | //qApp->processEvents(); |
779 | audio_pcm( output, samples, buffer[0], (d->synth.pcm.channels == 2) ? buffer[1] : 0 ); | 775 | audio_pcm( output, samples, buffer[0], (d->synth.pcm.channels == 2) ? buffer[1] : 0 ); |
780 | // audio_pcm( output, samples, buffer[1], buffer[0] ); | 776 | // audio_pcm( output, samples, buffer[1], buffer[0] ); |
781 | // audio_pcm( output, samples, buffer[0], buffer[1] ); | 777 | // audio_pcm( output, samples, buffer[0], buffer[1] ); |
782 | samplesMade = samples; | 778 | samplesMade = samples; |
783 | memmove( buffer[0], &(buffer[0][samples]), (buffered - samples) * sizeof(mad_fixed_t) ); | 779 | memmove( buffer[0], &(buffer[0][samples]), (buffered - samples) * sizeof(mad_fixed_t) ); |
784 | if ( d->synth.pcm.channels == 2 ) { | 780 | if ( d->synth.pcm.channels == 2 ) { |
785 | memmove( buffer[1], &(buffer[1][samples]), (buffered - samples) * sizeof(mad_fixed_t) ); | 781 | memmove( buffer[1], &(buffer[1][samples]), (buffered - samples) * sizeof(mad_fixed_t) ); |
786 | } | 782 | } |
787 | buffered -= samples; | 783 | buffered -= samples; |
788 | 784 | ||
789 | return TRUE; | 785 | return TRUE; |
790 | } | 786 | } |
791 | 787 | ||
792 | /*bool LibMadPlugin::audioReadStereoSamples( short *output, long samples, long& samplesMade, int ) { | 788 | /*bool LibMadPlugin::audioReadStereoSamples( short *output, long samples, long& samplesMade, int ) { |
793 | */ | 789 | */ |
794 | bool LibMadPlugin::audioReadSamples( short *output, int /*channels*/, long samples, long& samplesMade, int ) { | 790 | bool LibMadPlugin::audioReadSamples( short *output, int /*channels*/, long samples, long& samplesMade, int ) { |
795 | debugMsg( "LibMadPlugin::audioReadStereoSamples" ); | 791 | debugMsg( "LibMadPlugin::audioReadStereoSamples" ); |
796 | 792 | ||
797 | static bool needInput = TRUE; | 793 | static bool needInput = TRUE; |
798 | 794 | ||
799 | if ( samples == 0 ) | 795 | if ( samples == 0 ) |
800 | return FALSE; | 796 | return FALSE; |
801 | 797 | ||
802 | do { | 798 | do { |
803 | if ( needInput ) | 799 | if ( needInput ) |
804 | if ( !read() ) { | 800 | if ( !read() ) { |
805 | return FALSE; | 801 | return FALSE; |
806 | } | 802 | } |
807 | 803 | ||
808 | needInput = FALSE; | 804 | needInput = FALSE; |
809 | 805 | ||
810 | if ( decode( output, samples, samplesMade ) ) | 806 | if ( decode( output, samples, samplesMade ) ) |
811 | return TRUE; | 807 | return TRUE; |
812 | else | 808 | else |
813 | needInput = TRUE; | 809 | needInput = TRUE; |
814 | } | 810 | } |
815 | while ( ( samplesMade < samples ) && ( !d->input.eof ) ); | 811 | while ( ( samplesMade < samples ) && ( !d->input.eof ) ); |
816 | 812 | ||
817 | return FALSE; | 813 | return FALSE; |
818 | } | 814 | } |
819 | 815 | ||
820 | 816 | ||
821 | double LibMadPlugin::getTime() { | 817 | double LibMadPlugin::getTime() { |
822 | debugMsg( "LibMadPlugin::getTime" ); | 818 | debugMsg( "LibMadPlugin::getTime" ); |
823 | return 0.0; | 819 | return 0.0; |
824 | } | 820 | } |
825 | 821 | ||
826 | 822 | ||
827 | void LibMadPlugin::printID3Tags() { | 823 | void LibMadPlugin::printID3Tags() { |
828 | // odebug << "LibMadPlugin::printID3Tags" << oendl; | 824 | // qDebug( "LibMadPlugin::printID3Tags" ); |
829 | 825 | ||
830 | char id3v1[128 + 1]; | 826 | char id3v1[128 + 1]; |
831 | 827 | ||
832 | if ( ::lseek( d->input.fd, -128, SEEK_END ) == -1 ) { | 828 | if ( ::lseek( d->input.fd, -128, SEEK_END ) == -1 ) { |
833 | // odebug << "error seeking to id3 tags" << oendl; | 829 | // qDebug( "error seeking to id3 tags" ); |
834 | return; | 830 | return; |
835 | } | 831 | } |
836 | 832 | ||
837 | if ( ::read( d->input.fd, id3v1, 128 ) != 128 ) { | 833 | if ( ::read( d->input.fd, id3v1, 128 ) != 128 ) { |
838 | // odebug << "error reading in id3 tags" << oendl; | 834 | // qDebug( "error reading in id3 tags" ); |
839 | return; | 835 | return; |
840 | } | 836 | } |
841 | 837 | ||
842 | if ( ::strncmp( (const char *)id3v1, "TAG", 3 ) != 0 ) { | 838 | if ( ::strncmp( (const char *)id3v1, "TAG", 3 ) != 0 ) { |
843 | debugMsg( "sorry, no id3 tags" ); | 839 | debugMsg( "sorry, no id3 tags" ); |
844 | } else { | 840 | } else { |
845 | int len[5] = { 30, 30, 30, 4, 30 }; | 841 | int len[5] = { 30, 30, 30, 4, 30 }; |
846 | QString label[5] = { tr( "Title" ), tr( "Artist" ), tr( "Album" ), tr( "Year" ), tr( "Comment" ) }; | 842 | QString label[5] = { tr( "Title" ), tr( "Artist" ), tr( "Album" ), tr( "Year" ), tr( "Comment" ) }; |
847 | char *ptr = id3v1 + 3, *ptr2 = ptr + len[0]; | 843 | char *ptr = id3v1 + 3, *ptr2 = ptr + len[0]; |
848 | // odebug << "ID3 tags in file:" << oendl; | 844 | // qDebug( "ID3 tags in file:" ); |
849 | info = ""; | 845 | info = ""; |
850 | for ( int i = 0; i < 5; ptr += len[i], i++, ptr2 += len[i] ) { | 846 | for ( int i = 0; i < 5; ptr += len[i], i++, ptr2 += len[i] ) { |
851 | char push = *ptr2; | 847 | char push = *ptr2; |
852 | *ptr2 = '\0'; | 848 | *ptr2 = '\0'; |
853 | char *ptr3 = ptr2; | 849 | char *ptr3 = ptr2; |
854 | while ( ptr3-1 >= ptr && isspace(ptr3[-1]) ) ptr3--; | 850 | while ( ptr3-1 >= ptr && isspace(ptr3[-1]) ) ptr3--; |
855 | char push2 = *ptr3; *ptr3 = '\0'; | 851 | char push2 = *ptr3; *ptr3 = '\0'; |
856 | if ( strcmp( ptr, "" ) ) { | 852 | if ( strcmp( ptr, "" ) ) { |
857 | if( ((QString)ptr).find(" ") == -1) // don't add anything that has blanks | 853 | if( ((QString)ptr).find(" ") == -1) // don't add anything that has blanks |
858 | info += ( i != 0 ? ", " : "" ) + label[i] + ": " + ptr; | 854 | info += ( i != 0 ? ", " : "" ) + label[i] + ": " + ptr; |
859 | } | 855 | } |
860 | // odebug << info.latin1() << oendl; | 856 | // qDebug( info.latin1() ); |
861 | *ptr3 = push2; | 857 | *ptr3 = push2; |
862 | *ptr2 = push; | 858 | *ptr2 = push; |
863 | } | 859 | } |
864 | if (id3v1[126] == 0 && id3v1[127] != 0) | 860 | if (id3v1[126] == 0 && id3v1[127] != 0) |
865 | info += tr( ", Track: " ) + id3v1[127]; | 861 | info += tr( ", Track: " ) + id3v1[127]; |
866 | } | 862 | } |
867 | 863 | ||
868 | if ( ::lseek(d->input.fd, 0, SEEK_SET) == -1 ) { | 864 | if ( ::lseek(d->input.fd, 0, SEEK_SET) == -1 ) { |
869 | // odebug << "error seeking back to beginning" << oendl; | 865 | // qDebug( "error seeking back to beginning" ); |
870 | return; | 866 | return; |
871 | } | 867 | } |
872 | } | 868 | } |
873 | 869 | ||
diff --git a/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp b/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp index b3e01e5..67779e8 100644 --- a/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp +++ b/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp | |||
@@ -1,72 +1,70 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "libmadplugin.h" | 20 | #include "libmadplugin.h" |
21 | #include "libmadpluginimpl.h" | 21 | #include "libmadpluginimpl.h" |
22 | 22 | ||
23 | 23 | ||
24 | LibMadPluginImpl::LibMadPluginImpl() | 24 | LibMadPluginImpl::LibMadPluginImpl() |
25 | : libmadplugin(0), ref(0) | 25 | : libmadplugin(0), ref(0) |
26 | { | 26 | { |
27 | } | 27 | } |
28 | 28 | ||
29 | 29 | ||
30 | LibMadPluginImpl::~LibMadPluginImpl() | 30 | LibMadPluginImpl::~LibMadPluginImpl() |
31 | { | 31 | { |
32 | if ( libmadplugin ) | 32 | if ( libmadplugin ) |
33 | delete libmadplugin; | 33 | delete libmadplugin; |
34 | } | 34 | } |
35 | 35 | ||
36 | 36 | ||
37 | MediaPlayerDecoder *LibMadPluginImpl::decoder() | 37 | MediaPlayerDecoder *LibMadPluginImpl::decoder() |
38 | { | 38 | { |
39 | if ( !libmadplugin ) | 39 | if ( !libmadplugin ) |
40 | libmadplugin = new LibMadPlugin; | 40 | libmadplugin = new LibMadPlugin; |
41 | return libmadplugin; | 41 | return libmadplugin; |
42 | } | 42 | } |
43 | 43 | ||
44 | 44 | ||
45 | MediaPlayerEncoder *LibMadPluginImpl::encoder() | 45 | MediaPlayerEncoder *LibMadPluginImpl::encoder() |
46 | { | 46 | { |
47 | return NULL; | 47 | return NULL; |
48 | } | 48 | } |
49 | 49 | ||
50 | 50 | ||
51 | #ifndef QT_NO_COMPONENT | 51 | #ifndef QT_NO_COMPONENT |
52 | 52 | ||
53 | 53 | ||
54 | QRESULT LibMadPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 54 | QRESULT LibMadPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
55 | { | 55 | { |
56 | *iface = 0; | 56 | *iface = 0; |
57 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) | 57 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) |
58 | *iface = this, (*iface)->addRef(); | 58 | *iface = this, (*iface)->addRef(); |
59 | else | ||
60 | return QS_FALSE; | ||
61 | return QS_OK; | 59 | return QS_OK; |
62 | } | 60 | } |
63 | 61 | ||
64 | 62 | ||
65 | Q_EXPORT_INTERFACE() | 63 | Q_EXPORT_INTERFACE() |
66 | { | 64 | { |
67 | Q_CREATE_INSTANCE( LibMadPluginImpl ) | 65 | Q_CREATE_INSTANCE( LibMadPluginImpl ) |
68 | } | 66 | } |
69 | 67 | ||
70 | 68 | ||
71 | #endif | 69 | #endif |
72 | 70 | ||
diff --git a/core/multimedia/opieplayer/libmad/mad.h b/core/multimedia/opieplayer/libmad/mad.h index 9db9da3..9ef6cc8 100644 --- a/core/multimedia/opieplayer/libmad/mad.h +++ b/core/multimedia/opieplayer/libmad/mad.h | |||
@@ -1,830 +1,964 @@ | |||
1 | /* | 1 | /* |
2 | * mad - MPEG audio decoder | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * If you would like to negotiate alternate licensing terms, you may do | 19 | * If you would like to negotiate alternate licensing terms, you may do |
20 | * so by contacting the author: Robert Leslie <rob@mars.org> | 20 | * so by contacting: Underbit Technologies, Inc. <info@underbit.com> |
21 | */ | 21 | */ |
22 | 22 | ||
23 | # ifdef __cplusplus | ||
24 | extern "C" { | ||
25 | # endif | ||
26 | |||
27 | # define FPM_INTEL | ||
28 | |||
29 | |||
30 | |||
23 | # define SIZEOF_INT 4 | 31 | # define SIZEOF_INT 4 |
24 | # define SIZEOF_LONG 4 | 32 | # define SIZEOF_LONG 4 |
25 | # define SIZEOF_LONG_LONG 8 | 33 | # define SIZEOF_LONG_LONG 8 |
26 | 34 | ||
27 | /* Id: version.h,v 1.16 2001/04/05 04:57:11 rob Exp */ | 35 | |
36 | /* Id: version.h,v 1.26 2004/01/23 09:41:33 rob Exp */ | ||
28 | 37 | ||
29 | # ifndef LIBMAD_VERSION_H | 38 | # ifndef LIBMAD_VERSION_H |
30 | # define LIBMAD_VERSION_H | 39 | # define LIBMAD_VERSION_H |
31 | 40 | ||
32 | # define MAD_VERSION_MAJOR0 | 41 | # define MAD_VERSION_MAJOR0 |
33 | # define MAD_VERSION_MINOR13 | 42 | # define MAD_VERSION_MINOR15 |
34 | # define MAD_VERSION_PATCH0 | 43 | # define MAD_VERSION_PATCH1 |
35 | # define MAD_VERSION_EXTRA" (beta)" | 44 | # define MAD_VERSION_EXTRA" (beta)" |
36 | 45 | ||
37 | # define MAD_VERSION_STRINGIZE(str)#str | 46 | # define MAD_VERSION_STRINGIZE(str)#str |
38 | # define MAD_VERSION_STRING(num)MAD_VERSION_STRINGIZE(num) | 47 | # define MAD_VERSION_STRING(num)MAD_VERSION_STRINGIZE(num) |
39 | 48 | ||
40 | # define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ | 49 | # define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ |
41 | MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ | 50 | MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ |
42 | MAD_VERSION_STRING(MAD_VERSION_PATCH) \ | 51 | MAD_VERSION_STRING(MAD_VERSION_PATCH) \ |
43 | MAD_VERSION_EXTRA | 52 | MAD_VERSION_EXTRA |
44 | 53 | ||
45 | # define MAD_PUBLISHYEAR"2000-2001" | 54 | # define MAD_PUBLISHYEAR"2000-2004" |
46 | # define MAD_AUTHOR "Robert Leslie" | 55 | # define MAD_AUTHOR "Underbit Technologies, Inc." |
47 | # define MAD_EMAIL "rob@mars.org" | 56 | # define MAD_EMAIL "info@underbit.com" |
48 | 57 | ||
49 | extern char const mad_version[]; | 58 | extern char const mad_version[]; |
50 | extern char const mad_copyright[]; | 59 | extern char const mad_copyright[]; |
51 | extern char const mad_author[]; | 60 | extern char const mad_author[]; |
52 | extern char const mad_build[]; | 61 | extern char const mad_build[]; |
53 | 62 | ||
54 | # endif | 63 | # endif |
55 | 64 | ||
56 | /* Id: fixed.h,v 1.23 2001/04/05 04:57:11 rob Exp */ | 65 | /* Id: fixed.h,v 1.38 2004/02/17 02:02:03 rob Exp */ |
57 | 66 | ||
58 | # ifndef LIBMAD_FIXED_H | 67 | # ifndef LIBMAD_FIXED_H |
59 | # define LIBMAD_FIXED_H | 68 | # define LIBMAD_FIXED_H |
60 | 69 | ||
61 | # if SIZEOF_INT >= 4 | 70 | # if SIZEOF_INT >= 4 |
62 | typedef signed int mad_fixed_t; | 71 | typedef signed int mad_fixed_t; |
63 | 72 | ||
64 | typedef signed int mad_fixed64hi_t; | 73 | typedef signed int mad_fixed64hi_t; |
65 | typedef unsigned int mad_fixed64lo_t; | 74 | typedef unsigned int mad_fixed64lo_t; |
66 | # else | 75 | # else |
67 | typedef signed long mad_fixed_t; | 76 | typedef signed long mad_fixed_t; |
68 | 77 | ||
69 | typedef signed long mad_fixed64hi_t; | 78 | typedef signed long mad_fixed64hi_t; |
70 | typedef unsigned long mad_fixed64lo_t; | 79 | typedef unsigned long mad_fixed64lo_t; |
71 | # endif | 80 | # endif |
72 | 81 | ||
82 | # if defined(_MSC_VER) | ||
83 | # define mad_fixed64_t signed __int64 | ||
84 | # elif 1 || defined(__GNUC__) | ||
85 | # define mad_fixed64_t signed long long | ||
86 | # endif | ||
87 | |||
88 | # if defined(FPM_FLOAT) | ||
89 | typedef double mad_sample_t; | ||
90 | # else | ||
91 | typedef mad_fixed_t mad_sample_t; | ||
92 | # endif | ||
93 | |||
73 | /* | 94 | /* |
74 | * Fixed-point format: 0xABBBBBBB | 95 | * Fixed-point format: 0xABBBBBBB |
75 | * A == whole part (sign + 3 bits) | 96 | * A == whole part (sign + 3 bits) |
76 | * B == fractional part (28 bits) | 97 | * B == fractional part (28 bits) |
77 | * | 98 | * |
78 | * Values are signed two's complement, so the effective range is: | 99 | * Values are signed two's complement, so the effective range is: |
79 | * 0x80000000 to 0x7fffffff | 100 | * 0x80000000 to 0x7fffffff |
80 | * -8.0 to +7.9999999962747097015380859375 | 101 | * -8.0 to +7.9999999962747097015380859375 |
81 | * | 102 | * |
82 | * The smallest representable value is: | 103 | * The smallest representable value is: |
83 | * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9) | 104 | * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9) |
84 | * | 105 | * |
85 | * 28 bits of fractional accuracy represent about | 106 | * 28 bits of fractional accuracy represent about |
86 | * 8.6 digits of decimal accuracy. | 107 | * 8.6 digits of decimal accuracy. |
87 | * | 108 | * |
88 | * Fixed-point numbers can be added or subtracted as normal | 109 | * Fixed-point numbers can be added or subtracted as normal |
89 | * integers, but multiplication requires shifting the 64-bit result | 110 | * integers, but multiplication requires shifting the 64-bit result |
90 | * from 56 fractional bits back to 28 (and rounding.) | 111 | * from 56 fractional bits back to 28 (and rounding.) |
91 | * | 112 | * |
92 | * Changing the definition of MAD_F_FRACBITS is only partially | 113 | * Changing the definition of MAD_F_FRACBITS is only partially |
93 | * supported, and must be done with care. | 114 | * supported, and must be done with care. |
94 | */ | 115 | */ |
95 | 116 | ||
96 | # define MAD_F_FRACBITS 28 | 117 | # define MAD_F_FRACBITS 28 |
97 | 118 | ||
98 | # if MAD_F_FRACBITS == 28 | 119 | # if MAD_F_FRACBITS == 28 |
99 | # define MAD_F(x) ((mad_fixed_t) (x##L)) | 120 | # define MAD_F(x) ((mad_fixed_t) (x##L)) |
100 | # else | 121 | # else |
101 | # if MAD_F_FRACBITS < 28 | 122 | # if MAD_F_FRACBITS < 28 |
102 | # warning "MAD_F_FRACBITS < 28" | 123 | # warning "MAD_F_FRACBITS < 28" |
103 | # define MAD_F(x) ((mad_fixed_t) \ | 124 | # define MAD_F(x) ((mad_fixed_t) \ |
104 | (((x##L) + \ | 125 | (((x##L) + \ |
105 | (1L << (28 - MAD_F_FRACBITS - 1))) >> \ | 126 | (1L << (28 - MAD_F_FRACBITS - 1))) >> \ |
106 | (28 - MAD_F_FRACBITS))) | 127 | (28 - MAD_F_FRACBITS))) |
107 | # elif MAD_F_FRACBITS > 28 | 128 | # elif MAD_F_FRACBITS > 28 |
108 | # error "MAD_F_FRACBITS > 28 not currently supported" | 129 | # error "MAD_F_FRACBITS > 28 not currently supported" |
109 | # define MAD_F(x) ((mad_fixed_t) \ | 130 | # define MAD_F(x) ((mad_fixed_t) \ |
110 | ((x##L) << (MAD_F_FRACBITS - 28))) | 131 | ((x##L) << (MAD_F_FRACBITS - 28))) |
111 | # endif | 132 | # endif |
112 | # endif | 133 | # endif |
113 | 134 | ||
114 | # define MAD_F_MIN ((mad_fixed_t) -0x80000000L) | 135 | # define MAD_F_MIN ((mad_fixed_t) -0x80000000L) |
115 | # define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) | 136 | # define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) |
116 | 137 | ||
117 | # define MAD_F_ONE MAD_F(0x10000000) | 138 | # define MAD_F_ONE MAD_F(0x10000000) |
118 | 139 | ||
119 | # define mad_f_tofixed(x)((mad_fixed_t) \ | 140 | # define mad_f_tofixed(x)((mad_fixed_t) \ |
120 | ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) | 141 | ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) |
121 | # define mad_f_todouble(x)((double) \ | 142 | # define mad_f_todouble(x)((double) \ |
122 | ((x) / (double) (1L << MAD_F_FRACBITS))) | 143 | ((x) / (double) (1L << MAD_F_FRACBITS))) |
123 | 144 | ||
124 | # define mad_f_intpart(x)((x) >> MAD_F_FRACBITS) | 145 | # define mad_f_intpart(x)((x) >> MAD_F_FRACBITS) |
125 | # define mad_f_fracpart(x)((x) & ((1L << MAD_F_FRACBITS) - 1)) | 146 | # define mad_f_fracpart(x)((x) & ((1L << MAD_F_FRACBITS) - 1)) |
126 | /* (x should be positive) */ | 147 | /* (x should be positive) */ |
127 | 148 | ||
128 | # define mad_f_fromint(x)((x) << MAD_F_FRACBITS) | 149 | # define mad_f_fromint(x)((x) << MAD_F_FRACBITS) |
129 | 150 | ||
130 | # define mad_f_add(x, y)((x) + (y)) | 151 | # define mad_f_add(x, y)((x) + (y)) |
131 | # define mad_f_sub(x, y)((x) - (y)) | 152 | # define mad_f_sub(x, y)((x) - (y)) |
132 | 153 | ||
133 | # if defined(FPM_64BIT) | 154 | # if defined(FPM_FLOAT) |
155 | # error "FPM_FLOAT not yet supported" | ||
156 | |||
157 | # undef MAD_F | ||
158 | # define MAD_F(x) mad_f_todouble(x) | ||
159 | |||
160 | # define mad_f_mul(x, y)((x) * (y)) | ||
161 | # define mad_f_scale64 | ||
162 | |||
163 | # undef ASO_ZEROCHECK | ||
164 | |||
165 | # elif defined(FPM_64BIT) | ||
134 | 166 | ||
135 | /* | 167 | /* |
136 | * This version should be the most accurate if 64-bit (long long) types are | 168 | * This version should be the most accurate if 64-bit types are supported by |
137 | * supported by the compiler, although it may not be the most efficient. | 169 | * the compiler, although it may not be the most efficient. |
138 | */ | 170 | */ |
139 | # if defined(OPT_ACCURACY) | 171 | # if defined(OPT_ACCURACY) |
140 | # define mad_f_mul(x, y) \ | 172 | # define mad_f_mul(x, y) \ |
141 | ((mad_fixed_t) \ | 173 | ((mad_fixed_t) \ |
142 | ((((signed long long) (x) * (y)) + \ | 174 | ((((mad_fixed64_t) (x) * (y)) + \ |
143 | (1L << (MAD_F_SCALEBITS - 1))) >> MAD_F_SCALEBITS)) | 175 | (1L << (MAD_F_SCALEBITS - 1))) >> MAD_F_SCALEBITS)) |
144 | # else | 176 | # else |
145 | # define mad_f_mul(x, y) \ | 177 | # define mad_f_mul(x, y) \ |
146 | ((mad_fixed_t) (((signed long long) (x) * (y)) >> MAD_F_SCALEBITS)) | 178 | ((mad_fixed_t) (((mad_fixed64_t) (x) * (y)) >> MAD_F_SCALEBITS)) |
147 | # endif | 179 | # endif |
148 | 180 | ||
149 | # define MAD_F_SCALEBITS MAD_F_FRACBITS | 181 | # define MAD_F_SCALEBITS MAD_F_FRACBITS |
150 | 182 | ||
151 | /* --- Intel --------------------------------------------------------------- */ | 183 | /* --- Intel --------------------------------------------------------------- */ |
152 | 184 | ||
153 | # elif defined(FPM_INTEL) | 185 | # elif defined(FPM_INTEL) |
154 | 186 | ||
187 | # if defined(_MSC_VER) | ||
188 | # pragma warning(push) | ||
189 | # pragma warning(disable: 4035) /* no return value */ | ||
190 | static __forceinline | ||
191 | mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | ||
192 | { | ||
193 | enum { | ||
194 | fracbits = MAD_F_FRACBITS | ||
195 | }; | ||
196 | |||
197 | __asm { | ||
198 | mov eax, x | ||
199 | imul y | ||
200 | shrd eax, edx, fracbits | ||
201 | } | ||
202 | |||
203 | /* implicit return of eax */ | ||
204 | } | ||
205 | # pragma warning(pop) | ||
206 | |||
207 | # define mad_f_mul mad_f_mul_inline | ||
208 | # define mad_f_scale64 | ||
209 | # else | ||
155 | /* | 210 | /* |
156 | * This Intel version is fast and accurate; the disposition of the least | 211 | * This Intel version is fast and accurate; the disposition of the least |
157 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). | 212 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). |
158 | */ | 213 | */ |
159 | # define MAD_F_MLX(hi, lo, x, y) \ | 214 | # define MAD_F_MLX(hi, lo, x, y) \ |
160 | asm ("imull %3" \ | 215 | asm ("imull %3" \ |
161 | : "=a" (lo), "=d" (hi) \ | 216 | : "=a" (lo), "=d" (hi) \ |
162 | : "%a" (x), "rm" (y) \ | 217 | : "%a" (x), "rm" (y) \ |
163 | : "cc") | 218 | : "cc") |
164 | 219 | ||
165 | # if defined(OPT_ACCURACY) | 220 | # if defined(OPT_ACCURACY) |
166 | /* | 221 | /* |
167 | * This gives best accuracy but is not very fast. | 222 | * This gives best accuracy but is not very fast. |
168 | */ | 223 | */ |
169 | # define MAD_F_MLA(hi, lo, x, y) \ | 224 | # define MAD_F_MLA(hi, lo, x, y) \ |
170 | ({ mad_fixed64hi_t __hi; \ | 225 | ({ mad_fixed64hi_t __hi; \ |
171 | mad_fixed64lo_t __lo; \ | 226 | mad_fixed64lo_t __lo; \ |
172 | MAD_F_MLX(__hi, __lo, (x), (y)); \ | 227 | MAD_F_MLX(__hi, __lo, (x), (y)); \ |
173 | asm ("addl %2,%0\n\t" \ | 228 | asm ("addl %2,%0\n\t" \ |
174 | "adcl %3,%1" \ | 229 | "adcl %3,%1" \ |
175 | : "=rm" (lo), "=rm" (hi) \ | 230 | : "=rm" (lo), "=rm" (hi) \ |
176 | : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ | 231 | : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ |
177 | : "cc"); \ | 232 | : "cc"); \ |
178 | }) | 233 | }) |
179 | # endif /* OPT_ACCURACY */ | 234 | # endif /* OPT_ACCURACY */ |
180 | 235 | ||
181 | # if defined(OPT_ACCURACY) | 236 | # if defined(OPT_ACCURACY) |
182 | /* | 237 | /* |
183 | * Surprisingly, this is faster than SHRD followed by ADC. | 238 | * Surprisingly, this is faster than SHRD followed by ADC. |
184 | */ | 239 | */ |
185 | # define mad_f_scale64(hi, lo) \ | 240 | # define mad_f_scale64(hi, lo) \ |
186 | ({ mad_fixed64hi_t __hi_; \ | 241 | ({ mad_fixed64hi_t __hi_; \ |
187 | mad_fixed64lo_t __lo_; \ | 242 | mad_fixed64lo_t __lo_; \ |
188 | mad_fixed_t __result; \ | 243 | mad_fixed_t __result; \ |
189 | asm ("addl %4,%2\n\t" \ | 244 | asm ("addl %4,%2\n\t" \ |
190 | "adcl %5,%3" \ | 245 | "adcl %5,%3" \ |
191 | : "=rm" (__lo_), "=rm" (__hi_) \ | 246 | : "=rm" (__lo_), "=rm" (__hi_) \ |
192 | : "0" (lo), "1" (hi), \ | 247 | : "0" (lo), "1" (hi), \ |
193 | "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ | 248 | "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ |
194 | : "cc"); \ | 249 | : "cc"); \ |
195 | asm ("shrdl %3,%2,%1" \ | 250 | asm ("shrdl %3,%2,%1" \ |
196 | : "=rm" (__result) \ | 251 | : "=rm" (__result) \ |
197 | : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ | 252 | : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ |
198 | : "cc"); \ | 253 | : "cc"); \ |
199 | __result; \ | 254 | __result; \ |
200 | }) | 255 | }) |
201 | # else | 256 | # elif defined(OPT_INTEL) |
202 | # define mad_f_scale64(hi, lo) \ | 257 | /* |
258 | * Alternate Intel scaling that may or may not perform better. | ||
259 | */ | ||
260 | # define mad_f_scale64(hi, lo) \ | ||
261 | ({ mad_fixed_t __result; \ | ||
262 | asm ("shrl %3,%1\n\t" \ | ||
263 | "shll %4,%2\n\t" \ | ||
264 | "orl %2,%1" \ | ||
265 | : "=rm" (__result) \ | ||
266 | : "0" (lo), "r" (hi), \ | ||
267 | "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ | ||
268 | : "cc"); \ | ||
269 | __result; \ | ||
270 | }) | ||
271 | # else | ||
272 | # define mad_f_scale64(hi, lo) \ | ||
203 | ({ mad_fixed_t __result; \ | 273 | ({ mad_fixed_t __result; \ |
204 | asm ("shrdl %3,%2,%1" \ | 274 | asm ("shrdl %3,%2,%1" \ |
205 | : "=rm" (__result) \ | 275 | : "=rm" (__result) \ |
206 | : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ | 276 | : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ |
207 | : "cc"); \ | 277 | : "cc"); \ |
208 | __result; \ | 278 | __result; \ |
209 | }) | 279 | }) |
210 | # endif /* OPT_ACCURACY */ | 280 | # endif /* OPT_ACCURACY */ |
211 | 281 | ||
212 | # define MAD_F_SCALEBITS MAD_F_FRACBITS | 282 | # define MAD_F_SCALEBITS MAD_F_FRACBITS |
283 | # endif | ||
213 | 284 | ||
214 | /* --- ARM ----------------------------------------------------------------- */ | 285 | /* --- ARM ----------------------------------------------------------------- */ |
215 | 286 | ||
216 | # elif defined(FPM_ARM) | 287 | # elif defined(FPM_ARM) |
217 | 288 | ||
218 | /* | 289 | /* |
219 | * This ARM V4 version is as accurate as FPM_64BIT but much faster. The | 290 | * This ARM V4 version is as accurate as FPM_64BIT but much faster. The |
220 | * least significant bit is properly rounded at no CPU cycle cost! | 291 | * least significant bit is properly rounded at no CPU cycle cost! |
221 | */ | 292 | */ |
222 | # if 1 | 293 | # if 1 |
223 | /* | 294 | /* |
224 | * There's a bug somewhere, possibly in the compiler, that sometimes makes | 295 | * This is faster than the default implementation via MAD_F_MLX() and |
225 | * this necessary instead of the default implementation via MAD_F_MLX and | 296 | * mad_f_scale64(). |
226 | * mad_f_scale64. It may be related to the use (or lack) of | ||
227 | * -finline-functions and/or -fstrength-reduce. | ||
228 | * | ||
229 | * This is also apparently faster than MAD_F_MLX/mad_f_scale64. | ||
230 | */ | 297 | */ |
231 | # define mad_f_mul(x, y) \ | 298 | # define mad_f_mul(x, y) \ |
232 | ({ mad_fixed64hi_t __hi; \ | 299 | ({ mad_fixed64hi_t __hi; \ |
233 | mad_fixed64lo_t __lo; \ | 300 | mad_fixed64lo_t __lo; \ |
234 | mad_fixed_t __result; \ | 301 | mad_fixed_t __result; \ |
235 | asm ("smull%0, %1, %3, %4\n\t" \ | 302 | asm ("smull%0, %1, %3, %4\n\t" \ |
236 | "movs%0, %0, lsr %5\n\t" \ | 303 | "movs%0, %0, lsr %5\n\t" \ |
237 | "adc%2, %0, %1, lsl %6" \ | 304 | "adc%2, %0, %1, lsl %6" \ |
238 | : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ | 305 | : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ |
239 | : "%r" (x), "r" (y), \ | 306 | : "%r" (x), "r" (y), \ |
240 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ | 307 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ |
241 | : "cc"); \ | 308 | : "cc"); \ |
242 | __result; \ | 309 | __result; \ |
243 | }) | 310 | }) |
244 | # endif | 311 | # endif |
245 | 312 | ||
246 | # define MAD_F_MLX(hi, lo, x, y) \ | 313 | # define MAD_F_MLX(hi, lo, x, y) \ |
247 | asm ("smull%0, %1, %2, %3" \ | 314 | asm ("smull%0, %1, %2, %3" \ |
248 | : "=&r" (lo), "=&r" (hi) \ | 315 | : "=&r" (lo), "=&r" (hi) \ |
249 | : "%r" (x), "r" (y)) | 316 | : "%r" (x), "r" (y)) |
250 | 317 | ||
251 | # define MAD_F_MLA(hi, lo, x, y) \ | 318 | # define MAD_F_MLA(hi, lo, x, y) \ |
252 | asm ("smlal%0, %1, %2, %3" \ | 319 | asm ("smlal%0, %1, %2, %3" \ |
253 | : "+r" (lo), "+r" (hi) \ | 320 | : "+r" (lo), "+r" (hi) \ |
254 | : "%r" (x), "r" (y)) | 321 | : "%r" (x), "r" (y)) |
255 | 322 | ||
323 | # define MAD_F_MLN(hi, lo) \ | ||
324 | asm ("rsbs%0, %2, #0\n\t" \ | ||
325 | "rsc%1, %3, #0" \ | ||
326 | : "=r" (lo), "=r" (hi) \ | ||
327 | : "0" (lo), "1" (hi) \ | ||
328 | : "cc") | ||
329 | |||
256 | # define mad_f_scale64(hi, lo) \ | 330 | # define mad_f_scale64(hi, lo) \ |
257 | ({ mad_fixed_t __result; \ | 331 | ({ mad_fixed_t __result; \ |
258 | asm ("movs%0, %1, lsr %3\n\t" \ | 332 | asm ("movs%0, %1, lsr %3\n\t" \ |
259 | "adc%0, %0, %2, lsl %4" \ | 333 | "adc%0, %0, %2, lsl %4" \ |
260 | : "=r" (__result) \ | 334 | : "=&r" (__result) \ |
261 | : "r" (lo), "r" (hi), \ | 335 | : "r" (lo), "r" (hi), \ |
262 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ | 336 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ |
263 | : "cc"); \ | 337 | : "cc"); \ |
264 | __result; \ | 338 | __result; \ |
265 | }) | 339 | }) |
266 | 340 | ||
267 | # define MAD_F_SCALEBITS MAD_F_FRACBITS | 341 | # define MAD_F_SCALEBITS MAD_F_FRACBITS |
268 | 342 | ||
269 | /* --- MIPS ---------------------------------------------------------------- */ | 343 | /* --- MIPS ---------------------------------------------------------------- */ |
270 | 344 | ||
271 | # elif defined(FPM_MIPS) | 345 | # elif defined(FPM_MIPS) |
272 | 346 | ||
273 | /* | 347 | /* |
274 | * This MIPS version is fast and accurate; the disposition of the least | 348 | * This MIPS version is fast and accurate; the disposition of the least |
275 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). | 349 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). |
276 | */ | 350 | */ |
277 | # define MAD_F_MLX(hi, lo, x, y) \ | 351 | # define MAD_F_MLX(hi, lo, x, y) \ |
278 | asm ("mult%2,%3" \ | 352 | asm ("mult%2,%3" \ |
279 | : "=l" (lo), "=h" (hi) \ | 353 | : "=l" (lo), "=h" (hi) \ |
280 | : "%r" (x), "r" (y)) | 354 | : "%r" (x), "r" (y)) |
281 | 355 | ||
282 | # if defined(HAVE_MADD_ASM) | 356 | # if defined(HAVE_MADD_ASM) |
283 | # define MAD_F_MLA(hi, lo, x, y) \ | 357 | # define MAD_F_MLA(hi, lo, x, y) \ |
284 | asm ("madd%2,%3" \ | 358 | asm ("madd%2,%3" \ |
285 | : "+l" (lo), "+h" (hi) \ | 359 | : "+l" (lo), "+h" (hi) \ |
286 | : "%r" (x), "r" (y)) | 360 | : "%r" (x), "r" (y)) |
287 | # elif defined(HAVE_MADD16_ASM) | 361 | # elif defined(HAVE_MADD16_ASM) |
288 | /* | 362 | /* |
289 | * This loses significant accuracy due to the 16-bit integer limit in the | 363 | * This loses significant accuracy due to the 16-bit integer limit in the |
290 | * multiply/accumulate instruction. | 364 | * multiply/accumulate instruction. |
291 | */ | 365 | */ |
292 | # define MAD_F_ML0(hi, lo, x, y) \ | 366 | # define MAD_F_ML0(hi, lo, x, y) \ |
293 | asm ("mult%2,%3" \ | 367 | asm ("mult%2,%3" \ |
294 | : "=l" (lo), "=h" (hi) \ | 368 | : "=l" (lo), "=h" (hi) \ |
295 | : "%r" ((x) >> 12), "r" ((y) >> 16)) | 369 | : "%r" ((x) >> 12), "r" ((y) >> 16)) |
296 | # define MAD_F_MLA(hi, lo, x, y) \ | 370 | # define MAD_F_MLA(hi, lo, x, y) \ |
297 | asm ("madd16%2,%3" \ | 371 | asm ("madd16%2,%3" \ |
298 | : "+l" (lo), "+h" (hi) \ | 372 | : "+l" (lo), "+h" (hi) \ |
299 | : "%r" ((x) >> 12), "r" ((y) >> 16)) | 373 | : "%r" ((x) >> 12), "r" ((y) >> 16)) |
300 | # define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) | 374 | # define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) |
301 | # endif | 375 | # endif |
302 | 376 | ||
303 | # if defined(OPT_SPEED) | 377 | # if defined(OPT_SPEED) |
304 | # define mad_f_scale64(hi, lo) \ | 378 | # define mad_f_scale64(hi, lo) \ |
305 | ((mad_fixed_t) ((hi) << (32 - MAD_F_SCALEBITS))) | 379 | ((mad_fixed_t) ((hi) << (32 - MAD_F_SCALEBITS))) |
306 | # define MAD_F_SCALEBITS MAD_F_FRACBITS | 380 | # define MAD_F_SCALEBITS MAD_F_FRACBITS |
307 | # endif | 381 | # endif |
308 | 382 | ||
309 | /* --- SPARC --------------------------------------------------------------- */ | 383 | /* --- SPARC --------------------------------------------------------------- */ |
310 | 384 | ||
311 | # elif defined(FPM_SPARC) | 385 | # elif defined(FPM_SPARC) |
312 | 386 | ||
313 | /* | 387 | /* |
314 | * This SPARC V8 version is fast and accurate; the disposition of the least | 388 | * This SPARC V8 version is fast and accurate; the disposition of the least |
315 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). | 389 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). |
316 | */ | 390 | */ |
317 | # define MAD_F_MLX(hi, lo, x, y) \ | 391 | # define MAD_F_MLX(hi, lo, x, y) \ |
318 | asm ("smul %2, %3, %0\n\t" \ | 392 | asm ("smul %2, %3, %0\n\t" \ |
319 | "rd %%y, %1" \ | 393 | "rd %%y, %1" \ |
320 | : "=r" (lo), "=r" (hi) \ | 394 | : "=r" (lo), "=r" (hi) \ |
321 | : "%r" (x), "rI" (y)) | 395 | : "%r" (x), "rI" (y)) |
322 | 396 | ||
323 | /* --- PowerPC ------------------------------------------------------------- */ | 397 | /* --- PowerPC ------------------------------------------------------------- */ |
324 | 398 | ||
325 | # elif defined(FPM_PPC) | 399 | # elif defined(FPM_PPC) |
326 | 400 | ||
327 | /* | 401 | /* |
328 | * This PowerPC version is tuned for the 4xx embedded processors. It is | 402 | * This PowerPC version is fast and accurate; the disposition of the least |
329 | * effectively a tuned version of FPM_64BIT. It is a little faster and just | 403 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). |
330 | * as accurate. The disposition of the least significant bit depends on | ||
331 | * OPT_ACCURACY via mad_f_scale64(). | ||
332 | */ | 404 | */ |
333 | # define MAD_F_MLX(hi, lo, x, y) \ | 405 | # define MAD_F_MLX(hi, lo, x, y) \ |
334 | asm ("mulhw %1, %2, %3\n\t" \ | 406 | do { \ |
335 | "mullw %0, %2, %3" \ | 407 | asm ("mullw %0,%1,%2" \ |
336 | : "=&r" (lo), "=&r" (hi) \ | 408 | : "=r" (lo) \ |
337 | : "%r" (x), "r" (y)) | 409 | : "%r" (x), "r" (y)); \ |
410 | asm ("mulhw %0,%1,%2" \ | ||
411 | : "=r" (hi) \ | ||
412 | : "%r" (x), "r" (y)); \ | ||
413 | } \ | ||
414 | while (0) | ||
338 | 415 | ||
339 | # define MAD_F_MLA(hi, lo, x, y) \ | 416 | # if defined(OPT_ACCURACY) |
417 | /* | ||
418 | * This gives best accuracy but is not very fast. | ||
419 | */ | ||
420 | # define MAD_F_MLA(hi, lo, x, y) \ | ||
340 | ({ mad_fixed64hi_t __hi; \ | 421 | ({ mad_fixed64hi_t __hi; \ |
341 | mad_fixed64lo_t __lo; \ | 422 | mad_fixed64lo_t __lo; \ |
342 | MAD_F_MLX(__hi, __lo, (x), (y)); \ | 423 | MAD_F_MLX(__hi, __lo, (x), (y)); \ |
343 | asm ("addc %0, %2, %3\n\t" \ | 424 | asm ("addc %0,%2,%3\n\t" \ |
344 | "adde %1, %4, %5" \ | 425 | "adde %1,%4,%5" \ |
345 | : "=r" (lo), "=r" (hi) \ | 426 | : "=r" (lo), "=r" (hi) \ |
346 | : "%r" (__lo), "0" (lo), "%r" (__hi), "1" (hi)); \ | 427 | : "%r" (lo), "r" (__lo), \ |
428 | "%r" (hi), "r" (__hi) \ | ||
429 | : "xer"); \ | ||
347 | }) | 430 | }) |
431 | # endif | ||
348 | 432 | ||
349 | # if defined(OPT_ACCURACY) | 433 | # if defined(OPT_ACCURACY) |
350 | /* | 434 | /* |
351 | * This is accurate and ~2 - 2.5 times slower than the unrounded version. | 435 | * This is slower than the truncating version below it. |
352 | * | ||
353 | * The __volatile__ improves the generated code by another 5% (fewer spills | ||
354 | * to memory); eventually they should be removed. | ||
355 | */ | 436 | */ |
356 | # define mad_f_scale64(hi, lo) \ | 437 | # define mad_f_scale64(hi, lo) \ |
357 | ({ mad_fixed_t __result; \ | 438 | ({ mad_fixed_t __result, __round; \ |
358 | mad_fixed64hi_t __hi_; \ | 439 | asm ("rotrwi %0,%1,%2" \ |
359 | mad_fixed64lo_t __lo_; \ | 440 | : "=r" (__result) \ |
360 | asm __volatile__ ("addc %0, %2, %4\n\t" \ | 441 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ |
361 | "addze %1, %3" \ | 442 | asm ("extrwi %0,%1,1,0" \ |
362 | : "=r" (__lo_), "=r" (__hi_) \ | 443 | : "=r" (__round) \ |
363 | : "r" (lo), "r" (hi), "r" (1 << (MAD_F_SCALEBITS - 1))); \ | 444 | : "r" (__result)); \ |
364 | asm __volatile__ ("rlwinm %0, %2,32-%3,0,%3-1\n\t" \ | 445 | asm ("insrwi %0,%1,%2,0" \ |
365 | "rlwimi %0, %1,32-%3,%3,31" \ | 446 | : "+r" (__result) \ |
366 | : "=&r" (__result) \ | 447 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ |
367 | : "r" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS)); \ | 448 | asm ("add %0,%1,%2" \ |
368 | __result; \ | 449 | : "=r" (__result) \ |
450 | : "%r" (__result), "r" (__round)); \ | ||
451 | __result; \ | ||
369 | }) | 452 | }) |
370 | # else | 453 | # else |
371 | # define mad_f_scale64(hi, lo) \ | 454 | # define mad_f_scale64(hi, lo) \ |
372 | ({ mad_fixed_t __result; \ | 455 | ({ mad_fixed_t __result; \ |
373 | asm ("rlwinm %0, %2,32-%3,0,%3-1\n\t" \ | 456 | asm ("rotrwi %0,%1,%2" \ |
374 | "rlwimi %0, %1,32-%3,%3,31" \ | ||
375 | : "=r" (__result) \ | 457 | : "=r" (__result) \ |
376 | : "r" (lo), "r" (hi), "I" (MAD_F_SCALEBITS)); \ | 458 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ |
377 | __result; \ | 459 | asm ("insrwi %0,%1,%2,0" \ |
460 | : "+r" (__result) \ | ||
461 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ | ||
462 | __result; \ | ||
378 | }) | 463 | }) |
379 | # endif /* OPT_ACCURACY */ | 464 | # endif |
380 | 465 | ||
381 | # define MAD_F_SCALEBITS MAD_F_FRACBITS | 466 | # define MAD_F_SCALEBITS MAD_F_FRACBITS |
382 | 467 | ||
383 | /* --- Default ------------------------------------------------------------- */ | 468 | /* --- Default ------------------------------------------------------------- */ |
384 | 469 | ||
385 | # elif defined(FPM_DEFAULT) | 470 | # elif defined(FPM_DEFAULT) |
386 | 471 | ||
387 | /* | 472 | /* |
388 | * This version is the most portable but it loses significant accuracy. | 473 | * This version is the most portable but it loses significant accuracy. |
389 | * Furthermore, accuracy is biased against the second argument, so care | 474 | * Furthermore, accuracy is biased against the second argument, so care |
390 | * should be taken when ordering operands. | 475 | * should be taken when ordering operands. |
391 | * | 476 | * |
392 | * The scale factors are constant as this is not used with SSO. | 477 | * The scale factors are constant as this is not used with SSO. |
393 | * | 478 | * |
394 | * Pre-rounding is required to stay within the limits of compliance. | 479 | * Pre-rounding is required to stay within the limits of compliance. |
395 | */ | 480 | */ |
396 | # define mad_f_mul(x, y)((((x) + (1L << 11)) >> 12) * \ | 481 | # if defined(OPT_SPEED) |
482 | # define mad_f_mul(x, y)(((x) >> 12) * ((y) >> 16)) | ||
483 | # else | ||
484 | # define mad_f_mul(x, y)((((x) + (1L << 11)) >> 12) * \ | ||
397 | (((y) + (1L << 15)) >> 16)) | 485 | (((y) + (1L << 15)) >> 16)) |
486 | # endif | ||
398 | 487 | ||
399 | /* ------------------------------------------------------------------------- */ | 488 | /* ------------------------------------------------------------------------- */ |
400 | 489 | ||
401 | # else | 490 | # else |
402 | # error "no FPM selected" | 491 | # error "no FPM selected" |
403 | # endif | 492 | # endif |
404 | 493 | ||
405 | /* default implementations */ | 494 | /* default implementations */ |
406 | 495 | ||
407 | # if !defined(mad_f_mul) | 496 | # if !defined(mad_f_mul) |
408 | # define mad_f_mul(x, y) \ | 497 | # define mad_f_mul(x, y) \ |
409 | ({ mad_fixed64hi_t __hi; \ | 498 | ({ register mad_fixed64hi_t __hi; \ |
410 | mad_fixed64lo_t __lo; \ | 499 | register mad_fixed64lo_t __lo; \ |
411 | MAD_F_MLX(__hi, __lo, (x), (y)); \ | 500 | MAD_F_MLX(__hi, __lo, (x), (y)); \ |
412 | mad_f_scale64(__hi, __lo); \ | 501 | mad_f_scale64(__hi, __lo); \ |
413 | }) | 502 | }) |
414 | # endif | 503 | # endif |
415 | 504 | ||
416 | # if !defined(MAD_F_MLA) | 505 | # if !defined(MAD_F_MLA) |
417 | # define MAD_F_ML0(hi, lo, x, y)((lo) = mad_f_mul((x), (y))) | 506 | # define MAD_F_ML0(hi, lo, x, y)((lo) = mad_f_mul((x), (y))) |
418 | # define MAD_F_MLA(hi, lo, x, y)((lo) += mad_f_mul((x), (y))) | 507 | # define MAD_F_MLA(hi, lo, x, y)((lo) += mad_f_mul((x), (y))) |
508 | # define MAD_F_MLN(hi, lo) ((lo) = -(lo)) | ||
419 | # define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) | 509 | # define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) |
420 | # endif | 510 | # endif |
421 | 511 | ||
422 | # if !defined(MAD_F_ML0) | 512 | # if !defined(MAD_F_ML0) |
423 | # define MAD_F_ML0(hi, lo, x, y)MAD_F_MLX((hi), (lo), (x), (y)) | 513 | # define MAD_F_ML0(hi, lo, x, y)MAD_F_MLX((hi), (lo), (x), (y)) |
424 | # endif | 514 | # endif |
425 | 515 | ||
516 | # if !defined(MAD_F_MLN) | ||
517 | # define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) | ||
518 | # endif | ||
519 | |||
426 | # if !defined(MAD_F_MLZ) | 520 | # if !defined(MAD_F_MLZ) |
427 | # define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) | 521 | # define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) |
428 | # endif | 522 | # endif |
429 | 523 | ||
430 | # if !defined(mad_f_scale64) | 524 | # if !defined(mad_f_scale64) |
431 | # if defined(OPT_ACCURACY) | 525 | # if defined(OPT_ACCURACY) |
432 | # define mad_f_scale64(hi, lo) \ | 526 | # define mad_f_scale64(hi, lo) \ |
433 | ((((mad_fixed_t) \ | 527 | ((((mad_fixed_t) \ |
434 | (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \ | 528 | (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \ |
435 | ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) | 529 | ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) |
436 | # else | 530 | # else |
437 | # define mad_f_scale64(hi, lo) \ | 531 | # define mad_f_scale64(hi, lo) \ |
438 | ((mad_fixed_t) \ | 532 | ((mad_fixed_t) \ |
439 | (((hi) << (32 - MAD_F_SCALEBITS)) | \ | 533 | (((hi) << (32 - MAD_F_SCALEBITS)) | \ |
440 | ((lo) >> MAD_F_SCALEBITS))) | 534 | ((lo) >> MAD_F_SCALEBITS))) |
441 | # endif | 535 | # endif |
442 | # define MAD_F_SCALEBITS MAD_F_FRACBITS | 536 | # define MAD_F_SCALEBITS MAD_F_FRACBITS |
443 | # endif | 537 | # endif |
444 | 538 | ||
445 | /* miscellaneous C routines */ | 539 | /* C routines */ |
446 | 540 | ||
447 | mad_fixed_t mad_f_abs(mad_fixed_t); | 541 | mad_fixed_t mad_f_abs(mad_fixed_t); |
542 | mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t); | ||
448 | 543 | ||
449 | # endif | 544 | # endif |
450 | 545 | ||
451 | /* Id: bit.h,v 1.7 2001/04/05 04:57:11 rob Exp */ | 546 | /* Id: bit.h,v 1.12 2004/01/23 09:41:32 rob Exp */ |
452 | 547 | ||
453 | # ifndef LIBMAD_BIT_H | 548 | # ifndef LIBMAD_BIT_H |
454 | # define LIBMAD_BIT_H | 549 | # define LIBMAD_BIT_H |
455 | 550 | ||
456 | struct mad_bitptr { | 551 | struct mad_bitptr { |
457 | unsigned char const *byte; | 552 | unsigned char const *byte; |
458 | unsigned short cache; | 553 | unsigned short cache; |
459 | unsigned short left; | 554 | unsigned short left; |
460 | }; | 555 | }; |
461 | 556 | ||
462 | void mad_bit_init(struct mad_bitptr *, unsigned char const *); | 557 | void mad_bit_init(struct mad_bitptr *, unsigned char const *); |
463 | 558 | ||
464 | # define mad_bit_finish(bitptr) /* nothing */ | 559 | # define mad_bit_finish(bitptr) /* nothing */ |
465 | 560 | ||
466 | unsigned int mad_bit_length(struct mad_bitptr const *, | 561 | unsigned int mad_bit_length(struct mad_bitptr const *, |
467 | struct mad_bitptr const *); | 562 | struct mad_bitptr const *); |
468 | 563 | ||
469 | # define mad_bit_bitsleft(bitptr) ((bitptr)->left) | 564 | # define mad_bit_bitsleft(bitptr) ((bitptr)->left) |
470 | unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); | 565 | unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); |
471 | 566 | ||
472 | void mad_bit_skip(struct mad_bitptr *, unsigned int); | 567 | void mad_bit_skip(struct mad_bitptr *, unsigned int); |
473 | unsigned long mad_bit_read(struct mad_bitptr *, unsigned int); | 568 | unsigned long mad_bit_read(struct mad_bitptr *, unsigned int); |
474 | void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long); | 569 | void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long); |
475 | 570 | ||
476 | unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short); | 571 | unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short); |
477 | 572 | ||
478 | # endif | 573 | # endif |
479 | 574 | ||
480 | /* Id: timer.h,v 1.10 2001/04/05 04:57:11 rob Exp */ | 575 | /* Id: timer.h,v 1.16 2004/01/23 09:41:33 rob Exp */ |
481 | 576 | ||
482 | # ifndef LIBMAD_TIMER_H | 577 | # ifndef LIBMAD_TIMER_H |
483 | # define LIBMAD_TIMER_H | 578 | # define LIBMAD_TIMER_H |
484 | 579 | ||
485 | typedef struct { | 580 | typedef struct { |
486 | signed long seconds; /* whole seconds */ | 581 | signed long seconds; /* whole seconds */ |
487 | unsigned long fraction;/* 1/MAD_TIMER_RESOLUTION seconds */ | 582 | unsigned long fraction;/* 1/MAD_TIMER_RESOLUTION seconds */ |
488 | } mad_timer_t; | 583 | } mad_timer_t; |
489 | 584 | ||
490 | extern mad_timer_t const mad_timer_zero; | 585 | extern mad_timer_t const mad_timer_zero; |
491 | 586 | ||
492 | # define MAD_TIMER_RESOLUTION352800000UL | 587 | # define MAD_TIMER_RESOLUTION352800000UL |
493 | 588 | ||
494 | enum mad_units { | 589 | enum mad_units { |
495 | MAD_UNITS_HOURS = -2, | 590 | MAD_UNITS_HOURS = -2, |
496 | MAD_UNITS_MINUTES = -1, | 591 | MAD_UNITS_MINUTES = -1, |
497 | MAD_UNITS_SECONDS = 0, | 592 | MAD_UNITS_SECONDS = 0, |
498 | 593 | ||
499 | /* metric units */ | 594 | /* metric units */ |
500 | 595 | ||
501 | MAD_UNITS_DECISECONDS = 10, | 596 | MAD_UNITS_DECISECONDS = 10, |
502 | MAD_UNITS_CENTISECONDS = 100, | 597 | MAD_UNITS_CENTISECONDS = 100, |
503 | MAD_UNITS_MILLISECONDS = 1000, | 598 | MAD_UNITS_MILLISECONDS = 1000, |
504 | 599 | ||
505 | /* audio sample units */ | 600 | /* audio sample units */ |
506 | 601 | ||
507 | MAD_UNITS_8000_HZ = 8000, | 602 | MAD_UNITS_8000_HZ = 8000, |
508 | MAD_UNITS_11025_HZ = 11025, | 603 | MAD_UNITS_11025_HZ = 11025, |
509 | MAD_UNITS_12000_HZ = 12000, | 604 | MAD_UNITS_12000_HZ = 12000, |
510 | 605 | ||
511 | MAD_UNITS_16000_HZ = 16000, | 606 | MAD_UNITS_16000_HZ = 16000, |
512 | MAD_UNITS_22050_HZ = 22050, | 607 | MAD_UNITS_22050_HZ = 22050, |
513 | MAD_UNITS_24000_HZ = 24000, | 608 | MAD_UNITS_24000_HZ = 24000, |
514 | 609 | ||
515 | MAD_UNITS_32000_HZ = 32000, | 610 | MAD_UNITS_32000_HZ = 32000, |
516 | MAD_UNITS_44100_HZ = 44100, | 611 | MAD_UNITS_44100_HZ = 44100, |
517 | MAD_UNITS_48000_HZ = 48000, | 612 | MAD_UNITS_48000_HZ = 48000, |
518 | 613 | ||
519 | /* video frame/field units */ | 614 | /* video frame/field units */ |
520 | 615 | ||
521 | MAD_UNITS_24_FPS = 24, | 616 | MAD_UNITS_24_FPS = 24, |
522 | MAD_UNITS_25_FPS = 25, | 617 | MAD_UNITS_25_FPS = 25, |
523 | MAD_UNITS_30_FPS = 30, | 618 | MAD_UNITS_30_FPS = 30, |
524 | MAD_UNITS_48_FPS = 48, | 619 | MAD_UNITS_48_FPS = 48, |
525 | MAD_UNITS_50_FPS = 50, | 620 | MAD_UNITS_50_FPS = 50, |
526 | MAD_UNITS_60_FPS = 60, | 621 | MAD_UNITS_60_FPS = 60, |
527 | 622 | ||
528 | /* CD audio frames */ | 623 | /* CD audio frames */ |
529 | 624 | ||
530 | MAD_UNITS_75_FPS = 75, | 625 | MAD_UNITS_75_FPS = 75, |
531 | 626 | ||
532 | /* video drop-frame units */ | 627 | /* video drop-frame units */ |
533 | 628 | ||
534 | MAD_UNITS_23_976_FPS = -24, | 629 | MAD_UNITS_23_976_FPS = -24, |
535 | MAD_UNITS_24_975_FPS = -25, | 630 | MAD_UNITS_24_975_FPS = -25, |
536 | MAD_UNITS_29_97_FPS = -30, | 631 | MAD_UNITS_29_97_FPS = -30, |
537 | MAD_UNITS_47_952_FPS = -48, | 632 | MAD_UNITS_47_952_FPS = -48, |
538 | MAD_UNITS_49_95_FPS = -50, | 633 | MAD_UNITS_49_95_FPS = -50, |
539 | MAD_UNITS_59_94_FPS = -60 | 634 | MAD_UNITS_59_94_FPS = -60 |
540 | }; | 635 | }; |
541 | 636 | ||
542 | # define mad_timer_reset(timer)(*(timer) = mad_timer_zero) | 637 | # define mad_timer_reset(timer)((void) (*(timer) = mad_timer_zero)) |
543 | 638 | ||
544 | int mad_timer_compare(mad_timer_t, mad_timer_t); | 639 | int mad_timer_compare(mad_timer_t, mad_timer_t); |
545 | 640 | ||
546 | # define mad_timer_sign(timer)mad_timer_compare((timer), mad_timer_zero) | 641 | # define mad_timer_sign(timer)mad_timer_compare((timer), mad_timer_zero) |
547 | 642 | ||
548 | void mad_timer_negate(mad_timer_t *); | 643 | void mad_timer_negate(mad_timer_t *); |
549 | mad_timer_t mad_timer_abs(mad_timer_t); | 644 | mad_timer_t mad_timer_abs(mad_timer_t); |
550 | 645 | ||
551 | void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long); | 646 | void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long); |
552 | void mad_timer_add(mad_timer_t *, mad_timer_t); | 647 | void mad_timer_add(mad_timer_t *, mad_timer_t); |
553 | void mad_timer_multiply(mad_timer_t *, signed long); | 648 | void mad_timer_multiply(mad_timer_t *, signed long); |
554 | 649 | ||
555 | signed long mad_timer_count(mad_timer_t, enum mad_units); | 650 | signed long mad_timer_count(mad_timer_t, enum mad_units); |
556 | unsigned long mad_timer_fraction(mad_timer_t, unsigned long); | 651 | unsigned long mad_timer_fraction(mad_timer_t, unsigned long); |
557 | void mad_timer_string(mad_timer_t, char *, char const *, | 652 | void mad_timer_string(mad_timer_t, char *, char const *, |
558 | enum mad_units, enum mad_units, unsigned long); | 653 | enum mad_units, enum mad_units, unsigned long); |
559 | 654 | ||
560 | # endif | 655 | # endif |
561 | 656 | ||
562 | /* Id: stream.h,v 1.12 2001/04/10 05:18:21 rob Exp */ | 657 | /* Id: stream.h,v 1.20 2004/02/05 09:02:39 rob Exp */ |
563 | 658 | ||
564 | # ifndef LIBMAD_STREAM_H | 659 | # ifndef LIBMAD_STREAM_H |
565 | # define LIBMAD_STREAM_H | 660 | # define LIBMAD_STREAM_H |
566 | 661 | ||
662 | |||
567 | # define MAD_BUFFER_GUARD8 | 663 | # define MAD_BUFFER_GUARD8 |
568 | # define MAD_BUFFER_MDLEN(511 + 2048 + MAD_BUFFER_GUARD) | 664 | # define MAD_BUFFER_MDLEN(511 + 2048 + MAD_BUFFER_GUARD) |
569 | 665 | ||
570 | enum mad_error { | 666 | enum mad_error { |
667 | MAD_ERROR_NONE = 0x0000,/* no error */ | ||
668 | |||
571 | MAD_ERROR_BUFLEN = 0x0001,/* input buffer too small (or EOF) */ | 669 | MAD_ERROR_BUFLEN = 0x0001,/* input buffer too small (or EOF) */ |
572 | MAD_ERROR_BUFPTR = 0x0002,/* invalid (null) buffer pointer */ | 670 | MAD_ERROR_BUFPTR = 0x0002,/* invalid (null) buffer pointer */ |
573 | 671 | ||
574 | MAD_ERROR_NOMEM = 0x0031,/* not enough memory */ | 672 | MAD_ERROR_NOMEM = 0x0031,/* not enough memory */ |
575 | 673 | ||
576 | MAD_ERROR_LOSTSYNC = 0x0101,/* lost synchronization */ | 674 | MAD_ERROR_LOSTSYNC = 0x0101,/* lost synchronization */ |
577 | MAD_ERROR_BADLAYER = 0x0102,/* reserved header layer value */ | 675 | MAD_ERROR_BADLAYER = 0x0102,/* reserved header layer value */ |
578 | MAD_ERROR_BADBITRATE = 0x0103,/* forbidden bitrate value */ | 676 | MAD_ERROR_BADBITRATE = 0x0103,/* forbidden bitrate value */ |
579 | MAD_ERROR_BADSAMPLERATE = 0x0104,/* reserved sample frequency value */ | 677 | MAD_ERROR_BADSAMPLERATE = 0x0104,/* reserved sample frequency value */ |
580 | MAD_ERROR_BADEMPHASIS = 0x0105,/* reserved emphasis value */ | 678 | MAD_ERROR_BADEMPHASIS = 0x0105,/* reserved emphasis value */ |
581 | 679 | ||
582 | MAD_ERROR_BADCRC = 0x0201,/* CRC check failed */ | 680 | MAD_ERROR_BADCRC = 0x0201,/* CRC check failed */ |
583 | MAD_ERROR_BADBITALLOC = 0x0211,/* forbidden bit allocation value */ | 681 | MAD_ERROR_BADBITALLOC = 0x0211,/* forbidden bit allocation value */ |
584 | MAD_ERROR_BADSCALEFACTOR = 0x0221,/* bad scalefactor index */ | 682 | MAD_ERROR_BADSCALEFACTOR = 0x0221,/* bad scalefactor index */ |
683 | MAD_ERROR_BADMODE = 0x0222,/* bad bitrate/mode combination */ | ||
585 | MAD_ERROR_BADFRAMELEN = 0x0231,/* bad frame length */ | 684 | MAD_ERROR_BADFRAMELEN = 0x0231,/* bad frame length */ |
586 | MAD_ERROR_BADBIGVALUES = 0x0232,/* bad big_values count */ | 685 | MAD_ERROR_BADBIGVALUES = 0x0232,/* bad big_values count */ |
587 | MAD_ERROR_BADBLOCKTYPE = 0x0233,/* reserved block_type */ | 686 | MAD_ERROR_BADBLOCKTYPE = 0x0233,/* reserved block_type */ |
588 | MAD_ERROR_BADSCFSI = 0x0234,/* bad scalefactor selection info */ | 687 | MAD_ERROR_BADSCFSI = 0x0234,/* bad scalefactor selection info */ |
589 | MAD_ERROR_BADDATAPTR = 0x0235,/* bad main_data_begin pointer */ | 688 | MAD_ERROR_BADDATAPTR = 0x0235,/* bad main_data_begin pointer */ |
590 | MAD_ERROR_BADPART3LEN = 0x0236,/* bad audio data length */ | 689 | MAD_ERROR_BADPART3LEN = 0x0236,/* bad audio data length */ |
591 | MAD_ERROR_BADHUFFTABLE = 0x0237,/* bad Huffman table select */ | 690 | MAD_ERROR_BADHUFFTABLE = 0x0237,/* bad Huffman table select */ |
592 | MAD_ERROR_BADHUFFDATA = 0x0238,/* Huffman data overrun */ | 691 | MAD_ERROR_BADHUFFDATA = 0x0238,/* Huffman data overrun */ |
593 | MAD_ERROR_BADSTEREO = 0x0239/* incompatible block_type for JS */ | 692 | MAD_ERROR_BADSTEREO = 0x0239/* incompatible block_type for JS */ |
594 | }; | 693 | }; |
595 | 694 | ||
596 | # define MAD_RECOVERABLE(error)((error) & 0xff00) | 695 | # define MAD_RECOVERABLE(error)((error) & 0xff00) |
597 | 696 | ||
598 | struct mad_stream { | 697 | struct mad_stream { |
599 | unsigned char const *buffer; /* input bitstream buffer */ | 698 | unsigned char const *buffer; /* input bitstream buffer */ |
600 | unsigned char const *bufend; /* end of buffer */ | 699 | unsigned char const *bufend; /* end of buffer */ |
601 | unsigned long skiplen; /* bytes to skip before next frame */ | 700 | unsigned long skiplen; /* bytes to skip before next frame */ |
602 | 701 | ||
603 | int sync; /* stream sync found */ | 702 | int sync; /* stream sync found */ |
604 | unsigned long freerate; /* free bitrate (fixed) */ | 703 | unsigned long freerate; /* free bitrate (fixed) */ |
605 | 704 | ||
606 | unsigned char const *this_frame;/* start of current frame */ | 705 | unsigned char const *this_frame;/* start of current frame */ |
607 | unsigned char const *next_frame;/* start of next frame */ | 706 | unsigned char const *next_frame;/* start of next frame */ |
608 | struct mad_bitptr ptr; /* current processing bit pointer */ | 707 | struct mad_bitptr ptr; /* current processing bit pointer */ |
609 | 708 | ||
610 | struct mad_bitptr anc_ptr; /* ancillary bits pointer */ | 709 | struct mad_bitptr anc_ptr; /* ancillary bits pointer */ |
611 | unsigned int anc_bitlen; /* number of ancillary bits */ | 710 | unsigned int anc_bitlen; /* number of ancillary bits */ |
612 | 711 | ||
613 | unsigned char (*main_data)[MAD_BUFFER_MDLEN]; | 712 | unsigned char (*main_data)[MAD_BUFFER_MDLEN]; |
614 | /* Layer III main_data() */ | 713 | /* Layer III main_data() */ |
615 | unsigned int md_len; /* bytes in main_data */ | 714 | unsigned int md_len; /* bytes in main_data */ |
616 | 715 | ||
617 | int options; /* decoding options (see below) */ | 716 | int options; /* decoding options (see below) */ |
618 | enum mad_error error; /* error code (see above) */ | 717 | enum mad_error error; /* error code (see above) */ |
619 | }; | 718 | }; |
620 | 719 | ||
621 | enum { | 720 | enum { |
622 | MAD_OPTION_IGNORECRC = 0x0001,/* ignore CRC errors */ | 721 | MAD_OPTION_IGNORECRC = 0x0001,/* ignore CRC errors */ |
623 | MAD_OPTION_HALFSAMPLERATE = 0x0002,/* generate PCM at 1/2 sample rate */ | 722 | MAD_OPTION_HALFSAMPLERATE = 0x0002/* generate PCM at 1/2 sample rate */ |
624 | # if 0 /* not yet implemented */ | 723 | # if 0 /* not yet implemented */ |
625 | MAD_OPTION_LEFTCHANNEL = 0x0010,/* decode left channel only */ | 724 | MAD_OPTION_LEFTCHANNEL = 0x0010,/* decode left channel only */ |
626 | MAD_OPTION_RIGHTCHANNEL = 0x0020,/* decode right channel only */ | 725 | MAD_OPTION_RIGHTCHANNEL = 0x0020,/* decode right channel only */ |
627 | MAD_OPTION_SINGLECHANNEL = 0x0030,/* combine channels */ | 726 | MAD_OPTION_SINGLECHANNEL = 0x0030/* combine channels */ |
628 | # endif | 727 | # endif |
629 | }; | 728 | }; |
630 | 729 | ||
631 | void mad_stream_init(struct mad_stream *); | 730 | void mad_stream_init(struct mad_stream *); |
632 | void mad_stream_finish(struct mad_stream *); | 731 | void mad_stream_finish(struct mad_stream *); |
633 | 732 | ||
634 | # define mad_stream_options(stream, opts) ((stream)->options = (opts)) | 733 | # define mad_stream_options(stream, opts) \ |
734 | ((void) ((stream)->options = (opts))) | ||
635 | 735 | ||
636 | void mad_stream_buffer(struct mad_stream *, | 736 | void mad_stream_buffer(struct mad_stream *, |
637 | unsigned char const *, unsigned long); | 737 | unsigned char const *, unsigned long); |
638 | void mad_stream_skip(struct mad_stream *, unsigned long); | 738 | void mad_stream_skip(struct mad_stream *, unsigned long); |
639 | 739 | ||
640 | int mad_stream_sync(struct mad_stream *); | 740 | int mad_stream_sync(struct mad_stream *); |
641 | 741 | ||
742 | char const *mad_stream_errorstr(struct mad_stream const *); | ||
743 | |||
642 | # endif | 744 | # endif |
643 | 745 | ||
644 | /* Id: frame.h,v 1.13 2001/04/05 04:57:11 rob Exp */ | 746 | /* Id: frame.h,v 1.20 2004/01/23 09:41:32 rob Exp */ |
645 | 747 | ||
646 | # ifndef LIBMAD_FRAME_H | 748 | # ifndef LIBMAD_FRAME_H |
647 | # define LIBMAD_FRAME_H | 749 | # define LIBMAD_FRAME_H |
648 | 750 | ||
751 | |||
649 | enum mad_layer { | 752 | enum mad_layer { |
650 | MAD_LAYER_I = 1, /* Layer I */ | 753 | MAD_LAYER_I = 1, /* Layer I */ |
651 | MAD_LAYER_II = 2, /* Layer II */ | 754 | MAD_LAYER_II = 2, /* Layer II */ |
652 | MAD_LAYER_III = 3 /* Layer III */ | 755 | MAD_LAYER_III = 3 /* Layer III */ |
653 | }; | 756 | }; |
654 | 757 | ||
655 | enum mad_mode { | 758 | enum mad_mode { |
656 | MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */ | 759 | MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */ |
657 | MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */ | 760 | MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */ |
658 | MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */ | 761 | MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */ |
659 | MAD_MODE_STEREO = 3 /* normal LR stereo */ | 762 | MAD_MODE_STEREO = 3 /* normal LR stereo */ |
660 | }; | 763 | }; |
661 | 764 | ||
662 | enum mad_emphasis { | 765 | enum mad_emphasis { |
663 | MAD_EMPHASIS_NONE = 0, /* no emphasis */ | 766 | MAD_EMPHASIS_NONE = 0, /* no emphasis */ |
664 | MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ | 767 | MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ |
665 | MAD_EMPHASIS_CCITT_J_17 = 3 /* CCITT J.17 emphasis */ | 768 | MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */ |
769 | MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */ | ||
666 | }; | 770 | }; |
667 | 771 | ||
668 | struct mad_frame { | 772 | struct mad_header { |
669 | struct mad_header { | 773 | enum mad_layer layer; /* audio layer (1, 2, or 3) */ |
670 | enum mad_layer layer; /* audio layer (1, 2, or 3) */ | 774 | enum mad_mode mode; /* channel mode (see above) */ |
671 | enum mad_mode mode; /* channel mode (see above) */ | 775 | int mode_extension; /* additional mode info */ |
672 | int mode_extension; /* additional mode info */ | 776 | enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ |
673 | enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ | 777 | |
778 | unsigned long bitrate; /* stream bitrate (bps) */ | ||
779 | unsigned int samplerate; /* sampling frequency (Hz) */ | ||
674 | 780 | ||
675 | unsigned long bitrate; /* stream bitrate (bps) */ | 781 | unsigned short crc_check; /* frame CRC accumulator */ |
676 | unsigned int samplerate; /* sampling frequency (Hz) */ | 782 | unsigned short crc_target; /* final target CRC checksum */ |
677 | 783 | ||
678 | unsigned short crc_check; /* frame CRC accumulator */ | 784 | int flags; /* flags (see below) */ |
679 | unsigned short crc_target; /* final target CRC checksum */ | 785 | int private_bits; /* private bits (see below) */ |
680 | 786 | ||
681 | int flags; /* flags (see below) */ | 787 | mad_timer_t duration; /* audio playing time of frame */ |
682 | int private_bits; /* private bits (see below) */ | 788 | }; |
683 | 789 | ||
684 | mad_timer_t duration; /* audio playing time of frame */ | 790 | struct mad_frame { |
685 | } header; | 791 | struct mad_header header; /* MPEG audio header */ |
686 | 792 | ||
687 | int options; /* decoding options (from stream) */ | 793 | int options; /* decoding options (from stream) */ |
688 | 794 | ||
689 | mad_fixed_t sbsample[2][36][32];/* synthesis subband filter samples */ | 795 | mad_fixed_t sbsample[2][36][32];/* synthesis subband filter samples */ |
690 | mad_fixed_t (*overlap)[2][32][18];/* Layer III block overlap data */ | 796 | mad_fixed_t (*overlap)[2][32][18];/* Layer III block overlap data */ |
691 | }; | 797 | }; |
692 | 798 | ||
693 | # define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) | 799 | # define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) |
694 | # define MAD_NSBSAMPLES(header) \ | 800 | # define MAD_NSBSAMPLES(header) \ |
695 | ((header)->layer == MAD_LAYER_I ? 12 : \ | 801 | ((header)->layer == MAD_LAYER_I ? 12 : \ |
696 | (((header)->layer == MAD_LAYER_III && \ | 802 | (((header)->layer == MAD_LAYER_III && \ |
697 | ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36)) | 803 | ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36)) |
698 | 804 | ||
699 | enum { | 805 | enum { |
700 | MAD_FLAG_NPRIVATE_III = 0x0007,/* number of Layer III private bits */ | 806 | MAD_FLAG_NPRIVATE_III = 0x0007,/* number of Layer III private bits */ |
701 | MAD_FLAG_INCOMPLETE = 0x0008,/* header but not data is decoded */ | 807 | MAD_FLAG_INCOMPLETE = 0x0008,/* header but not data is decoded */ |
702 | 808 | ||
703 | MAD_FLAG_PROTECTION = 0x0010,/* frame has CRC protection */ | 809 | MAD_FLAG_PROTECTION = 0x0010,/* frame has CRC protection */ |
704 | MAD_FLAG_COPYRIGHT = 0x0020,/* frame is copyright */ | 810 | MAD_FLAG_COPYRIGHT = 0x0020,/* frame is copyright */ |
705 | MAD_FLAG_ORIGINAL = 0x0040,/* frame is original (else copy) */ | 811 | MAD_FLAG_ORIGINAL = 0x0040,/* frame is original (else copy) */ |
706 | MAD_FLAG_PADDING = 0x0080,/* frame has additional slot */ | 812 | MAD_FLAG_PADDING = 0x0080,/* frame has additional slot */ |
707 | 813 | ||
708 | MAD_FLAG_I_STEREO = 0x0100,/* uses intensity joint stereo */ | 814 | MAD_FLAG_I_STEREO = 0x0100,/* uses intensity joint stereo */ |
709 | MAD_FLAG_MS_STEREO = 0x0200,/* uses middle/side joint stereo */ | 815 | MAD_FLAG_MS_STEREO = 0x0200,/* uses middle/side joint stereo */ |
710 | MAD_FLAG_FREEFORMAT = 0x0400,/* uses free format bitrate */ | 816 | MAD_FLAG_FREEFORMAT = 0x0400,/* uses free format bitrate */ |
711 | 817 | ||
712 | MAD_FLAG_LSF_EXT = 0x1000,/* lower sampling freq. extension */ | 818 | MAD_FLAG_LSF_EXT = 0x1000,/* lower sampling freq. extension */ |
713 | MAD_FLAG_MC_EXT = 0x2000,/* multichannel audio extension */ | 819 | MAD_FLAG_MC_EXT = 0x2000,/* multichannel audio extension */ |
714 | MAD_FLAG_MPEG_2_5_EXT = 0x4000/* MPEG 2.5 (unofficial) extension */ | 820 | MAD_FLAG_MPEG_2_5_EXT = 0x4000/* MPEG 2.5 (unofficial) extension */ |
715 | }; | 821 | }; |
716 | 822 | ||
717 | enum { | 823 | enum { |
718 | MAD_PRIVATE_HEADER = 0x0100,/* header private bit */ | 824 | MAD_PRIVATE_HEADER = 0x0100,/* header private bit */ |
719 | MAD_PRIVATE_III = 0x001f/* Layer III private bits (up to 5) */ | 825 | MAD_PRIVATE_III = 0x001f/* Layer III private bits (up to 5) */ |
720 | }; | 826 | }; |
721 | 827 | ||
722 | void mad_header_init(struct mad_header *); | 828 | void mad_header_init(struct mad_header *); |
723 | 829 | ||
724 | # define mad_header_finish(header) /* nothing */ | 830 | # define mad_header_finish(header) /* nothing */ |
725 | 831 | ||
726 | int mad_header_decode(struct mad_header *, struct mad_stream *); | 832 | int mad_header_decode(struct mad_header *, struct mad_stream *); |
727 | 833 | ||
728 | void mad_frame_init(struct mad_frame *); | 834 | void mad_frame_init(struct mad_frame *); |
729 | void mad_frame_finish(struct mad_frame *); | 835 | void mad_frame_finish(struct mad_frame *); |
730 | 836 | ||
731 | int mad_frame_decode(struct mad_frame *, struct mad_stream *); | 837 | int mad_frame_decode(struct mad_frame *, struct mad_stream *); |
732 | 838 | ||
733 | void mad_frame_mute(struct mad_frame *); | 839 | void mad_frame_mute(struct mad_frame *); |
734 | 840 | ||
735 | # endif | 841 | # endif |
736 | 842 | ||
737 | /* Id: synth.h,v 1.8 2001/04/05 04:57:11 rob Exp */ | 843 | /* Id: synth.h,v 1.15 2004/01/23 09:41:33 rob Exp */ |
738 | 844 | ||
739 | # ifndef LIBMAD_SYNTH_H | 845 | # ifndef LIBMAD_SYNTH_H |
740 | # define LIBMAD_SYNTH_H | 846 | # define LIBMAD_SYNTH_H |
741 | 847 | ||
848 | |||
849 | struct mad_pcm { | ||
850 | unsigned int samplerate; /* sampling frequency (Hz) */ | ||
851 | unsigned short channels; /* number of channels */ | ||
852 | unsigned short length; /* number of samples per channel */ | ||
853 | mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ | ||
854 | }; | ||
855 | |||
742 | struct mad_synth { | 856 | struct mad_synth { |
743 | mad_fixed_t filter[2][2][2][16][8];/* polyphase filterbank outputs */ | 857 | mad_fixed_t filter[2][2][2][16][8];/* polyphase filterbank outputs */ |
744 | /* [ch][eo][peo][s][v] */ | 858 | /* [ch][eo][peo][s][v] */ |
745 | 859 | ||
746 | unsigned int phase; /* current processing phase */ | 860 | unsigned int phase; /* current processing phase */ |
747 | 861 | ||
748 | struct mad_pcm { | 862 | struct mad_pcm pcm; /* PCM output */ |
749 | unsigned int samplerate; /* sampling frequency (Hz) */ | 863 | }; |
750 | unsigned short channels; /* number of channels */ | 864 | |
751 | unsigned short length; /* number of samples per channel */ | 865 | /* single channel PCM selector */ |
752 | mad_fixed_t samples[2][1152];/* PCM output samples */ | 866 | enum { |
753 | } pcm; | 867 | MAD_PCM_CHANNEL_SINGLE = 0 |
868 | }; | ||
869 | |||
870 | /* dual channel PCM selector */ | ||
871 | enum { | ||
872 | MAD_PCM_CHANNEL_DUAL_1 = 0, | ||
873 | MAD_PCM_CHANNEL_DUAL_2 = 1 | ||
874 | }; | ||
875 | |||
876 | /* stereo PCM selector */ | ||
877 | enum { | ||
878 | MAD_PCM_CHANNEL_STEREO_LEFT = 0, | ||
879 | MAD_PCM_CHANNEL_STEREO_RIGHT = 1 | ||
754 | }; | 880 | }; |
755 | 881 | ||
756 | void mad_synth_init(struct mad_synth *); | 882 | void mad_synth_init(struct mad_synth *); |
757 | 883 | ||
758 | # define mad_synth_finish(synth) /* nothing */ | 884 | # define mad_synth_finish(synth) /* nothing */ |
759 | 885 | ||
760 | void mad_synth_mute(struct mad_synth *); | 886 | void mad_synth_mute(struct mad_synth *); |
761 | 887 | ||
762 | void mad_synth_frame(struct mad_synth *, struct mad_frame const *); | 888 | void mad_synth_frame(struct mad_synth *, struct mad_frame const *); |
763 | 889 | ||
764 | # endif | 890 | # endif |
765 | 891 | ||
766 | /* Id: decoder.h,v 1.9 2001/04/05 04:57:11 rob Exp */ | 892 | /* Id: decoder.h,v 1.17 2004/01/23 09:41:32 rob Exp */ |
767 | 893 | ||
768 | # ifndef LIBMAD_DECODER_H | 894 | # ifndef LIBMAD_DECODER_H |
769 | # define LIBMAD_DECODER_H | 895 | # define LIBMAD_DECODER_H |
770 | 896 | ||
897 | |||
771 | enum mad_decoder_mode { | 898 | enum mad_decoder_mode { |
772 | MAD_DECODER_MODE_SYNC = 0, | 899 | MAD_DECODER_MODE_SYNC = 0, |
773 | MAD_DECODER_MODE_ASYNC | 900 | MAD_DECODER_MODE_ASYNC |
774 | }; | 901 | }; |
775 | 902 | ||
776 | enum mad_flow { | 903 | enum mad_flow { |
777 | MAD_FLOW_CONTINUE = 0x0000, | 904 | MAD_FLOW_CONTINUE = 0x0000,/* continue normally */ |
778 | MAD_FLOW_STOP = 0x0010, | 905 | MAD_FLOW_STOP = 0x0010,/* stop decoding normally */ |
779 | MAD_FLOW_BREAK = 0x0011, | 906 | MAD_FLOW_BREAK = 0x0011,/* stop decoding and signal an error */ |
780 | MAD_FLOW_IGNORE = 0x0020 | 907 | MAD_FLOW_IGNORE = 0x0020/* ignore the current frame */ |
781 | }; | 908 | }; |
782 | 909 | ||
783 | struct mad_decoder { | 910 | struct mad_decoder { |
784 | enum mad_decoder_mode mode; | 911 | enum mad_decoder_mode mode; |
785 | 912 | ||
786 | int options; | 913 | int options; |
787 | 914 | ||
788 | struct { | 915 | struct { |
789 | long pid; | 916 | long pid; |
790 | int in; | 917 | int in; |
791 | int out; | 918 | int out; |
792 | } async; | 919 | } async; |
793 | 920 | ||
794 | struct { | 921 | struct { |
795 | struct mad_stream stream; | 922 | struct mad_stream stream; |
796 | struct mad_frame frame; | 923 | struct mad_frame frame; |
797 | struct mad_synth synth; | 924 | struct mad_synth synth; |
798 | } *sync; | 925 | } *sync; |
799 | 926 | ||
800 | void *cb_data; | 927 | void *cb_data; |
801 | 928 | ||
802 | enum mad_flow (*input_func)(void *, struct mad_stream *); | 929 | enum mad_flow (*input_func)(void *, struct mad_stream *); |
803 | enum mad_flow (*header_func)(void *, struct mad_header const *); | 930 | enum mad_flow (*header_func)(void *, struct mad_header const *); |
804 | enum mad_flow (*filter_func)(void *, struct mad_frame *); | 931 | enum mad_flow (*filter_func)(void *, |
932 | struct mad_stream const *, struct mad_frame *); | ||
805 | enum mad_flow (*output_func)(void *, | 933 | enum mad_flow (*output_func)(void *, |
806 | struct mad_header const *, struct mad_pcm *); | 934 | struct mad_header const *, struct mad_pcm *); |
807 | enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); | 935 | enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); |
808 | enum mad_flow (*message_func)(void *, void *, unsigned int *); | 936 | enum mad_flow (*message_func)(void *, void *, unsigned int *); |
809 | }; | 937 | }; |
810 | 938 | ||
811 | void mad_decoder_init(struct mad_decoder *, void *, | 939 | void mad_decoder_init(struct mad_decoder *, void *, |
812 | enum mad_flow (*)(void *, struct mad_stream *), | 940 | enum mad_flow (*)(void *, struct mad_stream *), |
813 | enum mad_flow (*)(void *, struct mad_header const *), | 941 | enum mad_flow (*)(void *, struct mad_header const *), |
814 | enum mad_flow (*)(void *, struct mad_frame *), | 942 | enum mad_flow (*)(void *, |
943 | struct mad_stream const *, | ||
944 | struct mad_frame *), | ||
815 | enum mad_flow (*)(void *, | 945 | enum mad_flow (*)(void *, |
816 | struct mad_header const *, | 946 | struct mad_header const *, |
817 | struct mad_pcm *), | 947 | struct mad_pcm *), |
818 | enum mad_flow (*)(void *, | 948 | enum mad_flow (*)(void *, |
819 | struct mad_stream *, | 949 | struct mad_stream *, |
820 | struct mad_frame *), | 950 | struct mad_frame *), |
821 | enum mad_flow (*)(void *, void *, unsigned int *)); | 951 | enum mad_flow (*)(void *, void *, unsigned int *)); |
822 | int mad_decoder_finish(struct mad_decoder *); | 952 | int mad_decoder_finish(struct mad_decoder *); |
823 | 953 | ||
824 | # define mad_decoder_options(decoder, opts) ((decoder)->options = (opts)) | 954 | # define mad_decoder_options(decoder, opts) \ |
955 | ((void) ((decoder)->options = (opts))) | ||
825 | 956 | ||
826 | int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode); | 957 | int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode); |
827 | int mad_decoder_message(struct mad_decoder *, void *, unsigned int *); | 958 | int mad_decoder_message(struct mad_decoder *, void *, unsigned int *); |
828 | 959 | ||
829 | # endif | 960 | # endif |
830 | 961 | ||
962 | # ifdef __cplusplus | ||
963 | } | ||
964 | # endif | ||
diff --git a/core/multimedia/opieplayer/libmad/opie-libmadplugin.control b/core/multimedia/opieplayer/libmad/opie-libmadplugin.control index 8de5976..15c083f 100644 --- a/core/multimedia/opieplayer/libmad/opie-libmadplugin.control +++ b/core/multimedia/opieplayer/libmad/opie-libmadplugin.control | |||
@@ -1,11 +1,11 @@ | |||
1 | Package: opie-libmadplugin | 1 | Package: opie-libmadplugin |
2 | Files: plugins/codecs/libmadplugin.so.1.0.0 plugins/codecs/libmadplugin.so.1.0 plugins/codecs/libmadplugin.so.1 plugins/codecs/libmadplugin.so | 2 | Files: plugins/codecs/libmadplugin.so.1.0.0 plugins/codecs/libmadplugin.so.1.0 plugins/codecs/libmadplugin.so.1 plugins/codecs/libmadplugin.so |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: libs | 4 | Section: opie/plugins |
5 | Maintainer: Maximilian Reiss <max.reiss@gmx.de>, L.J. Potter <lpotter@trolltech.com> | 5 | Maintainer: Maximilian Reiss <max.reiss@gmx.de> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal |
8 | Description: MP3 file plugin using libmad | 8 | Description: MP3 file plugin using libmad |
9 | Plugin to play MP3 files with the mediaplayer in the Opie environment. | 9 | Plugin to play MP3 files with the mediaplayer in the Opie environment. |
10 | It also has streaming support (Shoutcast/Icecast). | 10 | It also hast streaming support (Shoutcast/Icecast). |
11 | Version: $QPE_VERSION$EXTRAVERSION | 11 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/core/multimedia/opieplayer/libmad/qc_table.dat b/core/multimedia/opieplayer/libmad/qc_table.dat index 5d9ca96..d28a207 100644 --- a/core/multimedia/opieplayer/libmad/qc_table.dat +++ b/core/multimedia/opieplayer/libmad/qc_table.dat | |||
@@ -1,77 +1,77 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * These are the Layer II classes of quantization. | 23 | * These are the Layer II classes of quantization. |
24 | * The table is derived from Table B.4 of ISO/IEC 11172-3. | 24 | * The table is derived from Table B.4 of ISO/IEC 11172-3. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | { 3, 2, 5, | 27 | { 3, 2, 5, |
28 | MAD_F(0x15555555) /* 1.33333333333 => 1.33333333209, e 0.00000000124 */, | 28 | MAD_F(0x15555555) /* 1.33333333333 => 1.33333333209, e 0.00000000124 */, |
29 | MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ }, | 29 | MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ }, |
30 | { 5, 3, 7, | 30 | { 5, 3, 7, |
31 | MAD_F(0x1999999a) /* 1.60000000000 => 1.60000000149, e -0.00000000149 */, | 31 | MAD_F(0x1999999a) /* 1.60000000000 => 1.60000000149, e -0.00000000149 */, |
32 | MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ }, | 32 | MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ }, |
33 | { 7, 0, 3, | 33 | { 7, 0, 3, |
34 | MAD_F(0x12492492) /* 1.14285714286 => 1.14285714179, e 0.00000000107 */, | 34 | MAD_F(0x12492492) /* 1.14285714286 => 1.14285714179, e 0.00000000107 */, |
35 | MAD_F(0x04000000) /* 0.25000000000 => 0.25000000000, e 0.00000000000 */ }, | 35 | MAD_F(0x04000000) /* 0.25000000000 => 0.25000000000, e 0.00000000000 */ }, |
36 | { 9, 4, 10, | 36 | { 9, 4, 10, |
37 | MAD_F(0x1c71c71c) /* 1.77777777777 => 1.77777777612, e 0.00000000165 */, | 37 | MAD_F(0x1c71c71c) /* 1.77777777777 => 1.77777777612, e 0.00000000165 */, |
38 | MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ }, | 38 | MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ }, |
39 | { 15, 0, 4, | 39 | { 15, 0, 4, |
40 | MAD_F(0x11111111) /* 1.06666666666 => 1.06666666642, e 0.00000000024 */, | 40 | MAD_F(0x11111111) /* 1.06666666666 => 1.06666666642, e 0.00000000024 */, |
41 | MAD_F(0x02000000) /* 0.12500000000 => 0.12500000000, e 0.00000000000 */ }, | 41 | MAD_F(0x02000000) /* 0.12500000000 => 0.12500000000, e 0.00000000000 */ }, |
42 | { 31, 0, 5, | 42 | { 31, 0, 5, |
43 | MAD_F(0x10842108) /* 1.03225806452 => 1.03225806355, e 0.00000000097 */, | 43 | MAD_F(0x10842108) /* 1.03225806452 => 1.03225806355, e 0.00000000097 */, |
44 | MAD_F(0x01000000) /* 0.06250000000 => 0.06250000000, e 0.00000000000 */ }, | 44 | MAD_F(0x01000000) /* 0.06250000000 => 0.06250000000, e 0.00000000000 */ }, |
45 | { 63, 0, 6, | 45 | { 63, 0, 6, |
46 | MAD_F(0x10410410) /* 1.01587301587 => 1.01587301493, e 0.00000000094 */, | 46 | MAD_F(0x10410410) /* 1.01587301587 => 1.01587301493, e 0.00000000094 */, |
47 | MAD_F(0x00800000) /* 0.03125000000 => 0.03125000000, e 0.00000000000 */ }, | 47 | MAD_F(0x00800000) /* 0.03125000000 => 0.03125000000, e 0.00000000000 */ }, |
48 | { 127, 0, 7, | 48 | { 127, 0, 7, |
49 | MAD_F(0x10204081) /* 1.00787401575 => 1.00787401572, e 0.00000000003 */, | 49 | MAD_F(0x10204081) /* 1.00787401575 => 1.00787401572, e 0.00000000003 */, |
50 | MAD_F(0x00400000) /* 0.01562500000 => 0.01562500000, e 0.00000000000 */ }, | 50 | MAD_F(0x00400000) /* 0.01562500000 => 0.01562500000, e 0.00000000000 */ }, |
51 | { 255, 0, 8, | 51 | { 255, 0, 8, |
52 | MAD_F(0x10101010) /* 1.00392156863 => 1.00392156839, e 0.00000000024 */, | 52 | MAD_F(0x10101010) /* 1.00392156863 => 1.00392156839, e 0.00000000024 */, |
53 | MAD_F(0x00200000) /* 0.00781250000 => 0.00781250000, e 0.00000000000 */ }, | 53 | MAD_F(0x00200000) /* 0.00781250000 => 0.00781250000, e 0.00000000000 */ }, |
54 | { 511, 0, 9, | 54 | { 511, 0, 9, |
55 | MAD_F(0x10080402) /* 1.00195694716 => 1.00195694715, e 0.00000000001 */, | 55 | MAD_F(0x10080402) /* 1.00195694716 => 1.00195694715, e 0.00000000001 */, |
56 | MAD_F(0x00100000) /* 0.00390625000 => 0.00390625000, e 0.00000000000 */ }, | 56 | MAD_F(0x00100000) /* 0.00390625000 => 0.00390625000, e 0.00000000000 */ }, |
57 | { 1023, 0, 10, | 57 | { 1023, 0, 10, |
58 | MAD_F(0x10040100) /* 1.00097751711 => 1.00097751617, e 0.00000000094 */, | 58 | MAD_F(0x10040100) /* 1.00097751711 => 1.00097751617, e 0.00000000094 */, |
59 | MAD_F(0x00080000) /* 0.00195312500 => 0.00195312500, e 0.00000000000 */ }, | 59 | MAD_F(0x00080000) /* 0.00195312500 => 0.00195312500, e 0.00000000000 */ }, |
60 | { 2047, 0, 11, | 60 | { 2047, 0, 11, |
61 | MAD_F(0x10020040) /* 1.00048851979 => 1.00048851967, e 0.00000000012 */, | 61 | MAD_F(0x10020040) /* 1.00048851979 => 1.00048851967, e 0.00000000012 */, |
62 | MAD_F(0x00040000) /* 0.00097656250 => 0.00097656250, e 0.00000000000 */ }, | 62 | MAD_F(0x00040000) /* 0.00097656250 => 0.00097656250, e 0.00000000000 */ }, |
63 | { 4095, 0, 12, | 63 | { 4095, 0, 12, |
64 | MAD_F(0x10010010) /* 1.00024420024 => 1.00024420023, e 0.00000000001 */, | 64 | MAD_F(0x10010010) /* 1.00024420024 => 1.00024420023, e 0.00000000001 */, |
65 | MAD_F(0x00020000) /* 0.00048828125 => 0.00048828125, e 0.00000000000 */ }, | 65 | MAD_F(0x00020000) /* 0.00048828125 => 0.00048828125, e 0.00000000000 */ }, |
66 | { 8191, 0, 13, | 66 | { 8191, 0, 13, |
67 | MAD_F(0x10008004) /* 1.00012208522 => 1.00012208521, e 0.00000000001 */, | 67 | MAD_F(0x10008004) /* 1.00012208522 => 1.00012208521, e 0.00000000001 */, |
68 | MAD_F(0x00010000) /* 0.00024414063 => 0.00024414062, e 0.00000000000 */ }, | 68 | MAD_F(0x00010000) /* 0.00024414063 => 0.00024414062, e 0.00000000000 */ }, |
69 | { 16383, 0, 14, | 69 | { 16383, 0, 14, |
70 | MAD_F(0x10004001) /* 1.00006103888 => 1.00006103888, e -0.00000000000 */, | 70 | MAD_F(0x10004001) /* 1.00006103888 => 1.00006103888, e -0.00000000000 */, |
71 | MAD_F(0x00008000) /* 0.00012207031 => 0.00012207031, e -0.00000000000 */ }, | 71 | MAD_F(0x00008000) /* 0.00012207031 => 0.00012207031, e -0.00000000000 */ }, |
72 | { 32767, 0, 15, | 72 | { 32767, 0, 15, |
73 | MAD_F(0x10002000) /* 1.00003051851 => 1.00003051758, e 0.00000000093 */, | 73 | MAD_F(0x10002000) /* 1.00003051851 => 1.00003051758, e 0.00000000093 */, |
74 | MAD_F(0x00004000) /* 0.00006103516 => 0.00006103516, e 0.00000000000 */ }, | 74 | MAD_F(0x00004000) /* 0.00006103516 => 0.00006103516, e 0.00000000000 */ }, |
75 | { 65535, 0, 16, | 75 | { 65535, 0, 16, |
76 | MAD_F(0x10001000) /* 1.00001525902 => 1.00001525879, e 0.00000000023 */, | 76 | MAD_F(0x10001000) /* 1.00001525902 => 1.00001525879, e 0.00000000023 */, |
77 | MAD_F(0x00002000) /* 0.00003051758 => 0.00003051758, e 0.00000000000 */ } | 77 | MAD_F(0x00002000) /* 0.00003051758 => 0.00003051758, e 0.00000000000 */ } |
diff --git a/core/multimedia/opieplayer/libmad/rq_table.dat b/core/multimedia/opieplayer/libmad/rq_table.dat index 803cf04..518a391 100644 --- a/core/multimedia/opieplayer/libmad/rq_table.dat +++ b/core/multimedia/opieplayer/libmad/rq_table.dat | |||
@@ -1,1027 +1,1027 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * This is the lookup table used to compute x^(4/3) for Layer III | 23 | * This is the lookup table used to compute x^(4/3) for Layer III |
24 | * requantization. To maintain the best possible accuracy, the value is | 24 | * requantization. To maintain the best possible accuracy, the value is |
25 | * stored as a normalized mantissa with exponent. The requantization | 25 | * stored as a normalized mantissa with exponent. The requantization |
26 | * algorithm recombines these parts with appropriate scaling. | 26 | * algorithm recombines these parts with appropriate scaling. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | /* 0 */ { MAD_F(0x00000000) /* 0.000000000 */, 0 }, | 29 | /* 0 */ { MAD_F(0x00000000) /* 0.000000000 */, 0 }, |
30 | /* 1 */ { MAD_F(0x04000000) /* 0.250000000 */, 2 }, | 30 | /* 1 */ { MAD_F(0x04000000) /* 0.250000000 */, 2 }, |
31 | /* 2 */ { MAD_F(0x050a28be) /* 0.314980262 */, 3 }, | 31 | /* 2 */ { MAD_F(0x050a28be) /* 0.314980262 */, 3 }, |
32 | /* 3 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 4 }, | 32 | /* 3 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 4 }, |
33 | /* 4 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 4 }, | 33 | /* 4 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 4 }, |
34 | /* 5 */ { MAD_F(0x04466275) /* 0.267183742 */, 5 }, | 34 | /* 5 */ { MAD_F(0x04466275) /* 0.267183742 */, 5 }, |
35 | /* 6 */ { MAD_F(0x05738c72) /* 0.340710111 */, 5 }, | 35 | /* 6 */ { MAD_F(0x05738c72) /* 0.340710111 */, 5 }, |
36 | /* 7 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 5 }, | 36 | /* 7 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 5 }, |
37 | /* 8 */ { MAD_F(0x04000000) /* 0.250000000 */, 6 }, | 37 | /* 8 */ { MAD_F(0x04000000) /* 0.250000000 */, 6 }, |
38 | /* 9 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 6 }, | 38 | /* 9 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 6 }, |
39 | /* 10 */ { MAD_F(0x0562d694) /* 0.336630420 */, 6 }, | 39 | /* 10 */ { MAD_F(0x0562d694) /* 0.336630420 */, 6 }, |
40 | /* 11 */ { MAD_F(0x061dae96) /* 0.382246578 */, 6 }, | 40 | /* 11 */ { MAD_F(0x061dae96) /* 0.382246578 */, 6 }, |
41 | /* 12 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 6 }, | 41 | /* 12 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 6 }, |
42 | /* 13 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 6 }, | 42 | /* 13 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 6 }, |
43 | /* 14 */ { MAD_F(0x0437be65) /* 0.263609310 */, 7 }, | 43 | /* 14 */ { MAD_F(0x0437be65) /* 0.263609310 */, 7 }, |
44 | /* 15 */ { MAD_F(0x049fc824) /* 0.289009227 */, 7 }, | 44 | /* 15 */ { MAD_F(0x049fc824) /* 0.289009227 */, 7 }, |
45 | 45 | ||
46 | /* 16 */ { MAD_F(0x050a28be) /* 0.314980262 */, 7 }, | 46 | /* 16 */ { MAD_F(0x050a28be) /* 0.314980262 */, 7 }, |
47 | /* 17 */ { MAD_F(0x0576c6f5) /* 0.341498336 */, 7 }, | 47 | /* 17 */ { MAD_F(0x0576c6f5) /* 0.341498336 */, 7 }, |
48 | /* 18 */ { MAD_F(0x05e58c0b) /* 0.368541759 */, 7 }, | 48 | /* 18 */ { MAD_F(0x05e58c0b) /* 0.368541759 */, 7 }, |
49 | /* 19 */ { MAD_F(0x06566361) /* 0.396090870 */, 7 }, | 49 | /* 19 */ { MAD_F(0x06566361) /* 0.396090870 */, 7 }, |
50 | /* 20 */ { MAD_F(0x06c93a2e) /* 0.424127753 */, 7 }, | 50 | /* 20 */ { MAD_F(0x06c93a2e) /* 0.424127753 */, 7 }, |
51 | /* 21 */ { MAD_F(0x073dff3e) /* 0.452635998 */, 7 }, | 51 | /* 21 */ { MAD_F(0x073dff3e) /* 0.452635998 */, 7 }, |
52 | /* 22 */ { MAD_F(0x07b4a2bc) /* 0.481600510 */, 7 }, | 52 | /* 22 */ { MAD_F(0x07b4a2bc) /* 0.481600510 */, 7 }, |
53 | /* 23 */ { MAD_F(0x04168b05) /* 0.255503674 */, 8 }, | 53 | /* 23 */ { MAD_F(0x04168b05) /* 0.255503674 */, 8 }, |
54 | /* 24 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 8 }, | 54 | /* 24 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 8 }, |
55 | /* 25 */ { MAD_F(0x04919b6a) /* 0.285548607 */, 8 }, | 55 | /* 25 */ { MAD_F(0x04919b6a) /* 0.285548607 */, 8 }, |
56 | /* 26 */ { MAD_F(0x04d065fb) /* 0.300878507 */, 8 }, | 56 | /* 26 */ { MAD_F(0x04d065fb) /* 0.300878507 */, 8 }, |
57 | /* 27 */ { MAD_F(0x05100000) /* 0.316406250 */, 8 }, | 57 | /* 27 */ { MAD_F(0x05100000) /* 0.316406250 */, 8 }, |
58 | /* 28 */ { MAD_F(0x05506451) /* 0.332126919 */, 8 }, | 58 | /* 28 */ { MAD_F(0x05506451) /* 0.332126919 */, 8 }, |
59 | /* 29 */ { MAD_F(0x05918e15) /* 0.348035890 */, 8 }, | 59 | /* 29 */ { MAD_F(0x05918e15) /* 0.348035890 */, 8 }, |
60 | /* 30 */ { MAD_F(0x05d378bb) /* 0.364128809 */, 8 }, | 60 | /* 30 */ { MAD_F(0x05d378bb) /* 0.364128809 */, 8 }, |
61 | /* 31 */ { MAD_F(0x06161ff3) /* 0.380401563 */, 8 }, | 61 | /* 31 */ { MAD_F(0x06161ff3) /* 0.380401563 */, 8 }, |
62 | 62 | ||
63 | /* 32 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 8 }, | 63 | /* 32 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 8 }, |
64 | /* 33 */ { MAD_F(0x069d9400) /* 0.413471222 */, 8 }, | 64 | /* 33 */ { MAD_F(0x069d9400) /* 0.413471222 */, 8 }, |
65 | /* 34 */ { MAD_F(0x06e2594c) /* 0.430260942 */, 8 }, | 65 | /* 34 */ { MAD_F(0x06e2594c) /* 0.430260942 */, 8 }, |
66 | /* 35 */ { MAD_F(0x0727cc11) /* 0.447216097 */, 8 }, | 66 | /* 35 */ { MAD_F(0x0727cc11) /* 0.447216097 */, 8 }, |
67 | /* 36 */ { MAD_F(0x076de8fc) /* 0.464333519 */, 8 }, | 67 | /* 36 */ { MAD_F(0x076de8fc) /* 0.464333519 */, 8 }, |
68 | /* 37 */ { MAD_F(0x07b4ace3) /* 0.481610189 */, 8 }, | 68 | /* 37 */ { MAD_F(0x07b4ace3) /* 0.481610189 */, 8 }, |
69 | /* 38 */ { MAD_F(0x07fc14bf) /* 0.499043224 */, 8 }, | 69 | /* 38 */ { MAD_F(0x07fc14bf) /* 0.499043224 */, 8 }, |
70 | /* 39 */ { MAD_F(0x04220ed7) /* 0.258314934 */, 9 }, | 70 | /* 39 */ { MAD_F(0x04220ed7) /* 0.258314934 */, 9 }, |
71 | /* 40 */ { MAD_F(0x04466275) /* 0.267183742 */, 9 }, | 71 | /* 40 */ { MAD_F(0x04466275) /* 0.267183742 */, 9 }, |
72 | /* 41 */ { MAD_F(0x046b03e7) /* 0.276126771 */, 9 }, | 72 | /* 41 */ { MAD_F(0x046b03e7) /* 0.276126771 */, 9 }, |
73 | /* 42 */ { MAD_F(0x048ff1e8) /* 0.285142811 */, 9 }, | 73 | /* 42 */ { MAD_F(0x048ff1e8) /* 0.285142811 */, 9 }, |
74 | /* 43 */ { MAD_F(0x04b52b3f) /* 0.294230696 */, 9 }, | 74 | /* 43 */ { MAD_F(0x04b52b3f) /* 0.294230696 */, 9 }, |
75 | /* 44 */ { MAD_F(0x04daaec0) /* 0.303389310 */, 9 }, | 75 | /* 44 */ { MAD_F(0x04daaec0) /* 0.303389310 */, 9 }, |
76 | /* 45 */ { MAD_F(0x05007b49) /* 0.312617576 */, 9 }, | 76 | /* 45 */ { MAD_F(0x05007b49) /* 0.312617576 */, 9 }, |
77 | /* 46 */ { MAD_F(0x05268fc6) /* 0.321914457 */, 9 }, | 77 | /* 46 */ { MAD_F(0x05268fc6) /* 0.321914457 */, 9 }, |
78 | /* 47 */ { MAD_F(0x054ceb2a) /* 0.331278957 */, 9 }, | 78 | /* 47 */ { MAD_F(0x054ceb2a) /* 0.331278957 */, 9 }, |
79 | 79 | ||
80 | /* 48 */ { MAD_F(0x05738c72) /* 0.340710111 */, 9 }, | 80 | /* 48 */ { MAD_F(0x05738c72) /* 0.340710111 */, 9 }, |
81 | /* 49 */ { MAD_F(0x059a72a5) /* 0.350206992 */, 9 }, | 81 | /* 49 */ { MAD_F(0x059a72a5) /* 0.350206992 */, 9 }, |
82 | /* 50 */ { MAD_F(0x05c19cd3) /* 0.359768701 */, 9 }, | 82 | /* 50 */ { MAD_F(0x05c19cd3) /* 0.359768701 */, 9 }, |
83 | /* 51 */ { MAD_F(0x05e90a12) /* 0.369394372 */, 9 }, | 83 | /* 51 */ { MAD_F(0x05e90a12) /* 0.369394372 */, 9 }, |
84 | /* 52 */ { MAD_F(0x0610b982) /* 0.379083164 */, 9 }, | 84 | /* 52 */ { MAD_F(0x0610b982) /* 0.379083164 */, 9 }, |
85 | /* 53 */ { MAD_F(0x0638aa48) /* 0.388834268 */, 9 }, | 85 | /* 53 */ { MAD_F(0x0638aa48) /* 0.388834268 */, 9 }, |
86 | /* 54 */ { MAD_F(0x0660db91) /* 0.398646895 */, 9 }, | 86 | /* 54 */ { MAD_F(0x0660db91) /* 0.398646895 */, 9 }, |
87 | /* 55 */ { MAD_F(0x06894c90) /* 0.408520284 */, 9 }, | 87 | /* 55 */ { MAD_F(0x06894c90) /* 0.408520284 */, 9 }, |
88 | /* 56 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 9 }, | 88 | /* 56 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 9 }, |
89 | /* 57 */ { MAD_F(0x06daeaa1) /* 0.428446415 */, 9 }, | 89 | /* 57 */ { MAD_F(0x06daeaa1) /* 0.428446415 */, 9 }, |
90 | /* 58 */ { MAD_F(0x07041636) /* 0.438497744 */, 9 }, | 90 | /* 58 */ { MAD_F(0x07041636) /* 0.438497744 */, 9 }, |
91 | /* 59 */ { MAD_F(0x072d7e8b) /* 0.448607009 */, 9 }, | 91 | /* 59 */ { MAD_F(0x072d7e8b) /* 0.448607009 */, 9 }, |
92 | /* 60 */ { MAD_F(0x075722ef) /* 0.458773552 */, 9 }, | 92 | /* 60 */ { MAD_F(0x075722ef) /* 0.458773552 */, 9 }, |
93 | /* 61 */ { MAD_F(0x078102b8) /* 0.468996735 */, 9 }, | 93 | /* 61 */ { MAD_F(0x078102b8) /* 0.468996735 */, 9 }, |
94 | /* 62 */ { MAD_F(0x07ab1d3e) /* 0.479275937 */, 9 }, | 94 | /* 62 */ { MAD_F(0x07ab1d3e) /* 0.479275937 */, 9 }, |
95 | /* 63 */ { MAD_F(0x07d571e0) /* 0.489610555 */, 9 }, | 95 | /* 63 */ { MAD_F(0x07d571e0) /* 0.489610555 */, 9 }, |
96 | 96 | ||
97 | /* 64 */ { MAD_F(0x04000000) /* 0.250000000 */, 10 }, | 97 | /* 64 */ { MAD_F(0x04000000) /* 0.250000000 */, 10 }, |
98 | /* 65 */ { MAD_F(0x04156381) /* 0.255221850 */, 10 }, | 98 | /* 65 */ { MAD_F(0x04156381) /* 0.255221850 */, 10 }, |
99 | /* 66 */ { MAD_F(0x042ae32a) /* 0.260470548 */, 10 }, | 99 | /* 66 */ { MAD_F(0x042ae32a) /* 0.260470548 */, 10 }, |
100 | /* 67 */ { MAD_F(0x04407eb1) /* 0.265745823 */, 10 }, | 100 | /* 67 */ { MAD_F(0x04407eb1) /* 0.265745823 */, 10 }, |
101 | /* 68 */ { MAD_F(0x045635cf) /* 0.271047409 */, 10 }, | 101 | /* 68 */ { MAD_F(0x045635cf) /* 0.271047409 */, 10 }, |
102 | /* 69 */ { MAD_F(0x046c083e) /* 0.276375048 */, 10 }, | 102 | /* 69 */ { MAD_F(0x046c083e) /* 0.276375048 */, 10 }, |
103 | /* 70 */ { MAD_F(0x0481f5bb) /* 0.281728487 */, 10 }, | 103 | /* 70 */ { MAD_F(0x0481f5bb) /* 0.281728487 */, 10 }, |
104 | /* 71 */ { MAD_F(0x0497fe03) /* 0.287107481 */, 10 }, | 104 | /* 71 */ { MAD_F(0x0497fe03) /* 0.287107481 */, 10 }, |
105 | /* 72 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 10 }, | 105 | /* 72 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 10 }, |
106 | /* 73 */ { MAD_F(0x04c45df6) /* 0.297941173 */, 10 }, | 106 | /* 73 */ { MAD_F(0x04c45df6) /* 0.297941173 */, 10 }, |
107 | /* 74 */ { MAD_F(0x04dab524) /* 0.303395408 */, 10 }, | 107 | /* 74 */ { MAD_F(0x04dab524) /* 0.303395408 */, 10 }, |
108 | /* 75 */ { MAD_F(0x04f12624) /* 0.308874267 */, 10 }, | 108 | /* 75 */ { MAD_F(0x04f12624) /* 0.308874267 */, 10 }, |
109 | /* 76 */ { MAD_F(0x0507b0bc) /* 0.314377532 */, 10 }, | 109 | /* 76 */ { MAD_F(0x0507b0bc) /* 0.314377532 */, 10 }, |
110 | /* 77 */ { MAD_F(0x051e54b1) /* 0.319904987 */, 10 }, | 110 | /* 77 */ { MAD_F(0x051e54b1) /* 0.319904987 */, 10 }, |
111 | /* 78 */ { MAD_F(0x053511cb) /* 0.325456423 */, 10 }, | 111 | /* 78 */ { MAD_F(0x053511cb) /* 0.325456423 */, 10 }, |
112 | /* 79 */ { MAD_F(0x054be7d4) /* 0.331031635 */, 10 }, | 112 | /* 79 */ { MAD_F(0x054be7d4) /* 0.331031635 */, 10 }, |
113 | 113 | ||
114 | /* 80 */ { MAD_F(0x0562d694) /* 0.336630420 */, 10 }, | 114 | /* 80 */ { MAD_F(0x0562d694) /* 0.336630420 */, 10 }, |
115 | /* 81 */ { MAD_F(0x0579ddd8) /* 0.342252584 */, 10 }, | 115 | /* 81 */ { MAD_F(0x0579ddd8) /* 0.342252584 */, 10 }, |
116 | /* 82 */ { MAD_F(0x0590fd6c) /* 0.347897931 */, 10 }, | 116 | /* 82 */ { MAD_F(0x0590fd6c) /* 0.347897931 */, 10 }, |
117 | /* 83 */ { MAD_F(0x05a8351c) /* 0.353566275 */, 10 }, | 117 | /* 83 */ { MAD_F(0x05a8351c) /* 0.353566275 */, 10 }, |
118 | /* 84 */ { MAD_F(0x05bf84b8) /* 0.359257429 */, 10 }, | 118 | /* 84 */ { MAD_F(0x05bf84b8) /* 0.359257429 */, 10 }, |
119 | /* 85 */ { MAD_F(0x05d6ec0e) /* 0.364971213 */, 10 }, | 119 | /* 85 */ { MAD_F(0x05d6ec0e) /* 0.364971213 */, 10 }, |
120 | /* 86 */ { MAD_F(0x05ee6aef) /* 0.370707448 */, 10 }, | 120 | /* 86 */ { MAD_F(0x05ee6aef) /* 0.370707448 */, 10 }, |
121 | /* 87 */ { MAD_F(0x0606012b) /* 0.376465960 */, 10 }, | 121 | /* 87 */ { MAD_F(0x0606012b) /* 0.376465960 */, 10 }, |
122 | /* 88 */ { MAD_F(0x061dae96) /* 0.382246578 */, 10 }, | 122 | /* 88 */ { MAD_F(0x061dae96) /* 0.382246578 */, 10 }, |
123 | /* 89 */ { MAD_F(0x06357302) /* 0.388049134 */, 10 }, | 123 | /* 89 */ { MAD_F(0x06357302) /* 0.388049134 */, 10 }, |
124 | /* 90 */ { MAD_F(0x064d4e43) /* 0.393873464 */, 10 }, | 124 | /* 90 */ { MAD_F(0x064d4e43) /* 0.393873464 */, 10 }, |
125 | /* 91 */ { MAD_F(0x0665402d) /* 0.399719406 */, 10 }, | 125 | /* 91 */ { MAD_F(0x0665402d) /* 0.399719406 */, 10 }, |
126 | /* 92 */ { MAD_F(0x067d4896) /* 0.405586801 */, 10 }, | 126 | /* 92 */ { MAD_F(0x067d4896) /* 0.405586801 */, 10 }, |
127 | /* 93 */ { MAD_F(0x06956753) /* 0.411475493 */, 10 }, | 127 | /* 93 */ { MAD_F(0x06956753) /* 0.411475493 */, 10 }, |
128 | /* 94 */ { MAD_F(0x06ad9c3d) /* 0.417385331 */, 10 }, | 128 | /* 94 */ { MAD_F(0x06ad9c3d) /* 0.417385331 */, 10 }, |
129 | /* 95 */ { MAD_F(0x06c5e72b) /* 0.423316162 */, 10 }, | 129 | /* 95 */ { MAD_F(0x06c5e72b) /* 0.423316162 */, 10 }, |
130 | 130 | ||
131 | /* 96 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 10 }, | 131 | /* 96 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 10 }, |
132 | /* 97 */ { MAD_F(0x06f6be73) /* 0.435240221 */, 10 }, | 132 | /* 97 */ { MAD_F(0x06f6be73) /* 0.435240221 */, 10 }, |
133 | /* 98 */ { MAD_F(0x070f4a80) /* 0.441233161 */, 10 }, | 133 | /* 98 */ { MAD_F(0x070f4a80) /* 0.441233161 */, 10 }, |
134 | /* 99 */ { MAD_F(0x0727ebf7) /* 0.447246519 */, 10 }, | 134 | /* 99 */ { MAD_F(0x0727ebf7) /* 0.447246519 */, 10 }, |
135 | /* 100 */ { MAD_F(0x0740a2b2) /* 0.453280160 */, 10 }, | 135 | /* 100 */ { MAD_F(0x0740a2b2) /* 0.453280160 */, 10 }, |
136 | /* 101 */ { MAD_F(0x07596e8d) /* 0.459333946 */, 10 }, | 136 | /* 101 */ { MAD_F(0x07596e8d) /* 0.459333946 */, 10 }, |
137 | /* 102 */ { MAD_F(0x07724f64) /* 0.465407744 */, 10 }, | 137 | /* 102 */ { MAD_F(0x07724f64) /* 0.465407744 */, 10 }, |
138 | /* 103 */ { MAD_F(0x078b4514) /* 0.471501425 */, 10 }, | 138 | /* 103 */ { MAD_F(0x078b4514) /* 0.471501425 */, 10 }, |
139 | /* 104 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 10 }, | 139 | /* 104 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 10 }, |
140 | /* 105 */ { MAD_F(0x07bd6e75) /* 0.483747918 */, 10 }, | 140 | /* 105 */ { MAD_F(0x07bd6e75) /* 0.483747918 */, 10 }, |
141 | /* 106 */ { MAD_F(0x07d6a1e2) /* 0.489900479 */, 10 }, | 141 | /* 106 */ { MAD_F(0x07d6a1e2) /* 0.489900479 */, 10 }, |
142 | /* 107 */ { MAD_F(0x07efe9a1) /* 0.496072418 */, 10 }, | 142 | /* 107 */ { MAD_F(0x07efe9a1) /* 0.496072418 */, 10 }, |
143 | /* 108 */ { MAD_F(0x0404a2c9) /* 0.251131807 */, 11 }, | 143 | /* 108 */ { MAD_F(0x0404a2c9) /* 0.251131807 */, 11 }, |
144 | /* 109 */ { MAD_F(0x04115aca) /* 0.254236974 */, 11 }, | 144 | /* 109 */ { MAD_F(0x04115aca) /* 0.254236974 */, 11 }, |
145 | /* 110 */ { MAD_F(0x041e1cc4) /* 0.257351652 */, 11 }, | 145 | /* 110 */ { MAD_F(0x041e1cc4) /* 0.257351652 */, 11 }, |
146 | /* 111 */ { MAD_F(0x042ae8a7) /* 0.260475783 */, 11 }, | 146 | /* 111 */ { MAD_F(0x042ae8a7) /* 0.260475783 */, 11 }, |
147 | 147 | ||
148 | /* 112 */ { MAD_F(0x0437be65) /* 0.263609310 */, 11 }, | 148 | /* 112 */ { MAD_F(0x0437be65) /* 0.263609310 */, 11 }, |
149 | /* 113 */ { MAD_F(0x04449dee) /* 0.266752177 */, 11 }, | 149 | /* 113 */ { MAD_F(0x04449dee) /* 0.266752177 */, 11 }, |
150 | /* 114 */ { MAD_F(0x04518733) /* 0.269904329 */, 11 }, | 150 | /* 114 */ { MAD_F(0x04518733) /* 0.269904329 */, 11 }, |
151 | /* 115 */ { MAD_F(0x045e7a26) /* 0.273065710 */, 11 }, | 151 | /* 115 */ { MAD_F(0x045e7a26) /* 0.273065710 */, 11 }, |
152 | /* 116 */ { MAD_F(0x046b76b9) /* 0.276236269 */, 11 }, | 152 | /* 116 */ { MAD_F(0x046b76b9) /* 0.276236269 */, 11 }, |
153 | /* 117 */ { MAD_F(0x04787cdc) /* 0.279415952 */, 11 }, | 153 | /* 117 */ { MAD_F(0x04787cdc) /* 0.279415952 */, 11 }, |
154 | /* 118 */ { MAD_F(0x04858c83) /* 0.282604707 */, 11 }, | 154 | /* 118 */ { MAD_F(0x04858c83) /* 0.282604707 */, 11 }, |
155 | /* 119 */ { MAD_F(0x0492a59f) /* 0.285802482 */, 11 }, | 155 | /* 119 */ { MAD_F(0x0492a59f) /* 0.285802482 */, 11 }, |
156 | /* 120 */ { MAD_F(0x049fc824) /* 0.289009227 */, 11 }, | 156 | /* 120 */ { MAD_F(0x049fc824) /* 0.289009227 */, 11 }, |
157 | /* 121 */ { MAD_F(0x04acf402) /* 0.292224893 */, 11 }, | 157 | /* 121 */ { MAD_F(0x04acf402) /* 0.292224893 */, 11 }, |
158 | /* 122 */ { MAD_F(0x04ba292e) /* 0.295449429 */, 11 }, | 158 | /* 122 */ { MAD_F(0x04ba292e) /* 0.295449429 */, 11 }, |
159 | /* 123 */ { MAD_F(0x04c7679a) /* 0.298682788 */, 11 }, | 159 | /* 123 */ { MAD_F(0x04c7679a) /* 0.298682788 */, 11 }, |
160 | /* 124 */ { MAD_F(0x04d4af3a) /* 0.301924921 */, 11 }, | 160 | /* 124 */ { MAD_F(0x04d4af3a) /* 0.301924921 */, 11 }, |
161 | /* 125 */ { MAD_F(0x04e20000) /* 0.305175781 */, 11 }, | 161 | /* 125 */ { MAD_F(0x04e20000) /* 0.305175781 */, 11 }, |
162 | /* 126 */ { MAD_F(0x04ef59e0) /* 0.308435322 */, 11 }, | 162 | /* 126 */ { MAD_F(0x04ef59e0) /* 0.308435322 */, 11 }, |
163 | /* 127 */ { MAD_F(0x04fcbcce) /* 0.311703498 */, 11 }, | 163 | /* 127 */ { MAD_F(0x04fcbcce) /* 0.311703498 */, 11 }, |
164 | 164 | ||
165 | /* 128 */ { MAD_F(0x050a28be) /* 0.314980262 */, 11 }, | 165 | /* 128 */ { MAD_F(0x050a28be) /* 0.314980262 */, 11 }, |
166 | /* 129 */ { MAD_F(0x05179da4) /* 0.318265572 */, 11 }, | 166 | /* 129 */ { MAD_F(0x05179da4) /* 0.318265572 */, 11 }, |
167 | /* 130 */ { MAD_F(0x05251b73) /* 0.321559381 */, 11 }, | 167 | /* 130 */ { MAD_F(0x05251b73) /* 0.321559381 */, 11 }, |
168 | /* 131 */ { MAD_F(0x0532a220) /* 0.324861647 */, 11 }, | 168 | /* 131 */ { MAD_F(0x0532a220) /* 0.324861647 */, 11 }, |
169 | /* 132 */ { MAD_F(0x054031a0) /* 0.328172327 */, 11 }, | 169 | /* 132 */ { MAD_F(0x054031a0) /* 0.328172327 */, 11 }, |
170 | /* 133 */ { MAD_F(0x054dc9e7) /* 0.331491377 */, 11 }, | 170 | /* 133 */ { MAD_F(0x054dc9e7) /* 0.331491377 */, 11 }, |
171 | /* 134 */ { MAD_F(0x055b6ae9) /* 0.334818756 */, 11 }, | 171 | /* 134 */ { MAD_F(0x055b6ae9) /* 0.334818756 */, 11 }, |
172 | /* 135 */ { MAD_F(0x0569149c) /* 0.338154423 */, 11 }, | 172 | /* 135 */ { MAD_F(0x0569149c) /* 0.338154423 */, 11 }, |
173 | /* 136 */ { MAD_F(0x0576c6f5) /* 0.341498336 */, 11 }, | 173 | /* 136 */ { MAD_F(0x0576c6f5) /* 0.341498336 */, 11 }, |
174 | /* 137 */ { MAD_F(0x058481e9) /* 0.344850455 */, 11 }, | 174 | /* 137 */ { MAD_F(0x058481e9) /* 0.344850455 */, 11 }, |
175 | /* 138 */ { MAD_F(0x0592456d) /* 0.348210741 */, 11 }, | 175 | /* 138 */ { MAD_F(0x0592456d) /* 0.348210741 */, 11 }, |
176 | /* 139 */ { MAD_F(0x05a01176) /* 0.351579152 */, 11 }, | 176 | /* 139 */ { MAD_F(0x05a01176) /* 0.351579152 */, 11 }, |
177 | /* 140 */ { MAD_F(0x05ade5fa) /* 0.354955651 */, 11 }, | 177 | /* 140 */ { MAD_F(0x05ade5fa) /* 0.354955651 */, 11 }, |
178 | /* 141 */ { MAD_F(0x05bbc2ef) /* 0.358340200 */, 11 }, | 178 | /* 141 */ { MAD_F(0x05bbc2ef) /* 0.358340200 */, 11 }, |
179 | /* 142 */ { MAD_F(0x05c9a84a) /* 0.361732758 */, 11 }, | 179 | /* 142 */ { MAD_F(0x05c9a84a) /* 0.361732758 */, 11 }, |
180 | /* 143 */ { MAD_F(0x05d79601) /* 0.365133291 */, 11 }, | 180 | /* 143 */ { MAD_F(0x05d79601) /* 0.365133291 */, 11 }, |
181 | 181 | ||
182 | /* 144 */ { MAD_F(0x05e58c0b) /* 0.368541759 */, 11 }, | 182 | /* 144 */ { MAD_F(0x05e58c0b) /* 0.368541759 */, 11 }, |
183 | /* 145 */ { MAD_F(0x05f38a5d) /* 0.371958126 */, 11 }, | 183 | /* 145 */ { MAD_F(0x05f38a5d) /* 0.371958126 */, 11 }, |
184 | /* 146 */ { MAD_F(0x060190ee) /* 0.375382356 */, 11 }, | 184 | /* 146 */ { MAD_F(0x060190ee) /* 0.375382356 */, 11 }, |
185 | /* 147 */ { MAD_F(0x060f9fb3) /* 0.378814413 */, 11 }, | 185 | /* 147 */ { MAD_F(0x060f9fb3) /* 0.378814413 */, 11 }, |
186 | /* 148 */ { MAD_F(0x061db6a5) /* 0.382254261 */, 11 }, | 186 | /* 148 */ { MAD_F(0x061db6a5) /* 0.382254261 */, 11 }, |
187 | /* 149 */ { MAD_F(0x062bd5b8) /* 0.385701865 */, 11 }, | 187 | /* 149 */ { MAD_F(0x062bd5b8) /* 0.385701865 */, 11 }, |
188 | /* 150 */ { MAD_F(0x0639fce4) /* 0.389157191 */, 11 }, | 188 | /* 150 */ { MAD_F(0x0639fce4) /* 0.389157191 */, 11 }, |
189 | /* 151 */ { MAD_F(0x06482c1f) /* 0.392620204 */, 11 }, | 189 | /* 151 */ { MAD_F(0x06482c1f) /* 0.392620204 */, 11 }, |
190 | /* 152 */ { MAD_F(0x06566361) /* 0.396090870 */, 11 }, | 190 | /* 152 */ { MAD_F(0x06566361) /* 0.396090870 */, 11 }, |
191 | /* 153 */ { MAD_F(0x0664a2a0) /* 0.399569155 */, 11 }, | 191 | /* 153 */ { MAD_F(0x0664a2a0) /* 0.399569155 */, 11 }, |
192 | /* 154 */ { MAD_F(0x0672e9d4) /* 0.403055027 */, 11 }, | 192 | /* 154 */ { MAD_F(0x0672e9d4) /* 0.403055027 */, 11 }, |
193 | /* 155 */ { MAD_F(0x068138f3) /* 0.406548452 */, 11 }, | 193 | /* 155 */ { MAD_F(0x068138f3) /* 0.406548452 */, 11 }, |
194 | /* 156 */ { MAD_F(0x068f8ff5) /* 0.410049398 */, 11 }, | 194 | /* 156 */ { MAD_F(0x068f8ff5) /* 0.410049398 */, 11 }, |
195 | /* 157 */ { MAD_F(0x069deed1) /* 0.413557833 */, 11 }, | 195 | /* 157 */ { MAD_F(0x069deed1) /* 0.413557833 */, 11 }, |
196 | /* 158 */ { MAD_F(0x06ac557f) /* 0.417073724 */, 11 }, | 196 | /* 158 */ { MAD_F(0x06ac557f) /* 0.417073724 */, 11 }, |
197 | /* 159 */ { MAD_F(0x06bac3f6) /* 0.420597041 */, 11 }, | 197 | /* 159 */ { MAD_F(0x06bac3f6) /* 0.420597041 */, 11 }, |
198 | 198 | ||
199 | /* 160 */ { MAD_F(0x06c93a2e) /* 0.424127753 */, 11 }, | 199 | /* 160 */ { MAD_F(0x06c93a2e) /* 0.424127753 */, 11 }, |
200 | /* 161 */ { MAD_F(0x06d7b81f) /* 0.427665827 */, 11 }, | 200 | /* 161 */ { MAD_F(0x06d7b81f) /* 0.427665827 */, 11 }, |
201 | /* 162 */ { MAD_F(0x06e63dc0) /* 0.431211234 */, 11 }, | 201 | /* 162 */ { MAD_F(0x06e63dc0) /* 0.431211234 */, 11 }, |
202 | /* 163 */ { MAD_F(0x06f4cb09) /* 0.434763944 */, 11 }, | 202 | /* 163 */ { MAD_F(0x06f4cb09) /* 0.434763944 */, 11 }, |
203 | /* 164 */ { MAD_F(0x07035ff3) /* 0.438323927 */, 11 }, | 203 | /* 164 */ { MAD_F(0x07035ff3) /* 0.438323927 */, 11 }, |
204 | /* 165 */ { MAD_F(0x0711fc75) /* 0.441891153 */, 11 }, | 204 | /* 165 */ { MAD_F(0x0711fc75) /* 0.441891153 */, 11 }, |
205 | /* 166 */ { MAD_F(0x0720a087) /* 0.445465593 */, 11 }, | 205 | /* 166 */ { MAD_F(0x0720a087) /* 0.445465593 */, 11 }, |
206 | /* 167 */ { MAD_F(0x072f4c22) /* 0.449047217 */, 11 }, | 206 | /* 167 */ { MAD_F(0x072f4c22) /* 0.449047217 */, 11 }, |
207 | /* 168 */ { MAD_F(0x073dff3e) /* 0.452635998 */, 11 }, | 207 | /* 168 */ { MAD_F(0x073dff3e) /* 0.452635998 */, 11 }, |
208 | /* 169 */ { MAD_F(0x074cb9d3) /* 0.456231906 */, 11 }, | 208 | /* 169 */ { MAD_F(0x074cb9d3) /* 0.456231906 */, 11 }, |
209 | /* 170 */ { MAD_F(0x075b7bdb) /* 0.459834914 */, 11 }, | 209 | /* 170 */ { MAD_F(0x075b7bdb) /* 0.459834914 */, 11 }, |
210 | /* 171 */ { MAD_F(0x076a454c) /* 0.463444993 */, 11 }, | 210 | /* 171 */ { MAD_F(0x076a454c) /* 0.463444993 */, 11 }, |
211 | /* 172 */ { MAD_F(0x07791620) /* 0.467062117 */, 11 }, | 211 | /* 172 */ { MAD_F(0x07791620) /* 0.467062117 */, 11 }, |
212 | /* 173 */ { MAD_F(0x0787ee50) /* 0.470686258 */, 11 }, | 212 | /* 173 */ { MAD_F(0x0787ee50) /* 0.470686258 */, 11 }, |
213 | /* 174 */ { MAD_F(0x0796cdd4) /* 0.474317388 */, 11 }, | 213 | /* 174 */ { MAD_F(0x0796cdd4) /* 0.474317388 */, 11 }, |
214 | /* 175 */ { MAD_F(0x07a5b4a5) /* 0.477955481 */, 11 }, | 214 | /* 175 */ { MAD_F(0x07a5b4a5) /* 0.477955481 */, 11 }, |
215 | 215 | ||
216 | /* 176 */ { MAD_F(0x07b4a2bc) /* 0.481600510 */, 11 }, | 216 | /* 176 */ { MAD_F(0x07b4a2bc) /* 0.481600510 */, 11 }, |
217 | /* 177 */ { MAD_F(0x07c39812) /* 0.485252449 */, 11 }, | 217 | /* 177 */ { MAD_F(0x07c39812) /* 0.485252449 */, 11 }, |
218 | /* 178 */ { MAD_F(0x07d294a0) /* 0.488911273 */, 11 }, | 218 | /* 178 */ { MAD_F(0x07d294a0) /* 0.488911273 */, 11 }, |
219 | /* 179 */ { MAD_F(0x07e1985f) /* 0.492576954 */, 11 }, | 219 | /* 179 */ { MAD_F(0x07e1985f) /* 0.492576954 */, 11 }, |
220 | /* 180 */ { MAD_F(0x07f0a348) /* 0.496249468 */, 11 }, | 220 | /* 180 */ { MAD_F(0x07f0a348) /* 0.496249468 */, 11 }, |
221 | /* 181 */ { MAD_F(0x07ffb554) /* 0.499928790 */, 11 }, | 221 | /* 181 */ { MAD_F(0x07ffb554) /* 0.499928790 */, 11 }, |
222 | /* 182 */ { MAD_F(0x0407673f) /* 0.251807447 */, 12 }, | 222 | /* 182 */ { MAD_F(0x0407673f) /* 0.251807447 */, 12 }, |
223 | /* 183 */ { MAD_F(0x040ef75e) /* 0.253653877 */, 12 }, | 223 | /* 183 */ { MAD_F(0x040ef75e) /* 0.253653877 */, 12 }, |
224 | /* 184 */ { MAD_F(0x04168b05) /* 0.255503674 */, 12 }, | 224 | /* 184 */ { MAD_F(0x04168b05) /* 0.255503674 */, 12 }, |
225 | /* 185 */ { MAD_F(0x041e2230) /* 0.257356825 */, 12 }, | 225 | /* 185 */ { MAD_F(0x041e2230) /* 0.257356825 */, 12 }, |
226 | /* 186 */ { MAD_F(0x0425bcdd) /* 0.259213318 */, 12 }, | 226 | /* 186 */ { MAD_F(0x0425bcdd) /* 0.259213318 */, 12 }, |
227 | /* 187 */ { MAD_F(0x042d5b07) /* 0.261073141 */, 12 }, | 227 | /* 187 */ { MAD_F(0x042d5b07) /* 0.261073141 */, 12 }, |
228 | /* 188 */ { MAD_F(0x0434fcad) /* 0.262936282 */, 12 }, | 228 | /* 188 */ { MAD_F(0x0434fcad) /* 0.262936282 */, 12 }, |
229 | /* 189 */ { MAD_F(0x043ca1c9) /* 0.264802730 */, 12 }, | 229 | /* 189 */ { MAD_F(0x043ca1c9) /* 0.264802730 */, 12 }, |
230 | /* 190 */ { MAD_F(0x04444a5a) /* 0.266672472 */, 12 }, | 230 | /* 190 */ { MAD_F(0x04444a5a) /* 0.266672472 */, 12 }, |
231 | /* 191 */ { MAD_F(0x044bf65d) /* 0.268545497 */, 12 }, | 231 | /* 191 */ { MAD_F(0x044bf65d) /* 0.268545497 */, 12 }, |
232 | 232 | ||
233 | /* 192 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 12 }, | 233 | /* 192 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 12 }, |
234 | /* 193 */ { MAD_F(0x045b58a9) /* 0.272301352 */, 12 }, | 234 | /* 193 */ { MAD_F(0x045b58a9) /* 0.272301352 */, 12 }, |
235 | /* 194 */ { MAD_F(0x04630eed) /* 0.274184158 */, 12 }, | 235 | /* 194 */ { MAD_F(0x04630eed) /* 0.274184158 */, 12 }, |
236 | /* 195 */ { MAD_F(0x046ac896) /* 0.276070203 */, 12 }, | 236 | /* 195 */ { MAD_F(0x046ac896) /* 0.276070203 */, 12 }, |
237 | /* 196 */ { MAD_F(0x047285a2) /* 0.277959474 */, 12 }, | 237 | /* 196 */ { MAD_F(0x047285a2) /* 0.277959474 */, 12 }, |
238 | /* 197 */ { MAD_F(0x047a460c) /* 0.279851960 */, 12 }, | 238 | /* 197 */ { MAD_F(0x047a460c) /* 0.279851960 */, 12 }, |
239 | /* 198 */ { MAD_F(0x048209d3) /* 0.281747652 */, 12 }, | 239 | /* 198 */ { MAD_F(0x048209d3) /* 0.281747652 */, 12 }, |
240 | /* 199 */ { MAD_F(0x0489d0f4) /* 0.283646538 */, 12 }, | 240 | /* 199 */ { MAD_F(0x0489d0f4) /* 0.283646538 */, 12 }, |
241 | /* 200 */ { MAD_F(0x04919b6a) /* 0.285548607 */, 12 }, | 241 | /* 200 */ { MAD_F(0x04919b6a) /* 0.285548607 */, 12 }, |
242 | /* 201 */ { MAD_F(0x04996935) /* 0.287453849 */, 12 }, | 242 | /* 201 */ { MAD_F(0x04996935) /* 0.287453849 */, 12 }, |
243 | /* 202 */ { MAD_F(0x04a13a50) /* 0.289362253 */, 12 }, | 243 | /* 202 */ { MAD_F(0x04a13a50) /* 0.289362253 */, 12 }, |
244 | /* 203 */ { MAD_F(0x04a90eba) /* 0.291273810 */, 12 }, | 244 | /* 203 */ { MAD_F(0x04a90eba) /* 0.291273810 */, 12 }, |
245 | /* 204 */ { MAD_F(0x04b0e66e) /* 0.293188507 */, 12 }, | 245 | /* 204 */ { MAD_F(0x04b0e66e) /* 0.293188507 */, 12 }, |
246 | /* 205 */ { MAD_F(0x04b8c16c) /* 0.295106336 */, 12 }, | 246 | /* 205 */ { MAD_F(0x04b8c16c) /* 0.295106336 */, 12 }, |
247 | /* 206 */ { MAD_F(0x04c09faf) /* 0.297027285 */, 12 }, | 247 | /* 206 */ { MAD_F(0x04c09faf) /* 0.297027285 */, 12 }, |
248 | /* 207 */ { MAD_F(0x04c88135) /* 0.298951346 */, 12 }, | 248 | /* 207 */ { MAD_F(0x04c88135) /* 0.298951346 */, 12 }, |
249 | 249 | ||
250 | /* 208 */ { MAD_F(0x04d065fb) /* 0.300878507 */, 12 }, | 250 | /* 208 */ { MAD_F(0x04d065fb) /* 0.300878507 */, 12 }, |
251 | /* 209 */ { MAD_F(0x04d84dff) /* 0.302808759 */, 12 }, | 251 | /* 209 */ { MAD_F(0x04d84dff) /* 0.302808759 */, 12 }, |
252 | /* 210 */ { MAD_F(0x04e0393e) /* 0.304742092 */, 12 }, | 252 | /* 210 */ { MAD_F(0x04e0393e) /* 0.304742092 */, 12 }, |
253 | /* 211 */ { MAD_F(0x04e827b6) /* 0.306678497 */, 12 }, | 253 | /* 211 */ { MAD_F(0x04e827b6) /* 0.306678497 */, 12 }, |
254 | /* 212 */ { MAD_F(0x04f01963) /* 0.308617963 */, 12 }, | 254 | /* 212 */ { MAD_F(0x04f01963) /* 0.308617963 */, 12 }, |
255 | /* 213 */ { MAD_F(0x04f80e44) /* 0.310560480 */, 12 }, | 255 | /* 213 */ { MAD_F(0x04f80e44) /* 0.310560480 */, 12 }, |
256 | /* 214 */ { MAD_F(0x05000655) /* 0.312506041 */, 12 }, | 256 | /* 214 */ { MAD_F(0x05000655) /* 0.312506041 */, 12 }, |
257 | /* 215 */ { MAD_F(0x05080195) /* 0.314454634 */, 12 }, | 257 | /* 215 */ { MAD_F(0x05080195) /* 0.314454634 */, 12 }, |
258 | /* 216 */ { MAD_F(0x05100000) /* 0.316406250 */, 12 }, | 258 | /* 216 */ { MAD_F(0x05100000) /* 0.316406250 */, 12 }, |
259 | /* 217 */ { MAD_F(0x05180194) /* 0.318360880 */, 12 }, | 259 | /* 217 */ { MAD_F(0x05180194) /* 0.318360880 */, 12 }, |
260 | /* 218 */ { MAD_F(0x0520064f) /* 0.320318516 */, 12 }, | 260 | /* 218 */ { MAD_F(0x0520064f) /* 0.320318516 */, 12 }, |
261 | /* 219 */ { MAD_F(0x05280e2d) /* 0.322279147 */, 12 }, | 261 | /* 219 */ { MAD_F(0x05280e2d) /* 0.322279147 */, 12 }, |
262 | /* 220 */ { MAD_F(0x0530192e) /* 0.324242764 */, 12 }, | 262 | /* 220 */ { MAD_F(0x0530192e) /* 0.324242764 */, 12 }, |
263 | /* 221 */ { MAD_F(0x0538274e) /* 0.326209359 */, 12 }, | 263 | /* 221 */ { MAD_F(0x0538274e) /* 0.326209359 */, 12 }, |
264 | /* 222 */ { MAD_F(0x0540388a) /* 0.328178922 */, 12 }, | 264 | /* 222 */ { MAD_F(0x0540388a) /* 0.328178922 */, 12 }, |
265 | /* 223 */ { MAD_F(0x05484ce2) /* 0.330151445 */, 12 }, | 265 | /* 223 */ { MAD_F(0x05484ce2) /* 0.330151445 */, 12 }, |
266 | 266 | ||
267 | /* 224 */ { MAD_F(0x05506451) /* 0.332126919 */, 12 }, | 267 | /* 224 */ { MAD_F(0x05506451) /* 0.332126919 */, 12 }, |
268 | /* 225 */ { MAD_F(0x05587ed5) /* 0.334105334 */, 12 }, | 268 | /* 225 */ { MAD_F(0x05587ed5) /* 0.334105334 */, 12 }, |
269 | /* 226 */ { MAD_F(0x05609c6e) /* 0.336086683 */, 12 }, | 269 | /* 226 */ { MAD_F(0x05609c6e) /* 0.336086683 */, 12 }, |
270 | /* 227 */ { MAD_F(0x0568bd17) /* 0.338070956 */, 12 }, | 270 | /* 227 */ { MAD_F(0x0568bd17) /* 0.338070956 */, 12 }, |
271 | /* 228 */ { MAD_F(0x0570e0cf) /* 0.340058145 */, 12 }, | 271 | /* 228 */ { MAD_F(0x0570e0cf) /* 0.340058145 */, 12 }, |
272 | /* 229 */ { MAD_F(0x05790793) /* 0.342048241 */, 12 }, | 272 | /* 229 */ { MAD_F(0x05790793) /* 0.342048241 */, 12 }, |
273 | /* 230 */ { MAD_F(0x05813162) /* 0.344041237 */, 12 }, | 273 | /* 230 */ { MAD_F(0x05813162) /* 0.344041237 */, 12 }, |
274 | /* 231 */ { MAD_F(0x05895e39) /* 0.346037122 */, 12 }, | 274 | /* 231 */ { MAD_F(0x05895e39) /* 0.346037122 */, 12 }, |
275 | /* 232 */ { MAD_F(0x05918e15) /* 0.348035890 */, 12 }, | 275 | /* 232 */ { MAD_F(0x05918e15) /* 0.348035890 */, 12 }, |
276 | /* 233 */ { MAD_F(0x0599c0f4) /* 0.350037532 */, 12 }, | 276 | /* 233 */ { MAD_F(0x0599c0f4) /* 0.350037532 */, 12 }, |
277 | /* 234 */ { MAD_F(0x05a1f6d5) /* 0.352042040 */, 12 }, | 277 | /* 234 */ { MAD_F(0x05a1f6d5) /* 0.352042040 */, 12 }, |
278 | /* 235 */ { MAD_F(0x05aa2fb5) /* 0.354049405 */, 12 }, | 278 | /* 235 */ { MAD_F(0x05aa2fb5) /* 0.354049405 */, 12 }, |
279 | /* 236 */ { MAD_F(0x05b26b92) /* 0.356059619 */, 12 }, | 279 | /* 236 */ { MAD_F(0x05b26b92) /* 0.356059619 */, 12 }, |
280 | /* 237 */ { MAD_F(0x05baaa69) /* 0.358072674 */, 12 }, | 280 | /* 237 */ { MAD_F(0x05baaa69) /* 0.358072674 */, 12 }, |
281 | /* 238 */ { MAD_F(0x05c2ec39) /* 0.360088563 */, 12 }, | 281 | /* 238 */ { MAD_F(0x05c2ec39) /* 0.360088563 */, 12 }, |
282 | /* 239 */ { MAD_F(0x05cb3100) /* 0.362107278 */, 12 }, | 282 | /* 239 */ { MAD_F(0x05cb3100) /* 0.362107278 */, 12 }, |
283 | 283 | ||
284 | /* 240 */ { MAD_F(0x05d378bb) /* 0.364128809 */, 12 }, | 284 | /* 240 */ { MAD_F(0x05d378bb) /* 0.364128809 */, 12 }, |
285 | /* 241 */ { MAD_F(0x05dbc368) /* 0.366153151 */, 12 }, | 285 | /* 241 */ { MAD_F(0x05dbc368) /* 0.366153151 */, 12 }, |
286 | /* 242 */ { MAD_F(0x05e41105) /* 0.368180294 */, 12 }, | 286 | /* 242 */ { MAD_F(0x05e41105) /* 0.368180294 */, 12 }, |
287 | /* 243 */ { MAD_F(0x05ec6190) /* 0.370210231 */, 12 }, | 287 | /* 243 */ { MAD_F(0x05ec6190) /* 0.370210231 */, 12 }, |
288 | /* 244 */ { MAD_F(0x05f4b507) /* 0.372242955 */, 12 }, | 288 | /* 244 */ { MAD_F(0x05f4b507) /* 0.372242955 */, 12 }, |
289 | /* 245 */ { MAD_F(0x05fd0b68) /* 0.374278458 */, 12 }, | 289 | /* 245 */ { MAD_F(0x05fd0b68) /* 0.374278458 */, 12 }, |
290 | /* 246 */ { MAD_F(0x060564b1) /* 0.376316732 */, 12 }, | 290 | /* 246 */ { MAD_F(0x060564b1) /* 0.376316732 */, 12 }, |
291 | /* 247 */ { MAD_F(0x060dc0e0) /* 0.378357769 */, 12 }, | 291 | /* 247 */ { MAD_F(0x060dc0e0) /* 0.378357769 */, 12 }, |
292 | /* 248 */ { MAD_F(0x06161ff3) /* 0.380401563 */, 12 }, | 292 | /* 248 */ { MAD_F(0x06161ff3) /* 0.380401563 */, 12 }, |
293 | /* 249 */ { MAD_F(0x061e81e8) /* 0.382448106 */, 12 }, | 293 | /* 249 */ { MAD_F(0x061e81e8) /* 0.382448106 */, 12 }, |
294 | /* 250 */ { MAD_F(0x0626e6bc) /* 0.384497391 */, 12 }, | 294 | /* 250 */ { MAD_F(0x0626e6bc) /* 0.384497391 */, 12 }, |
295 | /* 251 */ { MAD_F(0x062f4e6f) /* 0.386549409 */, 12 }, | 295 | /* 251 */ { MAD_F(0x062f4e6f) /* 0.386549409 */, 12 }, |
296 | /* 252 */ { MAD_F(0x0637b8fd) /* 0.388604155 */, 12 }, | 296 | /* 252 */ { MAD_F(0x0637b8fd) /* 0.388604155 */, 12 }, |
297 | /* 253 */ { MAD_F(0x06402666) /* 0.390661620 */, 12 }, | 297 | /* 253 */ { MAD_F(0x06402666) /* 0.390661620 */, 12 }, |
298 | /* 254 */ { MAD_F(0x064896a7) /* 0.392721798 */, 12 }, | 298 | /* 254 */ { MAD_F(0x064896a7) /* 0.392721798 */, 12 }, |
299 | /* 255 */ { MAD_F(0x065109be) /* 0.394784681 */, 12 }, | 299 | /* 255 */ { MAD_F(0x065109be) /* 0.394784681 */, 12 }, |
300 | 300 | ||
301 | /* 256 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 12 }, | 301 | /* 256 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 12 }, |
302 | /* 257 */ { MAD_F(0x0661f867) /* 0.398918536 */, 12 }, | 302 | /* 257 */ { MAD_F(0x0661f867) /* 0.398918536 */, 12 }, |
303 | /* 258 */ { MAD_F(0x066a73f5) /* 0.400989493 */, 12 }, | 303 | /* 258 */ { MAD_F(0x066a73f5) /* 0.400989493 */, 12 }, |
304 | /* 259 */ { MAD_F(0x0672f252) /* 0.403063128 */, 12 }, | 304 | /* 259 */ { MAD_F(0x0672f252) /* 0.403063128 */, 12 }, |
305 | /* 260 */ { MAD_F(0x067b737c) /* 0.405139433 */, 12 }, | 305 | /* 260 */ { MAD_F(0x067b737c) /* 0.405139433 */, 12 }, |
306 | /* 261 */ { MAD_F(0x0683f771) /* 0.407218402 */, 12 }, | 306 | /* 261 */ { MAD_F(0x0683f771) /* 0.407218402 */, 12 }, |
307 | /* 262 */ { MAD_F(0x068c7e2f) /* 0.409300027 */, 12 }, | 307 | /* 262 */ { MAD_F(0x068c7e2f) /* 0.409300027 */, 12 }, |
308 | /* 263 */ { MAD_F(0x069507b5) /* 0.411384303 */, 12 }, | 308 | /* 263 */ { MAD_F(0x069507b5) /* 0.411384303 */, 12 }, |
309 | /* 264 */ { MAD_F(0x069d9400) /* 0.413471222 */, 12 }, | 309 | /* 264 */ { MAD_F(0x069d9400) /* 0.413471222 */, 12 }, |
310 | /* 265 */ { MAD_F(0x06a6230f) /* 0.415560778 */, 12 }, | 310 | /* 265 */ { MAD_F(0x06a6230f) /* 0.415560778 */, 12 }, |
311 | /* 266 */ { MAD_F(0x06aeb4e0) /* 0.417652964 */, 12 }, | 311 | /* 266 */ { MAD_F(0x06aeb4e0) /* 0.417652964 */, 12 }, |
312 | /* 267 */ { MAD_F(0x06b74971) /* 0.419747773 */, 12 }, | 312 | /* 267 */ { MAD_F(0x06b74971) /* 0.419747773 */, 12 }, |
313 | /* 268 */ { MAD_F(0x06bfe0c0) /* 0.421845199 */, 12 }, | 313 | /* 268 */ { MAD_F(0x06bfe0c0) /* 0.421845199 */, 12 }, |
314 | /* 269 */ { MAD_F(0x06c87acc) /* 0.423945235 */, 12 }, | 314 | /* 269 */ { MAD_F(0x06c87acc) /* 0.423945235 */, 12 }, |
315 | /* 270 */ { MAD_F(0x06d11794) /* 0.426047876 */, 12 }, | 315 | /* 270 */ { MAD_F(0x06d11794) /* 0.426047876 */, 12 }, |
316 | /* 271 */ { MAD_F(0x06d9b714) /* 0.428153114 */, 12 }, | 316 | /* 271 */ { MAD_F(0x06d9b714) /* 0.428153114 */, 12 }, |
317 | 317 | ||
318 | /* 272 */ { MAD_F(0x06e2594c) /* 0.430260942 */, 12 }, | 318 | /* 272 */ { MAD_F(0x06e2594c) /* 0.430260942 */, 12 }, |
319 | /* 273 */ { MAD_F(0x06eafe3a) /* 0.432371356 */, 12 }, | 319 | /* 273 */ { MAD_F(0x06eafe3a) /* 0.432371356 */, 12 }, |
320 | /* 274 */ { MAD_F(0x06f3a5dc) /* 0.434484348 */, 12 }, | 320 | /* 274 */ { MAD_F(0x06f3a5dc) /* 0.434484348 */, 12 }, |
321 | /* 275 */ { MAD_F(0x06fc5030) /* 0.436599912 */, 12 }, | 321 | /* 275 */ { MAD_F(0x06fc5030) /* 0.436599912 */, 12 }, |
322 | /* 276 */ { MAD_F(0x0704fd35) /* 0.438718042 */, 12 }, | 322 | /* 276 */ { MAD_F(0x0704fd35) /* 0.438718042 */, 12 }, |
323 | /* 277 */ { MAD_F(0x070dacea) /* 0.440838732 */, 12 }, | 323 | /* 277 */ { MAD_F(0x070dacea) /* 0.440838732 */, 12 }, |
324 | /* 278 */ { MAD_F(0x07165f4b) /* 0.442961975 */, 12 }, | 324 | /* 278 */ { MAD_F(0x07165f4b) /* 0.442961975 */, 12 }, |
325 | /* 279 */ { MAD_F(0x071f1459) /* 0.445087765 */, 12 }, | 325 | /* 279 */ { MAD_F(0x071f1459) /* 0.445087765 */, 12 }, |
326 | /* 280 */ { MAD_F(0x0727cc11) /* 0.447216097 */, 12 }, | 326 | /* 280 */ { MAD_F(0x0727cc11) /* 0.447216097 */, 12 }, |
327 | /* 281 */ { MAD_F(0x07308671) /* 0.449346964 */, 12 }, | 327 | /* 281 */ { MAD_F(0x07308671) /* 0.449346964 */, 12 }, |
328 | /* 282 */ { MAD_F(0x07394378) /* 0.451480360 */, 12 }, | 328 | /* 282 */ { MAD_F(0x07394378) /* 0.451480360 */, 12 }, |
329 | /* 283 */ { MAD_F(0x07420325) /* 0.453616280 */, 12 }, | 329 | /* 283 */ { MAD_F(0x07420325) /* 0.453616280 */, 12 }, |
330 | /* 284 */ { MAD_F(0x074ac575) /* 0.455754717 */, 12 }, | 330 | /* 284 */ { MAD_F(0x074ac575) /* 0.455754717 */, 12 }, |
331 | /* 285 */ { MAD_F(0x07538a67) /* 0.457895665 */, 12 }, | 331 | /* 285 */ { MAD_F(0x07538a67) /* 0.457895665 */, 12 }, |
332 | /* 286 */ { MAD_F(0x075c51fa) /* 0.460039119 */, 12 }, | 332 | /* 286 */ { MAD_F(0x075c51fa) /* 0.460039119 */, 12 }, |
333 | /* 287 */ { MAD_F(0x07651c2c) /* 0.462185072 */, 12 }, | 333 | /* 287 */ { MAD_F(0x07651c2c) /* 0.462185072 */, 12 }, |
334 | 334 | ||
335 | /* 288 */ { MAD_F(0x076de8fc) /* 0.464333519 */, 12 }, | 335 | /* 288 */ { MAD_F(0x076de8fc) /* 0.464333519 */, 12 }, |
336 | /* 289 */ { MAD_F(0x0776b867) /* 0.466484455 */, 12 }, | 336 | /* 289 */ { MAD_F(0x0776b867) /* 0.466484455 */, 12 }, |
337 | /* 290 */ { MAD_F(0x077f8a6d) /* 0.468637872 */, 12 }, | 337 | /* 290 */ { MAD_F(0x077f8a6d) /* 0.468637872 */, 12 }, |
338 | /* 291 */ { MAD_F(0x07885f0b) /* 0.470793767 */, 12 }, | 338 | /* 291 */ { MAD_F(0x07885f0b) /* 0.470793767 */, 12 }, |
339 | /* 292 */ { MAD_F(0x07913641) /* 0.472952132 */, 12 }, | 339 | /* 292 */ { MAD_F(0x07913641) /* 0.472952132 */, 12 }, |
340 | /* 293 */ { MAD_F(0x079a100c) /* 0.475112962 */, 12 }, | 340 | /* 293 */ { MAD_F(0x079a100c) /* 0.475112962 */, 12 }, |
341 | /* 294 */ { MAD_F(0x07a2ec6c) /* 0.477276252 */, 12 }, | 341 | /* 294 */ { MAD_F(0x07a2ec6c) /* 0.477276252 */, 12 }, |
342 | /* 295 */ { MAD_F(0x07abcb5f) /* 0.479441997 */, 12 }, | 342 | /* 295 */ { MAD_F(0x07abcb5f) /* 0.479441997 */, 12 }, |
343 | /* 296 */ { MAD_F(0x07b4ace3) /* 0.481610189 */, 12 }, | 343 | /* 296 */ { MAD_F(0x07b4ace3) /* 0.481610189 */, 12 }, |
344 | /* 297 */ { MAD_F(0x07bd90f6) /* 0.483780825 */, 12 }, | 344 | /* 297 */ { MAD_F(0x07bd90f6) /* 0.483780825 */, 12 }, |
345 | /* 298 */ { MAD_F(0x07c67798) /* 0.485953899 */, 12 }, | 345 | /* 298 */ { MAD_F(0x07c67798) /* 0.485953899 */, 12 }, |
346 | /* 299 */ { MAD_F(0x07cf60c7) /* 0.488129404 */, 12 }, | 346 | /* 299 */ { MAD_F(0x07cf60c7) /* 0.488129404 */, 12 }, |
347 | /* 300 */ { MAD_F(0x07d84c81) /* 0.490307336 */, 12 }, | 347 | /* 300 */ { MAD_F(0x07d84c81) /* 0.490307336 */, 12 }, |
348 | /* 301 */ { MAD_F(0x07e13ac5) /* 0.492487690 */, 12 }, | 348 | /* 301 */ { MAD_F(0x07e13ac5) /* 0.492487690 */, 12 }, |
349 | /* 302 */ { MAD_F(0x07ea2b92) /* 0.494670459 */, 12 }, | 349 | /* 302 */ { MAD_F(0x07ea2b92) /* 0.494670459 */, 12 }, |
350 | /* 303 */ { MAD_F(0x07f31ee6) /* 0.496855639 */, 12 }, | 350 | /* 303 */ { MAD_F(0x07f31ee6) /* 0.496855639 */, 12 }, |
351 | 351 | ||
352 | /* 304 */ { MAD_F(0x07fc14bf) /* 0.499043224 */, 12 }, | 352 | /* 304 */ { MAD_F(0x07fc14bf) /* 0.499043224 */, 12 }, |
353 | /* 305 */ { MAD_F(0x0402868e) /* 0.250616605 */, 13 }, | 353 | /* 305 */ { MAD_F(0x0402868e) /* 0.250616605 */, 13 }, |
354 | /* 306 */ { MAD_F(0x040703ff) /* 0.251712795 */, 13 }, | 354 | /* 306 */ { MAD_F(0x040703ff) /* 0.251712795 */, 13 }, |
355 | /* 307 */ { MAD_F(0x040b82b0) /* 0.252810180 */, 13 }, | 355 | /* 307 */ { MAD_F(0x040b82b0) /* 0.252810180 */, 13 }, |
356 | /* 308 */ { MAD_F(0x041002a1) /* 0.253908756 */, 13 }, | 356 | /* 308 */ { MAD_F(0x041002a1) /* 0.253908756 */, 13 }, |
357 | /* 309 */ { MAD_F(0x041483d1) /* 0.255008523 */, 13 }, | 357 | /* 309 */ { MAD_F(0x041483d1) /* 0.255008523 */, 13 }, |
358 | /* 310 */ { MAD_F(0x04190640) /* 0.256109476 */, 13 }, | 358 | /* 310 */ { MAD_F(0x04190640) /* 0.256109476 */, 13 }, |
359 | /* 311 */ { MAD_F(0x041d89ed) /* 0.257211614 */, 13 }, | 359 | /* 311 */ { MAD_F(0x041d89ed) /* 0.257211614 */, 13 }, |
360 | /* 312 */ { MAD_F(0x04220ed7) /* 0.258314934 */, 13 }, | 360 | /* 312 */ { MAD_F(0x04220ed7) /* 0.258314934 */, 13 }, |
361 | /* 313 */ { MAD_F(0x042694fe) /* 0.259419433 */, 13 }, | 361 | /* 313 */ { MAD_F(0x042694fe) /* 0.259419433 */, 13 }, |
362 | /* 314 */ { MAD_F(0x042b1c60) /* 0.260525110 */, 13 }, | 362 | /* 314 */ { MAD_F(0x042b1c60) /* 0.260525110 */, 13 }, |
363 | /* 315 */ { MAD_F(0x042fa4fe) /* 0.261631960 */, 13 }, | 363 | /* 315 */ { MAD_F(0x042fa4fe) /* 0.261631960 */, 13 }, |
364 | /* 316 */ { MAD_F(0x04342ed7) /* 0.262739982 */, 13 }, | 364 | /* 316 */ { MAD_F(0x04342ed7) /* 0.262739982 */, 13 }, |
365 | /* 317 */ { MAD_F(0x0438b9e9) /* 0.263849174 */, 13 }, | 365 | /* 317 */ { MAD_F(0x0438b9e9) /* 0.263849174 */, 13 }, |
366 | /* 318 */ { MAD_F(0x043d4635) /* 0.264959533 */, 13 }, | 366 | /* 318 */ { MAD_F(0x043d4635) /* 0.264959533 */, 13 }, |
367 | /* 319 */ { MAD_F(0x0441d3b9) /* 0.266071056 */, 13 }, | 367 | /* 319 */ { MAD_F(0x0441d3b9) /* 0.266071056 */, 13 }, |
368 | 368 | ||
369 | /* 320 */ { MAD_F(0x04466275) /* 0.267183742 */, 13 }, | 369 | /* 320 */ { MAD_F(0x04466275) /* 0.267183742 */, 13 }, |
370 | /* 321 */ { MAD_F(0x044af269) /* 0.268297587 */, 13 }, | 370 | /* 321 */ { MAD_F(0x044af269) /* 0.268297587 */, 13 }, |
371 | /* 322 */ { MAD_F(0x044f8393) /* 0.269412589 */, 13 }, | 371 | /* 322 */ { MAD_F(0x044f8393) /* 0.269412589 */, 13 }, |
372 | /* 323 */ { MAD_F(0x045415f3) /* 0.270528746 */, 13 }, | 372 | /* 323 */ { MAD_F(0x045415f3) /* 0.270528746 */, 13 }, |
373 | /* 324 */ { MAD_F(0x0458a989) /* 0.271646056 */, 13 }, | 373 | /* 324 */ { MAD_F(0x0458a989) /* 0.271646056 */, 13 }, |
374 | /* 325 */ { MAD_F(0x045d3e53) /* 0.272764515 */, 13 }, | 374 | /* 325 */ { MAD_F(0x045d3e53) /* 0.272764515 */, 13 }, |
375 | /* 326 */ { MAD_F(0x0461d451) /* 0.273884123 */, 13 }, | 375 | /* 326 */ { MAD_F(0x0461d451) /* 0.273884123 */, 13 }, |
376 | /* 327 */ { MAD_F(0x04666b83) /* 0.275004875 */, 13 }, | 376 | /* 327 */ { MAD_F(0x04666b83) /* 0.275004875 */, 13 }, |
377 | /* 328 */ { MAD_F(0x046b03e7) /* 0.276126771 */, 13 }, | 377 | /* 328 */ { MAD_F(0x046b03e7) /* 0.276126771 */, 13 }, |
378 | /* 329 */ { MAD_F(0x046f9d7e) /* 0.277249808 */, 13 }, | 378 | /* 329 */ { MAD_F(0x046f9d7e) /* 0.277249808 */, 13 }, |
379 | /* 330 */ { MAD_F(0x04743847) /* 0.278373983 */, 13 }, | 379 | /* 330 */ { MAD_F(0x04743847) /* 0.278373983 */, 13 }, |
380 | /* 331 */ { MAD_F(0x0478d440) /* 0.279499294 */, 13 }, | 380 | /* 331 */ { MAD_F(0x0478d440) /* 0.279499294 */, 13 }, |
381 | /* 332 */ { MAD_F(0x047d716a) /* 0.280625739 */, 13 }, | 381 | /* 332 */ { MAD_F(0x047d716a) /* 0.280625739 */, 13 }, |
382 | /* 333 */ { MAD_F(0x04820fc3) /* 0.281753315 */, 13 }, | 382 | /* 333 */ { MAD_F(0x04820fc3) /* 0.281753315 */, 13 }, |
383 | /* 334 */ { MAD_F(0x0486af4c) /* 0.282882021 */, 13 }, | 383 | /* 334 */ { MAD_F(0x0486af4c) /* 0.282882021 */, 13 }, |
384 | /* 335 */ { MAD_F(0x048b5003) /* 0.284011853 */, 13 }, | 384 | /* 335 */ { MAD_F(0x048b5003) /* 0.284011853 */, 13 }, |
385 | 385 | ||
386 | /* 336 */ { MAD_F(0x048ff1e8) /* 0.285142811 */, 13 }, | 386 | /* 336 */ { MAD_F(0x048ff1e8) /* 0.285142811 */, 13 }, |
387 | /* 337 */ { MAD_F(0x049494fb) /* 0.286274891 */, 13 }, | 387 | /* 337 */ { MAD_F(0x049494fb) /* 0.286274891 */, 13 }, |
388 | /* 338 */ { MAD_F(0x0499393a) /* 0.287408091 */, 13 }, | 388 | /* 338 */ { MAD_F(0x0499393a) /* 0.287408091 */, 13 }, |
389 | /* 339 */ { MAD_F(0x049ddea5) /* 0.288542409 */, 13 }, | 389 | /* 339 */ { MAD_F(0x049ddea5) /* 0.288542409 */, 13 }, |
390 | /* 340 */ { MAD_F(0x04a2853c) /* 0.289677844 */, 13 }, | 390 | /* 340 */ { MAD_F(0x04a2853c) /* 0.289677844 */, 13 }, |
391 | /* 341 */ { MAD_F(0x04a72cfe) /* 0.290814392 */, 13 }, | 391 | /* 341 */ { MAD_F(0x04a72cfe) /* 0.290814392 */, 13 }, |
392 | /* 342 */ { MAD_F(0x04abd5ea) /* 0.291952051 */, 13 }, | 392 | /* 342 */ { MAD_F(0x04abd5ea) /* 0.291952051 */, 13 }, |
393 | /* 343 */ { MAD_F(0x04b08000) /* 0.293090820 */, 13 }, | 393 | /* 343 */ { MAD_F(0x04b08000) /* 0.293090820 */, 13 }, |
394 | /* 344 */ { MAD_F(0x04b52b3f) /* 0.294230696 */, 13 }, | 394 | /* 344 */ { MAD_F(0x04b52b3f) /* 0.294230696 */, 13 }, |
395 | /* 345 */ { MAD_F(0x04b9d7a7) /* 0.295371678 */, 13 }, | 395 | /* 345 */ { MAD_F(0x04b9d7a7) /* 0.295371678 */, 13 }, |
396 | /* 346 */ { MAD_F(0x04be8537) /* 0.296513762 */, 13 }, | 396 | /* 346 */ { MAD_F(0x04be8537) /* 0.296513762 */, 13 }, |
397 | /* 347 */ { MAD_F(0x04c333ee) /* 0.297656947 */, 13 }, | 397 | /* 347 */ { MAD_F(0x04c333ee) /* 0.297656947 */, 13 }, |
398 | /* 348 */ { MAD_F(0x04c7e3cc) /* 0.298801231 */, 13 }, | 398 | /* 348 */ { MAD_F(0x04c7e3cc) /* 0.298801231 */, 13 }, |
399 | /* 349 */ { MAD_F(0x04cc94d1) /* 0.299946611 */, 13 }, | 399 | /* 349 */ { MAD_F(0x04cc94d1) /* 0.299946611 */, 13 }, |
400 | /* 350 */ { MAD_F(0x04d146fb) /* 0.301093085 */, 13 }, | 400 | /* 350 */ { MAD_F(0x04d146fb) /* 0.301093085 */, 13 }, |
401 | /* 351 */ { MAD_F(0x04d5fa4b) /* 0.302240653 */, 13 }, | 401 | /* 351 */ { MAD_F(0x04d5fa4b) /* 0.302240653 */, 13 }, |
402 | 402 | ||
403 | /* 352 */ { MAD_F(0x04daaec0) /* 0.303389310 */, 13 }, | 403 | /* 352 */ { MAD_F(0x04daaec0) /* 0.303389310 */, 13 }, |
404 | /* 353 */ { MAD_F(0x04df6458) /* 0.304539056 */, 13 }, | 404 | /* 353 */ { MAD_F(0x04df6458) /* 0.304539056 */, 13 }, |
405 | /* 354 */ { MAD_F(0x04e41b14) /* 0.305689888 */, 13 }, | 405 | /* 354 */ { MAD_F(0x04e41b14) /* 0.305689888 */, 13 }, |
406 | /* 355 */ { MAD_F(0x04e8d2f3) /* 0.306841804 */, 13 }, | 406 | /* 355 */ { MAD_F(0x04e8d2f3) /* 0.306841804 */, 13 }, |
407 | /* 356 */ { MAD_F(0x04ed8bf5) /* 0.307994802 */, 13 }, | 407 | /* 356 */ { MAD_F(0x04ed8bf5) /* 0.307994802 */, 13 }, |
408 | /* 357 */ { MAD_F(0x04f24618) /* 0.309148880 */, 13 }, | 408 | /* 357 */ { MAD_F(0x04f24618) /* 0.309148880 */, 13 }, |
409 | /* 358 */ { MAD_F(0x04f7015d) /* 0.310304037 */, 13 }, | 409 | /* 358 */ { MAD_F(0x04f7015d) /* 0.310304037 */, 13 }, |
410 | /* 359 */ { MAD_F(0x04fbbdc3) /* 0.311460269 */, 13 }, | 410 | /* 359 */ { MAD_F(0x04fbbdc3) /* 0.311460269 */, 13 }, |
411 | /* 360 */ { MAD_F(0x05007b49) /* 0.312617576 */, 13 }, | 411 | /* 360 */ { MAD_F(0x05007b49) /* 0.312617576 */, 13 }, |
412 | /* 361 */ { MAD_F(0x050539ef) /* 0.313775954 */, 13 }, | 412 | /* 361 */ { MAD_F(0x050539ef) /* 0.313775954 */, 13 }, |
413 | /* 362 */ { MAD_F(0x0509f9b4) /* 0.314935403 */, 13 }, | 413 | /* 362 */ { MAD_F(0x0509f9b4) /* 0.314935403 */, 13 }, |
414 | /* 363 */ { MAD_F(0x050eba98) /* 0.316095920 */, 13 }, | 414 | /* 363 */ { MAD_F(0x050eba98) /* 0.316095920 */, 13 }, |
415 | /* 364 */ { MAD_F(0x05137c9a) /* 0.317257503 */, 13 }, | 415 | /* 364 */ { MAD_F(0x05137c9a) /* 0.317257503 */, 13 }, |
416 | /* 365 */ { MAD_F(0x05183fba) /* 0.318420150 */, 13 }, | 416 | /* 365 */ { MAD_F(0x05183fba) /* 0.318420150 */, 13 }, |
417 | /* 366 */ { MAD_F(0x051d03f7) /* 0.319583859 */, 13 }, | 417 | /* 366 */ { MAD_F(0x051d03f7) /* 0.319583859 */, 13 }, |
418 | /* 367 */ { MAD_F(0x0521c950) /* 0.320748629 */, 13 }, | 418 | /* 367 */ { MAD_F(0x0521c950) /* 0.320748629 */, 13 }, |
419 | 419 | ||
420 | /* 368 */ { MAD_F(0x05268fc6) /* 0.321914457 */, 13 }, | 420 | /* 368 */ { MAD_F(0x05268fc6) /* 0.321914457 */, 13 }, |
421 | /* 369 */ { MAD_F(0x052b5757) /* 0.323081342 */, 13 }, | 421 | /* 369 */ { MAD_F(0x052b5757) /* 0.323081342 */, 13 }, |
422 | /* 370 */ { MAD_F(0x05302003) /* 0.324249281 */, 13 }, | 422 | /* 370 */ { MAD_F(0x05302003) /* 0.324249281 */, 13 }, |
423 | /* 371 */ { MAD_F(0x0534e9ca) /* 0.325418273 */, 13 }, | 423 | /* 371 */ { MAD_F(0x0534e9ca) /* 0.325418273 */, 13 }, |
424 | /* 372 */ { MAD_F(0x0539b4ab) /* 0.326588316 */, 13 }, | 424 | /* 372 */ { MAD_F(0x0539b4ab) /* 0.326588316 */, 13 }, |
425 | /* 373 */ { MAD_F(0x053e80a6) /* 0.327759407 */, 13 }, | 425 | /* 373 */ { MAD_F(0x053e80a6) /* 0.327759407 */, 13 }, |
426 | /* 374 */ { MAD_F(0x05434db9) /* 0.328931546 */, 13 }, | 426 | /* 374 */ { MAD_F(0x05434db9) /* 0.328931546 */, 13 }, |
427 | /* 375 */ { MAD_F(0x05481be5) /* 0.330104730 */, 13 }, | 427 | /* 375 */ { MAD_F(0x05481be5) /* 0.330104730 */, 13 }, |
428 | /* 376 */ { MAD_F(0x054ceb2a) /* 0.331278957 */, 13 }, | 428 | /* 376 */ { MAD_F(0x054ceb2a) /* 0.331278957 */, 13 }, |
429 | /* 377 */ { MAD_F(0x0551bb85) /* 0.332454225 */, 13 }, | 429 | /* 377 */ { MAD_F(0x0551bb85) /* 0.332454225 */, 13 }, |
430 | /* 378 */ { MAD_F(0x05568cf8) /* 0.333630533 */, 13 }, | 430 | /* 378 */ { MAD_F(0x05568cf8) /* 0.333630533 */, 13 }, |
431 | /* 379 */ { MAD_F(0x055b5f81) /* 0.334807879 */, 13 }, | 431 | /* 379 */ { MAD_F(0x055b5f81) /* 0.334807879 */, 13 }, |
432 | /* 380 */ { MAD_F(0x05603321) /* 0.335986261 */, 13 }, | 432 | /* 380 */ { MAD_F(0x05603321) /* 0.335986261 */, 13 }, |
433 | /* 381 */ { MAD_F(0x056507d6) /* 0.337165677 */, 13 }, | 433 | /* 381 */ { MAD_F(0x056507d6) /* 0.337165677 */, 13 }, |
434 | /* 382 */ { MAD_F(0x0569dda0) /* 0.338346125 */, 13 }, | 434 | /* 382 */ { MAD_F(0x0569dda0) /* 0.338346125 */, 13 }, |
435 | /* 383 */ { MAD_F(0x056eb47f) /* 0.339527604 */, 13 }, | 435 | /* 383 */ { MAD_F(0x056eb47f) /* 0.339527604 */, 13 }, |
436 | 436 | ||
437 | /* 384 */ { MAD_F(0x05738c72) /* 0.340710111 */, 13 }, | 437 | /* 384 */ { MAD_F(0x05738c72) /* 0.340710111 */, 13 }, |
438 | /* 385 */ { MAD_F(0x05786578) /* 0.341893646 */, 13 }, | 438 | /* 385 */ { MAD_F(0x05786578) /* 0.341893646 */, 13 }, |
439 | /* 386 */ { MAD_F(0x057d3f92) /* 0.343078205 */, 13 }, | 439 | /* 386 */ { MAD_F(0x057d3f92) /* 0.343078205 */, 13 }, |
440 | /* 387 */ { MAD_F(0x05821abf) /* 0.344263788 */, 13 }, | 440 | /* 387 */ { MAD_F(0x05821abf) /* 0.344263788 */, 13 }, |
441 | /* 388 */ { MAD_F(0x0586f6fd) /* 0.345450393 */, 13 }, | 441 | /* 388 */ { MAD_F(0x0586f6fd) /* 0.345450393 */, 13 }, |
442 | /* 389 */ { MAD_F(0x058bd44e) /* 0.346638017 */, 13 }, | 442 | /* 389 */ { MAD_F(0x058bd44e) /* 0.346638017 */, 13 }, |
443 | /* 390 */ { MAD_F(0x0590b2b0) /* 0.347826659 */, 13 }, | 443 | /* 390 */ { MAD_F(0x0590b2b0) /* 0.347826659 */, 13 }, |
444 | /* 391 */ { MAD_F(0x05959222) /* 0.349016318 */, 13 }, | 444 | /* 391 */ { MAD_F(0x05959222) /* 0.349016318 */, 13 }, |
445 | /* 392 */ { MAD_F(0x059a72a5) /* 0.350206992 */, 13 }, | 445 | /* 392 */ { MAD_F(0x059a72a5) /* 0.350206992 */, 13 }, |
446 | /* 393 */ { MAD_F(0x059f5438) /* 0.351398678 */, 13 }, | 446 | /* 393 */ { MAD_F(0x059f5438) /* 0.351398678 */, 13 }, |
447 | /* 394 */ { MAD_F(0x05a436da) /* 0.352591376 */, 13 }, | 447 | /* 394 */ { MAD_F(0x05a436da) /* 0.352591376 */, 13 }, |
448 | /* 395 */ { MAD_F(0x05a91a8c) /* 0.353785083 */, 13 }, | 448 | /* 395 */ { MAD_F(0x05a91a8c) /* 0.353785083 */, 13 }, |
449 | /* 396 */ { MAD_F(0x05adff4c) /* 0.354979798 */, 13 }, | 449 | /* 396 */ { MAD_F(0x05adff4c) /* 0.354979798 */, 13 }, |
450 | /* 397 */ { MAD_F(0x05b2e51a) /* 0.356175519 */, 13 }, | 450 | /* 397 */ { MAD_F(0x05b2e51a) /* 0.356175519 */, 13 }, |
451 | /* 398 */ { MAD_F(0x05b7cbf5) /* 0.357372244 */, 13 }, | 451 | /* 398 */ { MAD_F(0x05b7cbf5) /* 0.357372244 */, 13 }, |
452 | /* 399 */ { MAD_F(0x05bcb3de) /* 0.358569972 */, 13 }, | 452 | /* 399 */ { MAD_F(0x05bcb3de) /* 0.358569972 */, 13 }, |
453 | 453 | ||
454 | /* 400 */ { MAD_F(0x05c19cd3) /* 0.359768701 */, 13 }, | 454 | /* 400 */ { MAD_F(0x05c19cd3) /* 0.359768701 */, 13 }, |
455 | /* 401 */ { MAD_F(0x05c686d5) /* 0.360968429 */, 13 }, | 455 | /* 401 */ { MAD_F(0x05c686d5) /* 0.360968429 */, 13 }, |
456 | /* 402 */ { MAD_F(0x05cb71e2) /* 0.362169156 */, 13 }, | 456 | /* 402 */ { MAD_F(0x05cb71e2) /* 0.362169156 */, 13 }, |
457 | /* 403 */ { MAD_F(0x05d05dfb) /* 0.363370878 */, 13 }, | 457 | /* 403 */ { MAD_F(0x05d05dfb) /* 0.363370878 */, 13 }, |
458 | /* 404 */ { MAD_F(0x05d54b1f) /* 0.364573594 */, 13 }, | 458 | /* 404 */ { MAD_F(0x05d54b1f) /* 0.364573594 */, 13 }, |
459 | /* 405 */ { MAD_F(0x05da394d) /* 0.365777304 */, 13 }, | 459 | /* 405 */ { MAD_F(0x05da394d) /* 0.365777304 */, 13 }, |
460 | /* 406 */ { MAD_F(0x05df2885) /* 0.366982004 */, 13 }, | 460 | /* 406 */ { MAD_F(0x05df2885) /* 0.366982004 */, 13 }, |
461 | /* 407 */ { MAD_F(0x05e418c7) /* 0.368187694 */, 13 }, | 461 | /* 407 */ { MAD_F(0x05e418c7) /* 0.368187694 */, 13 }, |
462 | /* 408 */ { MAD_F(0x05e90a12) /* 0.369394372 */, 13 }, | 462 | /* 408 */ { MAD_F(0x05e90a12) /* 0.369394372 */, 13 }, |
463 | /* 409 */ { MAD_F(0x05edfc66) /* 0.370602036 */, 13 }, | 463 | /* 409 */ { MAD_F(0x05edfc66) /* 0.370602036 */, 13 }, |
464 | /* 410 */ { MAD_F(0x05f2efc2) /* 0.371810684 */, 13 }, | 464 | /* 410 */ { MAD_F(0x05f2efc2) /* 0.371810684 */, 13 }, |
465 | /* 411 */ { MAD_F(0x05f7e426) /* 0.373020316 */, 13 }, | 465 | /* 411 */ { MAD_F(0x05f7e426) /* 0.373020316 */, 13 }, |
466 | /* 412 */ { MAD_F(0x05fcd992) /* 0.374230929 */, 13 }, | 466 | /* 412 */ { MAD_F(0x05fcd992) /* 0.374230929 */, 13 }, |
467 | /* 413 */ { MAD_F(0x0601d004) /* 0.375442522 */, 13 }, | 467 | /* 413 */ { MAD_F(0x0601d004) /* 0.375442522 */, 13 }, |
468 | /* 414 */ { MAD_F(0x0606c77d) /* 0.376655093 */, 13 }, | 468 | /* 414 */ { MAD_F(0x0606c77d) /* 0.376655093 */, 13 }, |
469 | /* 415 */ { MAD_F(0x060bbffd) /* 0.377868641 */, 13 }, | 469 | /* 415 */ { MAD_F(0x060bbffd) /* 0.377868641 */, 13 }, |
470 | 470 | ||
471 | /* 416 */ { MAD_F(0x0610b982) /* 0.379083164 */, 13 }, | 471 | /* 416 */ { MAD_F(0x0610b982) /* 0.379083164 */, 13 }, |
472 | /* 417 */ { MAD_F(0x0615b40c) /* 0.380298661 */, 13 }, | 472 | /* 417 */ { MAD_F(0x0615b40c) /* 0.380298661 */, 13 }, |
473 | /* 418 */ { MAD_F(0x061aaf9c) /* 0.381515130 */, 13 }, | 473 | /* 418 */ { MAD_F(0x061aaf9c) /* 0.381515130 */, 13 }, |
474 | /* 419 */ { MAD_F(0x061fac2f) /* 0.382732569 */, 13 }, | 474 | /* 419 */ { MAD_F(0x061fac2f) /* 0.382732569 */, 13 }, |
475 | /* 420 */ { MAD_F(0x0624a9c7) /* 0.383950977 */, 13 }, | 475 | /* 420 */ { MAD_F(0x0624a9c7) /* 0.383950977 */, 13 }, |
476 | /* 421 */ { MAD_F(0x0629a863) /* 0.385170352 */, 13 }, | 476 | /* 421 */ { MAD_F(0x0629a863) /* 0.385170352 */, 13 }, |
477 | /* 422 */ { MAD_F(0x062ea802) /* 0.386390694 */, 13 }, | 477 | /* 422 */ { MAD_F(0x062ea802) /* 0.386390694 */, 13 }, |
478 | /* 423 */ { MAD_F(0x0633a8a3) /* 0.387611999 */, 13 }, | 478 | /* 423 */ { MAD_F(0x0633a8a3) /* 0.387611999 */, 13 }, |
479 | /* 424 */ { MAD_F(0x0638aa48) /* 0.388834268 */, 13 }, | 479 | /* 424 */ { MAD_F(0x0638aa48) /* 0.388834268 */, 13 }, |
480 | /* 425 */ { MAD_F(0x063dacee) /* 0.390057497 */, 13 }, | 480 | /* 425 */ { MAD_F(0x063dacee) /* 0.390057497 */, 13 }, |
481 | /* 426 */ { MAD_F(0x0642b096) /* 0.391281687 */, 13 }, | 481 | /* 426 */ { MAD_F(0x0642b096) /* 0.391281687 */, 13 }, |
482 | /* 427 */ { MAD_F(0x0647b53f) /* 0.392506834 */, 13 }, | 482 | /* 427 */ { MAD_F(0x0647b53f) /* 0.392506834 */, 13 }, |
483 | /* 428 */ { MAD_F(0x064cbae9) /* 0.393732939 */, 13 }, | 483 | /* 428 */ { MAD_F(0x064cbae9) /* 0.393732939 */, 13 }, |
484 | /* 429 */ { MAD_F(0x0651c193) /* 0.394959999 */, 13 }, | 484 | /* 429 */ { MAD_F(0x0651c193) /* 0.394959999 */, 13 }, |
485 | /* 430 */ { MAD_F(0x0656c93d) /* 0.396188012 */, 13 }, | 485 | /* 430 */ { MAD_F(0x0656c93d) /* 0.396188012 */, 13 }, |
486 | /* 431 */ { MAD_F(0x065bd1e7) /* 0.397416978 */, 13 }, | 486 | /* 431 */ { MAD_F(0x065bd1e7) /* 0.397416978 */, 13 }, |
487 | 487 | ||
488 | /* 432 */ { MAD_F(0x0660db91) /* 0.398646895 */, 13 }, | 488 | /* 432 */ { MAD_F(0x0660db91) /* 0.398646895 */, 13 }, |
489 | /* 433 */ { MAD_F(0x0665e639) /* 0.399877761 */, 13 }, | 489 | /* 433 */ { MAD_F(0x0665e639) /* 0.399877761 */, 13 }, |
490 | /* 434 */ { MAD_F(0x066af1df) /* 0.401109575 */, 13 }, | 490 | /* 434 */ { MAD_F(0x066af1df) /* 0.401109575 */, 13 }, |
491 | /* 435 */ { MAD_F(0x066ffe84) /* 0.402342335 */, 13 }, | 491 | /* 435 */ { MAD_F(0x066ffe84) /* 0.402342335 */, 13 }, |
492 | /* 436 */ { MAD_F(0x06750c26) /* 0.403576041 */, 13 }, | 492 | /* 436 */ { MAD_F(0x06750c26) /* 0.403576041 */, 13 }, |
493 | /* 437 */ { MAD_F(0x067a1ac6) /* 0.404810690 */, 13 }, | 493 | /* 437 */ { MAD_F(0x067a1ac6) /* 0.404810690 */, 13 }, |
494 | /* 438 */ { MAD_F(0x067f2a62) /* 0.406046281 */, 13 }, | 494 | /* 438 */ { MAD_F(0x067f2a62) /* 0.406046281 */, 13 }, |
495 | /* 439 */ { MAD_F(0x06843afb) /* 0.407282813 */, 13 }, | 495 | /* 439 */ { MAD_F(0x06843afb) /* 0.407282813 */, 13 }, |
496 | /* 440 */ { MAD_F(0x06894c90) /* 0.408520284 */, 13 }, | 496 | /* 440 */ { MAD_F(0x06894c90) /* 0.408520284 */, 13 }, |
497 | /* 441 */ { MAD_F(0x068e5f21) /* 0.409758693 */, 13 }, | 497 | /* 441 */ { MAD_F(0x068e5f21) /* 0.409758693 */, 13 }, |
498 | /* 442 */ { MAD_F(0x069372ae) /* 0.410998038 */, 13 }, | 498 | /* 442 */ { MAD_F(0x069372ae) /* 0.410998038 */, 13 }, |
499 | /* 443 */ { MAD_F(0x06988735) /* 0.412238319 */, 13 }, | 499 | /* 443 */ { MAD_F(0x06988735) /* 0.412238319 */, 13 }, |
500 | /* 444 */ { MAD_F(0x069d9cb7) /* 0.413479532 */, 13 }, | 500 | /* 444 */ { MAD_F(0x069d9cb7) /* 0.413479532 */, 13 }, |
501 | /* 445 */ { MAD_F(0x06a2b333) /* 0.414721679 */, 13 }, | 501 | /* 445 */ { MAD_F(0x06a2b333) /* 0.414721679 */, 13 }, |
502 | /* 446 */ { MAD_F(0x06a7caa9) /* 0.415964756 */, 13 }, | 502 | /* 446 */ { MAD_F(0x06a7caa9) /* 0.415964756 */, 13 }, |
503 | /* 447 */ { MAD_F(0x06ace318) /* 0.417208762 */, 13 }, | 503 | /* 447 */ { MAD_F(0x06ace318) /* 0.417208762 */, 13 }, |
504 | 504 | ||
505 | /* 448 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 13 }, | 505 | /* 448 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 13 }, |
506 | /* 449 */ { MAD_F(0x06b716e2) /* 0.419699557 */, 13 }, | 506 | /* 449 */ { MAD_F(0x06b716e2) /* 0.419699557 */, 13 }, |
507 | /* 450 */ { MAD_F(0x06bc323b) /* 0.420946343 */, 13 }, | 507 | /* 450 */ { MAD_F(0x06bc323b) /* 0.420946343 */, 13 }, |
508 | /* 451 */ { MAD_F(0x06c14e8d) /* 0.422194054 */, 13 }, | 508 | /* 451 */ { MAD_F(0x06c14e8d) /* 0.422194054 */, 13 }, |
509 | /* 452 */ { MAD_F(0x06c66bd6) /* 0.423442686 */, 13 }, | 509 | /* 452 */ { MAD_F(0x06c66bd6) /* 0.423442686 */, 13 }, |
510 | /* 453 */ { MAD_F(0x06cb8a17) /* 0.424692240 */, 13 }, | 510 | /* 453 */ { MAD_F(0x06cb8a17) /* 0.424692240 */, 13 }, |
511 | /* 454 */ { MAD_F(0x06d0a94e) /* 0.425942714 */, 13 }, | 511 | /* 454 */ { MAD_F(0x06d0a94e) /* 0.425942714 */, 13 }, |
512 | /* 455 */ { MAD_F(0x06d5c97c) /* 0.427194106 */, 13 }, | 512 | /* 455 */ { MAD_F(0x06d5c97c) /* 0.427194106 */, 13 }, |
513 | /* 456 */ { MAD_F(0x06daeaa1) /* 0.428446415 */, 13 }, | 513 | /* 456 */ { MAD_F(0x06daeaa1) /* 0.428446415 */, 13 }, |
514 | /* 457 */ { MAD_F(0x06e00cbb) /* 0.429699640 */, 13 }, | 514 | /* 457 */ { MAD_F(0x06e00cbb) /* 0.429699640 */, 13 }, |
515 | /* 458 */ { MAD_F(0x06e52fca) /* 0.430953779 */, 13 }, | 515 | /* 458 */ { MAD_F(0x06e52fca) /* 0.430953779 */, 13 }, |
516 | /* 459 */ { MAD_F(0x06ea53cf) /* 0.432208832 */, 13 }, | 516 | /* 459 */ { MAD_F(0x06ea53cf) /* 0.432208832 */, 13 }, |
517 | /* 460 */ { MAD_F(0x06ef78c8) /* 0.433464796 */, 13 }, | 517 | /* 460 */ { MAD_F(0x06ef78c8) /* 0.433464796 */, 13 }, |
518 | /* 461 */ { MAD_F(0x06f49eb6) /* 0.434721671 */, 13 }, | 518 | /* 461 */ { MAD_F(0x06f49eb6) /* 0.434721671 */, 13 }, |
519 | /* 462 */ { MAD_F(0x06f9c597) /* 0.435979455 */, 13 }, | 519 | /* 462 */ { MAD_F(0x06f9c597) /* 0.435979455 */, 13 }, |
520 | /* 463 */ { MAD_F(0x06feed6d) /* 0.437238146 */, 13 }, | 520 | /* 463 */ { MAD_F(0x06feed6d) /* 0.437238146 */, 13 }, |
521 | 521 | ||
522 | /* 464 */ { MAD_F(0x07041636) /* 0.438497744 */, 13 }, | 522 | /* 464 */ { MAD_F(0x07041636) /* 0.438497744 */, 13 }, |
523 | /* 465 */ { MAD_F(0x07093ff2) /* 0.439758248 */, 13 }, | 523 | /* 465 */ { MAD_F(0x07093ff2) /* 0.439758248 */, 13 }, |
524 | /* 466 */ { MAD_F(0x070e6aa0) /* 0.441019655 */, 13 }, | 524 | /* 466 */ { MAD_F(0x070e6aa0) /* 0.441019655 */, 13 }, |
525 | /* 467 */ { MAD_F(0x07139641) /* 0.442281965 */, 13 }, | 525 | /* 467 */ { MAD_F(0x07139641) /* 0.442281965 */, 13 }, |
526 | /* 468 */ { MAD_F(0x0718c2d3) /* 0.443545176 */, 13 }, | 526 | /* 468 */ { MAD_F(0x0718c2d3) /* 0.443545176 */, 13 }, |
527 | /* 469 */ { MAD_F(0x071df058) /* 0.444809288 */, 13 }, | 527 | /* 469 */ { MAD_F(0x071df058) /* 0.444809288 */, 13 }, |
528 | /* 470 */ { MAD_F(0x07231ecd) /* 0.446074298 */, 13 }, | 528 | /* 470 */ { MAD_F(0x07231ecd) /* 0.446074298 */, 13 }, |
529 | /* 471 */ { MAD_F(0x07284e34) /* 0.447340205 */, 13 }, | 529 | /* 471 */ { MAD_F(0x07284e34) /* 0.447340205 */, 13 }, |
530 | /* 472 */ { MAD_F(0x072d7e8b) /* 0.448607009 */, 13 }, | 530 | /* 472 */ { MAD_F(0x072d7e8b) /* 0.448607009 */, 13 }, |
531 | /* 473 */ { MAD_F(0x0732afd2) /* 0.449874708 */, 13 }, | 531 | /* 473 */ { MAD_F(0x0732afd2) /* 0.449874708 */, 13 }, |
532 | /* 474 */ { MAD_F(0x0737e209) /* 0.451143300 */, 13 }, | 532 | /* 474 */ { MAD_F(0x0737e209) /* 0.451143300 */, 13 }, |
533 | /* 475 */ { MAD_F(0x073d1530) /* 0.452412785 */, 13 }, | 533 | /* 475 */ { MAD_F(0x073d1530) /* 0.452412785 */, 13 }, |
534 | /* 476 */ { MAD_F(0x07424946) /* 0.453683161 */, 13 }, | 534 | /* 476 */ { MAD_F(0x07424946) /* 0.453683161 */, 13 }, |
535 | /* 477 */ { MAD_F(0x07477e4b) /* 0.454954427 */, 13 }, | 535 | /* 477 */ { MAD_F(0x07477e4b) /* 0.454954427 */, 13 }, |
536 | /* 478 */ { MAD_F(0x074cb43e) /* 0.456226581 */, 13 }, | 536 | /* 478 */ { MAD_F(0x074cb43e) /* 0.456226581 */, 13 }, |
537 | /* 479 */ { MAD_F(0x0751eb20) /* 0.457499623 */, 13 }, | 537 | /* 479 */ { MAD_F(0x0751eb20) /* 0.457499623 */, 13 }, |
538 | 538 | ||
539 | /* 480 */ { MAD_F(0x075722ef) /* 0.458773552 */, 13 }, | 539 | /* 480 */ { MAD_F(0x075722ef) /* 0.458773552 */, 13 }, |
540 | /* 481 */ { MAD_F(0x075c5bac) /* 0.460048365 */, 13 }, | 540 | /* 481 */ { MAD_F(0x075c5bac) /* 0.460048365 */, 13 }, |
541 | /* 482 */ { MAD_F(0x07619557) /* 0.461324062 */, 13 }, | 541 | /* 482 */ { MAD_F(0x07619557) /* 0.461324062 */, 13 }, |
542 | /* 483 */ { MAD_F(0x0766cfee) /* 0.462600642 */, 13 }, | 542 | /* 483 */ { MAD_F(0x0766cfee) /* 0.462600642 */, 13 }, |
543 | /* 484 */ { MAD_F(0x076c0b72) /* 0.463878102 */, 13 }, | 543 | /* 484 */ { MAD_F(0x076c0b72) /* 0.463878102 */, 13 }, |
544 | /* 485 */ { MAD_F(0x077147e2) /* 0.465156443 */, 13 }, | 544 | /* 485 */ { MAD_F(0x077147e2) /* 0.465156443 */, 13 }, |
545 | /* 486 */ { MAD_F(0x0776853e) /* 0.466435663 */, 13 }, | 545 | /* 486 */ { MAD_F(0x0776853e) /* 0.466435663 */, 13 }, |
546 | /* 487 */ { MAD_F(0x077bc385) /* 0.467715761 */, 13 }, | 546 | /* 487 */ { MAD_F(0x077bc385) /* 0.467715761 */, 13 }, |
547 | /* 488 */ { MAD_F(0x078102b8) /* 0.468996735 */, 13 }, | 547 | /* 488 */ { MAD_F(0x078102b8) /* 0.468996735 */, 13 }, |
548 | /* 489 */ { MAD_F(0x078642d6) /* 0.470278584 */, 13 }, | 548 | /* 489 */ { MAD_F(0x078642d6) /* 0.470278584 */, 13 }, |
549 | /* 490 */ { MAD_F(0x078b83de) /* 0.471561307 */, 13 }, | 549 | /* 490 */ { MAD_F(0x078b83de) /* 0.471561307 */, 13 }, |
550 | /* 491 */ { MAD_F(0x0790c5d1) /* 0.472844904 */, 13 }, | 550 | /* 491 */ { MAD_F(0x0790c5d1) /* 0.472844904 */, 13 }, |
551 | /* 492 */ { MAD_F(0x079608ae) /* 0.474129372 */, 13 }, | 551 | /* 492 */ { MAD_F(0x079608ae) /* 0.474129372 */, 13 }, |
552 | /* 493 */ { MAD_F(0x079b4c74) /* 0.475414710 */, 13 }, | 552 | /* 493 */ { MAD_F(0x079b4c74) /* 0.475414710 */, 13 }, |
553 | /* 494 */ { MAD_F(0x07a09124) /* 0.476700918 */, 13 }, | 553 | /* 494 */ { MAD_F(0x07a09124) /* 0.476700918 */, 13 }, |
554 | /* 495 */ { MAD_F(0x07a5d6bd) /* 0.477987994 */, 13 }, | 554 | /* 495 */ { MAD_F(0x07a5d6bd) /* 0.477987994 */, 13 }, |
555 | 555 | ||
556 | /* 496 */ { MAD_F(0x07ab1d3e) /* 0.479275937 */, 13 }, | 556 | /* 496 */ { MAD_F(0x07ab1d3e) /* 0.479275937 */, 13 }, |
557 | /* 497 */ { MAD_F(0x07b064a8) /* 0.480564746 */, 13 }, | 557 | /* 497 */ { MAD_F(0x07b064a8) /* 0.480564746 */, 13 }, |
558 | /* 498 */ { MAD_F(0x07b5acfb) /* 0.481854420 */, 13 }, | 558 | /* 498 */ { MAD_F(0x07b5acfb) /* 0.481854420 */, 13 }, |
559 | /* 499 */ { MAD_F(0x07baf635) /* 0.483144957 */, 13 }, | 559 | /* 499 */ { MAD_F(0x07baf635) /* 0.483144957 */, 13 }, |
560 | /* 500 */ { MAD_F(0x07c04056) /* 0.484436356 */, 13 }, | 560 | /* 500 */ { MAD_F(0x07c04056) /* 0.484436356 */, 13 }, |
561 | /* 501 */ { MAD_F(0x07c58b5f) /* 0.485728617 */, 13 }, | 561 | /* 501 */ { MAD_F(0x07c58b5f) /* 0.485728617 */, 13 }, |
562 | /* 502 */ { MAD_F(0x07cad74e) /* 0.487021738 */, 13 }, | 562 | /* 502 */ { MAD_F(0x07cad74e) /* 0.487021738 */, 13 }, |
563 | /* 503 */ { MAD_F(0x07d02424) /* 0.488315717 */, 13 }, | 563 | /* 503 */ { MAD_F(0x07d02424) /* 0.488315717 */, 13 }, |
564 | /* 504 */ { MAD_F(0x07d571e0) /* 0.489610555 */, 13 }, | 564 | /* 504 */ { MAD_F(0x07d571e0) /* 0.489610555 */, 13 }, |
565 | /* 505 */ { MAD_F(0x07dac083) /* 0.490906249 */, 13 }, | 565 | /* 505 */ { MAD_F(0x07dac083) /* 0.490906249 */, 13 }, |
566 | /* 506 */ { MAD_F(0x07e0100a) /* 0.492202799 */, 13 }, | 566 | /* 506 */ { MAD_F(0x07e0100a) /* 0.492202799 */, 13 }, |
567 | /* 507 */ { MAD_F(0x07e56078) /* 0.493500203 */, 13 }, | 567 | /* 507 */ { MAD_F(0x07e56078) /* 0.493500203 */, 13 }, |
568 | /* 508 */ { MAD_F(0x07eab1ca) /* 0.494798460 */, 13 }, | 568 | /* 508 */ { MAD_F(0x07eab1ca) /* 0.494798460 */, 13 }, |
569 | /* 509 */ { MAD_F(0x07f00401) /* 0.496097570 */, 13 }, | 569 | /* 509 */ { MAD_F(0x07f00401) /* 0.496097570 */, 13 }, |
570 | /* 510 */ { MAD_F(0x07f5571d) /* 0.497397530 */, 13 }, | 570 | /* 510 */ { MAD_F(0x07f5571d) /* 0.497397530 */, 13 }, |
571 | /* 511 */ { MAD_F(0x07faab1c) /* 0.498698341 */, 13 }, | 571 | /* 511 */ { MAD_F(0x07faab1c) /* 0.498698341 */, 13 }, |
572 | 572 | ||
573 | /* 512 */ { MAD_F(0x04000000) /* 0.250000000 */, 14 }, | 573 | /* 512 */ { MAD_F(0x04000000) /* 0.250000000 */, 14 }, |
574 | /* 513 */ { MAD_F(0x0402aae3) /* 0.250651254 */, 14 }, | 574 | /* 513 */ { MAD_F(0x0402aae3) /* 0.250651254 */, 14 }, |
575 | /* 514 */ { MAD_F(0x04055638) /* 0.251302930 */, 14 }, | 575 | /* 514 */ { MAD_F(0x04055638) /* 0.251302930 */, 14 }, |
576 | /* 515 */ { MAD_F(0x040801ff) /* 0.251955030 */, 14 }, | 576 | /* 515 */ { MAD_F(0x040801ff) /* 0.251955030 */, 14 }, |
577 | /* 516 */ { MAD_F(0x040aae37) /* 0.252607552 */, 14 }, | 577 | /* 516 */ { MAD_F(0x040aae37) /* 0.252607552 */, 14 }, |
578 | /* 517 */ { MAD_F(0x040d5ae0) /* 0.253260495 */, 14 }, | 578 | /* 517 */ { MAD_F(0x040d5ae0) /* 0.253260495 */, 14 }, |
579 | /* 518 */ { MAD_F(0x041007fa) /* 0.253913860 */, 14 }, | 579 | /* 518 */ { MAD_F(0x041007fa) /* 0.253913860 */, 14 }, |
580 | /* 519 */ { MAD_F(0x0412b586) /* 0.254567645 */, 14 }, | 580 | /* 519 */ { MAD_F(0x0412b586) /* 0.254567645 */, 14 }, |
581 | /* 520 */ { MAD_F(0x04156381) /* 0.255221850 */, 14 }, | 581 | /* 520 */ { MAD_F(0x04156381) /* 0.255221850 */, 14 }, |
582 | /* 521 */ { MAD_F(0x041811ee) /* 0.255876475 */, 14 }, | 582 | /* 521 */ { MAD_F(0x041811ee) /* 0.255876475 */, 14 }, |
583 | /* 522 */ { MAD_F(0x041ac0cb) /* 0.256531518 */, 14 }, | 583 | /* 522 */ { MAD_F(0x041ac0cb) /* 0.256531518 */, 14 }, |
584 | /* 523 */ { MAD_F(0x041d7018) /* 0.257186980 */, 14 }, | 584 | /* 523 */ { MAD_F(0x041d7018) /* 0.257186980 */, 14 }, |
585 | /* 524 */ { MAD_F(0x04201fd5) /* 0.257842860 */, 14 }, | 585 | /* 524 */ { MAD_F(0x04201fd5) /* 0.257842860 */, 14 }, |
586 | /* 525 */ { MAD_F(0x0422d003) /* 0.258499157 */, 14 }, | 586 | /* 525 */ { MAD_F(0x0422d003) /* 0.258499157 */, 14 }, |
587 | /* 526 */ { MAD_F(0x042580a0) /* 0.259155872 */, 14 }, | 587 | /* 526 */ { MAD_F(0x042580a0) /* 0.259155872 */, 14 }, |
588 | /* 527 */ { MAD_F(0x042831ad) /* 0.259813002 */, 14 }, | 588 | /* 527 */ { MAD_F(0x042831ad) /* 0.259813002 */, 14 }, |
589 | 589 | ||
590 | /* 528 */ { MAD_F(0x042ae32a) /* 0.260470548 */, 14 }, | 590 | /* 528 */ { MAD_F(0x042ae32a) /* 0.260470548 */, 14 }, |
591 | /* 529 */ { MAD_F(0x042d9516) /* 0.261128510 */, 14 }, | 591 | /* 529 */ { MAD_F(0x042d9516) /* 0.261128510 */, 14 }, |
592 | /* 530 */ { MAD_F(0x04304772) /* 0.261786886 */, 14 }, | 592 | /* 530 */ { MAD_F(0x04304772) /* 0.261786886 */, 14 }, |
593 | /* 531 */ { MAD_F(0x0432fa3d) /* 0.262445676 */, 14 }, | 593 | /* 531 */ { MAD_F(0x0432fa3d) /* 0.262445676 */, 14 }, |
594 | /* 532 */ { MAD_F(0x0435ad76) /* 0.263104880 */, 14 }, | 594 | /* 532 */ { MAD_F(0x0435ad76) /* 0.263104880 */, 14 }, |
595 | /* 533 */ { MAD_F(0x0438611f) /* 0.263764497 */, 14 }, | 595 | /* 533 */ { MAD_F(0x0438611f) /* 0.263764497 */, 14 }, |
596 | /* 534 */ { MAD_F(0x043b1536) /* 0.264424527 */, 14 }, | 596 | /* 534 */ { MAD_F(0x043b1536) /* 0.264424527 */, 14 }, |
597 | /* 535 */ { MAD_F(0x043dc9bc) /* 0.265084969 */, 14 }, | 597 | /* 535 */ { MAD_F(0x043dc9bc) /* 0.265084969 */, 14 }, |
598 | /* 536 */ { MAD_F(0x04407eb1) /* 0.265745823 */, 14 }, | 598 | /* 536 */ { MAD_F(0x04407eb1) /* 0.265745823 */, 14 }, |
599 | /* 537 */ { MAD_F(0x04433414) /* 0.266407088 */, 14 }, | 599 | /* 537 */ { MAD_F(0x04433414) /* 0.266407088 */, 14 }, |
600 | /* 538 */ { MAD_F(0x0445e9e5) /* 0.267068763 */, 14 }, | 600 | /* 538 */ { MAD_F(0x0445e9e5) /* 0.267068763 */, 14 }, |
601 | /* 539 */ { MAD_F(0x0448a024) /* 0.267730848 */, 14 }, | 601 | /* 539 */ { MAD_F(0x0448a024) /* 0.267730848 */, 14 }, |
602 | /* 540 */ { MAD_F(0x044b56d1) /* 0.268393343 */, 14 }, | 602 | /* 540 */ { MAD_F(0x044b56d1) /* 0.268393343 */, 14 }, |
603 | /* 541 */ { MAD_F(0x044e0dec) /* 0.269056248 */, 14 }, | 603 | /* 541 */ { MAD_F(0x044e0dec) /* 0.269056248 */, 14 }, |
604 | /* 542 */ { MAD_F(0x0450c575) /* 0.269719560 */, 14 }, | 604 | /* 542 */ { MAD_F(0x0450c575) /* 0.269719560 */, 14 }, |
605 | /* 543 */ { MAD_F(0x04537d6b) /* 0.270383281 */, 14 }, | 605 | /* 543 */ { MAD_F(0x04537d6b) /* 0.270383281 */, 14 }, |
606 | 606 | ||
607 | /* 544 */ { MAD_F(0x045635cf) /* 0.271047409 */, 14 }, | 607 | /* 544 */ { MAD_F(0x045635cf) /* 0.271047409 */, 14 }, |
608 | /* 545 */ { MAD_F(0x0458ee9f) /* 0.271711944 */, 14 }, | 608 | /* 545 */ { MAD_F(0x0458ee9f) /* 0.271711944 */, 14 }, |
609 | /* 546 */ { MAD_F(0x045ba7dd) /* 0.272376886 */, 14 }, | 609 | /* 546 */ { MAD_F(0x045ba7dd) /* 0.272376886 */, 14 }, |
610 | /* 547 */ { MAD_F(0x045e6188) /* 0.273042234 */, 14 }, | 610 | /* 547 */ { MAD_F(0x045e6188) /* 0.273042234 */, 14 }, |
611 | /* 548 */ { MAD_F(0x04611ba0) /* 0.273707988 */, 14 }, | 611 | /* 548 */ { MAD_F(0x04611ba0) /* 0.273707988 */, 14 }, |
612 | /* 549 */ { MAD_F(0x0463d625) /* 0.274374147 */, 14 }, | 612 | /* 549 */ { MAD_F(0x0463d625) /* 0.274374147 */, 14 }, |
613 | /* 550 */ { MAD_F(0x04669116) /* 0.275040710 */, 14 }, | 613 | /* 550 */ { MAD_F(0x04669116) /* 0.275040710 */, 14 }, |
614 | /* 551 */ { MAD_F(0x04694c74) /* 0.275707677 */, 14 }, | 614 | /* 551 */ { MAD_F(0x04694c74) /* 0.275707677 */, 14 }, |
615 | /* 552 */ { MAD_F(0x046c083e) /* 0.276375048 */, 14 }, | 615 | /* 552 */ { MAD_F(0x046c083e) /* 0.276375048 */, 14 }, |
616 | /* 553 */ { MAD_F(0x046ec474) /* 0.277042822 */, 14 }, | 616 | /* 553 */ { MAD_F(0x046ec474) /* 0.277042822 */, 14 }, |
617 | /* 554 */ { MAD_F(0x04718116) /* 0.277710999 */, 14 }, | 617 | /* 554 */ { MAD_F(0x04718116) /* 0.277710999 */, 14 }, |
618 | /* 555 */ { MAD_F(0x04743e25) /* 0.278379578 */, 14 }, | 618 | /* 555 */ { MAD_F(0x04743e25) /* 0.278379578 */, 14 }, |
619 | /* 556 */ { MAD_F(0x0476fb9f) /* 0.279048558 */, 14 }, | 619 | /* 556 */ { MAD_F(0x0476fb9f) /* 0.279048558 */, 14 }, |
620 | /* 557 */ { MAD_F(0x0479b984) /* 0.279717940 */, 14 }, | 620 | /* 557 */ { MAD_F(0x0479b984) /* 0.279717940 */, 14 }, |
621 | /* 558 */ { MAD_F(0x047c77d6) /* 0.280387722 */, 14 }, | 621 | /* 558 */ { MAD_F(0x047c77d6) /* 0.280387722 */, 14 }, |
622 | /* 559 */ { MAD_F(0x047f3693) /* 0.281057905 */, 14 }, | 622 | /* 559 */ { MAD_F(0x047f3693) /* 0.281057905 */, 14 }, |
623 | 623 | ||
624 | /* 560 */ { MAD_F(0x0481f5bb) /* 0.281728487 */, 14 }, | 624 | /* 560 */ { MAD_F(0x0481f5bb) /* 0.281728487 */, 14 }, |
625 | /* 561 */ { MAD_F(0x0484b54e) /* 0.282399469 */, 14 }, | 625 | /* 561 */ { MAD_F(0x0484b54e) /* 0.282399469 */, 14 }, |
626 | /* 562 */ { MAD_F(0x0487754c) /* 0.283070849 */, 14 }, | 626 | /* 562 */ { MAD_F(0x0487754c) /* 0.283070849 */, 14 }, |
627 | /* 563 */ { MAD_F(0x048a35b6) /* 0.283742628 */, 14 }, | 627 | /* 563 */ { MAD_F(0x048a35b6) /* 0.283742628 */, 14 }, |
628 | /* 564 */ { MAD_F(0x048cf68a) /* 0.284414805 */, 14 }, | 628 | /* 564 */ { MAD_F(0x048cf68a) /* 0.284414805 */, 14 }, |
629 | /* 565 */ { MAD_F(0x048fb7c8) /* 0.285087379 */, 14 }, | 629 | /* 565 */ { MAD_F(0x048fb7c8) /* 0.285087379 */, 14 }, |
630 | /* 566 */ { MAD_F(0x04927972) /* 0.285760350 */, 14 }, | 630 | /* 566 */ { MAD_F(0x04927972) /* 0.285760350 */, 14 }, |
631 | /* 567 */ { MAD_F(0x04953b85) /* 0.286433717 */, 14 }, | 631 | /* 567 */ { MAD_F(0x04953b85) /* 0.286433717 */, 14 }, |
632 | /* 568 */ { MAD_F(0x0497fe03) /* 0.287107481 */, 14 }, | 632 | /* 568 */ { MAD_F(0x0497fe03) /* 0.287107481 */, 14 }, |
633 | /* 569 */ { MAD_F(0x049ac0eb) /* 0.287781640 */, 14 }, | 633 | /* 569 */ { MAD_F(0x049ac0eb) /* 0.287781640 */, 14 }, |
634 | /* 570 */ { MAD_F(0x049d843e) /* 0.288456194 */, 14 }, | 634 | /* 570 */ { MAD_F(0x049d843e) /* 0.288456194 */, 14 }, |
635 | /* 571 */ { MAD_F(0x04a047fa) /* 0.289131142 */, 14 }, | 635 | /* 571 */ { MAD_F(0x04a047fa) /* 0.289131142 */, 14 }, |
636 | /* 572 */ { MAD_F(0x04a30c20) /* 0.289806485 */, 14 }, | 636 | /* 572 */ { MAD_F(0x04a30c20) /* 0.289806485 */, 14 }, |
637 | /* 573 */ { MAD_F(0x04a5d0af) /* 0.290482221 */, 14 }, | 637 | /* 573 */ { MAD_F(0x04a5d0af) /* 0.290482221 */, 14 }, |
638 | /* 574 */ { MAD_F(0x04a895a8) /* 0.291158351 */, 14 }, | 638 | /* 574 */ { MAD_F(0x04a895a8) /* 0.291158351 */, 14 }, |
639 | /* 575 */ { MAD_F(0x04ab5b0b) /* 0.291834873 */, 14 }, | 639 | /* 575 */ { MAD_F(0x04ab5b0b) /* 0.291834873 */, 14 }, |
640 | 640 | ||
641 | /* 576 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 14 }, | 641 | /* 576 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 14 }, |
642 | /* 577 */ { MAD_F(0x04b0e70c) /* 0.293189094 */, 14 }, | 642 | /* 577 */ { MAD_F(0x04b0e70c) /* 0.293189094 */, 14 }, |
643 | /* 578 */ { MAD_F(0x04b3adaa) /* 0.293866792 */, 14 }, | 643 | /* 578 */ { MAD_F(0x04b3adaa) /* 0.293866792 */, 14 }, |
644 | /* 579 */ { MAD_F(0x04b674b1) /* 0.294544881 */, 14 }, | 644 | /* 579 */ { MAD_F(0x04b674b1) /* 0.294544881 */, 14 }, |
645 | /* 580 */ { MAD_F(0x04b93c21) /* 0.295223360 */, 14 }, | 645 | /* 580 */ { MAD_F(0x04b93c21) /* 0.295223360 */, 14 }, |
646 | /* 581 */ { MAD_F(0x04bc03fa) /* 0.295902229 */, 14 }, | 646 | /* 581 */ { MAD_F(0x04bc03fa) /* 0.295902229 */, 14 }, |
647 | /* 582 */ { MAD_F(0x04becc3b) /* 0.296581488 */, 14 }, | 647 | /* 582 */ { MAD_F(0x04becc3b) /* 0.296581488 */, 14 }, |
648 | /* 583 */ { MAD_F(0x04c194e4) /* 0.297261136 */, 14 }, | 648 | /* 583 */ { MAD_F(0x04c194e4) /* 0.297261136 */, 14 }, |
649 | /* 584 */ { MAD_F(0x04c45df6) /* 0.297941173 */, 14 }, | 649 | /* 584 */ { MAD_F(0x04c45df6) /* 0.297941173 */, 14 }, |
650 | /* 585 */ { MAD_F(0x04c72771) /* 0.298621598 */, 14 }, | 650 | /* 585 */ { MAD_F(0x04c72771) /* 0.298621598 */, 14 }, |
651 | /* 586 */ { MAD_F(0x04c9f153) /* 0.299302411 */, 14 }, | 651 | /* 586 */ { MAD_F(0x04c9f153) /* 0.299302411 */, 14 }, |
652 | /* 587 */ { MAD_F(0x04ccbb9d) /* 0.299983611 */, 14 }, | 652 | /* 587 */ { MAD_F(0x04ccbb9d) /* 0.299983611 */, 14 }, |
653 | /* 588 */ { MAD_F(0x04cf864f) /* 0.300665198 */, 14 }, | 653 | /* 588 */ { MAD_F(0x04cf864f) /* 0.300665198 */, 14 }, |
654 | /* 589 */ { MAD_F(0x04d25169) /* 0.301347172 */, 14 }, | 654 | /* 589 */ { MAD_F(0x04d25169) /* 0.301347172 */, 14 }, |
655 | /* 590 */ { MAD_F(0x04d51ceb) /* 0.302029532 */, 14 }, | 655 | /* 590 */ { MAD_F(0x04d51ceb) /* 0.302029532 */, 14 }, |
656 | /* 591 */ { MAD_F(0x04d7e8d4) /* 0.302712277 */, 14 }, | 656 | /* 591 */ { MAD_F(0x04d7e8d4) /* 0.302712277 */, 14 }, |
657 | 657 | ||
658 | /* 592 */ { MAD_F(0x04dab524) /* 0.303395408 */, 14 }, | 658 | /* 592 */ { MAD_F(0x04dab524) /* 0.303395408 */, 14 }, |
659 | /* 593 */ { MAD_F(0x04dd81dc) /* 0.304078923 */, 14 }, | 659 | /* 593 */ { MAD_F(0x04dd81dc) /* 0.304078923 */, 14 }, |
660 | /* 594 */ { MAD_F(0x04e04efb) /* 0.304762823 */, 14 }, | 660 | /* 594 */ { MAD_F(0x04e04efb) /* 0.304762823 */, 14 }, |
661 | /* 595 */ { MAD_F(0x04e31c81) /* 0.305447106 */, 14 }, | 661 | /* 595 */ { MAD_F(0x04e31c81) /* 0.305447106 */, 14 }, |
662 | /* 596 */ { MAD_F(0x04e5ea6e) /* 0.306131773 */, 14 }, | 662 | /* 596 */ { MAD_F(0x04e5ea6e) /* 0.306131773 */, 14 }, |
663 | /* 597 */ { MAD_F(0x04e8b8c2) /* 0.306816823 */, 14 }, | 663 | /* 597 */ { MAD_F(0x04e8b8c2) /* 0.306816823 */, 14 }, |
664 | /* 598 */ { MAD_F(0x04eb877c) /* 0.307502256 */, 14 }, | 664 | /* 598 */ { MAD_F(0x04eb877c) /* 0.307502256 */, 14 }, |
665 | /* 599 */ { MAD_F(0x04ee569d) /* 0.308188071 */, 14 }, | 665 | /* 599 */ { MAD_F(0x04ee569d) /* 0.308188071 */, 14 }, |
666 | /* 600 */ { MAD_F(0x04f12624) /* 0.308874267 */, 14 }, | 666 | /* 600 */ { MAD_F(0x04f12624) /* 0.308874267 */, 14 }, |
667 | /* 601 */ { MAD_F(0x04f3f612) /* 0.309560845 */, 14 }, | 667 | /* 601 */ { MAD_F(0x04f3f612) /* 0.309560845 */, 14 }, |
668 | /* 602 */ { MAD_F(0x04f6c666) /* 0.310247804 */, 14 }, | 668 | /* 602 */ { MAD_F(0x04f6c666) /* 0.310247804 */, 14 }, |
669 | /* 603 */ { MAD_F(0x04f99721) /* 0.310935143 */, 14 }, | 669 | /* 603 */ { MAD_F(0x04f99721) /* 0.310935143 */, 14 }, |
670 | /* 604 */ { MAD_F(0x04fc6841) /* 0.311622862 */, 14 }, | 670 | /* 604 */ { MAD_F(0x04fc6841) /* 0.311622862 */, 14 }, |
671 | /* 605 */ { MAD_F(0x04ff39c7) /* 0.312310961 */, 14 }, | 671 | /* 605 */ { MAD_F(0x04ff39c7) /* 0.312310961 */, 14 }, |
672 | /* 606 */ { MAD_F(0x05020bb3) /* 0.312999439 */, 14 }, | 672 | /* 606 */ { MAD_F(0x05020bb3) /* 0.312999439 */, 14 }, |
673 | /* 607 */ { MAD_F(0x0504de05) /* 0.313688296 */, 14 }, | 673 | /* 607 */ { MAD_F(0x0504de05) /* 0.313688296 */, 14 }, |
674 | 674 | ||
675 | /* 608 */ { MAD_F(0x0507b0bc) /* 0.314377532 */, 14 }, | 675 | /* 608 */ { MAD_F(0x0507b0bc) /* 0.314377532 */, 14 }, |
676 | /* 609 */ { MAD_F(0x050a83d8) /* 0.315067145 */, 14 }, | 676 | /* 609 */ { MAD_F(0x050a83d8) /* 0.315067145 */, 14 }, |
677 | /* 610 */ { MAD_F(0x050d575b) /* 0.315757136 */, 14 }, | 677 | /* 610 */ { MAD_F(0x050d575b) /* 0.315757136 */, 14 }, |
678 | /* 611 */ { MAD_F(0x05102b42) /* 0.316447504 */, 14 }, | 678 | /* 611 */ { MAD_F(0x05102b42) /* 0.316447504 */, 14 }, |
679 | /* 612 */ { MAD_F(0x0512ff8e) /* 0.317138249 */, 14 }, | 679 | /* 612 */ { MAD_F(0x0512ff8e) /* 0.317138249 */, 14 }, |
680 | /* 613 */ { MAD_F(0x0515d440) /* 0.317829370 */, 14 }, | 680 | /* 613 */ { MAD_F(0x0515d440) /* 0.317829370 */, 14 }, |
681 | /* 614 */ { MAD_F(0x0518a956) /* 0.318520867 */, 14 }, | 681 | /* 614 */ { MAD_F(0x0518a956) /* 0.318520867 */, 14 }, |
682 | /* 615 */ { MAD_F(0x051b7ed1) /* 0.319212739 */, 14 }, | 682 | /* 615 */ { MAD_F(0x051b7ed1) /* 0.319212739 */, 14 }, |
683 | /* 616 */ { MAD_F(0x051e54b1) /* 0.319904987 */, 14 }, | 683 | /* 616 */ { MAD_F(0x051e54b1) /* 0.319904987 */, 14 }, |
684 | /* 617 */ { MAD_F(0x05212af5) /* 0.320597609 */, 14 }, | 684 | /* 617 */ { MAD_F(0x05212af5) /* 0.320597609 */, 14 }, |
685 | /* 618 */ { MAD_F(0x0524019e) /* 0.321290606 */, 14 }, | 685 | /* 618 */ { MAD_F(0x0524019e) /* 0.321290606 */, 14 }, |
686 | /* 619 */ { MAD_F(0x0526d8ab) /* 0.321983976 */, 14 }, | 686 | /* 619 */ { MAD_F(0x0526d8ab) /* 0.321983976 */, 14 }, |
687 | /* 620 */ { MAD_F(0x0529b01d) /* 0.322677720 */, 14 }, | 687 | /* 620 */ { MAD_F(0x0529b01d) /* 0.322677720 */, 14 }, |
688 | /* 621 */ { MAD_F(0x052c87f2) /* 0.323371837 */, 14 }, | 688 | /* 621 */ { MAD_F(0x052c87f2) /* 0.323371837 */, 14 }, |
689 | /* 622 */ { MAD_F(0x052f602c) /* 0.324066327 */, 14 }, | 689 | /* 622 */ { MAD_F(0x052f602c) /* 0.324066327 */, 14 }, |
690 | /* 623 */ { MAD_F(0x053238ca) /* 0.324761189 */, 14 }, | 690 | /* 623 */ { MAD_F(0x053238ca) /* 0.324761189 */, 14 }, |
691 | 691 | ||
692 | /* 624 */ { MAD_F(0x053511cb) /* 0.325456423 */, 14 }, | 692 | /* 624 */ { MAD_F(0x053511cb) /* 0.325456423 */, 14 }, |
693 | /* 625 */ { MAD_F(0x0537eb30) /* 0.326152028 */, 14 }, | 693 | /* 625 */ { MAD_F(0x0537eb30) /* 0.326152028 */, 14 }, |
694 | /* 626 */ { MAD_F(0x053ac4f9) /* 0.326848005 */, 14 }, | 694 | /* 626 */ { MAD_F(0x053ac4f9) /* 0.326848005 */, 14 }, |
695 | /* 627 */ { MAD_F(0x053d9f25) /* 0.327544352 */, 14 }, | 695 | /* 627 */ { MAD_F(0x053d9f25) /* 0.327544352 */, 14 }, |
696 | /* 628 */ { MAD_F(0x054079b5) /* 0.328241070 */, 14 }, | 696 | /* 628 */ { MAD_F(0x054079b5) /* 0.328241070 */, 14 }, |
697 | /* 629 */ { MAD_F(0x054354a8) /* 0.328938157 */, 14 }, | 697 | /* 629 */ { MAD_F(0x054354a8) /* 0.328938157 */, 14 }, |
698 | /* 630 */ { MAD_F(0x05462ffe) /* 0.329635614 */, 14 }, | 698 | /* 630 */ { MAD_F(0x05462ffe) /* 0.329635614 */, 14 }, |
699 | /* 631 */ { MAD_F(0x05490bb7) /* 0.330333440 */, 14 }, | 699 | /* 631 */ { MAD_F(0x05490bb7) /* 0.330333440 */, 14 }, |
700 | /* 632 */ { MAD_F(0x054be7d4) /* 0.331031635 */, 14 }, | 700 | /* 632 */ { MAD_F(0x054be7d4) /* 0.331031635 */, 14 }, |
701 | /* 633 */ { MAD_F(0x054ec453) /* 0.331730198 */, 14 }, | 701 | /* 633 */ { MAD_F(0x054ec453) /* 0.331730198 */, 14 }, |
702 | /* 634 */ { MAD_F(0x0551a134) /* 0.332429129 */, 14 }, | 702 | /* 634 */ { MAD_F(0x0551a134) /* 0.332429129 */, 14 }, |
703 | /* 635 */ { MAD_F(0x05547e79) /* 0.333128427 */, 14 }, | 703 | /* 635 */ { MAD_F(0x05547e79) /* 0.333128427 */, 14 }, |
704 | /* 636 */ { MAD_F(0x05575c20) /* 0.333828093 */, 14 }, | 704 | /* 636 */ { MAD_F(0x05575c20) /* 0.333828093 */, 14 }, |
705 | /* 637 */ { MAD_F(0x055a3a2a) /* 0.334528126 */, 14 }, | 705 | /* 637 */ { MAD_F(0x055a3a2a) /* 0.334528126 */, 14 }, |
706 | /* 638 */ { MAD_F(0x055d1896) /* 0.335228525 */, 14 }, | 706 | /* 638 */ { MAD_F(0x055d1896) /* 0.335228525 */, 14 }, |
707 | /* 639 */ { MAD_F(0x055ff764) /* 0.335929290 */, 14 }, | 707 | /* 639 */ { MAD_F(0x055ff764) /* 0.335929290 */, 14 }, |
708 | 708 | ||
709 | /* 640 */ { MAD_F(0x0562d694) /* 0.336630420 */, 14 }, | 709 | /* 640 */ { MAD_F(0x0562d694) /* 0.336630420 */, 14 }, |
710 | /* 641 */ { MAD_F(0x0565b627) /* 0.337331916 */, 14 }, | 710 | /* 641 */ { MAD_F(0x0565b627) /* 0.337331916 */, 14 }, |
711 | /* 642 */ { MAD_F(0x0568961b) /* 0.338033777 */, 14 }, | 711 | /* 642 */ { MAD_F(0x0568961b) /* 0.338033777 */, 14 }, |
712 | /* 643 */ { MAD_F(0x056b7671) /* 0.338736002 */, 14 }, | 712 | /* 643 */ { MAD_F(0x056b7671) /* 0.338736002 */, 14 }, |
713 | /* 644 */ { MAD_F(0x056e5729) /* 0.339438592 */, 14 }, | 713 | /* 644 */ { MAD_F(0x056e5729) /* 0.339438592 */, 14 }, |
714 | /* 645 */ { MAD_F(0x05713843) /* 0.340141545 */, 14 }, | 714 | /* 645 */ { MAD_F(0x05713843) /* 0.340141545 */, 14 }, |
715 | /* 646 */ { MAD_F(0x057419be) /* 0.340844862 */, 14 }, | 715 | /* 646 */ { MAD_F(0x057419be) /* 0.340844862 */, 14 }, |
716 | /* 647 */ { MAD_F(0x0576fb9a) /* 0.341548541 */, 14 }, | 716 | /* 647 */ { MAD_F(0x0576fb9a) /* 0.341548541 */, 14 }, |
717 | /* 648 */ { MAD_F(0x0579ddd8) /* 0.342252584 */, 14 }, | 717 | /* 648 */ { MAD_F(0x0579ddd8) /* 0.342252584 */, 14 }, |
718 | /* 649 */ { MAD_F(0x057cc077) /* 0.342956988 */, 14 }, | 718 | /* 649 */ { MAD_F(0x057cc077) /* 0.342956988 */, 14 }, |
719 | /* 650 */ { MAD_F(0x057fa378) /* 0.343661754 */, 14 }, | 719 | /* 650 */ { MAD_F(0x057fa378) /* 0.343661754 */, 14 }, |
720 | /* 651 */ { MAD_F(0x058286d9) /* 0.344366882 */, 14 }, | 720 | /* 651 */ { MAD_F(0x058286d9) /* 0.344366882 */, 14 }, |
721 | /* 652 */ { MAD_F(0x05856a9b) /* 0.345072371 */, 14 }, | 721 | /* 652 */ { MAD_F(0x05856a9b) /* 0.345072371 */, 14 }, |
722 | /* 653 */ { MAD_F(0x05884ebe) /* 0.345778221 */, 14 }, | 722 | /* 653 */ { MAD_F(0x05884ebe) /* 0.345778221 */, 14 }, |
723 | /* 654 */ { MAD_F(0x058b3342) /* 0.346484431 */, 14 }, | 723 | /* 654 */ { MAD_F(0x058b3342) /* 0.346484431 */, 14 }, |
724 | /* 655 */ { MAD_F(0x058e1827) /* 0.347191002 */, 14 }, | 724 | /* 655 */ { MAD_F(0x058e1827) /* 0.347191002 */, 14 }, |
725 | 725 | ||
726 | /* 656 */ { MAD_F(0x0590fd6c) /* 0.347897931 */, 14 }, | 726 | /* 656 */ { MAD_F(0x0590fd6c) /* 0.347897931 */, 14 }, |
727 | /* 657 */ { MAD_F(0x0593e311) /* 0.348605221 */, 14 }, | 727 | /* 657 */ { MAD_F(0x0593e311) /* 0.348605221 */, 14 }, |
728 | /* 658 */ { MAD_F(0x0596c917) /* 0.349312869 */, 14 }, | 728 | /* 658 */ { MAD_F(0x0596c917) /* 0.349312869 */, 14 }, |
729 | /* 659 */ { MAD_F(0x0599af7d) /* 0.350020876 */, 14 }, | 729 | /* 659 */ { MAD_F(0x0599af7d) /* 0.350020876 */, 14 }, |
730 | /* 660 */ { MAD_F(0x059c9643) /* 0.350729240 */, 14 }, | 730 | /* 660 */ { MAD_F(0x059c9643) /* 0.350729240 */, 14 }, |
731 | /* 661 */ { MAD_F(0x059f7d6a) /* 0.351437963 */, 14 }, | 731 | /* 661 */ { MAD_F(0x059f7d6a) /* 0.351437963 */, 14 }, |
732 | /* 662 */ { MAD_F(0x05a264f0) /* 0.352147044 */, 14 }, | 732 | /* 662 */ { MAD_F(0x05a264f0) /* 0.352147044 */, 14 }, |
733 | /* 663 */ { MAD_F(0x05a54cd6) /* 0.352856481 */, 14 }, | 733 | /* 663 */ { MAD_F(0x05a54cd6) /* 0.352856481 */, 14 }, |
734 | /* 664 */ { MAD_F(0x05a8351c) /* 0.353566275 */, 14 }, | 734 | /* 664 */ { MAD_F(0x05a8351c) /* 0.353566275 */, 14 }, |
735 | /* 665 */ { MAD_F(0x05ab1dc2) /* 0.354276426 */, 14 }, | 735 | /* 665 */ { MAD_F(0x05ab1dc2) /* 0.354276426 */, 14 }, |
736 | /* 666 */ { MAD_F(0x05ae06c7) /* 0.354986932 */, 14 }, | 736 | /* 666 */ { MAD_F(0x05ae06c7) /* 0.354986932 */, 14 }, |
737 | /* 667 */ { MAD_F(0x05b0f02b) /* 0.355697795 */, 14 }, | 737 | /* 667 */ { MAD_F(0x05b0f02b) /* 0.355697795 */, 14 }, |
738 | /* 668 */ { MAD_F(0x05b3d9f0) /* 0.356409012 */, 14 }, | 738 | /* 668 */ { MAD_F(0x05b3d9f0) /* 0.356409012 */, 14 }, |
739 | /* 669 */ { MAD_F(0x05b6c413) /* 0.357120585 */, 14 }, | 739 | /* 669 */ { MAD_F(0x05b6c413) /* 0.357120585 */, 14 }, |
740 | /* 670 */ { MAD_F(0x05b9ae95) /* 0.357832512 */, 14 }, | 740 | /* 670 */ { MAD_F(0x05b9ae95) /* 0.357832512 */, 14 }, |
741 | /* 671 */ { MAD_F(0x05bc9977) /* 0.358544794 */, 14 }, | 741 | /* 671 */ { MAD_F(0x05bc9977) /* 0.358544794 */, 14 }, |
742 | 742 | ||
743 | /* 672 */ { MAD_F(0x05bf84b8) /* 0.359257429 */, 14 }, | 743 | /* 672 */ { MAD_F(0x05bf84b8) /* 0.359257429 */, 14 }, |
744 | /* 673 */ { MAD_F(0x05c27057) /* 0.359970419 */, 14 }, | 744 | /* 673 */ { MAD_F(0x05c27057) /* 0.359970419 */, 14 }, |
745 | /* 674 */ { MAD_F(0x05c55c56) /* 0.360683761 */, 14 }, | 745 | /* 674 */ { MAD_F(0x05c55c56) /* 0.360683761 */, 14 }, |
746 | /* 675 */ { MAD_F(0x05c848b3) /* 0.361397456 */, 14 }, | 746 | /* 675 */ { MAD_F(0x05c848b3) /* 0.361397456 */, 14 }, |
747 | /* 676 */ { MAD_F(0x05cb356e) /* 0.362111504 */, 14 }, | 747 | /* 676 */ { MAD_F(0x05cb356e) /* 0.362111504 */, 14 }, |
748 | /* 677 */ { MAD_F(0x05ce2289) /* 0.362825904 */, 14 }, | 748 | /* 677 */ { MAD_F(0x05ce2289) /* 0.362825904 */, 14 }, |
749 | /* 678 */ { MAD_F(0x05d11001) /* 0.363540655 */, 14 }, | 749 | /* 678 */ { MAD_F(0x05d11001) /* 0.363540655 */, 14 }, |
750 | /* 679 */ { MAD_F(0x05d3fdd8) /* 0.364255759 */, 14 }, | 750 | /* 679 */ { MAD_F(0x05d3fdd8) /* 0.364255759 */, 14 }, |
751 | /* 680 */ { MAD_F(0x05d6ec0e) /* 0.364971213 */, 14 }, | 751 | /* 680 */ { MAD_F(0x05d6ec0e) /* 0.364971213 */, 14 }, |
752 | /* 681 */ { MAD_F(0x05d9daa1) /* 0.365687018 */, 14 }, | 752 | /* 681 */ { MAD_F(0x05d9daa1) /* 0.365687018 */, 14 }, |
753 | /* 682 */ { MAD_F(0x05dcc993) /* 0.366403174 */, 14 }, | 753 | /* 682 */ { MAD_F(0x05dcc993) /* 0.366403174 */, 14 }, |
754 | /* 683 */ { MAD_F(0x05dfb8e2) /* 0.367119680 */, 14 }, | 754 | /* 683 */ { MAD_F(0x05dfb8e2) /* 0.367119680 */, 14 }, |
755 | /* 684 */ { MAD_F(0x05e2a890) /* 0.367836535 */, 14 }, | 755 | /* 684 */ { MAD_F(0x05e2a890) /* 0.367836535 */, 14 }, |
756 | /* 685 */ { MAD_F(0x05e5989b) /* 0.368553740 */, 14 }, | 756 | /* 685 */ { MAD_F(0x05e5989b) /* 0.368553740 */, 14 }, |
757 | /* 686 */ { MAD_F(0x05e88904) /* 0.369271294 */, 14 }, | 757 | /* 686 */ { MAD_F(0x05e88904) /* 0.369271294 */, 14 }, |
758 | /* 687 */ { MAD_F(0x05eb79cb) /* 0.369989197 */, 14 }, | 758 | /* 687 */ { MAD_F(0x05eb79cb) /* 0.369989197 */, 14 }, |
759 | 759 | ||
760 | /* 688 */ { MAD_F(0x05ee6aef) /* 0.370707448 */, 14 }, | 760 | /* 688 */ { MAD_F(0x05ee6aef) /* 0.370707448 */, 14 }, |
761 | /* 689 */ { MAD_F(0x05f15c70) /* 0.371426047 */, 14 }, | 761 | /* 689 */ { MAD_F(0x05f15c70) /* 0.371426047 */, 14 }, |
762 | /* 690 */ { MAD_F(0x05f44e4f) /* 0.372144994 */, 14 }, | 762 | /* 690 */ { MAD_F(0x05f44e4f) /* 0.372144994 */, 14 }, |
763 | /* 691 */ { MAD_F(0x05f7408b) /* 0.372864289 */, 14 }, | 763 | /* 691 */ { MAD_F(0x05f7408b) /* 0.372864289 */, 14 }, |
764 | /* 692 */ { MAD_F(0x05fa3324) /* 0.373583930 */, 14 }, | 764 | /* 692 */ { MAD_F(0x05fa3324) /* 0.373583930 */, 14 }, |
765 | /* 693 */ { MAD_F(0x05fd261b) /* 0.374303918 */, 14 }, | 765 | /* 693 */ { MAD_F(0x05fd261b) /* 0.374303918 */, 14 }, |
766 | /* 694 */ { MAD_F(0x0600196e) /* 0.375024253 */, 14 }, | 766 | /* 694 */ { MAD_F(0x0600196e) /* 0.375024253 */, 14 }, |
767 | /* 695 */ { MAD_F(0x06030d1e) /* 0.375744934 */, 14 }, | 767 | /* 695 */ { MAD_F(0x06030d1e) /* 0.375744934 */, 14 }, |
768 | /* 696 */ { MAD_F(0x0606012b) /* 0.376465960 */, 14 }, | 768 | /* 696 */ { MAD_F(0x0606012b) /* 0.376465960 */, 14 }, |
769 | /* 697 */ { MAD_F(0x0608f595) /* 0.377187332 */, 14 }, | 769 | /* 697 */ { MAD_F(0x0608f595) /* 0.377187332 */, 14 }, |
770 | /* 698 */ { MAD_F(0x060bea5c) /* 0.377909049 */, 14 }, | 770 | /* 698 */ { MAD_F(0x060bea5c) /* 0.377909049 */, 14 }, |
771 | /* 699 */ { MAD_F(0x060edf7f) /* 0.378631110 */, 14 }, | 771 | /* 699 */ { MAD_F(0x060edf7f) /* 0.378631110 */, 14 }, |
772 | /* 700 */ { MAD_F(0x0611d4fe) /* 0.379353516 */, 14 }, | 772 | /* 700 */ { MAD_F(0x0611d4fe) /* 0.379353516 */, 14 }, |
773 | /* 701 */ { MAD_F(0x0614cada) /* 0.380076266 */, 14 }, | 773 | /* 701 */ { MAD_F(0x0614cada) /* 0.380076266 */, 14 }, |
774 | /* 702 */ { MAD_F(0x0617c112) /* 0.380799360 */, 14 }, | 774 | /* 702 */ { MAD_F(0x0617c112) /* 0.380799360 */, 14 }, |
775 | /* 703 */ { MAD_F(0x061ab7a6) /* 0.381522798 */, 14 }, | 775 | /* 703 */ { MAD_F(0x061ab7a6) /* 0.381522798 */, 14 }, |
776 | 776 | ||
777 | /* 704 */ { MAD_F(0x061dae96) /* 0.382246578 */, 14 }, | 777 | /* 704 */ { MAD_F(0x061dae96) /* 0.382246578 */, 14 }, |
778 | /* 705 */ { MAD_F(0x0620a5e3) /* 0.382970701 */, 14 }, | 778 | /* 705 */ { MAD_F(0x0620a5e3) /* 0.382970701 */, 14 }, |
779 | /* 706 */ { MAD_F(0x06239d8b) /* 0.383695167 */, 14 }, | 779 | /* 706 */ { MAD_F(0x06239d8b) /* 0.383695167 */, 14 }, |
780 | /* 707 */ { MAD_F(0x0626958f) /* 0.384419975 */, 14 }, | 780 | /* 707 */ { MAD_F(0x0626958f) /* 0.384419975 */, 14 }, |
781 | /* 708 */ { MAD_F(0x06298def) /* 0.385145124 */, 14 }, | 781 | /* 708 */ { MAD_F(0x06298def) /* 0.385145124 */, 14 }, |
782 | /* 709 */ { MAD_F(0x062c86aa) /* 0.385870615 */, 14 }, | 782 | /* 709 */ { MAD_F(0x062c86aa) /* 0.385870615 */, 14 }, |
783 | /* 710 */ { MAD_F(0x062f7fc1) /* 0.386596448 */, 14 }, | 783 | /* 710 */ { MAD_F(0x062f7fc1) /* 0.386596448 */, 14 }, |
784 | /* 711 */ { MAD_F(0x06327934) /* 0.387322621 */, 14 }, | 784 | /* 711 */ { MAD_F(0x06327934) /* 0.387322621 */, 14 }, |
785 | /* 712 */ { MAD_F(0x06357302) /* 0.388049134 */, 14 }, | 785 | /* 712 */ { MAD_F(0x06357302) /* 0.388049134 */, 14 }, |
786 | /* 713 */ { MAD_F(0x06386d2b) /* 0.388775988 */, 14 }, | 786 | /* 713 */ { MAD_F(0x06386d2b) /* 0.388775988 */, 14 }, |
787 | /* 714 */ { MAD_F(0x063b67b0) /* 0.389503182 */, 14 }, | 787 | /* 714 */ { MAD_F(0x063b67b0) /* 0.389503182 */, 14 }, |
788 | /* 715 */ { MAD_F(0x063e6290) /* 0.390230715 */, 14 }, | 788 | /* 715 */ { MAD_F(0x063e6290) /* 0.390230715 */, 14 }, |
789 | /* 716 */ { MAD_F(0x06415dcb) /* 0.390958588 */, 14 }, | 789 | /* 716 */ { MAD_F(0x06415dcb) /* 0.390958588 */, 14 }, |
790 | /* 717 */ { MAD_F(0x06445960) /* 0.391686799 */, 14 }, | 790 | /* 717 */ { MAD_F(0x06445960) /* 0.391686799 */, 14 }, |
791 | /* 718 */ { MAD_F(0x06475551) /* 0.392415349 */, 14 }, | 791 | /* 718 */ { MAD_F(0x06475551) /* 0.392415349 */, 14 }, |
792 | /* 719 */ { MAD_F(0x064a519c) /* 0.393144238 */, 14 }, | 792 | /* 719 */ { MAD_F(0x064a519c) /* 0.393144238 */, 14 }, |
793 | 793 | ||
794 | /* 720 */ { MAD_F(0x064d4e43) /* 0.393873464 */, 14 }, | 794 | /* 720 */ { MAD_F(0x064d4e43) /* 0.393873464 */, 14 }, |
795 | /* 721 */ { MAD_F(0x06504b44) /* 0.394603028 */, 14 }, | 795 | /* 721 */ { MAD_F(0x06504b44) /* 0.394603028 */, 14 }, |
796 | /* 722 */ { MAD_F(0x0653489f) /* 0.395332930 */, 14 }, | 796 | /* 722 */ { MAD_F(0x0653489f) /* 0.395332930 */, 14 }, |
797 | /* 723 */ { MAD_F(0x06564655) /* 0.396063168 */, 14 }, | 797 | /* 723 */ { MAD_F(0x06564655) /* 0.396063168 */, 14 }, |
798 | /* 724 */ { MAD_F(0x06594465) /* 0.396793743 */, 14 }, | 798 | /* 724 */ { MAD_F(0x06594465) /* 0.396793743 */, 14 }, |
799 | /* 725 */ { MAD_F(0x065c42d0) /* 0.397524655 */, 14 }, | 799 | /* 725 */ { MAD_F(0x065c42d0) /* 0.397524655 */, 14 }, |
800 | /* 726 */ { MAD_F(0x065f4195) /* 0.398255903 */, 14 }, | 800 | /* 726 */ { MAD_F(0x065f4195) /* 0.398255903 */, 14 }, |
801 | /* 727 */ { MAD_F(0x066240b4) /* 0.398987487 */, 14 }, | 801 | /* 727 */ { MAD_F(0x066240b4) /* 0.398987487 */, 14 }, |
802 | /* 728 */ { MAD_F(0x0665402d) /* 0.399719406 */, 14 }, | 802 | /* 728 */ { MAD_F(0x0665402d) /* 0.399719406 */, 14 }, |
803 | /* 729 */ { MAD_F(0x06684000) /* 0.400451660 */, 14 }, | 803 | /* 729 */ { MAD_F(0x06684000) /* 0.400451660 */, 14 }, |
804 | /* 730 */ { MAD_F(0x066b402d) /* 0.401184249 */, 14 }, | 804 | /* 730 */ { MAD_F(0x066b402d) /* 0.401184249 */, 14 }, |
805 | /* 731 */ { MAD_F(0x066e40b3) /* 0.401917173 */, 14 }, | 805 | /* 731 */ { MAD_F(0x066e40b3) /* 0.401917173 */, 14 }, |
806 | /* 732 */ { MAD_F(0x06714194) /* 0.402650431 */, 14 }, | 806 | /* 732 */ { MAD_F(0x06714194) /* 0.402650431 */, 14 }, |
807 | /* 733 */ { MAD_F(0x067442ce) /* 0.403384024 */, 14 }, | 807 | /* 733 */ { MAD_F(0x067442ce) /* 0.403384024 */, 14 }, |
808 | /* 734 */ { MAD_F(0x06774462) /* 0.404117949 */, 14 }, | 808 | /* 734 */ { MAD_F(0x06774462) /* 0.404117949 */, 14 }, |
809 | /* 735 */ { MAD_F(0x067a464f) /* 0.404852209 */, 14 }, | 809 | /* 735 */ { MAD_F(0x067a464f) /* 0.404852209 */, 14 }, |
810 | 810 | ||
811 | /* 736 */ { MAD_F(0x067d4896) /* 0.405586801 */, 14 }, | 811 | /* 736 */ { MAD_F(0x067d4896) /* 0.405586801 */, 14 }, |
812 | /* 737 */ { MAD_F(0x06804b36) /* 0.406321726 */, 14 }, | 812 | /* 737 */ { MAD_F(0x06804b36) /* 0.406321726 */, 14 }, |
813 | /* 738 */ { MAD_F(0x06834e2f) /* 0.407056983 */, 14 }, | 813 | /* 738 */ { MAD_F(0x06834e2f) /* 0.407056983 */, 14 }, |
814 | /* 739 */ { MAD_F(0x06865181) /* 0.407792573 */, 14 }, | 814 | /* 739 */ { MAD_F(0x06865181) /* 0.407792573 */, 14 }, |
815 | /* 740 */ { MAD_F(0x0689552c) /* 0.408528495 */, 14 }, | 815 | /* 740 */ { MAD_F(0x0689552c) /* 0.408528495 */, 14 }, |
816 | /* 741 */ { MAD_F(0x068c5931) /* 0.409264748 */, 14 }, | 816 | /* 741 */ { MAD_F(0x068c5931) /* 0.409264748 */, 14 }, |
817 | /* 742 */ { MAD_F(0x068f5d8e) /* 0.410001332 */, 14 }, | 817 | /* 742 */ { MAD_F(0x068f5d8e) /* 0.410001332 */, 14 }, |
818 | /* 743 */ { MAD_F(0x06926245) /* 0.410738247 */, 14 }, | 818 | /* 743 */ { MAD_F(0x06926245) /* 0.410738247 */, 14 }, |
819 | /* 744 */ { MAD_F(0x06956753) /* 0.411475493 */, 14 }, | 819 | /* 744 */ { MAD_F(0x06956753) /* 0.411475493 */, 14 }, |
820 | /* 745 */ { MAD_F(0x06986cbb) /* 0.412213070 */, 14 }, | 820 | /* 745 */ { MAD_F(0x06986cbb) /* 0.412213070 */, 14 }, |
821 | /* 746 */ { MAD_F(0x069b727b) /* 0.412950976 */, 14 }, | 821 | /* 746 */ { MAD_F(0x069b727b) /* 0.412950976 */, 14 }, |
822 | /* 747 */ { MAD_F(0x069e7894) /* 0.413689213 */, 14 }, | 822 | /* 747 */ { MAD_F(0x069e7894) /* 0.413689213 */, 14 }, |
823 | /* 748 */ { MAD_F(0x06a17f05) /* 0.414427779 */, 14 }, | 823 | /* 748 */ { MAD_F(0x06a17f05) /* 0.414427779 */, 14 }, |
824 | /* 749 */ { MAD_F(0x06a485cf) /* 0.415166674 */, 14 }, | 824 | /* 749 */ { MAD_F(0x06a485cf) /* 0.415166674 */, 14 }, |
825 | /* 750 */ { MAD_F(0x06a78cf1) /* 0.415905897 */, 14 }, | 825 | /* 750 */ { MAD_F(0x06a78cf1) /* 0.415905897 */, 14 }, |
826 | /* 751 */ { MAD_F(0x06aa946b) /* 0.416645450 */, 14 }, | 826 | /* 751 */ { MAD_F(0x06aa946b) /* 0.416645450 */, 14 }, |
827 | 827 | ||
828 | /* 752 */ { MAD_F(0x06ad9c3d) /* 0.417385331 */, 14 }, | 828 | /* 752 */ { MAD_F(0x06ad9c3d) /* 0.417385331 */, 14 }, |
829 | /* 753 */ { MAD_F(0x06b0a468) /* 0.418125540 */, 14 }, | 829 | /* 753 */ { MAD_F(0x06b0a468) /* 0.418125540 */, 14 }, |
830 | /* 754 */ { MAD_F(0x06b3acea) /* 0.418866076 */, 14 }, | 830 | /* 754 */ { MAD_F(0x06b3acea) /* 0.418866076 */, 14 }, |
831 | /* 755 */ { MAD_F(0x06b6b5c4) /* 0.419606940 */, 14 }, | 831 | /* 755 */ { MAD_F(0x06b6b5c4) /* 0.419606940 */, 14 }, |
832 | /* 756 */ { MAD_F(0x06b9bef6) /* 0.420348132 */, 14 }, | 832 | /* 756 */ { MAD_F(0x06b9bef6) /* 0.420348132 */, 14 }, |
833 | /* 757 */ { MAD_F(0x06bcc880) /* 0.421089650 */, 14 }, | 833 | /* 757 */ { MAD_F(0x06bcc880) /* 0.421089650 */, 14 }, |
834 | /* 758 */ { MAD_F(0x06bfd261) /* 0.421831494 */, 14 }, | 834 | /* 758 */ { MAD_F(0x06bfd261) /* 0.421831494 */, 14 }, |
835 | /* 759 */ { MAD_F(0x06c2dc9a) /* 0.422573665 */, 14 }, | 835 | /* 759 */ { MAD_F(0x06c2dc9a) /* 0.422573665 */, 14 }, |
836 | /* 760 */ { MAD_F(0x06c5e72b) /* 0.423316162 */, 14 }, | 836 | /* 760 */ { MAD_F(0x06c5e72b) /* 0.423316162 */, 14 }, |
837 | /* 761 */ { MAD_F(0x06c8f213) /* 0.424058985 */, 14 }, | 837 | /* 761 */ { MAD_F(0x06c8f213) /* 0.424058985 */, 14 }, |
838 | /* 762 */ { MAD_F(0x06cbfd52) /* 0.424802133 */, 14 }, | 838 | /* 762 */ { MAD_F(0x06cbfd52) /* 0.424802133 */, 14 }, |
839 | /* 763 */ { MAD_F(0x06cf08e9) /* 0.425545607 */, 14 }, | 839 | /* 763 */ { MAD_F(0x06cf08e9) /* 0.425545607 */, 14 }, |
840 | /* 764 */ { MAD_F(0x06d214d7) /* 0.426289405 */, 14 }, | 840 | /* 764 */ { MAD_F(0x06d214d7) /* 0.426289405 */, 14 }, |
841 | /* 765 */ { MAD_F(0x06d5211c) /* 0.427033528 */, 14 }, | 841 | /* 765 */ { MAD_F(0x06d5211c) /* 0.427033528 */, 14 }, |
842 | /* 766 */ { MAD_F(0x06d82db8) /* 0.427777975 */, 14 }, | 842 | /* 766 */ { MAD_F(0x06d82db8) /* 0.427777975 */, 14 }, |
843 | /* 767 */ { MAD_F(0x06db3aaa) /* 0.428522746 */, 14 }, | 843 | /* 767 */ { MAD_F(0x06db3aaa) /* 0.428522746 */, 14 }, |
844 | 844 | ||
845 | /* 768 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 14 }, | 845 | /* 768 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 14 }, |
846 | /* 769 */ { MAD_F(0x06e15595) /* 0.430013259 */, 14 }, | 846 | /* 769 */ { MAD_F(0x06e15595) /* 0.430013259 */, 14 }, |
847 | /* 770 */ { MAD_F(0x06e4638d) /* 0.430759001 */, 14 }, | 847 | /* 770 */ { MAD_F(0x06e4638d) /* 0.430759001 */, 14 }, |
848 | /* 771 */ { MAD_F(0x06e771db) /* 0.431505065 */, 14 }, | 848 | /* 771 */ { MAD_F(0x06e771db) /* 0.431505065 */, 14 }, |
849 | /* 772 */ { MAD_F(0x06ea807f) /* 0.432251452 */, 14 }, | 849 | /* 772 */ { MAD_F(0x06ea807f) /* 0.432251452 */, 14 }, |
850 | /* 773 */ { MAD_F(0x06ed8f7b) /* 0.432998162 */, 14 }, | 850 | /* 773 */ { MAD_F(0x06ed8f7b) /* 0.432998162 */, 14 }, |
851 | /* 774 */ { MAD_F(0x06f09ecc) /* 0.433745193 */, 14 }, | 851 | /* 774 */ { MAD_F(0x06f09ecc) /* 0.433745193 */, 14 }, |
852 | /* 775 */ { MAD_F(0x06f3ae75) /* 0.434492546 */, 14 }, | 852 | /* 775 */ { MAD_F(0x06f3ae75) /* 0.434492546 */, 14 }, |
853 | /* 776 */ { MAD_F(0x06f6be73) /* 0.435240221 */, 14 }, | 853 | /* 776 */ { MAD_F(0x06f6be73) /* 0.435240221 */, 14 }, |
854 | /* 777 */ { MAD_F(0x06f9cec8) /* 0.435988217 */, 14 }, | 854 | /* 777 */ { MAD_F(0x06f9cec8) /* 0.435988217 */, 14 }, |
855 | /* 778 */ { MAD_F(0x06fcdf72) /* 0.436736534 */, 14 }, | 855 | /* 778 */ { MAD_F(0x06fcdf72) /* 0.436736534 */, 14 }, |
856 | /* 779 */ { MAD_F(0x06fff073) /* 0.437485172 */, 14 }, | 856 | /* 779 */ { MAD_F(0x06fff073) /* 0.437485172 */, 14 }, |
857 | /* 780 */ { MAD_F(0x070301ca) /* 0.438234130 */, 14 }, | 857 | /* 780 */ { MAD_F(0x070301ca) /* 0.438234130 */, 14 }, |
858 | /* 781 */ { MAD_F(0x07061377) /* 0.438983408 */, 14 }, | 858 | /* 781 */ { MAD_F(0x07061377) /* 0.438983408 */, 14 }, |
859 | /* 782 */ { MAD_F(0x0709257a) /* 0.439733006 */, 14 }, | 859 | /* 782 */ { MAD_F(0x0709257a) /* 0.439733006 */, 14 }, |
860 | /* 783 */ { MAD_F(0x070c37d2) /* 0.440482924 */, 14 }, | 860 | /* 783 */ { MAD_F(0x070c37d2) /* 0.440482924 */, 14 }, |
861 | 861 | ||
862 | /* 784 */ { MAD_F(0x070f4a80) /* 0.441233161 */, 14 }, | 862 | /* 784 */ { MAD_F(0x070f4a80) /* 0.441233161 */, 14 }, |
863 | /* 785 */ { MAD_F(0x07125d84) /* 0.441983717 */, 14 }, | 863 | /* 785 */ { MAD_F(0x07125d84) /* 0.441983717 */, 14 }, |
864 | /* 786 */ { MAD_F(0x071570de) /* 0.442734592 */, 14 }, | 864 | /* 786 */ { MAD_F(0x071570de) /* 0.442734592 */, 14 }, |
865 | /* 787 */ { MAD_F(0x0718848d) /* 0.443485785 */, 14 }, | 865 | /* 787 */ { MAD_F(0x0718848d) /* 0.443485785 */, 14 }, |
866 | /* 788 */ { MAD_F(0x071b9891) /* 0.444237296 */, 14 }, | 866 | /* 788 */ { MAD_F(0x071b9891) /* 0.444237296 */, 14 }, |
867 | /* 789 */ { MAD_F(0x071eaceb) /* 0.444989126 */, 14 }, | 867 | /* 789 */ { MAD_F(0x071eaceb) /* 0.444989126 */, 14 }, |
868 | /* 790 */ { MAD_F(0x0721c19a) /* 0.445741273 */, 14 }, | 868 | /* 790 */ { MAD_F(0x0721c19a) /* 0.445741273 */, 14 }, |
869 | /* 791 */ { MAD_F(0x0724d69e) /* 0.446493738 */, 14 }, | 869 | /* 791 */ { MAD_F(0x0724d69e) /* 0.446493738 */, 14 }, |
870 | /* 792 */ { MAD_F(0x0727ebf7) /* 0.447246519 */, 14 }, | 870 | /* 792 */ { MAD_F(0x0727ebf7) /* 0.447246519 */, 14 }, |
871 | /* 793 */ { MAD_F(0x072b01a6) /* 0.447999618 */, 14 }, | 871 | /* 793 */ { MAD_F(0x072b01a6) /* 0.447999618 */, 14 }, |
872 | /* 794 */ { MAD_F(0x072e17a9) /* 0.448753033 */, 14 }, | 872 | /* 794 */ { MAD_F(0x072e17a9) /* 0.448753033 */, 14 }, |
873 | /* 795 */ { MAD_F(0x07312e01) /* 0.449506765 */, 14 }, | 873 | /* 795 */ { MAD_F(0x07312e01) /* 0.449506765 */, 14 }, |
874 | /* 796 */ { MAD_F(0x073444ae) /* 0.450260813 */, 14 }, | 874 | /* 796 */ { MAD_F(0x073444ae) /* 0.450260813 */, 14 }, |
875 | /* 797 */ { MAD_F(0x07375bb0) /* 0.451015176 */, 14 }, | 875 | /* 797 */ { MAD_F(0x07375bb0) /* 0.451015176 */, 14 }, |
876 | /* 798 */ { MAD_F(0x073a7307) /* 0.451769856 */, 14 }, | 876 | /* 798 */ { MAD_F(0x073a7307) /* 0.451769856 */, 14 }, |
877 | /* 799 */ { MAD_F(0x073d8ab2) /* 0.452524850 */, 14 }, | 877 | /* 799 */ { MAD_F(0x073d8ab2) /* 0.452524850 */, 14 }, |
878 | 878 | ||
879 | /* 800 */ { MAD_F(0x0740a2b2) /* 0.453280160 */, 14 }, | 879 | /* 800 */ { MAD_F(0x0740a2b2) /* 0.453280160 */, 14 }, |
880 | /* 801 */ { MAD_F(0x0743bb06) /* 0.454035784 */, 14 }, | 880 | /* 801 */ { MAD_F(0x0743bb06) /* 0.454035784 */, 14 }, |
881 | /* 802 */ { MAD_F(0x0746d3af) /* 0.454791723 */, 14 }, | 881 | /* 802 */ { MAD_F(0x0746d3af) /* 0.454791723 */, 14 }, |
882 | /* 803 */ { MAD_F(0x0749ecac) /* 0.455547976 */, 14 }, | 882 | /* 803 */ { MAD_F(0x0749ecac) /* 0.455547976 */, 14 }, |
883 | /* 804 */ { MAD_F(0x074d05fe) /* 0.456304543 */, 14 }, | 883 | /* 804 */ { MAD_F(0x074d05fe) /* 0.456304543 */, 14 }, |
884 | /* 805 */ { MAD_F(0x07501fa3) /* 0.457061423 */, 14 }, | 884 | /* 805 */ { MAD_F(0x07501fa3) /* 0.457061423 */, 14 }, |
885 | /* 806 */ { MAD_F(0x0753399d) /* 0.457818618 */, 14 }, | 885 | /* 806 */ { MAD_F(0x0753399d) /* 0.457818618 */, 14 }, |
886 | /* 807 */ { MAD_F(0x075653eb) /* 0.458576125 */, 14 }, | 886 | /* 807 */ { MAD_F(0x075653eb) /* 0.458576125 */, 14 }, |
887 | /* 808 */ { MAD_F(0x07596e8d) /* 0.459333946 */, 14 }, | 887 | /* 808 */ { MAD_F(0x07596e8d) /* 0.459333946 */, 14 }, |
888 | /* 809 */ { MAD_F(0x075c8983) /* 0.460092079 */, 14 }, | 888 | /* 809 */ { MAD_F(0x075c8983) /* 0.460092079 */, 14 }, |
889 | /* 810 */ { MAD_F(0x075fa4cc) /* 0.460850524 */, 14 }, | 889 | /* 810 */ { MAD_F(0x075fa4cc) /* 0.460850524 */, 14 }, |
890 | /* 811 */ { MAD_F(0x0762c06a) /* 0.461609282 */, 14 }, | 890 | /* 811 */ { MAD_F(0x0762c06a) /* 0.461609282 */, 14 }, |
891 | /* 812 */ { MAD_F(0x0765dc5b) /* 0.462368352 */, 14 }, | 891 | /* 812 */ { MAD_F(0x0765dc5b) /* 0.462368352 */, 14 }, |
892 | /* 813 */ { MAD_F(0x0768f8a0) /* 0.463127733 */, 14 }, | 892 | /* 813 */ { MAD_F(0x0768f8a0) /* 0.463127733 */, 14 }, |
893 | /* 814 */ { MAD_F(0x076c1538) /* 0.463887426 */, 14 }, | 893 | /* 814 */ { MAD_F(0x076c1538) /* 0.463887426 */, 14 }, |
894 | /* 815 */ { MAD_F(0x076f3224) /* 0.464647430 */, 14 }, | 894 | /* 815 */ { MAD_F(0x076f3224) /* 0.464647430 */, 14 }, |
895 | 895 | ||
896 | /* 816 */ { MAD_F(0x07724f64) /* 0.465407744 */, 14 }, | 896 | /* 816 */ { MAD_F(0x07724f64) /* 0.465407744 */, 14 }, |
897 | /* 817 */ { MAD_F(0x07756cf7) /* 0.466168370 */, 14 }, | 897 | /* 817 */ { MAD_F(0x07756cf7) /* 0.466168370 */, 14 }, |
898 | /* 818 */ { MAD_F(0x07788add) /* 0.466929306 */, 14 }, | 898 | /* 818 */ { MAD_F(0x07788add) /* 0.466929306 */, 14 }, |
899 | /* 819 */ { MAD_F(0x077ba916) /* 0.467690552 */, 14 }, | 899 | /* 819 */ { MAD_F(0x077ba916) /* 0.467690552 */, 14 }, |
900 | /* 820 */ { MAD_F(0x077ec7a3) /* 0.468452108 */, 14 }, | 900 | /* 820 */ { MAD_F(0x077ec7a3) /* 0.468452108 */, 14 }, |
901 | /* 821 */ { MAD_F(0x0781e683) /* 0.469213973 */, 14 }, | 901 | /* 821 */ { MAD_F(0x0781e683) /* 0.469213973 */, 14 }, |
902 | /* 822 */ { MAD_F(0x078505b5) /* 0.469976148 */, 14 }, | 902 | /* 822 */ { MAD_F(0x078505b5) /* 0.469976148 */, 14 }, |
903 | /* 823 */ { MAD_F(0x0788253b) /* 0.470738632 */, 14 }, | 903 | /* 823 */ { MAD_F(0x0788253b) /* 0.470738632 */, 14 }, |
904 | /* 824 */ { MAD_F(0x078b4514) /* 0.471501425 */, 14 }, | 904 | /* 824 */ { MAD_F(0x078b4514) /* 0.471501425 */, 14 }, |
905 | /* 825 */ { MAD_F(0x078e653f) /* 0.472264527 */, 14 }, | 905 | /* 825 */ { MAD_F(0x078e653f) /* 0.472264527 */, 14 }, |
906 | /* 826 */ { MAD_F(0x079185be) /* 0.473027937 */, 14 }, | 906 | /* 826 */ { MAD_F(0x079185be) /* 0.473027937 */, 14 }, |
907 | /* 827 */ { MAD_F(0x0794a68f) /* 0.473791655 */, 14 }, | 907 | /* 827 */ { MAD_F(0x0794a68f) /* 0.473791655 */, 14 }, |
908 | /* 828 */ { MAD_F(0x0797c7b2) /* 0.474555681 */, 14 }, | 908 | /* 828 */ { MAD_F(0x0797c7b2) /* 0.474555681 */, 14 }, |
909 | /* 829 */ { MAD_F(0x079ae929) /* 0.475320014 */, 14 }, | 909 | /* 829 */ { MAD_F(0x079ae929) /* 0.475320014 */, 14 }, |
910 | /* 830 */ { MAD_F(0x079e0af1) /* 0.476084655 */, 14 }, | 910 | /* 830 */ { MAD_F(0x079e0af1) /* 0.476084655 */, 14 }, |
911 | /* 831 */ { MAD_F(0x07a12d0c) /* 0.476849603 */, 14 }, | 911 | /* 831 */ { MAD_F(0x07a12d0c) /* 0.476849603 */, 14 }, |
912 | 912 | ||
913 | /* 832 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 14 }, | 913 | /* 832 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 14 }, |
914 | /* 833 */ { MAD_F(0x07a7723a) /* 0.478380420 */, 14 }, | 914 | /* 833 */ { MAD_F(0x07a7723a) /* 0.478380420 */, 14 }, |
915 | /* 834 */ { MAD_F(0x07aa954c) /* 0.479146288 */, 14 }, | 915 | /* 834 */ { MAD_F(0x07aa954c) /* 0.479146288 */, 14 }, |
916 | /* 835 */ { MAD_F(0x07adb8b0) /* 0.479912463 */, 14 }, | 916 | /* 835 */ { MAD_F(0x07adb8b0) /* 0.479912463 */, 14 }, |
917 | /* 836 */ { MAD_F(0x07b0dc67) /* 0.480678943 */, 14 }, | 917 | /* 836 */ { MAD_F(0x07b0dc67) /* 0.480678943 */, 14 }, |
918 | /* 837 */ { MAD_F(0x07b4006f) /* 0.481445729 */, 14 }, | 918 | /* 837 */ { MAD_F(0x07b4006f) /* 0.481445729 */, 14 }, |
919 | /* 838 */ { MAD_F(0x07b724ca) /* 0.482212820 */, 14 }, | 919 | /* 838 */ { MAD_F(0x07b724ca) /* 0.482212820 */, 14 }, |
920 | /* 839 */ { MAD_F(0x07ba4976) /* 0.482980216 */, 14 }, | 920 | /* 839 */ { MAD_F(0x07ba4976) /* 0.482980216 */, 14 }, |
921 | /* 840 */ { MAD_F(0x07bd6e75) /* 0.483747918 */, 14 }, | 921 | /* 840 */ { MAD_F(0x07bd6e75) /* 0.483747918 */, 14 }, |
922 | /* 841 */ { MAD_F(0x07c093c5) /* 0.484515924 */, 14 }, | 922 | /* 841 */ { MAD_F(0x07c093c5) /* 0.484515924 */, 14 }, |
923 | /* 842 */ { MAD_F(0x07c3b967) /* 0.485284235 */, 14 }, | 923 | /* 842 */ { MAD_F(0x07c3b967) /* 0.485284235 */, 14 }, |
924 | /* 843 */ { MAD_F(0x07c6df5a) /* 0.486052849 */, 14 }, | 924 | /* 843 */ { MAD_F(0x07c6df5a) /* 0.486052849 */, 14 }, |
925 | /* 844 */ { MAD_F(0x07ca059f) /* 0.486821768 */, 14 }, | 925 | /* 844 */ { MAD_F(0x07ca059f) /* 0.486821768 */, 14 }, |
926 | /* 845 */ { MAD_F(0x07cd2c36) /* 0.487590991 */, 14 }, | 926 | /* 845 */ { MAD_F(0x07cd2c36) /* 0.487590991 */, 14 }, |
927 | /* 846 */ { MAD_F(0x07d0531e) /* 0.488360517 */, 14 }, | 927 | /* 846 */ { MAD_F(0x07d0531e) /* 0.488360517 */, 14 }, |
928 | /* 847 */ { MAD_F(0x07d37a57) /* 0.489130346 */, 14 }, | 928 | /* 847 */ { MAD_F(0x07d37a57) /* 0.489130346 */, 14 }, |
929 | 929 | ||
930 | /* 848 */ { MAD_F(0x07d6a1e2) /* 0.489900479 */, 14 }, | 930 | /* 848 */ { MAD_F(0x07d6a1e2) /* 0.489900479 */, 14 }, |
931 | /* 849 */ { MAD_F(0x07d9c9be) /* 0.490670914 */, 14 }, | 931 | /* 849 */ { MAD_F(0x07d9c9be) /* 0.490670914 */, 14 }, |
932 | /* 850 */ { MAD_F(0x07dcf1ec) /* 0.491441651 */, 14 }, | 932 | /* 850 */ { MAD_F(0x07dcf1ec) /* 0.491441651 */, 14 }, |
933 | /* 851 */ { MAD_F(0x07e01a6a) /* 0.492212691 */, 14 }, | 933 | /* 851 */ { MAD_F(0x07e01a6a) /* 0.492212691 */, 14 }, |
934 | /* 852 */ { MAD_F(0x07e3433a) /* 0.492984033 */, 14 }, | 934 | /* 852 */ { MAD_F(0x07e3433a) /* 0.492984033 */, 14 }, |
935 | /* 853 */ { MAD_F(0x07e66c5a) /* 0.493755677 */, 14 }, | 935 | /* 853 */ { MAD_F(0x07e66c5a) /* 0.493755677 */, 14 }, |
936 | /* 854 */ { MAD_F(0x07e995cc) /* 0.494527623 */, 14 }, | 936 | /* 854 */ { MAD_F(0x07e995cc) /* 0.494527623 */, 14 }, |
937 | /* 855 */ { MAD_F(0x07ecbf8e) /* 0.495299870 */, 14 }, | 937 | /* 855 */ { MAD_F(0x07ecbf8e) /* 0.495299870 */, 14 }, |
938 | /* 856 */ { MAD_F(0x07efe9a1) /* 0.496072418 */, 14 }, | 938 | /* 856 */ { MAD_F(0x07efe9a1) /* 0.496072418 */, 14 }, |
939 | /* 857 */ { MAD_F(0x07f31405) /* 0.496845266 */, 14 }, | 939 | /* 857 */ { MAD_F(0x07f31405) /* 0.496845266 */, 14 }, |
940 | /* 858 */ { MAD_F(0x07f63eba) /* 0.497618416 */, 14 }, | 940 | /* 858 */ { MAD_F(0x07f63eba) /* 0.497618416 */, 14 }, |
941 | /* 859 */ { MAD_F(0x07f969c0) /* 0.498391866 */, 14 }, | 941 | /* 859 */ { MAD_F(0x07f969c0) /* 0.498391866 */, 14 }, |
942 | /* 860 */ { MAD_F(0x07fc9516) /* 0.499165616 */, 14 }, | 942 | /* 860 */ { MAD_F(0x07fc9516) /* 0.499165616 */, 14 }, |
943 | /* 861 */ { MAD_F(0x07ffc0bc) /* 0.499939666 */, 14 }, | 943 | /* 861 */ { MAD_F(0x07ffc0bc) /* 0.499939666 */, 14 }, |
944 | /* 862 */ { MAD_F(0x04017659) /* 0.250357008 */, 15 }, | 944 | /* 862 */ { MAD_F(0x04017659) /* 0.250357008 */, 15 }, |
945 | /* 863 */ { MAD_F(0x04030c7d) /* 0.250744333 */, 15 }, | 945 | /* 863 */ { MAD_F(0x04030c7d) /* 0.250744333 */, 15 }, |
946 | 946 | ||
947 | /* 864 */ { MAD_F(0x0404a2c9) /* 0.251131807 */, 15 }, | 947 | /* 864 */ { MAD_F(0x0404a2c9) /* 0.251131807 */, 15 }, |
948 | /* 865 */ { MAD_F(0x0406393d) /* 0.251519431 */, 15 }, | 948 | /* 865 */ { MAD_F(0x0406393d) /* 0.251519431 */, 15 }, |
949 | /* 866 */ { MAD_F(0x0407cfd9) /* 0.251907204 */, 15 }, | 949 | /* 866 */ { MAD_F(0x0407cfd9) /* 0.251907204 */, 15 }, |
950 | /* 867 */ { MAD_F(0x0409669d) /* 0.252295127 */, 15 }, | 950 | /* 867 */ { MAD_F(0x0409669d) /* 0.252295127 */, 15 }, |
951 | /* 868 */ { MAD_F(0x040afd89) /* 0.252683198 */, 15 }, | 951 | /* 868 */ { MAD_F(0x040afd89) /* 0.252683198 */, 15 }, |
952 | /* 869 */ { MAD_F(0x040c949e) /* 0.253071419 */, 15 }, | 952 | /* 869 */ { MAD_F(0x040c949e) /* 0.253071419 */, 15 }, |
953 | /* 870 */ { MAD_F(0x040e2bda) /* 0.253459789 */, 15 }, | 953 | /* 870 */ { MAD_F(0x040e2bda) /* 0.253459789 */, 15 }, |
954 | /* 871 */ { MAD_F(0x040fc33e) /* 0.253848307 */, 15 }, | 954 | /* 871 */ { MAD_F(0x040fc33e) /* 0.253848307 */, 15 }, |
955 | /* 872 */ { MAD_F(0x04115aca) /* 0.254236974 */, 15 }, | 955 | /* 872 */ { MAD_F(0x04115aca) /* 0.254236974 */, 15 }, |
956 | /* 873 */ { MAD_F(0x0412f27e) /* 0.254625790 */, 15 }, | 956 | /* 873 */ { MAD_F(0x0412f27e) /* 0.254625790 */, 15 }, |
957 | /* 874 */ { MAD_F(0x04148a5a) /* 0.255014755 */, 15 }, | 957 | /* 874 */ { MAD_F(0x04148a5a) /* 0.255014755 */, 15 }, |
958 | /* 875 */ { MAD_F(0x0416225d) /* 0.255403867 */, 15 }, | 958 | /* 875 */ { MAD_F(0x0416225d) /* 0.255403867 */, 15 }, |
959 | /* 876 */ { MAD_F(0x0417ba89) /* 0.255793128 */, 15 }, | 959 | /* 876 */ { MAD_F(0x0417ba89) /* 0.255793128 */, 15 }, |
960 | /* 877 */ { MAD_F(0x041952dc) /* 0.256182537 */, 15 }, | 960 | /* 877 */ { MAD_F(0x041952dc) /* 0.256182537 */, 15 }, |
961 | /* 878 */ { MAD_F(0x041aeb57) /* 0.256572095 */, 15 }, | 961 | /* 878 */ { MAD_F(0x041aeb57) /* 0.256572095 */, 15 }, |
962 | /* 879 */ { MAD_F(0x041c83fa) /* 0.256961800 */, 15 }, | 962 | /* 879 */ { MAD_F(0x041c83fa) /* 0.256961800 */, 15 }, |
963 | 963 | ||
964 | /* 880 */ { MAD_F(0x041e1cc4) /* 0.257351652 */, 15 }, | 964 | /* 880 */ { MAD_F(0x041e1cc4) /* 0.257351652 */, 15 }, |
965 | /* 881 */ { MAD_F(0x041fb5b6) /* 0.257741653 */, 15 }, | 965 | /* 881 */ { MAD_F(0x041fb5b6) /* 0.257741653 */, 15 }, |
966 | /* 882 */ { MAD_F(0x04214ed0) /* 0.258131801 */, 15 }, | 966 | /* 882 */ { MAD_F(0x04214ed0) /* 0.258131801 */, 15 }, |
967 | /* 883 */ { MAD_F(0x0422e811) /* 0.258522097 */, 15 }, | 967 | /* 883 */ { MAD_F(0x0422e811) /* 0.258522097 */, 15 }, |
968 | /* 884 */ { MAD_F(0x04248179) /* 0.258912540 */, 15 }, | 968 | /* 884 */ { MAD_F(0x04248179) /* 0.258912540 */, 15 }, |
969 | /* 885 */ { MAD_F(0x04261b0a) /* 0.259303130 */, 15 }, | 969 | /* 885 */ { MAD_F(0x04261b0a) /* 0.259303130 */, 15 }, |
970 | /* 886 */ { MAD_F(0x0427b4c2) /* 0.259693868 */, 15 }, | 970 | /* 886 */ { MAD_F(0x0427b4c2) /* 0.259693868 */, 15 }, |
971 | /* 887 */ { MAD_F(0x04294ea1) /* 0.260084752 */, 15 }, | 971 | /* 887 */ { MAD_F(0x04294ea1) /* 0.260084752 */, 15 }, |
972 | /* 888 */ { MAD_F(0x042ae8a7) /* 0.260475783 */, 15 }, | 972 | /* 888 */ { MAD_F(0x042ae8a7) /* 0.260475783 */, 15 }, |
973 | /* 889 */ { MAD_F(0x042c82d6) /* 0.260866961 */, 15 }, | 973 | /* 889 */ { MAD_F(0x042c82d6) /* 0.260866961 */, 15 }, |
974 | /* 890 */ { MAD_F(0x042e1d2b) /* 0.261258286 */, 15 }, | 974 | /* 890 */ { MAD_F(0x042e1d2b) /* 0.261258286 */, 15 }, |
975 | /* 891 */ { MAD_F(0x042fb7a8) /* 0.261649758 */, 15 }, | 975 | /* 891 */ { MAD_F(0x042fb7a8) /* 0.261649758 */, 15 }, |
976 | /* 892 */ { MAD_F(0x0431524c) /* 0.262041376 */, 15 }, | 976 | /* 892 */ { MAD_F(0x0431524c) /* 0.262041376 */, 15 }, |
977 | /* 893 */ { MAD_F(0x0432ed17) /* 0.262433140 */, 15 }, | 977 | /* 893 */ { MAD_F(0x0432ed17) /* 0.262433140 */, 15 }, |
978 | /* 894 */ { MAD_F(0x0434880a) /* 0.262825051 */, 15 }, | 978 | /* 894 */ { MAD_F(0x0434880a) /* 0.262825051 */, 15 }, |
979 | /* 895 */ { MAD_F(0x04362324) /* 0.263217107 */, 15 }, | 979 | /* 895 */ { MAD_F(0x04362324) /* 0.263217107 */, 15 }, |
980 | 980 | ||
981 | /* 896 */ { MAD_F(0x0437be65) /* 0.263609310 */, 15 }, | 981 | /* 896 */ { MAD_F(0x0437be65) /* 0.263609310 */, 15 }, |
982 | /* 897 */ { MAD_F(0x043959cd) /* 0.264001659 */, 15 }, | 982 | /* 897 */ { MAD_F(0x043959cd) /* 0.264001659 */, 15 }, |
983 | /* 898 */ { MAD_F(0x043af55d) /* 0.264394153 */, 15 }, | 983 | /* 898 */ { MAD_F(0x043af55d) /* 0.264394153 */, 15 }, |
984 | /* 899 */ { MAD_F(0x043c9113) /* 0.264786794 */, 15 }, | 984 | /* 899 */ { MAD_F(0x043c9113) /* 0.264786794 */, 15 }, |
985 | /* 900 */ { MAD_F(0x043e2cf1) /* 0.265179580 */, 15 }, | 985 | /* 900 */ { MAD_F(0x043e2cf1) /* 0.265179580 */, 15 }, |
986 | /* 901 */ { MAD_F(0x043fc8f6) /* 0.265572511 */, 15 }, | 986 | /* 901 */ { MAD_F(0x043fc8f6) /* 0.265572511 */, 15 }, |
987 | /* 902 */ { MAD_F(0x04416522) /* 0.265965588 */, 15 }, | 987 | /* 902 */ { MAD_F(0x04416522) /* 0.265965588 */, 15 }, |
988 | /* 903 */ { MAD_F(0x04430174) /* 0.266358810 */, 15 }, | 988 | /* 903 */ { MAD_F(0x04430174) /* 0.266358810 */, 15 }, |
989 | /* 904 */ { MAD_F(0x04449dee) /* 0.266752177 */, 15 }, | 989 | /* 904 */ { MAD_F(0x04449dee) /* 0.266752177 */, 15 }, |
990 | /* 905 */ { MAD_F(0x04463a8f) /* 0.267145689 */, 15 }, | 990 | /* 905 */ { MAD_F(0x04463a8f) /* 0.267145689 */, 15 }, |
991 | /* 906 */ { MAD_F(0x0447d756) /* 0.267539347 */, 15 }, | 991 | /* 906 */ { MAD_F(0x0447d756) /* 0.267539347 */, 15 }, |
992 | /* 907 */ { MAD_F(0x04497445) /* 0.267933149 */, 15 }, | 992 | /* 907 */ { MAD_F(0x04497445) /* 0.267933149 */, 15 }, |
993 | /* 908 */ { MAD_F(0x044b115a) /* 0.268327096 */, 15 }, | 993 | /* 908 */ { MAD_F(0x044b115a) /* 0.268327096 */, 15 }, |
994 | /* 909 */ { MAD_F(0x044cae96) /* 0.268721187 */, 15 }, | 994 | /* 909 */ { MAD_F(0x044cae96) /* 0.268721187 */, 15 }, |
995 | /* 910 */ { MAD_F(0x044e4bf9) /* 0.269115423 */, 15 }, | 995 | /* 910 */ { MAD_F(0x044e4bf9) /* 0.269115423 */, 15 }, |
996 | /* 911 */ { MAD_F(0x044fe983) /* 0.269509804 */, 15 }, | 996 | /* 911 */ { MAD_F(0x044fe983) /* 0.269509804 */, 15 }, |
997 | 997 | ||
998 | /* 912 */ { MAD_F(0x04518733) /* 0.269904329 */, 15 }, | 998 | /* 912 */ { MAD_F(0x04518733) /* 0.269904329 */, 15 }, |
999 | /* 913 */ { MAD_F(0x0453250a) /* 0.270298998 */, 15 }, | 999 | /* 913 */ { MAD_F(0x0453250a) /* 0.270298998 */, 15 }, |
1000 | /* 914 */ { MAD_F(0x0454c308) /* 0.270693811 */, 15 }, | 1000 | /* 914 */ { MAD_F(0x0454c308) /* 0.270693811 */, 15 }, |
1001 | /* 915 */ { MAD_F(0x0456612d) /* 0.271088768 */, 15 }, | 1001 | /* 915 */ { MAD_F(0x0456612d) /* 0.271088768 */, 15 }, |
1002 | /* 916 */ { MAD_F(0x0457ff78) /* 0.271483869 */, 15 }, | 1002 | /* 916 */ { MAD_F(0x0457ff78) /* 0.271483869 */, 15 }, |
1003 | /* 917 */ { MAD_F(0x04599dea) /* 0.271879114 */, 15 }, | 1003 | /* 917 */ { MAD_F(0x04599dea) /* 0.271879114 */, 15 }, |
1004 | /* 918 */ { MAD_F(0x045b3c82) /* 0.272274503 */, 15 }, | 1004 | /* 918 */ { MAD_F(0x045b3c82) /* 0.272274503 */, 15 }, |
1005 | /* 919 */ { MAD_F(0x045cdb41) /* 0.272670035 */, 15 }, | 1005 | /* 919 */ { MAD_F(0x045cdb41) /* 0.272670035 */, 15 }, |
1006 | /* 920 */ { MAD_F(0x045e7a26) /* 0.273065710 */, 15 }, | 1006 | /* 920 */ { MAD_F(0x045e7a26) /* 0.273065710 */, 15 }, |
1007 | /* 921 */ { MAD_F(0x04601932) /* 0.273461530 */, 15 }, | 1007 | /* 921 */ { MAD_F(0x04601932) /* 0.273461530 */, 15 }, |
1008 | /* 922 */ { MAD_F(0x0461b864) /* 0.273857492 */, 15 }, | 1008 | /* 922 */ { MAD_F(0x0461b864) /* 0.273857492 */, 15 }, |
1009 | /* 923 */ { MAD_F(0x046357bd) /* 0.274253597 */, 15 }, | 1009 | /* 923 */ { MAD_F(0x046357bd) /* 0.274253597 */, 15 }, |
1010 | /* 924 */ { MAD_F(0x0464f73c) /* 0.274649846 */, 15 }, | 1010 | /* 924 */ { MAD_F(0x0464f73c) /* 0.274649846 */, 15 }, |
1011 | /* 925 */ { MAD_F(0x046696e2) /* 0.275046238 */, 15 }, | 1011 | /* 925 */ { MAD_F(0x046696e2) /* 0.275046238 */, 15 }, |
1012 | /* 926 */ { MAD_F(0x046836ae) /* 0.275442772 */, 15 }, | 1012 | /* 926 */ { MAD_F(0x046836ae) /* 0.275442772 */, 15 }, |
1013 | /* 927 */ { MAD_F(0x0469d6a0) /* 0.275839449 */, 15 }, | 1013 | /* 927 */ { MAD_F(0x0469d6a0) /* 0.275839449 */, 15 }, |
1014 | 1014 | ||
1015 | /* 928 */ { MAD_F(0x046b76b9) /* 0.276236269 */, 15 }, | 1015 | /* 928 */ { MAD_F(0x046b76b9) /* 0.276236269 */, 15 }, |
1016 | /* 929 */ { MAD_F(0x046d16f7) /* 0.276633232 */, 15 }, | 1016 | /* 929 */ { MAD_F(0x046d16f7) /* 0.276633232 */, 15 }, |
1017 | /* 930 */ { MAD_F(0x046eb75c) /* 0.277030337 */, 15 }, | 1017 | /* 930 */ { MAD_F(0x046eb75c) /* 0.277030337 */, 15 }, |
1018 | /* 931 */ { MAD_F(0x047057e8) /* 0.277427584 */, 15 }, | 1018 | /* 931 */ { MAD_F(0x047057e8) /* 0.277427584 */, 15 }, |
1019 | /* 932 */ { MAD_F(0x0471f899) /* 0.277824973 */, 15 }, | 1019 | /* 932 */ { MAD_F(0x0471f899) /* 0.277824973 */, 15 }, |
1020 | /* 933 */ { MAD_F(0x04739971) /* 0.278222505 */, 15 }, | 1020 | /* 933 */ { MAD_F(0x04739971) /* 0.278222505 */, 15 }, |
1021 | /* 934 */ { MAD_F(0x04753a6f) /* 0.278620179 */, 15 }, | 1021 | /* 934 */ { MAD_F(0x04753a6f) /* 0.278620179 */, 15 }, |
1022 | /* 935 */ { MAD_F(0x0476db92) /* 0.279017995 */, 15 }, | 1022 | /* 935 */ { MAD_F(0x0476db92) /* 0.279017995 */, 15 }, |
1023 | /* 936 */ { MAD_F(0x04787cdc) /* 0.279415952 */, 15 }, | 1023 | /* 936 */ { MAD_F(0x04787cdc) /* 0.279415952 */, 15 }, |
1024 | /* 937 */ { MAD_F(0x047a1e4c) /* 0.279814051 */, 15 }, | 1024 | /* 937 */ { MAD_F(0x047a1e4c) /* 0.279814051 */, 15 }, |
1025 | /* 938 */ { MAD_F(0x047bbfe2) /* 0.280212292 */, 15 }, | 1025 | /* 938 */ { MAD_F(0x047bbfe2) /* 0.280212292 */, 15 }, |
1026 | /* 939 */ { MAD_F(0x047d619e) /* 0.280610675 */, 15 }, | 1026 | /* 939 */ { MAD_F(0x047d619e) /* 0.280610675 */, 15 }, |
1027 | /* 940 */ { MAD_F(0x047f0380) /* 0.281009199 */, 15 }, | 1027 | /* 940 */ { MAD_F(0x047f0380) /* 0.281009199 */, 15 }, |
diff --git a/core/multimedia/opieplayer/libmad/sf_table.dat b/core/multimedia/opieplayer/libmad/sf_table.dat index bc368af..de084d9 100644 --- a/core/multimedia/opieplayer/libmad/sf_table.dat +++ b/core/multimedia/opieplayer/libmad/sf_table.dat | |||
@@ -1,100 +1,106 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * These are the scalefactor values for Layer I and Layer II. | 23 | * These are the scalefactor values for Layer I and Layer II. |
24 | * The values are from Table B.1 of ISO/IEC 11172-3. | 24 | * The values are from Table B.1 of ISO/IEC 11172-3. |
25 | * | 25 | * |
26 | * There is some error introduced by the 32-bit fixed-point representation; | 26 | * There is some error introduced by the 32-bit fixed-point representation; |
27 | * the amount of error is shown. For 16-bit PCM output, this shouldn't be | 27 | * the amount of error is shown. For 16-bit PCM output, this shouldn't be |
28 | * too much of a problem. | 28 | * too much of a problem. |
29 | * | ||
30 | * Strictly speaking, Table B.1 has only 63 entries (0-62), thus a strict | ||
31 | * interpretation of ISO/IEC 11172-3 would suggest that a scalefactor index of | ||
32 | * 63 is invalid. However, for better compatibility with current practices, we | ||
33 | * add a 64th entry. | ||
29 | */ | 34 | */ |
30 | 35 | ||
31 | MAD_F(0x20000000), /* 2.000000000000 => 2.000000000000, e 0.000000000000 */ | 36 | MAD_F(0x20000000), /* 2.000000000000 => 2.000000000000, e 0.000000000000 */ |
32 | MAD_F(0x1965fea5), /* 1.587401051968 => 1.587401051074, e 0.000000000894 */ | 37 | MAD_F(0x1965fea5), /* 1.587401051968 => 1.587401051074, e 0.000000000894 */ |
33 | MAD_F(0x1428a2fa), /* 1.259921049895 => 1.259921051562, e -0.000000001667 */ | 38 | MAD_F(0x1428a2fa), /* 1.259921049895 => 1.259921051562, e -0.000000001667 */ |
34 | MAD_F(0x10000000), /* 1.000000000000 => 1.000000000000, e 0.000000000000 */ | 39 | MAD_F(0x10000000), /* 1.000000000000 => 1.000000000000, e 0.000000000000 */ |
35 | MAD_F(0x0cb2ff53), /* 0.793700525984 => 0.793700527400, e -0.000000001416 */ | 40 | MAD_F(0x0cb2ff53), /* 0.793700525984 => 0.793700527400, e -0.000000001416 */ |
36 | MAD_F(0x0a14517d), /* 0.629960524947 => 0.629960525781, e -0.000000000833 */ | 41 | MAD_F(0x0a14517d), /* 0.629960524947 => 0.629960525781, e -0.000000000833 */ |
37 | MAD_F(0x08000000), /* 0.500000000000 => 0.500000000000, e 0.000000000000 */ | 42 | MAD_F(0x08000000), /* 0.500000000000 => 0.500000000000, e 0.000000000000 */ |
38 | MAD_F(0x06597fa9), /* 0.396850262992 => 0.396850261837, e 0.000000001155 */ | 43 | MAD_F(0x06597fa9), /* 0.396850262992 => 0.396850261837, e 0.000000001155 */ |
39 | 44 | ||
40 | MAD_F(0x050a28be), /* 0.314980262474 => 0.314980261028, e 0.000000001446 */ | 45 | MAD_F(0x050a28be), /* 0.314980262474 => 0.314980261028, e 0.000000001446 */ |
41 | MAD_F(0x04000000), /* 0.250000000000 => 0.250000000000, e 0.000000000000 */ | 46 | MAD_F(0x04000000), /* 0.250000000000 => 0.250000000000, e 0.000000000000 */ |
42 | MAD_F(0x032cbfd5), /* 0.198425131496 => 0.198425132781, e -0.000000001285 */ | 47 | MAD_F(0x032cbfd5), /* 0.198425131496 => 0.198425132781, e -0.000000001285 */ |
43 | MAD_F(0x0285145f), /* 0.157490131237 => 0.157490130514, e 0.000000000723 */ | 48 | MAD_F(0x0285145f), /* 0.157490131237 => 0.157490130514, e 0.000000000723 */ |
44 | MAD_F(0x02000000), /* 0.125000000000 => 0.125000000000, e 0.000000000000 */ | 49 | MAD_F(0x02000000), /* 0.125000000000 => 0.125000000000, e 0.000000000000 */ |
45 | MAD_F(0x01965fea), /* 0.099212565748 => 0.099212564528, e 0.000000001220 */ | 50 | MAD_F(0x01965fea), /* 0.099212565748 => 0.099212564528, e 0.000000001220 */ |
46 | MAD_F(0x01428a30), /* 0.078745065618 => 0.078745067120, e -0.000000001501 */ | 51 | MAD_F(0x01428a30), /* 0.078745065618 => 0.078745067120, e -0.000000001501 */ |
47 | MAD_F(0x01000000), /* 0.062500000000 => 0.062500000000, e 0.000000000000 */ | 52 | MAD_F(0x01000000), /* 0.062500000000 => 0.062500000000, e 0.000000000000 */ |
48 | 53 | ||
49 | MAD_F(0x00cb2ff5), /* 0.049606282874 => 0.049606282264, e 0.000000000610 */ | 54 | MAD_F(0x00cb2ff5), /* 0.049606282874 => 0.049606282264, e 0.000000000610 */ |
50 | MAD_F(0x00a14518), /* 0.039372532809 => 0.039372533560, e -0.000000000751 */ | 55 | MAD_F(0x00a14518), /* 0.039372532809 => 0.039372533560, e -0.000000000751 */ |
51 | MAD_F(0x00800000), /* 0.031250000000 => 0.031250000000, e 0.000000000000 */ | 56 | MAD_F(0x00800000), /* 0.031250000000 => 0.031250000000, e 0.000000000000 */ |
52 | MAD_F(0x006597fb), /* 0.024803141437 => 0.024803142995, e -0.000000001558 */ | 57 | MAD_F(0x006597fb), /* 0.024803141437 => 0.024803142995, e -0.000000001558 */ |
53 | MAD_F(0x0050a28c), /* 0.019686266405 => 0.019686266780, e -0.000000000375 */ | 58 | MAD_F(0x0050a28c), /* 0.019686266405 => 0.019686266780, e -0.000000000375 */ |
54 | MAD_F(0x00400000), /* 0.015625000000 => 0.015625000000, e 0.000000000000 */ | 59 | MAD_F(0x00400000), /* 0.015625000000 => 0.015625000000, e 0.000000000000 */ |
55 | MAD_F(0x0032cbfd), /* 0.012401570719 => 0.012401569635, e 0.000000001084 */ | 60 | MAD_F(0x0032cbfd), /* 0.012401570719 => 0.012401569635, e 0.000000001084 */ |
56 | MAD_F(0x00285146), /* 0.009843133202 => 0.009843133390, e -0.000000000188 */ | 61 | MAD_F(0x00285146), /* 0.009843133202 => 0.009843133390, e -0.000000000188 */ |
57 | 62 | ||
58 | MAD_F(0x00200000), /* 0.007812500000 => 0.007812500000, e 0.000000000000 */ | 63 | MAD_F(0x00200000), /* 0.007812500000 => 0.007812500000, e 0.000000000000 */ |
59 | MAD_F(0x001965ff), /* 0.006200785359 => 0.006200786680, e -0.000000001321 */ | 64 | MAD_F(0x001965ff), /* 0.006200785359 => 0.006200786680, e -0.000000001321 */ |
60 | MAD_F(0x001428a3), /* 0.004921566601 => 0.004921566695, e -0.000000000094 */ | 65 | MAD_F(0x001428a3), /* 0.004921566601 => 0.004921566695, e -0.000000000094 */ |
61 | MAD_F(0x00100000), /* 0.003906250000 => 0.003906250000, e 0.000000000000 */ | 66 | MAD_F(0x00100000), /* 0.003906250000 => 0.003906250000, e 0.000000000000 */ |
62 | MAD_F(0x000cb2ff), /* 0.003100392680 => 0.003100391477, e 0.000000001202 */ | 67 | MAD_F(0x000cb2ff), /* 0.003100392680 => 0.003100391477, e 0.000000001202 */ |
63 | MAD_F(0x000a1451), /* 0.002460783301 => 0.002460781485, e 0.000000001816 */ | 68 | MAD_F(0x000a1451), /* 0.002460783301 => 0.002460781485, e 0.000000001816 */ |
64 | MAD_F(0x00080000), /* 0.001953125000 => 0.001953125000, e 0.000000000000 */ | 69 | MAD_F(0x00080000), /* 0.001953125000 => 0.001953125000, e 0.000000000000 */ |
65 | MAD_F(0x00065980), /* 0.001550196340 => 0.001550197601, e -0.000000001262 */ | 70 | MAD_F(0x00065980), /* 0.001550196340 => 0.001550197601, e -0.000000001262 */ |
66 | 71 | ||
67 | MAD_F(0x00050a29), /* 0.001230391650 => 0.001230392605, e -0.000000000955 */ | 72 | MAD_F(0x00050a29), /* 0.001230391650 => 0.001230392605, e -0.000000000955 */ |
68 | MAD_F(0x00040000), /* 0.000976562500 => 0.000976562500, e 0.000000000000 */ | 73 | MAD_F(0x00040000), /* 0.000976562500 => 0.000976562500, e 0.000000000000 */ |
69 | MAD_F(0x00032cc0), /* 0.000775098170 => 0.000775098801, e -0.000000000631 */ | 74 | MAD_F(0x00032cc0), /* 0.000775098170 => 0.000775098801, e -0.000000000631 */ |
70 | MAD_F(0x00028514), /* 0.000615195825 => 0.000615194440, e 0.000000001385 */ | 75 | MAD_F(0x00028514), /* 0.000615195825 => 0.000615194440, e 0.000000001385 */ |
71 | MAD_F(0x00020000), /* 0.000488281250 => 0.000488281250, e 0.000000000000 */ | 76 | MAD_F(0x00020000), /* 0.000488281250 => 0.000488281250, e 0.000000000000 */ |
72 | MAD_F(0x00019660), /* 0.000387549085 => 0.000387549400, e -0.000000000315 */ | 77 | MAD_F(0x00019660), /* 0.000387549085 => 0.000387549400, e -0.000000000315 */ |
73 | MAD_F(0x0001428a), /* 0.000307597913 => 0.000307597220, e 0.000000000693 */ | 78 | MAD_F(0x0001428a), /* 0.000307597913 => 0.000307597220, e 0.000000000693 */ |
74 | MAD_F(0x00010000), /* 0.000244140625 => 0.000244140625, e 0.000000000000 */ | 79 | MAD_F(0x00010000), /* 0.000244140625 => 0.000244140625, e 0.000000000000 */ |
75 | 80 | ||
76 | MAD_F(0x0000cb30), /* 0.000193774542 => 0.000193774700, e -0.000000000158 */ | 81 | MAD_F(0x0000cb30), /* 0.000193774542 => 0.000193774700, e -0.000000000158 */ |
77 | MAD_F(0x0000a145), /* 0.000153798956 => 0.000153798610, e 0.000000000346 */ | 82 | MAD_F(0x0000a145), /* 0.000153798956 => 0.000153798610, e 0.000000000346 */ |
78 | MAD_F(0x00008000), /* 0.000122070313 => 0.000122070313, e 0.000000000000 */ | 83 | MAD_F(0x00008000), /* 0.000122070313 => 0.000122070313, e 0.000000000000 */ |
79 | MAD_F(0x00006598), /* 0.000096887271 => 0.000096887350, e -0.000000000079 */ | 84 | MAD_F(0x00006598), /* 0.000096887271 => 0.000096887350, e -0.000000000079 */ |
80 | MAD_F(0x000050a3), /* 0.000076899478 => 0.000076901168, e -0.000000001689 */ | 85 | MAD_F(0x000050a3), /* 0.000076899478 => 0.000076901168, e -0.000000001689 */ |
81 | MAD_F(0x00004000), /* 0.000061035156 => 0.000061035156, e 0.000000000000 */ | 86 | MAD_F(0x00004000), /* 0.000061035156 => 0.000061035156, e 0.000000000000 */ |
82 | MAD_F(0x000032cc), /* 0.000048443636 => 0.000048443675, e -0.000000000039 */ | 87 | MAD_F(0x000032cc), /* 0.000048443636 => 0.000048443675, e -0.000000000039 */ |
83 | MAD_F(0x00002851), /* 0.000038449739 => 0.000038448721, e 0.000000001018 */ | 88 | MAD_F(0x00002851), /* 0.000038449739 => 0.000038448721, e 0.000000001018 */ |
84 | 89 | ||
85 | MAD_F(0x00002000), /* 0.000030517578 => 0.000030517578, e 0.000000000000 */ | 90 | MAD_F(0x00002000), /* 0.000030517578 => 0.000030517578, e 0.000000000000 */ |
86 | MAD_F(0x00001966), /* 0.000024221818 => 0.000024221838, e -0.000000000020 */ | 91 | MAD_F(0x00001966), /* 0.000024221818 => 0.000024221838, e -0.000000000020 */ |
87 | MAD_F(0x00001429), /* 0.000019224870 => 0.000019226223, e -0.000000001354 */ | 92 | MAD_F(0x00001429), /* 0.000019224870 => 0.000019226223, e -0.000000001354 */ |
88 | MAD_F(0x00001000), /* 0.000015258789 => 0.000015258789, e -0.000000000000 */ | 93 | MAD_F(0x00001000), /* 0.000015258789 => 0.000015258789, e -0.000000000000 */ |
89 | MAD_F(0x00000cb3), /* 0.000012110909 => 0.000012110919, e -0.000000000010 */ | 94 | MAD_F(0x00000cb3), /* 0.000012110909 => 0.000012110919, e -0.000000000010 */ |
90 | MAD_F(0x00000a14), /* 0.000009612435 => 0.000009611249, e 0.000000001186 */ | 95 | MAD_F(0x00000a14), /* 0.000009612435 => 0.000009611249, e 0.000000001186 */ |
91 | MAD_F(0x00000800), /* 0.000007629395 => 0.000007629395, e -0.000000000000 */ | 96 | MAD_F(0x00000800), /* 0.000007629395 => 0.000007629395, e -0.000000000000 */ |
92 | MAD_F(0x00000659), /* 0.000006055454 => 0.000006053597, e 0.000000001858 */ | 97 | MAD_F(0x00000659), /* 0.000006055454 => 0.000006053597, e 0.000000001858 */ |
93 | 98 | ||
94 | MAD_F(0x0000050a), /* 0.000004806217 => 0.000004805624, e 0.000000000593 */ | 99 | MAD_F(0x0000050a), /* 0.000004806217 => 0.000004805624, e 0.000000000593 */ |
95 | MAD_F(0x00000400), /* 0.000003814697 => 0.000003814697, e 0.000000000000 */ | 100 | MAD_F(0x00000400), /* 0.000003814697 => 0.000003814697, e 0.000000000000 */ |
96 | MAD_F(0x0000032d), /* 0.000003027727 => 0.000003028661, e -0.000000000934 */ | 101 | MAD_F(0x0000032d), /* 0.000003027727 => 0.000003028661, e -0.000000000934 */ |
97 | MAD_F(0x00000285), /* 0.000002403109 => 0.000002402812, e 0.000000000296 */ | 102 | MAD_F(0x00000285), /* 0.000002403109 => 0.000002402812, e 0.000000000296 */ |
98 | MAD_F(0x00000200), /* 0.000001907349 => 0.000001907349, e -0.000000000000 */ | 103 | MAD_F(0x00000200), /* 0.000001907349 => 0.000001907349, e -0.000000000000 */ |
99 | MAD_F(0x00000196), /* 0.000001513864 => 0.000001512468, e 0.000000001396 */ | 104 | MAD_F(0x00000196), /* 0.000001513864 => 0.000001512468, e 0.000000001396 */ |
100 | MAD_F(0x00000143) /* 0.000001201554 => 0.000001203269, e -0.000000001714 */ | 105 | MAD_F(0x00000143), /* 0.000001201554 => 0.000001203269, e -0.000000001714 */ |
106 | MAD_F(0x00000000) /* this compatibility entry is not part of Table B.1 */ | ||
diff --git a/core/multimedia/opieplayer/libmad/stream.c b/core/multimedia/opieplayer/libmad/stream.c index 4374de7..a63d67b 100644 --- a/core/multimedia/opieplayer/libmad/stream.c +++ b/core/multimedia/opieplayer/libmad/stream.c | |||
@@ -1,160 +1,161 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifdef HAVE_CONFIG_H | 22 | # ifdef HAVE_CONFIG_H |
23 | # include "libmad_config.h" | 23 | # include "libmad_config.h" |
24 | # endif | 24 | # endif |
25 | 25 | ||
26 | # include "libmad_global.h" | 26 | # include "libmad_global.h" |
27 | 27 | ||
28 | # include <stdlib.h> | 28 | # include <stdlib.h> |
29 | 29 | ||
30 | # include "bit.h" | 30 | # include "bit.h" |
31 | # include "stream.h" | 31 | # include "stream.h" |
32 | 32 | ||
33 | /* | 33 | /* |
34 | * NAME:stream->init() | 34 | * NAME:stream->init() |
35 | * DESCRIPTION:initialize stream struct | 35 | * DESCRIPTION:initialize stream struct |
36 | */ | 36 | */ |
37 | void mad_stream_init(struct mad_stream *stream) | 37 | void mad_stream_init(struct mad_stream *stream) |
38 | { | 38 | { |
39 | stream->buffer = 0; | 39 | stream->buffer = 0; |
40 | stream->bufend = 0; | 40 | stream->bufend = 0; |
41 | stream->skiplen = 0; | 41 | stream->skiplen = 0; |
42 | 42 | ||
43 | stream->sync = 0; | 43 | stream->sync = 0; |
44 | stream->freerate = 0; | 44 | stream->freerate = 0; |
45 | 45 | ||
46 | stream->this_frame = 0; | 46 | stream->this_frame = 0; |
47 | stream->next_frame = 0; | 47 | stream->next_frame = 0; |
48 | mad_bit_init(&stream->ptr, 0); | 48 | mad_bit_init(&stream->ptr, 0); |
49 | 49 | ||
50 | mad_bit_init(&stream->anc_ptr, 0); | 50 | mad_bit_init(&stream->anc_ptr, 0); |
51 | stream->anc_bitlen = 0; | 51 | stream->anc_bitlen = 0; |
52 | 52 | ||
53 | stream->main_data = 0; | 53 | stream->main_data = 0; |
54 | stream->md_len = 0; | 54 | stream->md_len = 0; |
55 | 55 | ||
56 | stream->options = 0; | 56 | stream->options = 0; |
57 | stream->error = MAD_ERROR_NONE; | 57 | stream->error = MAD_ERROR_NONE; |
58 | } | 58 | } |
59 | 59 | ||
60 | /* | 60 | /* |
61 | * NAME:stream->finish() | 61 | * NAME:stream->finish() |
62 | * DESCRIPTION:deallocate any dynamic memory associated with stream | 62 | * DESCRIPTION:deallocate any dynamic memory associated with stream |
63 | */ | 63 | */ |
64 | void mad_stream_finish(struct mad_stream *stream) | 64 | void mad_stream_finish(struct mad_stream *stream) |
65 | { | 65 | { |
66 | if (stream->main_data) { | 66 | if (stream->main_data) { |
67 | free(stream->main_data); | 67 | free(stream->main_data); |
68 | stream->main_data = 0; | 68 | stream->main_data = 0; |
69 | } | 69 | } |
70 | 70 | ||
71 | mad_bit_finish(&stream->anc_ptr); | 71 | mad_bit_finish(&stream->anc_ptr); |
72 | mad_bit_finish(&stream->ptr); | 72 | mad_bit_finish(&stream->ptr); |
73 | } | 73 | } |
74 | 74 | ||
75 | /* | 75 | /* |
76 | * NAME:stream->buffer() | 76 | * NAME:stream->buffer() |
77 | * DESCRIPTION:set stream buffer pointers | 77 | * DESCRIPTION:set stream buffer pointers |
78 | */ | 78 | */ |
79 | void mad_stream_buffer(struct mad_stream *stream, | 79 | void mad_stream_buffer(struct mad_stream *stream, |
80 | unsigned char const *buffer, unsigned long length) | 80 | unsigned char const *buffer, unsigned long length) |
81 | { | 81 | { |
82 | stream->buffer = buffer; | 82 | stream->buffer = buffer; |
83 | stream->bufend = buffer + length; | 83 | stream->bufend = buffer + length; |
84 | 84 | ||
85 | stream->this_frame = buffer; | 85 | stream->this_frame = buffer; |
86 | stream->next_frame = buffer; | 86 | stream->next_frame = buffer; |
87 | 87 | ||
88 | stream->sync = 1; | 88 | stream->sync = 1; |
89 | 89 | ||
90 | mad_bit_init(&stream->ptr, buffer); | 90 | mad_bit_init(&stream->ptr, buffer); |
91 | } | 91 | } |
92 | 92 | ||
93 | /* | 93 | /* |
94 | * NAME:stream->skip() | 94 | * NAME:stream->skip() |
95 | * DESCRIPTION:arrange to skip bytes before the next frame | 95 | * DESCRIPTION:arrange to skip bytes before the next frame |
96 | */ | 96 | */ |
97 | void mad_stream_skip(struct mad_stream *stream, unsigned long length) | 97 | void mad_stream_skip(struct mad_stream *stream, unsigned long length) |
98 | { | 98 | { |
99 | stream->skiplen += length; | 99 | stream->skiplen += length; |
100 | } | 100 | } |
101 | 101 | ||
102 | /* | 102 | /* |
103 | * NAME:stream->sync() | 103 | * NAME:stream->sync() |
104 | * DESCRIPTION:locate the next stream sync word | 104 | * DESCRIPTION:locate the next stream sync word |
105 | */ | 105 | */ |
106 | int mad_stream_sync(struct mad_stream *stream) | 106 | int mad_stream_sync(struct mad_stream *stream) |
107 | { | 107 | { |
108 | register unsigned char const *ptr, *end; | 108 | register unsigned char const *ptr, *end; |
109 | 109 | ||
110 | ptr = mad_bit_nextbyte(&stream->ptr); | 110 | ptr = mad_bit_nextbyte(&stream->ptr); |
111 | end = stream->bufend; | 111 | end = stream->bufend; |
112 | 112 | ||
113 | while (ptr < end - 1 && | 113 | while (ptr < end - 1 && |
114 | !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) | 114 | !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) |
115 | ++ptr; | 115 | ++ptr; |
116 | 116 | ||
117 | if (end - ptr < MAD_BUFFER_GUARD) | 117 | if (end - ptr < MAD_BUFFER_GUARD) |
118 | return -1; | 118 | return -1; |
119 | 119 | ||
120 | mad_bit_init(&stream->ptr, ptr); | 120 | mad_bit_init(&stream->ptr, ptr); |
121 | 121 | ||
122 | return 0; | 122 | return 0; |
123 | } | 123 | } |
124 | 124 | ||
125 | /* | 125 | /* |
126 | * NAME:stream->errorstr() | 126 | * NAME:stream->errorstr() |
127 | * DESCRIPTION:return a string description of the current error condition | 127 | * DESCRIPTION:return a string description of the current error condition |
128 | */ | 128 | */ |
129 | char const *mad_stream_errorstr(struct mad_stream const *stream) | 129 | char const *mad_stream_errorstr(struct mad_stream const *stream) |
130 | { | 130 | { |
131 | switch (stream->error) { | 131 | switch (stream->error) { |
132 | case MAD_ERROR_NONE: return "no error"; | 132 | case MAD_ERROR_NONE: return "no error"; |
133 | 133 | ||
134 | case MAD_ERROR_BUFLEN: return "input buffer too small (or EOF)"; | 134 | case MAD_ERROR_BUFLEN: return "input buffer too small (or EOF)"; |
135 | case MAD_ERROR_BUFPTR: return "invalid (null) buffer pointer"; | 135 | case MAD_ERROR_BUFPTR: return "invalid (null) buffer pointer"; |
136 | 136 | ||
137 | case MAD_ERROR_NOMEM: return "not enough memory"; | 137 | case MAD_ERROR_NOMEM: return "not enough memory"; |
138 | 138 | ||
139 | case MAD_ERROR_LOSTSYNC: return "lost synchronization"; | 139 | case MAD_ERROR_LOSTSYNC: return "lost synchronization"; |
140 | case MAD_ERROR_BADLAYER: return "reserved header layer value"; | 140 | case MAD_ERROR_BADLAYER: return "reserved header layer value"; |
141 | case MAD_ERROR_BADBITRATE: return "forbidden bitrate value"; | 141 | case MAD_ERROR_BADBITRATE: return "forbidden bitrate value"; |
142 | case MAD_ERROR_BADSAMPLERATE: return "reserved sample frequency value"; | 142 | case MAD_ERROR_BADSAMPLERATE: return "reserved sample frequency value"; |
143 | case MAD_ERROR_BADEMPHASIS: return "reserved emphasis value"; | 143 | case MAD_ERROR_BADEMPHASIS: return "reserved emphasis value"; |
144 | 144 | ||
145 | case MAD_ERROR_BADCRC: return "CRC check failed"; | 145 | case MAD_ERROR_BADCRC: return "CRC check failed"; |
146 | case MAD_ERROR_BADBITALLOC: return "forbidden bit allocation value"; | 146 | case MAD_ERROR_BADBITALLOC: return "forbidden bit allocation value"; |
147 | case MAD_ERROR_BADSCALEFACTOR: return "bad scalefactor index"; | 147 | case MAD_ERROR_BADSCALEFACTOR: return "bad scalefactor index"; |
148 | case MAD_ERROR_BADMODE: return "bad bitrate/mode combination"; | ||
148 | case MAD_ERROR_BADFRAMELEN: return "bad frame length"; | 149 | case MAD_ERROR_BADFRAMELEN: return "bad frame length"; |
149 | case MAD_ERROR_BADBIGVALUES: return "bad big_values count"; | 150 | case MAD_ERROR_BADBIGVALUES: return "bad big_values count"; |
150 | case MAD_ERROR_BADBLOCKTYPE: return "reserved block_type"; | 151 | case MAD_ERROR_BADBLOCKTYPE: return "reserved block_type"; |
151 | case MAD_ERROR_BADSCFSI: return "bad scalefactor selection info"; | 152 | case MAD_ERROR_BADSCFSI: return "bad scalefactor selection info"; |
152 | case MAD_ERROR_BADDATAPTR: return "bad main_data_begin pointer"; | 153 | case MAD_ERROR_BADDATAPTR: return "bad main_data_begin pointer"; |
153 | case MAD_ERROR_BADPART3LEN: return "bad audio data length"; | 154 | case MAD_ERROR_BADPART3LEN: return "bad audio data length"; |
154 | case MAD_ERROR_BADHUFFTABLE: return "bad Huffman table select"; | 155 | case MAD_ERROR_BADHUFFTABLE: return "bad Huffman table select"; |
155 | case MAD_ERROR_BADHUFFDATA: return "Huffman data overrun"; | 156 | case MAD_ERROR_BADHUFFDATA: return "Huffman data overrun"; |
156 | case MAD_ERROR_BADSTEREO: return "incompatible block_type for JS"; | 157 | case MAD_ERROR_BADSTEREO: return "incompatible block_type for JS"; |
157 | } | 158 | } |
158 | 159 | ||
159 | return 0; | 160 | return 0; |
160 | } | 161 | } |
diff --git a/core/multimedia/opieplayer/libmad/stream.h b/core/multimedia/opieplayer/libmad/stream.h index 08e6dc5..5fca48f 100644 --- a/core/multimedia/opieplayer/libmad/stream.h +++ b/core/multimedia/opieplayer/libmad/stream.h | |||
@@ -1,107 +1,108 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifndef LIBMAD_STREAM_H | 22 | # ifndef LIBMAD_STREAM_H |
23 | # define LIBMAD_STREAM_H | 23 | # define LIBMAD_STREAM_H |
24 | 24 | ||
25 | # include "bit.h" | 25 | # include "bit.h" |
26 | 26 | ||
27 | # define MAD_BUFFER_GUARD8 | 27 | # define MAD_BUFFER_GUARD8 |
28 | # define MAD_BUFFER_MDLEN(511 + 2048 + MAD_BUFFER_GUARD) | 28 | # define MAD_BUFFER_MDLEN(511 + 2048 + MAD_BUFFER_GUARD) |
29 | 29 | ||
30 | enum mad_error { | 30 | enum mad_error { |
31 | MAD_ERROR_NONE = 0x0000,/* no error */ | 31 | MAD_ERROR_NONE = 0x0000,/* no error */ |
32 | 32 | ||
33 | MAD_ERROR_BUFLEN = 0x0001,/* input buffer too small (or EOF) */ | 33 | MAD_ERROR_BUFLEN = 0x0001,/* input buffer too small (or EOF) */ |
34 | MAD_ERROR_BUFPTR = 0x0002,/* invalid (null) buffer pointer */ | 34 | MAD_ERROR_BUFPTR = 0x0002,/* invalid (null) buffer pointer */ |
35 | 35 | ||
36 | MAD_ERROR_NOMEM = 0x0031,/* not enough memory */ | 36 | MAD_ERROR_NOMEM = 0x0031,/* not enough memory */ |
37 | 37 | ||
38 | MAD_ERROR_LOSTSYNC = 0x0101,/* lost synchronization */ | 38 | MAD_ERROR_LOSTSYNC = 0x0101,/* lost synchronization */ |
39 | MAD_ERROR_BADLAYER = 0x0102,/* reserved header layer value */ | 39 | MAD_ERROR_BADLAYER = 0x0102,/* reserved header layer value */ |
40 | MAD_ERROR_BADBITRATE = 0x0103,/* forbidden bitrate value */ | 40 | MAD_ERROR_BADBITRATE = 0x0103,/* forbidden bitrate value */ |
41 | MAD_ERROR_BADSAMPLERATE = 0x0104,/* reserved sample frequency value */ | 41 | MAD_ERROR_BADSAMPLERATE = 0x0104,/* reserved sample frequency value */ |
42 | MAD_ERROR_BADEMPHASIS = 0x0105,/* reserved emphasis value */ | 42 | MAD_ERROR_BADEMPHASIS = 0x0105,/* reserved emphasis value */ |
43 | 43 | ||
44 | MAD_ERROR_BADCRC = 0x0201,/* CRC check failed */ | 44 | MAD_ERROR_BADCRC = 0x0201,/* CRC check failed */ |
45 | MAD_ERROR_BADBITALLOC = 0x0211,/* forbidden bit allocation value */ | 45 | MAD_ERROR_BADBITALLOC = 0x0211,/* forbidden bit allocation value */ |
46 | MAD_ERROR_BADSCALEFACTOR = 0x0221,/* bad scalefactor index */ | 46 | MAD_ERROR_BADSCALEFACTOR = 0x0221,/* bad scalefactor index */ |
47 | MAD_ERROR_BADMODE = 0x0222,/* bad bitrate/mode combination */ | ||
47 | MAD_ERROR_BADFRAMELEN = 0x0231,/* bad frame length */ | 48 | MAD_ERROR_BADFRAMELEN = 0x0231,/* bad frame length */ |
48 | MAD_ERROR_BADBIGVALUES = 0x0232,/* bad big_values count */ | 49 | MAD_ERROR_BADBIGVALUES = 0x0232,/* bad big_values count */ |
49 | MAD_ERROR_BADBLOCKTYPE = 0x0233,/* reserved block_type */ | 50 | MAD_ERROR_BADBLOCKTYPE = 0x0233,/* reserved block_type */ |
50 | MAD_ERROR_BADSCFSI = 0x0234,/* bad scalefactor selection info */ | 51 | MAD_ERROR_BADSCFSI = 0x0234,/* bad scalefactor selection info */ |
51 | MAD_ERROR_BADDATAPTR = 0x0235,/* bad main_data_begin pointer */ | 52 | MAD_ERROR_BADDATAPTR = 0x0235,/* bad main_data_begin pointer */ |
52 | MAD_ERROR_BADPART3LEN = 0x0236,/* bad audio data length */ | 53 | MAD_ERROR_BADPART3LEN = 0x0236,/* bad audio data length */ |
53 | MAD_ERROR_BADHUFFTABLE = 0x0237,/* bad Huffman table select */ | 54 | MAD_ERROR_BADHUFFTABLE = 0x0237,/* bad Huffman table select */ |
54 | MAD_ERROR_BADHUFFDATA = 0x0238,/* Huffman data overrun */ | 55 | MAD_ERROR_BADHUFFDATA = 0x0238,/* Huffman data overrun */ |
55 | MAD_ERROR_BADSTEREO = 0x0239/* incompatible block_type for JS */ | 56 | MAD_ERROR_BADSTEREO = 0x0239/* incompatible block_type for JS */ |
56 | }; | 57 | }; |
57 | 58 | ||
58 | # define MAD_RECOVERABLE(error)((error) & 0xff00) | 59 | # define MAD_RECOVERABLE(error)((error) & 0xff00) |
59 | 60 | ||
60 | struct mad_stream { | 61 | struct mad_stream { |
61 | unsigned char const *buffer; /* input bitstream buffer */ | 62 | unsigned char const *buffer; /* input bitstream buffer */ |
62 | unsigned char const *bufend; /* end of buffer */ | 63 | unsigned char const *bufend; /* end of buffer */ |
63 | unsigned long skiplen; /* bytes to skip before next frame */ | 64 | unsigned long skiplen; /* bytes to skip before next frame */ |
64 | 65 | ||
65 | int sync; /* stream sync found */ | 66 | int sync; /* stream sync found */ |
66 | unsigned long freerate; /* free bitrate (fixed) */ | 67 | unsigned long freerate; /* free bitrate (fixed) */ |
67 | 68 | ||
68 | unsigned char const *this_frame;/* start of current frame */ | 69 | unsigned char const *this_frame;/* start of current frame */ |
69 | unsigned char const *next_frame;/* start of next frame */ | 70 | unsigned char const *next_frame;/* start of next frame */ |
70 | struct mad_bitptr ptr; /* current processing bit pointer */ | 71 | struct mad_bitptr ptr; /* current processing bit pointer */ |
71 | 72 | ||
72 | struct mad_bitptr anc_ptr; /* ancillary bits pointer */ | 73 | struct mad_bitptr anc_ptr; /* ancillary bits pointer */ |
73 | unsigned int anc_bitlen; /* number of ancillary bits */ | 74 | unsigned int anc_bitlen; /* number of ancillary bits */ |
74 | 75 | ||
75 | unsigned char (*main_data)[MAD_BUFFER_MDLEN]; | 76 | unsigned char (*main_data)[MAD_BUFFER_MDLEN]; |
76 | /* Layer III main_data() */ | 77 | /* Layer III main_data() */ |
77 | unsigned int md_len; /* bytes in main_data */ | 78 | unsigned int md_len; /* bytes in main_data */ |
78 | 79 | ||
79 | int options; /* decoding options (see below) */ | 80 | int options; /* decoding options (see below) */ |
80 | enum mad_error error; /* error code (see above) */ | 81 | enum mad_error error; /* error code (see above) */ |
81 | }; | 82 | }; |
82 | 83 | ||
83 | enum { | 84 | enum { |
84 | MAD_OPTION_IGNORECRC = 0x0001,/* ignore CRC errors */ | 85 | MAD_OPTION_IGNORECRC = 0x0001,/* ignore CRC errors */ |
85 | MAD_OPTION_HALFSAMPLERATE = 0x0002/* generate PCM at 1/2 sample rate */ | 86 | MAD_OPTION_HALFSAMPLERATE = 0x0002/* generate PCM at 1/2 sample rate */ |
86 | # if 0 /* not yet implemented */ | 87 | # if 0 /* not yet implemented */ |
87 | MAD_OPTION_LEFTCHANNEL = 0x0010,/* decode left channel only */ | 88 | MAD_OPTION_LEFTCHANNEL = 0x0010,/* decode left channel only */ |
88 | MAD_OPTION_RIGHTCHANNEL = 0x0020,/* decode right channel only */ | 89 | MAD_OPTION_RIGHTCHANNEL = 0x0020,/* decode right channel only */ |
89 | MAD_OPTION_SINGLECHANNEL = 0x0030/* combine channels */ | 90 | MAD_OPTION_SINGLECHANNEL = 0x0030/* combine channels */ |
90 | # endif | 91 | # endif |
91 | }; | 92 | }; |
92 | 93 | ||
93 | void mad_stream_init(struct mad_stream *); | 94 | void mad_stream_init(struct mad_stream *); |
94 | void mad_stream_finish(struct mad_stream *); | 95 | void mad_stream_finish(struct mad_stream *); |
95 | 96 | ||
96 | # define mad_stream_options(stream, opts) \ | 97 | # define mad_stream_options(stream, opts) \ |
97 | ((void) ((stream)->options = (opts))) | 98 | ((void) ((stream)->options = (opts))) |
98 | 99 | ||
99 | void mad_stream_buffer(struct mad_stream *, | 100 | void mad_stream_buffer(struct mad_stream *, |
100 | unsigned char const *, unsigned long); | 101 | unsigned char const *, unsigned long); |
101 | void mad_stream_skip(struct mad_stream *, unsigned long); | 102 | void mad_stream_skip(struct mad_stream *, unsigned long); |
102 | 103 | ||
103 | int mad_stream_sync(struct mad_stream *); | 104 | int mad_stream_sync(struct mad_stream *); |
104 | 105 | ||
105 | char const *mad_stream_errorstr(struct mad_stream const *); | 106 | char const *mad_stream_errorstr(struct mad_stream const *); |
106 | 107 | ||
107 | # endif | 108 | # endif |
diff --git a/core/multimedia/opieplayer/libmad/synth.c b/core/multimedia/opieplayer/libmad/synth.c index cf3c1d5..881f85a 100644 --- a/core/multimedia/opieplayer/libmad/synth.c +++ b/core/multimedia/opieplayer/libmad/synth.c | |||
@@ -1,857 +1,857 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifdef HAVE_CONFIG_H | 22 | # ifdef HAVE_CONFIG_H |
23 | # include "libmad_config.h" | 23 | # include "libmad_config.h" |
24 | # endif | 24 | # endif |
25 | 25 | ||
26 | # include "libmad_global.h" | 26 | # include "libmad_global.h" |
27 | 27 | ||
28 | # include "fixed.h" | 28 | # include "fixed.h" |
29 | # include "frame.h" | 29 | # include "frame.h" |
30 | # include "synth.h" | 30 | # include "synth.h" |
31 | 31 | ||
32 | /* | 32 | /* |
33 | * NAME:synth->init() | 33 | * NAME:synth->init() |
34 | * DESCRIPTION:initialize synth struct | 34 | * DESCRIPTION:initialize synth struct |
35 | */ | 35 | */ |
36 | void mad_synth_init(struct mad_synth *synth) | 36 | void mad_synth_init(struct mad_synth *synth) |
37 | { | 37 | { |
38 | mad_synth_mute(synth); | 38 | mad_synth_mute(synth); |
39 | 39 | ||
40 | synth->phase = 0; | 40 | synth->phase = 0; |
41 | 41 | ||
42 | synth->pcm.samplerate = 0; | 42 | synth->pcm.samplerate = 0; |
43 | synth->pcm.channels = 0; | 43 | synth->pcm.channels = 0; |
44 | synth->pcm.length = 0; | 44 | synth->pcm.length = 0; |
45 | } | 45 | } |
46 | 46 | ||
47 | /* | 47 | /* |
48 | * NAME:synth->mute() | 48 | * NAME:synth->mute() |
49 | * DESCRIPTION:zero all polyphase filterbank values, resetting synthesis | 49 | * DESCRIPTION:zero all polyphase filterbank values, resetting synthesis |
50 | */ | 50 | */ |
51 | void mad_synth_mute(struct mad_synth *synth) | 51 | void mad_synth_mute(struct mad_synth *synth) |
52 | { | 52 | { |
53 | unsigned int ch, s, v; | 53 | unsigned int ch, s, v; |
54 | 54 | ||
55 | for (ch = 0; ch < 2; ++ch) { | 55 | for (ch = 0; ch < 2; ++ch) { |
56 | for (s = 0; s < 16; ++s) { | 56 | for (s = 0; s < 16; ++s) { |
57 | for (v = 0; v < 8; ++v) { | 57 | for (v = 0; v < 8; ++v) { |
58 | synth->filter[ch][0][0][s][v] = synth->filter[ch][0][1][s][v] = | 58 | synth->filter[ch][0][0][s][v] = synth->filter[ch][0][1][s][v] = |
59 | synth->filter[ch][1][0][s][v] = synth->filter[ch][1][1][s][v] = 0; | 59 | synth->filter[ch][1][0][s][v] = synth->filter[ch][1][1][s][v] = 0; |
60 | } | 60 | } |
61 | } | 61 | } |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | /* | 65 | /* |
66 | * An optional optimization called here the Subband Synthesis Optimization | 66 | * An optional optimization called here the Subband Synthesis Optimization |
67 | * (SSO) improves the performance of subband synthesis at the expense of | 67 | * (SSO) improves the performance of subband synthesis at the expense of |
68 | * accuracy. | 68 | * accuracy. |
69 | * | 69 | * |
70 | * The idea is to simplify 32x32->64-bit multiplication to 32x32->32 such | 70 | * The idea is to simplify 32x32->64-bit multiplication to 32x32->32 such |
71 | * that extra scaling and rounding are not necessary. This often allows the | 71 | * that extra scaling and rounding are not necessary. This often allows the |
72 | * compiler to use faster 32-bit multiply-accumulate instructions instead of | 72 | * compiler to use faster 32-bit multiply-accumulate instructions instead of |
73 | * explicit 64-bit multiply, shift, and add instructions. | 73 | * explicit 64-bit multiply, shift, and add instructions. |
74 | * | 74 | * |
75 | * SSO works like this: a full 32x32->64-bit multiply of two mad_fixed_t | 75 | * SSO works like this: a full 32x32->64-bit multiply of two mad_fixed_t |
76 | * values requires the result to be right-shifted 28 bits to be properly | 76 | * values requires the result to be right-shifted 28 bits to be properly |
77 | * scaled to the same fixed-point format. Right shifts can be applied at any | 77 | * scaled to the same fixed-point format. Right shifts can be applied at any |
78 | * time to either operand or to the result, so the optimization involves | 78 | * time to either operand or to the result, so the optimization involves |
79 | * careful placement of these shifts to minimize the loss of accuracy. | 79 | * careful placement of these shifts to minimize the loss of accuracy. |
80 | * | 80 | * |
81 | * First, a 14-bit shift is applied with rounding at compile-time to the D[] | 81 | * First, a 14-bit shift is applied with rounding at compile-time to the D[] |
82 | * table of coefficients for the subband synthesis window. This only loses 2 | 82 | * table of coefficients for the subband synthesis window. This only loses 2 |
83 | * bits of accuracy because the lower 12 bits are always zero. A second | 83 | * bits of accuracy because the lower 12 bits are always zero. A second |
84 | * 12-bit shift occurs after the DCT calculation. This loses 12 bits of | 84 | * 12-bit shift occurs after the DCT calculation. This loses 12 bits of |
85 | * accuracy. Finally, a third 2-bit shift occurs just before the sample is | 85 | * accuracy. Finally, a third 2-bit shift occurs just before the sample is |
86 | * saved in the PCM buffer. 14 + 12 + 2 == 28 bits. | 86 | * saved in the PCM buffer. 14 + 12 + 2 == 28 bits. |
87 | */ | 87 | */ |
88 | 88 | ||
89 | /* FPM_DEFAULT without OPT_SSO will actually lose accuracy and performance */ | 89 | /* FPM_DEFAULT without OPT_SSO will actually lose accuracy and performance */ |
90 | 90 | ||
91 | # if defined(FPM_DEFAULT) && !defined(OPT_SSO) | 91 | # if defined(FPM_DEFAULT) && !defined(OPT_SSO) |
92 | # define OPT_SSO | 92 | # define OPT_SSO |
93 | # endif | 93 | # endif |
94 | 94 | ||
95 | /* second SSO shift, with rounding */ | 95 | /* second SSO shift, with rounding */ |
96 | 96 | ||
97 | # if defined(OPT_SSO) | 97 | # if defined(OPT_SSO) |
98 | # define SHIFT(x) (((x) + (1L << 11)) >> 12) | 98 | # define SHIFT(x) (((x) + (1L << 11)) >> 12) |
99 | # else | 99 | # else |
100 | # define SHIFT(x) (x) | 100 | # define SHIFT(x) (x) |
101 | # endif | 101 | # endif |
102 | 102 | ||
103 | /* possible DCT speed optimization */ | 103 | /* possible DCT speed optimization */ |
104 | 104 | ||
105 | # if defined(OPT_SPEED) && defined(MAD_F_MLX) | 105 | # if defined(OPT_SPEED) && defined(MAD_F_MLX) |
106 | # define OPT_DCTO | 106 | # define OPT_DCTO |
107 | # define MUL(x, y) \ | 107 | # define MUL(x, y) \ |
108 | ({ mad_fixed64hi_t hi; \ | 108 | ({ mad_fixed64hi_t hi; \ |
109 | mad_fixed64lo_t lo; \ | 109 | mad_fixed64lo_t lo; \ |
110 | MAD_F_MLX(hi, lo, (x), (y)); \ | 110 | MAD_F_MLX(hi, lo, (x), (y)); \ |
111 | hi << (32 - MAD_F_SCALEBITS - 3); \ | 111 | hi << (32 - MAD_F_SCALEBITS - 3); \ |
112 | }) | 112 | }) |
113 | # else | 113 | # else |
114 | # undef OPT_DCTO | 114 | # undef OPT_DCTO |
115 | # define MUL(x, y) mad_f_mul((x), (y)) | 115 | # define MUL(x, y) mad_f_mul((x), (y)) |
116 | # endif | 116 | # endif |
117 | 117 | ||
118 | /* | 118 | /* |
119 | * NAME:dct32() | 119 | * NAME:dct32() |
120 | * DESCRIPTION:perform fast in[32]->out[32] DCT | 120 | * DESCRIPTION:perform fast in[32]->out[32] DCT |
121 | */ | 121 | */ |
122 | static | 122 | static |
123 | void dct32(mad_fixed_t const in[32], unsigned int slot, | 123 | void dct32(mad_fixed_t const in[32], unsigned int slot, |
124 | mad_fixed_t lo[16][8], mad_fixed_t hi[16][8]) | 124 | mad_fixed_t lo[16][8], mad_fixed_t hi[16][8]) |
125 | { | 125 | { |
126 | mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7; | 126 | mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7; |
127 | mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15; | 127 | mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15; |
128 | mad_fixed_t t16, t17, t18, t19, t20, t21, t22, t23; | 128 | mad_fixed_t t16, t17, t18, t19, t20, t21, t22, t23; |
129 | mad_fixed_t t24, t25, t26, t27, t28, t29, t30, t31; | 129 | mad_fixed_t t24, t25, t26, t27, t28, t29, t30, t31; |
130 | mad_fixed_t t32, t33, t34, t35, t36, t37, t38, t39; | 130 | mad_fixed_t t32, t33, t34, t35, t36, t37, t38, t39; |
131 | mad_fixed_t t40, t41, t42, t43, t44, t45, t46, t47; | 131 | mad_fixed_t t40, t41, t42, t43, t44, t45, t46, t47; |
132 | mad_fixed_t t48, t49, t50, t51, t52, t53, t54, t55; | 132 | mad_fixed_t t48, t49, t50, t51, t52, t53, t54, t55; |
133 | mad_fixed_t t56, t57, t58, t59, t60, t61, t62, t63; | 133 | mad_fixed_t t56, t57, t58, t59, t60, t61, t62, t63; |
134 | mad_fixed_t t64, t65, t66, t67, t68, t69, t70, t71; | 134 | mad_fixed_t t64, t65, t66, t67, t68, t69, t70, t71; |
135 | mad_fixed_t t72, t73, t74, t75, t76, t77, t78, t79; | 135 | mad_fixed_t t72, t73, t74, t75, t76, t77, t78, t79; |
136 | mad_fixed_t t80, t81, t82, t83, t84, t85, t86, t87; | 136 | mad_fixed_t t80, t81, t82, t83, t84, t85, t86, t87; |
137 | mad_fixed_t t88, t89, t90, t91, t92, t93, t94, t95; | 137 | mad_fixed_t t88, t89, t90, t91, t92, t93, t94, t95; |
138 | mad_fixed_t t96, t97, t98, t99, t100, t101, t102, t103; | 138 | mad_fixed_t t96, t97, t98, t99, t100, t101, t102, t103; |
139 | mad_fixed_t t104, t105, t106, t107, t108, t109, t110, t111; | 139 | mad_fixed_t t104, t105, t106, t107, t108, t109, t110, t111; |
140 | mad_fixed_t t112, t113, t114, t115, t116, t117, t118, t119; | 140 | mad_fixed_t t112, t113, t114, t115, t116, t117, t118, t119; |
141 | mad_fixed_t t120, t121, t122, t123, t124, t125, t126, t127; | 141 | mad_fixed_t t120, t121, t122, t123, t124, t125, t126, t127; |
142 | mad_fixed_t t128, t129, t130, t131, t132, t133, t134, t135; | 142 | mad_fixed_t t128, t129, t130, t131, t132, t133, t134, t135; |
143 | mad_fixed_t t136, t137, t138, t139, t140, t141, t142, t143; | 143 | mad_fixed_t t136, t137, t138, t139, t140, t141, t142, t143; |
144 | mad_fixed_t t144, t145, t146, t147, t148, t149, t150, t151; | 144 | mad_fixed_t t144, t145, t146, t147, t148, t149, t150, t151; |
145 | mad_fixed_t t152, t153, t154, t155, t156, t157, t158, t159; | 145 | mad_fixed_t t152, t153, t154, t155, t156, t157, t158, t159; |
146 | mad_fixed_t t160, t161, t162, t163, t164, t165, t166, t167; | 146 | mad_fixed_t t160, t161, t162, t163, t164, t165, t166, t167; |
147 | mad_fixed_t t168, t169, t170, t171, t172, t173, t174, t175; | 147 | mad_fixed_t t168, t169, t170, t171, t172, t173, t174, t175; |
148 | mad_fixed_t t176; | 148 | mad_fixed_t t176; |
149 | 149 | ||
150 | /* costab[i] = cos(PI / (2 * 32) * i) */ | 150 | /* costab[i] = cos(PI / (2 * 32) * i) */ |
151 | 151 | ||
152 | # if defined(OPT_DCTO) | 152 | # if defined(OPT_DCTO) |
153 | # define costab1MAD_F(0x7fd8878e) | 153 | # define costab1MAD_F(0x7fd8878e) |
154 | # define costab2MAD_F(0x7f62368f) | 154 | # define costab2MAD_F(0x7f62368f) |
155 | # define costab3MAD_F(0x7e9d55fc) | 155 | # define costab3MAD_F(0x7e9d55fc) |
156 | # define costab4MAD_F(0x7d8a5f40) | 156 | # define costab4MAD_F(0x7d8a5f40) |
157 | # define costab5MAD_F(0x7c29fbee) | 157 | # define costab5MAD_F(0x7c29fbee) |
158 | # define costab6MAD_F(0x7a7d055b) | 158 | # define costab6MAD_F(0x7a7d055b) |
159 | # define costab7MAD_F(0x78848414) | 159 | # define costab7MAD_F(0x78848414) |
160 | # define costab8MAD_F(0x7641af3d) | 160 | # define costab8MAD_F(0x7641af3d) |
161 | # define costab9MAD_F(0x73b5ebd1) | 161 | # define costab9MAD_F(0x73b5ebd1) |
162 | # define costab10MAD_F(0x70e2cbc6) | 162 | # define costab10MAD_F(0x70e2cbc6) |
163 | # define costab11MAD_F(0x6dca0d14) | 163 | # define costab11MAD_F(0x6dca0d14) |
164 | # define costab12MAD_F(0x6a6d98a4) | 164 | # define costab12MAD_F(0x6a6d98a4) |
165 | # define costab13MAD_F(0x66cf8120) | 165 | # define costab13MAD_F(0x66cf8120) |
166 | # define costab14MAD_F(0x62f201ac) | 166 | # define costab14MAD_F(0x62f201ac) |
167 | # define costab15MAD_F(0x5ed77c8a) | 167 | # define costab15MAD_F(0x5ed77c8a) |
168 | # define costab16MAD_F(0x5a82799a) | 168 | # define costab16MAD_F(0x5a82799a) |
169 | # define costab17MAD_F(0x55f5a4d2) | 169 | # define costab17MAD_F(0x55f5a4d2) |
170 | # define costab18MAD_F(0x5133cc94) | 170 | # define costab18MAD_F(0x5133cc94) |
171 | # define costab19MAD_F(0x4c3fdff4) | 171 | # define costab19MAD_F(0x4c3fdff4) |
172 | # define costab20MAD_F(0x471cece7) | 172 | # define costab20MAD_F(0x471cece7) |
173 | # define costab21MAD_F(0x41ce1e65) | 173 | # define costab21MAD_F(0x41ce1e65) |
174 | # define costab22MAD_F(0x3c56ba70) | 174 | # define costab22MAD_F(0x3c56ba70) |
175 | # define costab23MAD_F(0x36ba2014) | 175 | # define costab23MAD_F(0x36ba2014) |
176 | # define costab24MAD_F(0x30fbc54d) | 176 | # define costab24MAD_F(0x30fbc54d) |
177 | # define costab25MAD_F(0x2b1f34eb) | 177 | # define costab25MAD_F(0x2b1f34eb) |
178 | # define costab26MAD_F(0x25280c5e) | 178 | # define costab26MAD_F(0x25280c5e) |
179 | # define costab27MAD_F(0x1f19f97b) | 179 | # define costab27MAD_F(0x1f19f97b) |
180 | # define costab28MAD_F(0x18f8b83c) | 180 | # define costab28MAD_F(0x18f8b83c) |
181 | # define costab29MAD_F(0x12c8106f) | 181 | # define costab29MAD_F(0x12c8106f) |
182 | # define costab30MAD_F(0x0c8bd35e) | 182 | # define costab30MAD_F(0x0c8bd35e) |
183 | # define costab31MAD_F(0x0647d97c) | 183 | # define costab31MAD_F(0x0647d97c) |
184 | # else | 184 | # else |
185 | # define costab1MAD_F(0x0ffb10f2) /* 0.998795456 */ | 185 | # define costab1MAD_F(0x0ffb10f2) /* 0.998795456 */ |
186 | # define costab2MAD_F(0x0fec46d2) /* 0.995184727 */ | 186 | # define costab2MAD_F(0x0fec46d2) /* 0.995184727 */ |
187 | # define costab3MAD_F(0x0fd3aac0) /* 0.989176510 */ | 187 | # define costab3MAD_F(0x0fd3aac0) /* 0.989176510 */ |
188 | # define costab4MAD_F(0x0fb14be8) /* 0.980785280 */ | 188 | # define costab4MAD_F(0x0fb14be8) /* 0.980785280 */ |
189 | # define costab5MAD_F(0x0f853f7e) /* 0.970031253 */ | 189 | # define costab5MAD_F(0x0f853f7e) /* 0.970031253 */ |
190 | # define costab6MAD_F(0x0f4fa0ab) /* 0.956940336 */ | 190 | # define costab6MAD_F(0x0f4fa0ab) /* 0.956940336 */ |
191 | # define costab7MAD_F(0x0f109082) /* 0.941544065 */ | 191 | # define costab7MAD_F(0x0f109082) /* 0.941544065 */ |
192 | # define costab8MAD_F(0x0ec835e8) /* 0.923879533 */ | 192 | # define costab8MAD_F(0x0ec835e8) /* 0.923879533 */ |
193 | # define costab9MAD_F(0x0e76bd7a) /* 0.903989293 */ | 193 | # define costab9MAD_F(0x0e76bd7a) /* 0.903989293 */ |
194 | # define costab10MAD_F(0x0e1c5979) /* 0.881921264 */ | 194 | # define costab10MAD_F(0x0e1c5979) /* 0.881921264 */ |
195 | # define costab11MAD_F(0x0db941a3) /* 0.857728610 */ | 195 | # define costab11MAD_F(0x0db941a3) /* 0.857728610 */ |
196 | # define costab12MAD_F(0x0d4db315) /* 0.831469612 */ | 196 | # define costab12MAD_F(0x0d4db315) /* 0.831469612 */ |
197 | # define costab13MAD_F(0x0cd9f024) /* 0.803207531 */ | 197 | # define costab13MAD_F(0x0cd9f024) /* 0.803207531 */ |
198 | # define costab14MAD_F(0x0c5e4036) /* 0.773010453 */ | 198 | # define costab14MAD_F(0x0c5e4036) /* 0.773010453 */ |
199 | # define costab15MAD_F(0x0bdaef91) /* 0.740951125 */ | 199 | # define costab15MAD_F(0x0bdaef91) /* 0.740951125 */ |
200 | # define costab16MAD_F(0x0b504f33) /* 0.707106781 */ | 200 | # define costab16MAD_F(0x0b504f33) /* 0.707106781 */ |
201 | # define costab17MAD_F(0x0abeb49a) /* 0.671558955 */ | 201 | # define costab17MAD_F(0x0abeb49a) /* 0.671558955 */ |
202 | # define costab18MAD_F(0x0a267993) /* 0.634393284 */ | 202 | # define costab18MAD_F(0x0a267993) /* 0.634393284 */ |
203 | # define costab19MAD_F(0x0987fbfe) /* 0.595699304 */ | 203 | # define costab19MAD_F(0x0987fbfe) /* 0.595699304 */ |
204 | # define costab20MAD_F(0x08e39d9d) /* 0.555570233 */ | 204 | # define costab20MAD_F(0x08e39d9d) /* 0.555570233 */ |
205 | # define costab21MAD_F(0x0839c3cd) /* 0.514102744 */ | 205 | # define costab21MAD_F(0x0839c3cd) /* 0.514102744 */ |
206 | # define costab22MAD_F(0x078ad74e) /* 0.471396737 */ | 206 | # define costab22MAD_F(0x078ad74e) /* 0.471396737 */ |
207 | # define costab23MAD_F(0x06d74402) /* 0.427555093 */ | 207 | # define costab23MAD_F(0x06d74402) /* 0.427555093 */ |
208 | # define costab24MAD_F(0x061f78aa) /* 0.382683432 */ | 208 | # define costab24MAD_F(0x061f78aa) /* 0.382683432 */ |
209 | # define costab25MAD_F(0x0563e69d) /* 0.336889853 */ | 209 | # define costab25MAD_F(0x0563e69d) /* 0.336889853 */ |
210 | # define costab26MAD_F(0x04a5018c) /* 0.290284677 */ | 210 | # define costab26MAD_F(0x04a5018c) /* 0.290284677 */ |
211 | # define costab27MAD_F(0x03e33f2f) /* 0.242980180 */ | 211 | # define costab27MAD_F(0x03e33f2f) /* 0.242980180 */ |
212 | # define costab28MAD_F(0x031f1708) /* 0.195090322 */ | 212 | # define costab28MAD_F(0x031f1708) /* 0.195090322 */ |
213 | # define costab29MAD_F(0x0259020e) /* 0.146730474 */ | 213 | # define costab29MAD_F(0x0259020e) /* 0.146730474 */ |
214 | # define costab30MAD_F(0x01917a6c) /* 0.098017140 */ | 214 | # define costab30MAD_F(0x01917a6c) /* 0.098017140 */ |
215 | # define costab31MAD_F(0x00c8fb30) /* 0.049067674 */ | 215 | # define costab31MAD_F(0x00c8fb30) /* 0.049067674 */ |
216 | # endif | 216 | # endif |
217 | 217 | ||
218 | t0 = in[0] + in[31]; t16 = MUL(in[0] - in[31], costab1); | 218 | t0 = in[0] + in[31]; t16 = MUL(in[0] - in[31], costab1); |
219 | t1 = in[15] + in[16]; t17 = MUL(in[15] - in[16], costab31); | 219 | t1 = in[15] + in[16]; t17 = MUL(in[15] - in[16], costab31); |
220 | 220 | ||
221 | t41 = t16 + t17; | 221 | t41 = t16 + t17; |
222 | t59 = MUL(t16 - t17, costab2); | 222 | t59 = MUL(t16 - t17, costab2); |
223 | t33 = t0 + t1; | 223 | t33 = t0 + t1; |
224 | t50 = MUL(t0 - t1, costab2); | 224 | t50 = MUL(t0 - t1, costab2); |
225 | 225 | ||
226 | t2 = in[7] + in[24]; t18 = MUL(in[7] - in[24], costab15); | 226 | t2 = in[7] + in[24]; t18 = MUL(in[7] - in[24], costab15); |
227 | t3 = in[8] + in[23]; t19 = MUL(in[8] - in[23], costab17); | 227 | t3 = in[8] + in[23]; t19 = MUL(in[8] - in[23], costab17); |
228 | 228 | ||
229 | t42 = t18 + t19; | 229 | t42 = t18 + t19; |
230 | t60 = MUL(t18 - t19, costab30); | 230 | t60 = MUL(t18 - t19, costab30); |
231 | t34 = t2 + t3; | 231 | t34 = t2 + t3; |
232 | t51 = MUL(t2 - t3, costab30); | 232 | t51 = MUL(t2 - t3, costab30); |
233 | 233 | ||
234 | t4 = in[3] + in[28]; t20 = MUL(in[3] - in[28], costab7); | 234 | t4 = in[3] + in[28]; t20 = MUL(in[3] - in[28], costab7); |
235 | t5 = in[12] + in[19]; t21 = MUL(in[12] - in[19], costab25); | 235 | t5 = in[12] + in[19]; t21 = MUL(in[12] - in[19], costab25); |
236 | 236 | ||
237 | t43 = t20 + t21; | 237 | t43 = t20 + t21; |
238 | t61 = MUL(t20 - t21, costab14); | 238 | t61 = MUL(t20 - t21, costab14); |
239 | t35 = t4 + t5; | 239 | t35 = t4 + t5; |
240 | t52 = MUL(t4 - t5, costab14); | 240 | t52 = MUL(t4 - t5, costab14); |
241 | 241 | ||
242 | t6 = in[4] + in[27]; t22 = MUL(in[4] - in[27], costab9); | 242 | t6 = in[4] + in[27]; t22 = MUL(in[4] - in[27], costab9); |
243 | t7 = in[11] + in[20]; t23 = MUL(in[11] - in[20], costab23); | 243 | t7 = in[11] + in[20]; t23 = MUL(in[11] - in[20], costab23); |
244 | 244 | ||
245 | t44 = t22 + t23; | 245 | t44 = t22 + t23; |
246 | t62 = MUL(t22 - t23, costab18); | 246 | t62 = MUL(t22 - t23, costab18); |
247 | t36 = t6 + t7; | 247 | t36 = t6 + t7; |
248 | t53 = MUL(t6 - t7, costab18); | 248 | t53 = MUL(t6 - t7, costab18); |
249 | 249 | ||
250 | t8 = in[1] + in[30]; t24 = MUL(in[1] - in[30], costab3); | 250 | t8 = in[1] + in[30]; t24 = MUL(in[1] - in[30], costab3); |
251 | t9 = in[14] + in[17]; t25 = MUL(in[14] - in[17], costab29); | 251 | t9 = in[14] + in[17]; t25 = MUL(in[14] - in[17], costab29); |
252 | 252 | ||
253 | t45 = t24 + t25; | 253 | t45 = t24 + t25; |
254 | t63 = MUL(t24 - t25, costab6); | 254 | t63 = MUL(t24 - t25, costab6); |
255 | t37 = t8 + t9; | 255 | t37 = t8 + t9; |
256 | t54 = MUL(t8 - t9, costab6); | 256 | t54 = MUL(t8 - t9, costab6); |
257 | 257 | ||
258 | t10 = in[6] + in[25]; t26 = MUL(in[6] - in[25], costab13); | 258 | t10 = in[6] + in[25]; t26 = MUL(in[6] - in[25], costab13); |
259 | t11 = in[9] + in[22]; t27 = MUL(in[9] - in[22], costab19); | 259 | t11 = in[9] + in[22]; t27 = MUL(in[9] - in[22], costab19); |
260 | 260 | ||
261 | t46 = t26 + t27; | 261 | t46 = t26 + t27; |
262 | t64 = MUL(t26 - t27, costab26); | 262 | t64 = MUL(t26 - t27, costab26); |
263 | t38 = t10 + t11; | 263 | t38 = t10 + t11; |
264 | t55 = MUL(t10 - t11, costab26); | 264 | t55 = MUL(t10 - t11, costab26); |
265 | 265 | ||
266 | t12 = in[2] + in[29]; t28 = MUL(in[2] - in[29], costab5); | 266 | t12 = in[2] + in[29]; t28 = MUL(in[2] - in[29], costab5); |
267 | t13 = in[13] + in[18]; t29 = MUL(in[13] - in[18], costab27); | 267 | t13 = in[13] + in[18]; t29 = MUL(in[13] - in[18], costab27); |
268 | 268 | ||
269 | t47 = t28 + t29; | 269 | t47 = t28 + t29; |
270 | t65 = MUL(t28 - t29, costab10); | 270 | t65 = MUL(t28 - t29, costab10); |
271 | t39 = t12 + t13; | 271 | t39 = t12 + t13; |
272 | t56 = MUL(t12 - t13, costab10); | 272 | t56 = MUL(t12 - t13, costab10); |
273 | 273 | ||
274 | t14 = in[5] + in[26]; t30 = MUL(in[5] - in[26], costab11); | 274 | t14 = in[5] + in[26]; t30 = MUL(in[5] - in[26], costab11); |
275 | t15 = in[10] + in[21]; t31 = MUL(in[10] - in[21], costab21); | 275 | t15 = in[10] + in[21]; t31 = MUL(in[10] - in[21], costab21); |
276 | 276 | ||
277 | t48 = t30 + t31; | 277 | t48 = t30 + t31; |
278 | t66 = MUL(t30 - t31, costab22); | 278 | t66 = MUL(t30 - t31, costab22); |
279 | t40 = t14 + t15; | 279 | t40 = t14 + t15; |
280 | t57 = MUL(t14 - t15, costab22); | 280 | t57 = MUL(t14 - t15, costab22); |
281 | 281 | ||
282 | t69 = t33 + t34; t89 = MUL(t33 - t34, costab4); | 282 | t69 = t33 + t34; t89 = MUL(t33 - t34, costab4); |
283 | t70 = t35 + t36; t90 = MUL(t35 - t36, costab28); | 283 | t70 = t35 + t36; t90 = MUL(t35 - t36, costab28); |
284 | t71 = t37 + t38; t91 = MUL(t37 - t38, costab12); | 284 | t71 = t37 + t38; t91 = MUL(t37 - t38, costab12); |
285 | t72 = t39 + t40; t92 = MUL(t39 - t40, costab20); | 285 | t72 = t39 + t40; t92 = MUL(t39 - t40, costab20); |
286 | t73 = t41 + t42; t94 = MUL(t41 - t42, costab4); | 286 | t73 = t41 + t42; t94 = MUL(t41 - t42, costab4); |
287 | t74 = t43 + t44; t95 = MUL(t43 - t44, costab28); | 287 | t74 = t43 + t44; t95 = MUL(t43 - t44, costab28); |
288 | t75 = t45 + t46; t96 = MUL(t45 - t46, costab12); | 288 | t75 = t45 + t46; t96 = MUL(t45 - t46, costab12); |
289 | t76 = t47 + t48; t97 = MUL(t47 - t48, costab20); | 289 | t76 = t47 + t48; t97 = MUL(t47 - t48, costab20); |
290 | 290 | ||
291 | t78 = t50 + t51; t100 = MUL(t50 - t51, costab4); | 291 | t78 = t50 + t51; t100 = MUL(t50 - t51, costab4); |
292 | t79 = t52 + t53; t101 = MUL(t52 - t53, costab28); | 292 | t79 = t52 + t53; t101 = MUL(t52 - t53, costab28); |
293 | t80 = t54 + t55; t102 = MUL(t54 - t55, costab12); | 293 | t80 = t54 + t55; t102 = MUL(t54 - t55, costab12); |
294 | t81 = t56 + t57; t103 = MUL(t56 - t57, costab20); | 294 | t81 = t56 + t57; t103 = MUL(t56 - t57, costab20); |
295 | 295 | ||
296 | t83 = t59 + t60; t106 = MUL(t59 - t60, costab4); | 296 | t83 = t59 + t60; t106 = MUL(t59 - t60, costab4); |
297 | t84 = t61 + t62; t107 = MUL(t61 - t62, costab28); | 297 | t84 = t61 + t62; t107 = MUL(t61 - t62, costab28); |
298 | t85 = t63 + t64; t108 = MUL(t63 - t64, costab12); | 298 | t85 = t63 + t64; t108 = MUL(t63 - t64, costab12); |
299 | t86 = t65 + t66; t109 = MUL(t65 - t66, costab20); | 299 | t86 = t65 + t66; t109 = MUL(t65 - t66, costab20); |
300 | 300 | ||
301 | t113 = t69 + t70; | 301 | t113 = t69 + t70; |
302 | t114 = t71 + t72; | 302 | t114 = t71 + t72; |
303 | 303 | ||
304 | /* 0 */ hi[15][slot] = SHIFT(t113 + t114); | 304 | /* 0 */ hi[15][slot] = SHIFT(t113 + t114); |
305 | /* 16 */ lo[ 0][slot] = SHIFT(MUL(t113 - t114, costab16)); | 305 | /* 16 */ lo[ 0][slot] = SHIFT(MUL(t113 - t114, costab16)); |
306 | 306 | ||
307 | t115 = t73 + t74; | 307 | t115 = t73 + t74; |
308 | t116 = t75 + t76; | 308 | t116 = t75 + t76; |
309 | 309 | ||
310 | t32 = t115 + t116; | 310 | t32 = t115 + t116; |
311 | 311 | ||
312 | /* 1 */ hi[14][slot] = SHIFT(t32); | 312 | /* 1 */ hi[14][slot] = SHIFT(t32); |
313 | 313 | ||
314 | t118 = t78 + t79; | 314 | t118 = t78 + t79; |
315 | t119 = t80 + t81; | 315 | t119 = t80 + t81; |
316 | 316 | ||
317 | t58 = t118 + t119; | 317 | t58 = t118 + t119; |
318 | 318 | ||
319 | /* 2 */ hi[13][slot] = SHIFT(t58); | 319 | /* 2 */ hi[13][slot] = SHIFT(t58); |
320 | 320 | ||
321 | t121 = t83 + t84; | 321 | t121 = t83 + t84; |
322 | t122 = t85 + t86; | 322 | t122 = t85 + t86; |
323 | 323 | ||
324 | t67 = t121 + t122; | 324 | t67 = t121 + t122; |
325 | 325 | ||
326 | t49 = (t67 * 2) - t32; | 326 | t49 = (t67 * 2) - t32; |
327 | 327 | ||
328 | /* 3 */ hi[12][slot] = SHIFT(t49); | 328 | /* 3 */ hi[12][slot] = SHIFT(t49); |
329 | 329 | ||
330 | t125 = t89 + t90; | 330 | t125 = t89 + t90; |
331 | t126 = t91 + t92; | 331 | t126 = t91 + t92; |
332 | 332 | ||
333 | t93 = t125 + t126; | 333 | t93 = t125 + t126; |
334 | 334 | ||
335 | /* 4 */ hi[11][slot] = SHIFT(t93); | 335 | /* 4 */ hi[11][slot] = SHIFT(t93); |
336 | 336 | ||
337 | t128 = t94 + t95; | 337 | t128 = t94 + t95; |
338 | t129 = t96 + t97; | 338 | t129 = t96 + t97; |
339 | 339 | ||
340 | t98 = t128 + t129; | 340 | t98 = t128 + t129; |
341 | 341 | ||
342 | t68 = (t98 * 2) - t49; | 342 | t68 = (t98 * 2) - t49; |
343 | 343 | ||
344 | /* 5 */ hi[10][slot] = SHIFT(t68); | 344 | /* 5 */ hi[10][slot] = SHIFT(t68); |
345 | 345 | ||
346 | t132 = t100 + t101; | 346 | t132 = t100 + t101; |
347 | t133 = t102 + t103; | 347 | t133 = t102 + t103; |
348 | 348 | ||
349 | t104 = t132 + t133; | 349 | t104 = t132 + t133; |
350 | 350 | ||
351 | t82 = (t104 * 2) - t58; | 351 | t82 = (t104 * 2) - t58; |
352 | 352 | ||
353 | /* 6 */ hi[ 9][slot] = SHIFT(t82); | 353 | /* 6 */ hi[ 9][slot] = SHIFT(t82); |
354 | 354 | ||
355 | t136 = t106 + t107; | 355 | t136 = t106 + t107; |
356 | t137 = t108 + t109; | 356 | t137 = t108 + t109; |
357 | 357 | ||
358 | t110 = t136 + t137; | 358 | t110 = t136 + t137; |
359 | 359 | ||
360 | t87 = (t110 * 2) - t67; | 360 | t87 = (t110 * 2) - t67; |
361 | 361 | ||
362 | t77 = (t87 * 2) - t68; | 362 | t77 = (t87 * 2) - t68; |
363 | 363 | ||
364 | /* 7 */ hi[ 8][slot] = SHIFT(t77); | 364 | /* 7 */ hi[ 8][slot] = SHIFT(t77); |
365 | 365 | ||
366 | t141 = MUL(t69 - t70, costab8); | 366 | t141 = MUL(t69 - t70, costab8); |
367 | t142 = MUL(t71 - t72, costab24); | 367 | t142 = MUL(t71 - t72, costab24); |
368 | t143 = t141 + t142; | 368 | t143 = t141 + t142; |
369 | 369 | ||
370 | /* 8 */ hi[ 7][slot] = SHIFT(t143); | 370 | /* 8 */ hi[ 7][slot] = SHIFT(t143); |
371 | /* 24 */ lo[ 8][slot] = | 371 | /* 24 */ lo[ 8][slot] = |
372 | SHIFT((MUL(t141 - t142, costab16) * 2) - t143); | 372 | SHIFT((MUL(t141 - t142, costab16) * 2) - t143); |
373 | 373 | ||
374 | t144 = MUL(t73 - t74, costab8); | 374 | t144 = MUL(t73 - t74, costab8); |
375 | t145 = MUL(t75 - t76, costab24); | 375 | t145 = MUL(t75 - t76, costab24); |
376 | t146 = t144 + t145; | 376 | t146 = t144 + t145; |
377 | 377 | ||
378 | t88 = (t146 * 2) - t77; | 378 | t88 = (t146 * 2) - t77; |
379 | 379 | ||
380 | /* 9 */ hi[ 6][slot] = SHIFT(t88); | 380 | /* 9 */ hi[ 6][slot] = SHIFT(t88); |
381 | 381 | ||
382 | t148 = MUL(t78 - t79, costab8); | 382 | t148 = MUL(t78 - t79, costab8); |
383 | t149 = MUL(t80 - t81, costab24); | 383 | t149 = MUL(t80 - t81, costab24); |
384 | t150 = t148 + t149; | 384 | t150 = t148 + t149; |
385 | 385 | ||
386 | t105 = (t150 * 2) - t82; | 386 | t105 = (t150 * 2) - t82; |
387 | 387 | ||
388 | /* 10 */ hi[ 5][slot] = SHIFT(t105); | 388 | /* 10 */ hi[ 5][slot] = SHIFT(t105); |
389 | 389 | ||
390 | t152 = MUL(t83 - t84, costab8); | 390 | t152 = MUL(t83 - t84, costab8); |
391 | t153 = MUL(t85 - t86, costab24); | 391 | t153 = MUL(t85 - t86, costab24); |
392 | t154 = t152 + t153; | 392 | t154 = t152 + t153; |
393 | 393 | ||
394 | t111 = (t154 * 2) - t87; | 394 | t111 = (t154 * 2) - t87; |
395 | 395 | ||
396 | t99 = (t111 * 2) - t88; | 396 | t99 = (t111 * 2) - t88; |
397 | 397 | ||
398 | /* 11 */ hi[ 4][slot] = SHIFT(t99); | 398 | /* 11 */ hi[ 4][slot] = SHIFT(t99); |
399 | 399 | ||
400 | t157 = MUL(t89 - t90, costab8); | 400 | t157 = MUL(t89 - t90, costab8); |
401 | t158 = MUL(t91 - t92, costab24); | 401 | t158 = MUL(t91 - t92, costab24); |
402 | t159 = t157 + t158; | 402 | t159 = t157 + t158; |
403 | 403 | ||
404 | t127 = (t159 * 2) - t93; | 404 | t127 = (t159 * 2) - t93; |
405 | 405 | ||
406 | /* 12 */ hi[ 3][slot] = SHIFT(t127); | 406 | /* 12 */ hi[ 3][slot] = SHIFT(t127); |
407 | 407 | ||
408 | t160 = (MUL(t125 - t126, costab16) * 2) - t127; | 408 | t160 = (MUL(t125 - t126, costab16) * 2) - t127; |
409 | 409 | ||
410 | /* 20 */ lo[ 4][slot] = SHIFT(t160); | 410 | /* 20 */ lo[ 4][slot] = SHIFT(t160); |
411 | /* 28 */ lo[12][slot] = | 411 | /* 28 */ lo[12][slot] = |
412 | SHIFT((((MUL(t157 - t158, costab16) * 2) - t159) * 2) - t160); | 412 | SHIFT((((MUL(t157 - t158, costab16) * 2) - t159) * 2) - t160); |
413 | 413 | ||
414 | t161 = MUL(t94 - t95, costab8); | 414 | t161 = MUL(t94 - t95, costab8); |
415 | t162 = MUL(t96 - t97, costab24); | 415 | t162 = MUL(t96 - t97, costab24); |
416 | t163 = t161 + t162; | 416 | t163 = t161 + t162; |
417 | 417 | ||
418 | t130 = (t163 * 2) - t98; | 418 | t130 = (t163 * 2) - t98; |
419 | 419 | ||
420 | t112 = (t130 * 2) - t99; | 420 | t112 = (t130 * 2) - t99; |
421 | 421 | ||
422 | /* 13 */ hi[ 2][slot] = SHIFT(t112); | 422 | /* 13 */ hi[ 2][slot] = SHIFT(t112); |
423 | 423 | ||
424 | t164 = (MUL(t128 - t129, costab16) * 2) - t130; | 424 | t164 = (MUL(t128 - t129, costab16) * 2) - t130; |
425 | 425 | ||
426 | t166 = MUL(t100 - t101, costab8); | 426 | t166 = MUL(t100 - t101, costab8); |
427 | t167 = MUL(t102 - t103, costab24); | 427 | t167 = MUL(t102 - t103, costab24); |
428 | t168 = t166 + t167; | 428 | t168 = t166 + t167; |
429 | 429 | ||
430 | t134 = (t168 * 2) - t104; | 430 | t134 = (t168 * 2) - t104; |
431 | 431 | ||
432 | t120 = (t134 * 2) - t105; | 432 | t120 = (t134 * 2) - t105; |
433 | 433 | ||
434 | /* 14 */ hi[ 1][slot] = SHIFT(t120); | 434 | /* 14 */ hi[ 1][slot] = SHIFT(t120); |
435 | 435 | ||
436 | t135 = (MUL(t118 - t119, costab16) * 2) - t120; | 436 | t135 = (MUL(t118 - t119, costab16) * 2) - t120; |
437 | 437 | ||
438 | /* 18 */ lo[ 2][slot] = SHIFT(t135); | 438 | /* 18 */ lo[ 2][slot] = SHIFT(t135); |
439 | 439 | ||
440 | t169 = (MUL(t132 - t133, costab16) * 2) - t134; | 440 | t169 = (MUL(t132 - t133, costab16) * 2) - t134; |
441 | 441 | ||
442 | t151 = (t169 * 2) - t135; | 442 | t151 = (t169 * 2) - t135; |
443 | 443 | ||
444 | /* 22 */ lo[ 6][slot] = SHIFT(t151); | 444 | /* 22 */ lo[ 6][slot] = SHIFT(t151); |
445 | 445 | ||
446 | t170 = (((MUL(t148 - t149, costab16) * 2) - t150) * 2) - t151; | 446 | t170 = (((MUL(t148 - t149, costab16) * 2) - t150) * 2) - t151; |
447 | 447 | ||
448 | /* 26 */ lo[10][slot] = SHIFT(t170); | 448 | /* 26 */ lo[10][slot] = SHIFT(t170); |
449 | /* 30 */ lo[14][slot] = | 449 | /* 30 */ lo[14][slot] = |
450 | SHIFT((((((MUL(t166 - t167, costab16) * 2) - | 450 | SHIFT((((((MUL(t166 - t167, costab16) * 2) - |
451 | t168) * 2) - t169) * 2) - t170); | 451 | t168) * 2) - t169) * 2) - t170); |
452 | 452 | ||
453 | t171 = MUL(t106 - t107, costab8); | 453 | t171 = MUL(t106 - t107, costab8); |
454 | t172 = MUL(t108 - t109, costab24); | 454 | t172 = MUL(t108 - t109, costab24); |
455 | t173 = t171 + t172; | 455 | t173 = t171 + t172; |
456 | 456 | ||
457 | t138 = (t173 * 2) - t110; | 457 | t138 = (t173 * 2) - t110; |
458 | 458 | ||
459 | t123 = (t138 * 2) - t111; | 459 | t123 = (t138 * 2) - t111; |
460 | 460 | ||
461 | t139 = (MUL(t121 - t122, costab16) * 2) - t123; | 461 | t139 = (MUL(t121 - t122, costab16) * 2) - t123; |
462 | 462 | ||
463 | t117 = (t123 * 2) - t112; | 463 | t117 = (t123 * 2) - t112; |
464 | 464 | ||
465 | /* 15 */ hi[ 0][slot] = SHIFT(t117); | 465 | /* 15 */ hi[ 0][slot] = SHIFT(t117); |
466 | 466 | ||
467 | t124 = (MUL(t115 - t116, costab16) * 2) - t117; | 467 | t124 = (MUL(t115 - t116, costab16) * 2) - t117; |
468 | 468 | ||
469 | /* 17 */ lo[ 1][slot] = SHIFT(t124); | 469 | /* 17 */ lo[ 1][slot] = SHIFT(t124); |
470 | 470 | ||
471 | t131 = (t139 * 2) - t124; | 471 | t131 = (t139 * 2) - t124; |
472 | 472 | ||
473 | /* 19 */ lo[ 3][slot] = SHIFT(t131); | 473 | /* 19 */ lo[ 3][slot] = SHIFT(t131); |
474 | 474 | ||
475 | t140 = (t164 * 2) - t131; | 475 | t140 = (t164 * 2) - t131; |
476 | 476 | ||
477 | /* 21 */ lo[ 5][slot] = SHIFT(t140); | 477 | /* 21 */ lo[ 5][slot] = SHIFT(t140); |
478 | 478 | ||
479 | t174 = (MUL(t136 - t137, costab16) * 2) - t138; | 479 | t174 = (MUL(t136 - t137, costab16) * 2) - t138; |
480 | 480 | ||
481 | t155 = (t174 * 2) - t139; | 481 | t155 = (t174 * 2) - t139; |
482 | 482 | ||
483 | t147 = (t155 * 2) - t140; | 483 | t147 = (t155 * 2) - t140; |
484 | 484 | ||
485 | /* 23 */ lo[ 7][slot] = SHIFT(t147); | 485 | /* 23 */ lo[ 7][slot] = SHIFT(t147); |
486 | 486 | ||
487 | t156 = (((MUL(t144 - t145, costab16) * 2) - t146) * 2) - t147; | 487 | t156 = (((MUL(t144 - t145, costab16) * 2) - t146) * 2) - t147; |
488 | 488 | ||
489 | /* 25 */ lo[ 9][slot] = SHIFT(t156); | 489 | /* 25 */ lo[ 9][slot] = SHIFT(t156); |
490 | 490 | ||
491 | t175 = (((MUL(t152 - t153, costab16) * 2) - t154) * 2) - t155; | 491 | t175 = (((MUL(t152 - t153, costab16) * 2) - t154) * 2) - t155; |
492 | 492 | ||
493 | t165 = (t175 * 2) - t156; | 493 | t165 = (t175 * 2) - t156; |
494 | 494 | ||
495 | /* 27 */ lo[11][slot] = SHIFT(t165); | 495 | /* 27 */ lo[11][slot] = SHIFT(t165); |
496 | 496 | ||
497 | t176 = (((((MUL(t161 - t162, costab16) * 2) - | 497 | t176 = (((((MUL(t161 - t162, costab16) * 2) - |
498 | t163) * 2) - t164) * 2) - t165; | 498 | t163) * 2) - t164) * 2) - t165; |
499 | 499 | ||
500 | /* 29 */ lo[13][slot] = SHIFT(t176); | 500 | /* 29 */ lo[13][slot] = SHIFT(t176); |
501 | /* 31 */ lo[15][slot] = | 501 | /* 31 */ lo[15][slot] = |
502 | SHIFT((((((((MUL(t171 - t172, costab16) * 2) - | 502 | SHIFT((((((((MUL(t171 - t172, costab16) * 2) - |
503 | t173) * 2) - t174) * 2) - t175) * 2) - t176); | 503 | t173) * 2) - t174) * 2) - t175) * 2) - t176); |
504 | 504 | ||
505 | /* | 505 | /* |
506 | * Totals: | 506 | * Totals: |
507 | * 80 multiplies | 507 | * 80 multiplies |
508 | * 80 additions | 508 | * 80 additions |
509 | * 119 subtractions | 509 | * 119 subtractions |
510 | * 49 shifts (not counting SSO) | 510 | * 49 shifts (not counting SSO) |
511 | */ | 511 | */ |
512 | } | 512 | } |
513 | 513 | ||
514 | # undef MUL | 514 | # undef MUL |
515 | # undef SHIFT | 515 | # undef SHIFT |
516 | 516 | ||
517 | /* third SSO shift and/or D[] optimization preshift */ | 517 | /* third SSO shift and/or D[] optimization preshift */ |
518 | 518 | ||
519 | # if defined(OPT_SSO) | 519 | # if defined(OPT_SSO) |
520 | # if MAD_F_FRACBITS != 28 | 520 | # if MAD_F_FRACBITS != 28 |
521 | # error "MAD_F_FRACBITS must be 28 to use OPT_SSO" | 521 | # error "MAD_F_FRACBITS must be 28 to use OPT_SSO" |
522 | # endif | 522 | # endif |
523 | # define ML0(hi, lo, x, y)((lo) = (x) * (y)) | 523 | # define ML0(hi, lo, x, y)((lo) = (x) * (y)) |
524 | # define MLA(hi, lo, x, y)((lo) += (x) * (y)) | 524 | # define MLA(hi, lo, x, y)((lo) += (x) * (y)) |
525 | # define MLN(hi, lo) ((lo) = -(lo)) | 525 | # define MLN(hi, lo) ((lo) = -(lo)) |
526 | # define MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) | 526 | # define MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) |
527 | # define SHIFT(x) ((x) >> 2) | 527 | # define SHIFT(x) ((x) >> 2) |
528 | # define PRESHIFT(x) ((MAD_F(x) + (1L << 13)) >> 14) | 528 | # define PRESHIFT(x) ((MAD_F(x) + (1L << 13)) >> 14) |
529 | # else | 529 | # else |
530 | # define ML0(hi, lo, x, y)MAD_F_ML0((hi), (lo), (x), (y)) | 530 | # define ML0(hi, lo, x, y)MAD_F_ML0((hi), (lo), (x), (y)) |
531 | # define MLA(hi, lo, x, y)MAD_F_MLA((hi), (lo), (x), (y)) | 531 | # define MLA(hi, lo, x, y)MAD_F_MLA((hi), (lo), (x), (y)) |
532 | # define MLN(hi, lo) MAD_F_MLN((hi), (lo)) | 532 | # define MLN(hi, lo) MAD_F_MLN((hi), (lo)) |
533 | # define MLZ(hi, lo) MAD_F_MLZ((hi), (lo)) | 533 | # define MLZ(hi, lo) MAD_F_MLZ((hi), (lo)) |
534 | # define SHIFT(x) (x) | 534 | # define SHIFT(x) (x) |
535 | # if defined(MAD_F_SCALEBITS) | 535 | # if defined(MAD_F_SCALEBITS) |
536 | # undef MAD_F_SCALEBITS | 536 | # undef MAD_F_SCALEBITS |
537 | # define MAD_F_SCALEBITS(MAD_F_FRACBITS - 12) | 537 | # define MAD_F_SCALEBITS(MAD_F_FRACBITS - 12) |
538 | # define PRESHIFT(x) (MAD_F(x) >> 12) | 538 | # define PRESHIFT(x) (MAD_F(x) >> 12) |
539 | # else | 539 | # else |
540 | # define PRESHIFT(x) MAD_F(x) | 540 | # define PRESHIFT(x) MAD_F(x) |
541 | # endif | 541 | # endif |
542 | # endif | 542 | # endif |
543 | 543 | ||
544 | static | 544 | static |
545 | mad_fixed_t const D[17][32] = { | 545 | mad_fixed_t const D[17][32] = { |
546 | # include "D.dat" | 546 | # include "D.dat" |
547 | }; | 547 | }; |
548 | 548 | ||
549 | # if defined(ASO_SYNTH) | 549 | # if defined(ASO_SYNTH) |
550 | void synth_full(struct mad_synth *, struct mad_frame const *, | 550 | void synth_full(struct mad_synth *, struct mad_frame const *, |
551 | unsigned int, unsigned int); | 551 | unsigned int, unsigned int); |
552 | # else | 552 | # else |
553 | /* | 553 | /* |
554 | * NAME:synth->full() | 554 | * NAME:synth->full() |
555 | * DESCRIPTION:perform full frequency PCM synthesis | 555 | * DESCRIPTION:perform full frequency PCM synthesis |
556 | */ | 556 | */ |
557 | static | 557 | static |
558 | void synth_full(struct mad_synth *synth, struct mad_frame const *frame, | 558 | void synth_full(struct mad_synth *synth, struct mad_frame const *frame, |
559 | unsigned int nch, unsigned int ns) | 559 | unsigned int nch, unsigned int ns) |
560 | { | 560 | { |
561 | unsigned int phase, ch, s, sb, pe, po; | 561 | unsigned int phase, ch, s, sb, pe, po; |
562 | mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8]; | 562 | mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8]; |
563 | mad_fixed_t const (*sbsample)[36][32]; | 563 | mad_fixed_t const (*sbsample)[36][32]; |
564 | register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8]; | 564 | register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8]; |
565 | register mad_fixed_t const (*Dptr)[32], *ptr; | 565 | register mad_fixed_t const (*Dptr)[32], *ptr; |
566 | register mad_fixed64hi_t hi; | 566 | register mad_fixed64hi_t hi; |
567 | register mad_fixed64lo_t lo; | 567 | register mad_fixed64lo_t lo; |
568 | 568 | ||
569 | for (ch = 0; ch < nch; ++ch) { | 569 | for (ch = 0; ch < nch; ++ch) { |
570 | sbsample = &frame->sbsample[ch]; | 570 | sbsample = &frame->sbsample[ch]; |
571 | filter = &synth->filter[ch]; | 571 | filter = &synth->filter[ch]; |
572 | phase = synth->phase; | 572 | phase = synth->phase; |
573 | pcm1 = synth->pcm.samples[ch]; | 573 | pcm1 = synth->pcm.samples[ch]; |
574 | 574 | ||
575 | for (s = 0; s < ns; ++s) { | 575 | for (s = 0; s < ns; ++s) { |
576 | dct32((*sbsample)[s], phase >> 1, | 576 | dct32((*sbsample)[s], phase >> 1, |
577 | (*filter)[0][phase & 1], (*filter)[1][phase & 1]); | 577 | (*filter)[0][phase & 1], (*filter)[1][phase & 1]); |
578 | 578 | ||
579 | pe = phase & ~1; | 579 | pe = phase & ~1; |
580 | po = ((phase - 1) & 0xf) | 1; | 580 | po = ((phase - 1) & 0xf) | 1; |
581 | 581 | ||
582 | /* calculate 32 samples */ | 582 | /* calculate 32 samples */ |
583 | 583 | ||
584 | fe = &(*filter)[0][ phase & 1][0]; | 584 | fe = &(*filter)[0][ phase & 1][0]; |
585 | fx = &(*filter)[0][~phase & 1][0]; | 585 | fx = &(*filter)[0][~phase & 1][0]; |
586 | fo = &(*filter)[1][~phase & 1][0]; | 586 | fo = &(*filter)[1][~phase & 1][0]; |
587 | 587 | ||
588 | Dptr = &D[0]; | 588 | Dptr = &D[0]; |
589 | 589 | ||
590 | ptr = *Dptr + po; | 590 | ptr = *Dptr + po; |
591 | ML0(hi, lo, (*fx)[0], ptr[ 0]); | 591 | ML0(hi, lo, (*fx)[0], ptr[ 0]); |
592 | MLA(hi, lo, (*fx)[1], ptr[14]); | 592 | MLA(hi, lo, (*fx)[1], ptr[14]); |
593 | MLA(hi, lo, (*fx)[2], ptr[12]); | 593 | MLA(hi, lo, (*fx)[2], ptr[12]); |
594 | MLA(hi, lo, (*fx)[3], ptr[10]); | 594 | MLA(hi, lo, (*fx)[3], ptr[10]); |
595 | MLA(hi, lo, (*fx)[4], ptr[ 8]); | 595 | MLA(hi, lo, (*fx)[4], ptr[ 8]); |
596 | MLA(hi, lo, (*fx)[5], ptr[ 6]); | 596 | MLA(hi, lo, (*fx)[5], ptr[ 6]); |
597 | MLA(hi, lo, (*fx)[6], ptr[ 4]); | 597 | MLA(hi, lo, (*fx)[6], ptr[ 4]); |
598 | MLA(hi, lo, (*fx)[7], ptr[ 2]); | 598 | MLA(hi, lo, (*fx)[7], ptr[ 2]); |
599 | MLN(hi, lo); | 599 | MLN(hi, lo); |
600 | 600 | ||
601 | ptr = *Dptr + pe; | 601 | ptr = *Dptr + pe; |
602 | MLA(hi, lo, (*fe)[0], ptr[ 0]); | 602 | MLA(hi, lo, (*fe)[0], ptr[ 0]); |
603 | MLA(hi, lo, (*fe)[1], ptr[14]); | 603 | MLA(hi, lo, (*fe)[1], ptr[14]); |
604 | MLA(hi, lo, (*fe)[2], ptr[12]); | 604 | MLA(hi, lo, (*fe)[2], ptr[12]); |
605 | MLA(hi, lo, (*fe)[3], ptr[10]); | 605 | MLA(hi, lo, (*fe)[3], ptr[10]); |
606 | MLA(hi, lo, (*fe)[4], ptr[ 8]); | 606 | MLA(hi, lo, (*fe)[4], ptr[ 8]); |
607 | MLA(hi, lo, (*fe)[5], ptr[ 6]); | 607 | MLA(hi, lo, (*fe)[5], ptr[ 6]); |
608 | MLA(hi, lo, (*fe)[6], ptr[ 4]); | 608 | MLA(hi, lo, (*fe)[6], ptr[ 4]); |
609 | MLA(hi, lo, (*fe)[7], ptr[ 2]); | 609 | MLA(hi, lo, (*fe)[7], ptr[ 2]); |
610 | 610 | ||
611 | *pcm1++ = SHIFT(MLZ(hi, lo)); | 611 | *pcm1++ = SHIFT(MLZ(hi, lo)); |
612 | 612 | ||
613 | pcm2 = pcm1 + 30; | 613 | pcm2 = pcm1 + 30; |
614 | 614 | ||
615 | for (sb = 1; sb < 16; ++sb) { | 615 | for (sb = 1; sb < 16; ++sb) { |
616 | ++fe; | 616 | ++fe; |
617 | ++Dptr; | 617 | ++Dptr; |
618 | 618 | ||
619 | /* D[32 - sb][i] == -D[sb][31 - i] */ | 619 | /* D[32 - sb][i] == -D[sb][31 - i] */ |
620 | 620 | ||
621 | ptr = *Dptr + po; | 621 | ptr = *Dptr + po; |
622 | ML0(hi, lo, (*fo)[0], ptr[ 0]); | 622 | ML0(hi, lo, (*fo)[0], ptr[ 0]); |
623 | MLA(hi, lo, (*fo)[1], ptr[14]); | 623 | MLA(hi, lo, (*fo)[1], ptr[14]); |
624 | MLA(hi, lo, (*fo)[2], ptr[12]); | 624 | MLA(hi, lo, (*fo)[2], ptr[12]); |
625 | MLA(hi, lo, (*fo)[3], ptr[10]); | 625 | MLA(hi, lo, (*fo)[3], ptr[10]); |
626 | MLA(hi, lo, (*fo)[4], ptr[ 8]); | 626 | MLA(hi, lo, (*fo)[4], ptr[ 8]); |
627 | MLA(hi, lo, (*fo)[5], ptr[ 6]); | 627 | MLA(hi, lo, (*fo)[5], ptr[ 6]); |
628 | MLA(hi, lo, (*fo)[6], ptr[ 4]); | 628 | MLA(hi, lo, (*fo)[6], ptr[ 4]); |
629 | MLA(hi, lo, (*fo)[7], ptr[ 2]); | 629 | MLA(hi, lo, (*fo)[7], ptr[ 2]); |
630 | MLN(hi, lo); | 630 | MLN(hi, lo); |
631 | 631 | ||
632 | ptr = *Dptr + pe; | 632 | ptr = *Dptr + pe; |
633 | MLA(hi, lo, (*fe)[7], ptr[ 2]); | 633 | MLA(hi, lo, (*fe)[7], ptr[ 2]); |
634 | MLA(hi, lo, (*fe)[6], ptr[ 4]); | 634 | MLA(hi, lo, (*fe)[6], ptr[ 4]); |
635 | MLA(hi, lo, (*fe)[5], ptr[ 6]); | 635 | MLA(hi, lo, (*fe)[5], ptr[ 6]); |
636 | MLA(hi, lo, (*fe)[4], ptr[ 8]); | 636 | MLA(hi, lo, (*fe)[4], ptr[ 8]); |
637 | MLA(hi, lo, (*fe)[3], ptr[10]); | 637 | MLA(hi, lo, (*fe)[3], ptr[10]); |
638 | MLA(hi, lo, (*fe)[2], ptr[12]); | 638 | MLA(hi, lo, (*fe)[2], ptr[12]); |
639 | MLA(hi, lo, (*fe)[1], ptr[14]); | 639 | MLA(hi, lo, (*fe)[1], ptr[14]); |
640 | MLA(hi, lo, (*fe)[0], ptr[ 0]); | 640 | MLA(hi, lo, (*fe)[0], ptr[ 0]); |
641 | 641 | ||
642 | *pcm1++ = SHIFT(MLZ(hi, lo)); | 642 | *pcm1++ = SHIFT(MLZ(hi, lo)); |
643 | 643 | ||
644 | ptr = *Dptr - pe; | 644 | ptr = *Dptr - pe; |
645 | ML0(hi, lo, (*fe)[0], ptr[31 - 16]); | 645 | ML0(hi, lo, (*fe)[0], ptr[31 - 16]); |
646 | MLA(hi, lo, (*fe)[1], ptr[31 - 14]); | 646 | MLA(hi, lo, (*fe)[1], ptr[31 - 14]); |
647 | MLA(hi, lo, (*fe)[2], ptr[31 - 12]); | 647 | MLA(hi, lo, (*fe)[2], ptr[31 - 12]); |
648 | MLA(hi, lo, (*fe)[3], ptr[31 - 10]); | 648 | MLA(hi, lo, (*fe)[3], ptr[31 - 10]); |
649 | MLA(hi, lo, (*fe)[4], ptr[31 - 8]); | 649 | MLA(hi, lo, (*fe)[4], ptr[31 - 8]); |
650 | MLA(hi, lo, (*fe)[5], ptr[31 - 6]); | 650 | MLA(hi, lo, (*fe)[5], ptr[31 - 6]); |
651 | MLA(hi, lo, (*fe)[6], ptr[31 - 4]); | 651 | MLA(hi, lo, (*fe)[6], ptr[31 - 4]); |
652 | MLA(hi, lo, (*fe)[7], ptr[31 - 2]); | 652 | MLA(hi, lo, (*fe)[7], ptr[31 - 2]); |
653 | 653 | ||
654 | ptr = *Dptr - po; | 654 | ptr = *Dptr - po; |
655 | MLA(hi, lo, (*fo)[7], ptr[31 - 2]); | 655 | MLA(hi, lo, (*fo)[7], ptr[31 - 2]); |
656 | MLA(hi, lo, (*fo)[6], ptr[31 - 4]); | 656 | MLA(hi, lo, (*fo)[6], ptr[31 - 4]); |
657 | MLA(hi, lo, (*fo)[5], ptr[31 - 6]); | 657 | MLA(hi, lo, (*fo)[5], ptr[31 - 6]); |
658 | MLA(hi, lo, (*fo)[4], ptr[31 - 8]); | 658 | MLA(hi, lo, (*fo)[4], ptr[31 - 8]); |
659 | MLA(hi, lo, (*fo)[3], ptr[31 - 10]); | 659 | MLA(hi, lo, (*fo)[3], ptr[31 - 10]); |
660 | MLA(hi, lo, (*fo)[2], ptr[31 - 12]); | 660 | MLA(hi, lo, (*fo)[2], ptr[31 - 12]); |
661 | MLA(hi, lo, (*fo)[1], ptr[31 - 14]); | 661 | MLA(hi, lo, (*fo)[1], ptr[31 - 14]); |
662 | MLA(hi, lo, (*fo)[0], ptr[31 - 16]); | 662 | MLA(hi, lo, (*fo)[0], ptr[31 - 16]); |
663 | 663 | ||
664 | *pcm2-- = SHIFT(MLZ(hi, lo)); | 664 | *pcm2-- = SHIFT(MLZ(hi, lo)); |
665 | 665 | ||
666 | ++fo; | 666 | ++fo; |
667 | } | 667 | } |
668 | 668 | ||
669 | ++Dptr; | 669 | ++Dptr; |
670 | 670 | ||
671 | ptr = *Dptr + po; | 671 | ptr = *Dptr + po; |
672 | ML0(hi, lo, (*fo)[0], ptr[ 0]); | 672 | ML0(hi, lo, (*fo)[0], ptr[ 0]); |
673 | MLA(hi, lo, (*fo)[1], ptr[14]); | 673 | MLA(hi, lo, (*fo)[1], ptr[14]); |
674 | MLA(hi, lo, (*fo)[2], ptr[12]); | 674 | MLA(hi, lo, (*fo)[2], ptr[12]); |
675 | MLA(hi, lo, (*fo)[3], ptr[10]); | 675 | MLA(hi, lo, (*fo)[3], ptr[10]); |
676 | MLA(hi, lo, (*fo)[4], ptr[ 8]); | 676 | MLA(hi, lo, (*fo)[4], ptr[ 8]); |
677 | MLA(hi, lo, (*fo)[5], ptr[ 6]); | 677 | MLA(hi, lo, (*fo)[5], ptr[ 6]); |
678 | MLA(hi, lo, (*fo)[6], ptr[ 4]); | 678 | MLA(hi, lo, (*fo)[6], ptr[ 4]); |
679 | MLA(hi, lo, (*fo)[7], ptr[ 2]); | 679 | MLA(hi, lo, (*fo)[7], ptr[ 2]); |
680 | 680 | ||
681 | *pcm1 = SHIFT(-MLZ(hi, lo)); | 681 | *pcm1 = SHIFT(-MLZ(hi, lo)); |
682 | pcm1 += 16; | 682 | pcm1 += 16; |
683 | 683 | ||
684 | phase = (phase + 1) % 16; | 684 | phase = (phase + 1) % 16; |
685 | } | 685 | } |
686 | } | 686 | } |
687 | } | 687 | } |
688 | # endif | 688 | # endif |
689 | 689 | ||
690 | /* | 690 | /* |
691 | * NAME:synth->half() | 691 | * NAME:synth->half() |
692 | * DESCRIPTION:perform half frequency PCM synthesis | 692 | * DESCRIPTION:perform half frequency PCM synthesis |
693 | */ | 693 | */ |
694 | static | 694 | static |
695 | void synth_half(struct mad_synth *synth, struct mad_frame const *frame, | 695 | void synth_half(struct mad_synth *synth, struct mad_frame const *frame, |
696 | unsigned int nch, unsigned int ns) | 696 | unsigned int nch, unsigned int ns) |
697 | { | 697 | { |
698 | unsigned int phase, ch, s, sb, pe, po; | 698 | unsigned int phase, ch, s, sb, pe, po; |
699 | mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8]; | 699 | mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8]; |
700 | mad_fixed_t const (*sbsample)[36][32]; | 700 | mad_fixed_t const (*sbsample)[36][32]; |
701 | register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8]; | 701 | register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8]; |
702 | register mad_fixed_t const (*Dptr)[32], *ptr; | 702 | register mad_fixed_t const (*Dptr)[32], *ptr; |
703 | register mad_fixed64hi_t hi; | 703 | register mad_fixed64hi_t hi; |
704 | register mad_fixed64lo_t lo; | 704 | register mad_fixed64lo_t lo; |
705 | 705 | ||
706 | for (ch = 0; ch < nch; ++ch) { | 706 | for (ch = 0; ch < nch; ++ch) { |
707 | sbsample = &frame->sbsample[ch]; | 707 | sbsample = &frame->sbsample[ch]; |
708 | filter = &synth->filter[ch]; | 708 | filter = &synth->filter[ch]; |
709 | phase = synth->phase; | 709 | phase = synth->phase; |
710 | pcm1 = synth->pcm.samples[ch]; | 710 | pcm1 = synth->pcm.samples[ch]; |
711 | 711 | ||
712 | for (s = 0; s < ns; ++s) { | 712 | for (s = 0; s < ns; ++s) { |
713 | dct32((*sbsample)[s], phase >> 1, | 713 | dct32((*sbsample)[s], phase >> 1, |
714 | (*filter)[0][phase & 1], (*filter)[1][phase & 1]); | 714 | (*filter)[0][phase & 1], (*filter)[1][phase & 1]); |
715 | 715 | ||
716 | pe = phase & ~1; | 716 | pe = phase & ~1; |
717 | po = ((phase - 1) & 0xf) | 1; | 717 | po = ((phase - 1) & 0xf) | 1; |
718 | 718 | ||
719 | /* calculate 16 samples */ | 719 | /* calculate 16 samples */ |
720 | 720 | ||
721 | fe = &(*filter)[0][ phase & 1][0]; | 721 | fe = &(*filter)[0][ phase & 1][0]; |
722 | fx = &(*filter)[0][~phase & 1][0]; | 722 | fx = &(*filter)[0][~phase & 1][0]; |
723 | fo = &(*filter)[1][~phase & 1][0]; | 723 | fo = &(*filter)[1][~phase & 1][0]; |
724 | 724 | ||
725 | Dptr = &D[0]; | 725 | Dptr = &D[0]; |
726 | 726 | ||
727 | ptr = *Dptr + po; | 727 | ptr = *Dptr + po; |
728 | ML0(hi, lo, (*fx)[0], ptr[ 0]); | 728 | ML0(hi, lo, (*fx)[0], ptr[ 0]); |
729 | MLA(hi, lo, (*fx)[1], ptr[14]); | 729 | MLA(hi, lo, (*fx)[1], ptr[14]); |
730 | MLA(hi, lo, (*fx)[2], ptr[12]); | 730 | MLA(hi, lo, (*fx)[2], ptr[12]); |
731 | MLA(hi, lo, (*fx)[3], ptr[10]); | 731 | MLA(hi, lo, (*fx)[3], ptr[10]); |
732 | MLA(hi, lo, (*fx)[4], ptr[ 8]); | 732 | MLA(hi, lo, (*fx)[4], ptr[ 8]); |
733 | MLA(hi, lo, (*fx)[5], ptr[ 6]); | 733 | MLA(hi, lo, (*fx)[5], ptr[ 6]); |
734 | MLA(hi, lo, (*fx)[6], ptr[ 4]); | 734 | MLA(hi, lo, (*fx)[6], ptr[ 4]); |
735 | MLA(hi, lo, (*fx)[7], ptr[ 2]); | 735 | MLA(hi, lo, (*fx)[7], ptr[ 2]); |
736 | MLN(hi, lo); | 736 | MLN(hi, lo); |
737 | 737 | ||
738 | ptr = *Dptr + pe; | 738 | ptr = *Dptr + pe; |
739 | MLA(hi, lo, (*fe)[0], ptr[ 0]); | 739 | MLA(hi, lo, (*fe)[0], ptr[ 0]); |
740 | MLA(hi, lo, (*fe)[1], ptr[14]); | 740 | MLA(hi, lo, (*fe)[1], ptr[14]); |
741 | MLA(hi, lo, (*fe)[2], ptr[12]); | 741 | MLA(hi, lo, (*fe)[2], ptr[12]); |
742 | MLA(hi, lo, (*fe)[3], ptr[10]); | 742 | MLA(hi, lo, (*fe)[3], ptr[10]); |
743 | MLA(hi, lo, (*fe)[4], ptr[ 8]); | 743 | MLA(hi, lo, (*fe)[4], ptr[ 8]); |
744 | MLA(hi, lo, (*fe)[5], ptr[ 6]); | 744 | MLA(hi, lo, (*fe)[5], ptr[ 6]); |
745 | MLA(hi, lo, (*fe)[6], ptr[ 4]); | 745 | MLA(hi, lo, (*fe)[6], ptr[ 4]); |
746 | MLA(hi, lo, (*fe)[7], ptr[ 2]); | 746 | MLA(hi, lo, (*fe)[7], ptr[ 2]); |
747 | 747 | ||
748 | *pcm1++ = SHIFT(MLZ(hi, lo)); | 748 | *pcm1++ = SHIFT(MLZ(hi, lo)); |
749 | 749 | ||
750 | pcm2 = pcm1 + 14; | 750 | pcm2 = pcm1 + 14; |
751 | 751 | ||
752 | for (sb = 1; sb < 16; ++sb) { | 752 | for (sb = 1; sb < 16; ++sb) { |
753 | ++fe; | 753 | ++fe; |
754 | ++Dptr; | 754 | ++Dptr; |
755 | 755 | ||
756 | /* D[32 - sb][i] == -D[sb][31 - i] */ | 756 | /* D[32 - sb][i] == -D[sb][31 - i] */ |
757 | 757 | ||
758 | if (!(sb & 1)) { | 758 | if (!(sb & 1)) { |
759 | ptr = *Dptr + po; | 759 | ptr = *Dptr + po; |
760 | ML0(hi, lo, (*fo)[0], ptr[ 0]); | 760 | ML0(hi, lo, (*fo)[0], ptr[ 0]); |
761 | MLA(hi, lo, (*fo)[1], ptr[14]); | 761 | MLA(hi, lo, (*fo)[1], ptr[14]); |
762 | MLA(hi, lo, (*fo)[2], ptr[12]); | 762 | MLA(hi, lo, (*fo)[2], ptr[12]); |
763 | MLA(hi, lo, (*fo)[3], ptr[10]); | 763 | MLA(hi, lo, (*fo)[3], ptr[10]); |
764 | MLA(hi, lo, (*fo)[4], ptr[ 8]); | 764 | MLA(hi, lo, (*fo)[4], ptr[ 8]); |
765 | MLA(hi, lo, (*fo)[5], ptr[ 6]); | 765 | MLA(hi, lo, (*fo)[5], ptr[ 6]); |
766 | MLA(hi, lo, (*fo)[6], ptr[ 4]); | 766 | MLA(hi, lo, (*fo)[6], ptr[ 4]); |
767 | MLA(hi, lo, (*fo)[7], ptr[ 2]); | 767 | MLA(hi, lo, (*fo)[7], ptr[ 2]); |
768 | MLN(hi, lo); | 768 | MLN(hi, lo); |
769 | 769 | ||
770 | ptr = *Dptr + pe; | 770 | ptr = *Dptr + pe; |
771 | MLA(hi, lo, (*fe)[7], ptr[ 2]); | 771 | MLA(hi, lo, (*fe)[7], ptr[ 2]); |
772 | MLA(hi, lo, (*fe)[6], ptr[ 4]); | 772 | MLA(hi, lo, (*fe)[6], ptr[ 4]); |
773 | MLA(hi, lo, (*fe)[5], ptr[ 6]); | 773 | MLA(hi, lo, (*fe)[5], ptr[ 6]); |
774 | MLA(hi, lo, (*fe)[4], ptr[ 8]); | 774 | MLA(hi, lo, (*fe)[4], ptr[ 8]); |
775 | MLA(hi, lo, (*fe)[3], ptr[10]); | 775 | MLA(hi, lo, (*fe)[3], ptr[10]); |
776 | MLA(hi, lo, (*fe)[2], ptr[12]); | 776 | MLA(hi, lo, (*fe)[2], ptr[12]); |
777 | MLA(hi, lo, (*fe)[1], ptr[14]); | 777 | MLA(hi, lo, (*fe)[1], ptr[14]); |
778 | MLA(hi, lo, (*fe)[0], ptr[ 0]); | 778 | MLA(hi, lo, (*fe)[0], ptr[ 0]); |
779 | 779 | ||
780 | *pcm1++ = SHIFT(MLZ(hi, lo)); | 780 | *pcm1++ = SHIFT(MLZ(hi, lo)); |
781 | 781 | ||
782 | ptr = *Dptr - po; | 782 | ptr = *Dptr - po; |
783 | ML0(hi, lo, (*fo)[7], ptr[31 - 2]); | 783 | ML0(hi, lo, (*fo)[7], ptr[31 - 2]); |
784 | MLA(hi, lo, (*fo)[6], ptr[31 - 4]); | 784 | MLA(hi, lo, (*fo)[6], ptr[31 - 4]); |
785 | MLA(hi, lo, (*fo)[5], ptr[31 - 6]); | 785 | MLA(hi, lo, (*fo)[5], ptr[31 - 6]); |
786 | MLA(hi, lo, (*fo)[4], ptr[31 - 8]); | 786 | MLA(hi, lo, (*fo)[4], ptr[31 - 8]); |
787 | MLA(hi, lo, (*fo)[3], ptr[31 - 10]); | 787 | MLA(hi, lo, (*fo)[3], ptr[31 - 10]); |
788 | MLA(hi, lo, (*fo)[2], ptr[31 - 12]); | 788 | MLA(hi, lo, (*fo)[2], ptr[31 - 12]); |
789 | MLA(hi, lo, (*fo)[1], ptr[31 - 14]); | 789 | MLA(hi, lo, (*fo)[1], ptr[31 - 14]); |
790 | MLA(hi, lo, (*fo)[0], ptr[31 - 16]); | 790 | MLA(hi, lo, (*fo)[0], ptr[31 - 16]); |
791 | 791 | ||
792 | ptr = *Dptr - pe; | 792 | ptr = *Dptr - pe; |
793 | MLA(hi, lo, (*fe)[0], ptr[31 - 16]); | 793 | MLA(hi, lo, (*fe)[0], ptr[31 - 16]); |
794 | MLA(hi, lo, (*fe)[1], ptr[31 - 14]); | 794 | MLA(hi, lo, (*fe)[1], ptr[31 - 14]); |
795 | MLA(hi, lo, (*fe)[2], ptr[31 - 12]); | 795 | MLA(hi, lo, (*fe)[2], ptr[31 - 12]); |
796 | MLA(hi, lo, (*fe)[3], ptr[31 - 10]); | 796 | MLA(hi, lo, (*fe)[3], ptr[31 - 10]); |
797 | MLA(hi, lo, (*fe)[4], ptr[31 - 8]); | 797 | MLA(hi, lo, (*fe)[4], ptr[31 - 8]); |
798 | MLA(hi, lo, (*fe)[5], ptr[31 - 6]); | 798 | MLA(hi, lo, (*fe)[5], ptr[31 - 6]); |
799 | MLA(hi, lo, (*fe)[6], ptr[31 - 4]); | 799 | MLA(hi, lo, (*fe)[6], ptr[31 - 4]); |
800 | MLA(hi, lo, (*fe)[7], ptr[31 - 2]); | 800 | MLA(hi, lo, (*fe)[7], ptr[31 - 2]); |
801 | 801 | ||
802 | *pcm2-- = SHIFT(MLZ(hi, lo)); | 802 | *pcm2-- = SHIFT(MLZ(hi, lo)); |
803 | } | 803 | } |
804 | 804 | ||
805 | ++fo; | 805 | ++fo; |
806 | } | 806 | } |
807 | 807 | ||
808 | ++Dptr; | 808 | ++Dptr; |
809 | 809 | ||
810 | ptr = *Dptr + po; | 810 | ptr = *Dptr + po; |
811 | ML0(hi, lo, (*fo)[0], ptr[ 0]); | 811 | ML0(hi, lo, (*fo)[0], ptr[ 0]); |
812 | MLA(hi, lo, (*fo)[1], ptr[14]); | 812 | MLA(hi, lo, (*fo)[1], ptr[14]); |
813 | MLA(hi, lo, (*fo)[2], ptr[12]); | 813 | MLA(hi, lo, (*fo)[2], ptr[12]); |
814 | MLA(hi, lo, (*fo)[3], ptr[10]); | 814 | MLA(hi, lo, (*fo)[3], ptr[10]); |
815 | MLA(hi, lo, (*fo)[4], ptr[ 8]); | 815 | MLA(hi, lo, (*fo)[4], ptr[ 8]); |
816 | MLA(hi, lo, (*fo)[5], ptr[ 6]); | 816 | MLA(hi, lo, (*fo)[5], ptr[ 6]); |
817 | MLA(hi, lo, (*fo)[6], ptr[ 4]); | 817 | MLA(hi, lo, (*fo)[6], ptr[ 4]); |
818 | MLA(hi, lo, (*fo)[7], ptr[ 2]); | 818 | MLA(hi, lo, (*fo)[7], ptr[ 2]); |
819 | 819 | ||
820 | *pcm1 = SHIFT(-MLZ(hi, lo)); | 820 | *pcm1 = SHIFT(-MLZ(hi, lo)); |
821 | pcm1 += 8; | 821 | pcm1 += 8; |
822 | 822 | ||
823 | phase = (phase + 1) % 16; | 823 | phase = (phase + 1) % 16; |
824 | } | 824 | } |
825 | } | 825 | } |
826 | } | 826 | } |
827 | 827 | ||
828 | /* | 828 | /* |
829 | * NAME:synth->frame() | 829 | * NAME:synth->frame() |
830 | * DESCRIPTION:perform PCM synthesis of frame subband samples | 830 | * DESCRIPTION:perform PCM synthesis of frame subband samples |
831 | */ | 831 | */ |
832 | void mad_synth_frame(struct mad_synth *synth, struct mad_frame const *frame) | 832 | void mad_synth_frame(struct mad_synth *synth, struct mad_frame const *frame) |
833 | { | 833 | { |
834 | unsigned int nch, ns; | 834 | unsigned int nch, ns; |
835 | void (*synth_frame)(struct mad_synth *, struct mad_frame const *, | 835 | void (*synth_frame)(struct mad_synth *, struct mad_frame const *, |
836 | unsigned int, unsigned int); | 836 | unsigned int, unsigned int); |
837 | 837 | ||
838 | nch = MAD_NCHANNELS(&frame->header); | 838 | nch = MAD_NCHANNELS(&frame->header); |
839 | ns = MAD_NSBSAMPLES(&frame->header); | 839 | ns = MAD_NSBSAMPLES(&frame->header); |
840 | 840 | ||
841 | synth->pcm.samplerate = frame->header.samplerate; | 841 | synth->pcm.samplerate = frame->header.samplerate; |
842 | synth->pcm.channels = nch; | 842 | synth->pcm.channels = nch; |
843 | synth->pcm.length = 32 * ns; | 843 | synth->pcm.length = 32 * ns; |
844 | 844 | ||
845 | synth_frame = synth_full; | 845 | synth_frame = synth_full; |
846 | 846 | ||
847 | if (frame->options & MAD_OPTION_HALFSAMPLERATE) { | 847 | if (frame->options & MAD_OPTION_HALFSAMPLERATE) { |
848 | synth->pcm.samplerate /= 2; | 848 | synth->pcm.samplerate /= 2; |
849 | synth->pcm.length /= 2; | 849 | synth->pcm.length /= 2; |
850 | 850 | ||
851 | synth_frame = synth_half; | 851 | synth_frame = synth_half; |
852 | } | 852 | } |
853 | 853 | ||
854 | synth_frame(synth, frame, nch, ns); | 854 | synth_frame(synth, frame, nch, ns); |
855 | 855 | ||
856 | synth->phase = (synth->phase + ns) % 16; | 856 | synth->phase = (synth->phase + ns) % 16; |
857 | } | 857 | } |
diff --git a/core/multimedia/opieplayer/libmad/synth.h b/core/multimedia/opieplayer/libmad/synth.h index 2c9d5c8..d284d01 100644 --- a/core/multimedia/opieplayer/libmad/synth.h +++ b/core/multimedia/opieplayer/libmad/synth.h | |||
@@ -1,69 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifndef LIBMAD_SYNTH_H | 22 | # ifndef LIBMAD_SYNTH_H |
23 | # define LIBMAD_SYNTH_H | 23 | # define LIBMAD_SYNTH_H |
24 | 24 | ||
25 | # include "fixed.h" | 25 | # include "fixed.h" |
26 | # include "frame.h" | 26 | # include "frame.h" |
27 | 27 | ||
28 | struct mad_pcm { | 28 | struct mad_pcm { |
29 | unsigned int samplerate; /* sampling frequency (Hz) */ | 29 | unsigned int samplerate; /* sampling frequency (Hz) */ |
30 | unsigned short channels; /* number of channels */ | 30 | unsigned short channels; /* number of channels */ |
31 | unsigned short length; /* number of samples per channel */ | 31 | unsigned short length; /* number of samples per channel */ |
32 | mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ | 32 | mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ |
33 | }; | 33 | }; |
34 | 34 | ||
35 | struct mad_synth { | 35 | struct mad_synth { |
36 | mad_fixed_t filter[2][2][2][16][8];/* polyphase filterbank outputs */ | 36 | mad_fixed_t filter[2][2][2][16][8];/* polyphase filterbank outputs */ |
37 | /* [ch][eo][peo][s][v] */ | 37 | /* [ch][eo][peo][s][v] */ |
38 | 38 | ||
39 | unsigned int phase; /* current processing phase */ | 39 | unsigned int phase; /* current processing phase */ |
40 | 40 | ||
41 | struct mad_pcm pcm; /* PCM output */ | 41 | struct mad_pcm pcm; /* PCM output */ |
42 | }; | 42 | }; |
43 | 43 | ||
44 | /* single channel PCM selector */ | 44 | /* single channel PCM selector */ |
45 | enum { | 45 | enum { |
46 | MAD_PCM_CHANNEL_SINGLE = 0 | 46 | MAD_PCM_CHANNEL_SINGLE = 0 |
47 | }; | 47 | }; |
48 | 48 | ||
49 | /* dual channel PCM selector */ | 49 | /* dual channel PCM selector */ |
50 | enum { | 50 | enum { |
51 | MAD_PCM_CHANNEL_DUAL_1 = 0, | 51 | MAD_PCM_CHANNEL_DUAL_1 = 0, |
52 | MAD_PCM_CHANNEL_DUAL_2 = 1 | 52 | MAD_PCM_CHANNEL_DUAL_2 = 1 |
53 | }; | 53 | }; |
54 | 54 | ||
55 | /* stereo PCM selector */ | 55 | /* stereo PCM selector */ |
56 | enum { | 56 | enum { |
57 | MAD_PCM_CHANNEL_STEREO_LEFT = 0, | 57 | MAD_PCM_CHANNEL_STEREO_LEFT = 0, |
58 | MAD_PCM_CHANNEL_STEREO_RIGHT = 1 | 58 | MAD_PCM_CHANNEL_STEREO_RIGHT = 1 |
59 | }; | 59 | }; |
60 | 60 | ||
61 | void mad_synth_init(struct mad_synth *); | 61 | void mad_synth_init(struct mad_synth *); |
62 | 62 | ||
63 | # define mad_synth_finish(synth) /* nothing */ | 63 | # define mad_synth_finish(synth) /* nothing */ |
64 | 64 | ||
65 | void mad_synth_mute(struct mad_synth *); | 65 | void mad_synth_mute(struct mad_synth *); |
66 | 66 | ||
67 | void mad_synth_frame(struct mad_synth *, struct mad_frame const *); | 67 | void mad_synth_frame(struct mad_synth *, struct mad_frame const *); |
68 | 68 | ||
69 | # endif | 69 | # endif |
diff --git a/core/multimedia/opieplayer/libmad/timer.c b/core/multimedia/opieplayer/libmad/timer.c index 299fe0b..fa377d0 100644 --- a/core/multimedia/opieplayer/libmad/timer.c +++ b/core/multimedia/opieplayer/libmad/timer.c | |||
@@ -1,484 +1,485 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifdef HAVE_CONFIG_H | 22 | # ifdef HAVE_CONFIG_H |
23 | # include "libmad_config.h" | 23 | # include "libmad_config.h" |
24 | # endif | 24 | # endif |
25 | 25 | ||
26 | # include "libmad_global.h" | 26 | # include "libmad_global.h" |
27 | 27 | ||
28 | # include <stdio.h> | 28 | # include <stdio.h> |
29 | 29 | ||
30 | # ifdef HAVE_ASSERT_H | 30 | # ifdef HAVE_ASSERT_H |
31 | # include <assert.h> | 31 | # include <assert.h> |
32 | # endif | 32 | # endif |
33 | 33 | ||
34 | # include "timer.h" | 34 | # include "timer.h" |
35 | 35 | ||
36 | mad_timer_t const mad_timer_zero = { 0, 0 }; | 36 | mad_timer_t const mad_timer_zero = { 0, 0 }; |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * NAME:timer->compare() | 39 | * NAME:timer->compare() |
40 | * DESCRIPTION:indicate relative order of two timers | 40 | * DESCRIPTION:indicate relative order of two timers |
41 | */ | 41 | */ |
42 | int mad_timer_compare(mad_timer_t timer1, mad_timer_t timer2) | 42 | int mad_timer_compare(mad_timer_t timer1, mad_timer_t timer2) |
43 | { | 43 | { |
44 | signed long diff; | 44 | signed long diff; |
45 | 45 | ||
46 | diff = timer1.seconds - timer2.seconds; | 46 | diff = timer1.seconds - timer2.seconds; |
47 | if (diff < 0) | 47 | if (diff < 0) |
48 | return -1; | 48 | return -1; |
49 | else if (diff > 0) | 49 | else if (diff > 0) |
50 | return +1; | 50 | return +1; |
51 | 51 | ||
52 | diff = timer1.fraction - timer2.fraction; | 52 | diff = timer1.fraction - timer2.fraction; |
53 | if (diff < 0) | 53 | if (diff < 0) |
54 | return -1; | 54 | return -1; |
55 | else if (diff > 0) | 55 | else if (diff > 0) |
56 | return +1; | 56 | return +1; |
57 | 57 | ||
58 | return 0; | 58 | return 0; |
59 | } | 59 | } |
60 | 60 | ||
61 | /* | 61 | /* |
62 | * NAME:timer->negate() | 62 | * NAME:timer->negate() |
63 | * DESCRIPTION:invert the sign of a timer | 63 | * DESCRIPTION:invert the sign of a timer |
64 | */ | 64 | */ |
65 | void mad_timer_negate(mad_timer_t *timer) | 65 | void mad_timer_negate(mad_timer_t *timer) |
66 | { | 66 | { |
67 | timer->seconds = -timer->seconds; | 67 | timer->seconds = -timer->seconds; |
68 | 68 | ||
69 | if (timer->fraction) { | 69 | if (timer->fraction) { |
70 | timer->seconds -= 1; | 70 | timer->seconds -= 1; |
71 | timer->fraction = MAD_TIMER_RESOLUTION - timer->fraction; | 71 | timer->fraction = MAD_TIMER_RESOLUTION - timer->fraction; |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | /* | 75 | /* |
76 | * NAME:timer->abs() | 76 | * NAME:timer->abs() |
77 | * DESCRIPTION:return the absolute value of a timer | 77 | * DESCRIPTION:return the absolute value of a timer |
78 | */ | 78 | */ |
79 | mad_timer_t mad_timer_abs(mad_timer_t timer) | 79 | mad_timer_t mad_timer_abs(mad_timer_t timer) |
80 | { | 80 | { |
81 | if (mad_timer_sign(timer) < 0) | 81 | if (timer.seconds < 0) |
82 | mad_timer_negate(&timer); | 82 | mad_timer_negate(&timer); |
83 | 83 | ||
84 | return timer; | 84 | return timer; |
85 | } | 85 | } |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * NAME:reduce_timer() | 88 | * NAME:reduce_timer() |
89 | * DESCRIPTION:carry timer fraction into seconds | 89 | * DESCRIPTION:carry timer fraction into seconds |
90 | */ | 90 | */ |
91 | static | 91 | static |
92 | void reduce_timer(mad_timer_t *timer) | 92 | void reduce_timer(mad_timer_t *timer) |
93 | { | 93 | { |
94 | timer->seconds += timer->fraction / MAD_TIMER_RESOLUTION; | 94 | timer->seconds += timer->fraction / MAD_TIMER_RESOLUTION; |
95 | timer->fraction %= MAD_TIMER_RESOLUTION; | 95 | timer->fraction %= MAD_TIMER_RESOLUTION; |
96 | } | 96 | } |
97 | 97 | ||
98 | /* | 98 | /* |
99 | * NAME:gcd() | 99 | * NAME:gcd() |
100 | * DESCRIPTION:compute greatest common denominator | 100 | * DESCRIPTION:compute greatest common denominator |
101 | */ | 101 | */ |
102 | static | 102 | static |
103 | unsigned long gcd(unsigned long num1, unsigned long num2) | 103 | unsigned long gcd(unsigned long num1, unsigned long num2) |
104 | { | 104 | { |
105 | unsigned long tmp; | 105 | unsigned long tmp; |
106 | 106 | ||
107 | while (num2) { | 107 | while (num2) { |
108 | tmp = num2; | 108 | tmp = num2; |
109 | num2 = num1 % num2; | 109 | num2 = num1 % num2; |
110 | num1 = tmp; | 110 | num1 = tmp; |
111 | } | 111 | } |
112 | 112 | ||
113 | return num1; | 113 | return num1; |
114 | } | 114 | } |
115 | 115 | ||
116 | /* | 116 | /* |
117 | * NAME:reduce_rational() | 117 | * NAME:reduce_rational() |
118 | * DESCRIPTION:convert rational expression to lowest terms | 118 | * DESCRIPTION:convert rational expression to lowest terms |
119 | */ | 119 | */ |
120 | static | 120 | static |
121 | void reduce_rational(unsigned long *numer, unsigned long *denom) | 121 | void reduce_rational(unsigned long *numer, unsigned long *denom) |
122 | { | 122 | { |
123 | unsigned long factor; | 123 | unsigned long factor; |
124 | 124 | ||
125 | factor = gcd(*numer, *denom); | 125 | factor = gcd(*numer, *denom); |
126 | 126 | ||
127 | assert(factor != 0); | 127 | assert(factor != 0); |
128 | 128 | ||
129 | *numer /= factor; | 129 | *numer /= factor; |
130 | *denom /= factor; | 130 | *denom /= factor; |
131 | } | 131 | } |
132 | 132 | ||
133 | /* | 133 | /* |
134 | * NAME:scale_rational() | 134 | * NAME:scale_rational() |
135 | * DESCRIPTION:solve numer/denom == ?/scale avoiding overflowing | 135 | * DESCRIPTION:solve numer/denom == ?/scale avoiding overflowing |
136 | */ | 136 | */ |
137 | static | 137 | static |
138 | unsigned long scale_rational(unsigned long numer, unsigned long denom, | 138 | unsigned long scale_rational(unsigned long numer, unsigned long denom, |
139 | unsigned long scale) | 139 | unsigned long scale) |
140 | { | 140 | { |
141 | reduce_rational(&numer, &denom); | 141 | reduce_rational(&numer, &denom); |
142 | reduce_rational(&scale, &denom); | 142 | reduce_rational(&scale, &denom); |
143 | 143 | ||
144 | assert(denom != 0); | 144 | assert(denom != 0); |
145 | 145 | ||
146 | if (denom < scale) | 146 | if (denom < scale) |
147 | return numer * (scale / denom) + numer * (scale % denom) / denom; | 147 | return numer * (scale / denom) + numer * (scale % denom) / denom; |
148 | if (denom < numer) | 148 | if (denom < numer) |
149 | return scale * (numer / denom) + scale * (numer % denom) / denom; | 149 | return scale * (numer / denom) + scale * (numer % denom) / denom; |
150 | 150 | ||
151 | return numer * scale / denom; | 151 | return numer * scale / denom; |
152 | } | 152 | } |
153 | 153 | ||
154 | /* | 154 | /* |
155 | * NAME:timer->set() | 155 | * NAME:timer->set() |
156 | * DESCRIPTION:set timer to specific (positive) value | 156 | * DESCRIPTION:set timer to specific (positive) value |
157 | */ | 157 | */ |
158 | void mad_timer_set(mad_timer_t *timer, unsigned long seconds, | 158 | void mad_timer_set(mad_timer_t *timer, unsigned long seconds, |
159 | unsigned long numer, unsigned long denom) | 159 | unsigned long numer, unsigned long denom) |
160 | { | 160 | { |
161 | timer->seconds = seconds; | 161 | timer->seconds = seconds; |
162 | if (numer >= denom && denom > 0) { | 162 | if (numer >= denom && denom > 0) { |
163 | timer->seconds += numer / denom; | 163 | timer->seconds += numer / denom; |
164 | numer %= denom; | 164 | numer %= denom; |
165 | } | 165 | } |
166 | 166 | ||
167 | switch (denom) { | 167 | switch (denom) { |
168 | case 0: | 168 | case 0: |
169 | case 1: | 169 | case 1: |
170 | timer->fraction = 0; | 170 | timer->fraction = 0; |
171 | break; | 171 | break; |
172 | 172 | ||
173 | case MAD_TIMER_RESOLUTION: | 173 | case MAD_TIMER_RESOLUTION: |
174 | timer->fraction = numer; | 174 | timer->fraction = numer; |
175 | break; | 175 | break; |
176 | 176 | ||
177 | case 1000: | 177 | case 1000: |
178 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 1000); | 178 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 1000); |
179 | break; | 179 | break; |
180 | 180 | ||
181 | case 8000: | 181 | case 8000: |
182 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 8000); | 182 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 8000); |
183 | break; | 183 | break; |
184 | 184 | ||
185 | case 11025: | 185 | case 11025: |
186 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 11025); | 186 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 11025); |
187 | break; | 187 | break; |
188 | 188 | ||
189 | case 12000: | 189 | case 12000: |
190 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 12000); | 190 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 12000); |
191 | break; | 191 | break; |
192 | 192 | ||
193 | case 16000: | 193 | case 16000: |
194 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 16000); | 194 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 16000); |
195 | break; | 195 | break; |
196 | 196 | ||
197 | case 22050: | 197 | case 22050: |
198 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 22050); | 198 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 22050); |
199 | break; | 199 | break; |
200 | 200 | ||
201 | case 24000: | 201 | case 24000: |
202 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 24000); | 202 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 24000); |
203 | break; | 203 | break; |
204 | 204 | ||
205 | case 32000: | 205 | case 32000: |
206 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 32000); | 206 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 32000); |
207 | break; | 207 | break; |
208 | 208 | ||
209 | case 44100: | 209 | case 44100: |
210 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 44100); | 210 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 44100); |
211 | break; | 211 | break; |
212 | 212 | ||
213 | case 48000: | 213 | case 48000: |
214 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 48000); | 214 | timer->fraction = numer * (MAD_TIMER_RESOLUTION / 48000); |
215 | break; | 215 | break; |
216 | 216 | ||
217 | default: | 217 | default: |
218 | timer->fraction = scale_rational(numer, denom, MAD_TIMER_RESOLUTION); | 218 | timer->fraction = scale_rational(numer, denom, MAD_TIMER_RESOLUTION); |
219 | break; | 219 | break; |
220 | } | 220 | } |
221 | 221 | ||
222 | if (timer->fraction >= MAD_TIMER_RESOLUTION) | 222 | if (timer->fraction >= MAD_TIMER_RESOLUTION) |
223 | reduce_timer(timer); | 223 | reduce_timer(timer); |
224 | } | 224 | } |
225 | 225 | ||
226 | /* | 226 | /* |
227 | * NAME:timer->add() | 227 | * NAME:timer->add() |
228 | * DESCRIPTION:add one timer to another | 228 | * DESCRIPTION:add one timer to another |
229 | */ | 229 | */ |
230 | void mad_timer_add(mad_timer_t *timer, mad_timer_t incr) | 230 | void mad_timer_add(mad_timer_t *timer, mad_timer_t incr) |
231 | { | 231 | { |
232 | timer->seconds += incr.seconds; | 232 | timer->seconds += incr.seconds; |
233 | timer->fraction += incr.fraction; | 233 | timer->fraction += incr.fraction; |
234 | 234 | ||
235 | if (timer->fraction >= MAD_TIMER_RESOLUTION) | 235 | if (timer->fraction >= MAD_TIMER_RESOLUTION) |
236 | reduce_timer(timer); | 236 | reduce_timer(timer); |
237 | } | 237 | } |
238 | 238 | ||
239 | /* | 239 | /* |
240 | * NAME:timer->multiply() | 240 | * NAME:timer->multiply() |
241 | * DESCRIPTION:multiply a timer by a scalar value | 241 | * DESCRIPTION:multiply a timer by a scalar value |
242 | */ | 242 | */ |
243 | void mad_timer_multiply(mad_timer_t *timer, signed long scalar) | 243 | void mad_timer_multiply(mad_timer_t *timer, signed long scalar) |
244 | { | 244 | { |
245 | mad_timer_t addend; | 245 | mad_timer_t addend; |
246 | unsigned long factor; | 246 | unsigned long factor; |
247 | 247 | ||
248 | factor = scalar; | 248 | factor = scalar; |
249 | if (scalar < 0) { | 249 | if (scalar < 0) { |
250 | factor = -scalar; | 250 | factor = -scalar; |
251 | mad_timer_negate(timer); | 251 | mad_timer_negate(timer); |
252 | } | 252 | } |
253 | 253 | ||
254 | addend = *timer; | 254 | addend = *timer; |
255 | *timer = mad_timer_zero; | 255 | *timer = mad_timer_zero; |
256 | 256 | ||
257 | while (factor) { | 257 | while (factor) { |
258 | if (factor & 1) | 258 | if (factor & 1) |
259 | mad_timer_add(timer, addend); | 259 | mad_timer_add(timer, addend); |
260 | 260 | ||
261 | mad_timer_add(&addend, addend); | 261 | mad_timer_add(&addend, addend); |
262 | factor >>= 1; | 262 | factor >>= 1; |
263 | } | 263 | } |
264 | } | 264 | } |
265 | 265 | ||
266 | /* | 266 | /* |
267 | * NAME:timer->count() | 267 | * NAME:timer->count() |
268 | * DESCRIPTION:return timer value in selected units | 268 | * DESCRIPTION:return timer value in selected units |
269 | */ | 269 | */ |
270 | signed long mad_timer_count(mad_timer_t timer, enum mad_units units) | 270 | signed long mad_timer_count(mad_timer_t timer, enum mad_units units) |
271 | { | 271 | { |
272 | switch (units) { | 272 | switch (units) { |
273 | case MAD_UNITS_HOURS: | 273 | case MAD_UNITS_HOURS: |
274 | return timer.seconds / 60 / 60; | 274 | return timer.seconds / 60 / 60; |
275 | 275 | ||
276 | case MAD_UNITS_MINUTES: | 276 | case MAD_UNITS_MINUTES: |
277 | return timer.seconds / 60; | 277 | return timer.seconds / 60; |
278 | 278 | ||
279 | case MAD_UNITS_SECONDS: | 279 | case MAD_UNITS_SECONDS: |
280 | return timer.seconds; | 280 | return timer.seconds; |
281 | 281 | ||
282 | case MAD_UNITS_DECISECONDS: | 282 | case MAD_UNITS_DECISECONDS: |
283 | case MAD_UNITS_CENTISECONDS: | 283 | case MAD_UNITS_CENTISECONDS: |
284 | case MAD_UNITS_MILLISECONDS: | 284 | case MAD_UNITS_MILLISECONDS: |
285 | 285 | ||
286 | case MAD_UNITS_8000_HZ: | 286 | case MAD_UNITS_8000_HZ: |
287 | case MAD_UNITS_11025_HZ: | 287 | case MAD_UNITS_11025_HZ: |
288 | case MAD_UNITS_12000_HZ: | 288 | case MAD_UNITS_12000_HZ: |
289 | case MAD_UNITS_16000_HZ: | 289 | case MAD_UNITS_16000_HZ: |
290 | case MAD_UNITS_22050_HZ: | 290 | case MAD_UNITS_22050_HZ: |
291 | case MAD_UNITS_24000_HZ: | 291 | case MAD_UNITS_24000_HZ: |
292 | case MAD_UNITS_32000_HZ: | 292 | case MAD_UNITS_32000_HZ: |
293 | case MAD_UNITS_44100_HZ: | 293 | case MAD_UNITS_44100_HZ: |
294 | case MAD_UNITS_48000_HZ: | 294 | case MAD_UNITS_48000_HZ: |
295 | 295 | ||
296 | case MAD_UNITS_24_FPS: | 296 | case MAD_UNITS_24_FPS: |
297 | case MAD_UNITS_25_FPS: | 297 | case MAD_UNITS_25_FPS: |
298 | case MAD_UNITS_30_FPS: | 298 | case MAD_UNITS_30_FPS: |
299 | case MAD_UNITS_48_FPS: | 299 | case MAD_UNITS_48_FPS: |
300 | case MAD_UNITS_50_FPS: | 300 | case MAD_UNITS_50_FPS: |
301 | case MAD_UNITS_60_FPS: | 301 | case MAD_UNITS_60_FPS: |
302 | case MAD_UNITS_75_FPS: | 302 | case MAD_UNITS_75_FPS: |
303 | return timer.seconds * (signed long) units + | 303 | return timer.seconds * (signed long) units + |
304 | (signed long) scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, | 304 | (signed long) scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, |
305 | units); | 305 | units); |
306 | 306 | ||
307 | case MAD_UNITS_23_976_FPS: | 307 | case MAD_UNITS_23_976_FPS: |
308 | case MAD_UNITS_24_975_FPS: | 308 | case MAD_UNITS_24_975_FPS: |
309 | case MAD_UNITS_29_97_FPS: | 309 | case MAD_UNITS_29_97_FPS: |
310 | case MAD_UNITS_47_952_FPS: | 310 | case MAD_UNITS_47_952_FPS: |
311 | case MAD_UNITS_49_95_FPS: | 311 | case MAD_UNITS_49_95_FPS: |
312 | case MAD_UNITS_59_94_FPS: | 312 | case MAD_UNITS_59_94_FPS: |
313 | return (mad_timer_count(timer, -units) + 1) * 1000 / 1001; | 313 | return (mad_timer_count(timer, -units) + 1) * 1000 / 1001; |
314 | } | 314 | } |
315 | 315 | ||
316 | /* unsupported units */ | 316 | /* unsupported units */ |
317 | return 0; | 317 | return 0; |
318 | } | 318 | } |
319 | 319 | ||
320 | /* | 320 | /* |
321 | * NAME:timer->fraction() | 321 | * NAME:timer->fraction() |
322 | * DESCRIPTION:return fractional part of timer in arbitrary terms | 322 | * DESCRIPTION:return fractional part of timer in arbitrary terms |
323 | */ | 323 | */ |
324 | unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long denom) | 324 | unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long denom) |
325 | { | 325 | { |
326 | timer = mad_timer_abs(timer); | 326 | timer = mad_timer_abs(timer); |
327 | 327 | ||
328 | switch (denom) { | 328 | switch (denom) { |
329 | case 0: | 329 | case 0: |
330 | return MAD_TIMER_RESOLUTION / timer.fraction; | 330 | return timer.fraction ? |
331 | MAD_TIMER_RESOLUTION / timer.fraction : MAD_TIMER_RESOLUTION + 1; | ||
331 | 332 | ||
332 | case MAD_TIMER_RESOLUTION: | 333 | case MAD_TIMER_RESOLUTION: |
333 | return timer.fraction; | 334 | return timer.fraction; |
334 | 335 | ||
335 | default: | 336 | default: |
336 | return scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, denom); | 337 | return scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, denom); |
337 | } | 338 | } |
338 | } | 339 | } |
339 | 340 | ||
340 | /* | 341 | /* |
341 | * NAME:timer->string() | 342 | * NAME:timer->string() |
342 | * DESCRIPTION:write a string representation of a timer using a template | 343 | * DESCRIPTION:write a string representation of a timer using a template |
343 | */ | 344 | */ |
344 | void mad_timer_string(mad_timer_t timer, | 345 | void mad_timer_string(mad_timer_t timer, |
345 | char *dest, char const *format, enum mad_units units, | 346 | char *dest, char const *format, enum mad_units units, |
346 | enum mad_units fracunits, unsigned long subparts) | 347 | enum mad_units fracunits, unsigned long subparts) |
347 | { | 348 | { |
348 | unsigned long hours, minutes, seconds, sub; | 349 | unsigned long hours, minutes, seconds, sub; |
349 | unsigned int frac; | 350 | unsigned int frac; |
350 | 351 | ||
351 | timer = mad_timer_abs(timer); | 352 | timer = mad_timer_abs(timer); |
352 | 353 | ||
353 | seconds = timer.seconds; | 354 | seconds = timer.seconds; |
354 | frac = sub = 0; | 355 | frac = sub = 0; |
355 | 356 | ||
356 | switch (fracunits) { | 357 | switch (fracunits) { |
357 | case MAD_UNITS_HOURS: | 358 | case MAD_UNITS_HOURS: |
358 | case MAD_UNITS_MINUTES: | 359 | case MAD_UNITS_MINUTES: |
359 | case MAD_UNITS_SECONDS: | 360 | case MAD_UNITS_SECONDS: |
360 | break; | 361 | break; |
361 | 362 | ||
362 | case MAD_UNITS_DECISECONDS: | 363 | case MAD_UNITS_DECISECONDS: |
363 | case MAD_UNITS_CENTISECONDS: | 364 | case MAD_UNITS_CENTISECONDS: |
364 | case MAD_UNITS_MILLISECONDS: | 365 | case MAD_UNITS_MILLISECONDS: |
365 | 366 | ||
366 | case MAD_UNITS_8000_HZ: | 367 | case MAD_UNITS_8000_HZ: |
367 | case MAD_UNITS_11025_HZ: | 368 | case MAD_UNITS_11025_HZ: |
368 | case MAD_UNITS_12000_HZ: | 369 | case MAD_UNITS_12000_HZ: |
369 | case MAD_UNITS_16000_HZ: | 370 | case MAD_UNITS_16000_HZ: |
370 | case MAD_UNITS_22050_HZ: | 371 | case MAD_UNITS_22050_HZ: |
371 | case MAD_UNITS_24000_HZ: | 372 | case MAD_UNITS_24000_HZ: |
372 | case MAD_UNITS_32000_HZ: | 373 | case MAD_UNITS_32000_HZ: |
373 | case MAD_UNITS_44100_HZ: | 374 | case MAD_UNITS_44100_HZ: |
374 | case MAD_UNITS_48000_HZ: | 375 | case MAD_UNITS_48000_HZ: |
375 | 376 | ||
376 | case MAD_UNITS_24_FPS: | 377 | case MAD_UNITS_24_FPS: |
377 | case MAD_UNITS_25_FPS: | 378 | case MAD_UNITS_25_FPS: |
378 | case MAD_UNITS_30_FPS: | 379 | case MAD_UNITS_30_FPS: |
379 | case MAD_UNITS_48_FPS: | 380 | case MAD_UNITS_48_FPS: |
380 | case MAD_UNITS_50_FPS: | 381 | case MAD_UNITS_50_FPS: |
381 | case MAD_UNITS_60_FPS: | 382 | case MAD_UNITS_60_FPS: |
382 | case MAD_UNITS_75_FPS: | 383 | case MAD_UNITS_75_FPS: |
383 | { | 384 | { |
384 | unsigned long denom; | 385 | unsigned long denom; |
385 | 386 | ||
386 | denom = MAD_TIMER_RESOLUTION / fracunits; | 387 | denom = MAD_TIMER_RESOLUTION / fracunits; |
387 | 388 | ||
388 | frac = timer.fraction / denom; | 389 | frac = timer.fraction / denom; |
389 | sub = scale_rational(timer.fraction % denom, denom, subparts); | 390 | sub = scale_rational(timer.fraction % denom, denom, subparts); |
390 | } | 391 | } |
391 | break; | 392 | break; |
392 | 393 | ||
393 | case MAD_UNITS_23_976_FPS: | 394 | case MAD_UNITS_23_976_FPS: |
394 | case MAD_UNITS_24_975_FPS: | 395 | case MAD_UNITS_24_975_FPS: |
395 | case MAD_UNITS_29_97_FPS: | 396 | case MAD_UNITS_29_97_FPS: |
396 | case MAD_UNITS_47_952_FPS: | 397 | case MAD_UNITS_47_952_FPS: |
397 | case MAD_UNITS_49_95_FPS: | 398 | case MAD_UNITS_49_95_FPS: |
398 | case MAD_UNITS_59_94_FPS: | 399 | case MAD_UNITS_59_94_FPS: |
399 | /* drop-frame encoding */ | 400 | /* drop-frame encoding */ |
400 | /* N.B. this is only well-defined for MAD_UNITS_29_97_FPS */ | 401 | /* N.B. this is only well-defined for MAD_UNITS_29_97_FPS */ |
401 | { | 402 | { |
402 | unsigned long frame, cycle, d, m; | 403 | unsigned long frame, cycle, d, m; |
403 | 404 | ||
404 | frame = mad_timer_count(timer, fracunits); | 405 | frame = mad_timer_count(timer, fracunits); |
405 | 406 | ||
406 | cycle = -fracunits * 60 * 10 - (10 - 1) * 2; | 407 | cycle = -fracunits * 60 * 10 - (10 - 1) * 2; |
407 | 408 | ||
408 | d = frame / cycle; | 409 | d = frame / cycle; |
409 | m = frame % cycle; | 410 | m = frame % cycle; |
410 | frame += (10 - 1) * 2 * d; | 411 | frame += (10 - 1) * 2 * d; |
411 | if (m > 2) | 412 | if (m > 2) |
412 | frame += 2 * ((m - 2) / (cycle / 10)); | 413 | frame += 2 * ((m - 2) / (cycle / 10)); |
413 | 414 | ||
414 | frac = frame % -fracunits; | 415 | frac = frame % -fracunits; |
415 | seconds = frame / -fracunits; | 416 | seconds = frame / -fracunits; |
416 | } | 417 | } |
417 | break; | 418 | break; |
418 | } | 419 | } |
419 | 420 | ||
420 | switch (units) { | 421 | switch (units) { |
421 | case MAD_UNITS_HOURS: | 422 | case MAD_UNITS_HOURS: |
422 | minutes = seconds / 60; | 423 | minutes = seconds / 60; |
423 | hours = minutes / 60; | 424 | hours = minutes / 60; |
424 | 425 | ||
425 | sprintf(dest, format, | 426 | sprintf(dest, format, |
426 | hours, | 427 | hours, |
427 | (unsigned int) (minutes % 60), | 428 | (unsigned int) (minutes % 60), |
428 | (unsigned int) (seconds % 60), | 429 | (unsigned int) (seconds % 60), |
429 | frac, sub); | 430 | frac, sub); |
430 | break; | 431 | break; |
431 | 432 | ||
432 | case MAD_UNITS_MINUTES: | 433 | case MAD_UNITS_MINUTES: |
433 | minutes = seconds / 60; | 434 | minutes = seconds / 60; |
434 | 435 | ||
435 | sprintf(dest, format, | 436 | sprintf(dest, format, |
436 | minutes, | 437 | minutes, |
437 | (unsigned int) (seconds % 60), | 438 | (unsigned int) (seconds % 60), |
438 | frac, sub); | 439 | frac, sub); |
439 | break; | 440 | break; |
440 | 441 | ||
441 | case MAD_UNITS_SECONDS: | 442 | case MAD_UNITS_SECONDS: |
442 | sprintf(dest, format, | 443 | sprintf(dest, format, |
443 | seconds, | 444 | seconds, |
444 | frac, sub); | 445 | frac, sub); |
445 | break; | 446 | break; |
446 | 447 | ||
447 | case MAD_UNITS_23_976_FPS: | 448 | case MAD_UNITS_23_976_FPS: |
448 | case MAD_UNITS_24_975_FPS: | 449 | case MAD_UNITS_24_975_FPS: |
449 | case MAD_UNITS_29_97_FPS: | 450 | case MAD_UNITS_29_97_FPS: |
450 | case MAD_UNITS_47_952_FPS: | 451 | case MAD_UNITS_47_952_FPS: |
451 | case MAD_UNITS_49_95_FPS: | 452 | case MAD_UNITS_49_95_FPS: |
452 | case MAD_UNITS_59_94_FPS: | 453 | case MAD_UNITS_59_94_FPS: |
453 | if (fracunits < 0) { | 454 | if (fracunits < 0) { |
454 | /* not yet implemented */ | 455 | /* not yet implemented */ |
455 | sub = 0; | 456 | sub = 0; |
456 | } | 457 | } |
457 | 458 | ||
458 | /* fall through */ | 459 | /* fall through */ |
459 | 460 | ||
460 | case MAD_UNITS_DECISECONDS: | 461 | case MAD_UNITS_DECISECONDS: |
461 | case MAD_UNITS_CENTISECONDS: | 462 | case MAD_UNITS_CENTISECONDS: |
462 | case MAD_UNITS_MILLISECONDS: | 463 | case MAD_UNITS_MILLISECONDS: |
463 | 464 | ||
464 | case MAD_UNITS_8000_HZ: | 465 | case MAD_UNITS_8000_HZ: |
465 | case MAD_UNITS_11025_HZ: | 466 | case MAD_UNITS_11025_HZ: |
466 | case MAD_UNITS_12000_HZ: | 467 | case MAD_UNITS_12000_HZ: |
467 | case MAD_UNITS_16000_HZ: | 468 | case MAD_UNITS_16000_HZ: |
468 | case MAD_UNITS_22050_HZ: | 469 | case MAD_UNITS_22050_HZ: |
469 | case MAD_UNITS_24000_HZ: | 470 | case MAD_UNITS_24000_HZ: |
470 | case MAD_UNITS_32000_HZ: | 471 | case MAD_UNITS_32000_HZ: |
471 | case MAD_UNITS_44100_HZ: | 472 | case MAD_UNITS_44100_HZ: |
472 | case MAD_UNITS_48000_HZ: | 473 | case MAD_UNITS_48000_HZ: |
473 | 474 | ||
474 | case MAD_UNITS_24_FPS: | 475 | case MAD_UNITS_24_FPS: |
475 | case MAD_UNITS_25_FPS: | 476 | case MAD_UNITS_25_FPS: |
476 | case MAD_UNITS_30_FPS: | 477 | case MAD_UNITS_30_FPS: |
477 | case MAD_UNITS_48_FPS: | 478 | case MAD_UNITS_48_FPS: |
478 | case MAD_UNITS_50_FPS: | 479 | case MAD_UNITS_50_FPS: |
479 | case MAD_UNITS_60_FPS: | 480 | case MAD_UNITS_60_FPS: |
480 | case MAD_UNITS_75_FPS: | 481 | case MAD_UNITS_75_FPS: |
481 | sprintf(dest, format, mad_timer_count(timer, units), sub); | 482 | sprintf(dest, format, mad_timer_count(timer, units), sub); |
482 | break; | 483 | break; |
483 | } | 484 | } |
484 | } | 485 | } |
diff --git a/core/multimedia/opieplayer/libmad/timer.h b/core/multimedia/opieplayer/libmad/timer.h index f8afb8e..4f2be57 100644 --- a/core/multimedia/opieplayer/libmad/timer.h +++ b/core/multimedia/opieplayer/libmad/timer.h | |||
@@ -1,100 +1,100 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifndef LIBMAD_TIMER_H | 22 | # ifndef LIBMAD_TIMER_H |
23 | # define LIBMAD_TIMER_H | 23 | # define LIBMAD_TIMER_H |
24 | 24 | ||
25 | typedef struct { | 25 | typedef struct { |
26 | signed long seconds; /* whole seconds */ | 26 | signed long seconds; /* whole seconds */ |
27 | unsigned long fraction;/* 1/MAD_TIMER_RESOLUTION seconds */ | 27 | unsigned long fraction;/* 1/MAD_TIMER_RESOLUTION seconds */ |
28 | } mad_timer_t; | 28 | } mad_timer_t; |
29 | 29 | ||
30 | extern mad_timer_t const mad_timer_zero; | 30 | extern mad_timer_t const mad_timer_zero; |
31 | 31 | ||
32 | # define MAD_TIMER_RESOLUTION352800000UL | 32 | # define MAD_TIMER_RESOLUTION352800000UL |
33 | 33 | ||
34 | enum mad_units { | 34 | enum mad_units { |
35 | MAD_UNITS_HOURS = -2, | 35 | MAD_UNITS_HOURS = -2, |
36 | MAD_UNITS_MINUTES = -1, | 36 | MAD_UNITS_MINUTES = -1, |
37 | MAD_UNITS_SECONDS = 0, | 37 | MAD_UNITS_SECONDS = 0, |
38 | 38 | ||
39 | /* metric units */ | 39 | /* metric units */ |
40 | 40 | ||
41 | MAD_UNITS_DECISECONDS = 10, | 41 | MAD_UNITS_DECISECONDS = 10, |
42 | MAD_UNITS_CENTISECONDS = 100, | 42 | MAD_UNITS_CENTISECONDS = 100, |
43 | MAD_UNITS_MILLISECONDS = 1000, | 43 | MAD_UNITS_MILLISECONDS = 1000, |
44 | 44 | ||
45 | /* audio sample units */ | 45 | /* audio sample units */ |
46 | 46 | ||
47 | MAD_UNITS_8000_HZ = 8000, | 47 | MAD_UNITS_8000_HZ = 8000, |
48 | MAD_UNITS_11025_HZ = 11025, | 48 | MAD_UNITS_11025_HZ = 11025, |
49 | MAD_UNITS_12000_HZ = 12000, | 49 | MAD_UNITS_12000_HZ = 12000, |
50 | 50 | ||
51 | MAD_UNITS_16000_HZ = 16000, | 51 | MAD_UNITS_16000_HZ = 16000, |
52 | MAD_UNITS_22050_HZ = 22050, | 52 | MAD_UNITS_22050_HZ = 22050, |
53 | MAD_UNITS_24000_HZ = 24000, | 53 | MAD_UNITS_24000_HZ = 24000, |
54 | 54 | ||
55 | MAD_UNITS_32000_HZ = 32000, | 55 | MAD_UNITS_32000_HZ = 32000, |
56 | MAD_UNITS_44100_HZ = 44100, | 56 | MAD_UNITS_44100_HZ = 44100, |
57 | MAD_UNITS_48000_HZ = 48000, | 57 | MAD_UNITS_48000_HZ = 48000, |
58 | 58 | ||
59 | /* video frame/field units */ | 59 | /* video frame/field units */ |
60 | 60 | ||
61 | MAD_UNITS_24_FPS = 24, | 61 | MAD_UNITS_24_FPS = 24, |
62 | MAD_UNITS_25_FPS = 25, | 62 | MAD_UNITS_25_FPS = 25, |
63 | MAD_UNITS_30_FPS = 30, | 63 | MAD_UNITS_30_FPS = 30, |
64 | MAD_UNITS_48_FPS = 48, | 64 | MAD_UNITS_48_FPS = 48, |
65 | MAD_UNITS_50_FPS = 50, | 65 | MAD_UNITS_50_FPS = 50, |
66 | MAD_UNITS_60_FPS = 60, | 66 | MAD_UNITS_60_FPS = 60, |
67 | 67 | ||
68 | /* CD audio frames */ | 68 | /* CD audio frames */ |
69 | 69 | ||
70 | MAD_UNITS_75_FPS = 75, | 70 | MAD_UNITS_75_FPS = 75, |
71 | 71 | ||
72 | /* video drop-frame units */ | 72 | /* video drop-frame units */ |
73 | 73 | ||
74 | MAD_UNITS_23_976_FPS = -24, | 74 | MAD_UNITS_23_976_FPS = -24, |
75 | MAD_UNITS_24_975_FPS = -25, | 75 | MAD_UNITS_24_975_FPS = -25, |
76 | MAD_UNITS_29_97_FPS = -30, | 76 | MAD_UNITS_29_97_FPS = -30, |
77 | MAD_UNITS_47_952_FPS = -48, | 77 | MAD_UNITS_47_952_FPS = -48, |
78 | MAD_UNITS_49_95_FPS = -50, | 78 | MAD_UNITS_49_95_FPS = -50, |
79 | MAD_UNITS_59_94_FPS = -60 | 79 | MAD_UNITS_59_94_FPS = -60 |
80 | }; | 80 | }; |
81 | 81 | ||
82 | # define mad_timer_reset(timer)((void) (*(timer) = mad_timer_zero)) | 82 | # define mad_timer_reset(timer)((void) (*(timer) = mad_timer_zero)) |
83 | 83 | ||
84 | int mad_timer_compare(mad_timer_t, mad_timer_t); | 84 | int mad_timer_compare(mad_timer_t, mad_timer_t); |
85 | 85 | ||
86 | # define mad_timer_sign(timer)mad_timer_compare((timer), mad_timer_zero) | 86 | # define mad_timer_sign(timer)mad_timer_compare((timer), mad_timer_zero) |
87 | 87 | ||
88 | void mad_timer_negate(mad_timer_t *); | 88 | void mad_timer_negate(mad_timer_t *); |
89 | mad_timer_t mad_timer_abs(mad_timer_t); | 89 | mad_timer_t mad_timer_abs(mad_timer_t); |
90 | 90 | ||
91 | void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long); | 91 | void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long); |
92 | void mad_timer_add(mad_timer_t *, mad_timer_t); | 92 | void mad_timer_add(mad_timer_t *, mad_timer_t); |
93 | void mad_timer_multiply(mad_timer_t *, signed long); | 93 | void mad_timer_multiply(mad_timer_t *, signed long); |
94 | 94 | ||
95 | signed long mad_timer_count(mad_timer_t, enum mad_units); | 95 | signed long mad_timer_count(mad_timer_t, enum mad_units); |
96 | unsigned long mad_timer_fraction(mad_timer_t, unsigned long); | 96 | unsigned long mad_timer_fraction(mad_timer_t, unsigned long); |
97 | void mad_timer_string(mad_timer_t, char *, char const *, | 97 | void mad_timer_string(mad_timer_t, char *, char const *, |
98 | enum mad_units, enum mad_units, unsigned long); | 98 | enum mad_units, enum mad_units, unsigned long); |
99 | 99 | ||
100 | # endif | 100 | # endif |
diff --git a/core/multimedia/opieplayer/libmad/version.c b/core/multimedia/opieplayer/libmad/version.c index fb126f4..4fbef23 100644 --- a/core/multimedia/opieplayer/libmad/version.c +++ b/core/multimedia/opieplayer/libmad/version.c | |||
@@ -1,91 +1,91 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifdef HAVE_CONFIG_H | 22 | # ifdef HAVE_CONFIG_H |
23 | # include "libmad_config.h" | 23 | # include "libmad_config.h" |
24 | # endif | 24 | # endif |
25 | 25 | ||
26 | # include "libmad_global.h" | 26 | # include "libmad_global.h" |
27 | 27 | ||
28 | # include "libmad_version.h" | 28 | # include "libmad_version.h" |
29 | 29 | ||
30 | char const mad_version[] = "MPEG Audio Decoder " MAD_VERSION; | 30 | char const mad_version[] = "MPEG Audio Decoder " MAD_VERSION; |
31 | char const mad_copyright[] = "Copyright (C) " MAD_PUBLISHYEAR " " MAD_AUTHOR; | 31 | char const mad_copyright[] = "Copyright (C) " MAD_PUBLISHYEAR " " MAD_AUTHOR; |
32 | char const mad_author[] = MAD_AUTHOR " <" MAD_EMAIL ">"; | 32 | char const mad_author[] = MAD_AUTHOR " <" MAD_EMAIL ">"; |
33 | 33 | ||
34 | char const mad_build[] = "" | 34 | char const mad_build[] = "" |
35 | # if defined(DEBUG) | ||
36 | "DEBUG " | ||
37 | # elif defined(NDEBUG) | ||
38 | "NDEBUG " | ||
39 | # endif | ||
40 | |||
41 | # if defined(EXPERIMENTAL) | ||
42 | "EXPERIMENTAL " | ||
43 | # endif | ||
44 | |||
35 | # if defined(FPM_64BIT) | 45 | # if defined(FPM_64BIT) |
36 | "FPM_64BIT " | 46 | "FPM_64BIT " |
37 | # elif defined(FPM_INTEL) | 47 | # elif defined(FPM_INTEL) |
38 | "FPM_INTEL " | 48 | "FPM_INTEL " |
39 | # elif defined(FPM_ARM) | 49 | # elif defined(FPM_ARM) |
40 | "FPM_ARM " | 50 | "FPM_ARM " |
41 | # elif defined(FPM_MIPS) | 51 | # elif defined(FPM_MIPS) |
42 | "FPM_MIPS " | 52 | "FPM_MIPS " |
43 | # elif defined(FPM_SPARC) | 53 | # elif defined(FPM_SPARC) |
44 | "FPM_SPARC " | 54 | "FPM_SPARC " |
45 | # elif defined(FPM_PPC) | 55 | # elif defined(FPM_PPC) |
46 | "FPM_PPC " | 56 | "FPM_PPC " |
47 | # elif defined(FPM_DEFAULT) | 57 | # elif defined(FPM_DEFAULT) |
48 | "FPM_DEFAULT " | 58 | "FPM_DEFAULT " |
49 | # endif | 59 | # endif |
50 | 60 | ||
51 | # if defined(ASO_IMDCT) | 61 | # if defined(ASO_IMDCT) |
52 | "ASO_IMDCT " | 62 | "ASO_IMDCT " |
53 | # endif | 63 | # endif |
54 | # if defined(ASO_INTERLEAVE1) | 64 | # if defined(ASO_INTERLEAVE1) |
55 | "ASO_INTERLEAVE1 " | 65 | "ASO_INTERLEAVE1 " |
56 | # endif | 66 | # endif |
57 | # if defined(ASO_INTERLEAVE2) | 67 | # if defined(ASO_INTERLEAVE2) |
58 | "ASO_INTERLEAVE2 " | 68 | "ASO_INTERLEAVE2 " |
59 | # endif | 69 | # endif |
60 | # if defined(ASO_ZEROCHECK) | 70 | # if defined(ASO_ZEROCHECK) |
61 | "ASO_ZEROCHECK " | 71 | "ASO_ZEROCHECK " |
62 | # endif | 72 | # endif |
63 | 73 | ||
64 | # if defined(OPT_SPEED) | 74 | # if defined(OPT_SPEED) |
65 | "OPT_SPEED " | 75 | "OPT_SPEED " |
66 | # elif defined(OPT_ACCURACY) | 76 | # elif defined(OPT_ACCURACY) |
67 | "OPT_ACCURACY " | 77 | "OPT_ACCURACY " |
68 | # endif | 78 | # endif |
69 | 79 | ||
70 | # if defined(OPT_SSO) | 80 | # if defined(OPT_SSO) |
71 | "OPT_SSO " | 81 | "OPT_SSO " |
72 | # endif | 82 | # endif |
73 | 83 | ||
74 | # if defined(OPT_DCTO) /* never defined here */ | 84 | # if defined(OPT_DCTO) /* never defined here */ |
75 | "OPT_DCTO " | 85 | "OPT_DCTO " |
76 | # endif | 86 | # endif |
77 | 87 | ||
78 | # if defined(OPT_STRICT) | 88 | # if defined(OPT_STRICT) |
79 | "OPT_STRICT " | 89 | "OPT_STRICT " |
80 | # endif | 90 | # endif |
81 | |||
82 | # if defined(EXPERIMENTAL) | ||
83 | "EXPERIMENTAL " | ||
84 | # endif | ||
85 | |||
86 | # if defined(DEBUG) | ||
87 | "DEBUG " | ||
88 | # elif defined(NDEBUG) | ||
89 | "NDEBUG " | ||
90 | # endif | ||
91 | ; | 91 | ; |