author | harlekin <harlekin> | 2002-04-19 16:08:55 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-04-19 16:08:55 (UTC) |
commit | 7ea4abeb652e6787e57a938e1ca028d25fd249ce (patch) (unidiff) | |
tree | ee08f2d9d6aaa8adb1c5f07f4124da8a61eb8cd5 /core/multimedia/opieplayer/libmad/synth.c | |
parent | caa7ced77b9014526607f9f65c58aabe7e0ba631 (diff) | |
download | opie-7ea4abeb652e6787e57a938e1ca028d25fd249ce.zip opie-7ea4abeb652e6787e57a938e1ca028d25fd249ce.tar.gz opie-7ea4abeb652e6787e57a938e1ca028d25fd249ce.tar.bz2 |
new libmad version, less cpu usage
Diffstat (limited to 'core/multimedia/opieplayer/libmad/synth.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/libmad/synth.c | 328 |
1 files changed, 165 insertions, 163 deletions
diff --git a/core/multimedia/opieplayer/libmad/synth.c b/core/multimedia/opieplayer/libmad/synth.c index e1914c9..cf3c1d5 100644 --- a/core/multimedia/opieplayer/libmad/synth.c +++ b/core/multimedia/opieplayer/libmad/synth.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * mad - MPEG audio decoder | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2001 Robert Leslie |
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. |
@@ -147,79 +147,75 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, | |||
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 | enum { | 153 | # define costab1MAD_F(0x7fd8878e) |
154 | costab1 = MAD_F(0x7fd8878e), | 154 | # define costab2MAD_F(0x7f62368f) |
155 | costab2 = MAD_F(0x7f62368f), | 155 | # define costab3MAD_F(0x7e9d55fc) |
156 | costab3 = MAD_F(0x7e9d55fc), | 156 | # define costab4MAD_F(0x7d8a5f40) |
157 | costab4 = MAD_F(0x7d8a5f40), | 157 | # define costab5MAD_F(0x7c29fbee) |
158 | costab5 = MAD_F(0x7c29fbee), | 158 | # define costab6MAD_F(0x7a7d055b) |
159 | costab6 = MAD_F(0x7a7d055b), | 159 | # define costab7MAD_F(0x78848414) |
160 | costab7 = MAD_F(0x78848414), | 160 | # define costab8MAD_F(0x7641af3d) |
161 | costab8 = MAD_F(0x7641af3d), | 161 | # define costab9MAD_F(0x73b5ebd1) |
162 | costab9 = MAD_F(0x73b5ebd1), | 162 | # define costab10MAD_F(0x70e2cbc6) |
163 | costab10 = MAD_F(0x70e2cbc6), | 163 | # define costab11MAD_F(0x6dca0d14) |
164 | costab11 = MAD_F(0x6dca0d14), | 164 | # define costab12MAD_F(0x6a6d98a4) |
165 | costab12 = MAD_F(0x6a6d98a4), | 165 | # define costab13MAD_F(0x66cf8120) |
166 | costab13 = MAD_F(0x66cf8120), | 166 | # define costab14MAD_F(0x62f201ac) |
167 | costab14 = MAD_F(0x62f201ac), | 167 | # define costab15MAD_F(0x5ed77c8a) |
168 | costab15 = MAD_F(0x5ed77c8a), | 168 | # define costab16MAD_F(0x5a82799a) |
169 | costab16 = MAD_F(0x5a82799a), | 169 | # define costab17MAD_F(0x55f5a4d2) |
170 | costab17 = MAD_F(0x55f5a4d2), | 170 | # define costab18MAD_F(0x5133cc94) |
171 | costab18 = MAD_F(0x5133cc94), | 171 | # define costab19MAD_F(0x4c3fdff4) |
172 | costab19 = MAD_F(0x4c3fdff4), | 172 | # define costab20MAD_F(0x471cece7) |
173 | costab20 = MAD_F(0x471cece7), | 173 | # define costab21MAD_F(0x41ce1e65) |
174 | costab21 = MAD_F(0x41ce1e65), | 174 | # define costab22MAD_F(0x3c56ba70) |
175 | costab22 = MAD_F(0x3c56ba70), | 175 | # define costab23MAD_F(0x36ba2014) |
176 | costab23 = MAD_F(0x36ba2014), | 176 | # define costab24MAD_F(0x30fbc54d) |
177 | costab24 = MAD_F(0x30fbc54d), | 177 | # define costab25MAD_F(0x2b1f34eb) |
178 | costab25 = MAD_F(0x2b1f34eb), | 178 | # define costab26MAD_F(0x25280c5e) |
179 | costab26 = MAD_F(0x25280c5e), | 179 | # define costab27MAD_F(0x1f19f97b) |
180 | costab27 = MAD_F(0x1f19f97b), | 180 | # define costab28MAD_F(0x18f8b83c) |
181 | costab28 = MAD_F(0x18f8b83c), | 181 | # define costab29MAD_F(0x12c8106f) |
182 | costab29 = MAD_F(0x12c8106f), | 182 | # define costab30MAD_F(0x0c8bd35e) |
183 | costab30 = MAD_F(0x0c8bd35e), | 183 | # define costab31MAD_F(0x0647d97c) |
184 | costab31 = MAD_F(0x0647d97c) | ||
185 | }; | ||
186 | # else | 184 | # else |
187 | enum { | 185 | # define costab1MAD_F(0x0ffb10f2) /* 0.998795456 */ |
188 | costab1 = MAD_F(0x0ffb10f2), /* 0.998795456 */ | 186 | # define costab2MAD_F(0x0fec46d2) /* 0.995184727 */ |
189 | costab2 = MAD_F(0x0fec46d2), /* 0.995184727 */ | 187 | # define costab3MAD_F(0x0fd3aac0) /* 0.989176510 */ |
190 | costab3 = MAD_F(0x0fd3aac0), /* 0.989176510 */ | 188 | # define costab4MAD_F(0x0fb14be8) /* 0.980785280 */ |
191 | costab4 = MAD_F(0x0fb14be8), /* 0.980785280 */ | 189 | # define costab5MAD_F(0x0f853f7e) /* 0.970031253 */ |
192 | costab5 = MAD_F(0x0f853f7e), /* 0.970031253 */ | 190 | # define costab6MAD_F(0x0f4fa0ab) /* 0.956940336 */ |
193 | costab6 = MAD_F(0x0f4fa0ab), /* 0.956940336 */ | 191 | # define costab7MAD_F(0x0f109082) /* 0.941544065 */ |
194 | costab7 = MAD_F(0x0f109082), /* 0.941544065 */ | 192 | # define costab8MAD_F(0x0ec835e8) /* 0.923879533 */ |
195 | costab8 = MAD_F(0x0ec835e8), /* 0.923879533 */ | 193 | # define costab9MAD_F(0x0e76bd7a) /* 0.903989293 */ |
196 | costab9 = MAD_F(0x0e76bd7a), /* 0.903989293 */ | 194 | # define costab10MAD_F(0x0e1c5979) /* 0.881921264 */ |
197 | costab10 = MAD_F(0x0e1c5979), /* 0.881921264 */ | 195 | # define costab11MAD_F(0x0db941a3) /* 0.857728610 */ |
198 | costab11 = MAD_F(0x0db941a3), /* 0.857728610 */ | 196 | # define costab12MAD_F(0x0d4db315) /* 0.831469612 */ |
199 | costab12 = MAD_F(0x0d4db315), /* 0.831469612 */ | 197 | # define costab13MAD_F(0x0cd9f024) /* 0.803207531 */ |
200 | costab13 = MAD_F(0x0cd9f024), /* 0.803207531 */ | 198 | # define costab14MAD_F(0x0c5e4036) /* 0.773010453 */ |
201 | costab14 = MAD_F(0x0c5e4036), /* 0.773010453 */ | 199 | # define costab15MAD_F(0x0bdaef91) /* 0.740951125 */ |
202 | costab15 = MAD_F(0x0bdaef91), /* 0.740951125 */ | 200 | # define costab16MAD_F(0x0b504f33) /* 0.707106781 */ |
203 | costab16 = MAD_F(0x0b504f33), /* 0.707106781 */ | 201 | # define costab17MAD_F(0x0abeb49a) /* 0.671558955 */ |
204 | costab17 = MAD_F(0x0abeb49a), /* 0.671558955 */ | 202 | # define costab18MAD_F(0x0a267993) /* 0.634393284 */ |
205 | costab18 = MAD_F(0x0a267993), /* 0.634393284 */ | 203 | # define costab19MAD_F(0x0987fbfe) /* 0.595699304 */ |
206 | costab19 = MAD_F(0x0987fbfe), /* 0.595699304 */ | 204 | # define costab20MAD_F(0x08e39d9d) /* 0.555570233 */ |
207 | costab20 = MAD_F(0x08e39d9d), /* 0.555570233 */ | 205 | # define costab21MAD_F(0x0839c3cd) /* 0.514102744 */ |
208 | costab21 = MAD_F(0x0839c3cd), /* 0.514102744 */ | 206 | # define costab22MAD_F(0x078ad74e) /* 0.471396737 */ |
209 | costab22 = MAD_F(0x078ad74e), /* 0.471396737 */ | 207 | # define costab23MAD_F(0x06d74402) /* 0.427555093 */ |
210 | costab23 = MAD_F(0x06d74402), /* 0.427555093 */ | 208 | # define costab24MAD_F(0x061f78aa) /* 0.382683432 */ |
211 | costab24 = MAD_F(0x061f78aa), /* 0.382683432 */ | 209 | # define costab25MAD_F(0x0563e69d) /* 0.336889853 */ |
212 | costab25 = MAD_F(0x0563e69d), /* 0.336889853 */ | 210 | # define costab26MAD_F(0x04a5018c) /* 0.290284677 */ |
213 | costab26 = MAD_F(0x04a5018c), /* 0.290284677 */ | 211 | # define costab27MAD_F(0x03e33f2f) /* 0.242980180 */ |
214 | costab27 = MAD_F(0x03e33f2f), /* 0.242980180 */ | 212 | # define costab28MAD_F(0x031f1708) /* 0.195090322 */ |
215 | costab28 = MAD_F(0x031f1708), /* 0.195090322 */ | 213 | # define costab29MAD_F(0x0259020e) /* 0.146730474 */ |
216 | costab29 = MAD_F(0x0259020e), /* 0.146730474 */ | 214 | # define costab30MAD_F(0x01917a6c) /* 0.098017140 */ |
217 | costab30 = MAD_F(0x01917a6c), /* 0.098017140 */ | 215 | # define costab31MAD_F(0x00c8fb30) /* 0.049067674 */ |
218 | costab31 = MAD_F(0x00c8fb30) /* 0.049067674 */ | ||
219 | }; | ||
220 | # endif | 216 | # endif |
221 | 217 | ||
222 | 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); |
223 | 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); |
224 | 220 | ||
225 | t41 = t16 + t17; | 221 | t41 = t16 + t17; |
@@ -324,13 +320,13 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, | |||
324 | 320 | ||
325 | t121 = t83 + t84; | 321 | t121 = t83 + t84; |
326 | t122 = t85 + t86; | 322 | t122 = t85 + t86; |
327 | 323 | ||
328 | t67 = t121 + t122; | 324 | t67 = t121 + t122; |
329 | 325 | ||
330 | t49 = (t67 << 1) - t32; | 326 | t49 = (t67 * 2) - t32; |
331 | 327 | ||
332 | /* 3 */ hi[12][slot] = SHIFT(t49); | 328 | /* 3 */ hi[12][slot] = SHIFT(t49); |
333 | 329 | ||
334 | t125 = t89 + t90; | 330 | t125 = t89 + t90; |
335 | t126 = t91 + t92; | 331 | t126 = t91 + t92; |
336 | 332 | ||
@@ -340,174 +336,174 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, | |||
340 | 336 | ||
341 | t128 = t94 + t95; | 337 | t128 = t94 + t95; |
342 | t129 = t96 + t97; | 338 | t129 = t96 + t97; |
343 | 339 | ||
344 | t98 = t128 + t129; | 340 | t98 = t128 + t129; |
345 | 341 | ||
346 | t68 = (t98 << 1) - t49; | 342 | t68 = (t98 * 2) - t49; |
347 | 343 | ||
348 | /* 5 */ hi[10][slot] = SHIFT(t68); | 344 | /* 5 */ hi[10][slot] = SHIFT(t68); |
349 | 345 | ||
350 | t132 = t100 + t101; | 346 | t132 = t100 + t101; |
351 | t133 = t102 + t103; | 347 | t133 = t102 + t103; |
352 | 348 | ||
353 | t104 = t132 + t133; | 349 | t104 = t132 + t133; |
354 | 350 | ||
355 | t82 = (t104 << 1) - t58; | 351 | t82 = (t104 * 2) - t58; |
356 | 352 | ||
357 | /* 6 */ hi[ 9][slot] = SHIFT(t82); | 353 | /* 6 */ hi[ 9][slot] = SHIFT(t82); |
358 | 354 | ||
359 | t136 = t106 + t107; | 355 | t136 = t106 + t107; |
360 | t137 = t108 + t109; | 356 | t137 = t108 + t109; |
361 | 357 | ||
362 | t110 = t136 + t137; | 358 | t110 = t136 + t137; |
363 | 359 | ||
364 | t87 = (t110 << 1) - t67; | 360 | t87 = (t110 * 2) - t67; |
365 | 361 | ||
366 | t77 = (t87 << 1) - t68; | 362 | t77 = (t87 * 2) - t68; |
367 | 363 | ||
368 | /* 7 */ hi[ 8][slot] = SHIFT(t77); | 364 | /* 7 */ hi[ 8][slot] = SHIFT(t77); |
369 | 365 | ||
370 | t141 = MUL(t69 - t70, costab8); | 366 | t141 = MUL(t69 - t70, costab8); |
371 | t142 = MUL(t71 - t72, costab24); | 367 | t142 = MUL(t71 - t72, costab24); |
372 | t143 = t141 + t142; | 368 | t143 = t141 + t142; |
373 | 369 | ||
374 | /* 8 */ hi[ 7][slot] = SHIFT(t143); | 370 | /* 8 */ hi[ 7][slot] = SHIFT(t143); |
375 | /* 24 */ lo[ 8][slot] = | 371 | /* 24 */ lo[ 8][slot] = |
376 | SHIFT((MUL(t141 - t142, costab16) << 1) - t143); | 372 | SHIFT((MUL(t141 - t142, costab16) * 2) - t143); |
377 | 373 | ||
378 | t144 = MUL(t73 - t74, costab8); | 374 | t144 = MUL(t73 - t74, costab8); |
379 | t145 = MUL(t75 - t76, costab24); | 375 | t145 = MUL(t75 - t76, costab24); |
380 | t146 = t144 + t145; | 376 | t146 = t144 + t145; |
381 | 377 | ||
382 | t88 = (t146 << 1) - t77; | 378 | t88 = (t146 * 2) - t77; |
383 | 379 | ||
384 | /* 9 */ hi[ 6][slot] = SHIFT(t88); | 380 | /* 9 */ hi[ 6][slot] = SHIFT(t88); |
385 | 381 | ||
386 | t148 = MUL(t78 - t79, costab8); | 382 | t148 = MUL(t78 - t79, costab8); |
387 | t149 = MUL(t80 - t81, costab24); | 383 | t149 = MUL(t80 - t81, costab24); |
388 | t150 = t148 + t149; | 384 | t150 = t148 + t149; |
389 | 385 | ||
390 | t105 = (t150 << 1) - t82; | 386 | t105 = (t150 * 2) - t82; |
391 | 387 | ||
392 | /* 10 */ hi[ 5][slot] = SHIFT(t105); | 388 | /* 10 */ hi[ 5][slot] = SHIFT(t105); |
393 | 389 | ||
394 | t152 = MUL(t83 - t84, costab8); | 390 | t152 = MUL(t83 - t84, costab8); |
395 | t153 = MUL(t85 - t86, costab24); | 391 | t153 = MUL(t85 - t86, costab24); |
396 | t154 = t152 + t153; | 392 | t154 = t152 + t153; |
397 | 393 | ||
398 | t111 = (t154 << 1) - t87; | 394 | t111 = (t154 * 2) - t87; |
399 | 395 | ||
400 | t99 = (t111 << 1) - t88; | 396 | t99 = (t111 * 2) - t88; |
401 | 397 | ||
402 | /* 11 */ hi[ 4][slot] = SHIFT(t99); | 398 | /* 11 */ hi[ 4][slot] = SHIFT(t99); |
403 | 399 | ||
404 | t157 = MUL(t89 - t90, costab8); | 400 | t157 = MUL(t89 - t90, costab8); |
405 | t158 = MUL(t91 - t92, costab24); | 401 | t158 = MUL(t91 - t92, costab24); |
406 | t159 = t157 + t158; | 402 | t159 = t157 + t158; |
407 | 403 | ||
408 | t127 = (t159 << 1) - t93; | 404 | t127 = (t159 * 2) - t93; |
409 | 405 | ||
410 | /* 12 */ hi[ 3][slot] = SHIFT(t127); | 406 | /* 12 */ hi[ 3][slot] = SHIFT(t127); |
411 | 407 | ||
412 | t160 = (MUL(t125 - t126, costab16) << 1) - t127; | 408 | t160 = (MUL(t125 - t126, costab16) * 2) - t127; |
413 | 409 | ||
414 | /* 20 */ lo[ 4][slot] = SHIFT(t160); | 410 | /* 20 */ lo[ 4][slot] = SHIFT(t160); |
415 | /* 28 */ lo[12][slot] = | 411 | /* 28 */ lo[12][slot] = |
416 | SHIFT((((MUL(t157 - t158, costab16) << 1) - t159) << 1) - t160); | 412 | SHIFT((((MUL(t157 - t158, costab16) * 2) - t159) * 2) - t160); |
417 | 413 | ||
418 | t161 = MUL(t94 - t95, costab8); | 414 | t161 = MUL(t94 - t95, costab8); |
419 | t162 = MUL(t96 - t97, costab24); | 415 | t162 = MUL(t96 - t97, costab24); |
420 | t163 = t161 + t162; | 416 | t163 = t161 + t162; |
421 | 417 | ||
422 | t130 = (t163 << 1) - t98; | 418 | t130 = (t163 * 2) - t98; |
423 | 419 | ||
424 | t112 = (t130 << 1) - t99; | 420 | t112 = (t130 * 2) - t99; |
425 | 421 | ||
426 | /* 13 */ hi[ 2][slot] = SHIFT(t112); | 422 | /* 13 */ hi[ 2][slot] = SHIFT(t112); |
427 | 423 | ||
428 | t164 = (MUL(t128 - t129, costab16) << 1) - t130; | 424 | t164 = (MUL(t128 - t129, costab16) * 2) - t130; |
429 | 425 | ||
430 | t166 = MUL(t100 - t101, costab8); | 426 | t166 = MUL(t100 - t101, costab8); |
431 | t167 = MUL(t102 - t103, costab24); | 427 | t167 = MUL(t102 - t103, costab24); |
432 | t168 = t166 + t167; | 428 | t168 = t166 + t167; |
433 | 429 | ||
434 | t134 = (t168 << 1) - t104; | 430 | t134 = (t168 * 2) - t104; |
435 | 431 | ||
436 | t120 = (t134 << 1) - t105; | 432 | t120 = (t134 * 2) - t105; |
437 | 433 | ||
438 | /* 14 */ hi[ 1][slot] = SHIFT(t120); | 434 | /* 14 */ hi[ 1][slot] = SHIFT(t120); |
439 | 435 | ||
440 | t135 = (MUL(t118 - t119, costab16) << 1) - t120; | 436 | t135 = (MUL(t118 - t119, costab16) * 2) - t120; |
441 | 437 | ||
442 | /* 18 */ lo[ 2][slot] = SHIFT(t135); | 438 | /* 18 */ lo[ 2][slot] = SHIFT(t135); |
443 | 439 | ||
444 | t169 = (MUL(t132 - t133, costab16) << 1) - t134; | 440 | t169 = (MUL(t132 - t133, costab16) * 2) - t134; |
445 | 441 | ||
446 | t151 = (t169 << 1) - t135; | 442 | t151 = (t169 * 2) - t135; |
447 | 443 | ||
448 | /* 22 */ lo[ 6][slot] = SHIFT(t151); | 444 | /* 22 */ lo[ 6][slot] = SHIFT(t151); |
449 | 445 | ||
450 | t170 = (((MUL(t148 - t149, costab16) << 1) - t150) << 1) - t151; | 446 | t170 = (((MUL(t148 - t149, costab16) * 2) - t150) * 2) - t151; |
451 | 447 | ||
452 | /* 26 */ lo[10][slot] = SHIFT(t170); | 448 | /* 26 */ lo[10][slot] = SHIFT(t170); |
453 | /* 30 */ lo[14][slot] = | 449 | /* 30 */ lo[14][slot] = |
454 | SHIFT((((((MUL(t166 - t167, costab16) << 1) - | 450 | SHIFT((((((MUL(t166 - t167, costab16) * 2) - |
455 | t168) << 1) - t169) << 1) - t170); | 451 | t168) * 2) - t169) * 2) - t170); |
456 | 452 | ||
457 | t171 = MUL(t106 - t107, costab8); | 453 | t171 = MUL(t106 - t107, costab8); |
458 | t172 = MUL(t108 - t109, costab24); | 454 | t172 = MUL(t108 - t109, costab24); |
459 | t173 = t171 + t172; | 455 | t173 = t171 + t172; |
460 | 456 | ||
461 | t138 = (t173 << 1) - t110; | 457 | t138 = (t173 * 2) - t110; |
462 | 458 | ||
463 | t123 = (t138 << 1) - t111; | 459 | t123 = (t138 * 2) - t111; |
464 | 460 | ||
465 | t139 = (MUL(t121 - t122, costab16) << 1) - t123; | 461 | t139 = (MUL(t121 - t122, costab16) * 2) - t123; |
466 | 462 | ||
467 | t117 = (t123 << 1) - t112; | 463 | t117 = (t123 * 2) - t112; |
468 | 464 | ||
469 | /* 15 */ hi[ 0][slot] = SHIFT(t117); | 465 | /* 15 */ hi[ 0][slot] = SHIFT(t117); |
470 | 466 | ||
471 | t124 = (MUL(t115 - t116, costab16) << 1) - t117; | 467 | t124 = (MUL(t115 - t116, costab16) * 2) - t117; |
472 | 468 | ||
473 | /* 17 */ lo[ 1][slot] = SHIFT(t124); | 469 | /* 17 */ lo[ 1][slot] = SHIFT(t124); |
474 | 470 | ||
475 | t131 = (t139 << 1) - t124; | 471 | t131 = (t139 * 2) - t124; |
476 | 472 | ||
477 | /* 19 */ lo[ 3][slot] = SHIFT(t131); | 473 | /* 19 */ lo[ 3][slot] = SHIFT(t131); |
478 | 474 | ||
479 | t140 = (t164 << 1) - t131; | 475 | t140 = (t164 * 2) - t131; |
480 | 476 | ||
481 | /* 21 */ lo[ 5][slot] = SHIFT(t140); | 477 | /* 21 */ lo[ 5][slot] = SHIFT(t140); |
482 | 478 | ||
483 | t174 = (MUL(t136 - t137, costab16) << 1) - t138; | 479 | t174 = (MUL(t136 - t137, costab16) * 2) - t138; |
484 | 480 | ||
485 | t155 = (t174 << 1) - t139; | 481 | t155 = (t174 * 2) - t139; |
486 | 482 | ||
487 | t147 = (t155 << 1) - t140; | 483 | t147 = (t155 * 2) - t140; |
488 | 484 | ||
489 | /* 23 */ lo[ 7][slot] = SHIFT(t147); | 485 | /* 23 */ lo[ 7][slot] = SHIFT(t147); |
490 | 486 | ||
491 | t156 = (((MUL(t144 - t145, costab16) << 1) - t146) << 1) - t147; | 487 | t156 = (((MUL(t144 - t145, costab16) * 2) - t146) * 2) - t147; |
492 | 488 | ||
493 | /* 25 */ lo[ 9][slot] = SHIFT(t156); | 489 | /* 25 */ lo[ 9][slot] = SHIFT(t156); |
494 | 490 | ||
495 | t175 = (((MUL(t152 - t153, costab16) << 1) - t154) << 1) - t155; | 491 | t175 = (((MUL(t152 - t153, costab16) * 2) - t154) * 2) - t155; |
496 | 492 | ||
497 | t165 = (t175 << 1) - t156; | 493 | t165 = (t175 * 2) - t156; |
498 | 494 | ||
499 | /* 27 */ lo[11][slot] = SHIFT(t165); | 495 | /* 27 */ lo[11][slot] = SHIFT(t165); |
500 | 496 | ||
501 | t176 = (((((MUL(t161 - t162, costab16) << 1) - | 497 | t176 = (((((MUL(t161 - t162, costab16) * 2) - |
502 | t163) << 1) - t164) << 1) - t165; | 498 | t163) * 2) - t164) * 2) - t165; |
503 | 499 | ||
504 | /* 29 */ lo[13][slot] = SHIFT(t176); | 500 | /* 29 */ lo[13][slot] = SHIFT(t176); |
505 | /* 31 */ lo[15][slot] = | 501 | /* 31 */ lo[15][slot] = |
506 | SHIFT((((((((MUL(t171 - t172, costab16) << 1) - | 502 | SHIFT((((((((MUL(t171 - t172, costab16) * 2) - |
507 | t173) << 1) - t174) << 1) - t175) << 1) - t176); | 503 | t173) * 2) - t174) * 2) - t175) * 2) - t176); |
508 | 504 | ||
509 | /* | 505 | /* |
510 | * Totals: | 506 | * Totals: |
511 | * 80 multiplies | 507 | * 80 multiplies |
512 | * 80 additions | 508 | * 80 additions |
513 | * 119 subtractions | 509 | * 119 subtractions |
@@ -523,18 +519,20 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, | |||
523 | # if defined(OPT_SSO) | 519 | # if defined(OPT_SSO) |
524 | # if MAD_F_FRACBITS != 28 | 520 | # if MAD_F_FRACBITS != 28 |
525 | # error "MAD_F_FRACBITS must be 28 to use OPT_SSO" | 521 | # error "MAD_F_FRACBITS must be 28 to use OPT_SSO" |
526 | # endif | 522 | # endif |
527 | # define ML0(hi, lo, x, y)((lo) = (x) * (y)) | 523 | # define ML0(hi, lo, x, y)((lo) = (x) * (y)) |
528 | # 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)) | ||
529 | # define MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) | 526 | # define MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) |
530 | # define SHIFT(x) ((x) >> 2) | 527 | # define SHIFT(x) ((x) >> 2) |
531 | # define PRESHIFT(x) ((MAD_F(x) + (1L << 13)) >> 14) | 528 | # define PRESHIFT(x) ((MAD_F(x) + (1L << 13)) >> 14) |
532 | # else | 529 | # else |
533 | # 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)) |
534 | # 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)) | ||
535 | # define MLZ(hi, lo) MAD_F_MLZ((hi), (lo)) | 533 | # define MLZ(hi, lo) MAD_F_MLZ((hi), (lo)) |
536 | # define SHIFT(x) (x) | 534 | # define SHIFT(x) (x) |
537 | # if defined(MAD_F_SCALEBITS) | 535 | # if defined(MAD_F_SCALEBITS) |
538 | # undef MAD_F_SCALEBITS | 536 | # undef MAD_F_SCALEBITS |
539 | # define MAD_F_SCALEBITS(MAD_F_FRACBITS - 12) | 537 | # define MAD_F_SCALEBITS(MAD_F_FRACBITS - 12) |
540 | # define PRESHIFT(x) (MAD_F(x) >> 12) | 538 | # define PRESHIFT(x) (MAD_F(x) >> 12) |
@@ -586,84 +584,86 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, | |||
586 | fe = &(*filter)[0][ phase & 1][0]; | 584 | fe = &(*filter)[0][ phase & 1][0]; |
587 | fx = &(*filter)[0][~phase & 1][0]; | 585 | fx = &(*filter)[0][~phase & 1][0]; |
588 | fo = &(*filter)[1][~phase & 1][0]; | 586 | fo = &(*filter)[1][~phase & 1][0]; |
589 | 587 | ||
590 | Dptr = &D[0]; | 588 | Dptr = &D[0]; |
591 | 589 | ||
590 | ptr = *Dptr + po; | ||
591 | ML0(hi, lo, (*fx)[0], ptr[ 0]); | ||
592 | MLA(hi, lo, (*fx)[1], ptr[14]); | ||
593 | MLA(hi, lo, (*fx)[2], ptr[12]); | ||
594 | MLA(hi, lo, (*fx)[3], ptr[10]); | ||
595 | MLA(hi, lo, (*fx)[4], ptr[ 8]); | ||
596 | MLA(hi, lo, (*fx)[5], ptr[ 6]); | ||
597 | MLA(hi, lo, (*fx)[6], ptr[ 4]); | ||
598 | MLA(hi, lo, (*fx)[7], ptr[ 2]); | ||
599 | MLN(hi, lo); | ||
600 | |||
592 | ptr = *Dptr + pe; | 601 | ptr = *Dptr + pe; |
593 | ML0(hi, lo, (*fe)[0], ptr[ 0]); | 602 | MLA(hi, lo, (*fe)[0], ptr[ 0]); |
594 | MLA(hi, lo, (*fe)[1], ptr[14]); | 603 | MLA(hi, lo, (*fe)[1], ptr[14]); |
595 | MLA(hi, lo, (*fe)[2], ptr[12]); | 604 | MLA(hi, lo, (*fe)[2], ptr[12]); |
596 | MLA(hi, lo, (*fe)[3], ptr[10]); | 605 | MLA(hi, lo, (*fe)[3], ptr[10]); |
597 | MLA(hi, lo, (*fe)[4], ptr[ 8]); | 606 | MLA(hi, lo, (*fe)[4], ptr[ 8]); |
598 | MLA(hi, lo, (*fe)[5], ptr[ 6]); | 607 | MLA(hi, lo, (*fe)[5], ptr[ 6]); |
599 | MLA(hi, lo, (*fe)[6], ptr[ 4]); | 608 | MLA(hi, lo, (*fe)[6], ptr[ 4]); |
600 | MLA(hi, lo, (*fe)[7], ptr[ 2]); | 609 | MLA(hi, lo, (*fe)[7], ptr[ 2]); |
601 | 610 | ||
602 | ptr = *Dptr + po; | ||
603 | MLA(hi, lo, (*fx)[0], -ptr[ 0]); | ||
604 | MLA(hi, lo, (*fx)[1], -ptr[14]); | ||
605 | MLA(hi, lo, (*fx)[2], -ptr[12]); | ||
606 | MLA(hi, lo, (*fx)[3], -ptr[10]); | ||
607 | MLA(hi, lo, (*fx)[4], -ptr[ 8]); | ||
608 | MLA(hi, lo, (*fx)[5], -ptr[ 6]); | ||
609 | MLA(hi, lo, (*fx)[6], -ptr[ 4]); | ||
610 | MLA(hi, lo, (*fx)[7], -ptr[ 2]); | ||
611 | |||
612 | *pcm1++ = SHIFT(MLZ(hi, lo)); | 611 | *pcm1++ = SHIFT(MLZ(hi, lo)); |
613 | 612 | ||
614 | pcm2 = pcm1 + 30; | 613 | pcm2 = pcm1 + 30; |
615 | 614 | ||
616 | for (sb = 1; sb < 16; ++sb) { | 615 | for (sb = 1; sb < 16; ++sb) { |
617 | ++fe; | 616 | ++fe; |
618 | ++Dptr; | 617 | ++Dptr; |
619 | 618 | ||
620 | /* D[32 - sb][i] == -D[sb][31 - i] */ | 619 | /* D[32 - sb][i] == -D[sb][31 - i] */ |
621 | 620 | ||
621 | ptr = *Dptr + po; | ||
622 | ML0(hi, lo, (*fo)[0], ptr[ 0]); | ||
623 | MLA(hi, lo, (*fo)[1], ptr[14]); | ||
624 | MLA(hi, lo, (*fo)[2], ptr[12]); | ||
625 | MLA(hi, lo, (*fo)[3], ptr[10]); | ||
626 | MLA(hi, lo, (*fo)[4], ptr[ 8]); | ||
627 | MLA(hi, lo, (*fo)[5], ptr[ 6]); | ||
628 | MLA(hi, lo, (*fo)[6], ptr[ 4]); | ||
629 | MLA(hi, lo, (*fo)[7], ptr[ 2]); | ||
630 | MLN(hi, lo); | ||
631 | |||
622 | ptr = *Dptr + pe; | 632 | ptr = *Dptr + pe; |
623 | ML0(hi, lo, (*fe)[7], ptr[ 2]); | 633 | MLA(hi, lo, (*fe)[7], ptr[ 2]); |
624 | MLA(hi, lo, (*fe)[6], ptr[ 4]); | 634 | MLA(hi, lo, (*fe)[6], ptr[ 4]); |
625 | MLA(hi, lo, (*fe)[5], ptr[ 6]); | 635 | MLA(hi, lo, (*fe)[5], ptr[ 6]); |
626 | MLA(hi, lo, (*fe)[4], ptr[ 8]); | 636 | MLA(hi, lo, (*fe)[4], ptr[ 8]); |
627 | MLA(hi, lo, (*fe)[3], ptr[10]); | 637 | MLA(hi, lo, (*fe)[3], ptr[10]); |
628 | MLA(hi, lo, (*fe)[2], ptr[12]); | 638 | MLA(hi, lo, (*fe)[2], ptr[12]); |
629 | MLA(hi, lo, (*fe)[1], ptr[14]); | 639 | MLA(hi, lo, (*fe)[1], ptr[14]); |
630 | MLA(hi, lo, (*fe)[0], ptr[ 0]); | 640 | MLA(hi, lo, (*fe)[0], ptr[ 0]); |
631 | 641 | ||
632 | ptr = *Dptr + po; | ||
633 | MLA(hi, lo, (*fo)[0], -ptr[ 0]); | ||
634 | MLA(hi, lo, (*fo)[1], -ptr[14]); | ||
635 | MLA(hi, lo, (*fo)[2], -ptr[12]); | ||
636 | MLA(hi, lo, (*fo)[3], -ptr[10]); | ||
637 | MLA(hi, lo, (*fo)[4], -ptr[ 8]); | ||
638 | MLA(hi, lo, (*fo)[5], -ptr[ 6]); | ||
639 | MLA(hi, lo, (*fo)[6], -ptr[ 4]); | ||
640 | MLA(hi, lo, (*fo)[7], -ptr[ 2]); | ||
641 | |||
642 | *pcm1++ = SHIFT(MLZ(hi, lo)); | 642 | *pcm1++ = SHIFT(MLZ(hi, lo)); |
643 | 643 | ||
644 | ptr = *Dptr - po; | ||
645 | ML0(hi, lo, (*fo)[7], ptr[31 - 2]); | ||
646 | MLA(hi, lo, (*fo)[6], ptr[31 - 4]); | ||
647 | MLA(hi, lo, (*fo)[5], ptr[31 - 6]); | ||
648 | MLA(hi, lo, (*fo)[4], ptr[31 - 8]); | ||
649 | MLA(hi, lo, (*fo)[3], ptr[31 - 10]); | ||
650 | MLA(hi, lo, (*fo)[2], ptr[31 - 12]); | ||
651 | MLA(hi, lo, (*fo)[1], ptr[31 - 14]); | ||
652 | MLA(hi, lo, (*fo)[0], ptr[31 - 16]); | ||
653 | |||
654 | ptr = *Dptr - pe; | 644 | ptr = *Dptr - pe; |
655 | MLA(hi, lo, (*fe)[0], ptr[31 - 16]); | 645 | ML0(hi, lo, (*fe)[0], ptr[31 - 16]); |
656 | MLA(hi, lo, (*fe)[1], ptr[31 - 14]); | 646 | MLA(hi, lo, (*fe)[1], ptr[31 - 14]); |
657 | MLA(hi, lo, (*fe)[2], ptr[31 - 12]); | 647 | MLA(hi, lo, (*fe)[2], ptr[31 - 12]); |
658 | MLA(hi, lo, (*fe)[3], ptr[31 - 10]); | 648 | MLA(hi, lo, (*fe)[3], ptr[31 - 10]); |
659 | MLA(hi, lo, (*fe)[4], ptr[31 - 8]); | 649 | MLA(hi, lo, (*fe)[4], ptr[31 - 8]); |
660 | MLA(hi, lo, (*fe)[5], ptr[31 - 6]); | 650 | MLA(hi, lo, (*fe)[5], ptr[31 - 6]); |
661 | MLA(hi, lo, (*fe)[6], ptr[31 - 4]); | 651 | MLA(hi, lo, (*fe)[6], ptr[31 - 4]); |
662 | MLA(hi, lo, (*fe)[7], ptr[31 - 2]); | 652 | MLA(hi, lo, (*fe)[7], ptr[31 - 2]); |
663 | 653 | ||
654 | ptr = *Dptr - po; | ||
655 | MLA(hi, lo, (*fo)[7], ptr[31 - 2]); | ||
656 | MLA(hi, lo, (*fo)[6], ptr[31 - 4]); | ||
657 | MLA(hi, lo, (*fo)[5], ptr[31 - 6]); | ||
658 | MLA(hi, lo, (*fo)[4], ptr[31 - 8]); | ||
659 | MLA(hi, lo, (*fo)[3], ptr[31 - 10]); | ||
660 | MLA(hi, lo, (*fo)[2], ptr[31 - 12]); | ||
661 | MLA(hi, lo, (*fo)[1], ptr[31 - 14]); | ||
662 | MLA(hi, lo, (*fo)[0], ptr[31 - 16]); | ||
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; |
@@ -721,63 +721,65 @@ void synth_half(struct mad_synth *synth, struct mad_frame const *frame, | |||
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; | ||
728 | ML0(hi, lo, (*fx)[0], ptr[ 0]); | ||
729 | MLA(hi, lo, (*fx)[1], ptr[14]); | ||
730 | MLA(hi, lo, (*fx)[2], ptr[12]); | ||
731 | MLA(hi, lo, (*fx)[3], ptr[10]); | ||
732 | MLA(hi, lo, (*fx)[4], ptr[ 8]); | ||
733 | MLA(hi, lo, (*fx)[5], ptr[ 6]); | ||
734 | MLA(hi, lo, (*fx)[6], ptr[ 4]); | ||
735 | MLA(hi, lo, (*fx)[7], ptr[ 2]); | ||
736 | MLN(hi, lo); | ||
737 | |||
727 | ptr = *Dptr + pe; | 738 | ptr = *Dptr + pe; |
728 | ML0(hi, lo, (*fe)[0], ptr[ 0]); | 739 | MLA(hi, lo, (*fe)[0], ptr[ 0]); |
729 | MLA(hi, lo, (*fe)[1], ptr[14]); | 740 | MLA(hi, lo, (*fe)[1], ptr[14]); |
730 | MLA(hi, lo, (*fe)[2], ptr[12]); | 741 | MLA(hi, lo, (*fe)[2], ptr[12]); |
731 | MLA(hi, lo, (*fe)[3], ptr[10]); | 742 | MLA(hi, lo, (*fe)[3], ptr[10]); |
732 | MLA(hi, lo, (*fe)[4], ptr[ 8]); | 743 | MLA(hi, lo, (*fe)[4], ptr[ 8]); |
733 | MLA(hi, lo, (*fe)[5], ptr[ 6]); | 744 | MLA(hi, lo, (*fe)[5], ptr[ 6]); |
734 | MLA(hi, lo, (*fe)[6], ptr[ 4]); | 745 | MLA(hi, lo, (*fe)[6], ptr[ 4]); |
735 | MLA(hi, lo, (*fe)[7], ptr[ 2]); | 746 | MLA(hi, lo, (*fe)[7], ptr[ 2]); |
736 | 747 | ||
737 | ptr = *Dptr + po; | ||
738 | MLA(hi, lo, (*fx)[0], -ptr[ 0]); | ||
739 | MLA(hi, lo, (*fx)[1], -ptr[14]); | ||
740 | MLA(hi, lo, (*fx)[2], -ptr[12]); | ||
741 | MLA(hi, lo, (*fx)[3], -ptr[10]); | ||
742 | MLA(hi, lo, (*fx)[4], -ptr[ 8]); | ||
743 | MLA(hi, lo, (*fx)[5], -ptr[ 6]); | ||
744 | MLA(hi, lo, (*fx)[6], -ptr[ 4]); | ||
745 | MLA(hi, lo, (*fx)[7], -ptr[ 2]); | ||
746 | |||
747 | *pcm1++ = SHIFT(MLZ(hi, lo)); | 748 | *pcm1++ = SHIFT(MLZ(hi, lo)); |
748 | 749 | ||
749 | pcm2 = pcm1 + 14; | 750 | pcm2 = pcm1 + 14; |
750 | 751 | ||
751 | for (sb = 1; sb < 16; ++sb) { | 752 | for (sb = 1; sb < 16; ++sb) { |
752 | ++fe; | 753 | ++fe; |
753 | ++Dptr; | 754 | ++Dptr; |
754 | 755 | ||
755 | /* D[32 - sb][i] == -D[sb][31 - i] */ | 756 | /* D[32 - sb][i] == -D[sb][31 - i] */ |
756 | 757 | ||
757 | if (!(sb & 1)) { | 758 | if (!(sb & 1)) { |
759 | ptr = *Dptr + po; | ||
760 | ML0(hi, lo, (*fo)[0], ptr[ 0]); | ||
761 | MLA(hi, lo, (*fo)[1], ptr[14]); | ||
762 | MLA(hi, lo, (*fo)[2], ptr[12]); | ||
763 | MLA(hi, lo, (*fo)[3], ptr[10]); | ||
764 | MLA(hi, lo, (*fo)[4], ptr[ 8]); | ||
765 | MLA(hi, lo, (*fo)[5], ptr[ 6]); | ||
766 | MLA(hi, lo, (*fo)[6], ptr[ 4]); | ||
767 | MLA(hi, lo, (*fo)[7], ptr[ 2]); | ||
768 | MLN(hi, lo); | ||
769 | |||
758 | ptr = *Dptr + pe; | 770 | ptr = *Dptr + pe; |
759 | ML0(hi, lo, (*fe)[7], ptr[ 2]); | 771 | MLA(hi, lo, (*fe)[7], ptr[ 2]); |
760 | MLA(hi, lo, (*fe)[6], ptr[ 4]); | 772 | MLA(hi, lo, (*fe)[6], ptr[ 4]); |
761 | MLA(hi, lo, (*fe)[5], ptr[ 6]); | 773 | MLA(hi, lo, (*fe)[5], ptr[ 6]); |
762 | MLA(hi, lo, (*fe)[4], ptr[ 8]); | 774 | MLA(hi, lo, (*fe)[4], ptr[ 8]); |
763 | MLA(hi, lo, (*fe)[3], ptr[10]); | 775 | MLA(hi, lo, (*fe)[3], ptr[10]); |
764 | MLA(hi, lo, (*fe)[2], ptr[12]); | 776 | MLA(hi, lo, (*fe)[2], ptr[12]); |
765 | MLA(hi, lo, (*fe)[1], ptr[14]); | 777 | MLA(hi, lo, (*fe)[1], ptr[14]); |
766 | MLA(hi, lo, (*fe)[0], ptr[ 0]); | 778 | MLA(hi, lo, (*fe)[0], ptr[ 0]); |
767 | 779 | ||
768 | ptr = *Dptr + po; | ||
769 | MLA(hi, lo, (*fo)[0], -ptr[ 0]); | ||
770 | MLA(hi, lo, (*fo)[1], -ptr[14]); | ||
771 | MLA(hi, lo, (*fo)[2], -ptr[12]); | ||
772 | MLA(hi, lo, (*fo)[3], -ptr[10]); | ||
773 | MLA(hi, lo, (*fo)[4], -ptr[ 8]); | ||
774 | MLA(hi, lo, (*fo)[5], -ptr[ 6]); | ||
775 | MLA(hi, lo, (*fo)[6], -ptr[ 4]); | ||
776 | MLA(hi, lo, (*fo)[7], -ptr[ 2]); | ||
777 | |||
778 | *pcm1++ = SHIFT(MLZ(hi, lo)); | 780 | *pcm1++ = SHIFT(MLZ(hi, lo)); |
779 | 781 | ||
780 | ptr = *Dptr - po; | 782 | ptr = *Dptr - po; |
781 | ML0(hi, lo, (*fo)[7], ptr[31 - 2]); | 783 | ML0(hi, lo, (*fo)[7], ptr[31 - 2]); |
782 | MLA(hi, lo, (*fo)[6], ptr[31 - 4]); | 784 | MLA(hi, lo, (*fo)[6], ptr[31 - 4]); |
783 | MLA(hi, lo, (*fo)[5], ptr[31 - 6]); | 785 | MLA(hi, lo, (*fo)[5], ptr[31 - 6]); |