summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-04-11 10:09:16 +0200
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-04-11 10:09:16 +0200
commitaaa87d78d6e8fe7b1ddaa910f2657952f117529f (patch)
treedf7f07d70fa3f6b25998918bbc476b2b68b73101
parent3325b9aa2a719ae200b18b8f44f0b2452c27d49d (diff)
downloadxine-lib-aaa87d78d6e8fe7b1ddaa910f2657952f117529f.tar.gz
xine-lib-aaa87d78d6e8fe7b1ddaa910f2657952f117529f.tar.bz2
Update libmpcdec (formerly libmusepack) to version 1.2.5, this also reduces the patching needed.
Contestually, move libmpcdec code in contrib/libmpcdec, so that it's not mixed together with xine code. The use of MUSEPACK_LIBS/MUSEPACK_CFLAGS intermediate is to make simpler move to pkg-config checks if libmpcdec developers decide to install one.
-rw-r--r--ChangeLog3
-rw-r--r--configure.ac8
-rw-r--r--contrib/Makefile.am2
-rw-r--r--contrib/libmpcdec/COPYING31
-rw-r--r--contrib/libmpcdec/Makefile.am14
-rw-r--r--contrib/libmpcdec/diff_from_libmpcdec_1.2.5.patch20
-rw-r--r--contrib/libmpcdec/huffsv46.c75
-rw-r--r--contrib/libmpcdec/huffsv7.c81
-rw-r--r--contrib/libmpcdec/idtag.c (renamed from src/libmusepack/idtag.c)6
-rw-r--r--contrib/libmpcdec/mpc_decoder.c (renamed from src/libmusepack/mpc_decoder.c)810
-rw-r--r--contrib/libmpcdec/mpc_reader.c (renamed from src/libmusepack/mpc_reader.c)46
-rw-r--r--contrib/libmpcdec/mpcdec/config_types.h50
-rw-r--r--contrib/libmpcdec/mpcdec/decoder.h124
-rw-r--r--contrib/libmpcdec/mpcdec/huffman.h58
-rw-r--r--contrib/libmpcdec/mpcdec/internal.h65
-rw-r--r--contrib/libmpcdec/mpcdec/math.h (renamed from src/libmusepack/musepack/math.h)46
-rw-r--r--contrib/libmpcdec/mpcdec/mpcdec.h (renamed from src/libmusepack/musepack/musepack.h)75
-rw-r--r--contrib/libmpcdec/mpcdec/reader.h82
-rw-r--r--contrib/libmpcdec/mpcdec/requant.h51
-rw-r--r--contrib/libmpcdec/mpcdec/streaminfo.h (renamed from src/libmusepack/musepack/streaminfo.h)45
-rw-r--r--contrib/libmpcdec/requant.c (renamed from src/libmusepack/requant.c)44
-rw-r--r--contrib/libmpcdec/streaminfo.c (renamed from src/libmusepack/streaminfo.c)49
-rw-r--r--contrib/libmpcdec/synth_filter.c (renamed from src/libmusepack/synth_filter.c)8
-rw-r--r--src/libmusepack/Makefile.am25
-rw-r--r--src/libmusepack/diff_against_svn.patch55
-rw-r--r--src/libmusepack/huffsv46.c268
-rw-r--r--src/libmusepack/huffsv7.c500
-rw-r--r--src/libmusepack/musepack/Makefile.am5
-rw-r--r--src/libmusepack/musepack/config_types.h23
-rw-r--r--src/libmusepack/musepack/decoder.h114
-rw-r--r--src/libmusepack/musepack/huffman.h41
-rw-r--r--src/libmusepack/musepack/internal.h34
-rw-r--r--src/libmusepack/musepack/reader.h46
-rw-r--r--src/libmusepack/musepack/requant.h17
-rw-r--r--src/libmusepack/xine_musepack_decoder.c6
35 files changed, 1245 insertions, 1682 deletions
diff --git a/ChangeLog b/ChangeLog
index 14547988f..b1f73dbaa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,9 @@ xine-lib (1.1.90) (Unreleased)
* Use FFmpeg's own buildsystem, rather than wrapping automake around its
sources; this allows to enable/disable FFmpeg features easily, and allow
to properly support --disable-ffmpeg-(uncommon|popular)-codecs.
+ * Update libmpcdec (formerly libmusepack) to version 1.2.5 (newer than the
+ previous Subversion snapshot) and contestually move it to contrib/libmpcdec
+ to separate from xine's own code.
xine-lib (1.1.6) [UNRELEASED]
* Split the DirectFB plugin into X11 and non-X versions.
diff --git a/configure.ac b/configure.ac
index 138e587a4..04e811bc0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1263,11 +1263,15 @@ elif test "x$with_external_libmpcdec" = "xyes"; then
if test "x$have_mpcdec" != "xyes"; then
AC_MSG_ERROR([Unable to find mpcdec])
fi
- AC_DEFINE([HAVE_LIBMPC], [1], [Define if external libmpc is used])
+ MPCDEC_LIBS="-lmpcdec"
+ MPCDEC_CFLAGS=""
else
AC_MSG_RESULT([Use included libmusepack])
fi
+AC_SUBST(MPCDEC_LIBS)
+AC_SUBST(MPCDEC_CFLAGS)
+
AM_CONDITIONAL([MUSEPACK], [test "x$enable_musepack" != "xno"])
AM_CONDITIONAL([EXTERNAL_MPCDEC], [test "x$have_mpcdec" = "xyes"])
@@ -2546,6 +2550,7 @@ doc/hackersguide/Makefile
doc/faq/Makefile
doc/Doxyfile
contrib/Makefile
+contrib/libmpcdec/Makefile
include/Makefile
include/xine.h
lib/Makefile
@@ -2584,7 +2589,6 @@ src/libffmpeg/Makefile
src/libmad/Makefile
src/libmpeg2/Makefile
src/libmusepack/Makefile
-src/libmusepack/musepack/Makefile
src/libspudec/Makefile
src/libspucc/Makefile
src/libspucmml/Makefile
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 0c68b8304..7a624f8c1 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = libmpcdec
+
srcdir = $(shell cd @srcdir@; pwd)
CC = @CC@
diff --git a/contrib/libmpcdec/COPYING b/contrib/libmpcdec/COPYING
new file mode 100644
index 000000000..10190c014
--- /dev/null
+++ b/contrib/libmpcdec/COPYING
@@ -0,0 +1,31 @@
+Copyright (c) 2005, The Musepack Development Team
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of the The Musepack Development Team nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/contrib/libmpcdec/Makefile.am b/contrib/libmpcdec/Makefile.am
new file mode 100644
index 000000000..16ea80c28
--- /dev/null
+++ b/contrib/libmpcdec/Makefile.am
@@ -0,0 +1,14 @@
+if MUSEPACK
+if !EXTERNAL_MPCDEC
+noinst_LTLIBRARIES = libmpcdec.la
+endif
+endif
+
+libmpcdec_la_SOURCES = huffsv46.c huffsv7.c idtag.c mpc_decoder.c mpc_reader.c \
+ requant.c streaminfo.c synth_filter.c \
+ mpcdec/internal.h mpcdec/mpcdec.h mpcdec/streaminfo.h mpcdec/math.h \
+ mpcdec/decoder.h mpcdec/config_types.h mpcdec/requant.h mpcdec/huffman.h \
+ mpcdec/reader.h
+libmpcdec_la_CFLAGS = $(VISIBILITY_FLAG)
+
+EXTRA_DIST = diff_from_libmpcdec_1.2.5.patch COPYING
diff --git a/contrib/libmpcdec/diff_from_libmpcdec_1.2.5.patch b/contrib/libmpcdec/diff_from_libmpcdec_1.2.5.patch
new file mode 100644
index 000000000..f0e3b0cb6
--- /dev/null
+++ b/contrib/libmpcdec/diff_from_libmpcdec_1.2.5.patch
@@ -0,0 +1,20 @@
+Use xine's os_types.h file.
+Define MPC_LITTLE_ENDIAN when needed.
+
+Index: libmpcdec/mpcdec/config_types.h
+===================================================================
+--- libmpcdec.orig/mpcdec/config_types.h
++++ libmpcdec/mpcdec/config_types.h
+@@ -35,7 +35,11 @@
+ #ifndef __MUSEPACK_CONFIG_TYPES_H__
+ #define __MUSEPACK_CONFIG_TYPES_H__
+
+-#include <inttypes.h>
++#include "os_types.h"
++
++#ifndef WORDS_BIGENDIAN
++# define MPC_LITTLE_ENDIAN
++#endif
+
+ typedef unsigned char mpc_bool_t;
+ #define TRUE 1
diff --git a/contrib/libmpcdec/huffsv46.c b/contrib/libmpcdec/huffsv46.c
new file mode 100644
index 000000000..a6f031160
--- /dev/null
+++ b/contrib/libmpcdec/huffsv46.c
@@ -0,0 +1,75 @@
+/*
+ Copyright (c) 2005, The Musepack Development Team
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of the The Musepack Development Team nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/// \file huffsv46.c
+/// Implementations of huffman decoding for streamversions < 7.
+
+#include <mpcdec/mpcdec.h>
+#include <mpcdec/requant.h>
+#include <mpcdec/huffman.h>
+
+#ifdef MPC_SUPPORT_SV456
+
+
+const HuffmanTyp mpc_table_SCFI_Bundle [ 8] =
+{{2147483648u,1,7},{1073741824u,2,3},{939524096u,5,1},{805306368u,5,2},{738197504u,6,0},{671088640u,6,6},{536870912u,5,4},{0u,3,5},};
+const HuffmanTyp mpc_table_DSCF_Entropie [13] =
+{{3758096384u,3,1},{3489660928u,4,3},{3355443200u,5,5},{3221225472u,5,-3},{2952790016u,4,-2},{2684354560u,4,4},{2147483648u,3,-1},{1610612736u,3,2},{1476395008u,5,-5},{1409286144u,6,6},{1342177280u,6,-6},{1073741824u,4,-4},{0u,2,0},};
+const HuffmanTyp mpc_table_Region_A [16] =
+{{2147483648u,1,1},{2013265920u,5,3},{1946157056u,6,4},{1912602624u,7,7},{1895825408u,8,8},{1887436800u,9,9},{1883242496u,10,10},{1881145344u,11,11},{1880096768u,12,12},{1879572480u,13,13},{1879310336u,14,14},{1879048192u,14,15},{1744830464u,5,5},{1610612736u,5,6},{1073741824u,3,0},{0u,2,2},};
+const HuffmanTyp mpc_table_Region_B [ 8] =
+{{2147483648u,1,1},{1073741824u,2,0},{536870912u,3,2},{268435456u,4,3},{134217728u,5,4},{67108864u,6,5},{33554432u,7,6},{0u,7,7},};
+const HuffmanTyp mpc_table_Region_C [ 4] =
+{{2147483648u,1,0},{1073741824u,2,1},{536870912u,3,2},{0u,3,3},};
+
+static const HuffmanTyp mpc_table_Entropie_1 [ 3] =
+{{2147483648u,1,0},{1073741824u,2,-1},{0u,2,1},};
+static const HuffmanTyp mpc_table_Entropie_2 [ 5] =
+{{3221225472u,2,0},{2684354560u,3,2},{2147483648u,3,-2},{1073741824u,2,1},{0u,2,-1},};
+static const HuffmanTyp mpc_table_Entropie_3 [ 7] =
+{{3221225472u,2,0},{2684354560u,3,-2},{2415919104u,4,2},{2281701376u,5,-3},{2147483648u,5,3},{1073741824u,2,-1},{0u,2,1},};
+static const HuffmanTyp mpc_table_Entropie_4 [ 9] =
+{{4026531840u,4,3},{3758096384u,4,-3},{3221225472u,3,1},{2684354560u,3,-1},{2147483648u,3,2},{1610612736u,3,-2},{1342177280u,4,-4},{1073741824u,4,4},{0u,2,0},};
+static const HuffmanTyp mpc_table_Entropie_5 [15] =
+{{4026531840u,4,-2},{3892314112u,5,-5},{3825205248u,6,-7},{3758096384u,6,7},{3489660928u,4,-3},{3221225472u,4,3},{3087007744u,5,-6},{2952790016u,5,6},{2684354560u,4,4},{2147483648u,3,0},{1610612736u,3,1},{1073741824u,3,-1},{805306368u,4,-4},{536870912u,4,5},{0u,3,2},};
+static const HuffmanTyp mpc_table_Entropie_6 [31] =
+{{4160749568u,5,-4},{4026531840u,5,5},{3892314112u,5,-5},{3825205248u,6,10},{3758096384u,6,-10},{3623878656u,5,-6},{3489660928u,5,6},{3355443200u,5,7},{3221225472u,5,-7},{3087007744u,5,-8},{3019898880u,6,-11},{2986344448u,7,14},{2952790016u,7,-14},{2818572288u,5,8},{2751463424u,6,11},{2684354560u,6,-13},{2415919104u,4,0},{2147483648u,4,1},{1879048192u,4,-1},{1610612736u,4,3},{1342177280u,4,2},{1207959552u,5,-9},{1140850688u,6,12},{1073741824u,6,13},{805306368u,4,-3},{536870912u,4,-2},{402653184u,5,9},{335544320u,6,-12},{301989888u,7,15},{268435456u,7,-15},{0u,4,4},};
+static const HuffmanTyp mpc_table_Entropie_7 [63] =
+{{4278190080u,8,28},{4261412864u,8,26},{4227858432u,7,-20},{4160749568u,6,8},{4093640704u,6,-8},{4026531840u,6,-9},{3959422976u,6,9},{3925868544u,7,20},{3892314112u,7,21},{3825205248u,6,-10},{3758096384u,6,-11},{3690987520u,6,10},{3623878656u,6,11},{3590324224u,7,-21},{3573547008u,8,29},{3556769792u,8,-29},{3489660928u,6,13},{3422552064u,6,-13},{3355443200u,6,-12},{3288334336u,6,12},{3254779904u,7,-22},{3221225472u,7,22},{3154116608u,6,14},{3087007744u,6,15},{3019898880u,6,-14},{2986344448u,7,-23},{2952790016u,7,23},{2885681152u,6,-15},{2818572288u,6,-16},{2751463424u,6,16},{2717908992u,7,27},{2684354560u,7,-27},{2617245696u,6,17},{2550136832u,6,-17},{2533359616u,8,-30},{2516582400u,8,30},{2483027968u,7,24},{2415919104u,6,-18},{2281701376u,5,-1},{2147483648u,5,1},{2113929216u,7,-24},{2080374784u,7,25},{2013265920u,6,18},{1879048192u,5,-3},{1744830464u,5,3},{1610612736u,5,5},{1476395008u,5,0},{1342177280u,5,-2},{1275068416u,6,19},{1207959552u,6,-19},{1073741824u,5,-5},{939524096u,5,-4},{805306368u,5,-7},{671088640u,5,2},{536870912u,5,4},{402653184u,5,7},{369098752u,7,-25},{335544320u,7,-26},{301989888u,7,-28},{285212672u,8,-31},{268435456u,8,31},{134217728u,5,6},{0u,5,-6},};
+
+const HuffmanTyp* mpc_table_SampleHuff [18] = {
+ NULL,mpc_table_Entropie_1,mpc_table_Entropie_2,mpc_table_Entropie_3,mpc_table_Entropie_4,mpc_table_Entropie_5,mpc_table_Entropie_6,mpc_table_Entropie_7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
+};
+
+#endif //#ifdef MPC_SUPPORT_SV456
diff --git a/contrib/libmpcdec/huffsv7.c b/contrib/libmpcdec/huffsv7.c
new file mode 100644
index 000000000..96f81ce24
--- /dev/null
+++ b/contrib/libmpcdec/huffsv7.c
@@ -0,0 +1,81 @@
+/*
+ Copyright (c) 2005, The Musepack Development Team
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of the The Musepack Development Team nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/// \file huffsv7.c
+/// Implementations of sv7 huffman decoding functions.
+
+#include <mpcdec/mpcdec.h>
+#include <mpcdec/huffman.h>
+#include <mpcdec/requant.h>
+
+const HuffmanTyp mpc_table_HuffHdr [10] =
+{{2147483648u,1,0},{1610612736u,3,1},{1577058304u,7,-4},{1568669696u,9,3},{1560281088u,9,4},{1543503872u,8,-5},{1476395008u,6,2},{1342177280u,5,-3},{1073741824u,4,-2},{0u,2,-1},};
+const HuffmanTyp mpc_table_HuffSCFI [ 4] =
+{{2147483648u,1,1},{1610612736u,3,2},{1073741824u,3,0},{0u,2,3},};
+const HuffmanTyp mpc_table_HuffDSCF [16] =
+{{4160749568u,5,5},{4026531840u,5,-4},{3758096384u,4,3},{3489660928u,4,-3},{3221225472u,4,8},{2684354560u,3,1},{2415919104u,4,0},{2281701376u,5,-5},{2214592512u,6,7},{2147483648u,6,-7},{1610612736u,3,-1},{1073741824u,3,2},{805306368u,4,4},{671088640u,5,6},{536870912u,5,-6},{0u,3,-2},};
+
+static const HuffmanTyp mpc_table_HuffQ1 [2] [3*3*3] = {
+ {{3758096384u,3,13},{3690987520u,6,26},{3623878656u,6,0},{3556769792u,6,20},{3489660928u,6,6},{3221225472u,4,14},{2952790016u,4,12},{2684354560u,4,4},{2415919104u,4,22},{2348810240u,6,8},{2281701376u,6,18},{2214592512u,6,24},{2147483648u,6,2},{1879048192u,4,16},{1610612736u,4,10},{1476395008u,5,17},{1342177280u,5,9},{1207959552u,5,1},{1073741824u,5,25},{939524096u,5,5},{805306368u,5,21},{671088640u,5,3},{536870912u,5,11},{402653184u,5,15},{268435456u,5,23},{134217728u,5,19},{0u,5,7},},
+ {{2147483648u,1,13},{2113929216u,7,15},{2080374784u,7,1},{2046820352u,7,11},{2013265920u,7,7},{1979711488u,7,17},{1946157056u,7,25},{1912602624u,7,19},{1904214016u,9,8},{1895825408u,9,18},{1887436800u,9,2},{1879048192u,9,24},{1845493760u,7,3},{1811939328u,7,23},{1778384896u,7,21},{1744830464u,7,5},{1728053248u,8,0},{1711276032u,8,26},{1694498816u,8,6},{1677721600u,8,20},{1610612736u,6,9},{1342177280u,4,14},{1073741824u,4,12},{805306368u,4,4},{536870912u,4,22},{268435456u,4,16},{0u,4,10},},
+};
+static const HuffmanTyp mpc_table_HuffQ2 [2] [5*5] = {
+ {{4026531840u,4,13},{3758096384u,4,17},{3489660928u,4,7},{3221225472u,4,11},{3154116608u,6,1},{3087007744u,6,23},{3053453312u,7,4},{3019898880u,7,20},{2986344448u,7,0},{2952790016u,7,24},{2818572288u,5,22},{2684354560u,5,10},{2147483648u,3,12},{2013265920u,5,2},{1879048192u,5,14},{1610612736u,4,6},{1342177280u,4,18},{1073741824u,4,8},{805306368u,4,16},{671088640u,5,9},{536870912u,5,5},{402653184u,5,15},{268435456u,5,21},{134217728u,5,19},{0u,5,3},},
+ {{4160749568u,5,18},{4026531840u,5,6},{3892314112u,5,8},{3875536896u,8,3},{3871342592u,10,24},{3867148288u,10,4},{3862953984u,10,0},{3858759680u,10,20},{3825205248u,7,23},{3791650816u,7,1},{3758096384u,7,19},{3623878656u,5,16},{3590324224u,7,15},{3556769792u,7,21},{3523215360u,7,9},{3489660928u,7,5},{3422552064u,6,2},{3355443200u,6,10},{3288334336u,6,14},{3221225472u,6,22},{2147483648u,2,12},{1610612736u,3,13},{1073741824u,3,17},{536870912u,3,11},{0u,3,7},},
+};
+static const HuffmanTyp mpc_table_HuffQ3 [2] [ 7] = {
+ {{3758096384u,3,1},{3489660928u,4,3},{3221225472u,4,-3},{2684354560u,3,2},{2147483648u,3,-2},{1073741824u,2,0},{0u,2,-1},},
+ {{3221225472u,2,0},{2147483648u,2,-1},{1073741824u,2,1},{805306368u,4,-2},{671088640u,5,3},{536870912u,5,-3},{0u,3,2},},
+};
+static const HuffmanTyp mpc_table_HuffQ4 [2] [ 9] = {
+ {{3758096384u,3,0},{3221225472u,3,-1},{2684354560u,3,1},{2147483648u,3,-2},{1610612736u,3,2},{1342177280u,4,-4},{1073741824u,4,4},{536870912u,3,3},{0u,3,-3},},
+ {{3758096384u,3,1},{3489660928u,4,2},{3221225472u,4,-3},{2147483648u,2,0},{1610612736u,3,-2},{1342177280u,4,3},{1207959552u,5,-4},{1073741824u,5,4},{0u,2,-1},},
+};
+static const HuffmanTyp mpc_table_HuffQ5 [2] [15] = {
+ {{4026531840u,4,2},{3892314112u,5,5},{3825205248u,6,-7},{3758096384u,6,7},{3489660928u,4,-3},{3221225472u,4,3},{3087007744u,5,-6},{2952790016u,5,6},{2684354560u,4,-4},{2415919104u,4,4},{2147483648u,4,-5},{1610612736u,3,0},{1073741824u,3,-1},{536870912u,3,1},{0u,3,-2},},
+ {{4026531840u,4,3},{3892314112u,5,4},{3858759680u,7,6},{3841982464u,8,-7},{3825205248u,8,7},{3758096384u,6,-6},{3221225472u,3,0},{2684354560u,3,-1},{2147483648u,3,1},{1610612736u,3,-2},{1073741824u,3,2},{939524096u,5,-5},{805306368u,5,5},{536870912u,4,-4},{0u,3,-3},},
+};
+static const HuffmanTyp mpc_table_HuffQ6 [2] [31] = {
+ {{4160749568u,5,3},{4026531840u,5,-4},{3959422976u,6,-11},{3892314112u,6,12},{3758096384u,5,4},{3623878656u,5,6},{3489660928u,5,-5},{3355443200u,5,5},{3221225472u,5,7},{3087007744u,5,-7},{3019898880u,6,-12},{2952790016u,6,-13},{2818572288u,5,-6},{2684354560u,5,8},{2550136832u,5,-8},{2415919104u,5,9},{2281701376u,5,-9},{2214592512u,6,13},{2181038080u,7,-15},{2147483648u,7,15},{1879048192u,4,0},{1744830464u,5,-10},{1610612736u,5,10},{1342177280u,4,-1},{1073741824u,4,2},{805306368u,4,1},{536870912u,4,-2},{469762048u,6,14},{402653184u,6,-14},{268435456u,5,11},{0u,4,-3},},
+ {{4160749568u,5,-6},{4026531840u,5,6},{3758096384u,4,1},{3489660928u,4,-1},{3456106496u,7,10},{3422552064u,7,-10},{3405774848u,8,-11},{3397386240u,9,-12},{3395289088u,11,13},{3394764800u,13,15},{3394240512u,13,-14},{3393716224u,13,14},{3393191936u,13,-15},{3388997632u,10,-13},{3372220416u,8,11},{3355443200u,8,12},{3288334336u,6,-9},{3221225472u,6,9},{2952790016u,4,-2},{2684354560u,4,2},{2415919104u,4,3},{2147483648u,4,-3},{2013265920u,5,-7},{1879048192u,5,7},{1610612736u,4,-4},{1342177280u,4,4},{1207959552u,5,-8},{1073741824u,5,8},{805306368u,4,5},{536870912u,4,-5},{0u,3,0},},
+};
+static const HuffmanTyp mpc_table_HuffQ7 [2] [63] = {
+ {{4227858432u,6,7},{4160749568u,6,8},{4093640704u,6,9},{4026531840u,6,-8},{3959422976u,6,11},{3925868544u,7,21},{3909091328u,8,-28},{3892314112u,8,28},{3825205248u,6,-9},{3791650816u,7,-22},{3758096384u,7,-21},{3690987520u,6,-10},{3623878656u,6,-11},{3556769792u,6,10},{3489660928u,6,12},{3422552064u,6,-13},{3388997632u,7,22},{3355443200u,7,23},{3288334336u,6,-12},{3221225472u,6,13},{3154116608u,6,14},{3087007744u,6,-14},{3053453312u,7,-23},{3036676096u,8,-29},{3019898880u,8,29},{2952790016u,6,-15},{2885681152u,6,15},{2818572288u,6,16},{2751463424u,6,-16},{2717908992u,7,-24},{2684354560u,7,24},{2617245696u,6,17},{2583691264u,7,-25},{2566914048u,8,-30},{2550136832u,8,30},{2483027968u,6,-17},{2415919104u,6,18},{2348810240u,6,-18},{2315255808u,7,25},{2281701376u,7,26},{2214592512u,6,19},{2181038080u,7,-26},{2147483648u,7,-27},{2013265920u,5,2},{1946157056u,6,-19},{1879048192u,6,20},{1744830464u,5,-1},{1728053248u,8,-31},{1711276032u,8,31},{1677721600u,7,27},{1610612736u,6,-20},{1476395008u,5,1},{1342177280u,5,-5},{1207959552u,5,-3},{1073741824u,5,3},{939524096u,5,0},{805306368u,5,-2},{671088640u,5,-4},{536870912u,5,4},{402653184u,5,5},{268435456u,5,-6},{134217728u,5,6},{0u,5,-7},},
+ {{4160749568u,5,-1},{4026531840u,5,2},{3892314112u,5,-2},{3758096384u,5,3},{3741319168u,8,-20},{3737124864u,10,24},{3736862720u,14,28},{3736600576u,14,-28},{3736338432u,14,-30},{3736076288u,14,30},{3735027712u,12,-27},{3734765568u,14,29},{3734503424u,14,-29},{3734241280u,14,31},{3733979136u,14,-31},{3732930560u,12,27},{3724541952u,9,-22},{3690987520u,7,-17},{3623878656u,6,-11},{3489660928u,5,-3},{3355443200u,5,4},{3221225472u,5,-4},{3187671040u,7,17},{3170893824u,8,20},{3162505216u,9,22},{3158310912u,10,-25},{3154116608u,10,-26},{3087007744u,6,12},{2952790016u,5,5},{2818572288u,5,-5},{2684354560u,5,6},{2550136832u,5,-6},{2483027968u,6,-12},{2449473536u,7,-18},{2415919104u,7,18},{2348810240u,6,13},{2281701376u,6,-13},{2147483648u,5,-7},{2080374784u,6,14},{2063597568u,8,21},{2046820352u,8,-21},{2013265920u,7,-19},{1879048192u,5,7},{1744830464u,5,8},{1677721600u,6,-14},{1610612736u,6,-15},{1476395008u,5,-8},{1409286144u,6,15},{1375731712u,7,19},{1371537408u,10,25},{1367343104u,10,26},{1358954496u,9,-23},{1350565888u,9,23},{1342177280u,9,-24},{1207959552u,5,-9},{1073741824u,5,9},{1006632960u,6,16},{939524096u,6,-16},{805306368u,5,10},{536870912u,4,0},{402653184u,5,-10},{268435456u,5,11},{0u,4,1},},
+};
+
+const HuffmanTyp* mpc_table_HuffQ [2] [8] = {
+ {0,mpc_table_HuffQ1[0],mpc_table_HuffQ2[0],mpc_table_HuffQ3[0],mpc_table_HuffQ4[0],mpc_table_HuffQ5[0],mpc_table_HuffQ6[0],mpc_table_HuffQ7[0]},
+ {0,mpc_table_HuffQ1[1],mpc_table_HuffQ2[1],mpc_table_HuffQ3[1],mpc_table_HuffQ4[1],mpc_table_HuffQ5[1],mpc_table_HuffQ6[1],mpc_table_HuffQ7[1]},
+};
diff --git a/src/libmusepack/idtag.c b/contrib/libmpcdec/idtag.c
index 4b02b33f4..7cecdb04e 100644
--- a/src/libmusepack/idtag.c
+++ b/contrib/libmpcdec/idtag.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004, The Musepack Development Team
+ Copyright (c) 2005, The Musepack Development Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -36,8 +36,8 @@
/// Rudimentary id3tag handling routines, just enough to skip id3v2 tags,
/// if present.
-#include "musepack/musepack.h"
-#include "musepack/internal.h"
+#include <mpcdec/mpcdec.h>
+#include <mpcdec/internal.h>
mpc_int32_t
JumpID3v2 (mpc_reader* r) {
diff --git a/src/libmusepack/mpc_decoder.c b/contrib/libmpcdec/mpc_decoder.c
index 827dda6dc..0617869c8 100644
--- a/src/libmusepack/mpc_decoder.c
+++ b/contrib/libmpcdec/mpc_decoder.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004, The Musepack Development Team
+ Copyright (c) 2005, The Musepack Development Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -35,10 +35,34 @@
/// \file mpc_decoder.c
/// Core decoding routines and logic.
-#include "musepack/musepack.h"
-#include "musepack/internal.h"
-#include "musepack/requant.h"
-#include "musepack/huffman.h"
+#include <mpcdec/mpcdec.h>
+#include <mpcdec/internal.h>
+#include <mpcdec/requant.h>
+#include <mpcdec/huffman.h>
+
+//SV7 tables
+extern const HuffmanTyp* mpc_table_HuffQ [2] [8];
+extern const HuffmanTyp mpc_table_HuffHdr [10];
+extern const HuffmanTyp mpc_table_HuffSCFI [ 4];
+extern const HuffmanTyp mpc_table_HuffDSCF [16];
+
+
+#ifdef MPC_SUPPORT_SV456
+//SV4/5/6 tables
+extern const HuffmanTyp* mpc_table_SampleHuff [18];
+extern const HuffmanTyp mpc_table_SCFI_Bundle [ 8];
+extern const HuffmanTyp mpc_table_DSCF_Entropie [13];
+extern const HuffmanTyp mpc_table_Region_A [16];
+extern const HuffmanTyp mpc_table_Region_B [ 8];
+extern const HuffmanTyp mpc_table_Region_C [ 4];
+
+#endif
+
+#ifndef MPC_LITTLE_ENDIAN
+#define SWAP(X) mpc_swap32(X)
+#else
+#define SWAP(X) (X)
+#endif
//------------------------------------------------------------------------------
// types
@@ -56,53 +80,62 @@ enum
//------------------------------------------------------------------------------
// forward declarations
//------------------------------------------------------------------------------
-void mpc_decoder_init_huffman_sv6(mpc_decoder *d);
-void mpc_decoder_init_huffman_sv7(mpc_decoder *d);
-void mpc_decoder_read_bitstream_sv6(mpc_decoder *d);
-void mpc_decoder_read_bitstream_sv7(mpc_decoder *d);
-void mpc_decoder_update_buffer(mpc_decoder *d, mpc_uint32_t RING);
+void mpc_decoder_read_bitstream_sv6(mpc_decoder *d, mpc_bool_t seeking);
+void mpc_decoder_read_bitstream_sv7(mpc_decoder *d, mpc_bool_t seeking);
mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample);
void mpc_decoder_requantisierung(mpc_decoder *d, const mpc_int32_t Last_Band);
//------------------------------------------------------------------------------
// utility functions
//------------------------------------------------------------------------------
-static mpc_int32_t f_read(mpc_decoder *d, void *ptr, size_t size)
+static mpc_int32_t f_read(mpc_decoder *d, void *ptr, mpc_int32_t size)
{
return d->r->read(d->r->data, ptr, size);
-};
+}
static mpc_bool_t f_seek(mpc_decoder *d, mpc_int32_t offset)
{
return d->r->seek(d->r->data, offset);
-};
+}
static mpc_int32_t f_read_dword(mpc_decoder *d, mpc_uint32_t * ptr, mpc_uint32_t count)
{
- count = f_read(d, ptr, count << 2) >> 2;
-#ifndef MPC_LITTLE_ENDIAN
- mpc_uint32_t n;
- for(n = 0; n< count; n++) {
- ptr[n] = swap32(ptr[n]);
+ return f_read(d, ptr, count << 2) >> 2;
+}
+
+static void mpc_decoder_seek(mpc_decoder *d, mpc_uint32_t bitpos)
+{
+ f_seek(d, (bitpos>>5) * 4 + d->MPCHeaderPos);
+ f_read_dword(d, d->Speicher, MEMSIZE);
+ d->dword = SWAP(d->Speicher[d->Zaehler = 0]);
+ d->pos = bitpos & 31;
+ d->WordsRead = bitpos >> 5;
+}
+
+// jump desired number of bits out of the bitstream
+static void mpc_decoder_bitstream_jump(mpc_decoder *d, const mpc_uint32_t bits)
+{
+ d->pos += bits;
+
+ if (d->pos >= 32) {
+ d->Zaehler = (d->Zaehler + (d->pos >> 5)) & MEMMASK;
+ d->dword = SWAP(d->Speicher[d->Zaehler]);
+ d->WordsRead += d->pos >> 5;
+ d->pos &= 31;
+ }
+}
+
+void mpc_decoder_update_buffer(mpc_decoder *d, mpc_uint32_t RING)
+{
+ if ((RING ^ d->Zaehler) & MEMSIZE2 ) {
+ // update buffer
+ f_read_dword(d, d->Speicher + (RING & MEMSIZE2), MEMSIZE2);
}
-#endif
- return count;
}
//------------------------------------------------------------------------------
// huffman & bitstream functions
//------------------------------------------------------------------------------
-static const mpc_uint32_t mask [33] = {
- 0x00000000, 0x00000001, 0x00000003, 0x00000007,
- 0x0000000F, 0x0000001F, 0x0000003F, 0x0000007F,
- 0x000000FF, 0x000001FF, 0x000003FF, 0x000007FF,
- 0x00000FFF, 0x00001FFF, 0x00003FFF, 0x00007FFF,
- 0x0000FFFF, 0x0001FFFF, 0x0003FFFF, 0x0007FFFF,
- 0x000FFFFF, 0x001FFFFF, 0x003FFFFF, 0x007FFFFF,
- 0x00FFFFFF, 0x01FFFFFF, 0x03FFFFFF, 0x07FFFFFF,
- 0x0FFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF,
- 0xFFFFFFFF
-};
/* F U N C T I O N S */
@@ -123,7 +156,7 @@ mpc_decoder_bits_read(mpc_decoder *d)
return 32 * d->WordsRead + d->pos;
}
-// read desired number of bits out of the bitstream
+// read desired number of bits out of the bitstream (max 31)
static mpc_uint32_t
mpc_decoder_bitstream_read(mpc_decoder *d, const mpc_uint32_t bits)
{
@@ -133,139 +166,51 @@ mpc_decoder_bitstream_read(mpc_decoder *d, const mpc_uint32_t bits)
if (d->pos < 32) {
out >>= (32 - d->pos);
- }
- else {
- d->dword = d->Speicher[d->Zaehler = (d->Zaehler + 1) & MEMMASK];
+ } else {
+ d->dword = SWAP(d->Speicher[d->Zaehler = (d->Zaehler + 1) & MEMMASK]);
d->pos -= 32;
if (d->pos) {
out <<= d->pos;
out |= d->dword >> (32 - d->pos);
}
- ++(d->WordsRead);
+ d->WordsRead++;
}
- return out & mask[bits];
-}
-
-// decode SCFI-bundle (sv4,5,6)
-static void
-mpc_decoder_scfi_bundle_read(
- mpc_decoder *d,
- HuffmanTyp* Table, mpc_int32_t* SCFI, mpc_int32_t* DSCF)
-{
- // load preview and decode
- mpc_uint32_t code = d->dword << d->pos;
- if (d->pos > 26) {
- code |= d->Speicher[(d->Zaehler + 1) & MEMMASK] >> (32 - d->pos);
- }
- while (code < Table->Code) {
- Table++;
- }
-
- // set the new position within bitstream without performing a dummy-read
- if ((d->pos += Table->Length) >= 32) {
- d->pos -= 32;
- d->dword = d->Speicher[d->Zaehler = (d->Zaehler+1) & MEMMASK];
- ++(d->WordsRead);
- }
-
- *SCFI = Table->Value >> 1;
- *DSCF = Table->Value & 1;
-}
-
-static int
-mpc_decoder_huffman_typ_cmpfn(const void* p1, const void* p2)
-{
- if (((HuffmanTyp*) p1)->Code < ((HuffmanTyp*) p2)->Code ) return +1;
- if (((HuffmanTyp*) p1)->Code > ((HuffmanTyp*) p2)->Code ) return -1;
- return 0;
-}
-
-// sort huffman-tables by codeword
-// offset resulting value
-void
-mpc_decoder_resort_huff_tables(
- const mpc_uint32_t elements, HuffmanTyp* Table, const mpc_int32_t offset )
-{
- mpc_uint32_t i;
-
- for ( i = 0; i < elements; i++ ) {
- Table[i].Code <<= 32 - Table[i].Length;
- Table[i].Value = i - offset;
- }
- qsort(Table, elements, sizeof(*Table), mpc_decoder_huffman_typ_cmpfn);
+ return out & ((1 << bits) - 1);
}
// basic huffman decoding routine
-// works with maximum lengths up to 14
+// works with maximum lengths up to max_length
static mpc_int32_t
-mpc_decoder_huffman_decode(mpc_decoder *d, const HuffmanTyp *Table)
+mpc_decoder_huffman_decode(mpc_decoder *d, const HuffmanTyp *Table,
+ const mpc_uint32_t max_length)
{
// load preview and decode
mpc_uint32_t code = d->dword << d->pos;
- if (d->pos > 18) {
- code |= d->Speicher[(d->Zaehler + 1) & MEMMASK] >> (32 - d->pos);
- }
- while (code < Table->Code) {
- Table++;
- }
-
- // set the new position within bitstream without performing a dummy-read
- if ((d->pos += Table->Length) >= 32) {
- d->pos -= 32;
- d->dword = d->Speicher[d->Zaehler = (d->Zaehler + 1) & MEMMASK];
- ++(d->WordsRead);
- }
+ if (32 - d->pos < max_length)
+ code |= SWAP(d->Speicher[(d->Zaehler + 1) & MEMMASK]) >> (32 - d->pos);
- return Table->Value;
-}
-
-// faster huffman through previewing less bits
-// works with maximum lengths up to 10
-static mpc_int32_t
-mpc_decoder_huffman_decode_fast(mpc_decoder *d, const HuffmanTyp* Table)
-{
- // load preview and decode
- mpc_uint32_t code = d->dword << d->pos;
- if (d->pos > 22) {
- code |= d->Speicher[(d->Zaehler + 1) & MEMMASK] >> (32 - d->pos);
- }
- while (code < Table->Code) {
- Table++;
- }
+ while (code < Table->Code) Table++;
// set the new position within bitstream without performing a dummy-read
if ((d->pos += Table->Length) >= 32) {
d->pos -= 32;
- d->dword = d->Speicher[d->Zaehler = (d->Zaehler + 1) & MEMMASK];
- ++(d->WordsRead);
+ d->dword = SWAP(d->Speicher[d->Zaehler = (d->Zaehler + 1) & MEMMASK]);
+ d->WordsRead++;
}
return Table->Value;
}
-// even faster huffman through previewing even less bits
-// works with maximum lengths up to 5
-static mpc_int32_t
-mpc_decoder_huffman_decode_faster(mpc_decoder *d, const HuffmanTyp* Table)
+// decode SCFI-bundle (sv4,5,6)
+static void
+mpc_decoder_scfi_bundle_read(mpc_decoder *d, const HuffmanTyp* Table,
+ mpc_int32_t* SCFI, mpc_bool_t* DSCF)
{
- // load preview and decode
- mpc_uint32_t code = d->dword << d->pos;
- if (d->pos > 27) {
- code |= d->Speicher[(d->Zaehler + 1) & MEMMASK] >> (32 - d->pos);
- }
- while (code < Table->Code) {
- Table++;
- }
+ mpc_uint32_t value = mpc_decoder_huffman_decode(d, Table, 6);
- // set the new position within bitstream without performing a dummy-read
- if ((d->pos += Table->Length) >= 32) {
- d->pos -= 32;
- d->dword = d->Speicher[d->Zaehler = (d->Zaehler + 1) & MEMMASK];
- ++(d->WordsRead);
- }
-
- return Table->Value;
+ *SCFI = value >> 1;
+ *DSCF = value & 1;
}
static void
@@ -297,61 +242,95 @@ mpc_decoder_reset_globals(mpc_decoder *d)
d->StreamVersion = 0;
d->MS_used = 0;
- memset(d->Y_L , 0, sizeof d->Y_L );
- memset(d->Y_R , 0, sizeof d->Y_R );
- memset(d->SCF_Index_L , 0, sizeof d->SCF_Index_L );
- memset(d->SCF_Index_R , 0, sizeof d->SCF_Index_R );
+ memset(d->Y_L , 0, sizeof d->Y_L );
+ memset(d->Y_R , 0, sizeof d->Y_R );
+ memset(d->SCF_Index_L , 1, sizeof d->SCF_Index_L );
+ memset(d->SCF_Index_R , 1, sizeof d->SCF_Index_R );
memset(d->Res_L , 0, sizeof d->Res_L );
memset(d->Res_R , 0, sizeof d->Res_R );
memset(d->SCFI_L , 0, sizeof d->SCFI_L );
memset(d->SCFI_R , 0, sizeof d->SCFI_R );
memset(d->DSCF_Flag_L , 0, sizeof d->DSCF_Flag_L );
memset(d->DSCF_Flag_R , 0, sizeof d->DSCF_Flag_R );
- memset(d->DSCF_Reference_L, 0, sizeof d->DSCF_Reference_L );
- memset(d->DSCF_Reference_R, 0, sizeof d->DSCF_Reference_R );
memset(d->Q , 0, sizeof d->Q );
memset(d->MS_Flag , 0, sizeof d->MS_Flag );
+ memset(d->seeking_table , 0, sizeof d->seeking_table );
+}
+
+// Frame decoding. Takes big endian 32 bits words as input
+mpc_uint32_t
+mpc_decoder_decode_frame(mpc_decoder *d, mpc_uint32_t *in_buffer,
+ mpc_uint32_t in_len, MPC_SAMPLE_FORMAT *out_buffer)
+{
+ unsigned int i;
+ mpc_decoder_reset_bitstream_decode(d);
+ if (in_len > sizeof(d->Speicher)) in_len = sizeof(d->Speicher);
+ memcpy(d->Speicher, in_buffer, in_len);
+ for (i = 0; i < (in_len + 3) / 4; i++)
+ d->Speicher[i] = mpc_swap32(d->Speicher[i]);
+ d->dword = SWAP(d->Speicher[0]);
+ switch (d->StreamVersion) {
+#ifdef MPC_SUPPORT_SV456
+ case 0x04:
+ case 0x05:
+ case 0x06:
+ mpc_decoder_read_bitstream_sv6(d, FALSE);
+ break;
+#endif
+ case 0x07:
+ case 0x17:
+ mpc_decoder_read_bitstream_sv7(d, FALSE);
+ break;
+ default:
+ return (mpc_uint32_t)(-1);
+ }
+ mpc_decoder_requantisierung(d, d->Max_Band);
+ mpc_decoder_synthese_filter_float(d, out_buffer);
+ return mpc_decoder_bits_read(d);
}
static mpc_uint32_t
mpc_decoder_decode_internal(mpc_decoder *d, MPC_SAMPLE_FORMAT *buffer)
{
mpc_uint32_t output_frame_length = MPC_FRAME_LENGTH;
-
+ mpc_uint32_t FwdJumpInfo = 0;
mpc_uint32_t FrameBitCnt = 0;
if (d->DecodedFrames >= d->OverallFrames) {
return (mpc_uint32_t)(-1); // end of file -> abort decoding
}
- // read jump-info for validity check of frame
- d->FwdJumpInfo = mpc_decoder_bitstream_read(d, 20);
+ // add seeking info
+ if (d->seeking_table_frames < d->DecodedFrames &&
+ (d->DecodedFrames & ((1 << d->seeking_pwr) - 1)) == 0) {
+ d->seeking_table[d->DecodedFrames >> d->seeking_pwr] = mpc_decoder_bits_read(d);
+ d->seeking_table_frames = d->DecodedFrames;
+ }
- d->ActDecodePos = (d->Zaehler << 5) + d->pos;
+ // read jump-info for validity check of frame
+ FwdJumpInfo = mpc_decoder_bitstream_read(d, 20);
// decode data and check for validity of frame
FrameBitCnt = mpc_decoder_bits_read(d);
switch (d->StreamVersion) {
+#ifdef MPC_SUPPORT_SV456
case 0x04:
case 0x05:
case 0x06:
- mpc_decoder_read_bitstream_sv6(d);
+ mpc_decoder_read_bitstream_sv6(d, FALSE);
break;
+#endif
case 0x07:
case 0x17:
- mpc_decoder_read_bitstream_sv7(d);
+ mpc_decoder_read_bitstream_sv7(d, FALSE);
break;
default:
return (mpc_uint32_t)(-1);
}
- d->FrameWasValid = mpc_decoder_bits_read(d) - FrameBitCnt == d->FwdJumpInfo;
+ d->FrameWasValid = mpc_decoder_bits_read(d) - FrameBitCnt == FwdJumpInfo;
// synthesize signal
mpc_decoder_requantisierung(d, d->Max_Band);
-
- //if ( d->EQ_activated && PluginSettings.EQbyMPC )
- // perform_EQ ();
-
mpc_decoder_synthese_filter_float(d, buffer);
d->DecodedFrames++;
@@ -370,26 +349,12 @@ mpc_decoder_decode_internal(mpc_decoder *d, MPC_SAMPLE_FORMAT *buffer)
// additional FilterDecay samples are needed for decay of synthesis filter
if (MPC_DECODER_SYNTH_DELAY + mod_block >= MPC_FRAME_LENGTH) {
-
- // **********************************************************************
- // Rhoades 4/16/2002
- // Commented out are blocks of code which cause gapless playback to fail.
- // Temporary fix...
- // **********************************************************************
-
if (!d->TrueGaplessPresent) {
mpc_decoder_reset_y(d);
- }
- else {
- //if ( MPC_FRAME_LENGTH != d->LastValidSamples ) {
+ } else {
mpc_decoder_bitstream_read(d, 20);
- mpc_decoder_read_bitstream_sv7(d);
+ mpc_decoder_read_bitstream_sv7(d, FALSE);
mpc_decoder_requantisierung(d, d->Max_Band);
- //FilterDecay = d->LastValidSamples;
- //}
- //else {
- //FilterDecay = 0;
- //}
}
mpc_decoder_synthese_filter_float(d, buffer + 2304);
@@ -620,13 +585,49 @@ mpc_decoder_requantisierung(mpc_decoder *d, const mpc_int32_t Last_Band)
}
}
+#ifdef MPC_SUPPORT_SV456
+static const unsigned char Q_res[32][16] = {
+{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
+{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
+{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
+{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
+{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
+{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
+{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
+{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
+{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
+{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
+{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
+{0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0},
+{0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0},
+{0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0},
+{0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0},
+{0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0},
+{0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0},
+{0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0},
+{0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0},
+{0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0},
+{0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0},
+{0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0},
+{0,1,2,3,4,5,6,17,0,0,0,0,0,0,0,0},
+{0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0},
+{0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0},
+{0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0},
+{0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0},
+{0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0},
+{0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0},
+{0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0},
+{0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0},
+{0,1,2,17,0,0,0,0,0,0,0,0,0,0,0,0},
+};
+
/****************************************** SV 6 ******************************************/
void
-mpc_decoder_read_bitstream_sv6(mpc_decoder *d)
+mpc_decoder_read_bitstream_sv6(mpc_decoder *d, mpc_bool_t seeking)
{
mpc_int32_t n,k;
mpc_int32_t Max_used_Band=0;
- HuffmanTyp *Table;
+ const HuffmanTyp *Table;
const HuffmanTyp *x1;
const HuffmanTyp *x2;
mpc_int32_t *L;
@@ -639,15 +640,15 @@ mpc_decoder_read_bitstream_sv6(mpc_decoder *d)
ResR = d->Res_R;
for (n=0; n <= d->Max_Band; ++n, ++ResL, ++ResR)
{
- if (n<11) Table = d->Region_A;
- else if (n>=11 && n<=22) Table = d->Region_B;
- else /*if (n>=23)*/ Table = d->Region_C;
+ if (n<11) Table = mpc_table_Region_A;
+ else if (n>=11 && n<=22) Table = mpc_table_Region_B;
+ else /*if (n>=23)*/ Table = mpc_table_Region_C;
- *ResL = d->Q_res[n][mpc_decoder_huffman_decode(d, Table)];
+ *ResL = Q_res[n][mpc_decoder_huffman_decode(d, Table, 14)];
if (d->MS_used) {
d->MS_Flag[n] = mpc_decoder_bitstream_read(d, 1);
}
- *ResR = d->Q_res[n][mpc_decoder_huffman_decode(d, Table)];
+ *ResR = Q_res[n][mpc_decoder_huffman_decode(d, Table, 14)];
// only perform the following procedure up to the maximum non-zero subband
if (*ResL || *ResR) Max_used_Band = n;
@@ -657,8 +658,8 @@ mpc_decoder_read_bitstream_sv6(mpc_decoder *d)
ResL = d->Res_L;
ResR = d->Res_R;
for (n=0; n<=Max_used_Band; ++n, ++ResL, ++ResR) {
- if (*ResL) mpc_decoder_scfi_bundle_read(d, d->SCFI_Bundle, &(d->SCFI_L[n]), &(d->DSCF_Flag_L[n]));
- if (*ResR) mpc_decoder_scfi_bundle_read(d, d->SCFI_Bundle, &(d->SCFI_R[n]), &(d->DSCF_Flag_R[n]));
+ if (*ResL) mpc_decoder_scfi_bundle_read(d, mpc_table_SCFI_Bundle, &(d->SCFI_L[n]), &(d->DSCF_Flag_L[n]));
+ if (*ResR) mpc_decoder_scfi_bundle_read(d, mpc_table_SCFI_Bundle, &(d->SCFI_R[n]), &(d->DSCF_Flag_R[n]));
}
/***************************** SCFI ********************************/
@@ -673,33 +674,37 @@ mpc_decoder_read_bitstream_sv6(mpc_decoder *d)
/*********** DSCF ************/
if (d->DSCF_Flag_L[n]==1)
{
- L[2] = d->DSCF_Reference_L[n];
switch (d->SCFI_L[n])
{
case 3:
- L[0] = L[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie);
+ L[0] = L[2] + mpc_decoder_huffman_decode(d, mpc_table_DSCF_Entropie, 6);
L[1] = L[0];
L[2] = L[1];
break;
case 1:
- L[0] = L[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie);
- L[1] = L[0] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie);
+ L[0] = L[2] + mpc_decoder_huffman_decode(d, mpc_table_DSCF_Entropie, 6);
+ L[1] = L[0] + mpc_decoder_huffman_decode(d, mpc_table_DSCF_Entropie, 6);
L[2] = L[1];
break;
case 2:
- L[0] = L[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie);
+ L[0] = L[2] + mpc_decoder_huffman_decode(d, mpc_table_DSCF_Entropie, 6);
L[1] = L[0];
- L[2] = L[1] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie);
+ L[2] = L[1] + mpc_decoder_huffman_decode(d, mpc_table_DSCF_Entropie, 6);
break;
case 0:
- L[0] = L[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie);
- L[1] = L[0] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie);
- L[2] = L[1] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie);
+ L[0] = L[2] + mpc_decoder_huffman_decode(d, mpc_table_DSCF_Entropie, 6);
+ L[1] = L[0] + mpc_decoder_huffman_decode(d, mpc_table_DSCF_Entropie, 6);
+ L[2] = L[1] + mpc_decoder_huffman_decode(d, mpc_table_DSCF_Entropie, 6);
break;
default:
return;
- break;
}
+ if (L[0] > 1024)
+ L[0] = 0x8080;
+ if (L[1] > 1024)
+ L[1] = 0x8080;
+ if (L[2] > 1024)
+ L[2] = 0x8080;
}
/************ SCF ************/
else
@@ -728,44 +733,45 @@ mpc_decoder_read_bitstream_sv6(mpc_decoder *d)
break;
default:
return;
- break;
}
}
- // update Reference for DSCF
- d->DSCF_Reference_L[n] = L[2];
}
if (*ResR)
{
- R[2] = d->DSCF_Reference_R[n];
/*********** DSCF ************/
if (d->DSCF_Flag_R[n]==1)
{
switch (d->SCFI_R[n])
{
case 3:
- R[0] = R[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie);
+ R[0] = R[2] + mpc_decoder_huffman_decode(d, mpc_table_DSCF_Entropie, 6);
R[1] = R[0];
R[2] = R[1];
break;
case 1:
- R[0] = R[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie);
- R[1] = R[0] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie);
+ R[0] = R[2] + mpc_decoder_huffman_decode(d, mpc_table_DSCF_Entropie, 6);
+ R[1] = R[0] + mpc_decoder_huffman_decode(d, mpc_table_DSCF_Entropie, 6);
R[2] = R[1];
break;
case 2:
- R[0] = R[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie);
+ R[0] = R[2] + mpc_decoder_huffman_decode(d, mpc_table_DSCF_Entropie, 6);
R[1] = R[0];
- R[2] = R[1] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie);
+ R[2] = R[1] + mpc_decoder_huffman_decode(d, mpc_table_DSCF_Entropie, 6);
break;
case 0:
- R[0] = R[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie);
- R[1] = R[0] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie);
- R[2] = R[1] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie);
+ R[0] = R[2] + mpc_decoder_huffman_decode(d, mpc_table_DSCF_Entropie, 6);
+ R[1] = R[0] + mpc_decoder_huffman_decode(d, mpc_table_DSCF_Entropie, 6);
+ R[2] = R[1] + mpc_decoder_huffman_decode(d, mpc_table_DSCF_Entropie, 6);
break;
default:
return;
- break;
}
+ if (R[0] > 1024)
+ R[0] = 0x8080;
+ if (R[1] > 1024)
+ R[1] = 0x8080;
+ if (R[2] > 1024)
+ R[2] = 0x8080;
}
/************ SCF ************/
else
@@ -797,27 +803,28 @@ mpc_decoder_read_bitstream_sv6(mpc_decoder *d)
break;
}
}
- // update Reference for DSCF
- d->DSCF_Reference_R[n] = R[2];
}
}
+ if (seeking == TRUE)
+ return;
+
/**************************** Samples ****************************/
ResL = d->Res_L;
ResR = d->Res_R;
for (n=0; n <= Max_used_Band; ++n, ++ResL, ++ResR)
{
// setting pointers
- x1 = d->SampleHuff[*ResL];
- x2 = d->SampleHuff[*ResR];
+ x1 = mpc_table_SampleHuff[*ResL];
+ x2 = mpc_table_SampleHuff[*ResR];
L = d->Q[n].L;
R = d->Q[n].R;
if (x1!=NULL || x2!=NULL)
for (k=0; k<36; ++k)
{
- if (x1 != NULL) *L++ = mpc_decoder_huffman_decode_fast(d, x1);
- if (x2 != NULL) *R++ = mpc_decoder_huffman_decode_fast(d, x2);
+ if (x1 != NULL) *L++ = mpc_decoder_huffman_decode(d, x1, 8);
+ if (x2 != NULL) *R++ = mpc_decoder_huffman_decode(d, x2, 8);
}
if (*ResL>7 || *ResR>7)
@@ -828,17 +835,17 @@ mpc_decoder_read_bitstream_sv6(mpc_decoder *d)
}
}
}
-
+#endif //MPC_SUPPORT_SV456
/****************************************** SV 7 ******************************************/
void
-mpc_decoder_read_bitstream_sv7(mpc_decoder *d)
+mpc_decoder_read_bitstream_sv7(mpc_decoder *d, mpc_bool_t seeking)
{
// these arrays hold decoding results for bundled quantizers (3- and 5-step)
- /*static*/ mpc_int32_t idx30[] = { -1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1};
- /*static*/ mpc_int32_t idx31[] = { -1,-1,-1, 0, 0, 0, 1, 1, 1,-1,-1,-1, 0, 0, 0, 1, 1, 1,-1,-1,-1, 0, 0, 0, 1, 1, 1};
- /*static*/ mpc_int32_t idx32[] = { -1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1};
- /*static*/ mpc_int32_t idx50[] = { -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2};
- /*static*/ mpc_int32_t idx51[] = { -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2};
+ static const mpc_int32_t idx30[] = { -1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1};
+ static const mpc_int32_t idx31[] = { -1,-1,-1, 0, 0, 0, 1, 1, 1,-1,-1,-1, 0, 0, 0, 1, 1, 1,-1,-1,-1, 0, 0, 0, 1, 1, 1};
+ static const mpc_int32_t idx32[] = { -1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+ static const mpc_int32_t idx50[] = { -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2};
+ static const mpc_int32_t idx51[] = { -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2};
mpc_int32_t n,k;
mpc_int32_t Max_used_Band=0;
@@ -863,11 +870,11 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d)
++ResL; ++ResR; // increase pointers
for (n=1; n <= d->Max_Band; ++n, ++ResL, ++ResR)
{
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffHdr);
- *ResL = (idx!=4) ? *(ResL-1) + idx : mpc_decoder_bitstream_read(d, 4);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffHdr, 9);
+ *ResL = (idx!=4) ? *(ResL-1) + idx : (int) mpc_decoder_bitstream_read(d, 4);
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffHdr);
- *ResR = (idx!=4) ? *(ResR-1) + idx : mpc_decoder_bitstream_read(d, 4);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffHdr, 9);
+ *ResR = (idx!=4) ? *(ResR-1) + idx : (int) mpc_decoder_bitstream_read(d, 4);
if (d->MS_used && !(*ResL==0 && *ResR==0)) {
d->MS_Flag[n] = mpc_decoder_bitstream_read(d, 1);
@@ -884,8 +891,8 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d)
ResL = d->Res_L;
ResR = d->Res_R;
for (n=0; n <= Max_used_Band; ++n, ++L, ++R, ++ResL, ++ResR) {
- if (*ResL) *L = mpc_decoder_huffman_decode_faster(d, d->HuffSCFI);
- if (*ResR) *R = mpc_decoder_huffman_decode_faster(d, d->HuffSCFI);
+ if (*ResL) *L = mpc_decoder_huffman_decode(d, mpc_table_HuffSCFI, 3);
+ if (*ResR) *R = mpc_decoder_huffman_decode(d, mpc_table_HuffSCFI, 3);
}
/**************************** SCF/DSCF ****************************/
@@ -896,85 +903,93 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d)
for (n=0; n<=Max_used_Band; ++n, ++ResL, ++ResR, L+=3, R+=3) {
if (*ResL)
{
- L[2] = d->DSCF_Reference_L[n];
switch (d->SCFI_L[n])
{
case 1:
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
- L[0] = (idx!=8) ? L[2] + idx : mpc_decoder_bitstream_read(d, 6);
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
- L[1] = (idx!=8) ? L[0] + idx : mpc_decoder_bitstream_read(d, 6);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffDSCF, 6);
+ L[0] = (idx!=8) ? L[2] + idx : (int) mpc_decoder_bitstream_read(d, 6);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffDSCF, 6);
+ L[1] = (idx!=8) ? L[0] + idx : (int) mpc_decoder_bitstream_read(d, 6);
L[2] = L[1];
break;
case 3:
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
- L[0] = (idx!=8) ? L[2] + idx : mpc_decoder_bitstream_read(d, 6);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffDSCF, 6);
+ L[0] = (idx!=8) ? L[2] + idx : (int) mpc_decoder_bitstream_read(d, 6);
L[1] = L[0];
L[2] = L[1];
break;
case 2:
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
- L[0] = (idx!=8) ? L[2] + idx : mpc_decoder_bitstream_read(d, 6);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffDSCF, 6);
+ L[0] = (idx!=8) ? L[2] + idx : (int) mpc_decoder_bitstream_read(d, 6);
L[1] = L[0];
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
- L[2] = (idx!=8) ? L[1] + idx : mpc_decoder_bitstream_read(d, 6);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffDSCF, 6);
+ L[2] = (idx!=8) ? L[1] + idx : (int) mpc_decoder_bitstream_read(d, 6);
break;
case 0:
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
- L[0] = (idx!=8) ? L[2] + idx : mpc_decoder_bitstream_read(d, 6);
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
- L[1] = (idx!=8) ? L[0] + idx : mpc_decoder_bitstream_read(d, 6);
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
- L[2] = (idx!=8) ? L[1] + idx : mpc_decoder_bitstream_read(d, 6);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffDSCF, 6);
+ L[0] = (idx!=8) ? L[2] + idx : (int) mpc_decoder_bitstream_read(d, 6);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffDSCF, 6);
+ L[1] = (idx!=8) ? L[0] + idx : (int) mpc_decoder_bitstream_read(d, 6);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffDSCF, 6);
+ L[2] = (idx!=8) ? L[1] + idx : (int) mpc_decoder_bitstream_read(d, 6);
break;
default:
return;
- break;
}
- // update Reference for DSCF
- d->DSCF_Reference_L[n] = L[2];
+ if (L[0] > 1024)
+ L[0] = 0x8080;
+ if (L[1] > 1024)
+ L[1] = 0x8080;
+ if (L[2] > 1024)
+ L[2] = 0x8080;
}
if (*ResR)
{
- R[2] = d->DSCF_Reference_R[n];
switch (d->SCFI_R[n])
{
case 1:
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
- R[0] = (idx!=8) ? R[2] + idx : mpc_decoder_bitstream_read(d, 6);
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
- R[1] = (idx!=8) ? R[0] + idx : mpc_decoder_bitstream_read(d, 6);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffDSCF, 6);
+ R[0] = (idx!=8) ? R[2] + idx : (int) mpc_decoder_bitstream_read(d, 6);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffDSCF, 6);
+ R[1] = (idx!=8) ? R[0] + idx : (int) mpc_decoder_bitstream_read(d, 6);
R[2] = R[1];
break;
case 3:
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
- R[0] = (idx!=8) ? R[2] + idx : mpc_decoder_bitstream_read(d, 6);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffDSCF, 6);
+ R[0] = (idx!=8) ? R[2] + idx : (int) mpc_decoder_bitstream_read(d, 6);
R[1] = R[0];
R[2] = R[1];
break;
case 2:
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
- R[0] = (idx!=8) ? R[2] + idx : mpc_decoder_bitstream_read(d, 6);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffDSCF, 6);
+ R[0] = (idx!=8) ? R[2] + idx : (int) mpc_decoder_bitstream_read(d, 6);
R[1] = R[0];
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
- R[2] = (idx!=8) ? R[1] + idx : mpc_decoder_bitstream_read(d, 6);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffDSCF, 6);
+ R[2] = (idx!=8) ? R[1] + idx : (int) mpc_decoder_bitstream_read(d, 6);
break;
case 0:
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
- R[0] = (idx!=8) ? R[2] + idx : mpc_decoder_bitstream_read(d, 6);
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
- R[1] = (idx!=8) ? R[0] + idx : mpc_decoder_bitstream_read(d, 6);
- idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
- R[2] = (idx!=8) ? R[1] + idx : mpc_decoder_bitstream_read(d, 6);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffDSCF, 6);
+ R[0] = (idx!=8) ? R[2] + idx : (int) mpc_decoder_bitstream_read(d, 6);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffDSCF, 6);
+ R[1] = (idx!=8) ? R[0] + idx : (int) mpc_decoder_bitstream_read(d, 6);
+ idx = mpc_decoder_huffman_decode(d, mpc_table_HuffDSCF, 6);
+ R[2] = (idx!=8) ? R[1] + idx : (int) mpc_decoder_bitstream_read(d, 6);
break;
default:
return;
- break;
}
- // update Reference for DSCF
- d->DSCF_Reference_R[n] = R[2];
+ if (R[0] > 1024)
+ R[0] = 0x8080;
+ if (R[1] > 1024)
+ R[1] = 0x8080;
+ if (R[2] > 1024)
+ R[2] = 0x8080;
}
}
+
+ if (seeking == TRUE)
+ return;
+
/***************************** Samples ****************************/
ResL = d->Res_L;
ResR = d->Res_R;
@@ -991,7 +1006,7 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d)
break;
case -1:
for (k=0; k<36; k++ ) {
- tmp = random_int(d);
+ tmp = mpc_random_int(d);
*L++ = ((tmp >> 24) & 0xFF) + ((tmp >> 16) & 0xFF) + ((tmp >> 8) & 0xFF) + ((tmp >> 0) & 0xFF) - 510;
}
break;
@@ -999,40 +1014,40 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d)
L += 36;// increase pointer
break;
case 1:
- Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][1];
+ Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][1];
for (k=0; k<12; ++k)
{
- idx = mpc_decoder_huffman_decode_fast(d, Table);
+ idx = mpc_decoder_huffman_decode(d, Table, 9);
*L++ = idx30[idx];
*L++ = idx31[idx];
*L++ = idx32[idx];
}
break;
case 2:
- Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][2];
+ Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][2];
for (k=0; k<18; ++k)
{
- idx = mpc_decoder_huffman_decode_fast(d, Table);
+ idx = mpc_decoder_huffman_decode(d, Table, 10);
*L++ = idx50[idx];
*L++ = idx51[idx];
}
break;
case 3:
case 4:
- Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResL];
+ Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResL];
for (k=0; k<36; ++k)
- *L++ = mpc_decoder_huffman_decode_faster(d, Table);
+ *L++ = mpc_decoder_huffman_decode(d, Table, 5);
break;
case 5:
- Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResL];
+ Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResL];
for (k=0; k<36; ++k)
- *L++ = mpc_decoder_huffman_decode_fast(d, Table);
+ *L++ = mpc_decoder_huffman_decode(d, Table, 8);
break;
case 6:
case 7:
- Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResL];
+ Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResL];
for (k=0; k<36; ++k)
- *L++ = mpc_decoder_huffman_decode(d, Table);
+ *L++ = mpc_decoder_huffman_decode(d, Table, 14);
break;
case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17:
tmp = Dc[*ResL];
@@ -1051,7 +1066,7 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d)
break;
case -1:
for (k=0; k<36; k++ ) {
- tmp = random_int(d);
+ tmp = mpc_random_int(d);
*R++ = ((tmp >> 24) & 0xFF) + ((tmp >> 16) & 0xFF) + ((tmp >> 8) & 0xFF) + ((tmp >> 0) & 0xFF) - 510;
}
break;
@@ -1059,40 +1074,40 @@ mpc_decoder_read_bitstream_sv7(mpc_decoder *d)
R += 36;// increase pointer
break;
case 1:
- Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][1];
+ Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][1];
for (k=0; k<12; ++k)
{
- idx = mpc_decoder_huffman_decode_fast(d, Table);
+ idx = mpc_decoder_huffman_decode(d, Table, 9);
*R++ = idx30[idx];
*R++ = idx31[idx];
*R++ = idx32[idx];
}
break;
case 2:
- Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][2];
+ Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][2];
for (k=0; k<18; ++k)
{
- idx = mpc_decoder_huffman_decode_fast(d, Table);
+ idx = mpc_decoder_huffman_decode(d, Table, 10);
*R++ = idx50[idx];
*R++ = idx51[idx];
}
break;
case 3:
case 4:
- Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResR];
+ Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResR];
for (k=0; k<36; ++k)
- *R++ = mpc_decoder_huffman_decode_faster(d, Table);
+ *R++ = mpc_decoder_huffman_decode(d, Table, 5);
break;
case 5:
- Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResR];
+ Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResR];
for (k=0; k<36; ++k)
- *R++ = mpc_decoder_huffman_decode_fast(d, Table);
+ *R++ = mpc_decoder_huffman_decode(d, Table, 8);
break;
case 6:
case 7:
- Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResR];
+ Table = mpc_table_HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResR];
for (k=0; k<36; ++k)
- *R++ = mpc_decoder_huffman_decode(d, Table);
+ *R++ = mpc_decoder_huffman_decode(d, Table, 14);
break;
case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17:
tmp = Dc[*ResR];
@@ -1109,72 +1124,44 @@ void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r)
{
d->r = r;
- d->HuffQ[0][0] = 0;
- d->HuffQ[1][0] = 0;
- d->HuffQ[0][1] = d->HuffQ1[0];
- d->HuffQ[1][1] = d->HuffQ1[1];
- d->HuffQ[0][2] = d->HuffQ2[0];
- d->HuffQ[1][2] = d->HuffQ2[1];
- d->HuffQ[0][3] = d->HuffQ3[0];
- d->HuffQ[1][3] = d->HuffQ3[1];
- d->HuffQ[0][4] = d->HuffQ4[0];
- d->HuffQ[1][4] = d->HuffQ4[1];
- d->HuffQ[0][5] = d->HuffQ5[0];
- d->HuffQ[1][5] = d->HuffQ5[1];
- d->HuffQ[0][6] = d->HuffQ6[0];
- d->HuffQ[1][6] = d->HuffQ6[1];
- d->HuffQ[0][7] = d->HuffQ7[0];
- d->HuffQ[1][7] = d->HuffQ7[1];
-
- d->SampleHuff[0] = NULL;
- d->SampleHuff[1] = d->Entropie_1;
- d->SampleHuff[2] = d->Entropie_2;
- d->SampleHuff[3] = d->Entropie_3;
- d->SampleHuff[4] = d->Entropie_4;
- d->SampleHuff[5] = d->Entropie_5;
- d->SampleHuff[6] = d->Entropie_6;
- d->SampleHuff[7] = d->Entropie_7;
- d->SampleHuff[8] = NULL;
- d->SampleHuff[9] = NULL;
- d->SampleHuff[10] = NULL;
- d->SampleHuff[11] = NULL;
- d->SampleHuff[12] = NULL;
- d->SampleHuff[13] = NULL;
- d->SampleHuff[14] = NULL;
- d->SampleHuff[15] = NULL;
- d->SampleHuff[16] = NULL;
- d->SampleHuff[17] = NULL;
-
- d->EQ_activated = 0;
d->MPCHeaderPos = 0;
d->StreamVersion = 0;
d->MS_used = 0;
- d->FwdJumpInfo = 0;
- d->ActDecodePos = 0;
d->FrameWasValid = 0;
d->OverallFrames = 0;
d->DecodedFrames = 0;
- d->LastValidSamples = 0;
d->TrueGaplessPresent = 0;
d->WordsRead = 0;
d->Max_Band = 0;
d->SampleRate = 0;
-// clips = 0;
d->__r1 = 1;
d->__r2 = 1;
- d->dword = 0;
- d->pos = 0;
- d->Zaehler = 0;
- d->WordsRead = 0;
d->Max_Band = 0;
+ d->seeking_window = FAST_SEEKING_WINDOW;
+ mpc_decoder_reset_bitstream_decode(d);
mpc_decoder_initialisiere_quantisierungstabellen(d, 1.0f);
+#if 0
mpc_decoder_init_huffman_sv6(d);
mpc_decoder_init_huffman_sv7(d);
+#endif
}
-static void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si)
+static mpc_uint32_t get_initial_fpos(mpc_decoder *d)
+{
+ mpc_uint32_t fpos = 0;
+ switch ( d->StreamVersion ) { // setting position to the beginning of the data-bitstream
+ case 0x04: fpos = 48; break;
+ case 0x05:
+ case 0x06: fpos = 64; break;
+ case 0x07:
+ case 0x17: fpos = 200; break;
+ }
+ return fpos;
+}
+
+void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si)
{
mpc_decoder_reset_synthesis(d);
mpc_decoder_reset_globals(d);
@@ -1184,7 +1171,6 @@ static void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si)
d->Max_Band = si->max_band;
d->OverallFrames = si->frames;
d->MPCHeaderPos = si->header_position;
- d->LastValidSamples = si->last_frame_samples;
d->TrueGaplessPresent = si->is_true_gapless;
d->SampleRate = (mpc_int32_t)si->sample_freq;
@@ -1196,72 +1182,22 @@ mpc_bool_t mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si)
mpc_decoder_set_streaminfo(d, si);
// AB: setting position to the beginning of the data-bitstream
- switch (d->StreamVersion) {
- case 0x04: f_seek(d, 4 + d->MPCHeaderPos); d->pos = 16; break; // Geht auch über eine der Helperfunktionen
- case 0x05:
- case 0x06: f_seek(d, 8 + d->MPCHeaderPos); d->pos = 0; break;
- case 0x07:
- case 0x17: /*f_seek ( 24 + d->MPCHeaderPos );*/ d->pos = 8; break;
- default: return FALSE;
- }
+ mpc_decoder_seek(d, get_initial_fpos(d));
- // AB: fill buffer and initialize decoder
- f_read_dword(d, d->Speicher, MEMSIZE );
- d->dword = d->Speicher[d->Zaehler = 0];
+ d->seeking_pwr = 0;
+ while (d->OverallFrames > (SEEKING_TABLE_SIZE << d->seeking_pwr))
+ d->seeking_pwr++;
+ d->seeking_table_frames = 0;
+ d->seeking_table[0] = get_initial_fpos(d);
return TRUE;
}
-//---------------------------------------------------------------
-// will seek from the beginning of the file to the desired
-// position in ms (given by seek_needed)
-//---------------------------------------------------------------
-#if 0
-static void
-helper1(mpc_decoder *d, mpc_uint32_t bitpos)
-{
- f_seek(d, (bitpos >> 5) * 4 + d->MPCHeaderPos);
- f_read_dword(d, d->Speicher, 2);
- d->dword = d->Speicher[d->Zaehler = 0];
- d->pos = bitpos & 31;
-}
-#endif
-
-static void
-helper2(mpc_decoder *d, mpc_uint32_t bitpos)
-{
- f_seek(d, (bitpos>>5) * 4 + d->MPCHeaderPos);
- f_read_dword(d, d->Speicher, MEMSIZE);
- d->dword = d->Speicher[d->Zaehler = 0];
- d->pos = bitpos & 31;
-}
-
-#if 0
-static void
-helper3(mpc_decoder *d, mpc_uint32_t bitpos, mpc_uint32_t* buffoffs)
+void mpc_decoder_set_seeking(mpc_decoder *d, mpc_streaminfo *si, mpc_bool_t fast_seeking)
{
- d->pos = bitpos & 31;
- bitpos >>= 5;
- if ((mpc_uint32_t)(bitpos - *buffoffs) >= MEMSIZE - 2) {
- *buffoffs = bitpos;
- f_seek(d, bitpos * 4L + d->MPCHeaderPos);
- f_read_dword(d, d->Speicher, MEMSIZE );
- }
- d->dword = d->Speicher[d->Zaehler = bitpos - *buffoffs ];
-}
-#endif
-
-static mpc_uint32_t get_initial_fpos(mpc_decoder *d, mpc_uint32_t StreamVersion)
-{
- mpc_uint32_t fpos = 0;
- switch ( d->StreamVersion ) { // setting position to the beginning of the data-bitstream
- case 0x04: fpos = 48; break;
- case 0x05:
- case 0x06: fpos = 64; break;
- case 0x07:
- case 0x17: fpos = 200; break;
- }
- return fpos;
+ d->seeking_window = FAST_SEEKING_WINDOW;
+ if (si->fast_seek == 0 && fast_seeking == 0)
+ d->seeking_window = SLOW_SEEKING_WINDOW;
}
mpc_bool_t mpc_decoder_seek_seconds(mpc_decoder *d, double seconds)
@@ -1277,73 +1213,59 @@ mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample)
fwd = (mpc_uint32_t) (destsample / MPC_FRAME_LENGTH);
d->samples_to_skip = MPC_DECODER_SYNTH_DELAY + (mpc_uint32_t)(destsample % MPC_FRAME_LENGTH);
- memset(d->Y_L , 0, sizeof d->Y_L );
- memset(d->Y_R , 0, sizeof d->Y_R );
- memset(d->SCF_Index_L , 0, sizeof d->SCF_Index_L );
- memset(d->SCF_Index_R , 0, sizeof d->SCF_Index_R );
- memset(d->Res_L , 0, sizeof d->Res_L );
- memset(d->Res_R , 0, sizeof d->Res_R );
- memset(d->SCFI_L , 0, sizeof d->SCFI_L );
- memset(d->SCFI_R , 0, sizeof d->SCFI_R );
- memset(d->DSCF_Flag_L , 0, sizeof d->DSCF_Flag_L );
- memset(d->DSCF_Flag_R , 0, sizeof d->DSCF_Flag_R );
- memset(d->DSCF_Reference_L, 0, sizeof d->DSCF_Reference_L );
- memset(d->DSCF_Reference_R, 0, sizeof d->DSCF_Reference_R );
- memset(d->Q , 0, sizeof d->Q );
- memset(d->MS_Flag , 0, sizeof d->MS_Flag );
-
// resetting synthesis filter to avoid "clicks"
mpc_decoder_reset_synthesis(d);
// prevent from desired position out of allowed range
fwd = fwd < d->OverallFrames ? fwd : d->OverallFrames;
- // reset number of decoded frames
- d->DecodedFrames = 0;
-
- fpos = get_initial_fpos(d, d->StreamVersion);
- if (fpos == 0) {
- return FALSE;
+ if (fwd > d->DecodedFrames + d->seeking_window || fwd < d->DecodedFrames) {
+ memset(d->SCF_Index_L, 1, sizeof d->SCF_Index_L );
+ memset(d->SCF_Index_R, 1, sizeof d->SCF_Index_R );
}
- helper2(d, fpos);
+ if (d->seeking_table_frames > d->DecodedFrames || fwd < d->DecodedFrames) {
+ d->DecodedFrames = 0;
+ if (fwd > d->seeking_window)
+ d->DecodedFrames = (fwd - d->seeking_window) & (-1 << d->seeking_pwr);
+ if (d->DecodedFrames > d->seeking_table_frames)
+ d->DecodedFrames = d->seeking_table_frames;
+ fpos = d->seeking_table[d->DecodedFrames >> d->seeking_pwr];
+ mpc_decoder_seek(d, fpos);
+ }
// read the last 32 frames before the desired position to scan the scalefactors (artifactless jumping)
for ( ; d->DecodedFrames < fwd; d->DecodedFrames++ ) {
- mpc_uint32_t FrameBitCnt;
- mpc_uint32_t RING;
- RING = d->Zaehler;
- d->FwdJumpInfo = mpc_decoder_bitstream_read(d, 20); // read jump-info
- d->ActDecodePos = (d->Zaehler << 5) + d->pos;
- FrameBitCnt = mpc_decoder_bits_read(d); // scanning the scalefactors and check for validity of frame
- if (d->StreamVersion >= 7) {
- mpc_decoder_read_bitstream_sv7(d);
- }
- else {
- mpc_decoder_read_bitstream_sv6(d);
- }
- if (mpc_decoder_bits_read(d) - FrameBitCnt != d->FwdJumpInfo ) {
- // Box ("Bug in perform_jump");
- return FALSE;
- }
- // update buffer
- if ((RING ^ d->Zaehler) & MEMSIZE2) {
- f_read_dword(d, d->Speicher + (RING & MEMSIZE2), MEMSIZE2);
+ mpc_uint32_t RING = d->Zaehler;
+ mpc_uint32_t FwdJumpInfo;
+
+ // add seeking info
+ if (d->seeking_table_frames < d->DecodedFrames &&
+ (d->DecodedFrames & ((1 << d->seeking_pwr) - 1)) == 0) {
+ d->seeking_table[d->DecodedFrames >> d->seeking_pwr] = mpc_decoder_bits_read(d);
+ d->seeking_table_frames = d->DecodedFrames;
}
- }
- // LastBitsRead = BitsRead ();
- // LastFrame = d->DecodedFrames;
+ // read jump-info
+ FwdJumpInfo = mpc_decoder_bitstream_read(d, 20);
+ FwdJumpInfo += mpc_decoder_bits_read(d);
- return TRUE;
-}
+ if (fwd <= d->DecodedFrames + d->seeking_window) {
+ if (d->StreamVersion >= 7) {
+ mpc_decoder_read_bitstream_sv7(d, TRUE);
+ } else {
+#ifdef MPC_SUPPORT_SV456
+ mpc_decoder_read_bitstream_sv6(d, TRUE);
+#else
+ return FALSE;
+#endif
+ }
+ }
+ mpc_decoder_bitstream_jump(d, FwdJumpInfo - mpc_decoder_bits_read(d));
-void mpc_decoder_update_buffer(mpc_decoder *d, mpc_uint32_t RING)
-{
- if ((RING ^ d->Zaehler) & MEMSIZE2 ) {
// update buffer
- f_read_dword(d, d->Speicher + (RING & MEMSIZE2), MEMSIZE2);
+ mpc_decoder_update_buffer(d, RING);
}
-}
-
+ return TRUE;
+}
diff --git a/src/libmusepack/mpc_reader.c b/contrib/libmpcdec/mpc_reader.c
index 5ed913698..1d0accc01 100644
--- a/src/libmusepack/mpc_reader.c
+++ b/contrib/libmpcdec/mpc_reader.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004, The Musepack Development Team
+ Copyright (c) 2005, The Musepack Development Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -35,29 +35,29 @@
/// \file mpc_reader.c
/// Contains implementations for simple file-based mpc_reader
-#include "musepack/musepack.h"
+#include <mpcdec/mpcdec.h>
/// mpc_reader callback implementations
static mpc_int32_t
read_impl(void *data, void *ptr, mpc_int32_t size)
{
- mpc_reader *d = (mpc_reader *) data;
+ mpc_reader_file *d = (mpc_reader_file *) data;
- return fread(ptr, 1, size, d->file);
+ return (mpc_int32_t) fread(ptr, 1, size, d->file);
}
static mpc_bool_t
-seek_impl(void *data, int offset)
+seek_impl(void *data, mpc_int32_t offset)
{
- mpc_reader *d = (mpc_reader *) data;
+ mpc_reader_file *d = (mpc_reader_file *) data;
- return d->is_seekable ? !fseek(d->file, offset, SEEK_SET) : FALSE;
+ return d->is_seekable ? fseek(d->file, offset, SEEK_SET) == 0 : FALSE;
}
static mpc_int32_t
tell_impl(void *data)
{
- mpc_reader *d = (mpc_reader *) data;
+ mpc_reader_file *d = (mpc_reader_file *) data;
return ftell(d->file);
}
@@ -65,7 +65,7 @@ tell_impl(void *data)
static mpc_int32_t
get_size_impl(void *data)
{
- mpc_reader *d = (mpc_reader *) data;
+ mpc_reader_file *d = (mpc_reader_file *) data;
return d->file_size;
}
@@ -73,24 +73,24 @@ get_size_impl(void *data)
static mpc_bool_t
canseek_impl(void *data)
{
- mpc_reader *d = (mpc_reader *) data;
+ mpc_reader_file *d = (mpc_reader_file *) data;
return d->is_seekable;
}
void
-mpc_reader_setup_file_reader(mpc_reader *reader, FILE *input)
+mpc_reader_setup_file_reader(mpc_reader_file *p_reader, FILE *input)
{
- reader->seek = seek_impl;
- reader->read = read_impl;
- reader->tell = tell_impl;
- reader->get_size = get_size_impl;
- reader->canseek = canseek_impl;
- reader->data = reader; // point back to ourselves
-
- reader->file = input;
- reader->is_seekable = TRUE;
- fseek(reader->file, 0, SEEK_END);
- reader->file_size = ftell(reader->file);
- fseek(reader->file, 0, SEEK_SET);
+ p_reader->reader.seek = seek_impl;
+ p_reader->reader.read = read_impl;
+ p_reader->reader.tell = tell_impl;
+ p_reader->reader.get_size = get_size_impl;
+ p_reader->reader.canseek = canseek_impl;
+ p_reader->reader.data = p_reader; // point back to ourselves
+
+ p_reader->file = input;
+ p_reader->is_seekable = TRUE;
+ fseek(input, 0, SEEK_END);
+ p_reader->file_size = ftell(input);
+ fseek(input, 0, SEEK_SET);
}
diff --git a/contrib/libmpcdec/mpcdec/config_types.h b/contrib/libmpcdec/mpcdec/config_types.h
new file mode 100644
index 000000000..97197d048
--- /dev/null
+++ b/contrib/libmpcdec/mpcdec/config_types.h
@@ -0,0 +1,50 @@
+/*
+ Copyright (c) 2005, The Musepack Development Team
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of the The Musepack Development Team nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef __MUSEPACK_CONFIG_TYPES_H__
+#define __MUSEPACK_CONFIG_TYPES_H__
+
+#include "os_types.h"
+
+typedef unsigned char mpc_bool_t;
+#define TRUE 1
+#define FALSE 0
+
+typedef int16_t mpc_int16_t;
+typedef uint16_t mpc_uint16_t;
+typedef int32_t mpc_int32_t;
+typedef uint32_t mpc_uint32_t;
+typedef int64_t mpc_int64_t;
+
+#endif // __MUSEPACK_CONFIG_TYPES_H__
diff --git a/contrib/libmpcdec/mpcdec/decoder.h b/contrib/libmpcdec/mpcdec/decoder.h
new file mode 100644
index 000000000..9a737453e
--- /dev/null
+++ b/contrib/libmpcdec/mpcdec/decoder.h
@@ -0,0 +1,124 @@
+/*
+ Copyright (c) 2005, The Musepack Development Team
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of the The Musepack Development Team nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/// \file decoder.h
+
+#ifndef _mpcdec_decoder_h_
+#define _mpcdec_decoder_h_
+
+#include "huffman.h"
+#include "math.h"
+#include "mpcdec.h"
+#include "reader.h"
+#include "streaminfo.h"
+
+#define MPC_SUPPORT_SV456
+
+#define SEEKING_TABLE_SIZE 256u
+// set it to SLOW_SEEKING_WINDOW to not use fast seeking
+#define FAST_SEEKING_WINDOW 32
+// set it to FAST_SEEKING_WINDOW to only use fast seeking
+#define SLOW_SEEKING_WINDOW 0x80000000
+
+enum {
+ MPC_V_MEM = 2304,
+ MPC_DECODER_MEMSIZE = 16384, // overall buffer size
+};
+
+typedef struct {
+ mpc_int32_t L [36];
+ mpc_int32_t R [36];
+} QuantTyp;
+
+typedef struct mpc_decoder_t {
+ mpc_reader *r;
+
+ /// @name internal state variables
+ //@{
+
+ mpc_uint32_t dword; /// currently decoded 32bit-word
+ mpc_uint32_t pos; /// bit-position within dword
+ mpc_uint32_t Speicher[MPC_DECODER_MEMSIZE]; /// read-buffer
+ mpc_uint32_t Zaehler; /// actual index within read-buffer
+
+ mpc_uint32_t samples_to_skip;
+
+ mpc_uint32_t DecodedFrames;
+ mpc_uint32_t OverallFrames;
+ mpc_int32_t SampleRate; // Sample frequency
+
+ mpc_uint32_t StreamVersion; // version of bitstream
+ mpc_int32_t Max_Band;
+ mpc_uint32_t MPCHeaderPos; // AB: needed to support ID3v2
+
+ mpc_uint32_t FrameWasValid;
+ mpc_uint32_t MS_used; // MS-coding used ?
+ mpc_uint32_t TrueGaplessPresent;
+
+ mpc_uint32_t WordsRead; // counts amount of decoded dwords
+
+ // randomizer state variables
+ mpc_uint32_t __r1;
+ mpc_uint32_t __r2;
+
+ // seeking
+ mpc_uint32_t seeking_table[SEEKING_TABLE_SIZE];
+ mpc_uint32_t seeking_pwr; // distance between 2 frames in seeking_table = 2^seeking_pwr
+ mpc_uint32_t seeking_table_frames; // last frame in seaking table
+ mpc_uint32_t seeking_window; // number of frames to look for scalefactors
+
+ mpc_int32_t SCF_Index_L [32] [3];
+ mpc_int32_t SCF_Index_R [32] [3]; // holds scalefactor-indices
+ QuantTyp Q [32]; // holds quantized samples
+ mpc_int32_t Res_L [32];
+ mpc_int32_t Res_R [32]; // holds the chosen quantizer for each subband
+ mpc_bool_t DSCF_Flag_L [32];
+ mpc_bool_t DSCF_Flag_R [32]; // differential SCF used?
+ mpc_int32_t SCFI_L [32];
+ mpc_int32_t SCFI_R [32]; // describes order of transmitted SCF
+ mpc_bool_t MS_Flag[32]; // MS used?
+#ifdef MPC_FIXED_POINT
+ unsigned char SCF_shift[256];
+#endif
+
+ MPC_SAMPLE_FORMAT V_L[MPC_V_MEM + 960];
+ MPC_SAMPLE_FORMAT V_R[MPC_V_MEM + 960];
+ MPC_SAMPLE_FORMAT Y_L[36][32];
+ MPC_SAMPLE_FORMAT Y_R[36][32];
+ MPC_SAMPLE_FORMAT SCF[256]; ///< holds adapted scalefactors (for clipping prevention)
+ //@}
+
+} mpc_decoder;
+
+#endif // _mpc_decoder_h
diff --git a/contrib/libmpcdec/mpcdec/huffman.h b/contrib/libmpcdec/mpcdec/huffman.h
new file mode 100644
index 000000000..99d02ce71
--- /dev/null
+++ b/contrib/libmpcdec/mpcdec/huffman.h
@@ -0,0 +1,58 @@
+/*
+ Copyright (c) 2005, The Musepack Development Team
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of the The Musepack Development Team nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/// \file huffman.h
+/// Data structures and functions for huffman coding.
+
+#ifndef _mpcdec_huffman_h_
+#define _mpcdec_huffman_h_
+
+#ifndef WIN32
+#include "mpcdec/config_types.h"
+#else
+#include "mpcdec/config_win32.h"
+#endif
+
+#include "decoder.h"
+
+struct mpc_decoder_t; // forward declare to break circular dependencies
+
+/// Huffman table entry.
+typedef struct huffman_type_t {
+ mpc_uint32_t Code;
+ mpc_uint16_t Length;
+ mpc_int16_t Value;
+} HuffmanTyp;
+
+#endif // _mpcdec_huffman_h_
diff --git a/contrib/libmpcdec/mpcdec/internal.h b/contrib/libmpcdec/mpcdec/internal.h
new file mode 100644
index 000000000..19642a240
--- /dev/null
+++ b/contrib/libmpcdec/mpcdec/internal.h
@@ -0,0 +1,65 @@
+/*
+ Copyright (c) 2005, The Musepack Development Team
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of the The Musepack Development Team nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/// \file internal.h
+/// Definitions and structures used only internally by the libmpcdec.
+
+#ifndef _mpcdec_internal_h
+#define _mpcdec_internal_h
+
+
+enum {
+ MPC_DECODER_SYNTH_DELAY = 481
+};
+
+/// Big/little endian 32 bit byte swapping routine.
+static __inline
+mpc_uint32_t mpc_swap32(mpc_uint32_t val) {
+ return (((val & 0xff000000) >> 24) | ((val & 0x00ff0000) >> 8) |
+ ((val & 0x0000ff00) << 8) | ((val & 0x000000ff) << 24));
+}
+
+/// Searches for a ID3v2-tag and reads the length (in bytes) of it.
+/// \param reader supplying raw stream data
+/// \return size of tag, in bytes
+/// \return -1 on errors of any kind
+mpc_int32_t JumpID3v2(mpc_reader* fp);
+
+/// helper functions used by multiple files
+mpc_uint32_t mpc_random_int(mpc_decoder *d); // in synth_filter.c
+void mpc_decoder_initialisiere_quantisierungstabellen(mpc_decoder *d, double scale_factor);
+void mpc_decoder_synthese_filter_float(mpc_decoder *d, MPC_SAMPLE_FORMAT* OutData);
+
+#endif // _mpcdec_internal_h
+
diff --git a/src/libmusepack/musepack/math.h b/contrib/libmpcdec/mpcdec/math.h
index f3d52c504..31d078896 100644
--- a/src/libmusepack/musepack/math.h
+++ b/contrib/libmpcdec/mpcdec/math.h
@@ -1,8 +1,42 @@
-/// \file mpc_math.h
-/// Libmusepack internal math routines.
-
-#ifndef _musepack_math_h_
-#define _musepack_math_h_
+/*
+ Copyright (c) 2005, The Musepack Development Team
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of the The Musepack Development Team nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/// \file math.h
+/// Libmpcdec internal math routines.
+
+#ifndef _mpcdec_math_h_
+#define _mpcdec_math_h_
//#define MPC_FIXED_POINT
@@ -106,5 +140,5 @@ typedef float MPC_SAMPLE_FORMAT;
#endif
-#endif // _musepack_math_h_
+#endif // _mpcdec_math_h_
diff --git a/src/libmusepack/musepack/musepack.h b/contrib/libmpcdec/mpcdec/mpcdec.h
index dfbf0a36d..77418fbcc 100644
--- a/src/libmusepack/musepack/musepack.h
+++ b/contrib/libmpcdec/mpcdec/mpcdec.h
@@ -1,8 +1,42 @@
-/// \file musepack.h
-/// Top level include file for libmusepack.
-
-#ifndef _musepack_h_
-#define _musepack_h_
+/*
+ Copyright (c) 2005, The Musepack Development Team
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of the The Musepack Development Team nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/// \file mpcdec.h
+/// Top level include file for libmpcdec.
+
+#ifndef _mpcdec_h_
+#define _mpcdec_h_
#ifdef __cplusplus
extern "C" {
@@ -11,13 +45,17 @@ extern "C" {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <math.h>
-#include "musepack/config_types.h"
-#include "musepack/decoder.h"
-#include "musepack/math.h"
-#include "musepack/reader.h"
-#include "musepack/streaminfo.h"
+#ifndef WIN32
+#include "mpcdec/config_types.h"
+#else
+#include "mpcdec/config_win32.h"
+#endif
+
+#include "decoder.h"
+#include "math.h"
+#include "reader.h"
+#include "streaminfo.h"
enum {
MPC_FRAME_LENGTH = (36 * 32), /// samples per mpc frame
@@ -62,6 +100,13 @@ void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r);
/// \return TRUE if decoder was initalized successfully, FALSE otherwise
mpc_bool_t mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si);
+/// Call this next after calling mpc_decoder_setup.
+/// \param si streaminfo structure indicating format of source stream
+/// \param fast_seeking boolean 0 = use fast seeking if safe, 1 = force fast seeking
+void mpc_decoder_set_seeking(mpc_decoder *d, mpc_streaminfo *si, mpc_bool_t fast_seeking);
+
+void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si);
+
/// Sets decoder sample scaling factor. All decoded samples will be multiplied
/// by this factor.
/// \param scale_factor multiplicative scaling factor
@@ -81,6 +126,12 @@ mpc_uint32_t mpc_decoder_decode(
mpc_uint32_t *vbr_update_acc,
mpc_uint32_t *vbr_update_bits);
+mpc_uint32_t mpc_decoder_decode_frame(
+ mpc_decoder *d,
+ mpc_uint32_t *in_buffer,
+ mpc_uint32_t in_len,
+ MPC_SAMPLE_FORMAT *out_buffer);
+
/// Seeks to the specified sample in the source stream.
mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample);
@@ -91,4 +142,4 @@ mpc_bool_t mpc_decoder_seek_seconds(mpc_decoder *d, double seconds);
}
#endif // __cplusplus
-#endif // _musepack_h_
+#endif // _mpcdec_h_
diff --git a/contrib/libmpcdec/mpcdec/reader.h b/contrib/libmpcdec/mpcdec/reader.h
new file mode 100644
index 000000000..3d4f57edc
--- /dev/null
+++ b/contrib/libmpcdec/mpcdec/reader.h
@@ -0,0 +1,82 @@
+/*
+ Copyright (c) 2005, The Musepack Development Team
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of the The Musepack Development Team nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/// \file reader.h
+
+#ifndef _mpcdec_reader_h_
+#define _mpcdec_reader_h_
+
+/// \brief Stream reader interface structure.
+///
+/// This is the structure you must supply to the musepack decoding library
+/// to feed it with raw data. Implement the five member functions to provide
+/// a functional reader.
+typedef struct mpc_reader_t {
+ /// Reads size bytes of data into buffer at ptr.
+ mpc_int32_t (*read)(void *t, void *ptr, mpc_int32_t size);
+
+ /// Seeks to byte position offset.
+ mpc_bool_t (*seek)(void *t, mpc_int32_t offset);
+
+ /// Returns the current byte offset in the stream.
+ mpc_int32_t (*tell)(void *t);
+
+ /// Returns the total length of the source stream, in bytes.
+ mpc_int32_t (*get_size)(void *t);
+
+ /// True if the stream is a seekable stream.
+ mpc_bool_t (*canseek)(void *t);
+
+ /// Field that can be used to identify a particular instance of
+ /// reader or carry along data associated with that reader.
+ void *data;
+
+} mpc_reader;
+
+typedef struct mpc_reader_file_t {
+ mpc_reader reader;
+
+ FILE *file;
+ long file_size;
+ mpc_bool_t is_seekable;
+} mpc_reader_file;
+
+/// Initializes reader with default stdio file reader implementation. Use
+/// this if you're just reading from a plain file.
+///
+/// \param r reader struct to initalize
+/// \param input input stream to attach to the reader
+void mpc_reader_setup_file_reader(mpc_reader_file *r, FILE *input);
+
+#endif // _mpcdec_reader_h_
diff --git a/contrib/libmpcdec/mpcdec/requant.h b/contrib/libmpcdec/mpcdec/requant.h
new file mode 100644
index 000000000..a0aab981b
--- /dev/null
+++ b/contrib/libmpcdec/mpcdec/requant.h
@@ -0,0 +1,51 @@
+/*
+ Copyright (c) 2005, The Musepack Development Team
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of the The Musepack Development Team nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/// \file requant.h
+/// Requantization function definitions.
+
+#ifndef _mpcdec_requant_h
+#define _mpcdec_requant_h_
+
+#include "mpcdec.h"
+
+/* C O N S T A N T S */
+extern const mpc_uint32_t Res_bit [18]; // bits per sample for chosen quantizer
+extern const MPC_SAMPLE_FORMAT __Cc [1 + 18]; // coefficients for requantization
+extern const mpc_int32_t __Dc [1 + 18]; // offset for requantization
+
+#define Cc (__Cc + 1)
+#define Dc (__Dc + 1)
+
+#endif // _mpcdec_requant_h_
diff --git a/src/libmusepack/musepack/streaminfo.h b/contrib/libmpcdec/mpcdec/streaminfo.h
index dc8e77c22..7cf941c47 100644
--- a/src/libmusepack/musepack/streaminfo.h
+++ b/contrib/libmpcdec/mpcdec/streaminfo.h
@@ -1,7 +1,41 @@
+/*
+ Copyright (c) 2005, The Musepack Development Team
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of the The Musepack Development Team nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
/// \file streaminfo.h
-#ifndef _musepack_streaminfo_h_
-#define _musepack_streaminfo_h_
+#ifndef _mpcdec_streaminfo_h_
+#define _mpcdec_streaminfo_h_
typedef mpc_int32_t mpc_streaminfo_off_t;
@@ -47,6 +81,11 @@ typedef struct mpc_streaminfo {
mpc_streaminfo_off_t tag_offset; ///< offset to file tags
mpc_streaminfo_off_t total_file_length; ///< total length of underlying file
//@}
+
+ /// @name fast seeking support
+ //@{
+ mpc_uint32_t fast_seek; ///< support fast seeking ? (0: no, 1: yes)
+ //@}
} mpc_streaminfo;
-#endif // _musepack_streaminfo_h_
+#endif // _mpcdec_streaminfo_h_
diff --git a/src/libmusepack/requant.c b/contrib/libmpcdec/requant.c
index d318d0bd0..2e4c98b62 100644
--- a/src/libmusepack/requant.c
+++ b/contrib/libmpcdec/requant.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004, The Musepack Development Team
+ Copyright (c) 2005, The Musepack Development Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -36,8 +36,8 @@
/// Requantization function implementations.
/// \todo document me
-#include "musepack/musepack.h"
-#include "musepack/internal.h"
+#include <mpcdec/mpcdec.h>
+#include <mpcdec/internal.h>
/* C O N S T A N T S */
// bits per sample for chosen quantizer
@@ -72,9 +72,9 @@ const mpc_int32_t __Dc [1 + 18] = {
#ifdef MPC_FIXED_POINT
static mpc_uint32_t find_shift(double fval)
{
- mpc_int64_t val = (mpc_int64_t)fval;
- if (val<0) val = -val;
+ mpc_int64_t val = (mpc_int64_t)fval;
mpc_uint32_t ptr = 0;
+ if (val<0) val = -val;
while(val) {val>>=1;ptr++;}
return ptr > 31 ? 0 : 31 - ptr;
@@ -83,7 +83,7 @@ static mpc_uint32_t find_shift(double fval)
/* F U N C T I O N S */
-#define SET_SCF(N,X) d->SCF[N] = MAKE_MPC_SAMPLE_EX(X,SCF_shift[N] = (unsigned char)find_shift(X));
+#define SET_SCF(N,X) d->SCF[N] = MAKE_MPC_SAMPLE_EX(X,d->SCF_shift[N] = (unsigned char)find_shift(X));
void
mpc_decoder_scale_output(mpc_decoder *d, double factor)
@@ -113,40 +113,8 @@ mpc_decoder_scale_output(mpc_decoder *d, double factor)
}
}
-static void
-mpc_decoder_quantisierungsmodes(mpc_decoder *d) // conversion: index -> quantizer (bitstream reading)
-{ // conversion: quantizer -> index (bitstream writing)
- mpc_int32_t Band = 0;
- mpc_int32_t i;
-
- do {
- d->Q_bit [Band] = 4;
- for ( i = 0; i < 16-1; i++ )
- d->Q_res [Band] [i] = i;
- d->Q_res [Band][i] = 17;
- Band++;
- } while ( Band < 11 );
-
- do {
- d->Q_bit [Band] = 3;
- for ( i = 0; i < 8-1; i++ )
- d->Q_res [Band] [i] = i;
- d->Q_res [Band] [i] = 17;
- Band++;
- } while ( Band < 23 );
-
- do {
- d->Q_bit [Band] = 2;
- for ( i = 0; i < 4-1; i++ )
- d->Q_res [Band] [i] = i;
- d->Q_res [Band] [i] = 17;
- Band++;
- } while ( Band < 32 );
-}
-
void
mpc_decoder_initialisiere_quantisierungstabellen(mpc_decoder *d, double scale_factor)
{
- mpc_decoder_quantisierungsmodes(d);
mpc_decoder_scale_output(d, scale_factor);
}
diff --git a/src/libmusepack/streaminfo.c b/contrib/libmpcdec/streaminfo.c
index 2c6ff1c6f..060da08d0 100644
--- a/src/libmusepack/streaminfo.c
+++ b/contrib/libmpcdec/streaminfo.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004, The Musepack Development Team
+ Copyright (c) 2005, The Musepack Development Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -35,8 +35,8 @@
/// \file streaminfo.c
/// Implementation of streaminfo reading functions.
-#include "musepack/musepack.h"
-#include "musepack/internal.h"
+#include <mpcdec/mpcdec.h>
+#include <mpcdec/internal.h>
static const char *
Stringify(mpc_uint32_t profile) // profile is 0...15, where 7...13 is used
@@ -58,14 +58,6 @@ mpc_streaminfo_init(mpc_streaminfo * si)
memset(si, 0, sizeof(mpc_streaminfo));
}
-// read information from SV8 header
-// not yet implemented
-static mpc_int32_t
-streaminfo_read_header_sv8(mpc_streaminfo * si, mpc_reader * fp)
-{
- return 0;
-}
-
/// Reads streaminfo from SV7 header.
static mpc_int32_t
streaminfo_read_header_sv7(mpc_streaminfo * si, mpc_uint32_t HeaderData[8])
@@ -103,6 +95,7 @@ streaminfo_read_header_sv7(mpc_streaminfo * si, mpc_uint32_t HeaderData[8])
si->peak_album = (mpc_uint16_t) (HeaderData[4] & 0xFFFF);
si->is_true_gapless = (HeaderData[5] >> 31) & 0x0001; // true gapless: used?
si->last_frame_samples = (HeaderData[5] >> 20) & 0x07FF; // true gapless: valid samples for last frame
+ si->fast_seek = (HeaderData[5] >> 19) & 0x0001; // fast seeking
si->encoder_version = (HeaderData[6] >> 24) & 0x00FF;
if (si->encoder_version == 0) {
@@ -140,6 +133,7 @@ streaminfo_read_header_sv7(mpc_streaminfo * si, mpc_uint32_t HeaderData[8])
}
// read information from SV4-SV6 header
+#ifdef MPC_SUPPORT_SV456
static mpc_int32_t
streaminfo_read_header_sv6(mpc_streaminfo * si, mpc_uint32_t HeaderData[8])
{
@@ -196,7 +190,7 @@ streaminfo_read_header_sv6(mpc_streaminfo * si, mpc_uint32_t HeaderData[8])
return ERROR_CODE_OK;
}
-
+#endif
// reads file header and tags
mpc_int32_t
mpc_streaminfo_read(mpc_streaminfo * si, mpc_reader * r)
@@ -221,28 +215,35 @@ mpc_streaminfo_read(mpc_streaminfo * si, mpc_reader * r)
si->total_file_length = r->get_size(r->data);
si->tag_offset = si->total_file_length;
- if (memcmp(HeaderData, "MP+", 3) == 0) {
+
+ if (memcmp(HeaderData, "MP+", 3)) return ERROR_CODE_INVALIDSV;
#ifndef MPC_LITTLE_ENDIAN
+ {
mpc_uint32_t ptr;
for (ptr = 0; ptr < 8; ptr++) {
- HeaderData[ptr] = swap32(HeaderData[ptr]);
+ HeaderData[ptr] = mpc_swap32(HeaderData[ptr]);
}
+ }
#endif
- si->stream_version = HeaderData[0] >> 24;
+
+ si->stream_version = HeaderData[0] >> 24;
- // stream version 8
- if ((si->stream_version & 15) >= 8) {
- Error = streaminfo_read_header_sv8(si, r);
- }
- // stream version 7
- else if ((si->stream_version & 15) == 7) {
- Error = streaminfo_read_header_sv7(si, HeaderData);
- }
+ // stream version 8
+ if ((si->stream_version & 15) >= 8) {
+ return ERROR_CODE_INVALIDSV;
}
+ // stream version 7
+ else if ((si->stream_version & 15) == 7) {
+ Error = streaminfo_read_header_sv7(si, HeaderData);
+ if (Error != ERROR_CODE_OK) return Error;
+ }
+#ifdef MPC_SUPPORT_SV456
else {
// stream version 4-6
Error = streaminfo_read_header_sv6(si, HeaderData);
+ if (Error != ERROR_CODE_OK) return Error;
}
+#endif
// estimation, exact value needs too much time
si->pcm_samples = 1152 * si->frames - 576;
@@ -256,7 +257,7 @@ mpc_streaminfo_read(mpc_streaminfo * si, mpc_reader * r)
si->average_bitrate = 0;
}
- return Error;
+ return ERROR_CODE_OK;
}
double
diff --git a/src/libmusepack/synth_filter.c b/contrib/libmpcdec/synth_filter.c
index 5a14091f5..08308005d 100644
--- a/src/libmusepack/synth_filter.c
+++ b/contrib/libmpcdec/synth_filter.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004, The Musepack Development Team
+ Copyright (c) 2005, The Musepack Development Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -36,8 +36,8 @@
/// Synthesis functions.
/// \todo document me
-#include "musepack/musepack.h"
-#include "musepack/internal.h"
+#include <mpcdec/mpcdec.h>
+#include <mpcdec/internal.h>
/* C O N S T A N T S */
#undef _
@@ -422,7 +422,7 @@ static const unsigned char Parity [256] = { // parity
* XORed values of both generators.
*/
mpc_uint32_t
-random_int(mpc_decoder *d)
+mpc_random_int(mpc_decoder *d)
{
#if 1
mpc_uint32_t t1, t2, t3, t4;
diff --git a/src/libmusepack/Makefile.am b/src/libmusepack/Makefile.am
index d39426597..59e01ab7f 100644
--- a/src/libmusepack/Makefile.am
+++ b/src/libmusepack/Makefile.am
@@ -1,26 +1,21 @@
include $(top_srcdir)/misc/Makefile.common
-SUBDIRS = musepack
-
-EXTRA_DIST = diff_against_svn.patch
-
if MUSEPACK
xineplug_LTLIBRARIES = xineplug_decode_mpc.la
endif
-if EXTERNAL_MPCDEC
-internal_sources =
+if !EXTERNAL_MPCDEC
+link_libmpcdec = $(top_builddir)/contrib/libmpcdec/libmpcdec.la
+cflags_libmpcdec = -I$(top_srcdir)/contrib/libmpcdec
else
-internal_sources = huffsv46.c huffsv7.c idtag.c mpc_decoder.c \
- mpc_reader.c requant.c streaminfo.c synth_filter.c
+link_libmpcdec = $(MPCDEC_LIBS)
+cflags_libmpcdec = $(MPCDEC_CFLAGS)
endif
-if EXTERNAL_MPCDEC
-xineplug_decode_mpc_la_LIBADD = $(XINE_LIB) -lmpcdec
-else
-xineplug_decode_mpc_la_LIBADD = $(XINE_LIB)
-endif
+$(top_builddir)/contrib/libmpcdec/libmpcdec.la:
+ $(MAKE) -C $(top_builddir)/contrib/libmpcdec
-xineplug_decode_mpc_la_SOURCES = $(internal_sources) xine_musepack_decoder.c
-xineplug_decode_mpc_la_CFLAGS = $(VISIBILITY_FLAG)
+xineplug_decode_mpc_la_SOURCES = xine_musepack_decoder.c
+xineplug_decode_mpc_la_CFLAGS = $(VISIBILITY_FLAG) $(cflags_libmpcdec)
+xineplug_decode_mpc_la_LIBADD = $(XINE_LIB) $(link_libmpcdec)
xineplug_decode_mpc_la_LDFLAGS = $(xineplug_ldflags)
diff --git a/src/libmusepack/diff_against_svn.patch b/src/libmusepack/diff_against_svn.patch
deleted file mode 100644
index 1d44efb95..000000000
--- a/src/libmusepack/diff_against_svn.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-Use xine's inttypes.
-The file config_types.h is generated from config_types.h.in in musepack SVN.
-Check for previous swap32 definition before writing a new swap32 function.
-
-Index: src/libmusepack/musepack/config_types.h
-===================================================================
-RCS file: /home/valtri/CVS/xine-lib/src/libmusepack/musepack/config_types.h,v
-retrieving revision 1.1.1.2
-diff -u -p -u -p -r1.1.1.2 config_types.h
---- src/libmusepack/musepack/config_types.h 3 Feb 2005 00:19:24 -0000 1.1.1.2
-+++ src/libmusepack/musepack/config_types.h 3 Feb 2005 00:21:06 -0000
-@@ -1,7 +1,7 @@
- #ifndef __CONFIG_TYPES_H__
- #define __CONFIG_TYPES_H__
-
--#include <stdint.h>
-+#include "os_types.h"
-
- #ifdef WORDS_BIGENDIAN
- #undef MPC_LITTLE_ENDIAN
-Index: src/libmusepack/synth_filter.c
-===================================================================
-RCS file: /cvsroot/xine/xine-lib/src/libmusepack/synth_filter.c,v
-retrieving revision 1.1
-diff -u -r1.1 synth_filter.c
---- src/libmusepack/synth_filter.c 14 Jan 2005 15:24:25 -0000 1.1
-+++ src/libmusepack/synth_filter.c 7 Jan 2006 10:54:27 -0000
-@@ -39,8 +39,6 @@
- #include "musepack/musepack.h"
- #include "musepack/internal.h"
-
--typedef mpc_int32_t ptrdiff_t;
--
- /* C O N S T A N T S */
- #undef _
-
-diff -r d25b274e6e6a src/libmusepack/musepack/internal.h
---- a/src/libmusepack/musepack/internal.h Wed Apr 04 13:41:11 2007 +0200
-+++ b/src/libmusepack/musepack/internal.h Wed Apr 04 13:42:45 2007 +0200
-@@ -8,6 +8,7 @@ enum {
- MPC_DECODER_SYNTH_DELAY = 481
- };
-
-+#ifndef swap32
- /// Big/little endian 32 bit byte swapping routine.
- static inline
- mpc_uint32_t swap32(mpc_uint32_t val) {
-@@ -16,6 +17,7 @@ mpc_uint32_t swap32(mpc_uint32_t val) {
- (mpc_uint32_t)src[0] |
- ((mpc_uint32_t)src[1] << 8) | ((mpc_uint32_t)src[2] << 16) | ((mpc_uint32_t)src[3] << 24);
- }
-+#endif
-
- /// Searches for a ID3v2-tag and reads the length (in bytes) of it.
- /// \param reader supplying raw stream data
diff --git a/src/libmusepack/huffsv46.c b/src/libmusepack/huffsv46.c
deleted file mode 100644
index 6ade01b9d..000000000
--- a/src/libmusepack/huffsv46.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- Copyright (c) 2004, The Musepack Development Team
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-
- * Neither the name of the The Musepack Development Team nor the
- names of its contributors may be used to endorse or promote
- products derived from this software without specific prior
- written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/// \file huffsv46.c
-/// Implementations of huffman decoding for streamversions < 7.
-
-#include "musepack/musepack.h"
-#include "musepack/requant.h"
-#include "musepack/huffman.h"
-
-void
-mpc_decoder_init_huffman_sv6(mpc_decoder *d)
-{
- mpc_decoder_init_huffman_sv6_tables(d);
- mpc_decoder_resort_huff_tables(16, d->Region_A , 0);
- mpc_decoder_resort_huff_tables( 8, d->Region_B , 0);
- mpc_decoder_resort_huff_tables( 4, d->Region_C , 0);
- mpc_decoder_resort_huff_tables( 8, d->SCFI_Bundle , 0);
- mpc_decoder_resort_huff_tables(13, d->DSCF_Entropie , 6);
- mpc_decoder_resort_huff_tables( 3, d->Entropie_1 , Dc[1]);
- mpc_decoder_resort_huff_tables( 5, d->Entropie_2 , Dc[2]);
- mpc_decoder_resort_huff_tables( 7, d->Entropie_3 , Dc[3]);
- mpc_decoder_resort_huff_tables( 9, d->Entropie_4 , Dc[4]);
- mpc_decoder_resort_huff_tables(15, d->Entropie_5 , Dc[5]);
- mpc_decoder_resort_huff_tables(31, d->Entropie_6 , Dc[6]);
- mpc_decoder_resort_huff_tables(63, d->Entropie_7 , Dc[7]);
-}
-
-void
-mpc_decoder_init_huffman_sv6_tables(mpc_decoder *d)
-{
- // SCFI-bundle
- d->SCFI_Bundle[7].Code= 1; d->SCFI_Bundle[7].Length= 1;
- d->SCFI_Bundle[3].Code= 1; d->SCFI_Bundle[3].Length= 2;
- d->SCFI_Bundle[5].Code= 0; d->SCFI_Bundle[5].Length= 3;
- d->SCFI_Bundle[1].Code= 7; d->SCFI_Bundle[1].Length= 5;
- d->SCFI_Bundle[2].Code= 6; d->SCFI_Bundle[2].Length= 5;
- d->SCFI_Bundle[4].Code= 4; d->SCFI_Bundle[4].Length= 5;
- d->SCFI_Bundle[0].Code= 11; d->SCFI_Bundle[0].Length= 6;
- d->SCFI_Bundle[6].Code= 10; d->SCFI_Bundle[6].Length= 6;
-
- // region A (subbands 0..10)
- d->Region_A[ 1].Code= 1; d->Region_A[ 1].Length= 1;
- d->Region_A[ 2].Code= 0; d->Region_A[ 2].Length= 2;
- d->Region_A[ 0].Code= 2; d->Region_A[ 0].Length= 3;
- d->Region_A[ 3].Code= 15; d->Region_A[ 3].Length= 5;
- d->Region_A[ 5].Code= 13; d->Region_A[ 5].Length= 5;
- d->Region_A[ 6].Code= 12; d->Region_A[ 6].Length= 5;
- d->Region_A[ 4].Code= 29; d->Region_A[ 4].Length= 6;
- d->Region_A[ 7].Code= 57; d->Region_A[ 7].Length= 7;
- d->Region_A[ 8].Code= 113; d->Region_A[ 8].Length= 8;
- d->Region_A[ 9].Code= 225; d->Region_A[ 9].Length= 9;
- d->Region_A[10].Code= 449; d->Region_A[10].Length= 10;
- d->Region_A[11].Code= 897; d->Region_A[11].Length= 11;
- d->Region_A[12].Code= 1793; d->Region_A[12].Length= 12;
- d->Region_A[13].Code= 3585; d->Region_A[13].Length= 13;
- d->Region_A[14].Code= 7169; d->Region_A[14].Length= 14;
- d->Region_A[15].Code= 7168; d->Region_A[15].Length= 14;
-
- // region B (subbands 11..22)
- d->Region_B[1].Code= 1; d->Region_B[1].Length= 1;
- d->Region_B[0].Code= 1; d->Region_B[0].Length= 2;
- d->Region_B[2].Code= 1; d->Region_B[2].Length= 3;
- d->Region_B[3].Code= 1; d->Region_B[3].Length= 4;
- d->Region_B[4].Code= 1; d->Region_B[4].Length= 5;
- d->Region_B[5].Code= 1; d->Region_B[5].Length= 6;
- d->Region_B[6].Code= 1; d->Region_B[6].Length= 7;
- d->Region_B[7].Code= 0; d->Region_B[7].Length= 7;
-
- // region C (subbands 23..31)
- d->Region_C[0].Code= 1; d->Region_C[0].Length= 1;
- d->Region_C[1].Code= 1; d->Region_C[1].Length= 2;
- d->Region_C[2].Code= 1; d->Region_C[2].Length= 3;
- d->Region_C[3].Code= 0; d->Region_C[3].Length= 3;
-
- // DSCF
- d->DSCF_Entropie[ 6].Code= 0; d->DSCF_Entropie[ 6].Length= 2;
- d->DSCF_Entropie[ 7].Code= 7; d->DSCF_Entropie[ 7].Length= 3;
- d->DSCF_Entropie[ 5].Code= 4; d->DSCF_Entropie[ 5].Length= 3;
- d->DSCF_Entropie[ 8].Code= 3; d->DSCF_Entropie[ 8].Length= 3;
- d->DSCF_Entropie[ 9].Code= 13; d->DSCF_Entropie[ 9].Length= 4;
- d->DSCF_Entropie[ 4].Code= 11; d->DSCF_Entropie[ 4].Length= 4;
- d->DSCF_Entropie[10].Code= 10; d->DSCF_Entropie[10].Length= 4;
- d->DSCF_Entropie[ 2].Code= 4; d->DSCF_Entropie[ 2].Length= 4;
- d->DSCF_Entropie[11].Code= 25; d->DSCF_Entropie[11].Length= 5;
- d->DSCF_Entropie[ 3].Code= 24; d->DSCF_Entropie[ 3].Length= 5;
- d->DSCF_Entropie[ 1].Code= 11; d->DSCF_Entropie[ 1].Length= 5;
- d->DSCF_Entropie[12].Code= 21; d->DSCF_Entropie[12].Length= 6;
- d->DSCF_Entropie[ 0].Code= 20; d->DSCF_Entropie[ 0].Length= 6;
-
- // first quantizer
- d->Entropie_1[1].Code= 1; d->Entropie_1[1].Length= 1;
- d->Entropie_1[0].Code= 1; d->Entropie_1[0].Length= 2;
- d->Entropie_1[2].Code= 0; d->Entropie_1[2].Length= 2;
-
- // second quantizer
- d->Entropie_2[2].Code= 3; d->Entropie_2[2].Length= 2;
- d->Entropie_2[3].Code= 1; d->Entropie_2[3].Length= 2;
- d->Entropie_2[1].Code= 0; d->Entropie_2[1].Length= 2;
- d->Entropie_2[4].Code= 5; d->Entropie_2[4].Length= 3;
- d->Entropie_2[0].Code= 4; d->Entropie_2[0].Length= 3;
-
- // third quantizer
- d->Entropie_3[3].Code= 3; d->Entropie_3[3].Length= 2;
- d->Entropie_3[2].Code= 1; d->Entropie_3[2].Length= 2;
- d->Entropie_3[4].Code= 0; d->Entropie_3[4].Length= 2;
- d->Entropie_3[1].Code= 5; d->Entropie_3[1].Length= 3;
- d->Entropie_3[5].Code= 9; d->Entropie_3[5].Length= 4;
- d->Entropie_3[0].Code= 17; d->Entropie_3[0].Length= 5;
- d->Entropie_3[6].Code= 16; d->Entropie_3[6].Length= 5;
-
- // forth quantizer
- d->Entropie_4[4].Code= 0; d->Entropie_4[4].Length= 2;
- d->Entropie_4[5].Code= 6; d->Entropie_4[5].Length= 3;
- d->Entropie_4[3].Code= 5; d->Entropie_4[3].Length= 3;
- d->Entropie_4[6].Code= 4; d->Entropie_4[6].Length= 3;
- d->Entropie_4[2].Code= 3; d->Entropie_4[2].Length= 3;
- d->Entropie_4[7].Code= 15; d->Entropie_4[7].Length= 4;
- d->Entropie_4[1].Code= 14; d->Entropie_4[1].Length= 4;
- d->Entropie_4[0].Code= 5; d->Entropie_4[0].Length= 4;
- d->Entropie_4[8].Code= 4; d->Entropie_4[8].Length= 4;
-
- // fifth quantizer
- d->Entropie_5[7 ].Code= 4; d->Entropie_5[7 ].Length= 3;
- d->Entropie_5[8 ].Code= 3; d->Entropie_5[8 ].Length= 3;
- d->Entropie_5[6 ].Code= 2; d->Entropie_5[6 ].Length= 3;
- d->Entropie_5[9 ].Code= 0; d->Entropie_5[9 ].Length= 3;
- d->Entropie_5[5 ].Code= 15; d->Entropie_5[5 ].Length= 4;
- d->Entropie_5[4 ].Code= 13; d->Entropie_5[4 ].Length= 4;
- d->Entropie_5[10].Code= 12; d->Entropie_5[10].Length= 4;
- d->Entropie_5[11].Code= 10; d->Entropie_5[11].Length= 4;
- d->Entropie_5[3 ].Code= 3; d->Entropie_5[3 ].Length= 4;
- d->Entropie_5[12].Code= 2; d->Entropie_5[12].Length= 4;
- d->Entropie_5[2 ].Code= 29; d->Entropie_5[2 ].Length= 5;
- d->Entropie_5[1 ].Code= 23; d->Entropie_5[1 ].Length= 5;
- d->Entropie_5[13].Code= 22; d->Entropie_5[13].Length= 5;
- d->Entropie_5[0 ].Code= 57; d->Entropie_5[0 ].Length= 6;
- d->Entropie_5[14].Code= 56; d->Entropie_5[14].Length= 6;
-
- // sixth quantizer
- d->Entropie_6[15].Code= 9; d->Entropie_6[15].Length= 4;
- d->Entropie_6[16].Code= 8; d->Entropie_6[16].Length= 4;
- d->Entropie_6[14].Code= 7; d->Entropie_6[14].Length= 4;
- d->Entropie_6[18].Code= 6; d->Entropie_6[18].Length= 4;
- d->Entropie_6[17].Code= 5; d->Entropie_6[17].Length= 4;
- d->Entropie_6[12].Code= 3; d->Entropie_6[12].Length= 4;
- d->Entropie_6[13].Code= 2; d->Entropie_6[13].Length= 4;
- d->Entropie_6[19].Code= 0; d->Entropie_6[19].Length= 4;
- d->Entropie_6[11].Code= 31; d->Entropie_6[11].Length= 5;
- d->Entropie_6[20].Code= 30; d->Entropie_6[20].Length= 5;
- d->Entropie_6[10].Code= 29; d->Entropie_6[10].Length= 5;
- d->Entropie_6[9 ].Code= 27; d->Entropie_6[9 ].Length= 5;
- d->Entropie_6[21].Code= 26; d->Entropie_6[21].Length= 5;
- d->Entropie_6[22].Code= 25; d->Entropie_6[22].Length= 5;
- d->Entropie_6[8 ].Code= 24; d->Entropie_6[8 ].Length= 5;
- d->Entropie_6[7 ].Code= 23; d->Entropie_6[7 ].Length= 5;
- d->Entropie_6[23].Code= 21; d->Entropie_6[23].Length= 5;
- d->Entropie_6[6 ].Code= 9; d->Entropie_6[6 ].Length= 5;
- d->Entropie_6[24].Code= 3; d->Entropie_6[24].Length= 5;
- d->Entropie_6[25].Code= 57; d->Entropie_6[25].Length= 6;
- d->Entropie_6[5 ].Code= 56; d->Entropie_6[5 ].Length= 6;
- d->Entropie_6[4 ].Code= 45; d->Entropie_6[4 ].Length= 6;
- d->Entropie_6[26].Code= 41; d->Entropie_6[26].Length= 6;
- d->Entropie_6[2 ].Code= 40; d->Entropie_6[2 ].Length= 6;
- d->Entropie_6[27].Code= 17; d->Entropie_6[27].Length= 6;
- d->Entropie_6[28].Code= 16; d->Entropie_6[28].Length= 6;
- d->Entropie_6[3 ].Code= 5; d->Entropie_6[3 ].Length= 6;
- d->Entropie_6[29].Code= 89; d->Entropie_6[29].Length= 7;
- d->Entropie_6[1 ].Code= 88; d->Entropie_6[1 ].Length= 7;
- d->Entropie_6[30].Code= 9; d->Entropie_6[30].Length= 7;
- d->Entropie_6[0 ].Code= 8; d->Entropie_6[0 ].Length= 7;
-
- // seventh quantizer
- d->Entropie_7[25].Code= 0; d->Entropie_7[25].Length= 5;
- d->Entropie_7[37].Code= 1; d->Entropie_7[37].Length= 5;
- d->Entropie_7[62].Code= 16; d->Entropie_7[62].Length= 8;
- d->Entropie_7[ 0].Code= 17; d->Entropie_7[ 0].Length= 8;
- d->Entropie_7[ 3].Code= 9; d->Entropie_7[ 3].Length= 7;
- d->Entropie_7[ 5].Code= 10; d->Entropie_7[ 5].Length= 7;
- d->Entropie_7[ 6].Code= 11; d->Entropie_7[ 6].Length= 7;
- d->Entropie_7[38].Code= 3; d->Entropie_7[38].Length= 5;
- d->Entropie_7[35].Code= 4; d->Entropie_7[35].Length= 5;
- d->Entropie_7[33].Code= 5; d->Entropie_7[33].Length= 5;
- d->Entropie_7[24].Code= 6; d->Entropie_7[24].Length= 5;
- d->Entropie_7[27].Code= 7; d->Entropie_7[27].Length= 5;
- d->Entropie_7[26].Code= 8; d->Entropie_7[26].Length= 5;
- d->Entropie_7[12].Code= 18; d->Entropie_7[12].Length= 6;
- d->Entropie_7[50].Code= 19; d->Entropie_7[50].Length= 6;
- d->Entropie_7[29].Code= 10; d->Entropie_7[29].Length= 5;
- d->Entropie_7[31].Code= 11; d->Entropie_7[31].Length= 5;
- d->Entropie_7[36].Code= 12; d->Entropie_7[36].Length= 5;
- d->Entropie_7[34].Code= 13; d->Entropie_7[34].Length= 5;
- d->Entropie_7[28].Code= 14; d->Entropie_7[28].Length= 5;
- d->Entropie_7[49].Code= 30; d->Entropie_7[49].Length= 6;
- d->Entropie_7[56].Code= 62; d->Entropie_7[56].Length= 7;
- d->Entropie_7[ 7].Code= 63; d->Entropie_7[ 7].Length= 7;
- d->Entropie_7[32].Code= 16; d->Entropie_7[32].Length= 5;
- d->Entropie_7[30].Code= 17; d->Entropie_7[30].Length= 5;
- d->Entropie_7[13].Code= 36; d->Entropie_7[13].Length= 6;
- d->Entropie_7[55].Code= 74; d->Entropie_7[55].Length= 7;
- d->Entropie_7[61].Code= 150; d->Entropie_7[61].Length= 8;
- d->Entropie_7[ 1].Code= 151; d->Entropie_7[ 1].Length= 8;
- d->Entropie_7[14].Code= 38; d->Entropie_7[14].Length= 6;
- d->Entropie_7[48].Code= 39; d->Entropie_7[48].Length= 6;
- d->Entropie_7[ 4].Code= 80; d->Entropie_7[ 4].Length= 7;
- d->Entropie_7[58].Code= 81; d->Entropie_7[58].Length= 7;
- d->Entropie_7[47].Code= 41; d->Entropie_7[47].Length= 6;
- d->Entropie_7[15].Code= 42; d->Entropie_7[15].Length= 6;
- d->Entropie_7[16].Code= 43; d->Entropie_7[16].Length= 6;
- d->Entropie_7[54].Code= 88; d->Entropie_7[54].Length= 7;
- d->Entropie_7[ 8].Code= 89; d->Entropie_7[ 8].Length= 7;
- d->Entropie_7[17].Code= 45; d->Entropie_7[17].Length= 6;
- d->Entropie_7[46].Code= 46; d->Entropie_7[46].Length= 6;
- d->Entropie_7[45].Code= 47; d->Entropie_7[45].Length= 6;
- d->Entropie_7[53].Code= 96; d->Entropie_7[53].Length= 7;
- d->Entropie_7[ 9].Code= 97; d->Entropie_7[ 9].Length= 7;
- d->Entropie_7[43].Code= 49; d->Entropie_7[43].Length= 6;
- d->Entropie_7[19].Code= 50; d->Entropie_7[19].Length= 6;
- d->Entropie_7[18].Code= 51; d->Entropie_7[18].Length= 6;
- d->Entropie_7[44].Code= 52; d->Entropie_7[44].Length= 6;
- d->Entropie_7[ 2].Code= 212; d->Entropie_7[ 2].Length= 8;
- d->Entropie_7[60].Code= 213; d->Entropie_7[60].Length= 8;
- d->Entropie_7[10].Code= 107; d->Entropie_7[10].Length= 7;
- d->Entropie_7[42].Code= 54; d->Entropie_7[42].Length= 6;
- d->Entropie_7[41].Code= 55; d->Entropie_7[41].Length= 6;
- d->Entropie_7[20].Code= 56; d->Entropie_7[20].Length= 6;
- d->Entropie_7[21].Code= 57; d->Entropie_7[21].Length= 6;
- d->Entropie_7[52].Code= 116; d->Entropie_7[52].Length= 7;
- d->Entropie_7[51].Code= 117; d->Entropie_7[51].Length= 7;
- d->Entropie_7[40].Code= 59; d->Entropie_7[40].Length= 6;
- d->Entropie_7[22].Code= 60; d->Entropie_7[22].Length= 6;
- d->Entropie_7[23].Code= 61; d->Entropie_7[23].Length= 6;
- d->Entropie_7[39].Code= 62; d->Entropie_7[39].Length= 6;
- d->Entropie_7[11].Code= 126; d->Entropie_7[11].Length= 7;
- d->Entropie_7[57].Code= 254; d->Entropie_7[57].Length= 8;
- d->Entropie_7[59].Code= 255; d->Entropie_7[59].Length= 8;
-}
diff --git a/src/libmusepack/huffsv7.c b/src/libmusepack/huffsv7.c
deleted file mode 100644
index 80a8f2bff..000000000
--- a/src/libmusepack/huffsv7.c
+++ /dev/null
@@ -1,500 +0,0 @@
-/*
- Copyright (c) 2004, The Musepack Development Team
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-
- * Neither the name of the The Musepack Development Team nor the
- names of its contributors may be used to endorse or promote
- products derived from this software without specific prior
- written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/// \file huffsv7.c
-/// Implementations of sv7 huffman decoding functions.
-
-#include "musepack/musepack.h"
-#include "musepack/huffman.h"
-#include "musepack/requant.h"
-
-void
-mpc_decoder_init_huffman_sv7(mpc_decoder *d)
-{
- mpc_decoder_init_huffman_sv7_tables(d);
- mpc_decoder_resort_huff_tables(10, &(d->HuffHdr[0]) , 5);
- mpc_decoder_resort_huff_tables( 4, &(d->HuffSCFI[0]) , 0);
- mpc_decoder_resort_huff_tables(16, &(d->HuffDSCF[0]) , 7);
- mpc_decoder_resort_huff_tables(27, &(d->HuffQ1[0][0]) , 0);
- mpc_decoder_resort_huff_tables(27, &(d->HuffQ1[1][0]) , 0);
- mpc_decoder_resort_huff_tables(25, &(d->HuffQ2[0][0]) , 0);
- mpc_decoder_resort_huff_tables(25, &(d->HuffQ2[1][0]) , 0);
- mpc_decoder_resort_huff_tables( 7, &(d->HuffQ3[0][0]) , Dc[3]);
- mpc_decoder_resort_huff_tables( 7, &(d->HuffQ3[1][0]) , Dc[3]);
- mpc_decoder_resort_huff_tables( 9, &(d->HuffQ4[0][0]) , Dc[4]);
- mpc_decoder_resort_huff_tables( 9, &(d->HuffQ4[1][0]) , Dc[4]);
- mpc_decoder_resort_huff_tables(15, &(d->HuffQ5[0][0]) , Dc[5]);
- mpc_decoder_resort_huff_tables(15, &(d->HuffQ5[1][0]) , Dc[5]);
- mpc_decoder_resort_huff_tables(31, &(d->HuffQ6[0][0]) , Dc[6]);
- mpc_decoder_resort_huff_tables(31, &(d->HuffQ6[1][0]) , Dc[6]);
- mpc_decoder_resort_huff_tables(63, &(d->HuffQ7[0][0]) , Dc[7]);
- mpc_decoder_resort_huff_tables(63, &(d->HuffQ7[1][0]) , Dc[7]);
-}
-
-void
-mpc_decoder_init_huffman_sv7_tables(mpc_decoder *d)
-{
- /***************************** SCFI *******************************/
- d->HuffSCFI[0].Code = 2; d->HuffSCFI[0].Length = 3;
- d->HuffSCFI[1].Code = 1; d->HuffSCFI[1].Length = 1;
- d->HuffSCFI[2].Code = 3; d->HuffSCFI[2].Length = 3;
- d->HuffSCFI[3].Code = 0; d->HuffSCFI[3].Length = 2;
-
- /***************************** DSCF *******************************/
- d->HuffDSCF[ 0].Code = 32; d->HuffDSCF[ 0].Length = 6;
- d->HuffDSCF[ 1].Code = 4; d->HuffDSCF[ 1].Length = 5;
- d->HuffDSCF[ 2].Code = 17; d->HuffDSCF[ 2].Length = 5;
- d->HuffDSCF[ 3].Code = 30; d->HuffDSCF[ 3].Length = 5;
- d->HuffDSCF[ 4].Code = 13; d->HuffDSCF[ 4].Length = 4;
- d->HuffDSCF[ 5].Code = 0; d->HuffDSCF[ 5].Length = 3;
- d->HuffDSCF[ 6].Code = 3; d->HuffDSCF[ 6].Length = 3;
- d->HuffDSCF[ 7].Code = 9; d->HuffDSCF[ 7].Length = 4;
- d->HuffDSCF[ 8].Code = 5; d->HuffDSCF[ 8].Length = 3;
- d->HuffDSCF[ 9].Code = 2; d->HuffDSCF[ 9].Length = 3;
- d->HuffDSCF[10].Code = 14; d->HuffDSCF[10].Length = 4;
- d->HuffDSCF[11].Code = 3; d->HuffDSCF[11].Length = 4;
- d->HuffDSCF[12].Code = 31; d->HuffDSCF[12].Length = 5;
- d->HuffDSCF[13].Code = 5; d->HuffDSCF[13].Length = 5;
- d->HuffDSCF[14].Code = 33; d->HuffDSCF[14].Length = 6;
- d->HuffDSCF[15].Code = 12; d->HuffDSCF[15].Length = 4;
-
- /************************* frame-header ***************************/
- /***************** differential quantizer indizes *****************/
- d->HuffHdr[0].Code = 92; d->HuffHdr[0].Length = 8;
- d->HuffHdr[1].Code = 47; d->HuffHdr[1].Length = 7;
- d->HuffHdr[2].Code = 10; d->HuffHdr[2].Length = 5;
- d->HuffHdr[3].Code = 4; d->HuffHdr[3].Length = 4;
- d->HuffHdr[4].Code = 0; d->HuffHdr[4].Length = 2;
- d->HuffHdr[5].Code = 1; d->HuffHdr[5].Length = 1;
- d->HuffHdr[6].Code = 3; d->HuffHdr[6].Length = 3;
- d->HuffHdr[7].Code = 22; d->HuffHdr[7].Length = 6;
- d->HuffHdr[8].Code = 187; d->HuffHdr[8].Length = 9;
- d->HuffHdr[9].Code = 186; d->HuffHdr[9].Length = 9;
-
- /********************** 3-step quantizer **************************/
- /********************* 3 bundled samples **************************/
- //less shaped, book 0
- d->HuffQ1[0][ 0].Code = 54; d->HuffQ1[0][ 0].Length = 6;
- d->HuffQ1[0][ 1].Code = 9; d->HuffQ1[0][ 1].Length = 5;
- d->HuffQ1[0][ 2].Code = 32; d->HuffQ1[0][ 2].Length = 6;
- d->HuffQ1[0][ 3].Code = 5; d->HuffQ1[0][ 3].Length = 5;
- d->HuffQ1[0][ 4].Code = 10; d->HuffQ1[0][ 4].Length = 4;
- d->HuffQ1[0][ 5].Code = 7; d->HuffQ1[0][ 5].Length = 5;
- d->HuffQ1[0][ 6].Code = 52; d->HuffQ1[0][ 6].Length = 6;
- d->HuffQ1[0][ 7].Code = 0; d->HuffQ1[0][ 7].Length = 5;
- d->HuffQ1[0][ 8].Code = 35; d->HuffQ1[0][ 8].Length = 6;
- d->HuffQ1[0][ 9].Code = 10; d->HuffQ1[0][ 9].Length = 5;
- d->HuffQ1[0][10].Code = 6; d->HuffQ1[0][10].Length = 4;
- d->HuffQ1[0][11].Code = 4; d->HuffQ1[0][11].Length = 5;
- d->HuffQ1[0][12].Code = 11; d->HuffQ1[0][12].Length = 4;
- d->HuffQ1[0][13].Code = 7; d->HuffQ1[0][13].Length = 3;
- d->HuffQ1[0][14].Code = 12; d->HuffQ1[0][14].Length = 4;
- d->HuffQ1[0][15].Code = 3; d->HuffQ1[0][15].Length = 5;
- d->HuffQ1[0][16].Code = 7; d->HuffQ1[0][16].Length = 4;
- d->HuffQ1[0][17].Code = 11; d->HuffQ1[0][17].Length = 5;
- d->HuffQ1[0][18].Code = 34; d->HuffQ1[0][18].Length = 6;
- d->HuffQ1[0][19].Code = 1; d->HuffQ1[0][19].Length = 5;
- d->HuffQ1[0][20].Code = 53; d->HuffQ1[0][20].Length = 6;
- d->HuffQ1[0][21].Code = 6; d->HuffQ1[0][21].Length = 5;
- d->HuffQ1[0][22].Code = 9; d->HuffQ1[0][22].Length = 4;
- d->HuffQ1[0][23].Code = 2; d->HuffQ1[0][23].Length = 5;
- d->HuffQ1[0][24].Code = 33; d->HuffQ1[0][24].Length = 6;
- d->HuffQ1[0][25].Code = 8; d->HuffQ1[0][25].Length = 5;
- d->HuffQ1[0][26].Code = 55; d->HuffQ1[0][26].Length = 6;
-
- //more shaped, book 1
- d->HuffQ1[1][ 0].Code = 103; d->HuffQ1[1][ 0].Length = 8;
- d->HuffQ1[1][ 1].Code = 62; d->HuffQ1[1][ 1].Length = 7;
- d->HuffQ1[1][ 2].Code = 225; d->HuffQ1[1][ 2].Length = 9;
- d->HuffQ1[1][ 3].Code = 55; d->HuffQ1[1][ 3].Length = 7;
- d->HuffQ1[1][ 4].Code = 3; d->HuffQ1[1][ 4].Length = 4;
- d->HuffQ1[1][ 5].Code = 52; d->HuffQ1[1][ 5].Length = 7;
- d->HuffQ1[1][ 6].Code = 101; d->HuffQ1[1][ 6].Length = 8;
- d->HuffQ1[1][ 7].Code = 60; d->HuffQ1[1][ 7].Length = 7;
- d->HuffQ1[1][ 8].Code = 227; d->HuffQ1[1][ 8].Length = 9;
- d->HuffQ1[1][ 9].Code = 24; d->HuffQ1[1][ 9].Length = 6;
- d->HuffQ1[1][10].Code = 0; d->HuffQ1[1][10].Length = 4;
- d->HuffQ1[1][11].Code = 61; d->HuffQ1[1][11].Length = 7;
- d->HuffQ1[1][12].Code = 4; d->HuffQ1[1][12].Length = 4;
- d->HuffQ1[1][13].Code = 1; d->HuffQ1[1][13].Length = 1;
- d->HuffQ1[1][14].Code = 5; d->HuffQ1[1][14].Length = 4;
- d->HuffQ1[1][15].Code = 63; d->HuffQ1[1][15].Length = 7;
- d->HuffQ1[1][16].Code = 1; d->HuffQ1[1][16].Length = 4;
- d->HuffQ1[1][17].Code = 59; d->HuffQ1[1][17].Length = 7;
- d->HuffQ1[1][18].Code = 226; d->HuffQ1[1][18].Length = 9;
- d->HuffQ1[1][19].Code = 57; d->HuffQ1[1][19].Length = 7;
- d->HuffQ1[1][20].Code = 100; d->HuffQ1[1][20].Length = 8;
- d->HuffQ1[1][21].Code = 53; d->HuffQ1[1][21].Length = 7;
- d->HuffQ1[1][22].Code = 2; d->HuffQ1[1][22].Length = 4;
- d->HuffQ1[1][23].Code = 54; d->HuffQ1[1][23].Length = 7;
- d->HuffQ1[1][24].Code = 224; d->HuffQ1[1][24].Length = 9;
- d->HuffQ1[1][25].Code = 58; d->HuffQ1[1][25].Length = 7;
- d->HuffQ1[1][26].Code = 102; d->HuffQ1[1][26].Length = 8;
-
- /********************** 5-step quantizer **************************/
- /********************* 2 bundled samples **************************/
- //less shaped, book 0
- d->HuffQ2[0][ 0].Code = 89; d->HuffQ2[0][ 0].Length = 7;
- d->HuffQ2[0][ 1].Code = 47; d->HuffQ2[0][ 1].Length = 6;
- d->HuffQ2[0][ 2].Code = 15; d->HuffQ2[0][ 2].Length = 5;
- d->HuffQ2[0][ 3].Code = 0; d->HuffQ2[0][ 3].Length = 5;
- d->HuffQ2[0][ 4].Code = 91; d->HuffQ2[0][ 4].Length = 7;
- d->HuffQ2[0][ 5].Code = 4; d->HuffQ2[0][ 5].Length = 5;
- d->HuffQ2[0][ 6].Code = 6; d->HuffQ2[0][ 6].Length = 4;
- d->HuffQ2[0][ 7].Code = 13; d->HuffQ2[0][ 7].Length = 4;
- d->HuffQ2[0][ 8].Code = 4; d->HuffQ2[0][ 8].Length = 4;
- d->HuffQ2[0][ 9].Code = 5; d->HuffQ2[0][ 9].Length = 5;
- d->HuffQ2[0][10].Code = 20; d->HuffQ2[0][10].Length = 5;
- d->HuffQ2[0][11].Code = 12; d->HuffQ2[0][11].Length = 4;
- d->HuffQ2[0][12].Code = 4; d->HuffQ2[0][12].Length = 3;
- d->HuffQ2[0][13].Code = 15; d->HuffQ2[0][13].Length = 4;
- d->HuffQ2[0][14].Code = 14; d->HuffQ2[0][14].Length = 5;
- d->HuffQ2[0][15].Code = 3; d->HuffQ2[0][15].Length = 5;
- d->HuffQ2[0][16].Code = 3; d->HuffQ2[0][16].Length = 4;
- d->HuffQ2[0][17].Code = 14; d->HuffQ2[0][17].Length = 4;
- d->HuffQ2[0][18].Code = 5; d->HuffQ2[0][18].Length = 4;
- d->HuffQ2[0][19].Code = 1; d->HuffQ2[0][19].Length = 5;
- d->HuffQ2[0][20].Code = 90; d->HuffQ2[0][20].Length = 7;
- d->HuffQ2[0][21].Code = 2; d->HuffQ2[0][21].Length = 5;
- d->HuffQ2[0][22].Code = 21; d->HuffQ2[0][22].Length = 5;
- d->HuffQ2[0][23].Code = 46; d->HuffQ2[0][23].Length = 6;
- d->HuffQ2[0][24].Code = 88; d->HuffQ2[0][24].Length = 7;
-
- //more shaped, book 1
- d->HuffQ2[1][ 0].Code = 921; d->HuffQ2[1][ 0].Length = 10;
- d->HuffQ2[1][ 1].Code = 113; d->HuffQ2[1][ 1].Length = 7;
- d->HuffQ2[1][ 2].Code = 51; d->HuffQ2[1][ 2].Length = 6;
- d->HuffQ2[1][ 3].Code = 231; d->HuffQ2[1][ 3].Length = 8;
- d->HuffQ2[1][ 4].Code = 922; d->HuffQ2[1][ 4].Length = 10;
- d->HuffQ2[1][ 5].Code = 104; d->HuffQ2[1][ 5].Length = 7;
- d->HuffQ2[1][ 6].Code = 30; d->HuffQ2[1][ 6].Length = 5;
- d->HuffQ2[1][ 7].Code = 0; d->HuffQ2[1][ 7].Length = 3;
- d->HuffQ2[1][ 8].Code = 29; d->HuffQ2[1][ 8].Length = 5;
- d->HuffQ2[1][ 9].Code = 105; d->HuffQ2[1][ 9].Length = 7;
- d->HuffQ2[1][10].Code = 50; d->HuffQ2[1][10].Length = 6;
- d->HuffQ2[1][11].Code = 1; d->HuffQ2[1][11].Length = 3;
- d->HuffQ2[1][12].Code = 2; d->HuffQ2[1][12].Length = 2;
- d->HuffQ2[1][13].Code = 3; d->HuffQ2[1][13].Length = 3;
- d->HuffQ2[1][14].Code = 49; d->HuffQ2[1][14].Length = 6;
- d->HuffQ2[1][15].Code = 107; d->HuffQ2[1][15].Length = 7;
- d->HuffQ2[1][16].Code = 27; d->HuffQ2[1][16].Length = 5;
- d->HuffQ2[1][17].Code = 2; d->HuffQ2[1][17].Length = 3;
- d->HuffQ2[1][18].Code = 31; d->HuffQ2[1][18].Length = 5;
- d->HuffQ2[1][19].Code = 112; d->HuffQ2[1][19].Length = 7;
- d->HuffQ2[1][20].Code = 920; d->HuffQ2[1][20].Length = 10;
- d->HuffQ2[1][21].Code = 106; d->HuffQ2[1][21].Length = 7;
- d->HuffQ2[1][22].Code = 48; d->HuffQ2[1][22].Length = 6;
- d->HuffQ2[1][23].Code = 114; d->HuffQ2[1][23].Length = 7;
- d->HuffQ2[1][24].Code = 923; d->HuffQ2[1][24].Length = 10;
-
- /********************** 7-step quantizer **************************/
- /*********************** single samples ***************************/
- //less shaped, book 0
- d->HuffQ3[0][0].Code = 12; d->HuffQ3[0][0].Length = 4;
- d->HuffQ3[0][1].Code = 4; d->HuffQ3[0][1].Length = 3;
- d->HuffQ3[0][2].Code = 0; d->HuffQ3[0][2].Length = 2;
- d->HuffQ3[0][3].Code = 1; d->HuffQ3[0][3].Length = 2;
- d->HuffQ3[0][4].Code = 7; d->HuffQ3[0][4].Length = 3;
- d->HuffQ3[0][5].Code = 5; d->HuffQ3[0][5].Length = 3;
- d->HuffQ3[0][6].Code = 13; d->HuffQ3[0][6].Length = 4;
-
- //more shaped, book 1
- d->HuffQ3[1][0].Code = 4; d->HuffQ3[1][0].Length = 5;
- d->HuffQ3[1][1].Code = 3; d->HuffQ3[1][1].Length = 4;
- d->HuffQ3[1][2].Code = 2; d->HuffQ3[1][2].Length = 2;
- d->HuffQ3[1][3].Code = 3; d->HuffQ3[1][3].Length = 2;
- d->HuffQ3[1][4].Code = 1; d->HuffQ3[1][4].Length = 2;
- d->HuffQ3[1][5].Code = 0; d->HuffQ3[1][5].Length = 3;
- d->HuffQ3[1][6].Code = 5; d->HuffQ3[1][6].Length = 5;
-
- /********************** 9-step quantizer **************************/
- /*********************** single samples ***************************/
- //less shaped, book 0
- d->HuffQ4[0][0].Code = 5; d->HuffQ4[0][0].Length = 4;
- d->HuffQ4[0][1].Code = 0; d->HuffQ4[0][1].Length = 3;
- d->HuffQ4[0][2].Code = 4; d->HuffQ4[0][2].Length = 3;
- d->HuffQ4[0][3].Code = 6; d->HuffQ4[0][3].Length = 3;
- d->HuffQ4[0][4].Code = 7; d->HuffQ4[0][4].Length = 3;
- d->HuffQ4[0][5].Code = 5; d->HuffQ4[0][5].Length = 3;
- d->HuffQ4[0][6].Code = 3; d->HuffQ4[0][6].Length = 3;
- d->HuffQ4[0][7].Code = 1; d->HuffQ4[0][7].Length = 3;
- d->HuffQ4[0][8].Code = 4; d->HuffQ4[0][8].Length = 4;
-
- //more shaped, book 1
- d->HuffQ4[1][0].Code = 9; d->HuffQ4[1][0].Length = 5;
- d->HuffQ4[1][1].Code = 12; d->HuffQ4[1][1].Length = 4;
- d->HuffQ4[1][2].Code = 3; d->HuffQ4[1][2].Length = 3;
- d->HuffQ4[1][3].Code = 0; d->HuffQ4[1][3].Length = 2;
- d->HuffQ4[1][4].Code = 2; d->HuffQ4[1][4].Length = 2;
- d->HuffQ4[1][5].Code = 7; d->HuffQ4[1][5].Length = 3;
- d->HuffQ4[1][6].Code = 13; d->HuffQ4[1][6].Length = 4;
- d->HuffQ4[1][7].Code = 5; d->HuffQ4[1][7].Length = 4;
- d->HuffQ4[1][8].Code = 8; d->HuffQ4[1][8].Length = 5;
-
- /********************* 15-step quantizer **************************/
- /*********************** single samples ***************************/
- //less shaped, book 0
- d->HuffQ5[0][ 0].Code = 57; d->HuffQ5[0][ 0].Length = 6;
- d->HuffQ5[0][ 1].Code = 23; d->HuffQ5[0][ 1].Length = 5;
- d->HuffQ5[0][ 2].Code = 8; d->HuffQ5[0][ 2].Length = 4;
- d->HuffQ5[0][ 3].Code = 10; d->HuffQ5[0][ 3].Length = 4;
- d->HuffQ5[0][ 4].Code = 13; d->HuffQ5[0][ 4].Length = 4;
- d->HuffQ5[0][ 5].Code = 0; d->HuffQ5[0][ 5].Length = 3;
- d->HuffQ5[0][ 6].Code = 2; d->HuffQ5[0][ 6].Length = 3;
- d->HuffQ5[0][ 7].Code = 3; d->HuffQ5[0][ 7].Length = 3;
- d->HuffQ5[0][ 8].Code = 1; d->HuffQ5[0][ 8].Length = 3;
- d->HuffQ5[0][ 9].Code = 15; d->HuffQ5[0][ 9].Length = 4;
- d->HuffQ5[0][10].Code = 12; d->HuffQ5[0][10].Length = 4;
- d->HuffQ5[0][11].Code = 9; d->HuffQ5[0][11].Length = 4;
- d->HuffQ5[0][12].Code = 29; d->HuffQ5[0][12].Length = 5;
- d->HuffQ5[0][13].Code = 22; d->HuffQ5[0][13].Length = 5;
- d->HuffQ5[0][14].Code = 56; d->HuffQ5[0][14].Length = 6;
-
- //more shaped, book 1
- d->HuffQ5[1][ 0].Code = 229; d->HuffQ5[1][ 0].Length = 8;
- d->HuffQ5[1][ 1].Code = 56; d->HuffQ5[1][ 1].Length = 6;
- d->HuffQ5[1][ 2].Code = 7; d->HuffQ5[1][ 2].Length = 5;
- d->HuffQ5[1][ 3].Code = 2; d->HuffQ5[1][ 3].Length = 4;
- d->HuffQ5[1][ 4].Code = 0; d->HuffQ5[1][ 4].Length = 3;
- d->HuffQ5[1][ 5].Code = 3; d->HuffQ5[1][ 5].Length = 3;
- d->HuffQ5[1][ 6].Code = 5; d->HuffQ5[1][ 6].Length = 3;
- d->HuffQ5[1][ 7].Code = 6; d->HuffQ5[1][ 7].Length = 3;
- d->HuffQ5[1][ 8].Code = 4; d->HuffQ5[1][ 8].Length = 3;
- d->HuffQ5[1][ 9].Code = 2; d->HuffQ5[1][ 9].Length = 3;
- d->HuffQ5[1][10].Code = 15; d->HuffQ5[1][10].Length = 4;
- d->HuffQ5[1][11].Code = 29; d->HuffQ5[1][11].Length = 5;
- d->HuffQ5[1][12].Code = 6; d->HuffQ5[1][12].Length = 5;
- d->HuffQ5[1][13].Code = 115; d->HuffQ5[1][13].Length = 7;
- d->HuffQ5[1][14].Code = 228; d->HuffQ5[1][14].Length = 8;
-
- /********************* 31-step quantizer **************************/
- /*********************** single samples ***************************/
- //less shaped, book 0
- d->HuffQ6[0][ 0].Code = 65; d->HuffQ6[0][ 0].Length = 7;
- d->HuffQ6[0][ 1].Code = 6; d->HuffQ6[0][ 1].Length = 6;
- d->HuffQ6[0][ 2].Code = 44; d->HuffQ6[0][ 2].Length = 6;
- d->HuffQ6[0][ 3].Code = 45; d->HuffQ6[0][ 3].Length = 6;
- d->HuffQ6[0][ 4].Code = 59; d->HuffQ6[0][ 4].Length = 6;
- d->HuffQ6[0][ 5].Code = 13; d->HuffQ6[0][ 5].Length = 5;
- d->HuffQ6[0][ 6].Code = 17; d->HuffQ6[0][ 6].Length = 5;
- d->HuffQ6[0][ 7].Code = 19; d->HuffQ6[0][ 7].Length = 5;
- d->HuffQ6[0][ 8].Code = 23; d->HuffQ6[0][ 8].Length = 5;
- d->HuffQ6[0][ 9].Code = 21; d->HuffQ6[0][ 9].Length = 5;
- d->HuffQ6[0][10].Code = 26; d->HuffQ6[0][10].Length = 5;
- d->HuffQ6[0][11].Code = 30; d->HuffQ6[0][11].Length = 5;
- d->HuffQ6[0][12].Code = 0; d->HuffQ6[0][12].Length = 4;
- d->HuffQ6[0][13].Code = 2; d->HuffQ6[0][13].Length = 4;
- d->HuffQ6[0][14].Code = 5; d->HuffQ6[0][14].Length = 4;
- d->HuffQ6[0][15].Code = 7; d->HuffQ6[0][15].Length = 4;
- d->HuffQ6[0][16].Code = 3; d->HuffQ6[0][16].Length = 4;
- d->HuffQ6[0][17].Code = 4; d->HuffQ6[0][17].Length = 4;
- d->HuffQ6[0][18].Code = 31; d->HuffQ6[0][18].Length = 5;
- d->HuffQ6[0][19].Code = 28; d->HuffQ6[0][19].Length = 5;
- d->HuffQ6[0][20].Code = 25; d->HuffQ6[0][20].Length = 5;
- d->HuffQ6[0][21].Code = 27; d->HuffQ6[0][21].Length = 5;
- d->HuffQ6[0][22].Code = 24; d->HuffQ6[0][22].Length = 5;
- d->HuffQ6[0][23].Code = 20; d->HuffQ6[0][23].Length = 5;
- d->HuffQ6[0][24].Code = 18; d->HuffQ6[0][24].Length = 5;
- d->HuffQ6[0][25].Code = 12; d->HuffQ6[0][25].Length = 5;
- d->HuffQ6[0][26].Code = 2; d->HuffQ6[0][26].Length = 5;
- d->HuffQ6[0][27].Code = 58; d->HuffQ6[0][27].Length = 6;
- d->HuffQ6[0][28].Code = 33; d->HuffQ6[0][28].Length = 6;
- d->HuffQ6[0][29].Code = 7; d->HuffQ6[0][29].Length = 6;
- d->HuffQ6[0][30].Code = 64; d->HuffQ6[0][30].Length = 7;
-
- //more shaped, book 1
- d->HuffQ6[1][ 0].Code = 6472; d->HuffQ6[1][ 0].Length = 13;
- d->HuffQ6[1][ 1].Code = 6474; d->HuffQ6[1][ 1].Length = 13;
- d->HuffQ6[1][ 2].Code = 808; d->HuffQ6[1][ 2].Length = 10;
- d->HuffQ6[1][ 3].Code = 405; d->HuffQ6[1][ 3].Length = 9;
- d->HuffQ6[1][ 4].Code = 203; d->HuffQ6[1][ 4].Length = 8;
- d->HuffQ6[1][ 5].Code = 102; d->HuffQ6[1][ 5].Length = 7;
- d->HuffQ6[1][ 6].Code = 49; d->HuffQ6[1][ 6].Length = 6;
- d->HuffQ6[1][ 7].Code = 9; d->HuffQ6[1][ 7].Length = 5;
- d->HuffQ6[1][ 8].Code = 15; d->HuffQ6[1][ 8].Length = 5;
- d->HuffQ6[1][ 9].Code = 31; d->HuffQ6[1][ 9].Length = 5;
- d->HuffQ6[1][10].Code = 2; d->HuffQ6[1][10].Length = 4;
- d->HuffQ6[1][11].Code = 6; d->HuffQ6[1][11].Length = 4;
- d->HuffQ6[1][12].Code = 8; d->HuffQ6[1][12].Length = 4;
- d->HuffQ6[1][13].Code = 11; d->HuffQ6[1][13].Length = 4;
- d->HuffQ6[1][14].Code = 13; d->HuffQ6[1][14].Length = 4;
- d->HuffQ6[1][15].Code = 0; d->HuffQ6[1][15].Length = 3;
- d->HuffQ6[1][16].Code = 14; d->HuffQ6[1][16].Length = 4;
- d->HuffQ6[1][17].Code = 10; d->HuffQ6[1][17].Length = 4;
- d->HuffQ6[1][18].Code = 9; d->HuffQ6[1][18].Length = 4;
- d->HuffQ6[1][19].Code = 5; d->HuffQ6[1][19].Length = 4;
- d->HuffQ6[1][20].Code = 3; d->HuffQ6[1][20].Length = 4;
- d->HuffQ6[1][21].Code = 30; d->HuffQ6[1][21].Length = 5;
- d->HuffQ6[1][22].Code = 14; d->HuffQ6[1][22].Length = 5;
- d->HuffQ6[1][23].Code = 8; d->HuffQ6[1][23].Length = 5;
- d->HuffQ6[1][24].Code = 48; d->HuffQ6[1][24].Length = 6;
- d->HuffQ6[1][25].Code = 103; d->HuffQ6[1][25].Length = 7;
- d->HuffQ6[1][26].Code = 201; d->HuffQ6[1][26].Length = 8;
- d->HuffQ6[1][27].Code = 200; d->HuffQ6[1][27].Length = 8;
- d->HuffQ6[1][28].Code = 1619; d->HuffQ6[1][28].Length = 11;
- d->HuffQ6[1][29].Code = 6473; d->HuffQ6[1][29].Length = 13;
- d->HuffQ6[1][30].Code = 6475; d->HuffQ6[1][30].Length = 13;
-
- /********************* 63-step quantizer **************************/
- /*********************** single samples ***************************/
- //less shaped, book 0
- d->HuffQ7[0][ 0].Code = 103; d->HuffQ7[0][ 0].Length = 8; /* 0.003338 - 01100111 */
- d->HuffQ7[0][ 1].Code = 153; d->HuffQ7[0][ 1].Length = 8; /* 0.003766 - 10011001 */
- d->HuffQ7[0][ 2].Code = 181; d->HuffQ7[0][ 2].Length = 8; /* 0.004715 - 10110101 */
- d->HuffQ7[0][ 3].Code = 233; d->HuffQ7[0][ 3].Length = 8; /* 0.005528 - 11101001 */
- d->HuffQ7[0][ 4].Code = 64; d->HuffQ7[0][ 4].Length = 7; /* 0.006677 - 1000000 */
- d->HuffQ7[0][ 5].Code = 65; d->HuffQ7[0][ 5].Length = 7; /* 0.007041 - 1000001 */
- d->HuffQ7[0][ 6].Code = 77; d->HuffQ7[0][ 6].Length = 7; /* 0.007733 - 1001101 */
- d->HuffQ7[0][ 7].Code = 81; d->HuffQ7[0][ 7].Length = 7; /* 0.008296 - 1010001 */
- d->HuffQ7[0][ 8].Code = 91; d->HuffQ7[0][ 8].Length = 7; /* 0.009295 - 1011011 */
- d->HuffQ7[0][ 9].Code = 113; d->HuffQ7[0][ 9].Length = 7; /* 0.010814 - 1110001 */
- d->HuffQ7[0][10].Code = 112; d->HuffQ7[0][10].Length = 7; /* 0.010807 - 1110000 */
- d->HuffQ7[0][11].Code = 24; d->HuffQ7[0][11].Length = 6; /* 0.012748 - 011000 */
- d->HuffQ7[0][12].Code = 29; d->HuffQ7[0][12].Length = 6; /* 0.013390 - 011101 */
- d->HuffQ7[0][13].Code = 35; d->HuffQ7[0][13].Length = 6; /* 0.014224 - 100011 */
- d->HuffQ7[0][14].Code = 37; d->HuffQ7[0][14].Length = 6; /* 0.015201 - 100101 */
- d->HuffQ7[0][15].Code = 41; d->HuffQ7[0][15].Length = 6; /* 0.016642 - 101001 */
- d->HuffQ7[0][16].Code = 44; d->HuffQ7[0][16].Length = 6; /* 0.017292 - 101100 */
- d->HuffQ7[0][17].Code = 46; d->HuffQ7[0][17].Length = 6; /* 0.018647 - 101110 */
- d->HuffQ7[0][18].Code = 51; d->HuffQ7[0][18].Length = 6; /* 0.020473 - 110011 */
- d->HuffQ7[0][19].Code = 49; d->HuffQ7[0][19].Length = 6; /* 0.020152 - 110001 */
- d->HuffQ7[0][20].Code = 54; d->HuffQ7[0][20].Length = 6; /* 0.021315 - 110110 */
- d->HuffQ7[0][21].Code = 55; d->HuffQ7[0][21].Length = 6; /* 0.021358 - 110111 */
- d->HuffQ7[0][22].Code = 57; d->HuffQ7[0][22].Length = 6; /* 0.021700 - 111001 */
- d->HuffQ7[0][23].Code = 60; d->HuffQ7[0][23].Length = 6; /* 0.022449 - 111100 */
- d->HuffQ7[0][24].Code = 0; d->HuffQ7[0][24].Length = 5; /* 0.023063 - 00000 */
- d->HuffQ7[0][25].Code = 2; d->HuffQ7[0][25].Length = 5; /* 0.023854 - 00010 */
- d->HuffQ7[0][26].Code = 10; d->HuffQ7[0][26].Length = 5; /* 0.025481 - 01010 */
- d->HuffQ7[0][27].Code = 5; d->HuffQ7[0][27].Length = 5; /* 0.024867 - 00101 */
- d->HuffQ7[0][28].Code = 9; d->HuffQ7[0][28].Length = 5; /* 0.025352 - 01001 */
- d->HuffQ7[0][29].Code = 6; d->HuffQ7[0][29].Length = 5; /* 0.025074 - 00110 */
- d->HuffQ7[0][30].Code = 13; d->HuffQ7[0][30].Length = 5; /* 0.025745 - 01101 */
- d->HuffQ7[0][31].Code = 7; d->HuffQ7[0][31].Length = 5; /* 0.025195 - 00111 */
- d->HuffQ7[0][32].Code = 11; d->HuffQ7[0][32].Length = 5; /* 0.025502 - 01011 */
- d->HuffQ7[0][33].Code = 15; d->HuffQ7[0][33].Length = 5; /* 0.026251 - 01111 */
- d->HuffQ7[0][34].Code = 8; d->HuffQ7[0][34].Length = 5; /* 0.025260 - 01000 */
- d->HuffQ7[0][35].Code = 4; d->HuffQ7[0][35].Length = 5; /* 0.024418 - 00100 */
- d->HuffQ7[0][36].Code = 3; d->HuffQ7[0][36].Length = 5; /* 0.023983 - 00011 */
- d->HuffQ7[0][37].Code = 1; d->HuffQ7[0][37].Length = 5; /* 0.023697 - 00001 */
- d->HuffQ7[0][38].Code = 63; d->HuffQ7[0][38].Length = 6; /* 0.023041 - 111111 */
- d->HuffQ7[0][39].Code = 62; d->HuffQ7[0][39].Length = 6; /* 0.022656 - 111110 */
- d->HuffQ7[0][40].Code = 61; d->HuffQ7[0][40].Length = 6; /* 0.022549 - 111101 */
- d->HuffQ7[0][41].Code = 53; d->HuffQ7[0][41].Length = 6; /* 0.021151 - 110101 */
- d->HuffQ7[0][42].Code = 59; d->HuffQ7[0][42].Length = 6; /* 0.022042 - 111011 */
- d->HuffQ7[0][43].Code = 52; d->HuffQ7[0][43].Length = 6; /* 0.020837 - 110100 */
- d->HuffQ7[0][44].Code = 48; d->HuffQ7[0][44].Length = 6; /* 0.019446 - 110000 */
- d->HuffQ7[0][45].Code = 47; d->HuffQ7[0][45].Length = 6; /* 0.019189 - 101111 */
- d->HuffQ7[0][46].Code = 43; d->HuffQ7[0][46].Length = 6; /* 0.017177 - 101011 */
- d->HuffQ7[0][47].Code = 42; d->HuffQ7[0][47].Length = 6; /* 0.017035 - 101010 */
- d->HuffQ7[0][48].Code = 39; d->HuffQ7[0][48].Length = 6; /* 0.015287 - 100111 */
- d->HuffQ7[0][49].Code = 36; d->HuffQ7[0][49].Length = 6; /* 0.014559 - 100100 */
- d->HuffQ7[0][50].Code = 33; d->HuffQ7[0][50].Length = 6; /* 0.014117 - 100001 */
- d->HuffQ7[0][51].Code = 28; d->HuffQ7[0][51].Length = 6; /* 0.012776 - 011100 */
- d->HuffQ7[0][52].Code = 117; d->HuffQ7[0][52].Length = 7; /* 0.011107 - 1110101 */
- d->HuffQ7[0][53].Code = 101; d->HuffQ7[0][53].Length = 7; /* 0.010636 - 1100101 */
- d->HuffQ7[0][54].Code = 100; d->HuffQ7[0][54].Length = 7; /* 0.009751 - 1100100 */
- d->HuffQ7[0][55].Code = 80; d->HuffQ7[0][55].Length = 7; /* 0.008132 - 1010000 */
- d->HuffQ7[0][56].Code = 69; d->HuffQ7[0][56].Length = 7; /* 0.007091 - 1000101 */
- d->HuffQ7[0][57].Code = 68; d->HuffQ7[0][57].Length = 7; /* 0.007084 - 1000100 */
- d->HuffQ7[0][58].Code = 50; d->HuffQ7[0][58].Length = 7; /* 0.006277 - 0110010 */
- d->HuffQ7[0][59].Code = 232; d->HuffQ7[0][59].Length = 8; /* 0.005386 - 11101000 */
- d->HuffQ7[0][60].Code = 180; d->HuffQ7[0][60].Length = 8; /* 0.004408 - 10110100 */
- d->HuffQ7[0][61].Code = 152; d->HuffQ7[0][61].Length = 8; /* 0.003759 - 10011000 */
- d->HuffQ7[0][62].Code = 102; d->HuffQ7[0][62].Length = 8; /* 0.003160 - 01100110 */
-
- //more shaped, book 1
- d->HuffQ7[1][ 0].Code = 14244; d->HuffQ7[1][ 0].Length = 14; /* 0.000059 - 11011110100100 */
- d->HuffQ7[1][ 1].Code = 14253; d->HuffQ7[1][ 1].Length = 14; /* 0.000098 - 11011110101101 */
- d->HuffQ7[1][ 2].Code = 14246; d->HuffQ7[1][ 2].Length = 14; /* 0.000078 - 11011110100110 */
- d->HuffQ7[1][ 3].Code = 14254; d->HuffQ7[1][ 3].Length = 14; /* 0.000111 - 11011110101110 */
- d->HuffQ7[1][ 4].Code = 3562; d->HuffQ7[1][ 4].Length = 12; /* 0.000320 - 110111101010 */
- d->HuffQ7[1][ 5].Code = 752; d->HuffQ7[1][ 5].Length = 10; /* 0.000920 - 1011110000 */
- d->HuffQ7[1][ 6].Code = 753; d->HuffQ7[1][ 6].Length = 10; /* 0.001057 - 1011110001 */
- d->HuffQ7[1][ 7].Code = 160; d->HuffQ7[1][ 7].Length = 9; /* 0.001403 - 010100000 */
- d->HuffQ7[1][ 8].Code = 162; d->HuffQ7[1][ 8].Length = 9; /* 0.001579 - 010100010 */
- d->HuffQ7[1][ 9].Code = 444; d->HuffQ7[1][ 9].Length = 9; /* 0.002486 - 110111100 */
- d->HuffQ7[1][10].Code = 122; d->HuffQ7[1][10].Length = 8; /* 0.003772 - 01111010 */
- d->HuffQ7[1][11].Code = 223; d->HuffQ7[1][11].Length = 8; /* 0.005710 - 11011111 */
- d->HuffQ7[1][12].Code = 60; d->HuffQ7[1][12].Length = 7; /* 0.006858 - 0111100 */
- d->HuffQ7[1][13].Code = 73; d->HuffQ7[1][13].Length = 7; /* 0.008033 - 1001001 */
- d->HuffQ7[1][14].Code = 110; d->HuffQ7[1][14].Length = 7; /* 0.009827 - 1101110 */
- d->HuffQ7[1][15].Code = 14; d->HuffQ7[1][15].Length = 6; /* 0.012601 - 001110 */
- d->HuffQ7[1][16].Code = 24; d->HuffQ7[1][16].Length = 6; /* 0.013194 - 011000 */
- d->HuffQ7[1][17].Code = 25; d->HuffQ7[1][17].Length = 6; /* 0.013938 - 011001 */
- d->HuffQ7[1][18].Code = 34; d->HuffQ7[1][18].Length = 6; /* 0.015693 - 100010 */
- d->HuffQ7[1][19].Code = 37; d->HuffQ7[1][19].Length = 6; /* 0.017846 - 100101 */
- d->HuffQ7[1][20].Code = 54; d->HuffQ7[1][20].Length = 6; /* 0.020078 - 110110 */
- d->HuffQ7[1][21].Code = 3; d->HuffQ7[1][21].Length = 5; /* 0.022975 - 00011 */
- d->HuffQ7[1][22].Code = 9; d->HuffQ7[1][22].Length = 5; /* 0.025631 - 01001 */
- d->HuffQ7[1][23].Code = 11; d->HuffQ7[1][23].Length = 5; /* 0.027021 - 01011 */
- d->HuffQ7[1][24].Code = 16; d->HuffQ7[1][24].Length = 5; /* 0.031465 - 10000 */
- d->HuffQ7[1][25].Code = 19; d->HuffQ7[1][25].Length = 5; /* 0.034244 - 10011 */
- d->HuffQ7[1][26].Code = 21; d->HuffQ7[1][26].Length = 5; /* 0.035921 - 10101 */
- d->HuffQ7[1][27].Code = 24; d->HuffQ7[1][27].Length = 5; /* 0.037938 - 11000 */
- d->HuffQ7[1][28].Code = 26; d->HuffQ7[1][28].Length = 5; /* 0.039595 - 11010 */
- d->HuffQ7[1][29].Code = 29; d->HuffQ7[1][29].Length = 5; /* 0.041546 - 11101 */
- d->HuffQ7[1][30].Code = 31; d->HuffQ7[1][30].Length = 5; /* 0.042623 - 11111 */
- d->HuffQ7[1][31].Code = 2; d->HuffQ7[1][31].Length = 4; /* 0.045180 - 0010 */
- d->HuffQ7[1][32].Code = 0; d->HuffQ7[1][32].Length = 4; /* 0.043151 - 0000 */
- d->HuffQ7[1][33].Code = 30; d->HuffQ7[1][33].Length = 5; /* 0.042538 - 11110 */
- d->HuffQ7[1][34].Code = 28; d->HuffQ7[1][34].Length = 5; /* 0.041422 - 11100 */
- d->HuffQ7[1][35].Code = 25; d->HuffQ7[1][35].Length = 5; /* 0.039145 - 11001 */
- d->HuffQ7[1][36].Code = 22; d->HuffQ7[1][36].Length = 5; /* 0.036691 - 10110 */
- d->HuffQ7[1][37].Code = 20; d->HuffQ7[1][37].Length = 5; /* 0.034955 - 10100 */
- d->HuffQ7[1][38].Code = 14; d->HuffQ7[1][38].Length = 5; /* 0.029155 - 01110 */
- d->HuffQ7[1][39].Code = 13; d->HuffQ7[1][39].Length = 5; /* 0.027921 - 01101 */
- d->HuffQ7[1][40].Code = 8; d->HuffQ7[1][40].Length = 5; /* 0.025553 - 01000 */
- d->HuffQ7[1][41].Code = 6; d->HuffQ7[1][41].Length = 5; /* 0.023093 - 00110 */
- d->HuffQ7[1][42].Code = 2; d->HuffQ7[1][42].Length = 5; /* 0.021200 - 00010 */
- d->HuffQ7[1][43].Code = 46; d->HuffQ7[1][43].Length = 6; /* 0.018134 - 101110 */
- d->HuffQ7[1][44].Code = 35; d->HuffQ7[1][44].Length = 6; /* 0.015824 - 100011 */
- d->HuffQ7[1][45].Code = 31; d->HuffQ7[1][45].Length = 6; /* 0.014701 - 011111 */
- d->HuffQ7[1][46].Code = 21; d->HuffQ7[1][46].Length = 6; /* 0.013187 - 010101 */
- d->HuffQ7[1][47].Code = 15; d->HuffQ7[1][47].Length = 6; /* 0.012776 - 001111 */
- d->HuffQ7[1][48].Code = 95; d->HuffQ7[1][48].Length = 7; /* 0.009664 - 1011111 */
- d->HuffQ7[1][49].Code = 72; d->HuffQ7[1][49].Length = 7; /* 0.007922 - 1001000 */
- d->HuffQ7[1][50].Code = 41; d->HuffQ7[1][50].Length = 7; /* 0.006838 - 0101001 */
- d->HuffQ7[1][51].Code = 189; d->HuffQ7[1][51].Length = 8; /* 0.005024 - 10111101 */
- d->HuffQ7[1][52].Code = 123; d->HuffQ7[1][52].Length = 8; /* 0.003830 - 01111011 */
- d->HuffQ7[1][53].Code = 377; d->HuffQ7[1][53].Length = 9; /* 0.002232 - 101111001 */
- d->HuffQ7[1][54].Code = 161; d->HuffQ7[1][54].Length = 9; /* 0.001566 - 010100001 */
- d->HuffQ7[1][55].Code = 891; d->HuffQ7[1][55].Length = 10; /* 0.001383 - 1101111011 */
- d->HuffQ7[1][56].Code = 327; d->HuffQ7[1][56].Length = 10; /* 0.000900 - 0101000111 */
- d->HuffQ7[1][57].Code = 326; d->HuffQ7[1][57].Length = 10; /* 0.000790 - 0101000110 */
- d->HuffQ7[1][58].Code = 3560; d->HuffQ7[1][58].Length = 12; /* 0.000254 - 110111101000 */
- d->HuffQ7[1][59].Code = 14255; d->HuffQ7[1][59].Length = 14; /* 0.000117 - 11011110101111 */
- d->HuffQ7[1][60].Code = 14247; d->HuffQ7[1][60].Length = 14; /* 0.000085 - 11011110100111 */
- d->HuffQ7[1][61].Code = 14252; d->HuffQ7[1][61].Length = 14; /* 0.000085 - 11011110101100 */
- d->HuffQ7[1][62].Code = 14245; d->HuffQ7[1][62].Length = 14; /* 0.000065 - 11011110100101 */
-}
diff --git a/src/libmusepack/musepack/Makefile.am b/src/libmusepack/musepack/Makefile.am
deleted file mode 100644
index 1d37e1d79..000000000
--- a/src/libmusepack/musepack/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/misc/Makefile.common
-
-noinst_HEADERS = config_types.h decoder.h huffman.h internal.h math.h \
- musepack.h reader.h requant.h streaminfo.h
-
diff --git a/src/libmusepack/musepack/config_types.h b/src/libmusepack/musepack/config_types.h
deleted file mode 100644
index f501f5a38..000000000
--- a/src/libmusepack/musepack/config_types.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __CONFIG_TYPES_H__
-#define __CONFIG_TYPES_H__
-
-#include "os_types.h"
-
-#ifdef WORDS_BIGENDIAN
- #undef MPC_LITTLE_ENDIAN
-#else
- #define MPC_LITTLE_ENDIAN
-#endif
-
-typedef unsigned char mpc_bool_t;
-#define TRUE 1
-#define FALSE 0
-
-/* these are filled in by configure */
-typedef int16_t mpc_int16_t;
-typedef uint16_t mpc_uint16_t;
-typedef int32_t mpc_int32_t;
-typedef uint32_t mpc_uint32_t;
-typedef int64_t mpc_int64_t;
-
-#endif
diff --git a/src/libmusepack/musepack/decoder.h b/src/libmusepack/musepack/decoder.h
deleted file mode 100644
index 08c316390..000000000
--- a/src/libmusepack/musepack/decoder.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/// \file decoder.h
-
-#ifndef _musepack_decoder_h_
-#define _musepack_decoder_h_
-
-#include "musepack/huffman.h"
-#include "musepack/math.h"
-#include "musepack/musepack.h"
-#include "musepack/reader.h"
-#include "musepack/streaminfo.h"
-
-enum {
- MPC_V_MEM = 2304,
- MPC_DECODER_MEMSIZE = 16384, // overall buffer size
-};
-
-typedef struct {
- mpc_int32_t L [36];
- mpc_int32_t R [36];
-} QuantTyp;
-
-typedef struct mpc_decoder_t {
- mpc_reader *r;
-
- /// @name internal state variables
- //@{
-
- mpc_uint32_t dword; /// actually decoded 32bit-word
- mpc_uint32_t pos; /// bit-position within dword
- mpc_uint32_t Speicher[MPC_DECODER_MEMSIZE]; /// read-buffer
- mpc_uint32_t Zaehler; /// actual index within read-buffer
-
- mpc_uint32_t samples_to_skip;
-
- mpc_uint32_t FwdJumpInfo;
- mpc_uint32_t ActDecodePos;
- mpc_uint32_t FrameWasValid;
-
- mpc_uint32_t DecodedFrames;
- mpc_uint32_t OverallFrames;
- mpc_int32_t SampleRate; // Sample frequency
-
- mpc_uint32_t StreamVersion; // version of bitstream
- mpc_uint32_t MS_used; // MS-coding used ?
- mpc_int32_t Max_Band;
- mpc_uint32_t MPCHeaderPos; // AB: needed to support ID3v2
- mpc_uint32_t LastValidSamples;
- mpc_uint32_t TrueGaplessPresent;
-
- mpc_uint32_t EQ_activated;
-
- mpc_uint32_t WordsRead; // counts amount of decoded dwords
-
- // randomizer state variables
- mpc_uint32_t __r1;
- mpc_uint32_t __r2;
-
- mpc_uint32_t Q_bit [32];
- mpc_uint32_t Q_res [32][16];
-
- // huffman table stuff
- HuffmanTyp HuffHdr [10];
- HuffmanTyp HuffSCFI [ 4];
- HuffmanTyp HuffDSCF [16];
- HuffmanTyp* HuffQ [2] [8];
-
- HuffmanTyp HuffQ1 [2] [3*3*3];
- HuffmanTyp HuffQ2 [2] [5*5];
- HuffmanTyp HuffQ3 [2] [ 7];
- HuffmanTyp HuffQ4 [2] [ 9];
- HuffmanTyp HuffQ5 [2] [15];
- HuffmanTyp HuffQ6 [2] [31];
- HuffmanTyp HuffQ7 [2] [63];
- const HuffmanTyp* SampleHuff [18];
- HuffmanTyp SCFI_Bundle [ 8];
- HuffmanTyp DSCF_Entropie [13];
- HuffmanTyp Region_A [16];
- HuffmanTyp Region_B [ 8];
- HuffmanTyp Region_C [ 4];
-
- HuffmanTyp Entropie_1 [ 3];
- HuffmanTyp Entropie_2 [ 5];
- HuffmanTyp Entropie_3 [ 7];
- HuffmanTyp Entropie_4 [ 9];
- HuffmanTyp Entropie_5 [15];
- HuffmanTyp Entropie_6 [31];
- HuffmanTyp Entropie_7 [63];
-
- mpc_int32_t SCF_Index_L [32] [3];
- mpc_int32_t SCF_Index_R [32] [3]; // holds scalefactor-indices
- QuantTyp Q [32]; // holds quantized samples
- mpc_int32_t Res_L [32];
- mpc_int32_t Res_R [32]; // holds the chosen quantizer for each subband
- mpc_int32_t DSCF_Flag_L [32];
- mpc_int32_t DSCF_Flag_R [32]; // differential SCF used?
- mpc_int32_t SCFI_L [32];
- mpc_int32_t SCFI_R [32]; // describes order of transmitted SCF
- mpc_int32_t DSCF_Reference_L [32];
- mpc_int32_t DSCF_Reference_R [32]; // holds last frames SCF
- mpc_int32_t MS_Flag[32]; // MS used?
-#ifdef MPC_FIXED_POINT
- unsigned char SCF_shift[256];
-#endif
-
- MPC_SAMPLE_FORMAT V_L[MPC_V_MEM + 960];
- MPC_SAMPLE_FORMAT V_R[MPC_V_MEM + 960];
- MPC_SAMPLE_FORMAT Y_L[36][32];
- MPC_SAMPLE_FORMAT Y_R[36][32];
- MPC_SAMPLE_FORMAT SCF[256]; ///< holds adapted scalefactors (for clipping prevention)
- //@}
-
-} mpc_decoder;
-
-#endif // _mpc_decoder_h
diff --git a/src/libmusepack/musepack/huffman.h b/src/libmusepack/musepack/huffman.h
deleted file mode 100644
index 7f587771f..000000000
--- a/src/libmusepack/musepack/huffman.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/// \file huffman.h
-/// Data structures and functions for huffman coding.
-
-#ifndef _musepack_huffman_h_
-#define _musepack_huffman_h_
-
-#include "musepack/config_types.h"
-#include "musepack/decoder.h"
-
-struct mpc_decoder_t; // forward declare to break circular dependencies
-
-/// Huffman table entry.
-typedef struct huffman_type_t {
- mpc_uint32_t Code;
- mpc_uint32_t Length;
- mpc_int32_t Value;
-} HuffmanTyp;
-
-//! \brief Sorts huffman-tables by codeword.
-//!
-//! offset resulting value.
-//! \param elements
-//! \param Table table to sort
-//! \param offset offset of resulting sort
-void
-mpc_decoder_resort_huff_tables(
- const mpc_uint32_t elements, HuffmanTyp *Table, const mpc_int32_t offset);
-
-/// Initializes sv6 huffman decoding structures.
-void mpc_decoder_init_huffman_sv6(struct mpc_decoder_t *d);
-
-/// Initializes sv6 huffman decoding tables.
-void mpc_decoder_init_huffman_sv6_tables(struct mpc_decoder_t *d);
-
-/// Initializes sv7 huffman decoding structures.
-void mpc_decoder_init_huffman_sv7(struct mpc_decoder_t *d);
-
-/// Initializes sv7 huffman decoding tables.
-void mpc_decoder_init_huffman_sv7_tables(struct mpc_decoder_t *d);
-
-#endif // _musepack_huffman_h_
diff --git a/src/libmusepack/musepack/internal.h b/src/libmusepack/musepack/internal.h
deleted file mode 100644
index f86b45bb3..000000000
--- a/src/libmusepack/musepack/internal.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/// \file musepack_internal.h
-/// Definitions and structures used only internally by the libmusepack.
-
-#ifndef _musepack_internal_h
-#define _musepack_internal_h
-
-enum {
- MPC_DECODER_SYNTH_DELAY = 481
-};
-
-#ifndef swap32
-/// Big/little endian 32 bit byte swapping routine.
-static inline
-mpc_uint32_t swap32(mpc_uint32_t val) {
- const unsigned char* src = (const unsigned char*)&val;
- return
- (mpc_uint32_t)src[0] |
- ((mpc_uint32_t)src[1] << 8) | ((mpc_uint32_t)src[2] << 16) | ((mpc_uint32_t)src[3] << 24);
-}
-#endif
-
-/// Searches for a ID3v2-tag and reads the length (in bytes) of it.
-/// \param reader supplying raw stream data
-/// \return size of tag, in bytes
-/// \return -1 on errors of any kind
-mpc_int32_t JumpID3v2(mpc_reader* fp);
-
-/// helper functions used by multiple files
-mpc_uint32_t random_int(mpc_decoder *d); // in synth_filter.c
-void mpc_decoder_initialisiere_quantisierungstabellen(mpc_decoder *d, double scale_factor);
-void mpc_decoder_synthese_filter_float(mpc_decoder *d, MPC_SAMPLE_FORMAT* OutData);
-
-#endif // _musepack_internal_h
-
diff --git a/src/libmusepack/musepack/reader.h b/src/libmusepack/musepack/reader.h
deleted file mode 100644
index 2f29f97e4..000000000
--- a/src/libmusepack/musepack/reader.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/// \file reader.h
-
-#ifndef _musepack_reader_h_
-#define _musepack_reader_h_
-
-/// \brief Stream reader interface structure.
-///
-/// This is the structure you must supply to the musepack decoding library
-/// to feed it with raw data. Implement the five member functions to provide
-/// a functional reader.
-typedef struct mpc_reader_t {
- /// Reads size bytes of data into buffer at ptr.
- mpc_int32_t (*read)(void *t, void *ptr, mpc_int32_t size);
-
- /// Seeks to byte position offset.
- mpc_bool_t (*seek)(void *t, mpc_int32_t offset);
-
- /// Returns the current byte offset in the stream.
- mpc_int32_t (*tell)(void *t);
-
- /// Returns the total length of the source stream, in bytes.
- mpc_int32_t (*get_size)(void *t);
-
- /// True if the stream is a seekable stream.
- mpc_bool_t (*canseek)(void *t);
-
- /// Optional field that can be used to identify a particular instance of
- /// reader or carry along data associated with that reader.
- void *data;
-
- // These are used by provided internal standard file-based reader implementation.
- // You shouldn't touch them. They're included in the main struct to avoid
- // malloc/free.
- FILE *file;
- long file_size;
- mpc_bool_t is_seekable;
-} mpc_reader;
-
-/// Initializes reader with default stdio file reader implementation. Use
-/// this if you're just reading from a plain file.
-///
-/// \param r reader struct to initalize
-/// \param input input stream to attach to the reader
-void mpc_reader_setup_file_reader(mpc_reader *r, FILE *input);
-
-#endif // _musepack_reader_h_
diff --git a/src/libmusepack/musepack/requant.h b/src/libmusepack/musepack/requant.h
deleted file mode 100644
index dc9a5c32f..000000000
--- a/src/libmusepack/musepack/requant.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/// \file requant.h
-/// Requantization function definitions.
-
-#ifndef _musepack_requant_h
-#define _musepack_requant_h_
-
-#include "musepack/musepack.h"
-
-/* C O N S T A N T S */
-extern const mpc_uint32_t Res_bit [18]; // bits per sample for chosen quantizer
-extern const MPC_SAMPLE_FORMAT __Cc [1 + 18]; // coefficients for requantization
-extern const mpc_int32_t __Dc [1 + 18]; // offset for requantization
-
-#define Cc (__Cc + 1)
-#define Dc (__Dc + 1)
-
-#endif // _musepack_requant_h_
diff --git a/src/libmusepack/xine_musepack_decoder.c b/src/libmusepack/xine_musepack_decoder.c
index 26c2eddf5..4397f65e3 100644
--- a/src/libmusepack/xine_musepack_decoder.c
+++ b/src/libmusepack/xine_musepack_decoder.c
@@ -43,11 +43,7 @@
#include "buffer.h"
#include "xineutils.h"
-#ifdef HAVE_MPCDEC_MPCDEC_H
-# include <mpcdec/mpcdec.h>
-#else
-# include "musepack/musepack.h"
-#endif
+#include <mpcdec/mpcdec.h>
#define MPC_DECODER_MEMSIZE 65536
#define MPC_DECODER_MEMSIZE2 (MPC_DECODER_MEMSIZE/2)