summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-04-19 16:08:55 (UTC)
committer harlekin <harlekin>2002-04-19 16:08:55 (UTC)
commit7ea4abeb652e6787e57a938e1ca028d25fd249ce (patch) (side-by-side diff)
treeee08f2d9d6aaa8adb1c5f07f4124da8a61eb8cd5
parentcaa7ced77b9014526607f9f65c58aabe7e0ba631 (diff)
downloadopie-7ea4abeb652e6787e57a938e1ca028d25fd249ce.zip
opie-7ea4abeb652e6787e57a938e1ca028d25fd249ce.tar.gz
opie-7ea4abeb652e6787e57a938e1ca028d25fd249ce.tar.bz2
new libmad version, less cpu usage
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmad/COPYRIGHT21
-rw-r--r--core/multimedia/opieplayer/libmad/D.dat2
-rw-r--r--core/multimedia/opieplayer/libmad/bit.c37
-rw-r--r--core/multimedia/opieplayer/libmad/bit.h2
-rw-r--r--core/multimedia/opieplayer/libmad/decoder.c52
-rw-r--r--core/multimedia/opieplayer/libmad/decoder.h20
-rw-r--r--core/multimedia/opieplayer/libmad/fixed.c2
-rw-r--r--core/multimedia/opieplayer/libmad/fixed.h75
-rw-r--r--core/multimedia/opieplayer/libmad/frame.c4
-rw-r--r--core/multimedia/opieplayer/libmad/frame.h8
-rw-r--r--core/multimedia/opieplayer/libmad/huffman.c17
-rw-r--r--core/multimedia/opieplayer/libmad/huffman.h20
-rw-r--r--core/multimedia/opieplayer/libmad/imdct_s.dat2
-rw-r--r--core/multimedia/opieplayer/libmad/layer12.c2
-rw-r--r--core/multimedia/opieplayer/libmad/layer12.h2
-rw-r--r--core/multimedia/opieplayer/libmad/layer3.c146
-rw-r--r--core/multimedia/opieplayer/libmad/layer3.h2
-rw-r--r--core/multimedia/opieplayer/libmad/libmad_global.h15
-rw-r--r--core/multimedia/opieplayer/libmad/libmad_version.h6
-rw-r--r--core/multimedia/opieplayer/libmad/opie-libmadplugin.control2
-rw-r--r--core/multimedia/opieplayer/libmad/qc_table.dat2
-rw-r--r--core/multimedia/opieplayer/libmad/rq_table.dat2
-rw-r--r--core/multimedia/opieplayer/libmad/sf_table.dat2
-rw-r--r--core/multimedia/opieplayer/libmad/stream.c41
-rw-r--r--core/multimedia/opieplayer/libmad/stream.h13
-rw-r--r--core/multimedia/opieplayer/libmad/synth.c328
-rw-r--r--core/multimedia/opieplayer/libmad/synth.h33
-rw-r--r--core/multimedia/opieplayer/libmad/timer.c64
-rw-r--r--core/multimedia/opieplayer/libmad/timer.h4
-rw-r--r--core/multimedia/opieplayer/libmad/version.c6
30 files changed, 578 insertions, 354 deletions
diff --git a/core/multimedia/opieplayer/libmad/COPYRIGHT b/core/multimedia/opieplayer/libmad/COPYRIGHT
new file mode 100644
index 0000000..f30a707
--- a/dev/null
+++ b/core/multimedia/opieplayer/libmad/COPYRIGHT
@@ -0,0 +1,21 @@
+
+ libmad - MPEG audio decoder library
+ Copyright (C) 2000-2001 Robert Leslie
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ If you would like to negotiate alternate licensing terms, you may do
+ so by contacting the author: Robert Leslie <rob@mars.org>
+
diff --git a/core/multimedia/opieplayer/libmad/D.dat b/core/multimedia/opieplayer/libmad/D.dat
index f33d30c..c3ee74c 100644
--- a/core/multimedia/opieplayer/libmad/D.dat
+++ b/core/multimedia/opieplayer/libmad/D.dat
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
diff --git a/core/multimedia/opieplayer/libmad/bit.c b/core/multimedia/opieplayer/libmad/bit.c
index 2466c5f..4a4661b 100644
--- a/core/multimedia/opieplayer/libmad/bit.c
+++ b/core/multimedia/opieplayer/libmad/bit.c
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -199,18 +199,35 @@ unsigned short mad_bit_crc(struct mad_bitptr bitptr, unsigned int len,
{
- register unsigned int crc, data;
+ register unsigned int crc;
-# if CHAR_BIT == 8
- for (crc = init; len >= 8; len -= 8) {
- crc = (crc << 8) ^
+ for (crc = init; len >= 32; len -= 32) {
+ register unsigned long data;
+
+ data = mad_bit_read(&bitptr, 32);
+
+ crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 24)) & 0xff];
+ crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 16)) & 0xff];
+ crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 8)) & 0xff];
+ crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 0)) & 0xff];
+ }
+
+ switch (len / 8) {
+ case 3: crc = (crc << 8) ^
+ crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
+ case 2: crc = (crc << 8) ^
+ crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
+ case 1: crc = (crc << 8) ^
crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
+
+ len %= 8;
+
+ case 0: break;
}
-# else
- crc = init;
-# endif
while (len--) {
- data = mad_bit_read(&bitptr, 1) ^ (crc >> 15);
+ register unsigned int msb;
+
+ msb = mad_bit_read(&bitptr, 1) ^ (crc >> 15);
crc <<= 1;
- if (data & 1)
+ if (msb & 1)
crc ^= CRC_POLY;
diff --git a/core/multimedia/opieplayer/libmad/bit.h b/core/multimedia/opieplayer/libmad/bit.h
index f315bc9..3448d40 100644
--- a/core/multimedia/opieplayer/libmad/bit.h
+++ b/core/multimedia/opieplayer/libmad/bit.h
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
diff --git a/core/multimedia/opieplayer/libmad/decoder.c b/core/multimedia/opieplayer/libmad/decoder.c
index dcf7cf3..b2b6cbb 100644
--- a/core/multimedia/opieplayer/libmad/decoder.c
+++ b/core/multimedia/opieplayer/libmad/decoder.c
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -23,9 +23,2 @@
# include "libmad_config.h"
-# else
-# ifndef WEXITSTATUS
-# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
-# endif
-# ifndef WIFEXITED
-# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
-# endif
# endif
@@ -34,3 +27,5 @@
+# ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
+# endif
@@ -44,5 +39,11 @@
+# ifdef HAVE_FCNTL_H
# include <fcntl.h>
+# endif
+
# include <stdlib.h>
+
+# ifdef HAVE_ERRNO_H
# include <errno.h>
+# endif
@@ -54,6 +55,9 @@
void mad_decoder_init(struct mad_decoder *decoder, void *data,
- enum mad_flow (*input_func)(void *, struct mad_stream *),
+ enum mad_flow (*input_func)(void *,
+ struct mad_stream *),
enum mad_flow (*header_func)(void *,
struct mad_header const *),
- enum mad_flow (*filter_func)(void *, struct mad_frame *),
+ enum mad_flow (*filter_func)(void *,
+ struct mad_stream const *,
+ struct mad_frame *),
enum mad_flow (*output_func)(void *,
@@ -61,3 +65,4 @@ void mad_decoder_init(struct mad_decoder *decoder, void *data,
struct mad_pcm *),
- enum mad_flow (*error_func)(void *, struct mad_stream *,
+ enum mad_flow (*error_func)(void *,
+ struct mad_stream *,
struct mad_frame *),
@@ -88,2 +93,3 @@ int mad_decoder_finish(struct mad_decoder *decoder)
{
+# if defined(USE_ASYNC)
if (decoder->mode == MAD_DECODER_MODE_ASYNC && decoder->async.pid) {
@@ -94,5 +100,4 @@ int mad_decoder_finish(struct mad_decoder *decoder)
- do {
+ do
pid = waitpid(decoder->async.pid, &status, 0);
- }
while (pid == -1 && errno == EINTR);
@@ -112,2 +117,3 @@ int mad_decoder_finish(struct mad_decoder *decoder)
}
+# endif
@@ -116,2 +122,3 @@ int mad_decoder_finish(struct mad_decoder *decoder)
+# if defined(USE_ASYNC)
static
@@ -123,5 +130,4 @@ enum mad_flow send_io(int fd, void const *data, size_t len)
while (len) {
- do {
+ do
count = write(fd, ptr, len);
- }
while (count == -1 && errno == EINTR);
@@ -145,5 +151,4 @@ enum mad_flow receive_io(int fd, void *buffer, size_t len)
while (len) {
- do {
+ do
count = read(fd, ptr, len);
- }
while (count == -1 && errno == EINTR);
@@ -283,2 +288,3 @@ enum mad_flow check_message(struct mad_decoder *decoder)
}
+# endif
@@ -350,2 +356,3 @@ int run_sync(struct mad_decoder *decoder)
while (1) {
+# if defined(USE_ASYNC)
if (decoder->mode == MAD_DECODER_MODE_ASYNC) {
@@ -361,2 +368,3 @@ int run_sync(struct mad_decoder *decoder)
}
+# endif
@@ -411,3 +419,3 @@ int run_sync(struct mad_decoder *decoder)
if (decoder->filter_func) {
- switch (decoder->filter_func(decoder->cb_data, frame)) {
+ switch (decoder->filter_func(decoder->cb_data, stream, frame)) {
case MAD_FLOW_STOP:
@@ -452,2 +460,3 @@ int run_sync(struct mad_decoder *decoder)
+# if defined(USE_ASYNC)
static
@@ -513,2 +522,3 @@ int run_async(struct mad_decoder *decoder)
}
+# endif
@@ -525,3 +535,5 @@ int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode)
case MAD_DECODER_MODE_ASYNC:
+# if defined(USE_ASYNC)
run = run_async;
+# endif
break;
@@ -547,2 +559,3 @@ int mad_decoder_message(struct mad_decoder *decoder,
{
+# if defined(USE_ASYNC)
if (decoder->mode != MAD_DECODER_MODE_ASYNC ||
@@ -553,2 +566,5 @@ int mad_decoder_message(struct mad_decoder *decoder,
return 0;
+# else
+ return -1;
+# endif
}
diff --git a/core/multimedia/opieplayer/libmad/decoder.h b/core/multimedia/opieplayer/libmad/decoder.h
index dbacc1a..f34150d 100644
--- a/core/multimedia/opieplayer/libmad/decoder.h
+++ b/core/multimedia/opieplayer/libmad/decoder.h
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -34,6 +34,6 @@ enum mad_decoder_mode {
enum mad_flow {
- MAD_FLOW_CONTINUE = 0x0000,
- MAD_FLOW_STOP = 0x0010,
- MAD_FLOW_BREAK = 0x0011,
- MAD_FLOW_IGNORE = 0x0020
+ MAD_FLOW_CONTINUE = 0x0000, /* continue normally */
+ MAD_FLOW_STOP = 0x0010, /* stop decoding normally */
+ MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */
+ MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */
};
@@ -61,3 +61,4 @@ struct mad_decoder {
enum mad_flow (*header_func)(void *, struct mad_header const *);
- enum mad_flow (*filter_func)(void *, struct mad_frame *);
+ enum mad_flow (*filter_func)(void *,
+ struct mad_stream const *, struct mad_frame *);
enum mad_flow (*output_func)(void *,
@@ -71,3 +72,5 @@ void mad_decoder_init(struct mad_decoder *, void *,
enum mad_flow (*)(void *, struct mad_header const *),
- enum mad_flow (*)(void *, struct mad_frame *),
+ enum mad_flow (*)(void *,
+ struct mad_stream const *,
+ struct mad_frame *),
enum mad_flow (*)(void *,
@@ -81,3 +84,4 @@ int mad_decoder_finish(struct mad_decoder *);
-# define mad_decoder_options(decoder, opts) ((decoder)->options = (opts))
+# define mad_decoder_options(decoder, opts) \
+ ((void) ((decoder)->options = (opts)))
diff --git a/core/multimedia/opieplayer/libmad/fixed.c b/core/multimedia/opieplayer/libmad/fixed.c
index be5c94e..af1e87e 100644
--- a/core/multimedia/opieplayer/libmad/fixed.c
+++ b/core/multimedia/opieplayer/libmad/fixed.c
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
diff --git a/core/multimedia/opieplayer/libmad/fixed.h b/core/multimedia/opieplayer/libmad/fixed.h
index 00ade62..c9b98ca 100644
--- a/core/multimedia/opieplayer/libmad/fixed.h
+++ b/core/multimedia/opieplayer/libmad/fixed.h
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -36,2 +36,14 @@ typedef unsigned long mad_fixed64lo_t;
+# if defined(_MSC_VER)
+# define mad_fixed64_t signed __int64
+# elif 1 || defined(__GNUC__)
+# define mad_fixed64_t signed long long
+# endif
+
+# if defined(FPM_FLOAT)
+typedef double mad_sample_t;
+# else
+typedef mad_fixed_t mad_sample_t;
+# endif
+
/*
@@ -96,7 +108,18 @@ typedef unsigned long mad_fixed64lo_t;
-# if defined(FPM_64BIT)
+# if defined(FPM_FLOAT)
+# error "FPM_FLOAT not yet supported"
+
+# undef MAD_F
+# define MAD_F(x) mad_f_todouble(x)
+
+# define mad_f_mul(x, y) ((x) * (y))
+# define mad_f_scale64
+
+# undef ASO_ZEROCHECK
+
+# elif defined(FPM_64BIT)
/*
- * This version should be the most accurate if 64-bit (long long) types are
- * supported by the compiler, although it may not be the most efficient.
+ * This version should be the most accurate if 64-bit types are supported by
+ * the compiler, although it may not be the most efficient.
*/
@@ -105,3 +128,3 @@ typedef unsigned long mad_fixed64lo_t;
((mad_fixed_t) \
- ((((signed long long) (x) * (y)) + \
+ ((((mad_fixed64_t) (x) * (y)) + \
(1L << (MAD_F_SCALEBITS - 1))) >> MAD_F_SCALEBITS))
@@ -109,3 +132,3 @@ typedef unsigned long mad_fixed64lo_t;
# define mad_f_mul(x, y) \
- ((mad_fixed_t) (((signed long long) (x) * (y)) >> MAD_F_SCALEBITS))
+ ((mad_fixed_t) (((mad_fixed64_t) (x) * (y)) >> MAD_F_SCALEBITS))
# endif
@@ -118,2 +141,25 @@ typedef unsigned long mad_fixed64lo_t;
+# if defined(_MSC_VER)
+# pragma warning(push)
+# pragma warning(disable: 4035) /* no return value */
+static __forceinline
+mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y)
+{
+ enum {
+ fracbits = MAD_F_FRACBITS
+ };
+
+ __asm {
+ mov eax, x
+ imul y
+ shrd eax, edx, fracbits
+ }
+
+ /* implicit return of eax */
+}
+# pragma warning(pop)
+
+# define mad_f_mul mad_f_mul_inline
+# define mad_f_scale64
+# else
/*
@@ -176,2 +222,3 @@ typedef unsigned long mad_fixed64lo_t;
# define MAD_F_SCALEBITS MAD_F_FRACBITS
+# endif
@@ -219,2 +266,9 @@ typedef unsigned long mad_fixed64lo_t;
+# define MAD_F_MLN(hi, lo) \
+ asm ("rsbs %0, %2, #0\n\t" \
+ "rsc %1, %3, #0" \
+ : "=r" (lo), "=r" (hi) \
+ : "0" (lo), "1" (hi) \
+ : "cc")
+
# define mad_f_scale64(hi, lo) \
@@ -359,4 +413,8 @@ typedef unsigned long mad_fixed64lo_t;
*/
+# if defined(OPT_SPEED)
+# define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16))
+# else
# define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \
(((y) + (1L << 15)) >> 16))
+# endif
@@ -382,2 +440,3 @@ typedef unsigned long mad_fixed64lo_t;
# define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y)))
+# define MAD_F_MLN(hi, lo) ((lo) = -(lo))
# define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo))
@@ -389,2 +448,6 @@ typedef unsigned long mad_fixed64lo_t;
+# if !defined(MAD_F_MLN)
+# define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi))
+# endif
+
# if !defined(MAD_F_MLZ)
diff --git a/core/multimedia/opieplayer/libmad/frame.c b/core/multimedia/opieplayer/libmad/frame.c
index 4ebb80c..bf15e7f 100644
--- a/core/multimedia/opieplayer/libmad/frame.c
+++ b/core/multimedia/opieplayer/libmad/frame.c
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -375,3 +375,3 @@ int mad_header_decode(struct mad_header *header, struct mad_stream *stream)
if (header->bitrate == 0) {
- if ((!stream->sync || !stream->freerate) &&
+ if ((stream->freerate == 0 || !stream->sync) &&
free_bitrate(stream, header) == -1)
diff --git a/core/multimedia/opieplayer/libmad/frame.h b/core/multimedia/opieplayer/libmad/frame.h
index e88d0c8..3b8e454 100644
--- a/core/multimedia/opieplayer/libmad/frame.h
+++ b/core/multimedia/opieplayer/libmad/frame.h
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -47,3 +47,2 @@ enum mad_emphasis {
-struct mad_frame {
struct mad_header {
@@ -64,3 +63,6 @@ struct mad_frame {
mad_timer_t duration; /* audio playing time of frame */
- } header;
+};
+
+struct mad_frame {
+ struct mad_header header; /* MPEG audio header */
diff --git a/core/multimedia/opieplayer/libmad/huffman.c b/core/multimedia/opieplayer/libmad/huffman.c
index 8ec9499..5ea6547 100644
--- a/core/multimedia/opieplayer/libmad/huffman.c
+++ b/core/multimedia/opieplayer/libmad/huffman.c
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -36,4 +36,10 @@
-# define V(v, w, x, y, hlen) { { 1, hlen, v, w, x, y } }
+# if defined(__GNUC__)
# define PTR(offs, bits) { ptr: { 0, bits, offs } }
+# define V(v, w, x, y, hlen) { value: { 1, hlen, v, w, x, y } }
+# else
+# define PTR(offs, bits) { { 0, bits, offs } }
+# define V(v, w, x, y, hlen) { { 1, hlen, (v << 0) | (w << 1) | \
+ (x << 2) | (y << 3) } }
+# endif
@@ -102,4 +108,9 @@ union huffquad const hufftabB[] = {
-# define V(x, y, hlen) { { 1, hlen, x, y } }
+# if defined(__GNUC__)
# define PTR(offs, bits) { ptr: { 0, bits, offs } }
+# define V(x, y, hlen) { value: { 1, hlen, x, y } }
+# else
+# define PTR(offs, bits) { { 0, bits, offs } }
+# define V(x, y, hlen) { { 1, hlen, (x << 0) | (y << 4) } }
+# endif
diff --git a/core/multimedia/opieplayer/libmad/huffman.h b/core/multimedia/opieplayer/libmad/huffman.h
index 1801210..d051949 100644
--- a/core/multimedia/opieplayer/libmad/huffman.h
+++ b/core/multimedia/opieplayer/libmad/huffman.h
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -27,2 +27,7 @@ union huffquad {
unsigned short final : 1;
+ unsigned short bits : 3;
+ unsigned short offset : 12;
+ } ptr;
+ struct {
+ unsigned short final : 1;
unsigned short hlen : 3;
@@ -33,2 +38,6 @@ union huffquad {
} value;
+ unsigned short final : 1;
+};
+
+union huffpair {
struct {
@@ -38,6 +47,2 @@ union huffquad {
} ptr;
- unsigned short final : 1;
-};
-
-union huffpair {
struct {
@@ -48,7 +53,2 @@ union huffpair {
} value;
- struct {
- unsigned short final : 1;
- unsigned short bits : 3;
- unsigned short offset : 12;
- } ptr;
unsigned short final : 1;
diff --git a/core/multimedia/opieplayer/libmad/imdct_s.dat b/core/multimedia/opieplayer/libmad/imdct_s.dat
index 00d62eb..ed70446 100644
--- a/core/multimedia/opieplayer/libmad/imdct_s.dat
+++ b/core/multimedia/opieplayer/libmad/imdct_s.dat
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
diff --git a/core/multimedia/opieplayer/libmad/layer12.c b/core/multimedia/opieplayer/libmad/layer12.c
index 41b17ca..d291174 100644
--- a/core/multimedia/opieplayer/libmad/layer12.c
+++ b/core/multimedia/opieplayer/libmad/layer12.c
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
diff --git a/core/multimedia/opieplayer/libmad/layer12.h b/core/multimedia/opieplayer/libmad/layer12.h
index d2c81ac..c673726 100644
--- a/core/multimedia/opieplayer/libmad/layer12.h
+++ b/core/multimedia/opieplayer/libmad/layer12.h
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
diff --git a/core/multimedia/opieplayer/libmad/layer3.c b/core/multimedia/opieplayer/libmad/layer3.c
index 194fc7e..03f13fe 100644
--- a/core/multimedia/opieplayer/libmad/layer3.c
+++ b/core/multimedia/opieplayer/libmad/layer3.c
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -29,3 +29,6 @@
# include <string.h>
+
+# ifdef HAVE_ASSERT_H
# include <assert.h>
+# endif
@@ -53,2 +56,7 @@ enum {
+enum {
+ I_STEREO = 0x1,
+ MS_STEREO = 0x2
+};
+
struct sideinfo {
@@ -505,3 +513,3 @@ enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch,
unsigned int ngr, gr, ch, i;
- enum mad_error result = 0;
+ enum mad_error result = MAD_ERROR_NONE;
@@ -604,3 +612,3 @@ unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr,
- if (!((mode_extension & 0x1) && gr1ch)) {
+ if (!((mode_extension & I_STEREO) && gr1ch)) {
if (scalefac_compress < 400) {
@@ -645,3 +653,3 @@ unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr,
}
- else { /* (mode_extension & 0x1) && gr1ch (i.e. ch == 1) */
+ else { /* (mode_extension & I_STEREO) && gr1ch (i.e. ch == 1) */
scalefac_compress >>= 1;
@@ -777,2 +785,24 @@ unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel,
/*
+ * The Layer III formula for requantization and scaling is defined by
+ * section 2.4.3.4.7.1 of ISO/IEC 11172-3, as follows:
+ *
+ * long blocks:
+ * xr[i] = sign(is[i]) * abs(is[i])^(4/3) *
+ * 2^((1/4) * (global_gain - 210)) *
+ * 2^-(scalefac_multiplier *
+ * (scalefac_l[sfb] + preflag * pretab[sfb]))
+ *
+ * short blocks:
+ * xr[i] = sign(is[i]) * abs(is[i])^(4/3) *
+ * 2^((1/4) * (global_gain - 210 - 8 * subblock_gain[w])) *
+ * 2^-(scalefac_multiplier * scalefac_s[sfb][w])
+ *
+ * where:
+ * scalefac_multiplier = (scalefac_scale + 1) / 2
+ *
+ * The routines III_exponents() and III_requantize() facilitate this
+ * calculation.
+ */
+
+/*
* NAME: III_exponents()
@@ -858,19 +888,3 @@ mad_fixed_t III_requantize(unsigned int value, signed int exp)
- /*
- * long blocks:
- * xr[i] = sign(is[i]) * abs(is[i])^(4/3) *
- * 2^((1/4) * (global_gain - 210)) *
- * 2^-(scalefac_multiplier *
- * (scalefac_l[sfb] + preflag * pretab[sfb]))
- *
- * short blocks:
- * xr[i] = sign(is[i]) * abs(is[i])^(4/3) *
- * 2^((1/4) * (global_gain - 210 - 8 * subblock_gain[w])) *
- * 2^-(scalefac_multiplier * scalefac_s[sfb][w])
- *
- * where:
- * scalefac_multiplier = (scalefac_scale + 1) / 2
- */
-
- frac = exp % 4;
+ frac = exp % 4; /* assumes sign(frac) == sign(exp) */
exp /= 4;
@@ -886,5 +900,7 @@ mad_fixed_t III_requantize(unsigned int value, signed int exp)
}
- else
+ else {
+ requantized += 1L << (-exp - 1);
requantized >>= -exp;
}
+ }
else {
@@ -1253,3 +1269,3 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xr[576],
- return 0;
+ return MAD_ERROR_NONE;
}
@@ -1268,3 +1284,3 @@ void III_reorder(mad_fixed_t xr[576], struct channel const *channel,
mad_fixed_t tmp[32][3][6];
- unsigned int sb, l, sfbi, f, w, sbw[3], sw[3];
+ unsigned int sb, l, f, w, sbw[3], sw[3];
@@ -1272,6 +1288,10 @@ void III_reorder(mad_fixed_t xr[576], struct channel const *channel,
- if (channel->flags & mixed_block_flag)
- sb = 2, sfbi = 3 * 3;
- else
- sb = 0, sfbi = 0;
+ sb = 0;
+ if (channel->flags & mixed_block_flag) {
+ sb = 2;
+
+ l = 0;
+ while (l < 36)
+ l += *sfbwidth++;
+ }
@@ -1282,3 +1302,3 @@ void III_reorder(mad_fixed_t xr[576], struct channel const *channel,
- f = sfbwidth[sfbi];
+ f = *sfbwidth++;
w = 0;
@@ -1286,2 +1306,7 @@ void III_reorder(mad_fixed_t xr[576], struct channel const *channel,
for (l = 18 * sb; l < 576; ++l) {
+ if (f-- == 0) {
+ f = *sfbwidth++ - 1;
+ w = (w + 1) % 3;
+ }
+
tmp[sbw[w]][w][sw[w]++] = xr[l];
@@ -1292,9 +1317,2 @@ void III_reorder(mad_fixed_t xr[576], struct channel const *channel,
}
-
- if (--f == 0) {
- if (++w == 3)
- w = 0;
-
- f = sfbwidth[++sfbi];
- }
}
@@ -1317,7 +1335,2 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576],
- enum {
- i_stereo = 0x1,
- ms_stereo = 0x2
- };
-
if (granule->ch[0].block_type !=
@@ -1333,3 +1346,3 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576],
- if (header->mode_extension & i_stereo) {
+ if (header->mode_extension & I_STEREO) {
struct channel const *right_ch = &granule->ch[1];
@@ -1389,3 +1402,3 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576],
for (i = 0; i < lower; ++i)
- modes[i] = header->mode_extension & ~i_stereo;
+ modes[i] = header->mode_extension & ~I_STEREO;
@@ -1396,3 +1409,3 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576],
if (i < bound[w])
- modes[i] = header->mode_extension & ~i_stereo;
+ modes[i] = header->mode_extension & ~I_STEREO;
@@ -1419,3 +1432,3 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576],
for (i = 0; i < bound; ++i)
- modes[i] = header->mode_extension & ~i_stereo;
+ modes[i] = header->mode_extension & ~I_STEREO;
}
@@ -1434,3 +1447,3 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576],
- if (!(modes[sfbi] & i_stereo))
+ if (!(modes[sfbi] & I_STEREO))
continue;
@@ -1438,3 +1451,3 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576],
if (illegal_pos[sfbi]) {
- modes[sfbi] &= ~i_stereo;
+ modes[sfbi] &= ~I_STEREO;
continue;
@@ -1470,3 +1483,3 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576],
- if (!(modes[sfbi] & i_stereo))
+ if (!(modes[sfbi] & I_STEREO))
continue;
@@ -1476,3 +1489,3 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576],
if (is_pos >= 7) { /* illegal intensity position */
- modes[sfbi] &= ~i_stereo;
+ modes[sfbi] &= ~I_STEREO;
continue;
@@ -1494,3 +1507,3 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576],
- if (header->mode_extension & ms_stereo) {
+ if (header->mode_extension & MS_STEREO) {
register mad_fixed_t invsqrt2;
@@ -1504,3 +1517,3 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576],
- if (modes[sfbi] != ms_stereo)
+ if (modes[sfbi] != MS_STEREO)
continue;
@@ -1519,3 +1532,3 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576],
- return 0;
+ return MAD_ERROR_NONE;
}
@@ -1535,3 +1548,3 @@ void III_aliasreduce(mad_fixed_t xr[576], int lines)
for (i = 0; i < 8; ++i) {
- register mad_fixed_t *aptr, *bptr, a, b;
+ register mad_fixed_t a, b;
register mad_fixed64hi_t hi;
@@ -1539,7 +1552,4 @@ void III_aliasreduce(mad_fixed_t xr[576], int lines)
- aptr = &xr[-1 - i];
- bptr = &xr[ i];
-
- a = *aptr;
- b = *bptr;
+ a = xr[-1 - i];
+ b = xr[ i];
@@ -1551,3 +1561,3 @@ void III_aliasreduce(mad_fixed_t xr[576], int lines)
- *aptr = MAD_F_MLZ(hi, lo);
+ xr[-1 - i] = MAD_F_MLZ(hi, lo);
@@ -1556,3 +1566,3 @@ void III_aliasreduce(mad_fixed_t xr[576], int lines)
- *bptr = MAD_F_MLZ(hi, lo);
+ xr[ i] = MAD_F_MLZ(hi, lo);
# if defined(ASO_ZEROCHECK)
@@ -2143,3 +2153,3 @@ void III_freqinver(mad_fixed_t sample[18][32], unsigned int sb)
static
-int III_decode(struct mad_bitptr *ptr, struct mad_frame *frame,
+enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame,
struct sideinfo *si, unsigned int nch)
@@ -2171,3 +2181,3 @@ int III_decode(struct mad_bitptr *ptr, struct mad_frame *frame,
struct granule *granule = &si->gr[gr];
- unsigned char const *sfbwidth = 0;
+ unsigned char const *sfbwidth[2];
mad_fixed_t xr[2][576];
@@ -2180,5 +2190,5 @@ int III_decode(struct mad_bitptr *ptr, struct mad_frame *frame,
- sfbwidth = sfbwidth_table[sfreqi].l;
+ sfbwidth[ch] = sfbwidth_table[sfreqi].l;
if (channel->block_type == 2) {
- sfbwidth = (channel->flags & mixed_block_flag) ?
+ sfbwidth[ch] = (channel->flags & mixed_block_flag) ?
sfbwidth_table[sfreqi].m : sfbwidth_table[sfreqi].s;
@@ -2196,3 +2206,3 @@ int III_decode(struct mad_bitptr *ptr, struct mad_frame *frame,
- error = III_huffdecode(ptr, xr[ch], channel, sfbwidth, part2_length);
+ error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part2_length);
if (error)
@@ -2204,3 +2214,3 @@ int III_decode(struct mad_bitptr *ptr, struct mad_frame *frame,
if (header->mode == MAD_MODE_JOINT_STEREO && header->mode_extension) {
- error = III_stereo(xr, granule, header, sfbwidth);
+ error = III_stereo(xr, granule, header, sfbwidth[0]);
if (error)
@@ -2218,3 +2228,3 @@ int III_decode(struct mad_bitptr *ptr, struct mad_frame *frame,
if (channel->block_type == 2) {
- III_reorder(xr[ch], channel, sfbwidth_table[sfreqi].s);
+ III_reorder(xr[ch], channel, sfbwidth[ch]);
@@ -2302,3 +2312,3 @@ int III_decode(struct mad_bitptr *ptr, struct mad_frame *frame,
- return 0;
+ return MAD_ERROR_NONE;
}
diff --git a/core/multimedia/opieplayer/libmad/layer3.h b/core/multimedia/opieplayer/libmad/layer3.h
index 1fd83e2..c1a5c69 100644
--- a/core/multimedia/opieplayer/libmad/layer3.h
+++ b/core/multimedia/opieplayer/libmad/layer3.h
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
diff --git a/core/multimedia/opieplayer/libmad/libmad_global.h b/core/multimedia/opieplayer/libmad/libmad_global.h
index f2a2a71..2c9c713 100644
--- a/core/multimedia/opieplayer/libmad/libmad_global.h
+++ b/core/multimedia/opieplayer/libmad/libmad_global.h
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -44,2 +44,15 @@
+# if defined(HAVE_UNISTD_H) && defined(HAVE_WAITPID) && \
+ defined(HAVE_FCNTL) && defined(HAVE_PIPE) && defined(HAVE_FORK)
+# define USE_ASYNC
+# endif
+
+# if !defined(HAVE_ASSERT_H)
+# if defined(NDEBUG)
+# define assert(x) /* nothing */
+# else
+# define assert(x) do { if (!(x)) abort(); } while (0)
+# endif
+# endif
+
# endif
diff --git a/core/multimedia/opieplayer/libmad/libmad_version.h b/core/multimedia/opieplayer/libmad/libmad_version.h
index f8ee1fa..9e684a7 100644
--- a/core/multimedia/opieplayer/libmad/libmad_version.h
+++ b/core/multimedia/opieplayer/libmad/libmad_version.h
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -25,4 +25,4 @@
# define MAD_VERSION_MAJOR 0
-# define MAD_VERSION_MINOR 13
-# define MAD_VERSION_PATCH 0
+# define MAD_VERSION_MINOR 14
+# define MAD_VERSION_PATCH 2
# define MAD_VERSION_EXTRA " (beta)"
diff --git a/core/multimedia/opieplayer/libmad/opie-libmadplugin.control b/core/multimedia/opieplayer/libmad/opie-libmadplugin.control
index 941047f..42ea6c7 100644
--- a/core/multimedia/opieplayer/libmad/opie-libmadplugin.control
+++ b/core/multimedia/opieplayer/libmad/opie-libmadplugin.control
@@ -3,3 +3,3 @@ Priority: optional
Section: opie/plugins
-Maintainer: John Ryland <jryland@trolltech.com>
+Maintainer: Maximilian Reiss <max.reiss@gmx.de>
Architecture: arm
diff --git a/core/multimedia/opieplayer/libmad/qc_table.dat b/core/multimedia/opieplayer/libmad/qc_table.dat
index 92b7f38..5d9ca96 100644
--- a/core/multimedia/opieplayer/libmad/qc_table.dat
+++ b/core/multimedia/opieplayer/libmad/qc_table.dat
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
diff --git a/core/multimedia/opieplayer/libmad/rq_table.dat b/core/multimedia/opieplayer/libmad/rq_table.dat
index b6d1634..803cf04 100644
--- a/core/multimedia/opieplayer/libmad/rq_table.dat
+++ b/core/multimedia/opieplayer/libmad/rq_table.dat
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
diff --git a/core/multimedia/opieplayer/libmad/sf_table.dat b/core/multimedia/opieplayer/libmad/sf_table.dat
index 18e6202..bc368af 100644
--- a/core/multimedia/opieplayer/libmad/sf_table.dat
+++ b/core/multimedia/opieplayer/libmad/sf_table.dat
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
diff --git a/core/multimedia/opieplayer/libmad/stream.c b/core/multimedia/opieplayer/libmad/stream.c
index dea7b8e..4374de7 100644
--- a/core/multimedia/opieplayer/libmad/stream.c
+++ b/core/multimedia/opieplayer/libmad/stream.c
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -56,3 +56,3 @@ void mad_stream_init(struct mad_stream *stream)
stream->options = 0;
- stream->error = 0;
+ stream->error = MAD_ERROR_NONE;
}
@@ -123 +123,38 @@ int mad_stream_sync(struct mad_stream *stream)
}
+
+/*
+ * NAME: stream->errorstr()
+ * DESCRIPTION: return a string description of the current error condition
+ */
+char const *mad_stream_errorstr(struct mad_stream const *stream)
+{
+ switch (stream->error) {
+ case MAD_ERROR_NONE: return "no error";
+
+ case MAD_ERROR_BUFLEN: return "input buffer too small (or EOF)";
+ case MAD_ERROR_BUFPTR: return "invalid (null) buffer pointer";
+
+ case MAD_ERROR_NOMEM: return "not enough memory";
+
+ case MAD_ERROR_LOSTSYNC: return "lost synchronization";
+ case MAD_ERROR_BADLAYER: return "reserved header layer value";
+ case MAD_ERROR_BADBITRATE: return "forbidden bitrate value";
+ case MAD_ERROR_BADSAMPLERATE: return "reserved sample frequency value";
+ case MAD_ERROR_BADEMPHASIS: return "reserved emphasis value";
+
+ case MAD_ERROR_BADCRC: return "CRC check failed";
+ case MAD_ERROR_BADBITALLOC: return "forbidden bit allocation value";
+ case MAD_ERROR_BADSCALEFACTOR: return "bad scalefactor index";
+ case MAD_ERROR_BADFRAMELEN: return "bad frame length";
+ case MAD_ERROR_BADBIGVALUES: return "bad big_values count";
+ case MAD_ERROR_BADBLOCKTYPE: return "reserved block_type";
+ case MAD_ERROR_BADSCFSI: return "bad scalefactor selection info";
+ case MAD_ERROR_BADDATAPTR: return "bad main_data_begin pointer";
+ case MAD_ERROR_BADPART3LEN: return "bad audio data length";
+ case MAD_ERROR_BADHUFFTABLE: return "bad Huffman table select";
+ case MAD_ERROR_BADHUFFDATA: return "Huffman data overrun";
+ case MAD_ERROR_BADSTEREO: return "incompatible block_type for JS";
+ }
+
+ return 0;
+}
diff --git a/core/multimedia/opieplayer/libmad/stream.h b/core/multimedia/opieplayer/libmad/stream.h
index cf3280e..08e6dc5 100644
--- a/core/multimedia/opieplayer/libmad/stream.h
+++ b/core/multimedia/opieplayer/libmad/stream.h
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -30,2 +30,4 @@
enum mad_error {
+ MAD_ERROR_NONE = 0x0000, /* no error */
+
MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */
@@ -82,3 +84,3 @@ enum {
MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
- MAD_OPTION_HALFSAMPLERATE = 0x0002, /* generate PCM at 1/2 sample rate */
+ MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
# if 0 /* not yet implemented */
@@ -86,3 +88,3 @@ enum {
MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */
- MAD_OPTION_SINGLECHANNEL = 0x0030, /* combine channels */
+ MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */
# endif
@@ -93,3 +95,4 @@ void mad_stream_finish(struct mad_stream *);
-# define mad_stream_options(stream, opts) ((stream)->options = (opts))
+# define mad_stream_options(stream, opts) \
+ ((void) ((stream)->options = (opts)))
@@ -101,2 +104,4 @@ int mad_stream_sync(struct mad_stream *);
+char const *mad_stream_errorstr(struct mad_stream const *);
+
# endif
diff --git a/core/multimedia/opieplayer/libmad/synth.c b/core/multimedia/opieplayer/libmad/synth.c
index e1914c9..cf3c1d5 100644
--- a/core/multimedia/opieplayer/libmad/synth.c
+++ b/core/multimedia/opieplayer/libmad/synth.c
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -152,69 +152,65 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
# if defined(OPT_DCTO)
- enum {
- costab1 = MAD_F(0x7fd8878e),
- costab2 = MAD_F(0x7f62368f),
- costab3 = MAD_F(0x7e9d55fc),
- costab4 = MAD_F(0x7d8a5f40),
- costab5 = MAD_F(0x7c29fbee),
- costab6 = MAD_F(0x7a7d055b),
- costab7 = MAD_F(0x78848414),
- costab8 = MAD_F(0x7641af3d),
- costab9 = MAD_F(0x73b5ebd1),
- costab10 = MAD_F(0x70e2cbc6),
- costab11 = MAD_F(0x6dca0d14),
- costab12 = MAD_F(0x6a6d98a4),
- costab13 = MAD_F(0x66cf8120),
- costab14 = MAD_F(0x62f201ac),
- costab15 = MAD_F(0x5ed77c8a),
- costab16 = MAD_F(0x5a82799a),
- costab17 = MAD_F(0x55f5a4d2),
- costab18 = MAD_F(0x5133cc94),
- costab19 = MAD_F(0x4c3fdff4),
- costab20 = MAD_F(0x471cece7),
- costab21 = MAD_F(0x41ce1e65),
- costab22 = MAD_F(0x3c56ba70),
- costab23 = MAD_F(0x36ba2014),
- costab24 = MAD_F(0x30fbc54d),
- costab25 = MAD_F(0x2b1f34eb),
- costab26 = MAD_F(0x25280c5e),
- costab27 = MAD_F(0x1f19f97b),
- costab28 = MAD_F(0x18f8b83c),
- costab29 = MAD_F(0x12c8106f),
- costab30 = MAD_F(0x0c8bd35e),
- costab31 = MAD_F(0x0647d97c)
- };
+# define costab1 MAD_F(0x7fd8878e)
+# define costab2 MAD_F(0x7f62368f)
+# define costab3 MAD_F(0x7e9d55fc)
+# define costab4 MAD_F(0x7d8a5f40)
+# define costab5 MAD_F(0x7c29fbee)
+# define costab6 MAD_F(0x7a7d055b)
+# define costab7 MAD_F(0x78848414)
+# define costab8 MAD_F(0x7641af3d)
+# define costab9 MAD_F(0x73b5ebd1)
+# define costab10 MAD_F(0x70e2cbc6)
+# define costab11 MAD_F(0x6dca0d14)
+# define costab12 MAD_F(0x6a6d98a4)
+# define costab13 MAD_F(0x66cf8120)
+# define costab14 MAD_F(0x62f201ac)
+# define costab15 MAD_F(0x5ed77c8a)
+# define costab16 MAD_F(0x5a82799a)
+# define costab17 MAD_F(0x55f5a4d2)
+# define costab18 MAD_F(0x5133cc94)
+# define costab19 MAD_F(0x4c3fdff4)
+# define costab20 MAD_F(0x471cece7)
+# define costab21 MAD_F(0x41ce1e65)
+# define costab22 MAD_F(0x3c56ba70)
+# define costab23 MAD_F(0x36ba2014)
+# define costab24 MAD_F(0x30fbc54d)
+# define costab25 MAD_F(0x2b1f34eb)
+# define costab26 MAD_F(0x25280c5e)
+# define costab27 MAD_F(0x1f19f97b)
+# define costab28 MAD_F(0x18f8b83c)
+# define costab29 MAD_F(0x12c8106f)
+# define costab30 MAD_F(0x0c8bd35e)
+# define costab31 MAD_F(0x0647d97c)
# else
- enum {
- costab1 = MAD_F(0x0ffb10f2), /* 0.998795456 */
- costab2 = MAD_F(0x0fec46d2), /* 0.995184727 */
- costab3 = MAD_F(0x0fd3aac0), /* 0.989176510 */
- costab4 = MAD_F(0x0fb14be8), /* 0.980785280 */
- costab5 = MAD_F(0x0f853f7e), /* 0.970031253 */
- costab6 = MAD_F(0x0f4fa0ab), /* 0.956940336 */
- costab7 = MAD_F(0x0f109082), /* 0.941544065 */
- costab8 = MAD_F(0x0ec835e8), /* 0.923879533 */
- costab9 = MAD_F(0x0e76bd7a), /* 0.903989293 */
- costab10 = MAD_F(0x0e1c5979), /* 0.881921264 */
- costab11 = MAD_F(0x0db941a3), /* 0.857728610 */
- costab12 = MAD_F(0x0d4db315), /* 0.831469612 */
- costab13 = MAD_F(0x0cd9f024), /* 0.803207531 */
- costab14 = MAD_F(0x0c5e4036), /* 0.773010453 */
- costab15 = MAD_F(0x0bdaef91), /* 0.740951125 */
- costab16 = MAD_F(0x0b504f33), /* 0.707106781 */
- costab17 = MAD_F(0x0abeb49a), /* 0.671558955 */
- costab18 = MAD_F(0x0a267993), /* 0.634393284 */
- costab19 = MAD_F(0x0987fbfe), /* 0.595699304 */
- costab20 = MAD_F(0x08e39d9d), /* 0.555570233 */
- costab21 = MAD_F(0x0839c3cd), /* 0.514102744 */
- costab22 = MAD_F(0x078ad74e), /* 0.471396737 */
- costab23 = MAD_F(0x06d74402), /* 0.427555093 */
- costab24 = MAD_F(0x061f78aa), /* 0.382683432 */
- costab25 = MAD_F(0x0563e69d), /* 0.336889853 */
- costab26 = MAD_F(0x04a5018c), /* 0.290284677 */
- costab27 = MAD_F(0x03e33f2f), /* 0.242980180 */
- costab28 = MAD_F(0x031f1708), /* 0.195090322 */
- costab29 = MAD_F(0x0259020e), /* 0.146730474 */
- costab30 = MAD_F(0x01917a6c), /* 0.098017140 */
- costab31 = MAD_F(0x00c8fb30) /* 0.049067674 */
- };
+# define costab1 MAD_F(0x0ffb10f2) /* 0.998795456 */
+# define costab2 MAD_F(0x0fec46d2) /* 0.995184727 */
+# define costab3 MAD_F(0x0fd3aac0) /* 0.989176510 */
+# define costab4 MAD_F(0x0fb14be8) /* 0.980785280 */
+# define costab5 MAD_F(0x0f853f7e) /* 0.970031253 */
+# define costab6 MAD_F(0x0f4fa0ab) /* 0.956940336 */
+# define costab7 MAD_F(0x0f109082) /* 0.941544065 */
+# define costab8 MAD_F(0x0ec835e8) /* 0.923879533 */
+# define costab9 MAD_F(0x0e76bd7a) /* 0.903989293 */
+# define costab10 MAD_F(0x0e1c5979) /* 0.881921264 */
+# define costab11 MAD_F(0x0db941a3) /* 0.857728610 */
+# define costab12 MAD_F(0x0d4db315) /* 0.831469612 */
+# define costab13 MAD_F(0x0cd9f024) /* 0.803207531 */
+# define costab14 MAD_F(0x0c5e4036) /* 0.773010453 */
+# define costab15 MAD_F(0x0bdaef91) /* 0.740951125 */
+# define costab16 MAD_F(0x0b504f33) /* 0.707106781 */
+# define costab17 MAD_F(0x0abeb49a) /* 0.671558955 */
+# define costab18 MAD_F(0x0a267993) /* 0.634393284 */
+# define costab19 MAD_F(0x0987fbfe) /* 0.595699304 */
+# define costab20 MAD_F(0x08e39d9d) /* 0.555570233 */
+# define costab21 MAD_F(0x0839c3cd) /* 0.514102744 */
+# define costab22 MAD_F(0x078ad74e) /* 0.471396737 */
+# define costab23 MAD_F(0x06d74402) /* 0.427555093 */
+# define costab24 MAD_F(0x061f78aa) /* 0.382683432 */
+# define costab25 MAD_F(0x0563e69d) /* 0.336889853 */
+# define costab26 MAD_F(0x04a5018c) /* 0.290284677 */
+# define costab27 MAD_F(0x03e33f2f) /* 0.242980180 */
+# define costab28 MAD_F(0x031f1708) /* 0.195090322 */
+# define costab29 MAD_F(0x0259020e) /* 0.146730474 */
+# define costab30 MAD_F(0x01917a6c) /* 0.098017140 */
+# define costab31 MAD_F(0x00c8fb30) /* 0.049067674 */
# endif
@@ -329,3 +325,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t49 = (t67 << 1) - t32;
+ t49 = (t67 * 2) - t32;
@@ -345,3 +341,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t68 = (t98 << 1) - t49;
+ t68 = (t98 * 2) - t49;
@@ -354,3 +350,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t82 = (t104 << 1) - t58;
+ t82 = (t104 * 2) - t58;
@@ -363,5 +359,5 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t87 = (t110 << 1) - t67;
+ t87 = (t110 * 2) - t67;
- t77 = (t87 << 1) - t68;
+ t77 = (t87 * 2) - t68;
@@ -375,3 +371,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
/* 24 */ lo[ 8][slot] =
- SHIFT((MUL(t141 - t142, costab16) << 1) - t143);
+ SHIFT((MUL(t141 - t142, costab16) * 2) - t143);
@@ -381,3 +377,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t88 = (t146 << 1) - t77;
+ t88 = (t146 * 2) - t77;
@@ -389,3 +385,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t105 = (t150 << 1) - t82;
+ t105 = (t150 * 2) - t82;
@@ -397,5 +393,5 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t111 = (t154 << 1) - t87;
+ t111 = (t154 * 2) - t87;
- t99 = (t111 << 1) - t88;
+ t99 = (t111 * 2) - t88;
@@ -407,3 +403,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t127 = (t159 << 1) - t93;
+ t127 = (t159 * 2) - t93;
@@ -411,3 +407,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t160 = (MUL(t125 - t126, costab16) << 1) - t127;
+ t160 = (MUL(t125 - t126, costab16) * 2) - t127;
@@ -415,3 +411,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
/* 28 */ lo[12][slot] =
- SHIFT((((MUL(t157 - t158, costab16) << 1) - t159) << 1) - t160);
+ SHIFT((((MUL(t157 - t158, costab16) * 2) - t159) * 2) - t160);
@@ -421,5 +417,5 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t130 = (t163 << 1) - t98;
+ t130 = (t163 * 2) - t98;
- t112 = (t130 << 1) - t99;
+ t112 = (t130 * 2) - t99;
@@ -427,3 +423,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t164 = (MUL(t128 - t129, costab16) << 1) - t130;
+ t164 = (MUL(t128 - t129, costab16) * 2) - t130;
@@ -433,5 +429,5 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t134 = (t168 << 1) - t104;
+ t134 = (t168 * 2) - t104;
- t120 = (t134 << 1) - t105;
+ t120 = (t134 * 2) - t105;
@@ -439,3 +435,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t135 = (MUL(t118 - t119, costab16) << 1) - t120;
+ t135 = (MUL(t118 - t119, costab16) * 2) - t120;
@@ -443,5 +439,5 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t169 = (MUL(t132 - t133, costab16) << 1) - t134;
+ t169 = (MUL(t132 - t133, costab16) * 2) - t134;
- t151 = (t169 << 1) - t135;
+ t151 = (t169 * 2) - t135;
@@ -449,3 +445,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t170 = (((MUL(t148 - t149, costab16) << 1) - t150) << 1) - t151;
+ t170 = (((MUL(t148 - t149, costab16) * 2) - t150) * 2) - t151;
@@ -453,4 +449,4 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
/* 30 */ lo[14][slot] =
- SHIFT((((((MUL(t166 - t167, costab16) << 1) -
- t168) << 1) - t169) << 1) - t170);
+ SHIFT((((((MUL(t166 - t167, costab16) * 2) -
+ t168) * 2) - t169) * 2) - t170);
@@ -460,9 +456,9 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t138 = (t173 << 1) - t110;
+ t138 = (t173 * 2) - t110;
- t123 = (t138 << 1) - t111;
+ t123 = (t138 * 2) - t111;
- t139 = (MUL(t121 - t122, costab16) << 1) - t123;
+ t139 = (MUL(t121 - t122, costab16) * 2) - t123;
- t117 = (t123 << 1) - t112;
+ t117 = (t123 * 2) - t112;
@@ -470,3 +466,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t124 = (MUL(t115 - t116, costab16) << 1) - t117;
+ t124 = (MUL(t115 - t116, costab16) * 2) - t117;
@@ -474,3 +470,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t131 = (t139 << 1) - t124;
+ t131 = (t139 * 2) - t124;
@@ -478,3 +474,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t140 = (t164 << 1) - t131;
+ t140 = (t164 * 2) - t131;
@@ -482,7 +478,7 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t174 = (MUL(t136 - t137, costab16) << 1) - t138;
+ t174 = (MUL(t136 - t137, costab16) * 2) - t138;
- t155 = (t174 << 1) - t139;
+ t155 = (t174 * 2) - t139;
- t147 = (t155 << 1) - t140;
+ t147 = (t155 * 2) - t140;
@@ -490,3 +486,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t156 = (((MUL(t144 - t145, costab16) << 1) - t146) << 1) - t147;
+ t156 = (((MUL(t144 - t145, costab16) * 2) - t146) * 2) - t147;
@@ -494,5 +490,5 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t175 = (((MUL(t152 - t153, costab16) << 1) - t154) << 1) - t155;
+ t175 = (((MUL(t152 - t153, costab16) * 2) - t154) * 2) - t155;
- t165 = (t175 << 1) - t156;
+ t165 = (t175 * 2) - t156;
@@ -500,4 +496,4 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
- t176 = (((((MUL(t161 - t162, costab16) << 1) -
- t163) << 1) - t164) << 1) - t165;
+ t176 = (((((MUL(t161 - t162, costab16) * 2) -
+ t163) * 2) - t164) * 2) - t165;
@@ -505,4 +501,4 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
/* 31 */ lo[15][slot] =
- SHIFT((((((((MUL(t171 - t172, costab16) << 1) -
- t173) << 1) - t174) << 1) - t175) << 1) - t176);
+ SHIFT((((((((MUL(t171 - t172, costab16) * 2) -
+ t173) * 2) - t174) * 2) - t175) * 2) - t176);
@@ -528,2 +524,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
# define MLA(hi, lo, x, y) ((lo) += (x) * (y))
+# define MLN(hi, lo) ((lo) = -(lo))
# define MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo))
@@ -534,2 +531,3 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
# define MLA(hi, lo, x, y) MAD_F_MLA((hi), (lo), (x), (y))
+# define MLN(hi, lo) MAD_F_MLN((hi), (lo))
# define MLZ(hi, lo) MAD_F_MLZ((hi), (lo))
@@ -591,4 +589,15 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame,
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fx)[0], ptr[ 0]);
+ MLA(hi, lo, (*fx)[1], ptr[14]);
+ MLA(hi, lo, (*fx)[2], ptr[12]);
+ MLA(hi, lo, (*fx)[3], ptr[10]);
+ MLA(hi, lo, (*fx)[4], ptr[ 8]);
+ MLA(hi, lo, (*fx)[5], ptr[ 6]);
+ MLA(hi, lo, (*fx)[6], ptr[ 4]);
+ MLA(hi, lo, (*fx)[7], ptr[ 2]);
+ MLN(hi, lo);
+
ptr = *Dptr + pe;
- ML0(hi, lo, (*fe)[0], ptr[ 0]);
+ MLA(hi, lo, (*fe)[0], ptr[ 0]);
MLA(hi, lo, (*fe)[1], ptr[14]);
@@ -601,12 +610,2 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame,
- ptr = *Dptr + po;
- MLA(hi, lo, (*fx)[0], -ptr[ 0]);
- MLA(hi, lo, (*fx)[1], -ptr[14]);
- MLA(hi, lo, (*fx)[2], -ptr[12]);
- MLA(hi, lo, (*fx)[3], -ptr[10]);
- MLA(hi, lo, (*fx)[4], -ptr[ 8]);
- MLA(hi, lo, (*fx)[5], -ptr[ 6]);
- MLA(hi, lo, (*fx)[6], -ptr[ 4]);
- MLA(hi, lo, (*fx)[7], -ptr[ 2]);
-
*pcm1++ = SHIFT(MLZ(hi, lo));
@@ -621,4 +620,15 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame,
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fo)[0], ptr[ 0]);
+ MLA(hi, lo, (*fo)[1], ptr[14]);
+ MLA(hi, lo, (*fo)[2], ptr[12]);
+ MLA(hi, lo, (*fo)[3], ptr[10]);
+ MLA(hi, lo, (*fo)[4], ptr[ 8]);
+ MLA(hi, lo, (*fo)[5], ptr[ 6]);
+ MLA(hi, lo, (*fo)[6], ptr[ 4]);
+ MLA(hi, lo, (*fo)[7], ptr[ 2]);
+ MLN(hi, lo);
+
ptr = *Dptr + pe;
- ML0(hi, lo, (*fe)[7], ptr[ 2]);
+ MLA(hi, lo, (*fe)[7], ptr[ 2]);
MLA(hi, lo, (*fe)[6], ptr[ 4]);
@@ -631,26 +641,6 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame,
- ptr = *Dptr + po;
- MLA(hi, lo, (*fo)[0], -ptr[ 0]);
- MLA(hi, lo, (*fo)[1], -ptr[14]);
- MLA(hi, lo, (*fo)[2], -ptr[12]);
- MLA(hi, lo, (*fo)[3], -ptr[10]);
- MLA(hi, lo, (*fo)[4], -ptr[ 8]);
- MLA(hi, lo, (*fo)[5], -ptr[ 6]);
- MLA(hi, lo, (*fo)[6], -ptr[ 4]);
- MLA(hi, lo, (*fo)[7], -ptr[ 2]);
-
*pcm1++ = SHIFT(MLZ(hi, lo));
- ptr = *Dptr - po;
- ML0(hi, lo, (*fo)[7], ptr[31 - 2]);
- MLA(hi, lo, (*fo)[6], ptr[31 - 4]);
- MLA(hi, lo, (*fo)[5], ptr[31 - 6]);
- MLA(hi, lo, (*fo)[4], ptr[31 - 8]);
- MLA(hi, lo, (*fo)[3], ptr[31 - 10]);
- MLA(hi, lo, (*fo)[2], ptr[31 - 12]);
- MLA(hi, lo, (*fo)[1], ptr[31 - 14]);
- MLA(hi, lo, (*fo)[0], ptr[31 - 16]);
-
ptr = *Dptr - pe;
- MLA(hi, lo, (*fe)[0], ptr[31 - 16]);
+ ML0(hi, lo, (*fe)[0], ptr[31 - 16]);
MLA(hi, lo, (*fe)[1], ptr[31 - 14]);
@@ -663,2 +653,12 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame,
+ ptr = *Dptr - po;
+ MLA(hi, lo, (*fo)[7], ptr[31 - 2]);
+ MLA(hi, lo, (*fo)[6], ptr[31 - 4]);
+ MLA(hi, lo, (*fo)[5], ptr[31 - 6]);
+ MLA(hi, lo, (*fo)[4], ptr[31 - 8]);
+ MLA(hi, lo, (*fo)[3], ptr[31 - 10]);
+ MLA(hi, lo, (*fo)[2], ptr[31 - 12]);
+ MLA(hi, lo, (*fo)[1], ptr[31 - 14]);
+ MLA(hi, lo, (*fo)[0], ptr[31 - 16]);
+
*pcm2-- = SHIFT(MLZ(hi, lo));
@@ -726,4 +726,15 @@ void synth_half(struct mad_synth *synth, struct mad_frame const *frame,
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fx)[0], ptr[ 0]);
+ MLA(hi, lo, (*fx)[1], ptr[14]);
+ MLA(hi, lo, (*fx)[2], ptr[12]);
+ MLA(hi, lo, (*fx)[3], ptr[10]);
+ MLA(hi, lo, (*fx)[4], ptr[ 8]);
+ MLA(hi, lo, (*fx)[5], ptr[ 6]);
+ MLA(hi, lo, (*fx)[6], ptr[ 4]);
+ MLA(hi, lo, (*fx)[7], ptr[ 2]);
+ MLN(hi, lo);
+
ptr = *Dptr + pe;
- ML0(hi, lo, (*fe)[0], ptr[ 0]);
+ MLA(hi, lo, (*fe)[0], ptr[ 0]);
MLA(hi, lo, (*fe)[1], ptr[14]);
@@ -736,12 +747,2 @@ void synth_half(struct mad_synth *synth, struct mad_frame const *frame,
- ptr = *Dptr + po;
- MLA(hi, lo, (*fx)[0], -ptr[ 0]);
- MLA(hi, lo, (*fx)[1], -ptr[14]);
- MLA(hi, lo, (*fx)[2], -ptr[12]);
- MLA(hi, lo, (*fx)[3], -ptr[10]);
- MLA(hi, lo, (*fx)[4], -ptr[ 8]);
- MLA(hi, lo, (*fx)[5], -ptr[ 6]);
- MLA(hi, lo, (*fx)[6], -ptr[ 4]);
- MLA(hi, lo, (*fx)[7], -ptr[ 2]);
-
*pcm1++ = SHIFT(MLZ(hi, lo));
@@ -757,4 +758,15 @@ void synth_half(struct mad_synth *synth, struct mad_frame const *frame,
if (!(sb & 1)) {
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fo)[0], ptr[ 0]);
+ MLA(hi, lo, (*fo)[1], ptr[14]);
+ MLA(hi, lo, (*fo)[2], ptr[12]);
+ MLA(hi, lo, (*fo)[3], ptr[10]);
+ MLA(hi, lo, (*fo)[4], ptr[ 8]);
+ MLA(hi, lo, (*fo)[5], ptr[ 6]);
+ MLA(hi, lo, (*fo)[6], ptr[ 4]);
+ MLA(hi, lo, (*fo)[7], ptr[ 2]);
+ MLN(hi, lo);
+
ptr = *Dptr + pe;
- ML0(hi, lo, (*fe)[7], ptr[ 2]);
+ MLA(hi, lo, (*fe)[7], ptr[ 2]);
MLA(hi, lo, (*fe)[6], ptr[ 4]);
@@ -767,12 +779,2 @@ void synth_half(struct mad_synth *synth, struct mad_frame const *frame,
- ptr = *Dptr + po;
- MLA(hi, lo, (*fo)[0], -ptr[ 0]);
- MLA(hi, lo, (*fo)[1], -ptr[14]);
- MLA(hi, lo, (*fo)[2], -ptr[12]);
- MLA(hi, lo, (*fo)[3], -ptr[10]);
- MLA(hi, lo, (*fo)[4], -ptr[ 8]);
- MLA(hi, lo, (*fo)[5], -ptr[ 6]);
- MLA(hi, lo, (*fo)[6], -ptr[ 4]);
- MLA(hi, lo, (*fo)[7], -ptr[ 2]);
-
*pcm1++ = SHIFT(MLZ(hi, lo));
diff --git a/core/multimedia/opieplayer/libmad/synth.h b/core/multimedia/opieplayer/libmad/synth.h
index 64f6a86..2c9d5c8 100644
--- a/core/multimedia/opieplayer/libmad/synth.h
+++ b/core/multimedia/opieplayer/libmad/synth.h
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -27,2 +27,9 @@
+struct mad_pcm {
+ unsigned int samplerate; /* sampling frequency (Hz) */
+ unsigned short channels; /* number of channels */
+ unsigned short length; /* number of samples per channel */
+ mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
+};
+
struct mad_synth {
@@ -33,8 +40,20 @@ struct mad_synth {
- struct mad_pcm {
- unsigned int samplerate; /* sampling frequency (Hz) */
- unsigned short channels; /* number of channels */
- unsigned short length; /* number of samples per channel */
- mad_fixed_t samples[2][1152]; /* PCM output samples */
- } pcm;
+ struct mad_pcm pcm; /* PCM output */
+};
+
+/* single channel PCM selector */
+enum {
+ MAD_PCM_CHANNEL_SINGLE = 0
+};
+
+/* dual channel PCM selector */
+enum {
+ MAD_PCM_CHANNEL_DUAL_1 = 0,
+ MAD_PCM_CHANNEL_DUAL_2 = 1
+};
+
+/* stereo PCM selector */
+enum {
+ MAD_PCM_CHANNEL_STEREO_LEFT = 0,
+ MAD_PCM_CHANNEL_STEREO_RIGHT = 1
};
diff --git a/core/multimedia/opieplayer/libmad/timer.c b/core/multimedia/opieplayer/libmad/timer.c
index b30680c..299fe0b 100644
--- a/core/multimedia/opieplayer/libmad/timer.c
+++ b/core/multimedia/opieplayer/libmad/timer.c
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -28,3 +28,6 @@
# include <stdio.h>
+
+# ifdef HAVE_ASSERT_H
# include <assert.h>
+# endif
@@ -152,18 +155,16 @@ unsigned long scale_rational(unsigned long numer, unsigned long denom,
* NAME: timer->set()
- * DESCRIPTION: set timer to specific value
+ * DESCRIPTION: set timer to specific (positive) value
*/
void mad_timer_set(mad_timer_t *timer, unsigned long seconds,
- unsigned long fraction, unsigned long fracparts)
+ unsigned long numer, unsigned long denom)
{
timer->seconds = seconds;
-
- if (fraction == 0)
- fracparts = 0;
- else if (fracparts == 0) {
- fracparts = fraction;
- fraction = 1;
+ if (numer >= denom && denom > 0) {
+ timer->seconds += numer / denom;
+ numer %= denom;
}
- switch (fracparts) {
+ switch (denom) {
case 0:
+ case 1:
timer->fraction = 0;
@@ -172,3 +173,7 @@ void mad_timer_set(mad_timer_t *timer, unsigned long seconds,
case MAD_TIMER_RESOLUTION:
- timer->fraction = fraction;
+ timer->fraction = numer;
+ break;
+
+ case 1000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 1000);
break;
@@ -176,3 +181,3 @@ void mad_timer_set(mad_timer_t *timer, unsigned long seconds,
case 8000:
- timer->fraction = fraction * (MAD_TIMER_RESOLUTION / 8000);
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 8000);
break;
@@ -180,3 +185,3 @@ void mad_timer_set(mad_timer_t *timer, unsigned long seconds,
case 11025:
- timer->fraction = fraction * (MAD_TIMER_RESOLUTION / 11025);
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 11025);
break;
@@ -184,3 +189,3 @@ void mad_timer_set(mad_timer_t *timer, unsigned long seconds,
case 12000:
- timer->fraction = fraction * (MAD_TIMER_RESOLUTION / 12000);
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 12000);
break;
@@ -188,3 +193,3 @@ void mad_timer_set(mad_timer_t *timer, unsigned long seconds,
case 16000:
- timer->fraction = fraction * (MAD_TIMER_RESOLUTION / 16000);
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 16000);
break;
@@ -192,3 +197,3 @@ void mad_timer_set(mad_timer_t *timer, unsigned long seconds,
case 22050:
- timer->fraction = fraction * (MAD_TIMER_RESOLUTION / 22050);
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 22050);
break;
@@ -196,3 +201,3 @@ void mad_timer_set(mad_timer_t *timer, unsigned long seconds,
case 24000:
- timer->fraction = fraction * (MAD_TIMER_RESOLUTION / 24000);
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 24000);
break;
@@ -200,3 +205,3 @@ void mad_timer_set(mad_timer_t *timer, unsigned long seconds,
case 32000:
- timer->fraction = fraction * (MAD_TIMER_RESOLUTION / 32000);
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 32000);
break;
@@ -204,3 +209,3 @@ void mad_timer_set(mad_timer_t *timer, unsigned long seconds,
case 44100:
- timer->fraction = fraction * (MAD_TIMER_RESOLUTION / 44100);
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 44100);
break;
@@ -208,3 +213,3 @@ void mad_timer_set(mad_timer_t *timer, unsigned long seconds,
case 48000:
- timer->fraction = fraction * (MAD_TIMER_RESOLUTION / 48000);
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 48000);
break;
@@ -212,4 +217,3 @@ void mad_timer_set(mad_timer_t *timer, unsigned long seconds,
default:
- timer->fraction =
- scale_rational(fraction, fracparts, MAD_TIMER_RESOLUTION);
+ timer->fraction = scale_rational(numer, denom, MAD_TIMER_RESOLUTION);
break;
@@ -245,4 +249,4 @@ void mad_timer_multiply(mad_timer_t *timer, signed long scalar)
if (scalar < 0) {
- mad_timer_negate(timer);
factor = -scalar;
+ mad_timer_negate(timer);
}
@@ -319,3 +323,3 @@ signed long mad_timer_count(mad_timer_t timer, enum mad_units units)
*/
-unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long fracparts)
+unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long denom)
{
@@ -323,3 +327,3 @@ unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long fracparts)
- switch (fracparts) {
+ switch (denom) {
case 0:
@@ -331,3 +335,3 @@ unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long fracparts)
default:
- return scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, fracparts);
+ return scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, denom);
}
@@ -379,8 +383,8 @@ void mad_timer_string(mad_timer_t timer,
{
- unsigned long fracparts;
+ unsigned long denom;
- fracparts = MAD_TIMER_RESOLUTION / fracunits;
+ denom = MAD_TIMER_RESOLUTION / fracunits;
- frac = timer.fraction / fracparts;
- sub = scale_rational(timer.fraction % fracparts, fracparts, subparts);
+ frac = timer.fraction / denom;
+ sub = scale_rational(timer.fraction % denom, denom, subparts);
}
diff --git a/core/multimedia/opieplayer/libmad/timer.h b/core/multimedia/opieplayer/libmad/timer.h
index 67fe16a..f8afb8e 100644
--- a/core/multimedia/opieplayer/libmad/timer.h
+++ b/core/multimedia/opieplayer/libmad/timer.h
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -81,3 +81,3 @@ enum mad_units {
-# define mad_timer_reset(timer) (*(timer) = mad_timer_zero)
+# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero))
diff --git a/core/multimedia/opieplayer/libmad/version.c b/core/multimedia/opieplayer/libmad/version.c
index 413d54b..fb126f4 100644
--- a/core/multimedia/opieplayer/libmad/version.c
+++ b/core/multimedia/opieplayer/libmad/version.c
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -29,3 +29,3 @@
-char const mad_version[] = "MPEG Audio Decoder version " MAD_VERSION;
+char const mad_version[] = "MPEG Audio Decoder " MAD_VERSION;
char const mad_copyright[] = "Copyright (C) " MAD_PUBLISHYEAR " " MAD_AUTHOR;
@@ -33,3 +33,3 @@ char const mad_author[] = MAD_AUTHOR " <" MAD_EMAIL ">";
-char const mad_build[] =
+char const mad_build[] = ""
# if defined(FPM_64BIT)