diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/codecs/libmad/synth.c | 126 | ||||
-rw-r--r-- | apps/codecs/libmad/version.c | 4 |
2 files changed, 49 insertions, 81 deletions
diff --git a/apps/codecs/libmad/synth.c b/apps/codecs/libmad/synth.c index a928864b77..527d86d55c 100644 --- a/apps/codecs/libmad/synth.c +++ b/apps/codecs/libmad/synth.c | |||
@@ -90,14 +90,12 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, | |||
90 | * saved in the PCM buffer. 14 + 12 + 2 == 28 bits. | 90 | * saved in the PCM buffer. 14 + 12 + 2 == 28 bits. |
91 | */ | 91 | */ |
92 | 92 | ||
93 | /* FPM_DEFAULT without OPT_SSO will actually lose accuracy and performance */ | 93 | /* FPM_DEFAULT without OPT_SSO will actually not work. */ |
94 | |||
95 | # if defined(FPM_DEFAULT) && !defined(OPT_SSO) | 94 | # if defined(FPM_DEFAULT) && !defined(OPT_SSO) |
96 | # define OPT_SSO | 95 | # define OPT_SSO |
97 | # endif | 96 | # endif |
98 | 97 | ||
99 | /* second SSO shift, with rounding */ | 98 | /* second SSO shift, with rounding */ |
100 | |||
101 | # if defined(OPT_SSO) | 99 | # if defined(OPT_SSO) |
102 | # define SHIFT(x) (((x) + (1L << 11)) >> 12) | 100 | # define SHIFT(x) (((x) + (1L << 11)) >> 12) |
103 | # else | 101 | # else |
@@ -105,12 +103,9 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, | |||
105 | # endif | 103 | # endif |
106 | 104 | ||
107 | /* possible DCT speed optimization */ | 105 | /* possible DCT speed optimization */ |
108 | |||
109 | /* This is a Coldfire version of the OPT_SPEED optimisation below, but in the | ||
110 | case of Coldfire it doesn't lose any more precision than we would ordinarily | ||
111 | lose, */ | ||
112 | # ifdef FPM_COLDFIRE_EMAC | 106 | # ifdef FPM_COLDFIRE_EMAC |
113 | # define OPT_DCTO | 107 | /* This is a Coldfire version of the OPT_SPEED optimisation below, but in the |
108 | case of Coldfire it doesn't loose no additional precision. */ | ||
114 | # define MUL(x, y) \ | 109 | # define MUL(x, y) \ |
115 | ({ \ | 110 | ({ \ |
116 | mad_fixed64hi_t hi; \ | 111 | mad_fixed64hi_t hi; \ |
@@ -120,8 +115,21 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, | |||
120 | : [a] "r" ((x)), [b] "r" ((y))); \ | 115 | : [a] "r" ((x)), [b] "r" ((y))); \ |
121 | hi; \ | 116 | hi; \ |
122 | }) | 117 | }) |
118 | # elif defined(FPM_ARM) | ||
119 | /* This is an ARM version of the OPT_SPEED optimisation below. This | ||
120 | implementation will loose 1 bit of accuracy. */ | ||
121 | # define MUL(x, y) \ | ||
122 | ({ \ | ||
123 | mad_fixed64lo_t lo; \ | ||
124 | mad_fixed64hi_t hi; \ | ||
125 | asm volatile ( \ | ||
126 | "smull %[lo], %[hi], %[a], %[b]\n\t" /* hi = result */ \ | ||
127 | "mov %[hi], %[hi], lsl #1" /* hi <<= 1 */ \ | ||
128 | : [lo]"=&r"(lo), [hi]"=&r"(hi) \ | ||
129 | : [a]"r"(x), [b]"r"(y)); \ | ||
130 | hi; \ | ||
131 | }) | ||
123 | # elif defined(OPT_SPEED) && defined(MAD_F_MLX) | 132 | # elif defined(OPT_SPEED) && defined(MAD_F_MLX) |
124 | # define OPT_DCTO | ||
125 | # define MUL(x, y) \ | 133 | # define MUL(x, y) \ |
126 | ({ mad_fixed64hi_t hi; \ | 134 | ({ mad_fixed64hi_t hi; \ |
127 | mad_fixed64lo_t lo; \ | 135 | mad_fixed64lo_t lo; \ |
@@ -129,8 +137,7 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, | |||
129 | hi << (32 - MAD_F_SCALEBITS - 3); \ | 137 | hi << (32 - MAD_F_SCALEBITS - 3); \ |
130 | }) | 138 | }) |
131 | # else | 139 | # else |
132 | # undef OPT_DCTO | 140 | # define MUL(x, y) mad_f_mul((x), (y>>3)) |
133 | # define MUL(x, y) mad_f_mul((x), (y)) | ||
134 | # endif | 141 | # endif |
135 | 142 | ||
136 | /* | 143 | /* |
@@ -166,72 +173,37 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, | |||
166 | mad_fixed_t t176; | 173 | mad_fixed_t t176; |
167 | 174 | ||
168 | /* costab[i] = cos(PI / (2 * 32) * i) */ | 175 | /* costab[i] = cos(PI / (2 * 32) * i) */ |
169 | 176 | #define costab1 MAD_F(0x7fd8878e) /* 0.998795456 */ | |
170 | # if defined(OPT_DCTO) | 177 | #define costab2 MAD_F(0x7f62368f) /* 0.995184727 */ |
171 | # define costab1 MAD_F(0x7fd8878e) | 178 | #define costab3 MAD_F(0x7e9d55fc) /* 0.989176510 */ |
172 | # define costab2 MAD_F(0x7f62368f) | 179 | #define costab4 MAD_F(0x7d8a5f40) /* 0.980785280 */ |
173 | # define costab3 MAD_F(0x7e9d55fc) | 180 | #define costab5 MAD_F(0x7c29fbee) /* 0.970031253 */ |
174 | # define costab4 MAD_F(0x7d8a5f40) | 181 | #define costab6 MAD_F(0x7a7d055b) /* 0.956940336 */ |
175 | # define costab5 MAD_F(0x7c29fbee) | 182 | #define costab7 MAD_F(0x78848414) /* 0.941544065 */ |
176 | # define costab6 MAD_F(0x7a7d055b) | 183 | #define costab8 MAD_F(0x7641af3d) /* 0.923879533 */ |
177 | # define costab7 MAD_F(0x78848414) | 184 | #define costab9 MAD_F(0x73b5ebd1) /* 0.903989293 */ |
178 | # define costab8 MAD_F(0x7641af3d) | 185 | #define costab10 MAD_F(0x70e2cbc6) /* 0.881921264 */ |
179 | # define costab9 MAD_F(0x73b5ebd1) | 186 | #define costab11 MAD_F(0x6dca0d14) /* 0.857728610 */ |
180 | # define costab10 MAD_F(0x70e2cbc6) | 187 | #define costab12 MAD_F(0x6a5d98a4) /* 0.831469612 */ |
181 | # define costab11 MAD_F(0x6dca0d14) | 188 | #define costab13 MAD_F(0x66cf8120) /* 0.803207531 */ |
182 | # define costab12 MAD_F(0x6a5d98a4) | 189 | #define costab14 MAD_F(0x62f201ac) /* 0.773010453 */ |
183 | # define costab13 MAD_F(0x66cf8120) | 190 | #define costab15 MAD_F(0x5ed77c8a) /* 0.740951125 */ |
184 | # define costab14 MAD_F(0x62f201ac) | 191 | #define costab16 MAD_F(0x5a82799a) /* 0.707106781 */ |
185 | # define costab15 MAD_F(0x5ed77c8a) | 192 | #define costab17 MAD_F(0x55f5a4d2) /* 0.671558955 */ |
186 | # define costab16 MAD_F(0x5a82799a) | 193 | #define costab18 MAD_F(0x5133cc94) /* 0.634393284 */ |
187 | # define costab17 MAD_F(0x55f5a4d2) | 194 | #define costab19 MAD_F(0x4c3fdff4) /* 0.595699304 */ |
188 | # define costab18 MAD_F(0x5133cc94) | 195 | #define costab20 MAD_F(0x471cece7) /* 0.555570233 */ |
189 | # define costab19 MAD_F(0x4c3fdff4) | 196 | #define costab21 MAD_F(0x41ce1e65) /* 0.514102744 */ |
190 | # define costab20 MAD_F(0x471cece7) | 197 | #define costab22 MAD_F(0x3c56ba70) /* 0.471396737 */ |
191 | # define costab21 MAD_F(0x41ce1e65) | 198 | #define costab23 MAD_F(0x36ba2014) /* 0.427555093 */ |
192 | # define costab22 MAD_F(0x3c56ba70) | 199 | #define costab24 MAD_F(0x30fbc54d) /* 0.382683432 */ |
193 | # define costab23 MAD_F(0x36ba2014) | 200 | #define costab25 MAD_F(0x2b1f34eb) /* 0.336889853 */ |
194 | # define costab24 MAD_F(0x30fbc54d) | 201 | #define costab26 MAD_F(0x25280c5e) /* 0.290284677 */ |
195 | # define costab25 MAD_F(0x2b1f34eb) | 202 | #define costab27 MAD_F(0x1f19f97b) /* 0.242980180 */ |
196 | # define costab26 MAD_F(0x25280c5e) | 203 | #define costab28 MAD_F(0x18f8b83c) /* 0.195090322 */ |
197 | # define costab27 MAD_F(0x1f19f97b) | 204 | #define costab29 MAD_F(0x12c8106f) /* 0.146730474 */ |
198 | # define costab28 MAD_F(0x18f8b83c) | 205 | #define costab30 MAD_F(0x0c8bd35e) /* 0.098017140 */ |
199 | # define costab29 MAD_F(0x12c8106f) | 206 | #define costab31 MAD_F(0x0647d97c) /* 0.049067674 */ |
200 | # define costab30 MAD_F(0x0c8bd35e) | ||
201 | # define costab31 MAD_F(0x0647d97c) | ||
202 | # else | ||
203 | # define costab1 MAD_F(0x0ffb10f2) /* 0.998795456 */ | ||
204 | # define costab2 MAD_F(0x0fec46d2) /* 0.995184727 */ | ||
205 | # define costab3 MAD_F(0x0fd3aac0) /* 0.989176510 */ | ||
206 | # define costab4 MAD_F(0x0fb14be8) /* 0.980785280 */ | ||
207 | # define costab5 MAD_F(0x0f853f7e) /* 0.970031253 */ | ||
208 | # define costab6 MAD_F(0x0f4fa0ab) /* 0.956940336 */ | ||
209 | # define costab7 MAD_F(0x0f109082) /* 0.941544065 */ | ||
210 | # define costab8 MAD_F(0x0ec835e8) /* 0.923879533 */ | ||
211 | # define costab9 MAD_F(0x0e76bd7a) /* 0.903989293 */ | ||
212 | # define costab10 MAD_F(0x0e1c5979) /* 0.881921264 */ | ||
213 | # define costab11 MAD_F(0x0db941a3) /* 0.857728610 */ | ||
214 | # define costab12 MAD_F(0x0d4db315) /* 0.831469612 */ | ||
215 | # define costab13 MAD_F(0x0cd9f024) /* 0.803207531 */ | ||
216 | # define costab14 MAD_F(0x0c5e4036) /* 0.773010453 */ | ||
217 | # define costab15 MAD_F(0x0bdaef91) /* 0.740951125 */ | ||
218 | # define costab16 MAD_F(0x0b504f33) /* 0.707106781 */ | ||
219 | # define costab17 MAD_F(0x0abeb49a) /* 0.671558955 */ | ||
220 | # define costab18 MAD_F(0x0a267993) /* 0.634393284 */ | ||
221 | # define costab19 MAD_F(0x0987fbfe) /* 0.595699304 */ | ||
222 | # define costab20 MAD_F(0x08e39d9d) /* 0.555570233 */ | ||
223 | # define costab21 MAD_F(0x0839c3cd) /* 0.514102744 */ | ||
224 | # define costab22 MAD_F(0x078ad74e) /* 0.471396737 */ | ||
225 | # define costab23 MAD_F(0x06d74402) /* 0.427555093 */ | ||
226 | # define costab24 MAD_F(0x061f78aa) /* 0.382683432 */ | ||
227 | # define costab25 MAD_F(0x0563e69d) /* 0.336889853 */ | ||
228 | # define costab26 MAD_F(0x04a5018c) /* 0.290284677 */ | ||
229 | # define costab27 MAD_F(0x03e33f2f) /* 0.242980180 */ | ||
230 | # define costab28 MAD_F(0x031f1708) /* 0.195090322 */ | ||
231 | # define costab29 MAD_F(0x0259020e) /* 0.146730474 */ | ||
232 | # define costab30 MAD_F(0x01917a5c) /* 0.098017140 */ | ||
233 | # define costab31 MAD_F(0x00c8fb30) /* 0.049067674 */ | ||
234 | # endif | ||
235 | 207 | ||
236 | t0 = in[0] + in[31]; t16 = MUL(in[0] - in[31], costab1); | 208 | t0 = in[0] + in[31]; t16 = MUL(in[0] - in[31], costab1); |
237 | t1 = in[15] + in[16]; t17 = MUL(in[15] - in[16], costab31); | 209 | t1 = in[15] + in[16]; t17 = MUL(in[15] - in[16], costab31); |
diff --git a/apps/codecs/libmad/version.c b/apps/codecs/libmad/version.c index 064a5938cc..06edcd065b 100644 --- a/apps/codecs/libmad/version.c +++ b/apps/codecs/libmad/version.c | |||
@@ -81,10 +81,6 @@ char const mad_build[] = "" | |||
81 | "OPT_SSO " | 81 | "OPT_SSO " |
82 | # endif | 82 | # endif |
83 | 83 | ||
84 | # if defined(OPT_DCTO) /* never defined here */ | ||
85 | "OPT_DCTO " | ||
86 | # endif | ||
87 | |||
88 | # if defined(OPT_STRICT) | 84 | # if defined(OPT_STRICT) |
89 | "OPT_STRICT " | 85 | "OPT_STRICT " |
90 | # endif | 86 | # endif |