author | llornkcor <llornkcor> | 2005-11-08 23:16:03 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2005-11-08 23:16:03 (UTC) |
commit | 6bd52d3658f01c966d690b12235592a5473a4d57 (patch) (unidiff) | |
tree | 76e25003b738fde6ebbea5d338b7cf76b82f47fa /core | |
parent | a8063e0797d6edf2ead22fc8c5346ddf187f0b5d (diff) | |
download | opie-6bd52d3658f01c966d690b12235592a5473a4d57.zip opie-6bd52d3658f01c966d690b12235592a5473a4d57.tar.gz opie-6bd52d3658f01c966d690b12235592a5473a4d57.tar.bz2 |
update libmad and add 64bit define
33 files changed, 740 insertions, 283 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,15 +1,15 @@ | |||
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 |
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,15 +1,15 @@ | |||
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 |
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,15 +1,15 @@ | |||
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 |
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,15 +1,15 @@ | |||
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 |
@@ -43,24 +43,28 @@ | |||
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 *, |
@@ -513,24 +517,28 @@ int run_async(struct mad_decoder *decoder) | |||
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) |
@@ -545,24 +553,28 @@ int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode) | |||
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; |
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,15 +1,15 @@ | |||
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 |
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,15 +1,15 @@ | |||
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 |
@@ -26,12 +26,56 @@ | |||
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,15 +1,15 @@ | |||
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 |
@@ -199,54 +199,65 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
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"); \ |
@@ -266,25 +277,25 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t 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 | ||
@@ -334,76 +345,87 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
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 | ||
371 | # if defined(OPT_ACCURACY) | ||
372 | /* | ||
373 | * This gives best accuracy but is not very fast. | ||
374 | */ | ||
357 | # define MAD_F_MLA(hi, lo, x, y) \ | 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" \ |
404 | : "=r" (__result) \ | ||
405 | : "%r" (__result), "r" (__round)); \ | ||
386 | __result; \ | 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)); \ |
414 | asm ("insrwi %0,%1,%2,0" \ | ||
415 | : "+r" (__result) \ | ||
416 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ | ||
395 | __result; \ | 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 | * |
@@ -419,26 +441,26 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
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 | ||
@@ -460,17 +482,18 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
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,15 +1,15 @@ | |||
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 |
@@ -201,28 +201,35 @@ int decode_header(struct mad_header *header, struct mad_stream *stream) | |||
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() |
@@ -274,28 +281,24 @@ int free_bitrate(struct mad_stream *stream, struct mad_header const *header) | |||
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 | ||
@@ -364,25 +367,26 @@ int mad_header_decode(struct mad_header *header, struct mad_stream *stream) | |||
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; |
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,15 +1,15 @@ | |||
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 |
@@ -33,25 +33,26 @@ enum mad_layer { | |||
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 */ |
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,15 +1,15 @@ | |||
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 |
@@ -25,32 +25,38 @@ | |||
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 } } |
43 | # if defined(WORDS_BIGENDIAN) | ||
44 | # define V(v, w, x, y, hlen){ { 1, hlen, (v << 11) | (w << 10) | \ | ||
45 | (x << 9) | (y << 8) } } | ||
46 | # else | ||
42 | # define V(v, w, x, y, hlen){ { 1, hlen, (v << 0) | (w << 1) | \ | 47 | # define V(v, w, x, y, hlen){ { 1, hlen, (v << 0) | (w << 1) | \ |
43 | (x << 2) | (y << 3) } } | 48 | (x << 2) | (y << 3) } } |
44 | # endif | 49 | # 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), |
@@ -97,31 +103,36 @@ union huffquad const hufftabB[] = { | |||
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 } } |
121 | # if defined(WORDS_BIGENDIAN) | ||
122 | # define V(x, y, hlen){ { 1, hlen, (x << 8) | (y << 4) } } | ||
123 | # else | ||
114 | # define V(x, y, hlen) { { 1, hlen, (x << 0) | (y << 4) } } | 124 | # define V(x, y, hlen) { { 1, hlen, (x << 0) | (y << 4) } } |
115 | # endif | 125 | # 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), |
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,15 +1,15 @@ | |||
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 |
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,15 +1,15 @@ | |||
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 |
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,15 +1,15 @@ | |||
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 |
@@ -33,25 +33,25 @@ | |||
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 */ |
@@ -154,28 +154,35 @@ int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) | |||
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), |
@@ -325,38 +332,62 @@ 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: | ||
340 | case 48000: | ||
341 | index = (header->samplerate == 32000) ? 3 : 2; | ||
342 | break; | ||
343 | 348 | ||
344 | case 56000: | 349 | bitrate_per_channel = header->bitrate; |
345 | case 64000: | 350 | if (nch == 2) { |
346 | case 80000: | 351 | bitrate_per_channel /= 2; |
347 | index = 0; | ||
348 | break; | ||
349 | 352 | ||
350 | default: | 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 | } | ||
375 | |||
376 | if (bitrate_per_channel <= 48000) | ||
377 | index = (header->samplerate == 32000) ? 3 : 2; | ||
378 | else if (bitrate_per_channel <= 80000) | ||
379 | index = 0; | ||
380 | else { | ||
381 | freeformat: | ||
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 | } |
@@ -422,30 +453,37 @@ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) | |||
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 | ||
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,15 +1,15 @@ | |||
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 |
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,15 +1,15 @@ | |||
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 |
@@ -279,26 +279,26 @@ unsigned char const sfb_8000_long[] = { | |||
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; |
@@ -1566,24 +1566,211 @@ void III_aliasreduce(mad_fixed_t xr[576], int lines) | |||
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 | ||
@@ -1856,24 +2043,25 @@ void imdct36(mad_fixed_t const X[18], mad_fixed_t x[36]) | |||
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 */ |
@@ -1920,35 +2108,43 @@ void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36], | |||
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 | { |
@@ -2033,49 +2229,49 @@ 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) |
@@ -2445,30 +2641,30 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) | |||
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) { |
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,15 +1,15 @@ | |||
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 |
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 \ |
37 | ../../../../i18n/pt_BR/libmadplugin.ts \ | ||
38 | ../../../../i18n/sl/libmadplugin.ts \ | ||
39 | ../../../../i18n/zh_CN/libmadplugin.ts \ | ||
40 | ../../../../i18n/zh_TW/libmadplugin.ts | ||
27 | 41 | ||
28 | system(echo $QMAKESPEC | grep -s mipsel) { | ||
29 | DEFINES -= FPM_INTEL | ||
30 | DEFINES += FPM_MIPS | ||
31 | } | ||
32 | |||
33 | system(echo $QMAKESPEC | grep -s ramses) { | ||
34 | DEFINES -= FPM_INTEL | ||
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 | 42 | ||
53 | 43 | ||
44 | include ( $(OPIEDIR)/include.pro ) | ||
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,15 +1,15 @@ | |||
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 |
@@ -30,25 +30,25 @@ | |||
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) |
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 | |||
@@ -10,65 +10,60 @@ | |||
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 | ||
@@ -378,120 +373,120 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
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; |
@@ -501,39 +496,39 @@ bool LibMadPlugin::open( const QString& path ) { | |||
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 ); |
@@ -541,71 +536,72 @@ bool LibMadPlugin::isOpen() { | |||
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 | ||
@@ -675,25 +671,25 @@ bool LibMadPlugin::read() { | |||
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); |
@@ -753,25 +749,25 @@ bool LibMadPlugin::decode( short *output, long samples, long& samplesMade ) { | |||
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 | ||
@@ -816,58 +812,58 @@ bool LibMadPlugin::audioReadSamples( short *output, int /*channels*/, long sampl | |||
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 | |||
@@ -47,26 +47,24 @@ MediaPlayerEncoder *LibMadPluginImpl::encoder() | |||
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,84 +1,105 @@ | |||
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 | * |
@@ -121,46 +142,80 @@ typedef unsigned long mad_fixed64lo_t; | |||
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 | /* |
@@ -189,53 +244,65 @@ typedef unsigned long mad_fixed64lo_t; | |||
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 | }) |
256 | # elif defined(OPT_INTEL) | ||
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 | }) | ||
201 | # else | 271 | # else |
202 | # define mad_f_scale64(hi, lo) \ | 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"); \ |
@@ -244,29 +311,36 @@ typedef unsigned long mad_fixed64lo_t; | |||
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 | ||
@@ -316,148 +390,169 @@ typedef unsigned long mad_fixed64lo_t; | |||
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 | ||
416 | # if defined(OPT_ACCURACY) | ||
417 | /* | ||
418 | * This gives best accuracy but is not very fast. | ||
419 | */ | ||
339 | # define MAD_F_MLA(hi, lo, x, y) \ | 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" \ |
449 | : "=r" (__result) \ | ||
450 | : "%r" (__result), "r" (__round)); \ | ||
368 | __result; \ | 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)); \ |
459 | asm ("insrwi %0,%1,%2,0" \ | ||
460 | : "+r" (__result) \ | ||
461 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ | ||
377 | __result; \ | 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 | */ |
481 | # if defined(OPT_SPEED) | ||
482 | # define mad_f_mul(x, y)(((x) >> 12) * ((y) >> 16)) | ||
483 | # else | ||
396 | # define mad_f_mul(x, y)((((x) + (1L << 11)) >> 12) * \ | 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 | ||
@@ -468,25 +563,25 @@ unsigned int mad_bit_length(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 |
@@ -530,67 +625,71 @@ enum mad_units { | |||
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) |
@@ -611,87 +710,94 @@ struct mad_stream { | |||
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 { | ||
669 | struct mad_header { | 772 | struct mad_header { |
670 | enum mad_layer layer; /* audio layer (1, 2, or 3) */ | 773 | enum mad_layer layer; /* audio layer (1, 2, or 3) */ |
671 | enum mad_mode mode; /* channel mode (see above) */ | 774 | enum mad_mode mode; /* channel mode (see above) */ |
672 | int mode_extension; /* additional mode info */ | 775 | int mode_extension; /* additional mode info */ |
673 | enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ | 776 | enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ |
674 | 777 | ||
675 | unsigned long bitrate; /* stream bitrate (bps) */ | 778 | unsigned long bitrate; /* stream bitrate (bps) */ |
676 | unsigned int samplerate; /* sampling frequency (Hz) */ | 779 | unsigned int samplerate; /* sampling frequency (Hz) */ |
677 | 780 | ||
678 | unsigned short crc_check; /* frame CRC accumulator */ | 781 | unsigned short crc_check; /* frame CRC accumulator */ |
679 | unsigned short crc_target; /* final target CRC checksum */ | 782 | unsigned short crc_target; /* final target CRC checksum */ |
680 | 783 | ||
681 | int flags; /* flags (see below) */ | 784 | int flags; /* flags (see below) */ |
682 | int private_bits; /* private bits (see below) */ | 785 | int private_bits; /* private bits (see below) */ |
683 | 786 | ||
684 | mad_timer_t duration; /* audio playing time of frame */ | 787 | mad_timer_t duration; /* audio playing time of frame */ |
685 | } header; | 788 | }; |
789 | |||
790 | struct mad_frame { | ||
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)) |
@@ -725,106 +831,134 @@ void mad_header_init(struct mad_header *); | |||
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,15 +1,15 @@ | |||
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 |
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,15 +1,15 @@ | |||
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 |
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,15 +1,15 @@ | |||
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 |
@@ -17,24 +17,29 @@ | |||
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 */ |
@@ -88,13 +93,14 @@ | |||
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,15 +1,15 @@ | |||
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 |
@@ -136,24 +136,25 @@ char const *mad_stream_errorstr(struct mad_stream const *stream) | |||
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; |
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,15 +1,15 @@ | |||
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 |
@@ -35,24 +35,25 @@ enum mad_error { | |||
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) |
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,15 +1,15 @@ | |||
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 |
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,15 +1,15 @@ | |||
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 |
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,15 +1,15 @@ | |||
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 |
@@ -69,25 +69,25 @@ void mad_timer_negate(mad_timer_t *timer) | |||
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 | { |
@@ -318,25 +318,26 @@ signed long mad_timer_count(mad_timer_t timer, enum mad_units units) | |||
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 |
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,15 +1,15 @@ | |||
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 |
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,15 +1,15 @@ | |||
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 |
@@ -23,24 +23,34 @@ | |||
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 " |
@@ -69,23 +79,13 @@ char const mad_build[] = "" | |||
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 | ; |