author | harlekin <harlekin> | 2002-04-19 16:08:55 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-04-19 16:08:55 (UTC) |
commit | 7ea4abeb652e6787e57a938e1ca028d25fd249ce (patch) (side-by-side diff) | |
tree | ee08f2d9d6aaa8adb1c5f07f4124da8a61eb8cd5 /core/multimedia/opieplayer/libmad/huffman.c | |
parent | caa7ced77b9014526607f9f65c58aabe7e0ba631 (diff) | |
download | opie-7ea4abeb652e6787e57a938e1ca028d25fd249ce.zip opie-7ea4abeb652e6787e57a938e1ca028d25fd249ce.tar.gz opie-7ea4abeb652e6787e57a938e1ca028d25fd249ce.tar.bz2 |
new libmad version, less cpu usage
Diffstat (limited to 'core/multimedia/opieplayer/libmad/huffman.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/libmad/huffman.c | 21 |
1 files changed, 16 insertions, 5 deletions
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,62 +1,68 @@ /* - * mad - MPEG audio decoder + * 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 * * $Id$ */ # ifdef HAVE_CONFIG_H # include "libmad_config.h" # endif # 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. */ -# define V(v, w, x, y, hlen) { { 1, hlen, v, w, x, y } } -# define PTR(offs, bits) { ptr: { 0, bits, offs } } +# 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 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), /* 1000 */ V(0, 0, 0, 0, 1), /* 1001 */ V(0, 0, 0, 0, 1), /* 1010 */ V(0, 0, 0, 0, 1), /* 1011 */ V(0, 0, 0, 0, 1), /* 1100 */ V(0, 0, 0, 0, 1), /* 1101 */ V(0, 0, 0, 0, 1), /* 1110 */ V(0, 0, 0, 0, 1), /* 1111 */ V(0, 0, 0, 0, 1), /* 0000 ... */ /* 00 */ V(1, 0, 1, 1, 2), /* 16 */ /* 01 */ V(1, 1, 1, 1, 2), /* 10 */ V(1, 1, 0, 1, 2), @@ -79,50 +85,55 @@ union huffquad const hufftabA[] = { static union huffquad const hufftabB[] = { /* 0000 */ V(1, 1, 1, 1, 4), /* 0001 */ V(1, 1, 1, 0, 4), /* 0010 */ V(1, 1, 0, 1, 4), /* 0011 */ V(1, 1, 0, 0, 4), /* 0100 */ V(1, 0, 1, 1, 4), /* 0101 */ V(1, 0, 1, 0, 4), /* 0110 */ V(1, 0, 0, 1, 4), /* 0111 */ V(1, 0, 0, 0, 4), /* 1000 */ V(0, 1, 1, 1, 4), /* 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 -# define V(x, y, hlen) { { 1, hlen, x, y } } -# define PTR(offs, bits) { ptr: { 0, bits, offs } } +# 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 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), /* 011 */ V(1, 0, 2), /* 100 */ V(0, 0, 1), /* 101 */ V(0, 0, 1), /* 110 */ V(0, 0, 1), /* 111 */ V(0, 0, 1) }; static union huffpair const hufftab2[] = { /* 000 */ PTR(8, 3), /* 001 */ V(1, 1, 3), /* 010 */ V(0, 1, 3), /* 011 */ V(1, 0, 3), |