summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/libmad/huffman.c
Side-by-side diff
Diffstat (limited to 'core/multimedia/opieplayer/libmad/huffman.c') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmad/huffman.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/core/multimedia/opieplayer/libmad/huffman.c b/core/multimedia/opieplayer/libmad/huffman.c
index 5ea6547..684409e 100644
--- a/core/multimedia/opieplayer/libmad/huffman.c
+++ b/core/multimedia/opieplayer/libmad/huffman.c
@@ -1,15 +1,15 @@
/*
* libmad - MPEG audio decoder library
- * Copyright (C) 2000-2001 Robert Leslie
+ * Copyright (C) 2000-2004 Underbit Technologies, Inc.
*
* 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
@@ -25,31 +25,37 @@
# include "libmad_global.h"
# include "huffman.h"
/*
* These are the Huffman code words for Layer III.
* The data for these tables are derived from Table B.7 of ISO/IEC 11172-3.
*
* These tables support decoding up to 4 Huffman code bits at a time.
*/
-# 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 } }
+# if defined(__GNUC__) || \
+ (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901)
+# 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) } }
+# if defined(WORDS_BIGENDIAN)
+# define V(v, w, x, y, hlen) { { 1, hlen, (v << 11) | (w << 10) | \
+ (x << 9) | (y << 8) } }
+# else
+# define V(v, w, x, y, hlen) { { 1, hlen, (v << 0) | (w << 1) | \
+ (x << 2) | (y << 3) } }
+# endif
# endif
static
union huffquad const hufftabA[] = {
/* 0000 */ PTR(16, 2),
/* 0001 */ PTR(20, 2),
/* 0010 */ PTR(24, 1),
/* 0011 */ PTR(26, 1),
/* 0100 */ V(0, 0, 1, 0, 4),
/* 0101 */ V(0, 0, 0, 1, 4),
/* 0110 */ V(0, 1, 0, 0, 4),
/* 0111 */ V(1, 0, 0, 0, 4),
@@ -97,30 +103,35 @@ union huffquad const hufftabB[] = {
/* 1001 */ V(0, 1, 1, 0, 4),
/* 1010 */ V(0, 1, 0, 1, 4),
/* 1011 */ V(0, 1, 0, 0, 4),
/* 1100 */ V(0, 0, 1, 1, 4),
/* 1101 */ V(0, 0, 1, 0, 4),
/* 1110 */ V(0, 0, 0, 1, 4),
/* 1111 */ V(0, 0, 0, 0, 4)
};
# undef V
# undef PTR
-# if defined(__GNUC__)
-# define PTR(offs, bits) { ptr: { 0, bits, offs } }
-# define V(x, y, hlen) { value: { 1, hlen, x, y } }
+# if defined(__GNUC__) || \
+ (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901)
+# 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) } }
+# if defined(WORDS_BIGENDIAN)
+# define V(x, y, hlen) { { 1, hlen, (x << 8) | (y << 4) } }
+# else
+# define V(x, y, hlen) { { 1, hlen, (x << 0) | (y << 4) } }
+# endif
# endif
static
union huffpair const hufftab0[] = {
/* */ V(0, 0, 0)
};
static
union huffpair const hufftab1[] = {
/* 000 */ V(1, 1, 3),
/* 001 */ V(0, 1, 3),
/* 010 */ V(1, 0, 2),