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 | |
parent | a8063e0797d6edf2ead22fc8c5346ddf187f0b5d (diff) | |
download | opie-6bd52d3658f01c966d690b12235592a5473a4d57.zip opie-6bd52d3658f01c966d690b12235592a5473a4d57.tar.gz opie-6bd52d3658f01c966d690b12235592a5473a4d57.tar.bz2 |
update libmad and add 64bit define
33 files changed, 799 insertions, 342 deletions
diff --git a/core/multimedia/opieplayer/libmad/D.dat b/core/multimedia/opieplayer/libmad/D.dat index c3ee74c..89b01da 100644 --- a/core/multimedia/opieplayer/libmad/D.dat +++ b/core/multimedia/opieplayer/libmad/D.dat | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
@@ -54,2 +54,6 @@ | |||
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, |
@@ -524,2 +528,6 @@ int run_async(struct mad_decoder *decoder) | |||
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) |
@@ -556,2 +564,6 @@ int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode) | |||
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, |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
@@ -37 +37,45 @@ mad_fixed_t mad_f_abs(mad_fixed_t 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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
@@ -210,2 +210,17 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
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 |
@@ -234,8 +249,4 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
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 | */ |
@@ -277,3 +288,3 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
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), \ |
@@ -345,14 +356,21 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
345 | /* | 356 | /* |
346 | * This PowerPC version is tuned for the 4xx embedded processors. It is | 357 | * This PowerPC version is fast and accurate; the disposition of the least |
347 | * effectively a tuned version of FPM_64BIT. It is a little faster and just | 358 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). |
348 | * as accurate. The disposition of the least significant bit depends on | ||
349 | * OPT_ACCURACY via mad_f_scale64(). | ||
350 | */ | 359 | */ |
351 | # define MAD_F_MLX(hi, lo, x, y) \ | 360 | # define MAD_F_MLX(hi, lo, x, y) \ |
352 | asm ("mulhw %1, %2, %3\n\t" \ | 361 | do { \ |
353 | "mullw %0, %2, %3" \ | 362 | asm ("mullw %0,%1,%2" \ |
354 | : "=&r" (lo), "=&r" (hi) \ | 363 | : "=r" (lo) \ |
355 | : "%r" (x), "r" (y)) | 364 | : "%r" (x), "r" (y)); \ |
365 | asm ("mulhw %0,%1,%2" \ | ||
366 | : "=r" (hi) \ | ||
367 | : "%r" (x), "r" (y)); \ | ||
368 | } \ | ||
369 | while (0) | ||
356 | 370 | ||
357 | # define MAD_F_MLA(hi, lo, x, y) \ | 371 | # if defined(OPT_ACCURACY) |
372 | /* | ||
373 | * This gives best accuracy but is not very fast. | ||
374 | */ | ||
375 | # define MAD_F_MLA(hi, lo, x, y) \ | ||
358 | ({ mad_fixed64hi_t __hi; \ | 376 | ({ mad_fixed64hi_t __hi; \ |
@@ -360,7 +378,10 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
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 | ||
@@ -368,20 +389,19 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
368 | /* | 389 | /* |
369 | * This is accurate and ~2 - 2.5 times slower than the unrounded version. | 390 | * This is slower than the truncating version below it. |
370 | * | ||
371 | * The __volatile__ improves the generated code by another 5% (fewer spills | ||
372 | * to memory); eventually they should be removed. | ||
373 | */ | 391 | */ |
374 | # define mad_f_scale64(hi, lo) \ | 392 | # define mad_f_scale64(hi, lo) \ |
375 | ({ mad_fixed_t __result; \ | 393 | ({ mad_fixed_t __result, __round; \ |
376 | mad_fixed64hi_t __hi_; \ | 394 | asm ("rotrwi %0,%1,%2" \ |
377 | mad_fixed64lo_t __lo_; \ | 395 | : "=r" (__result) \ |
378 | asm __volatile__ ("addc %0, %2, %4\n\t" \ | 396 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ |
379 | "addze %1, %3" \ | 397 | asm ("extrwi %0,%1,1,0" \ |
380 | : "=r" (__lo_), "=r" (__hi_) \ | 398 | : "=r" (__round) \ |
381 | : "r" (lo), "r" (hi), "r" (1 << (MAD_F_SCALEBITS - 1))); \ | 399 | : "r" (__result)); \ |
382 | asm __volatile__ ("rlwinm %0, %2,32-%3,0,%3-1\n\t" \ | 400 | asm ("insrwi %0,%1,%2,0" \ |
383 | "rlwimi %0, %1,32-%3,%3,31" \ | 401 | : "+r" (__result) \ |
384 | : "=&r" (__result) \ | 402 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ |
385 | : "r" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS)); \ | 403 | asm ("add %0,%1,%2" \ |
386 | __result; \ | 404 | : "=r" (__result) \ |
405 | : "%r" (__result), "r" (__round)); \ | ||
406 | __result; \ | ||
387 | }) | 407 | }) |
@@ -390,9 +410,11 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
390 | ({ mad_fixed_t __result; \ | 410 | ({ mad_fixed_t __result; \ |
391 | asm ("rlwinm %0, %2,32-%3,0,%3-1\n\t" \ | 411 | asm ("rotrwi %0,%1,%2" \ |
392 | "rlwimi %0, %1,32-%3,%3,31" \ | ||
393 | : "=r" (__result) \ | 412 | : "=r" (__result) \ |
394 | : "r" (lo), "r" (hi), "I" (MAD_F_SCALEBITS)); \ | 413 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ |
395 | __result; \ | 414 | asm ("insrwi %0,%1,%2,0" \ |
415 | : "+r" (__result) \ | ||
416 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ | ||
417 | __result; \ | ||
396 | }) | 418 | }) |
397 | # endif /* OPT_ACCURACY */ | 419 | # endif |
398 | 420 | ||
@@ -430,4 +452,4 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
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)); \ |
@@ -471,5 +493,6 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
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 | ||
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
@@ -212,3 +212,9 @@ int decode_header(struct mad_header *header, struct mad_stream *stream) | |||
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; |
@@ -216,2 +222,3 @@ int decode_header(struct mad_header *header, struct mad_stream *stream) | |||
216 | } | 222 | } |
223 | # endif | ||
217 | 224 | ||
@@ -285,6 +292,2 @@ int free_bitrate(struct mad_stream *stream, struct mad_header const *header) | |||
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; |
@@ -375,3 +378,4 @@ int mad_header_decode(struct mad_header *header, struct mad_stream *stream) | |||
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) |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
@@ -44,3 +44,4 @@ enum mad_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 | }; |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
@@ -36,9 +36,15 @@ | |||
36 | 36 | ||
37 | # if defined(__GNUC__) | 37 | # if defined(__GNUC__) || \ |
38 | # define PTR(offs, bits){ ptr: { 0, bits, offs } } | 38 | (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901) |
39 | # define V(v, w, x, y, hlen){ value: { 1, hlen, v, w, x, y } } | 39 | # define PTR(offs, bits){ .ptr = { 0, bits, offs } } |
40 | # define V(v, w, x, y, hlen){ .value = { 1, hlen, v, w, x, y } } | ||
40 | # else | 41 | # else |
41 | # define PTR(offs, bits){ { 0, bits, offs } } | 42 | # define PTR(offs, bits){ { 0, bits, offs } } |
42 | # define V(v, w, x, y, hlen){ { 1, hlen, (v << 0) | (w << 1) | \ | 43 | # if defined(WORDS_BIGENDIAN) |
43 | (x << 2) | (y << 3) } } | 44 | # define V(v, w, x, y, hlen){ { 1, hlen, (v << 11) | (w << 10) | \ |
45 | (x << 9) | (y << 8) } } | ||
46 | # else | ||
47 | # define V(v, w, x, y, hlen){ { 1, hlen, (v << 0) | (w << 1) | \ | ||
48 | (x << 2) | (y << 3) } } | ||
49 | # endif | ||
44 | # endif | 50 | # endif |
@@ -108,8 +114,13 @@ union huffquad const hufftabB[] = { | |||
108 | 114 | ||
109 | # if defined(__GNUC__) | 115 | # if defined(__GNUC__) || \ |
110 | # define PTR(offs, bits){ ptr: { 0, bits, offs } } | 116 | (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901) |
111 | # define V(x, y, hlen) { value: { 1, hlen, x, y } } | 117 | # define PTR(offs, bits){ .ptr = { 0, bits, offs } } |
118 | # define V(x, y, hlen) { .value = { 1, hlen, x, y } } | ||
112 | # else | 119 | # else |
113 | # define PTR(offs, bits){ { 0, bits, offs } } | 120 | # define PTR(offs, bits){ { 0, bits, offs } } |
114 | # define V(x, y, hlen) { { 1, hlen, (x << 0) | (y << 4) } } | 121 | # if defined(WORDS_BIGENDIAN) |
122 | # define V(x, y, hlen){ { 1, hlen, (x << 8) | (y << 4) } } | ||
123 | # else | ||
124 | # define V(x, y, hlen){ { 1, hlen, (x << 0) | (y << 4) } } | ||
125 | # endif | ||
115 | # endif | 126 | # endif |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
@@ -44,3 +44,3 @@ | |||
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" |
@@ -165,2 +165,8 @@ int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) | |||
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) { |
@@ -169,2 +175,3 @@ int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) | |||
169 | } | 175 | } |
176 | # endif | ||
170 | } | 177 | } |
@@ -336,16 +343,40 @@ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) | |||
336 | index = 4; | 343 | index = 4; |
344 | else if (header->flags & MAD_FLAG_FREEFORMAT) | ||
345 | goto freeformat; | ||
337 | else { | 346 | else { |
338 | switch (nch == 2 ? header->bitrate / 2 : header->bitrate) { | 347 | unsigned long bitrate_per_channel; |
339 | case 32000: | 348 | |
340 | case 48000: | 349 | bitrate_per_channel = header->bitrate; |
341 | index = (header->samplerate == 32000) ? 3 : 2; | 350 | if (nch == 2) { |
342 | break; | 351 | bitrate_per_channel /= 2; |
352 | |||
353 | # if defined(OPT_STRICT) | ||
354 | /* | ||
355 | * ISO/IEC 11172-3 allows only single channel mode for 32, 48, 56, and | ||
356 | * 80 kbps bitrates in Layer II, but some encoders ignore this | ||
357 | * restriction. We enforce it if OPT_STRICT is defined. | ||
358 | */ | ||
359 | if (bitrate_per_channel <= 28000 || bitrate_per_channel == 40000) { | ||
360 | stream->error = MAD_ERROR_BADMODE; | ||
361 | return -1; | ||
362 | } | ||
363 | # endif | ||
364 | } | ||
365 | else { /* nch == 1 */ | ||
366 | if (bitrate_per_channel > 192000) { | ||
367 | /* | ||
368 | * ISO/IEC 11172-3 does not allow single channel mode for 224, 256, | ||
369 | * 320, or 384 kbps bitrates in Layer II. | ||
370 | */ | ||
371 | stream->error = MAD_ERROR_BADMODE; | ||
372 | return -1; | ||
373 | } | ||
374 | } | ||
343 | 375 | ||
344 | case 56000: | 376 | if (bitrate_per_channel <= 48000) |
345 | case 64000: | 377 | index = (header->samplerate == 32000) ? 3 : 2; |
346 | case 80000: | 378 | else if (bitrate_per_channel <= 80000) |
347 | index = 0; | 379 | index = 0; |
348 | break; | 380 | else { |
349 | 381 | freeformat: | |
350 | default: | ||
351 | index = (header->samplerate == 48000) ? 0 : 1; | 382 | index = (header->samplerate == 48000) ? 0 : 1; |
@@ -433,2 +464,8 @@ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) | |||
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 || |
@@ -439,2 +476,3 @@ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) | |||
439 | } | 476 | } |
477 | # endif | ||
440 | } | 478 | } |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
@@ -290,4 +290,4 @@ unsigned char const sfb_8000_short[] = { | |||
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 |
@@ -384,3 +384,3 @@ mad_fixed_t const ca[8] = { | |||
384 | * | 384 | * |
385 | * imdct_s[i/even][k] = cos((PI / 24) * (2 * (i / 2) + 7) * (2 * k + 1)) | 385 | * imdct_s[i/even][k] = cos((PI / 24) * (2 * (i / 2) + 7) * (2 * k + 1)) |
386 | * imdct_s[i /odd][k] = cos((PI / 24) * (2 * (6 + (i-1)/2) + 7) * (2 * k + 1)) | 386 | * imdct_s[i /odd][k] = cos((PI / 24) * (2 * (6 + (i-1)/2) + 7) * (2 * k + 1)) |
@@ -463,3 +463,3 @@ mad_fixed_t const is_table[7] = { | |||
463 | * is_lsf_table[0][i] = (1 / sqrt(sqrt(2)))^(i + 1) | 463 | * is_lsf_table[0][i] = (1 / sqrt(sqrt(2)))^(i + 1) |
464 | * is_lsf_table[1][i] = (1 / sqrt(2))^(i + 1) | 464 | * is_lsf_table[1][i] = (1 / sqrt(2)) ^(i + 1) |
465 | */ | 465 | */ |
@@ -1577,2 +1577,189 @@ 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 | /* |
@@ -1867,2 +2054,3 @@ void imdct36(mad_fixed_t const X[18], mad_fixed_t x[36]) | |||
1867 | } | 2054 | } |
2055 | # endif | ||
1868 | 2056 | ||
@@ -1931,3 +2119,7 @@ void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36], | |||
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 */ |
@@ -1941,3 +2133,7 @@ void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36], | |||
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; |
@@ -2044,3 +2240,3 @@ void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], | |||
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]; |
@@ -2048,3 +2244,3 @@ void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], | |||
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]; |
@@ -2053,5 +2249,5 @@ void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], | |||
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]; |
@@ -2060,6 +2256,6 @@ void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], | |||
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]; |
@@ -2068,3 +2264,3 @@ void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], | |||
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]; |
@@ -2456,8 +2652,8 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) | |||
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 | ||
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
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,3 +1,13 @@ | |||
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 \ |
@@ -9,3 +19,3 @@ 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 |
@@ -13,41 +23,22 @@ VERSION = 1.0.0 | |||
13 | 23 | ||
14 | include( $(OPIEDIR)/include.pro ) | 24 | TRANSLATIONS = ../../../../i18n/de/libmadplugin.ts \ |
15 | 25 | ../../../../i18n/nl/libmadplugin.ts \ | |
16 | DEFINES += FPM_INTEL | 26 | ../../../../i18n/da/libmadplugin.ts \ |
17 | 27 | ../../../../i18n/xx/libmadplugin.ts \ | |
18 | system(echo $QMAKESPEC | grep -s sharp) { | 28 | ../../../../i18n/en/libmadplugin.ts \ |
19 | DEFINES -= FPM_INTEL | 29 | ../../../../i18n/es/libmadplugin.ts \ |
20 | DEFINES += FPM_ARM | 30 | ../../../../i18n/fr/libmadplugin.ts \ |
21 | } | 31 | ../../../../i18n/hu/libmadplugin.ts \ |
22 | 32 | ../../../../i18n/ja/libmadplugin.ts \ | |
23 | system(echo $QMAKESPEC | grep -s ipaq) { | 33 | ../../../../i18n/ko/libmadplugin.ts \ |
24 | DEFINES -= FPM_INTEL | 34 | ../../../../i18n/no/libmadplugin.ts \ |
25 | DEFINES += FPM_ARM | 35 | ../../../../i18n/pl/libmadplugin.ts \ |
26 | } | 36 | ../../../../i18n/pt/libmadplugin.ts \ |
27 | 37 | ../../../../i18n/pt_BR/libmadplugin.ts \ | |
28 | system(echo $QMAKESPEC | grep -s mipsel) { | 38 | ../../../../i18n/sl/libmadplugin.ts \ |
29 | DEFINES -= FPM_INTEL | 39 | ../../../../i18n/zh_CN/libmadplugin.ts \ |
30 | DEFINES += FPM_MIPS | 40 | ../../../../i18n/zh_TW/libmadplugin.ts |
31 | } | 41 | |
32 | 42 | ||
33 | system(echo $QMAKESPEC | grep -s ramses) { | 43 | |
34 | DEFINES -= FPM_INTEL | 44 | include ( $(OPIEDIR)/include.pro ) |
35 | DEFINES += FPM_ARM | ||
36 | } | ||
37 | |||
38 | system(echo $QMAKESPEC | grep -s arm) { | ||
39 | DEFINES -= FPM_INTEL | ||
40 | DEFINES += FPM_ARM | ||
41 | } | ||
42 | |||
43 | system(echo $QMAKESPEC | grep -s simpad) { | ||
44 | DEFINES -= FPM_INTEL | ||
45 | DEFINES += FPM_ARM | ||
46 | } | ||
47 | |||
48 | system(echo $QMAKESPEC | grep -s yopy) { | ||
49 | DEFINES -= FPM_INTEL | ||
50 | DEFINES += FPM_ARM | ||
51 | } | ||
52 | |||
53 | |||
diff --git a/core/multimedia/opieplayer/libmad/libmad_global.h b/core/multimedia/opieplayer/libmad/libmad_global.h index 2c9c713..a3417b4 100644 --- a/core/multimedia/opieplayer/libmad/libmad_global.h +++ b/core/multimedia/opieplayer/libmad/libmad_global.h | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
@@ -41,3 +41,3 @@ | |||
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 |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
@@ -25,4 +25,4 @@ | |||
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)" |
@@ -37,5 +37,5 @@ | |||
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 | ||
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 | |||
@@ -21,14 +21,2 @@ | |||
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> |
@@ -48,2 +36,8 @@ | |||
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 |
@@ -62,2 +56,3 @@ | |||
62 | #endif | 56 | #endif |
57 | #include "libmadplugin.h" | ||
63 | 58 | ||
@@ -389,3 +384,3 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
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; |
@@ -403,3 +398,3 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
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; |
@@ -424,3 +419,3 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
424 | 419 | ||
425 | // odebug << "Stream info: " + info << oendl; | 420 | // qDebug("Stream info: " + info); |
426 | 421 | ||
@@ -436,3 +431,3 @@ bool LibMadPlugin::open( const QString& path ) { | |||
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; |
@@ -441,3 +436,3 @@ bool LibMadPlugin::open( const QString& path ) { | |||
441 | 436 | ||
442 | //odebug << "Opening " << path << "" << oendl; | 437 | //qDebug( "Opening %s", path.latin1() ); |
443 | 438 | ||
@@ -457,3 +452,3 @@ bool LibMadPlugin::open( const QString& path ) { | |||
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; |
@@ -463,3 +458,3 @@ bool LibMadPlugin::open( const QString& path ) { | |||
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 | } |
@@ -469,3 +464,3 @@ bool LibMadPlugin::open( const QString& path ) { | |||
469 | d->input.fileLength = 0; | 464 | d->input.fileLength = 0; |
470 | 465 | ||
471 | #if defined(HAVE_MMAP) | 466 | #if defined(HAVE_MMAP) |
@@ -475,3 +470,3 @@ bool LibMadPlugin::open( const QString& path ) { | |||
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 | } |
@@ -484,3 +479,3 @@ bool LibMadPlugin::open( const QString& path ) { | |||
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; |
@@ -512,3 +507,3 @@ bool LibMadPlugin::close() { | |||
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; |
@@ -526,3 +521,3 @@ bool LibMadPlugin::close() { | |||
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; |
@@ -552,3 +547,3 @@ int LibMadPlugin::audioChannels( int ) { | |||
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; |
@@ -562,3 +557,3 @@ int LibMadPlugin::audioFrequency( int ) { | |||
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; |
@@ -573,3 +568,4 @@ int LibMadPlugin::audioSamples( int ) { | |||
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; |
@@ -580,5 +576,5 @@ int LibMadPlugin::audioSamples( int ) { | |||
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 | ||
@@ -598,3 +594,3 @@ bool LibMadPlugin::audioSetSample( long, int ) { | |||
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 ); |
@@ -686,3 +682,3 @@ bool LibMadPlugin::read() { | |||
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; |
@@ -764,3 +760,3 @@ bool LibMadPlugin::decode( short *output, long samples, long& samplesMade ) { | |||
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 | } |
@@ -827,3 +823,3 @@ double LibMadPlugin::getTime() { | |||
827 | void LibMadPlugin::printID3Tags() { | 823 | void LibMadPlugin::printID3Tags() { |
828 | // odebug << "LibMadPlugin::printID3Tags" << oendl; | 824 | // qDebug( "LibMadPlugin::printID3Tags" ); |
829 | 825 | ||
@@ -832,3 +828,3 @@ void LibMadPlugin::printID3Tags() { | |||
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; |
@@ -837,3 +833,3 @@ void LibMadPlugin::printID3Tags() { | |||
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; |
@@ -847,3 +843,3 @@ void LibMadPlugin::printID3Tags() { | |||
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 = ""; |
@@ -859,3 +855,3 @@ void LibMadPlugin::printID3Tags() { | |||
859 | } | 855 | } |
860 | // odebug << info.latin1() << oendl; | 856 | // qDebug( info.latin1() ); |
861 | *ptr3 = push2; | 857 | *ptr3 = push2; |
@@ -868,3 +864,3 @@ void LibMadPlugin::printID3Tags() { | |||
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; |
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 | |||
@@ -58,4 +58,2 @@ QRESULT LibMadPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface * | |||
58 | *iface = this, (*iface)->addRef(); | 58 | *iface = this, (*iface)->addRef(); |
59 | else | ||
60 | return QS_FALSE; | ||
61 | return QS_OK; | 59 | return QS_OK; |
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,4 +1,4 @@ | |||
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 | * |
@@ -19,5 +19,13 @@ | |||
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 |
@@ -26,3 +34,4 @@ | |||
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 | ||
@@ -32,4 +41,4 @@ | |||
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)" |
@@ -44,5 +53,5 @@ | |||
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 | ||
@@ -55,3 +64,3 @@ extern char const mad_build[]; | |||
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 | ||
@@ -72,2 +81,14 @@ typedef unsigned long mad_fixed64lo_t; | |||
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 | /* |
@@ -132,7 +153,18 @@ typedef unsigned long mad_fixed64lo_t; | |||
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 | */ |
@@ -141,3 +173,3 @@ typedef unsigned long mad_fixed64lo_t; | |||
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)) |
@@ -145,3 +177,3 @@ typedef unsigned long mad_fixed64lo_t; | |||
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 |
@@ -154,2 +186,25 @@ typedef unsigned long mad_fixed64lo_t; | |||
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 | /* |
@@ -158,3 +213,3 @@ typedef unsigned long mad_fixed64lo_t; | |||
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" \ |
@@ -164,3 +219,3 @@ typedef unsigned long mad_fixed64lo_t; | |||
164 | 219 | ||
165 | # if defined(OPT_ACCURACY) | 220 | # if defined(OPT_ACCURACY) |
166 | /* | 221 | /* |
@@ -168,3 +223,3 @@ typedef unsigned long mad_fixed64lo_t; | |||
168 | */ | 223 | */ |
169 | # define MAD_F_MLA(hi, lo, x, y) \ | 224 | # define MAD_F_MLA(hi, lo, x, y) \ |
170 | ({ mad_fixed64hi_t __hi; \ | 225 | ({ mad_fixed64hi_t __hi; \ |
@@ -178,5 +233,5 @@ typedef unsigned long mad_fixed64lo_t; | |||
178 | }) | 233 | }) |
179 | # endif /* OPT_ACCURACY */ | 234 | # endif /* OPT_ACCURACY */ |
180 | 235 | ||
181 | # if defined(OPT_ACCURACY) | 236 | # if defined(OPT_ACCURACY) |
182 | /* | 237 | /* |
@@ -184,3 +239,3 @@ typedef unsigned long mad_fixed64lo_t; | |||
184 | */ | 239 | */ |
185 | # define mad_f_scale64(hi, lo) \ | 240 | # define mad_f_scale64(hi, lo) \ |
186 | ({ mad_fixed64hi_t __hi_; \ | 241 | ({ mad_fixed64hi_t __hi_; \ |
@@ -200,4 +255,19 @@ typedef unsigned long mad_fixed64lo_t; | |||
200 | }) | 255 | }) |
201 | # else | 256 | # elif defined(OPT_INTEL) |
202 | # define mad_f_scale64(hi, lo) \ | 257 | /* |
258 | * Alternate Intel scaling that may or may not perform better. | ||
259 | */ | ||
260 | # define mad_f_scale64(hi, lo) \ | ||
261 | ({ mad_fixed_t __result; \ | ||
262 | asm ("shrl %3,%1\n\t" \ | ||
263 | "shll %4,%2\n\t" \ | ||
264 | "orl %2,%1" \ | ||
265 | : "=rm" (__result) \ | ||
266 | : "0" (lo), "r" (hi), \ | ||
267 | "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ | ||
268 | : "cc"); \ | ||
269 | __result; \ | ||
270 | }) | ||
271 | # else | ||
272 | # define mad_f_scale64(hi, lo) \ | ||
203 | ({ mad_fixed_t __result; \ | 273 | ({ mad_fixed_t __result; \ |
@@ -209,5 +279,6 @@ typedef unsigned long mad_fixed64lo_t; | |||
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 | ||
@@ -223,8 +294,4 @@ typedef unsigned long mad_fixed64lo_t; | |||
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 | */ |
@@ -255,2 +322,9 @@ typedef unsigned long mad_fixed64lo_t; | |||
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) \ |
@@ -259,3 +333,3 @@ typedef unsigned long mad_fixed64lo_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), \ |
@@ -327,14 +401,21 @@ typedef unsigned long mad_fixed64lo_t; | |||
327 | /* | 401 | /* |
328 | * This PowerPC version is tuned for the 4xx embedded processors. It is | 402 | * This PowerPC version is fast and accurate; the disposition of the least |
329 | * effectively a tuned version of FPM_64BIT. It is a little faster and just | 403 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). |
330 | * as accurate. The disposition of the least significant bit depends on | ||
331 | * OPT_ACCURACY via mad_f_scale64(). | ||
332 | */ | 404 | */ |
333 | # define MAD_F_MLX(hi, lo, x, y) \ | 405 | # define MAD_F_MLX(hi, lo, x, y) \ |
334 | asm ("mulhw %1, %2, %3\n\t" \ | 406 | do { \ |
335 | "mullw %0, %2, %3" \ | 407 | asm ("mullw %0,%1,%2" \ |
336 | : "=&r" (lo), "=&r" (hi) \ | 408 | : "=r" (lo) \ |
337 | : "%r" (x), "r" (y)) | 409 | : "%r" (x), "r" (y)); \ |
410 | asm ("mulhw %0,%1,%2" \ | ||
411 | : "=r" (hi) \ | ||
412 | : "%r" (x), "r" (y)); \ | ||
413 | } \ | ||
414 | while (0) | ||
338 | 415 | ||
339 | # define MAD_F_MLA(hi, lo, x, y) \ | 416 | # if defined(OPT_ACCURACY) |
417 | /* | ||
418 | * This gives best accuracy but is not very fast. | ||
419 | */ | ||
420 | # define MAD_F_MLA(hi, lo, x, y) \ | ||
340 | ({ mad_fixed64hi_t __hi; \ | 421 | ({ mad_fixed64hi_t __hi; \ |
@@ -342,7 +423,10 @@ typedef unsigned long mad_fixed64lo_t; | |||
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 | ||
@@ -350,20 +434,19 @@ typedef unsigned long mad_fixed64lo_t; | |||
350 | /* | 434 | /* |
351 | * This is accurate and ~2 - 2.5 times slower than the unrounded version. | 435 | * This is slower than the truncating version below it. |
352 | * | ||
353 | * The __volatile__ improves the generated code by another 5% (fewer spills | ||
354 | * to memory); eventually they should be removed. | ||
355 | */ | 436 | */ |
356 | # define mad_f_scale64(hi, lo) \ | 437 | # define mad_f_scale64(hi, lo) \ |
357 | ({ mad_fixed_t __result; \ | 438 | ({ mad_fixed_t __result, __round; \ |
358 | mad_fixed64hi_t __hi_; \ | 439 | asm ("rotrwi %0,%1,%2" \ |
359 | mad_fixed64lo_t __lo_; \ | 440 | : "=r" (__result) \ |
360 | asm __volatile__ ("addc %0, %2, %4\n\t" \ | 441 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ |
361 | "addze %1, %3" \ | 442 | asm ("extrwi %0,%1,1,0" \ |
362 | : "=r" (__lo_), "=r" (__hi_) \ | 443 | : "=r" (__round) \ |
363 | : "r" (lo), "r" (hi), "r" (1 << (MAD_F_SCALEBITS - 1))); \ | 444 | : "r" (__result)); \ |
364 | asm __volatile__ ("rlwinm %0, %2,32-%3,0,%3-1\n\t" \ | 445 | asm ("insrwi %0,%1,%2,0" \ |
365 | "rlwimi %0, %1,32-%3,%3,31" \ | 446 | : "+r" (__result) \ |
366 | : "=&r" (__result) \ | 447 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ |
367 | : "r" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS)); \ | 448 | asm ("add %0,%1,%2" \ |
368 | __result; \ | 449 | : "=r" (__result) \ |
450 | : "%r" (__result), "r" (__round)); \ | ||
451 | __result; \ | ||
369 | }) | 452 | }) |
@@ -372,9 +455,11 @@ typedef unsigned long mad_fixed64lo_t; | |||
372 | ({ mad_fixed_t __result; \ | 455 | ({ mad_fixed_t __result; \ |
373 | asm ("rlwinm %0, %2,32-%3,0,%3-1\n\t" \ | 456 | asm ("rotrwi %0,%1,%2" \ |
374 | "rlwimi %0, %1,32-%3,%3,31" \ | ||
375 | : "=r" (__result) \ | 457 | : "=r" (__result) \ |
376 | : "r" (lo), "r" (hi), "I" (MAD_F_SCALEBITS)); \ | 458 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ |
377 | __result; \ | 459 | asm ("insrwi %0,%1,%2,0" \ |
460 | : "+r" (__result) \ | ||
461 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ | ||
462 | __result; \ | ||
378 | }) | 463 | }) |
379 | # endif /* OPT_ACCURACY */ | 464 | # endif |
380 | 465 | ||
@@ -395,4 +480,8 @@ typedef unsigned long mad_fixed64lo_t; | |||
395 | */ | 480 | */ |
396 | # define mad_f_mul(x, y)((((x) + (1L << 11)) >> 12) * \ | 481 | # if defined(OPT_SPEED) |
482 | # define mad_f_mul(x, y)(((x) >> 12) * ((y) >> 16)) | ||
483 | # else | ||
484 | # define mad_f_mul(x, y)((((x) + (1L << 11)) >> 12) * \ | ||
397 | (((y) + (1L << 15)) >> 16)) | 485 | (((y) + (1L << 15)) >> 16)) |
486 | # endif | ||
398 | 487 | ||
@@ -408,4 +497,4 @@ typedef unsigned long mad_fixed64lo_t; | |||
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)); \ |
@@ -418,2 +507,3 @@ typedef unsigned long mad_fixed64lo_t; | |||
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)) |
@@ -425,2 +515,6 @@ typedef unsigned long mad_fixed64lo_t; | |||
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) |
@@ -444,5 +538,6 @@ typedef unsigned long mad_fixed64lo_t; | |||
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 | ||
@@ -450,3 +545,3 @@ mad_fixed_t mad_f_abs(mad_fixed_t); | |||
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 | ||
@@ -479,3 +574,3 @@ unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short); | |||
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 | ||
@@ -541,3 +636,3 @@ enum mad_units { | |||
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 | ||
@@ -561,3 +656,3 @@ void mad_timer_string(mad_timer_t, char *, char const *, | |||
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 | ||
@@ -566,2 +661,3 @@ void mad_timer_string(mad_timer_t, char *, char const *, | |||
566 | 661 | ||
662 | |||
567 | # define MAD_BUFFER_GUARD8 | 663 | # define MAD_BUFFER_GUARD8 |
@@ -570,2 +666,4 @@ void mad_timer_string(mad_timer_t, char *, char const *, | |||
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) */ |
@@ -584,2 +682,3 @@ enum mad_error { | |||
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 */ |
@@ -622,3 +721,3 @@ 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 */ |
@@ -626,3 +725,3 @@ enum { | |||
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 |
@@ -633,3 +732,4 @@ 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 | ||
@@ -641,5 +741,7 @@ 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 | ||
@@ -648,2 +750,3 @@ int mad_stream_sync(struct mad_stream *); | |||
648 | 750 | ||
751 | |||
649 | enum mad_layer { | 752 | enum mad_layer { |
@@ -664,23 +767,26 @@ enum mad_emphasis { | |||
664 | MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ | 767 | MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ |
665 | MAD_EMPHASIS_CCITT_J_17 = 3 /* CCITT J.17 emphasis */ | 768 | MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */ |
769 | MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */ | ||
666 | }; | 770 | }; |
667 | 771 | ||
668 | struct mad_frame { | 772 | struct mad_header { |
669 | struct mad_header { | 773 | enum mad_layer layer; /* audio layer (1, 2, or 3) */ |
670 | enum mad_layer layer; /* audio layer (1, 2, or 3) */ | 774 | enum mad_mode mode; /* channel mode (see above) */ |
671 | enum mad_mode mode; /* channel mode (see above) */ | 775 | int mode_extension; /* additional mode info */ |
672 | int mode_extension; /* additional mode info */ | 776 | enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ |
673 | enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ | 777 | |
778 | unsigned long bitrate; /* stream bitrate (bps) */ | ||
779 | unsigned int samplerate; /* sampling frequency (Hz) */ | ||
674 | 780 | ||
675 | unsigned long bitrate; /* stream bitrate (bps) */ | 781 | unsigned short crc_check; /* frame CRC accumulator */ |
676 | unsigned int samplerate; /* sampling frequency (Hz) */ | 782 | unsigned short crc_target; /* final target CRC checksum */ |
677 | 783 | ||
678 | unsigned short crc_check; /* frame CRC accumulator */ | 784 | int flags; /* flags (see below) */ |
679 | unsigned short crc_target; /* final target CRC checksum */ | 785 | int private_bits; /* private bits (see below) */ |
680 | 786 | ||
681 | int flags; /* flags (see below) */ | 787 | mad_timer_t duration; /* audio playing time of frame */ |
682 | int private_bits; /* private bits (see below) */ | 788 | }; |
683 | 789 | ||
684 | mad_timer_t duration; /* audio playing time of frame */ | 790 | struct mad_frame { |
685 | } header; | 791 | struct mad_header header; /* MPEG audio header */ |
686 | 792 | ||
@@ -699,17 +805,17 @@ struct mad_frame { | |||
699 | enum { | 805 | enum { |
700 | MAD_FLAG_NPRIVATE_III = 0x0007,/* number of Layer III private bits */ | 806 | MAD_FLAG_NPRIVATE_III = 0x0007,/* number of Layer III private bits */ |
701 | MAD_FLAG_INCOMPLETE = 0x0008,/* header but not data is decoded */ | 807 | MAD_FLAG_INCOMPLETE = 0x0008,/* header but not data is decoded */ |
702 | 808 | ||
703 | MAD_FLAG_PROTECTION = 0x0010,/* frame has CRC protection */ | 809 | MAD_FLAG_PROTECTION = 0x0010,/* frame has CRC protection */ |
704 | MAD_FLAG_COPYRIGHT = 0x0020,/* frame is copyright */ | 810 | MAD_FLAG_COPYRIGHT = 0x0020,/* frame is copyright */ |
705 | MAD_FLAG_ORIGINAL = 0x0040,/* frame is original (else copy) */ | 811 | MAD_FLAG_ORIGINAL = 0x0040,/* frame is original (else copy) */ |
706 | MAD_FLAG_PADDING = 0x0080,/* frame has additional slot */ | 812 | MAD_FLAG_PADDING = 0x0080,/* frame has additional slot */ |
707 | 813 | ||
708 | MAD_FLAG_I_STEREO = 0x0100,/* uses intensity joint stereo */ | 814 | MAD_FLAG_I_STEREO = 0x0100,/* uses intensity joint stereo */ |
709 | MAD_FLAG_MS_STEREO = 0x0200,/* uses middle/side joint stereo */ | 815 | MAD_FLAG_MS_STEREO = 0x0200,/* uses middle/side joint stereo */ |
710 | MAD_FLAG_FREEFORMAT = 0x0400,/* uses free format bitrate */ | 816 | MAD_FLAG_FREEFORMAT = 0x0400,/* uses free format bitrate */ |
711 | 817 | ||
712 | MAD_FLAG_LSF_EXT = 0x1000,/* lower sampling freq. extension */ | 818 | MAD_FLAG_LSF_EXT = 0x1000,/* lower sampling freq. extension */ |
713 | MAD_FLAG_MC_EXT = 0x2000,/* multichannel audio extension */ | 819 | MAD_FLAG_MC_EXT = 0x2000,/* multichannel audio extension */ |
714 | MAD_FLAG_MPEG_2_5_EXT = 0x4000/* MPEG 2.5 (unofficial) extension */ | 820 | MAD_FLAG_MPEG_2_5_EXT = 0x4000/* MPEG 2.5 (unofficial) extension */ |
715 | }; | 821 | }; |
@@ -717,4 +823,4 @@ enum { | |||
717 | enum { | 823 | enum { |
718 | MAD_PRIVATE_HEADER = 0x0100,/* header private bit */ | 824 | MAD_PRIVATE_HEADER = 0x0100,/* header private bit */ |
719 | MAD_PRIVATE_III = 0x001f/* Layer III private bits (up to 5) */ | 825 | MAD_PRIVATE_III = 0x001f/* Layer III private bits (up to 5) */ |
720 | }; | 826 | }; |
@@ -736,3 +842,3 @@ void mad_frame_mute(struct mad_frame *); | |||
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 | ||
@@ -741,2 +847,10 @@ void mad_frame_mute(struct mad_frame *); | |||
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 { |
@@ -747,8 +861,20 @@ struct mad_synth { | |||
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 | }; |
@@ -765,3 +891,3 @@ void mad_synth_frame(struct mad_synth *, struct mad_frame const *); | |||
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 | ||
@@ -770,2 +896,3 @@ void mad_synth_frame(struct mad_synth *, struct mad_frame const *); | |||
770 | 896 | ||
897 | |||
771 | enum mad_decoder_mode { | 898 | enum mad_decoder_mode { |
@@ -776,6 +903,6 @@ enum mad_decoder_mode { | |||
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 | }; |
@@ -803,3 +930,4 @@ struct mad_decoder { | |||
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 *, |
@@ -813,3 +941,5 @@ void mad_decoder_init(struct mad_decoder *, void *, | |||
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 *, |
@@ -823,3 +953,4 @@ 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 | ||
@@ -830 +961,4 @@ int mad_decoder_message(struct mad_decoder *, void *, unsigned int *); | |||
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 | |||
@@ -3,4 +3,4 @@ Files: plugins/codecs/libmadplugin.so.1.0.0 plugins/codecs/libmadplugin.so.1.0 p | |||
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 |
@@ -9,3 +9,3 @@ 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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
@@ -28,2 +28,7 @@ | |||
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 | */ |
@@ -99,2 +104,3 @@ | |||
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
@@ -147,2 +147,3 @@ char const *mad_stream_errorstr(struct mad_stream const *stream) | |||
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"; |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
@@ -46,2 +46,3 @@ enum mad_error { | |||
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 */ |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
@@ -80,3 +80,3 @@ 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); |
@@ -329,3 +329,4 @@ unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long 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 | ||
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
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 | |||
@@ -2,3 +2,3 @@ | |||
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 | * |
@@ -34,2 +34,12 @@ char const mad_author[] = MAD_AUTHOR " <" MAD_EMAIL ">"; | |||
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) |
@@ -80,12 +90,2 @@ char const mad_build[] = "" | |||
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 | ; |