diff options
Diffstat (limited to 'akode/plugins/mpc_decoder')
21 files changed, 4847 insertions, 0 deletions
diff --git a/akode/plugins/mpc_decoder/Makefile.am b/akode/plugins/mpc_decoder/Makefile.am new file mode 100644 index 0000000..ad7546e --- /dev/null +++ b/akode/plugins/mpc_decoder/Makefile.am @@ -0,0 +1,8 @@ +SUBDIRS = mppdec . +INCLUDES = -I$(top_srcdir)/akode/lib -I$(top_builddir)/akode/lib -I$(srcdir)/mppdec $(all_includes) + +lib_LTLIBRARIES = libakode_mpc_decoder.la + +libakode_mpc_decoder_la_SOURCES = mpc_decoder.cpp +libakode_mpc_decoder_la_LDFLAGS = -module -avoid-version -no-undefined +libakode_mpc_decoder_la_LIBADD = ../../lib/libakode.la mppdec/libakode_mppdec.la diff --git a/akode/plugins/mpc_decoder/Makefile.in b/akode/plugins/mpc_decoder/Makefile.in new file mode 100644 index 0000000..39866eb --- /dev/null +++ b/akode/plugins/mpc_decoder/Makefile.in @@ -0,0 +1,778 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision: 483858 $ +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = akode/plugins/mpc_decoder +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/akode/lib/akode_export.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +libakode_mpc_decoder_la_DEPENDENCIES = ../../lib/libakode.la \ + mppdec/libakode_mppdec.la +am_libakode_mpc_decoder_la_OBJECTS = mpc_decoder.lo +#>- libakode_mpc_decoder_la_OBJECTS = \ +#>- $(am_libakode_mpc_decoder_la_OBJECTS) +#>+ 1 +libakode_mpc_decoder_la_OBJECTS = mpc_decoder.lo +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir)/akode/lib +depcomp = $(SHELL) $(top_srcdir)/admin/depcomp +am__depfiles_maybe = depfiles +#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 2 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +#>- LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ +#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +#>- $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 3 +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +CXXLD = $(CXX) +#>- CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ +#>- $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +#>+ 2 +CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(KDE_CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libakode_mpc_decoder_la_SOURCES) +DIST_SOURCES = $(libakode_mpc_decoder_la_SOURCES) +#>- RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ +#>- html-recursive info-recursive install-data-recursive \ +#>- install-exec-recursive install-info-recursive \ +#>- install-recursive installcheck-recursive installdirs-recursive \ +#>- pdf-recursive ps-recursive uninstall-info-recursive \ +#>- uninstall-recursive +#>+ 6 +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive nmcheck-recursive bcheck-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +#>+ 1 +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) +ACLOCAL = @ACLOCAL@ +AKODE_LIBDL = @AKODE_LIBDL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AVCODEC_CFLAGS = @AVCODEC_CFLAGS@ +AVCODEC_LDFLAGS = @AVCODEC_LDFLAGS@ +AVCODEC_LIBADD = @AVCODEC_LIBADD@ +AVFORMAT_CFLAGS = @AVFORMAT_CFLAGS@ +AVFORMAT_LDFLAGS = @AVFORMAT_LDFLAGS@ +AVFORMAT_LIBADD = @AVFORMAT_LIBADD@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_PERMISSIVE_FLAG = @ENABLE_PERMISSIVE_FLAG@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +HAVE_GCC_VISIBILITY = @HAVE_GCC_VISIBILITY@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JACK_CFLAGS = @JACK_CFLAGS@ +JACK_LDFLAGS = @JACK_LDFLAGS@ +JACK_LIBADD = @JACK_LIBADD@ +KDE_CHECK_PLUGIN = @KDE_CHECK_PLUGIN@ +KDE_NO_UNDEFINED = @KDE_NO_UNDEFINED@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +KDE_USE_NMCHECK_FALSE = @KDE_USE_NMCHECK_FALSE@ +KDE_USE_NMCHECK_TRUE = @KDE_USE_NMCHECK_TRUE@ +LDFLAGS = @LDFLAGS@ +LDFLAGS_AS_NEEDED = @LDFLAGS_AS_NEEDED@ +LDFLAGS_NEW_DTAGS = @LDFLAGS_NEW_DTAGS@ +LIBFLAC = @LIBFLAC@ +LIBOBJS = @LIBOBJS@ +LIBOGGFLAC = @LIBOGGFLAC@ +LIBOSSAUDIO = @LIBOSSAUDIO@ +LIBPTHREAD = @LIBPTHREAD@ +LIBS = @LIBS@ +LIBSAMPLERATE = @LIBSAMPLERATE@ +LIBSEM = @LIBSEM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MADLIBS = @MADLIBS@ +MAKEINFO = @MAKEINFO@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POLYP_CFLAGS = @POLYP_CFLAGS@ +POLYP_LDFLAGS = @POLYP_LDFLAGS@ +POLYP_LIBADD = @POLYP_LIBADD@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SPEEXLIBS = @SPEEXLIBS@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +USER_INCLUDES = @USER_INCLUDES@ +USER_LDFLAGS = @USER_LDFLAGS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RTTI = @USE_RTTI@ +VERSION = @VERSION@ +VORBISFILE_LIBS = @VORBISFILE_LIBS@ +VORBIS_LIBS = @VORBIS_LIBS@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +akode_SUBDIR_included_FALSE = @akode_SUBDIR_included_FALSE@ +akode_SUBDIR_included_TRUE = @akode_SUBDIR_included_TRUE@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +include_alsa_sink_FALSE = @include_alsa_sink_FALSE@ +include_alsa_sink_TRUE = @include_alsa_sink_TRUE@ +include_ffmpeg_decoder_FALSE = @include_ffmpeg_decoder_FALSE@ +include_ffmpeg_decoder_TRUE = @include_ffmpeg_decoder_TRUE@ +include_jack_sink_FALSE = @include_jack_sink_FALSE@ +include_jack_sink_TRUE = @include_jack_sink_TRUE@ +include_mpeg_decoder_FALSE = @include_mpeg_decoder_FALSE@ +include_mpeg_decoder_TRUE = @include_mpeg_decoder_TRUE@ +include_oss_sink_FALSE = @include_oss_sink_FALSE@ +include_oss_sink_TRUE = @include_oss_sink_TRUE@ +include_polyp_sink_FALSE = @include_polyp_sink_FALSE@ +include_polyp_sink_TRUE = @include_polyp_sink_TRUE@ +include_src_resampler_FALSE = @include_src_resampler_FALSE@ +include_src_resampler_TRUE = @include_src_resampler_TRUE@ +include_sun_sink_FALSE = @include_sun_sink_FALSE@ +include_sun_sink_TRUE = @include_sun_sink_TRUE@ +include_xiph_decoder_FALSE = @include_xiph_decoder_FALSE@ +include_xiph_decoder_TRUE = @include_xiph_decoder_TRUE@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +unsermake_enable_pch_FALSE = @unsermake_enable_pch_FALSE@ +unsermake_enable_pch_TRUE = @unsermake_enable_pch_TRUE@ +SUBDIRS = mppdec . +INCLUDES = -I$(top_srcdir)/akode/lib -I$(top_builddir)/akode/lib -I$(srcdir)/mppdec $(all_includes) +lib_LTLIBRARIES = libakode_mpc_decoder.la +libakode_mpc_decoder_la_SOURCES = mpc_decoder.cpp +#>- libakode_mpc_decoder_la_LDFLAGS = -module -avoid-version -no-undefined +#>+ 1 +libakode_mpc_decoder_la_LDFLAGS = -module -avoid-version -no-undefined $(KDE_NO_UNDEFINED) +libakode_mpc_decoder_la_LIBADD = ../../lib/libakode.la mppdec/libakode_mppdec.la +#>- all: all-recursive +#>+ 1 +all: docs-am all-recursive + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +#>- @for dep in $?; do \ +#>- case '$(am__configure_deps)' in \ +#>- *$$dep*) \ +#>- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ +#>- && exit 0; \ +#>- exit 1;; \ +#>- esac; \ +#>- done; \ +#>- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu akode/plugins/mpc_decoder/Makefile'; \ +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu akode/plugins/mpc_decoder/Makefile +#>+ 12 + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu akode/plugins/mpc_decoder/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu akode/plugins/mpc_decoder/Makefile + cd $(top_srcdir) && perl admin/am_edit akode/plugins/mpc_decoder/Makefile.in +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +#>- libakode_mpc_decoder.la: $(libakode_mpc_decoder_la_OBJECTS) $(libakode_mpc_decoder_la_DEPENDENCIES) +#>+ 2 +@KDE_USE_CLOSURE_TRUE@libakode_mpc_decoder.la: libakode_mpc_decoder.la.closure $(libakode_mpc_decoder_la_OBJECTS) $(libakode_mpc_decoder_la_DEPENDENCIES) +@KDE_USE_CLOSURE_FALSE@libakode_mpc_decoder.la: $(libakode_mpc_decoder_la_OBJECTS) $(libakode_mpc_decoder_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libakode_mpc_decoder_la_LDFLAGS) $(libakode_mpc_decoder_la_OBJECTS) $(libakode_mpc_decoder_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpc_decoder.Plo@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-recursive +#>+ 1 +clean: kde-rpo-clean clean-recursive + +#>- clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ +#>- mostlyclean-am +#>+ 2 +clean-am: clean-closures clean-bcheck clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-recursive ctags ctags-recursive distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-libLTLIBRARIES install-man \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ + pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-info-am uninstall-libLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +#>+ 8 +libakode_mpc_decoder.la.closure: $(libakode_mpc_decoder_la_OBJECTS) $(libakode_mpc_decoder_la_DEPENDENCIES) + @echo "int main() {return 0;}" > libakode_mpc_decoder_la_closure.cpp + @$(LTCXXCOMPILE) -c libakode_mpc_decoder_la_closure.cpp + $(CXXLINK) libakode_mpc_decoder_la_closure.lo $(libakode_mpc_decoder_la_LDFLAGS) $(libakode_mpc_decoder_la_OBJECTS) $(libakode_mpc_decoder_la_LIBADD) $(LIBS) + @rm -f libakode_mpc_decoder_la_closure.* libakode_mpc_decoder.la.closure + @echo "timestamp" > libakode_mpc_decoder.la.closure + + +#>+ 2 +KDE_DIST=mpc_decoder.h Makefile.in Makefile.am + +#>+ 3 +clean-closures: + -rm -f libakode_mpc_decoder.la.closure + +#>+ 2 +docs-am: + +#>+ 15 +force-reedit: + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu akode/plugins/mpc_decoder/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu akode/plugins/mpc_decoder/Makefile + cd $(top_srcdir) && perl admin/am_edit akode/plugins/mpc_decoder/Makefile.in + + +#>+ 21 +clean-bcheck: + rm -f *.bchecktest.cc *.bchecktest.cc.class a.out + +bcheck: bcheck-recursive + +bcheck-am: + @for i in ; do \ + if test $(srcdir)/$$i -nt $$i.bchecktest.cc; then \ + echo "int main() {return 0;}" > $$i.bchecktest.cc ; \ + echo "#include \"$$i\"" >> $$i.bchecktest.cc ; \ + echo "$$i"; \ + if ! $(CXXCOMPILE) --dump-class-hierarchy -c $$i.bchecktest.cc; then \ + rm -f $$i.bchecktest.cc; exit 1; \ + fi ; \ + echo "" >> $$i.bchecktest.cc.class; \ + perl $(top_srcdir)/admin/bcheck.pl $$i.bchecktest.cc.class || { rm -f $$i.bchecktest.cc; exit 1; }; \ + rm -f a.out; \ + fi ; \ + done + + +#>+ 3 +final: + $(MAKE) all-am + +#>+ 3 +final-install: + $(MAKE) install-am + +#>+ 3 +no-final: + $(MAKE) all-am + +#>+ 3 +no-final-install: + $(MAKE) install-am + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo + +#>+ 3 +nmcheck: +nmcheck-am: nmcheck diff --git a/akode/plugins/mpc_decoder/mpc_decoder.cpp b/akode/plugins/mpc_decoder/mpc_decoder.cpp new file mode 100644 index 0000000..a355ff4 --- /dev/null +++ b/akode/plugins/mpc_decoder/mpc_decoder.cpp @@ -0,0 +1,218 @@ +/* aKode: Musepack(MPC) Decoder + + Copyright (C) 2004 Allan Sandfeld Jensen <kde@carewolf.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" +//#ifdef AKODE_COMPILE_MPC + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#else +#include <stdint.h> +#endif + +#include "file.h" +#include "audioframe.h" + +#include "mpc_dec.h" + +#include "mpc_decoder.h" + +namespace aKode { + +class MPC_reader_impl : public MPC_reader +{ +public: + MPC_reader_impl(aKode::File *file, bool p_seekable) : m_file(file), m_seekable(p_seekable) + { + m_file->openRO(); + m_file->fadvise(); + } + virtual ~MPC_reader_impl() { + m_file->close(); + } + size_t read ( void *ptr, size_t size ) {return m_file->read((char*)ptr,size);} + bool seek ( int offset, int origin ) {return m_file->seek(offset,origin);} + long tell () {return m_file->position();} + long get_size () {return m_file->length();} + bool canseek() {return m_file->seekable();} +private: + aKode::File * m_file; + bool m_seekable; +}; + +bool MPCDecoderPlugin::canDecode(File* src) { + MPC_reader_impl reader(src, true); + StreamInfo si; + + int r = si.ReadStreamInfo(&reader); + return r==0; +} + +extern "C" { MPCDecoderPlugin mpc_decoder; } + +struct MPCDecoder::private_data +{ + private_data(File *src) : reader(src,true), decoder(&reader), + initialized(false), buffer(0), position(0), + eof(false), error(false) + {}; + MPC_reader_impl reader; + StreamInfo si; + MPC_decoder decoder; + + bool initialized; + MPC_SAMPLE_FORMAT *buffer; + + long position; + bool eof; + bool error; + + AudioConfiguration config; +}; + +MPCDecoder::MPCDecoder(File *src) { + m_data = new private_data(src); +} + +MPCDecoder::~MPCDecoder() { + if (m_data->initialized) + delete[] m_data->buffer; + delete m_data; +} + +void MPCDecoder::initialize() { + if (m_data->initialized) return; + + m_data->si.ReadStreamInfo(&m_data->reader); + m_data->error = !m_data->decoder.Initialize(&m_data->si); + m_data->buffer = new MPC_SAMPLE_FORMAT[MPC_decoder::DecodeBufferLength]; + m_data->initialized = true; + + m_data->config.channels = m_data->si.simple.Channels; + m_data->config.sample_rate = m_data->si.simple.SampleFreq; + m_data->config.sample_width = -32; + + if (m_data->config.channels <=2) + m_data->config.channel_config = MonoStereo; + else + m_data->config.channel_config = MultiChannel; + +} +/* +template<int bits> +static inline int32_t scale(float sample) +{ + static const int32_t max = (1<<(bits-1))-1; + + // scale + sample *= max; + + // round + sample += 0.5; + + // clip + if (sample > max) + sample = max; + else + if (sample < -max) + sample = -max; + + return (int32_t)sample; +}*/ + +bool MPCDecoder::readFrame(AudioFrame* frame) { + if (!m_data->initialized) initialize(); + + int status = m_data->decoder.Decode(m_data->buffer); + + if (status == -1) { + m_data->error=true; + return false; + } + if (status == 0) { + m_data->eof=true; + return false; + } + + int channels = m_data->config.channels; + long length = status; + frame->reserveSpace(&m_data->config, length); + m_data->position+=length; + + // Demux into frame + /* + int16_t** data = (int16_t**)frame->data; + for(int i=0; i<length; i++) + for(int j=0; j<channels; j++) { + data[j][i] = scale<16>(m_data->buffer[i*channels+j]); + }*/ + + float** data = (float**)frame->data; + for(int i=0; i<length; i++) + for(int j=0; j<channels; j++) + data[j][i] = m_data->buffer[i*channels+j]; + + frame->pos = position(); + return true; +} + +long MPCDecoder::length() { + if (!m_data->initialized) return -1; + return (long)(m_data->si.GetLength()*1000.0); +} + +long MPCDecoder::position() { + if (!m_data->initialized) return -1; + float mpcpos = ((float)m_data->position)/(float)m_data->si.simple.SampleFreq; + return (long)(mpcpos*1000.0); +} + +bool MPCDecoder::eof() { + return m_data->eof; +} + +bool MPCDecoder::error() { + return m_data->error; +} + +bool MPCDecoder::seekable() { + return m_data->reader.canseek(); +} + +bool MPCDecoder::seek(long pos) { + if (!m_data->initialized) return false; + + long samplepos = (long)((pos*(float)m_data->si.simple.SampleFreq)/1000.0); + + if (m_data->decoder.SeekSample(samplepos)) { + m_data->position = samplepos; + return true; + } + else + return false; +} + +const AudioConfiguration* MPCDecoder::audioConfiguration() { + return &m_data->config; +} + +} // namespace + +//#endif diff --git a/akode/plugins/mpc_decoder/mpc_decoder.h b/akode/plugins/mpc_decoder/mpc_decoder.h new file mode 100644 index 0000000..f88eede --- /dev/null +++ b/akode/plugins/mpc_decoder/mpc_decoder.h @@ -0,0 +1,69 @@ +/* aKode: MPC-Decoder + + Copyright (C) 2004 Allan Sandfeld Jensen <kde@carewolf.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _AKODE_MPC_DECODER_H +#define _AKODE_MPC_DECODER_H + +#include <config.h> +//#ifdef AKODE_COMPILE_MPC + +#include "decoder.h" + +namespace aKode { + +class File; +class AudioBuffer; + +class MPCDecoder : public Decoder { +public: + MPCDecoder(File* src); + virtual ~MPCDecoder(); + + virtual void initialize(); + virtual bool readFrame(AudioFrame* frame); + virtual long length(); + virtual long position(); + virtual bool seek(long); + virtual bool seekable(); + virtual bool eof(); + virtual bool error(); + + virtual const AudioConfiguration* audioConfiguration(); + + struct private_data; +private: + private_data *m_data; +}; + + +class MPCDecoderPlugin : public DecoderPlugin { +public: + virtual bool canDecode(File*); + virtual MPCDecoder* openDecoder(File* src) { + return new MPCDecoder(src); + }; +}; + +extern "C" MPCDecoderPlugin mpc_decoder; + +} // namespace + +//#endif // AKODE_COMPILE_MPC +#endif diff --git a/akode/plugins/mpc_decoder/mppdec/Makefile.am b/akode/plugins/mpc_decoder/mppdec/Makefile.am new file mode 100644 index 0000000..5f6f22a --- /dev/null +++ b/akode/plugins/mpc_decoder/mppdec/Makefile.am @@ -0,0 +1,7 @@ +INCLUDES = -I$(top_srcdir)/akode/lib $(all_includes) +noinst_LTLIBRARIES = libakode_mppdec.la + +libakode_mppdec_la_SOURCES = bitstream.cpp huffsv46.cpp huffsv7.cpp idtag.cpp mpc_dec.cpp requant.cpp streaminfo.cpp synth_filter.cpp + +# workaround +KDE_OPTIONS = nofinal diff --git a/akode/plugins/mpc_decoder/mppdec/Makefile.in b/akode/plugins/mpc_decoder/mppdec/Makefile.in new file mode 100644 index 0000000..f4f5971 --- /dev/null +++ b/akode/plugins/mpc_decoder/mppdec/Makefile.in @@ -0,0 +1,619 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision: 483858 $ +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = akode/plugins/mpc_decoder/mppdec +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/akode/lib/akode_export.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libakode_mppdec_la_LIBADD = +am_libakode_mppdec_la_OBJECTS = bitstream.lo huffsv46.lo huffsv7.lo \ + idtag.lo mpc_dec.lo requant.lo streaminfo.lo synth_filter.lo +#>- libakode_mppdec_la_OBJECTS = $(am_libakode_mppdec_la_OBJECTS) +#>+ 2 +libakode_mppdec_la_OBJECTS = bitstream.lo huffsv46.lo huffsv7.lo \ + idtag.lo mpc_dec.lo requant.lo streaminfo.lo synth_filter.lo +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir)/akode/lib +depcomp = $(SHELL) $(top_srcdir)/admin/depcomp +am__depfiles_maybe = depfiles +#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 2 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +#>- LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ +#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +#>- $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 3 +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +CXXLD = $(CXX) +#>- CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ +#>- $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +#>+ 2 +CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(KDE_CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libakode_mppdec_la_SOURCES) +DIST_SOURCES = $(libakode_mppdec_la_SOURCES) +ETAGS = etags +CTAGS = ctags +#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +#>+ 1 +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) +ACLOCAL = @ACLOCAL@ +AKODE_LIBDL = @AKODE_LIBDL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AVCODEC_CFLAGS = @AVCODEC_CFLAGS@ +AVCODEC_LDFLAGS = @AVCODEC_LDFLAGS@ +AVCODEC_LIBADD = @AVCODEC_LIBADD@ +AVFORMAT_CFLAGS = @AVFORMAT_CFLAGS@ +AVFORMAT_LDFLAGS = @AVFORMAT_LDFLAGS@ +AVFORMAT_LIBADD = @AVFORMAT_LIBADD@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_PERMISSIVE_FLAG = @ENABLE_PERMISSIVE_FLAG@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +HAVE_GCC_VISIBILITY = @HAVE_GCC_VISIBILITY@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JACK_CFLAGS = @JACK_CFLAGS@ +JACK_LDFLAGS = @JACK_LDFLAGS@ +JACK_LIBADD = @JACK_LIBADD@ +KDE_CHECK_PLUGIN = @KDE_CHECK_PLUGIN@ +KDE_NO_UNDEFINED = @KDE_NO_UNDEFINED@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +KDE_USE_NMCHECK_FALSE = @KDE_USE_NMCHECK_FALSE@ +KDE_USE_NMCHECK_TRUE = @KDE_USE_NMCHECK_TRUE@ +LDFLAGS = @LDFLAGS@ +LDFLAGS_AS_NEEDED = @LDFLAGS_AS_NEEDED@ +LDFLAGS_NEW_DTAGS = @LDFLAGS_NEW_DTAGS@ +LIBFLAC = @LIBFLAC@ +LIBOBJS = @LIBOBJS@ +LIBOGGFLAC = @LIBOGGFLAC@ +LIBOSSAUDIO = @LIBOSSAUDIO@ +LIBPTHREAD = @LIBPTHREAD@ +LIBS = @LIBS@ +LIBSAMPLERATE = @LIBSAMPLERATE@ +LIBSEM = @LIBSEM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MADLIBS = @MADLIBS@ +MAKEINFO = @MAKEINFO@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POLYP_CFLAGS = @POLYP_CFLAGS@ +POLYP_LDFLAGS = @POLYP_LDFLAGS@ +POLYP_LIBADD = @POLYP_LIBADD@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SPEEXLIBS = @SPEEXLIBS@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +USER_INCLUDES = @USER_INCLUDES@ +USER_LDFLAGS = @USER_LDFLAGS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RTTI = @USE_RTTI@ +VERSION = @VERSION@ +VORBISFILE_LIBS = @VORBISFILE_LIBS@ +VORBIS_LIBS = @VORBIS_LIBS@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +akode_SUBDIR_included_FALSE = @akode_SUBDIR_included_FALSE@ +akode_SUBDIR_included_TRUE = @akode_SUBDIR_included_TRUE@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +include_alsa_sink_FALSE = @include_alsa_sink_FALSE@ +include_alsa_sink_TRUE = @include_alsa_sink_TRUE@ +include_ffmpeg_decoder_FALSE = @include_ffmpeg_decoder_FALSE@ +include_ffmpeg_decoder_TRUE = @include_ffmpeg_decoder_TRUE@ +include_jack_sink_FALSE = @include_jack_sink_FALSE@ +include_jack_sink_TRUE = @include_jack_sink_TRUE@ +include_mpeg_decoder_FALSE = @include_mpeg_decoder_FALSE@ +include_mpeg_decoder_TRUE = @include_mpeg_decoder_TRUE@ +include_oss_sink_FALSE = @include_oss_sink_FALSE@ +include_oss_sink_TRUE = @include_oss_sink_TRUE@ +include_polyp_sink_FALSE = @include_polyp_sink_FALSE@ +include_polyp_sink_TRUE = @include_polyp_sink_TRUE@ +include_src_resampler_FALSE = @include_src_resampler_FALSE@ +include_src_resampler_TRUE = @include_src_resampler_TRUE@ +include_sun_sink_FALSE = @include_sun_sink_FALSE@ +include_sun_sink_TRUE = @include_sun_sink_TRUE@ +include_xiph_decoder_FALSE = @include_xiph_decoder_FALSE@ +include_xiph_decoder_TRUE = @include_xiph_decoder_TRUE@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +unsermake_enable_pch_FALSE = @unsermake_enable_pch_FALSE@ +unsermake_enable_pch_TRUE = @unsermake_enable_pch_TRUE@ +INCLUDES = -I$(top_srcdir)/akode/lib $(all_includes) +noinst_LTLIBRARIES = libakode_mppdec.la +libakode_mppdec_la_SOURCES = bitstream.cpp huffsv46.cpp huffsv7.cpp idtag.cpp mpc_dec.cpp requant.cpp streaminfo.cpp synth_filter.cpp + +# workaround +KDE_OPTIONS = nofinal +#>- all: all-am +#>+ 1 +all: docs-am all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +#>- @for dep in $?; do \ +#>- case '$(am__configure_deps)' in \ +#>- *$$dep*) \ +#>- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ +#>- && exit 0; \ +#>- exit 1;; \ +#>- esac; \ +#>- done; \ +#>- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu akode/plugins/mpc_decoder/mppdec/Makefile'; \ +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu akode/plugins/mpc_decoder/mppdec/Makefile +#>+ 12 + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu akode/plugins/mpc_decoder/mppdec/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu akode/plugins/mpc_decoder/mppdec/Makefile + cd $(top_srcdir) && perl admin/am_edit akode/plugins/mpc_decoder/mppdec/Makefile.in +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libakode_mppdec.la: $(libakode_mppdec_la_OBJECTS) $(libakode_mppdec_la_DEPENDENCIES) + $(CXXLINK) $(libakode_mppdec_la_LDFLAGS) $(libakode_mppdec_la_OBJECTS) $(libakode_mppdec_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitstream.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/huffsv46.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/huffsv7.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idtag.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpc_dec.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/requant.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/streaminfo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/synth_filter.Plo@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-am +#>+ 1 +clean: kde-rpo-clean clean-am + +#>- clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ +#>- mostlyclean-am +#>+ 2 +clean-am: clean-bcheck clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +#>+ 2 +KDE_DIST=streaminfo.h stdafx.cpp readme.txt requant.h stdafx.h mpc_dec.h mpc_math.h Makefile.in Makefile.am + +#>+ 2 +docs-am: + +#>+ 15 +force-reedit: + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu akode/plugins/mpc_decoder/mppdec/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu akode/plugins/mpc_decoder/mppdec/Makefile + cd $(top_srcdir) && perl admin/am_edit akode/plugins/mpc_decoder/mppdec/Makefile.in + + +#>+ 21 +clean-bcheck: + rm -f *.bchecktest.cc *.bchecktest.cc.class a.out + +bcheck: bcheck-am + +bcheck-am: + @for i in ; do \ + if test $(srcdir)/$$i -nt $$i.bchecktest.cc; then \ + echo "int main() {return 0;}" > $$i.bchecktest.cc ; \ + echo "#include \"$$i\"" >> $$i.bchecktest.cc ; \ + echo "$$i"; \ + if ! $(CXXCOMPILE) --dump-class-hierarchy -c $$i.bchecktest.cc; then \ + rm -f $$i.bchecktest.cc; exit 1; \ + fi ; \ + echo "" >> $$i.bchecktest.cc.class; \ + perl $(top_srcdir)/admin/bcheck.pl $$i.bchecktest.cc.class || { rm -f $$i.bchecktest.cc; exit 1; }; \ + rm -f a.out; \ + fi ; \ + done + + +#>+ 3 +final: + $(MAKE) all-am + +#>+ 3 +final-install: + $(MAKE) install-am + +#>+ 3 +no-final: + $(MAKE) all-am + +#>+ 3 +no-final-install: + $(MAKE) install-am + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo + +#>+ 3 +nmcheck: +nmcheck-am: nmcheck diff --git a/akode/plugins/mpc_decoder/mppdec/bitstream.cpp b/akode/plugins/mpc_decoder/mppdec/bitstream.cpp new file mode 100644 index 0000000..6e1714c --- /dev/null +++ b/akode/plugins/mpc_decoder/mppdec/bitstream.cpp @@ -0,0 +1,166 @@ +#include "stdafx.h" + + +/* C O N S T A N T S */ +const unsigned int 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 */ + +// resets bitstream decoding +void +MPC_decoder::Reset_BitstreamDecode ( void ) +{ + dword = 0; + pos = 0; + Zaehler = 0; + WordsRead = 0; +} + +// reports the number of read bits +unsigned int +MPC_decoder::BitsRead ( void ) +{ + return 32*WordsRead + pos; +} + +// read desired number of bits out of the bitstream +unsigned int +MPC_decoder::Bitstream_read ( const unsigned int bits ) +{ + unsigned int out = dword; + + pos += bits; + + if (pos<32) + { + out >>= (32-pos); + } + else + { + dword = Speicher[Zaehler=(Zaehler+1)&MEMMASK]; + pos -= 32; + if (pos) + { + out <<= pos; + out |= dword >> (32-pos); + } + ++WordsRead; + } + + return out & mask[bits]; +} + +// decode huffman +int +MPC_decoder::Huffman_Decode ( const HuffmanTyp* Table ) +{ + // load preview and decode + unsigned int code = dword << pos; + if (pos>18) code |= Speicher[(Zaehler+1)&MEMMASK] >> (32-pos); + while (code < Table->Code) Table++; + + // set the new position within bitstream without performing a dummy-read + if ((pos += Table->Length)>=32) + { + pos -= 32; + dword = Speicher[Zaehler=(Zaehler+1)&MEMMASK]; + ++WordsRead; + } + + return Table->Value; +} + +// faster huffman through previewing less bits +int +MPC_decoder::Huffman_Decode_fast ( const HuffmanTyp* Table ) +{ + // load preview and decode + unsigned int code = dword << pos; + if (pos>22) code |= Speicher[(Zaehler+1)&MEMMASK] >> (32-pos); + while (code < Table->Code) Table++; + + // set the new position within bitstream without performing a dummy-read + if ((pos += Table->Length)>=32) + { + pos -= 32; + dword = Speicher[Zaehler=(Zaehler+1)&MEMMASK]; + ++WordsRead; + } + + return Table->Value; +} + +// even faster huffman through previewing even less bits +int +MPC_decoder::Huffman_Decode_faster ( const HuffmanTyp* Table ) +{ + // load preview and decode + unsigned int code = dword << pos; + if (pos>27) code |= Speicher[(Zaehler+1)&MEMMASK] >> (32-pos); + while (code < Table->Code) Table++; + + // set the new position within bitstream without performing a dummy-read + if ((pos += Table->Length)>=32) + { + pos -= 32; + dword = Speicher[Zaehler=(Zaehler+1)&MEMMASK]; + ++WordsRead; + } + + return Table->Value; +} + +// decode SCFI-bundle (sv4,5,6) +void +MPC_decoder::SCFI_Bundle_read ( const HuffmanTyp* Table, int* SCFI, int* DSCF ) +{ + // load preview and decode + unsigned int code = dword << pos; + if (pos>26) code |= Speicher[(Zaehler+1)&MEMMASK] >> (32-pos); + while (code < Table->Code) Table++; + + // set the new position within bitstream without performing a dummy-read + if ((pos += Table->Length)>=32) + { + pos -= 32; + dword = Speicher[Zaehler=(Zaehler+1)&MEMMASK]; + ++WordsRead; + } + + *SCFI = Table->Value >> 1; + *DSCF = Table->Value & 1; +} + +int +MPC_decoder::HuffmanTyp_cmpfn ( const void* p1, const void* p2 ) +{ + if ( ((const MPC_decoder::HuffmanTyp*) p1)->Code < ((const MPC_decoder::HuffmanTyp*) p2)->Code ) return +1; + if ( ((const MPC_decoder::HuffmanTyp*) p1)->Code > ((const MPC_decoder::HuffmanTyp*) p2)->Code ) return -1; + return 0; +} + +// sort huffman-tables by codeword +// offset resulting value +void +MPC_decoder::Resort_HuffTables ( const unsigned int elements, HuffmanTyp* Table, const int offset ) +{ + unsigned int i; + + for ( i = 0; i < elements; i++ ) { + Table[i].Code <<= 32 - Table[i].Length; + Table[i].Value = i - offset; + } + qsort ( Table, elements, sizeof(*Table), HuffmanTyp_cmpfn ); +} + +/* end of bitstream.c */ diff --git a/akode/plugins/mpc_decoder/mppdec/huffsv46.cpp b/akode/plugins/mpc_decoder/mppdec/huffsv46.cpp new file mode 100644 index 0000000..b71f5c9 --- /dev/null +++ b/akode/plugins/mpc_decoder/mppdec/huffsv46.cpp @@ -0,0 +1,228 @@ +#include "stdafx.h" + +void +MPC_decoder::Huffman_SV6_Decoder ( void ) +{ + Huffman_SV6_Encoder (); + Resort_HuffTables( 16, Region_A , 0); + Resort_HuffTables( 8, Region_B , 0); + Resort_HuffTables( 4, Region_C , 0); + Resort_HuffTables( 8, SCFI_Bundle , 0); + Resort_HuffTables( 13, DSCF_Entropie , 6); + Resort_HuffTables( 3, Entropie_1 , Dc[1]); + Resort_HuffTables( 5, Entropie_2 , Dc[2]); + Resort_HuffTables( 7, Entropie_3 , Dc[3]); + Resort_HuffTables( 9, Entropie_4 , Dc[4]); + Resort_HuffTables( 15, Entropie_5 , Dc[5]); + Resort_HuffTables( 31, Entropie_6 , Dc[6]); + Resort_HuffTables( 63, Entropie_7 , Dc[7]); +} + +void MPC_decoder::Huffman_SV6_Encoder ( void ) +{ + // SCFI-bundle + SCFI_Bundle[7].Code= 1; SCFI_Bundle[7].Length= 1; + SCFI_Bundle[3].Code= 1; SCFI_Bundle[3].Length= 2; + SCFI_Bundle[5].Code= 0; SCFI_Bundle[5].Length= 3; + SCFI_Bundle[1].Code= 7; SCFI_Bundle[1].Length= 5; + SCFI_Bundle[2].Code= 6; SCFI_Bundle[2].Length= 5; + SCFI_Bundle[4].Code= 4; SCFI_Bundle[4].Length= 5; + SCFI_Bundle[0].Code= 11; SCFI_Bundle[0].Length= 6; + SCFI_Bundle[6].Code= 10; SCFI_Bundle[6].Length= 6; + + // region A (subbands 0..10) + Region_A[ 1].Code= 1; Region_A[ 1].Length= 1; + Region_A[ 2].Code= 0; Region_A[ 2].Length= 2; + Region_A[ 0].Code= 2; Region_A[ 0].Length= 3; + Region_A[ 3].Code= 15; Region_A[ 3].Length= 5; + Region_A[ 5].Code= 13; Region_A[ 5].Length= 5; + Region_A[ 6].Code= 12; Region_A[ 6].Length= 5; + Region_A[ 4].Code= 29; Region_A[ 4].Length= 6; + Region_A[ 7].Code= 57; Region_A[ 7].Length= 7; + Region_A[ 8].Code= 113; Region_A[ 8].Length= 8; + Region_A[ 9].Code= 225; Region_A[ 9].Length= 9; + Region_A[10].Code= 449; Region_A[10].Length= 10; + Region_A[11].Code= 897; Region_A[11].Length= 11; + Region_A[12].Code= 1793; Region_A[12].Length= 12; + Region_A[13].Code= 3585; Region_A[13].Length= 13; + Region_A[14].Code= 7169; Region_A[14].Length= 14; + Region_A[15].Code= 7168; Region_A[15].Length= 14; + + // region B (subbands 11..22) + Region_B[1].Code= 1; Region_B[1].Length= 1; + Region_B[0].Code= 1; Region_B[0].Length= 2; + Region_B[2].Code= 1; Region_B[2].Length= 3; + Region_B[3].Code= 1; Region_B[3].Length= 4; + Region_B[4].Code= 1; Region_B[4].Length= 5; + Region_B[5].Code= 1; Region_B[5].Length= 6; + Region_B[6].Code= 1; Region_B[6].Length= 7; + Region_B[7].Code= 0; Region_B[7].Length= 7; + + // region C (subbands 23..31) + Region_C[0].Code= 1; Region_C[0].Length= 1; + Region_C[1].Code= 1; Region_C[1].Length= 2; + Region_C[2].Code= 1; Region_C[2].Length= 3; + Region_C[3].Code= 0; Region_C[3].Length= 3; + + // DSCF + DSCF_Entropie[ 6].Code= 0; DSCF_Entropie[ 6].Length= 2; + DSCF_Entropie[ 7].Code= 7; DSCF_Entropie[ 7].Length= 3; + DSCF_Entropie[ 5].Code= 4; DSCF_Entropie[ 5].Length= 3; + DSCF_Entropie[ 8].Code= 3; DSCF_Entropie[ 8].Length= 3; + DSCF_Entropie[ 9].Code= 13; DSCF_Entropie[ 9].Length= 4; + DSCF_Entropie[ 4].Code= 11; DSCF_Entropie[ 4].Length= 4; + DSCF_Entropie[10].Code= 10; DSCF_Entropie[10].Length= 4; + DSCF_Entropie[ 2].Code= 4; DSCF_Entropie[ 2].Length= 4; + DSCF_Entropie[11].Code= 25; DSCF_Entropie[11].Length= 5; + DSCF_Entropie[ 3].Code= 24; DSCF_Entropie[ 3].Length= 5; + DSCF_Entropie[ 1].Code= 11; DSCF_Entropie[ 1].Length= 5; + DSCF_Entropie[12].Code= 21; DSCF_Entropie[12].Length= 6; + DSCF_Entropie[ 0].Code= 20; DSCF_Entropie[ 0].Length= 6; + + // first quantizer + Entropie_1[1].Code= 1; Entropie_1[1].Length= 1; + Entropie_1[0].Code= 1; Entropie_1[0].Length= 2; + Entropie_1[2].Code= 0; Entropie_1[2].Length= 2; + + // second quantizer + Entropie_2[2].Code= 3; Entropie_2[2].Length= 2; + Entropie_2[3].Code= 1; Entropie_2[3].Length= 2; + Entropie_2[1].Code= 0; Entropie_2[1].Length= 2; + Entropie_2[4].Code= 5; Entropie_2[4].Length= 3; + Entropie_2[0].Code= 4; Entropie_2[0].Length= 3; + + // third quantizer + Entropie_3[3].Code= 3; Entropie_3[3].Length= 2; + Entropie_3[2].Code= 1; Entropie_3[2].Length= 2; + Entropie_3[4].Code= 0; Entropie_3[4].Length= 2; + Entropie_3[1].Code= 5; Entropie_3[1].Length= 3; + Entropie_3[5].Code= 9; Entropie_3[5].Length= 4; + Entropie_3[0].Code= 17; Entropie_3[0].Length= 5; + Entropie_3[6].Code= 16; Entropie_3[6].Length= 5; + + // forth quantizer + Entropie_4[4].Code= 0; Entropie_4[4].Length= 2; + Entropie_4[5].Code= 6; Entropie_4[5].Length= 3; + Entropie_4[3].Code= 5; Entropie_4[3].Length= 3; + Entropie_4[6].Code= 4; Entropie_4[6].Length= 3; + Entropie_4[2].Code= 3; Entropie_4[2].Length= 3; + Entropie_4[7].Code= 15; Entropie_4[7].Length= 4; + Entropie_4[1].Code= 14; Entropie_4[1].Length= 4; + Entropie_4[0].Code= 5; Entropie_4[0].Length= 4; + Entropie_4[8].Code= 4; Entropie_4[8].Length= 4; + + // fifth quantizer + Entropie_5[7 ].Code= 4; Entropie_5[7 ].Length= 3; + Entropie_5[8 ].Code= 3; Entropie_5[8 ].Length= 3; + Entropie_5[6 ].Code= 2; Entropie_5[6 ].Length= 3; + Entropie_5[9 ].Code= 0; Entropie_5[9 ].Length= 3; + Entropie_5[5 ].Code= 15; Entropie_5[5 ].Length= 4; + Entropie_5[4 ].Code= 13; Entropie_5[4 ].Length= 4; + Entropie_5[10].Code= 12; Entropie_5[10].Length= 4; + Entropie_5[11].Code= 10; Entropie_5[11].Length= 4; + Entropie_5[3 ].Code= 3; Entropie_5[3 ].Length= 4; + Entropie_5[12].Code= 2; Entropie_5[12].Length= 4; + Entropie_5[2 ].Code= 29; Entropie_5[2 ].Length= 5; + Entropie_5[1 ].Code= 23; Entropie_5[1 ].Length= 5; + Entropie_5[13].Code= 22; Entropie_5[13].Length= 5; + Entropie_5[0 ].Code= 57; Entropie_5[0 ].Length= 6; + Entropie_5[14].Code= 56; Entropie_5[14].Length= 6; + + // sixth quantizer + Entropie_6[15].Code= 9; Entropie_6[15].Length= 4; + Entropie_6[16].Code= 8; Entropie_6[16].Length= 4; + Entropie_6[14].Code= 7; Entropie_6[14].Length= 4; + Entropie_6[18].Code= 6; Entropie_6[18].Length= 4; + Entropie_6[17].Code= 5; Entropie_6[17].Length= 4; + Entropie_6[12].Code= 3; Entropie_6[12].Length= 4; + Entropie_6[13].Code= 2; Entropie_6[13].Length= 4; + Entropie_6[19].Code= 0; Entropie_6[19].Length= 4; + Entropie_6[11].Code= 31; Entropie_6[11].Length= 5; + Entropie_6[20].Code= 30; Entropie_6[20].Length= 5; + Entropie_6[10].Code= 29; Entropie_6[10].Length= 5; + Entropie_6[9 ].Code= 27; Entropie_6[9 ].Length= 5; + Entropie_6[21].Code= 26; Entropie_6[21].Length= 5; + Entropie_6[22].Code= 25; Entropie_6[22].Length= 5; + Entropie_6[8 ].Code= 24; Entropie_6[8 ].Length= 5; + Entropie_6[7 ].Code= 23; Entropie_6[7 ].Length= 5; + Entropie_6[23].Code= 21; Entropie_6[23].Length= 5; + Entropie_6[6 ].Code= 9; Entropie_6[6 ].Length= 5; + Entropie_6[24].Code= 3; Entropie_6[24].Length= 5; + Entropie_6[25].Code= 57; Entropie_6[25].Length= 6; + Entropie_6[5 ].Code= 56; Entropie_6[5 ].Length= 6; + Entropie_6[4 ].Code= 45; Entropie_6[4 ].Length= 6; + Entropie_6[26].Code= 41; Entropie_6[26].Length= 6; + Entropie_6[2 ].Code= 40; Entropie_6[2 ].Length= 6; + Entropie_6[27].Code= 17; Entropie_6[27].Length= 6; + Entropie_6[28].Code= 16; Entropie_6[28].Length= 6; + Entropie_6[3 ].Code= 5; Entropie_6[3 ].Length= 6; + Entropie_6[29].Code= 89; Entropie_6[29].Length= 7; + Entropie_6[1 ].Code= 88; Entropie_6[1 ].Length= 7; + Entropie_6[30].Code= 9; Entropie_6[30].Length= 7; + Entropie_6[0 ].Code= 8; Entropie_6[0 ].Length= 7; + + // seventh quantizer + Entropie_7[25].Code= 0; Entropie_7[25].Length= 5; + Entropie_7[37].Code= 1; Entropie_7[37].Length= 5; + Entropie_7[62].Code= 16; Entropie_7[62].Length= 8; + Entropie_7[ 0].Code= 17; Entropie_7[ 0].Length= 8; + Entropie_7[ 3].Code= 9; Entropie_7[ 3].Length= 7; + Entropie_7[ 5].Code= 10; Entropie_7[ 5].Length= 7; + Entropie_7[ 6].Code= 11; Entropie_7[ 6].Length= 7; + Entropie_7[38].Code= 3; Entropie_7[38].Length= 5; + Entropie_7[35].Code= 4; Entropie_7[35].Length= 5; + Entropie_7[33].Code= 5; Entropie_7[33].Length= 5; + Entropie_7[24].Code= 6; Entropie_7[24].Length= 5; + Entropie_7[27].Code= 7; Entropie_7[27].Length= 5; + Entropie_7[26].Code= 8; Entropie_7[26].Length= 5; + Entropie_7[12].Code= 18; Entropie_7[12].Length= 6; + Entropie_7[50].Code= 19; Entropie_7[50].Length= 6; + Entropie_7[29].Code= 10; Entropie_7[29].Length= 5; + Entropie_7[31].Code= 11; Entropie_7[31].Length= 5; + Entropie_7[36].Code= 12; Entropie_7[36].Length= 5; + Entropie_7[34].Code= 13; Entropie_7[34].Length= 5; + Entropie_7[28].Code= 14; Entropie_7[28].Length= 5; + Entropie_7[49].Code= 30; Entropie_7[49].Length= 6; + Entropie_7[56].Code= 62; Entropie_7[56].Length= 7; + Entropie_7[ 7].Code= 63; Entropie_7[ 7].Length= 7; + Entropie_7[32].Code= 16; Entropie_7[32].Length= 5; + Entropie_7[30].Code= 17; Entropie_7[30].Length= 5; + Entropie_7[13].Code= 36; Entropie_7[13].Length= 6; + Entropie_7[55].Code= 74; Entropie_7[55].Length= 7; + Entropie_7[61].Code= 150; Entropie_7[61].Length= 8; + Entropie_7[ 1].Code= 151; Entropie_7[ 1].Length= 8; + Entropie_7[14].Code= 38; Entropie_7[14].Length= 6; + Entropie_7[48].Code= 39; Entropie_7[48].Length= 6; + Entropie_7[ 4].Code= 80; Entropie_7[ 4].Length= 7; + Entropie_7[58].Code= 81; Entropie_7[58].Length= 7; + Entropie_7[47].Code= 41; Entropie_7[47].Length= 6; + Entropie_7[15].Code= 42; Entropie_7[15].Length= 6; + Entropie_7[16].Code= 43; Entropie_7[16].Length= 6; + Entropie_7[54].Code= 88; Entropie_7[54].Length= 7; + Entropie_7[ 8].Code= 89; Entropie_7[ 8].Length= 7; + Entropie_7[17].Code= 45; Entropie_7[17].Length= 6; + Entropie_7[46].Code= 46; Entropie_7[46].Length= 6; + Entropie_7[45].Code= 47; Entropie_7[45].Length= 6; + Entropie_7[53].Code= 96; Entropie_7[53].Length= 7; + Entropie_7[ 9].Code= 97; Entropie_7[ 9].Length= 7; + Entropie_7[43].Code= 49; Entropie_7[43].Length= 6; + Entropie_7[19].Code= 50; Entropie_7[19].Length= 6; + Entropie_7[18].Code= 51; Entropie_7[18].Length= 6; + Entropie_7[44].Code= 52; Entropie_7[44].Length= 6; + Entropie_7[ 2].Code= 212; Entropie_7[ 2].Length= 8; + Entropie_7[60].Code= 213; Entropie_7[60].Length= 8; + Entropie_7[10].Code= 107; Entropie_7[10].Length= 7; + Entropie_7[42].Code= 54; Entropie_7[42].Length= 6; + Entropie_7[41].Code= 55; Entropie_7[41].Length= 6; + Entropie_7[20].Code= 56; Entropie_7[20].Length= 6; + Entropie_7[21].Code= 57; Entropie_7[21].Length= 6; + Entropie_7[52].Code= 116; Entropie_7[52].Length= 7; + Entropie_7[51].Code= 117; Entropie_7[51].Length= 7; + Entropie_7[40].Code= 59; Entropie_7[40].Length= 6; + Entropie_7[22].Code= 60; Entropie_7[22].Length= 6; + Entropie_7[23].Code= 61; Entropie_7[23].Length= 6; + Entropie_7[39].Code= 62; Entropie_7[39].Length= 6; + Entropie_7[11].Code= 126; Entropie_7[11].Length= 7; + Entropie_7[57].Code= 254; Entropie_7[57].Length= 8; + Entropie_7[59].Code= 255; Entropie_7[59].Length= 8; +} diff --git a/akode/plugins/mpc_decoder/mppdec/huffsv7.cpp b/akode/plugins/mpc_decoder/mppdec/huffsv7.cpp new file mode 100644 index 0000000..c0ba0ab --- /dev/null +++ b/akode/plugins/mpc_decoder/mppdec/huffsv7.cpp @@ -0,0 +1,461 @@ +#include "stdafx.h" + +void +MPC_decoder::Huffman_SV7_Decoder ( void ) +{ + Huffman_SV7_Encoder (); + Resort_HuffTables(10, &HuffHdr[0] , 5); + Resort_HuffTables( 4, &HuffSCFI[0] , 0); + Resort_HuffTables(16, &HuffDSCF[0] , 7); + Resort_HuffTables(27, &HuffQ1[0][0] , 0); + Resort_HuffTables(27, &HuffQ1[1][0] , 0); + Resort_HuffTables(25, &HuffQ2[0][0] , 0); + Resort_HuffTables(25, &HuffQ2[1][0] , 0); + Resort_HuffTables( 7, &HuffQ3[0][0] , Dc[3]); + Resort_HuffTables( 7, &HuffQ3[1][0] , Dc[3]); + Resort_HuffTables( 9, &HuffQ4[0][0] , Dc[4]); + Resort_HuffTables( 9, &HuffQ4[1][0] , Dc[4]); + Resort_HuffTables(15, &HuffQ5[0][0] , Dc[5]); + Resort_HuffTables(15, &HuffQ5[1][0] , Dc[5]); + Resort_HuffTables(31, &HuffQ6[0][0] , Dc[6]); + Resort_HuffTables(31, &HuffQ6[1][0] , Dc[6]); + Resort_HuffTables(63, &HuffQ7[0][0] , Dc[7]); + Resort_HuffTables(63, &HuffQ7[1][0] , Dc[7]); +} + +void +MPC_decoder::Huffman_SV7_Encoder ( void ) +{ + /***************************** SCFI *******************************/ + HuffSCFI[0].Code = 2; HuffSCFI[0].Length = 3; + HuffSCFI[1].Code = 1; HuffSCFI[1].Length = 1; + HuffSCFI[2].Code = 3; HuffSCFI[2].Length = 3; + HuffSCFI[3].Code = 0; HuffSCFI[3].Length = 2; + + /***************************** DSCF *******************************/ + HuffDSCF[ 0].Code = 32; HuffDSCF[ 0].Length = 6; + HuffDSCF[ 1].Code = 4; HuffDSCF[ 1].Length = 5; + HuffDSCF[ 2].Code = 17; HuffDSCF[ 2].Length = 5; + HuffDSCF[ 3].Code = 30; HuffDSCF[ 3].Length = 5; + HuffDSCF[ 4].Code = 13; HuffDSCF[ 4].Length = 4; + HuffDSCF[ 5].Code = 0; HuffDSCF[ 5].Length = 3; + HuffDSCF[ 6].Code = 3; HuffDSCF[ 6].Length = 3; + HuffDSCF[ 7].Code = 9; HuffDSCF[ 7].Length = 4; + HuffDSCF[ 8].Code = 5; HuffDSCF[ 8].Length = 3; + HuffDSCF[ 9].Code = 2; HuffDSCF[ 9].Length = 3; + HuffDSCF[10].Code = 14; HuffDSCF[10].Length = 4; + HuffDSCF[11].Code = 3; HuffDSCF[11].Length = 4; + HuffDSCF[12].Code = 31; HuffDSCF[12].Length = 5; + HuffDSCF[13].Code = 5; HuffDSCF[13].Length = 5; + HuffDSCF[14].Code = 33; HuffDSCF[14].Length = 6; + HuffDSCF[15].Code = 12; HuffDSCF[15].Length = 4; + + /************************* frame-header ***************************/ + /***************** differential quantizer indizes *****************/ + HuffHdr[0].Code = 92; HuffHdr[0].Length = 8; + HuffHdr[1].Code = 47; HuffHdr[1].Length = 7; + HuffHdr[2].Code = 10; HuffHdr[2].Length = 5; + HuffHdr[3].Code = 4; HuffHdr[3].Length = 4; + HuffHdr[4].Code = 0; HuffHdr[4].Length = 2; + HuffHdr[5].Code = 1; HuffHdr[5].Length = 1; + HuffHdr[6].Code = 3; HuffHdr[6].Length = 3; + HuffHdr[7].Code = 22; HuffHdr[7].Length = 6; + HuffHdr[8].Code = 187; HuffHdr[8].Length = 9; + HuffHdr[9].Code = 186; HuffHdr[9].Length = 9; + + /********************** 3-step quantizer **************************/ + /********************* 3 bundled samples **************************/ + //less shaped, book 0 + HuffQ1[0][ 0].Code = 54; HuffQ1[0][ 0].Length = 6; + HuffQ1[0][ 1].Code = 9; HuffQ1[0][ 1].Length = 5; + HuffQ1[0][ 2].Code = 32; HuffQ1[0][ 2].Length = 6; + HuffQ1[0][ 3].Code = 5; HuffQ1[0][ 3].Length = 5; + HuffQ1[0][ 4].Code = 10; HuffQ1[0][ 4].Length = 4; + HuffQ1[0][ 5].Code = 7; HuffQ1[0][ 5].Length = 5; + HuffQ1[0][ 6].Code = 52; HuffQ1[0][ 6].Length = 6; + HuffQ1[0][ 7].Code = 0; HuffQ1[0][ 7].Length = 5; + HuffQ1[0][ 8].Code = 35; HuffQ1[0][ 8].Length = 6; + HuffQ1[0][ 9].Code = 10; HuffQ1[0][ 9].Length = 5; + HuffQ1[0][10].Code = 6; HuffQ1[0][10].Length = 4; + HuffQ1[0][11].Code = 4; HuffQ1[0][11].Length = 5; + HuffQ1[0][12].Code = 11; HuffQ1[0][12].Length = 4; + HuffQ1[0][13].Code = 7; HuffQ1[0][13].Length = 3; + HuffQ1[0][14].Code = 12; HuffQ1[0][14].Length = 4; + HuffQ1[0][15].Code = 3; HuffQ1[0][15].Length = 5; + HuffQ1[0][16].Code = 7; HuffQ1[0][16].Length = 4; + HuffQ1[0][17].Code = 11; HuffQ1[0][17].Length = 5; + HuffQ1[0][18].Code = 34; HuffQ1[0][18].Length = 6; + HuffQ1[0][19].Code = 1; HuffQ1[0][19].Length = 5; + HuffQ1[0][20].Code = 53; HuffQ1[0][20].Length = 6; + HuffQ1[0][21].Code = 6; HuffQ1[0][21].Length = 5; + HuffQ1[0][22].Code = 9; HuffQ1[0][22].Length = 4; + HuffQ1[0][23].Code = 2; HuffQ1[0][23].Length = 5; + HuffQ1[0][24].Code = 33; HuffQ1[0][24].Length = 6; + HuffQ1[0][25].Code = 8; HuffQ1[0][25].Length = 5; + HuffQ1[0][26].Code = 55; HuffQ1[0][26].Length = 6; + + //more shaped, book 1 + HuffQ1[1][ 0].Code = 103; HuffQ1[1][ 0].Length = 8; + HuffQ1[1][ 1].Code = 62; HuffQ1[1][ 1].Length = 7; + HuffQ1[1][ 2].Code = 225; HuffQ1[1][ 2].Length = 9; + HuffQ1[1][ 3].Code = 55; HuffQ1[1][ 3].Length = 7; + HuffQ1[1][ 4].Code = 3; HuffQ1[1][ 4].Length = 4; + HuffQ1[1][ 5].Code = 52; HuffQ1[1][ 5].Length = 7; + HuffQ1[1][ 6].Code = 101; HuffQ1[1][ 6].Length = 8; + HuffQ1[1][ 7].Code = 60; HuffQ1[1][ 7].Length = 7; + HuffQ1[1][ 8].Code = 227; HuffQ1[1][ 8].Length = 9; + HuffQ1[1][ 9].Code = 24; HuffQ1[1][ 9].Length = 6; + HuffQ1[1][10].Code = 0; HuffQ1[1][10].Length = 4; + HuffQ1[1][11].Code = 61; HuffQ1[1][11].Length = 7; + HuffQ1[1][12].Code = 4; HuffQ1[1][12].Length = 4; + HuffQ1[1][13].Code = 1; HuffQ1[1][13].Length = 1; + HuffQ1[1][14].Code = 5; HuffQ1[1][14].Length = 4; + HuffQ1[1][15].Code = 63; HuffQ1[1][15].Length = 7; + HuffQ1[1][16].Code = 1; HuffQ1[1][16].Length = 4; + HuffQ1[1][17].Code = 59; HuffQ1[1][17].Length = 7; + HuffQ1[1][18].Code = 226; HuffQ1[1][18].Length = 9; + HuffQ1[1][19].Code = 57; HuffQ1[1][19].Length = 7; + HuffQ1[1][20].Code = 100; HuffQ1[1][20].Length = 8; + HuffQ1[1][21].Code = 53; HuffQ1[1][21].Length = 7; + HuffQ1[1][22].Code = 2; HuffQ1[1][22].Length = 4; + HuffQ1[1][23].Code = 54; HuffQ1[1][23].Length = 7; + HuffQ1[1][24].Code = 224; HuffQ1[1][24].Length = 9; + HuffQ1[1][25].Code = 58; HuffQ1[1][25].Length = 7; + HuffQ1[1][26].Code = 102; HuffQ1[1][26].Length = 8; + + /********************** 5-step quantizer **************************/ + /********************* 2 bundled samples **************************/ + //less shaped, book 0 + HuffQ2[0][ 0].Code = 89; HuffQ2[0][ 0].Length = 7; + HuffQ2[0][ 1].Code = 47; HuffQ2[0][ 1].Length = 6; + HuffQ2[0][ 2].Code = 15; HuffQ2[0][ 2].Length = 5; + HuffQ2[0][ 3].Code = 0; HuffQ2[0][ 3].Length = 5; + HuffQ2[0][ 4].Code = 91; HuffQ2[0][ 4].Length = 7; + HuffQ2[0][ 5].Code = 4; HuffQ2[0][ 5].Length = 5; + HuffQ2[0][ 6].Code = 6; HuffQ2[0][ 6].Length = 4; + HuffQ2[0][ 7].Code = 13; HuffQ2[0][ 7].Length = 4; + HuffQ2[0][ 8].Code = 4; HuffQ2[0][ 8].Length = 4; + HuffQ2[0][ 9].Code = 5; HuffQ2[0][ 9].Length = 5; + HuffQ2[0][10].Code = 20; HuffQ2[0][10].Length = 5; + HuffQ2[0][11].Code = 12; HuffQ2[0][11].Length = 4; + HuffQ2[0][12].Code = 4; HuffQ2[0][12].Length = 3; + HuffQ2[0][13].Code = 15; HuffQ2[0][13].Length = 4; + HuffQ2[0][14].Code = 14; HuffQ2[0][14].Length = 5; + HuffQ2[0][15].Code = 3; HuffQ2[0][15].Length = 5; + HuffQ2[0][16].Code = 3; HuffQ2[0][16].Length = 4; + HuffQ2[0][17].Code = 14; HuffQ2[0][17].Length = 4; + HuffQ2[0][18].Code = 5; HuffQ2[0][18].Length = 4; + HuffQ2[0][19].Code = 1; HuffQ2[0][19].Length = 5; + HuffQ2[0][20].Code = 90; HuffQ2[0][20].Length = 7; + HuffQ2[0][21].Code = 2; HuffQ2[0][21].Length = 5; + HuffQ2[0][22].Code = 21; HuffQ2[0][22].Length = 5; + HuffQ2[0][23].Code = 46; HuffQ2[0][23].Length = 6; + HuffQ2[0][24].Code = 88; HuffQ2[0][24].Length = 7; + + //more shaped, book 1 + HuffQ2[1][ 0].Code = 921; HuffQ2[1][ 0].Length = 10; + HuffQ2[1][ 1].Code = 113; HuffQ2[1][ 1].Length = 7; + HuffQ2[1][ 2].Code = 51; HuffQ2[1][ 2].Length = 6; + HuffQ2[1][ 3].Code = 231; HuffQ2[1][ 3].Length = 8; + HuffQ2[1][ 4].Code = 922; HuffQ2[1][ 4].Length = 10; + HuffQ2[1][ 5].Code = 104; HuffQ2[1][ 5].Length = 7; + HuffQ2[1][ 6].Code = 30; HuffQ2[1][ 6].Length = 5; + HuffQ2[1][ 7].Code = 0; HuffQ2[1][ 7].Length = 3; + HuffQ2[1][ 8].Code = 29; HuffQ2[1][ 8].Length = 5; + HuffQ2[1][ 9].Code = 105; HuffQ2[1][ 9].Length = 7; + HuffQ2[1][10].Code = 50; HuffQ2[1][10].Length = 6; + HuffQ2[1][11].Code = 1; HuffQ2[1][11].Length = 3; + HuffQ2[1][12].Code = 2; HuffQ2[1][12].Length = 2; + HuffQ2[1][13].Code = 3; HuffQ2[1][13].Length = 3; + HuffQ2[1][14].Code = 49; HuffQ2[1][14].Length = 6; + HuffQ2[1][15].Code = 107; HuffQ2[1][15].Length = 7; + HuffQ2[1][16].Code = 27; HuffQ2[1][16].Length = 5; + HuffQ2[1][17].Code = 2; HuffQ2[1][17].Length = 3; + HuffQ2[1][18].Code = 31; HuffQ2[1][18].Length = 5; + HuffQ2[1][19].Code = 112; HuffQ2[1][19].Length = 7; + HuffQ2[1][20].Code = 920; HuffQ2[1][20].Length = 10; + HuffQ2[1][21].Code = 106; HuffQ2[1][21].Length = 7; + HuffQ2[1][22].Code = 48; HuffQ2[1][22].Length = 6; + HuffQ2[1][23].Code = 114; HuffQ2[1][23].Length = 7; + HuffQ2[1][24].Code = 923; HuffQ2[1][24].Length = 10; + + /********************** 7-step quantizer **************************/ + /*********************** single samples ***************************/ + //less shaped, book 0 + HuffQ3[0][0].Code = 12; HuffQ3[0][0].Length = 4; + HuffQ3[0][1].Code = 4; HuffQ3[0][1].Length = 3; + HuffQ3[0][2].Code = 0; HuffQ3[0][2].Length = 2; + HuffQ3[0][3].Code = 1; HuffQ3[0][3].Length = 2; + HuffQ3[0][4].Code = 7; HuffQ3[0][4].Length = 3; + HuffQ3[0][5].Code = 5; HuffQ3[0][5].Length = 3; + HuffQ3[0][6].Code = 13; HuffQ3[0][6].Length = 4; + + //more shaped, book 1 + HuffQ3[1][0].Code = 4; HuffQ3[1][0].Length = 5; + HuffQ3[1][1].Code = 3; HuffQ3[1][1].Length = 4; + HuffQ3[1][2].Code = 2; HuffQ3[1][2].Length = 2; + HuffQ3[1][3].Code = 3; HuffQ3[1][3].Length = 2; + HuffQ3[1][4].Code = 1; HuffQ3[1][4].Length = 2; + HuffQ3[1][5].Code = 0; HuffQ3[1][5].Length = 3; + HuffQ3[1][6].Code = 5; HuffQ3[1][6].Length = 5; + + /********************** 9-step quantizer **************************/ + /*********************** single samples ***************************/ + //less shaped, book 0 + HuffQ4[0][0].Code = 5; HuffQ4[0][0].Length = 4; + HuffQ4[0][1].Code = 0; HuffQ4[0][1].Length = 3; + HuffQ4[0][2].Code = 4; HuffQ4[0][2].Length = 3; + HuffQ4[0][3].Code = 6; HuffQ4[0][3].Length = 3; + HuffQ4[0][4].Code = 7; HuffQ4[0][4].Length = 3; + HuffQ4[0][5].Code = 5; HuffQ4[0][5].Length = 3; + HuffQ4[0][6].Code = 3; HuffQ4[0][6].Length = 3; + HuffQ4[0][7].Code = 1; HuffQ4[0][7].Length = 3; + HuffQ4[0][8].Code = 4; HuffQ4[0][8].Length = 4; + + //more shaped, book 1 + HuffQ4[1][0].Code = 9; HuffQ4[1][0].Length = 5; + HuffQ4[1][1].Code = 12; HuffQ4[1][1].Length = 4; + HuffQ4[1][2].Code = 3; HuffQ4[1][2].Length = 3; + HuffQ4[1][3].Code = 0; HuffQ4[1][3].Length = 2; + HuffQ4[1][4].Code = 2; HuffQ4[1][4].Length = 2; + HuffQ4[1][5].Code = 7; HuffQ4[1][5].Length = 3; + HuffQ4[1][6].Code = 13; HuffQ4[1][6].Length = 4; + HuffQ4[1][7].Code = 5; HuffQ4[1][7].Length = 4; + HuffQ4[1][8].Code = 8; HuffQ4[1][8].Length = 5; + + /********************* 15-step quantizer **************************/ + /*********************** single samples ***************************/ + //less shaped, book 0 + HuffQ5[0][ 0].Code = 57; HuffQ5[0][ 0].Length = 6; + HuffQ5[0][ 1].Code = 23; HuffQ5[0][ 1].Length = 5; + HuffQ5[0][ 2].Code = 8; HuffQ5[0][ 2].Length = 4; + HuffQ5[0][ 3].Code = 10; HuffQ5[0][ 3].Length = 4; + HuffQ5[0][ 4].Code = 13; HuffQ5[0][ 4].Length = 4; + HuffQ5[0][ 5].Code = 0; HuffQ5[0][ 5].Length = 3; + HuffQ5[0][ 6].Code = 2; HuffQ5[0][ 6].Length = 3; + HuffQ5[0][ 7].Code = 3; HuffQ5[0][ 7].Length = 3; + HuffQ5[0][ 8].Code = 1; HuffQ5[0][ 8].Length = 3; + HuffQ5[0][ 9].Code = 15; HuffQ5[0][ 9].Length = 4; + HuffQ5[0][10].Code = 12; HuffQ5[0][10].Length = 4; + HuffQ5[0][11].Code = 9; HuffQ5[0][11].Length = 4; + HuffQ5[0][12].Code = 29; HuffQ5[0][12].Length = 5; + HuffQ5[0][13].Code = 22; HuffQ5[0][13].Length = 5; + HuffQ5[0][14].Code = 56; HuffQ5[0][14].Length = 6; + + //more shaped, book 1 + HuffQ5[1][ 0].Code = 229; HuffQ5[1][ 0].Length = 8; + HuffQ5[1][ 1].Code = 56; HuffQ5[1][ 1].Length = 6; + HuffQ5[1][ 2].Code = 7; HuffQ5[1][ 2].Length = 5; + HuffQ5[1][ 3].Code = 2; HuffQ5[1][ 3].Length = 4; + HuffQ5[1][ 4].Code = 0; HuffQ5[1][ 4].Length = 3; + HuffQ5[1][ 5].Code = 3; HuffQ5[1][ 5].Length = 3; + HuffQ5[1][ 6].Code = 5; HuffQ5[1][ 6].Length = 3; + HuffQ5[1][ 7].Code = 6; HuffQ5[1][ 7].Length = 3; + HuffQ5[1][ 8].Code = 4; HuffQ5[1][ 8].Length = 3; + HuffQ5[1][ 9].Code = 2; HuffQ5[1][ 9].Length = 3; + HuffQ5[1][10].Code = 15; HuffQ5[1][10].Length = 4; + HuffQ5[1][11].Code = 29; HuffQ5[1][11].Length = 5; + HuffQ5[1][12].Code = 6; HuffQ5[1][12].Length = 5; + HuffQ5[1][13].Code = 115; HuffQ5[1][13].Length = 7; + HuffQ5[1][14].Code = 228; HuffQ5[1][14].Length = 8; + + /********************* 31-step quantizer **************************/ + /*********************** single samples ***************************/ + //less shaped, book 0 + HuffQ6[0][ 0].Code = 65; HuffQ6[0][ 0].Length = 7; + HuffQ6[0][ 1].Code = 6; HuffQ6[0][ 1].Length = 6; + HuffQ6[0][ 2].Code = 44; HuffQ6[0][ 2].Length = 6; + HuffQ6[0][ 3].Code = 45; HuffQ6[0][ 3].Length = 6; + HuffQ6[0][ 4].Code = 59; HuffQ6[0][ 4].Length = 6; + HuffQ6[0][ 5].Code = 13; HuffQ6[0][ 5].Length = 5; + HuffQ6[0][ 6].Code = 17; HuffQ6[0][ 6].Length = 5; + HuffQ6[0][ 7].Code = 19; HuffQ6[0][ 7].Length = 5; + HuffQ6[0][ 8].Code = 23; HuffQ6[0][ 8].Length = 5; + HuffQ6[0][ 9].Code = 21; HuffQ6[0][ 9].Length = 5; + HuffQ6[0][10].Code = 26; HuffQ6[0][10].Length = 5; + HuffQ6[0][11].Code = 30; HuffQ6[0][11].Length = 5; + HuffQ6[0][12].Code = 0; HuffQ6[0][12].Length = 4; + HuffQ6[0][13].Code = 2; HuffQ6[0][13].Length = 4; + HuffQ6[0][14].Code = 5; HuffQ6[0][14].Length = 4; + HuffQ6[0][15].Code = 7; HuffQ6[0][15].Length = 4; + HuffQ6[0][16].Code = 3; HuffQ6[0][16].Length = 4; + HuffQ6[0][17].Code = 4; HuffQ6[0][17].Length = 4; + HuffQ6[0][18].Code = 31; HuffQ6[0][18].Length = 5; + HuffQ6[0][19].Code = 28; HuffQ6[0][19].Length = 5; + HuffQ6[0][20].Code = 25; HuffQ6[0][20].Length = 5; + HuffQ6[0][21].Code = 27; HuffQ6[0][21].Length = 5; + HuffQ6[0][22].Code = 24; HuffQ6[0][22].Length = 5; + HuffQ6[0][23].Code = 20; HuffQ6[0][23].Length = 5; + HuffQ6[0][24].Code = 18; HuffQ6[0][24].Length = 5; + HuffQ6[0][25].Code = 12; HuffQ6[0][25].Length = 5; + HuffQ6[0][26].Code = 2; HuffQ6[0][26].Length = 5; + HuffQ6[0][27].Code = 58; HuffQ6[0][27].Length = 6; + HuffQ6[0][28].Code = 33; HuffQ6[0][28].Length = 6; + HuffQ6[0][29].Code = 7; HuffQ6[0][29].Length = 6; + HuffQ6[0][30].Code = 64; HuffQ6[0][30].Length = 7; + + //more shaped, book 1 + HuffQ6[1][ 0].Code = 6472; HuffQ6[1][ 0].Length = 13; + HuffQ6[1][ 1].Code = 6474; HuffQ6[1][ 1].Length = 13; + HuffQ6[1][ 2].Code = 808; HuffQ6[1][ 2].Length = 10; + HuffQ6[1][ 3].Code = 405; HuffQ6[1][ 3].Length = 9; + HuffQ6[1][ 4].Code = 203; HuffQ6[1][ 4].Length = 8; + HuffQ6[1][ 5].Code = 102; HuffQ6[1][ 5].Length = 7; + HuffQ6[1][ 6].Code = 49; HuffQ6[1][ 6].Length = 6; + HuffQ6[1][ 7].Code = 9; HuffQ6[1][ 7].Length = 5; + HuffQ6[1][ 8].Code = 15; HuffQ6[1][ 8].Length = 5; + HuffQ6[1][ 9].Code = 31; HuffQ6[1][ 9].Length = 5; + HuffQ6[1][10].Code = 2; HuffQ6[1][10].Length = 4; + HuffQ6[1][11].Code = 6; HuffQ6[1][11].Length = 4; + HuffQ6[1][12].Code = 8; HuffQ6[1][12].Length = 4; + HuffQ6[1][13].Code = 11; HuffQ6[1][13].Length = 4; + HuffQ6[1][14].Code = 13; HuffQ6[1][14].Length = 4; + HuffQ6[1][15].Code = 0; HuffQ6[1][15].Length = 3; + HuffQ6[1][16].Code = 14; HuffQ6[1][16].Length = 4; + HuffQ6[1][17].Code = 10; HuffQ6[1][17].Length = 4; + HuffQ6[1][18].Code = 9; HuffQ6[1][18].Length = 4; + HuffQ6[1][19].Code = 5; HuffQ6[1][19].Length = 4; + HuffQ6[1][20].Code = 3; HuffQ6[1][20].Length = 4; + HuffQ6[1][21].Code = 30; HuffQ6[1][21].Length = 5; + HuffQ6[1][22].Code = 14; HuffQ6[1][22].Length = 5; + HuffQ6[1][23].Code = 8; HuffQ6[1][23].Length = 5; + HuffQ6[1][24].Code = 48; HuffQ6[1][24].Length = 6; + HuffQ6[1][25].Code = 103; HuffQ6[1][25].Length = 7; + HuffQ6[1][26].Code = 201; HuffQ6[1][26].Length = 8; + HuffQ6[1][27].Code = 200; HuffQ6[1][27].Length = 8; + HuffQ6[1][28].Code = 1619; HuffQ6[1][28].Length = 11; + HuffQ6[1][29].Code = 6473; HuffQ6[1][29].Length = 13; + HuffQ6[1][30].Code = 6475; HuffQ6[1][30].Length = 13; + + /********************* 63-step quantizer **************************/ + /*********************** single samples ***************************/ + //less shaped, book 0 + HuffQ7[0][ 0].Code = 103; HuffQ7[0][ 0].Length = 8; /* 0.003338 - 01100111 */ + HuffQ7[0][ 1].Code = 153; HuffQ7[0][ 1].Length = 8; /* 0.003766 - 10011001 */ + HuffQ7[0][ 2].Code = 181; HuffQ7[0][ 2].Length = 8; /* 0.004715 - 10110101 */ + HuffQ7[0][ 3].Code = 233; HuffQ7[0][ 3].Length = 8; /* 0.005528 - 11101001 */ + HuffQ7[0][ 4].Code = 64; HuffQ7[0][ 4].Length = 7; /* 0.006677 - 1000000 */ + HuffQ7[0][ 5].Code = 65; HuffQ7[0][ 5].Length = 7; /* 0.007041 - 1000001 */ + HuffQ7[0][ 6].Code = 77; HuffQ7[0][ 6].Length = 7; /* 0.007733 - 1001101 */ + HuffQ7[0][ 7].Code = 81; HuffQ7[0][ 7].Length = 7; /* 0.008296 - 1010001 */ + HuffQ7[0][ 8].Code = 91; HuffQ7[0][ 8].Length = 7; /* 0.009295 - 1011011 */ + HuffQ7[0][ 9].Code = 113; HuffQ7[0][ 9].Length = 7; /* 0.010814 - 1110001 */ + HuffQ7[0][10].Code = 112; HuffQ7[0][10].Length = 7; /* 0.010807 - 1110000 */ + HuffQ7[0][11].Code = 24; HuffQ7[0][11].Length = 6; /* 0.012748 - 011000 */ + HuffQ7[0][12].Code = 29; HuffQ7[0][12].Length = 6; /* 0.013390 - 011101 */ + HuffQ7[0][13].Code = 35; HuffQ7[0][13].Length = 6; /* 0.014224 - 100011 */ + HuffQ7[0][14].Code = 37; HuffQ7[0][14].Length = 6; /* 0.015201 - 100101 */ + HuffQ7[0][15].Code = 41; HuffQ7[0][15].Length = 6; /* 0.016642 - 101001 */ + HuffQ7[0][16].Code = 44; HuffQ7[0][16].Length = 6; /* 0.017292 - 101100 */ + HuffQ7[0][17].Code = 46; HuffQ7[0][17].Length = 6; /* 0.018647 - 101110 */ + HuffQ7[0][18].Code = 51; HuffQ7[0][18].Length = 6; /* 0.020473 - 110011 */ + HuffQ7[0][19].Code = 49; HuffQ7[0][19].Length = 6; /* 0.020152 - 110001 */ + HuffQ7[0][20].Code = 54; HuffQ7[0][20].Length = 6; /* 0.021315 - 110110 */ + HuffQ7[0][21].Code = 55; HuffQ7[0][21].Length = 6; /* 0.021358 - 110111 */ + HuffQ7[0][22].Code = 57; HuffQ7[0][22].Length = 6; /* 0.021700 - 111001 */ + HuffQ7[0][23].Code = 60; HuffQ7[0][23].Length = 6; /* 0.022449 - 111100 */ + HuffQ7[0][24].Code = 0; HuffQ7[0][24].Length = 5; /* 0.023063 - 00000 */ + HuffQ7[0][25].Code = 2; HuffQ7[0][25].Length = 5; /* 0.023854 - 00010 */ + HuffQ7[0][26].Code = 10; HuffQ7[0][26].Length = 5; /* 0.025481 - 01010 */ + HuffQ7[0][27].Code = 5; HuffQ7[0][27].Length = 5; /* 0.024867 - 00101 */ + HuffQ7[0][28].Code = 9; HuffQ7[0][28].Length = 5; /* 0.025352 - 01001 */ + HuffQ7[0][29].Code = 6; HuffQ7[0][29].Length = 5; /* 0.025074 - 00110 */ + HuffQ7[0][30].Code = 13; HuffQ7[0][30].Length = 5; /* 0.025745 - 01101 */ + HuffQ7[0][31].Code = 7; HuffQ7[0][31].Length = 5; /* 0.025195 - 00111 */ + HuffQ7[0][32].Code = 11; HuffQ7[0][32].Length = 5; /* 0.025502 - 01011 */ + HuffQ7[0][33].Code = 15; HuffQ7[0][33].Length = 5; /* 0.026251 - 01111 */ + HuffQ7[0][34].Code = 8; HuffQ7[0][34].Length = 5; /* 0.025260 - 01000 */ + HuffQ7[0][35].Code = 4; HuffQ7[0][35].Length = 5; /* 0.024418 - 00100 */ + HuffQ7[0][36].Code = 3; HuffQ7[0][36].Length = 5; /* 0.023983 - 00011 */ + HuffQ7[0][37].Code = 1; HuffQ7[0][37].Length = 5; /* 0.023697 - 00001 */ + HuffQ7[0][38].Code = 63; HuffQ7[0][38].Length = 6; /* 0.023041 - 111111 */ + HuffQ7[0][39].Code = 62; HuffQ7[0][39].Length = 6; /* 0.022656 - 111110 */ + HuffQ7[0][40].Code = 61; HuffQ7[0][40].Length = 6; /* 0.022549 - 111101 */ + HuffQ7[0][41].Code = 53; HuffQ7[0][41].Length = 6; /* 0.021151 - 110101 */ + HuffQ7[0][42].Code = 59; HuffQ7[0][42].Length = 6; /* 0.022042 - 111011 */ + HuffQ7[0][43].Code = 52; HuffQ7[0][43].Length = 6; /* 0.020837 - 110100 */ + HuffQ7[0][44].Code = 48; HuffQ7[0][44].Length = 6; /* 0.019446 - 110000 */ + HuffQ7[0][45].Code = 47; HuffQ7[0][45].Length = 6; /* 0.019189 - 101111 */ + HuffQ7[0][46].Code = 43; HuffQ7[0][46].Length = 6; /* 0.017177 - 101011 */ + HuffQ7[0][47].Code = 42; HuffQ7[0][47].Length = 6; /* 0.017035 - 101010 */ + HuffQ7[0][48].Code = 39; HuffQ7[0][48].Length = 6; /* 0.015287 - 100111 */ + HuffQ7[0][49].Code = 36; HuffQ7[0][49].Length = 6; /* 0.014559 - 100100 */ + HuffQ7[0][50].Code = 33; HuffQ7[0][50].Length = 6; /* 0.014117 - 100001 */ + HuffQ7[0][51].Code = 28; HuffQ7[0][51].Length = 6; /* 0.012776 - 011100 */ + HuffQ7[0][52].Code = 117; HuffQ7[0][52].Length = 7; /* 0.011107 - 1110101 */ + HuffQ7[0][53].Code = 101; HuffQ7[0][53].Length = 7; /* 0.010636 - 1100101 */ + HuffQ7[0][54].Code = 100; HuffQ7[0][54].Length = 7; /* 0.009751 - 1100100 */ + HuffQ7[0][55].Code = 80; HuffQ7[0][55].Length = 7; /* 0.008132 - 1010000 */ + HuffQ7[0][56].Code = 69; HuffQ7[0][56].Length = 7; /* 0.007091 - 1000101 */ + HuffQ7[0][57].Code = 68; HuffQ7[0][57].Length = 7; /* 0.007084 - 1000100 */ + HuffQ7[0][58].Code = 50; HuffQ7[0][58].Length = 7; /* 0.006277 - 0110010 */ + HuffQ7[0][59].Code = 232; HuffQ7[0][59].Length = 8; /* 0.005386 - 11101000 */ + HuffQ7[0][60].Code = 180; HuffQ7[0][60].Length = 8; /* 0.004408 - 10110100 */ + HuffQ7[0][61].Code = 152; HuffQ7[0][61].Length = 8; /* 0.003759 - 10011000 */ + HuffQ7[0][62].Code = 102; HuffQ7[0][62].Length = 8; /* 0.003160 - 01100110 */ + + //more shaped, book 1 + HuffQ7[1][ 0].Code = 14244; HuffQ7[1][ 0].Length = 14; /* 0.000059 - 11011110100100 */ + HuffQ7[1][ 1].Code = 14253; HuffQ7[1][ 1].Length = 14; /* 0.000098 - 11011110101101 */ + HuffQ7[1][ 2].Code = 14246; HuffQ7[1][ 2].Length = 14; /* 0.000078 - 11011110100110 */ + HuffQ7[1][ 3].Code = 14254; HuffQ7[1][ 3].Length = 14; /* 0.000111 - 11011110101110 */ + HuffQ7[1][ 4].Code = 3562; HuffQ7[1][ 4].Length = 12; /* 0.000320 - 110111101010 */ + HuffQ7[1][ 5].Code = 752; HuffQ7[1][ 5].Length = 10; /* 0.000920 - 1011110000 */ + HuffQ7[1][ 6].Code = 753; HuffQ7[1][ 6].Length = 10; /* 0.001057 - 1011110001 */ + HuffQ7[1][ 7].Code = 160; HuffQ7[1][ 7].Length = 9; /* 0.001403 - 010100000 */ + HuffQ7[1][ 8].Code = 162; HuffQ7[1][ 8].Length = 9; /* 0.001579 - 010100010 */ + HuffQ7[1][ 9].Code = 444; HuffQ7[1][ 9].Length = 9; /* 0.002486 - 110111100 */ + HuffQ7[1][10].Code = 122; HuffQ7[1][10].Length = 8; /* 0.003772 - 01111010 */ + HuffQ7[1][11].Code = 223; HuffQ7[1][11].Length = 8; /* 0.005710 - 11011111 */ + HuffQ7[1][12].Code = 60; HuffQ7[1][12].Length = 7; /* 0.006858 - 0111100 */ + HuffQ7[1][13].Code = 73; HuffQ7[1][13].Length = 7; /* 0.008033 - 1001001 */ + HuffQ7[1][14].Code = 110; HuffQ7[1][14].Length = 7; /* 0.009827 - 1101110 */ + HuffQ7[1][15].Code = 14; HuffQ7[1][15].Length = 6; /* 0.012601 - 001110 */ + HuffQ7[1][16].Code = 24; HuffQ7[1][16].Length = 6; /* 0.013194 - 011000 */ + HuffQ7[1][17].Code = 25; HuffQ7[1][17].Length = 6; /* 0.013938 - 011001 */ + HuffQ7[1][18].Code = 34; HuffQ7[1][18].Length = 6; /* 0.015693 - 100010 */ + HuffQ7[1][19].Code = 37; HuffQ7[1][19].Length = 6; /* 0.017846 - 100101 */ + HuffQ7[1][20].Code = 54; HuffQ7[1][20].Length = 6; /* 0.020078 - 110110 */ + HuffQ7[1][21].Code = 3; HuffQ7[1][21].Length = 5; /* 0.022975 - 00011 */ + HuffQ7[1][22].Code = 9; HuffQ7[1][22].Length = 5; /* 0.025631 - 01001 */ + HuffQ7[1][23].Code = 11; HuffQ7[1][23].Length = 5; /* 0.027021 - 01011 */ + HuffQ7[1][24].Code = 16; HuffQ7[1][24].Length = 5; /* 0.031465 - 10000 */ + HuffQ7[1][25].Code = 19; HuffQ7[1][25].Length = 5; /* 0.034244 - 10011 */ + HuffQ7[1][26].Code = 21; HuffQ7[1][26].Length = 5; /* 0.035921 - 10101 */ + HuffQ7[1][27].Code = 24; HuffQ7[1][27].Length = 5; /* 0.037938 - 11000 */ + HuffQ7[1][28].Code = 26; HuffQ7[1][28].Length = 5; /* 0.039595 - 11010 */ + HuffQ7[1][29].Code = 29; HuffQ7[1][29].Length = 5; /* 0.041546 - 11101 */ + HuffQ7[1][30].Code = 31; HuffQ7[1][30].Length = 5; /* 0.042623 - 11111 */ + HuffQ7[1][31].Code = 2; HuffQ7[1][31].Length = 4; /* 0.045180 - 0010 */ + HuffQ7[1][32].Code = 0; HuffQ7[1][32].Length = 4; /* 0.043151 - 0000 */ + HuffQ7[1][33].Code = 30; HuffQ7[1][33].Length = 5; /* 0.042538 - 11110 */ + HuffQ7[1][34].Code = 28; HuffQ7[1][34].Length = 5; /* 0.041422 - 11100 */ + HuffQ7[1][35].Code = 25; HuffQ7[1][35].Length = 5; /* 0.039145 - 11001 */ + HuffQ7[1][36].Code = 22; HuffQ7[1][36].Length = 5; /* 0.036691 - 10110 */ + HuffQ7[1][37].Code = 20; HuffQ7[1][37].Length = 5; /* 0.034955 - 10100 */ + HuffQ7[1][38].Code = 14; HuffQ7[1][38].Length = 5; /* 0.029155 - 01110 */ + HuffQ7[1][39].Code = 13; HuffQ7[1][39].Length = 5; /* 0.027921 - 01101 */ + HuffQ7[1][40].Code = 8; HuffQ7[1][40].Length = 5; /* 0.025553 - 01000 */ + HuffQ7[1][41].Code = 6; HuffQ7[1][41].Length = 5; /* 0.023093 - 00110 */ + HuffQ7[1][42].Code = 2; HuffQ7[1][42].Length = 5; /* 0.021200 - 00010 */ + HuffQ7[1][43].Code = 46; HuffQ7[1][43].Length = 6; /* 0.018134 - 101110 */ + HuffQ7[1][44].Code = 35; HuffQ7[1][44].Length = 6; /* 0.015824 - 100011 */ + HuffQ7[1][45].Code = 31; HuffQ7[1][45].Length = 6; /* 0.014701 - 011111 */ + HuffQ7[1][46].Code = 21; HuffQ7[1][46].Length = 6; /* 0.013187 - 010101 */ + HuffQ7[1][47].Code = 15; HuffQ7[1][47].Length = 6; /* 0.012776 - 001111 */ + HuffQ7[1][48].Code = 95; HuffQ7[1][48].Length = 7; /* 0.009664 - 1011111 */ + HuffQ7[1][49].Code = 72; HuffQ7[1][49].Length = 7; /* 0.007922 - 1001000 */ + HuffQ7[1][50].Code = 41; HuffQ7[1][50].Length = 7; /* 0.006838 - 0101001 */ + HuffQ7[1][51].Code = 189; HuffQ7[1][51].Length = 8; /* 0.005024 - 10111101 */ + HuffQ7[1][52].Code = 123; HuffQ7[1][52].Length = 8; /* 0.003830 - 01111011 */ + HuffQ7[1][53].Code = 377; HuffQ7[1][53].Length = 9; /* 0.002232 - 101111001 */ + HuffQ7[1][54].Code = 161; HuffQ7[1][54].Length = 9; /* 0.001566 - 010100001 */ + HuffQ7[1][55].Code = 891; HuffQ7[1][55].Length = 10; /* 0.001383 - 1101111011 */ + HuffQ7[1][56].Code = 327; HuffQ7[1][56].Length = 10; /* 0.000900 - 0101000111 */ + HuffQ7[1][57].Code = 326; HuffQ7[1][57].Length = 10; /* 0.000790 - 0101000110 */ + HuffQ7[1][58].Code = 3560; HuffQ7[1][58].Length = 12; /* 0.000254 - 110111101000 */ + HuffQ7[1][59].Code = 14255; HuffQ7[1][59].Length = 14; /* 0.000117 - 11011110101111 */ + HuffQ7[1][60].Code = 14247; HuffQ7[1][60].Length = 14; /* 0.000085 - 11011110100111 */ + HuffQ7[1][61].Code = 14252; HuffQ7[1][61].Length = 14; /* 0.000085 - 11011110101100 */ + HuffQ7[1][62].Code = 14245; HuffQ7[1][62].Length = 14; /* 0.000065 - 11011110100101 */ +} diff --git a/akode/plugins/mpc_decoder/mppdec/idtag.cpp b/akode/plugins/mpc_decoder/mppdec/idtag.cpp new file mode 100644 index 0000000..0b26833 --- /dev/null +++ b/akode/plugins/mpc_decoder/mppdec/idtag.cpp @@ -0,0 +1,66 @@ +#include "stdafx.h" + +StreamInfo::StreamInfo () +{ + memset ( &simple, 0, sizeof (simple) ); +} + +MPC_INT64 StreamInfo::GetLenthSamples() +{ + MPC_INT64 samples = (MPC_INT64)simple.Frames * MPC_decoder::FrameLength; + if ( simple.IsTrueGapless ) { + samples -= (MPC_decoder::FrameLength - simple.LastFrameSamples); + } else { + samples -= MPC_decoder::SynthDelay; + } + return samples; +} + +double StreamInfo::GetLength() +{ + return (double)GetLenthSamples() / (double)simple.SampleFreq; +} + + + +// searches for a ID3v2-tag and reads the length (in bytes) of it +// -1 on errors of any kind + +long +JumpID3v2 ( MPC_reader* fp ) +{ + unsigned char tmp [10]; + unsigned int Unsynchronisation; // ID3v2.4-flag + unsigned int ExtHeaderPresent; // ID3v2.4-flag + unsigned int ExperimentalFlag; // ID3v2.4-flag + unsigned int FooterPresent; // ID3v2.4-flag + long ret; + + fp->read ( tmp, sizeof(tmp) ); + + // check id3-tag + if ( 0 != memcmp ( tmp, "ID3", 3) ) + return 0; + + // read flags + Unsynchronisation = tmp[5] & 0x80; + ExtHeaderPresent = tmp[5] & 0x40; + ExperimentalFlag = tmp[5] & 0x20; + FooterPresent = tmp[5] & 0x10; + + if ( tmp[5] & 0x0F ) + return -1; // not (yet???) allowed + if ( (tmp[6] | tmp[7] | tmp[8] | tmp[9]) & 0x80 ) + return -1; // not allowed + + // read HeaderSize (syncsave: 4 * $0xxxxxxx = 28 significant bits) + ret = tmp[6] << 21; + ret += tmp[7] << 14; + ret += tmp[8] << 7; + ret += tmp[9] ; + ret += 10; + if ( FooterPresent ) + ret += 10; + + return ret; +} diff --git a/akode/plugins/mpc_decoder/mppdec/mpc_dec.cpp b/akode/plugins/mpc_decoder/mppdec/mpc_dec.cpp new file mode 100644 index 0000000..1ecb130 --- /dev/null +++ b/akode/plugins/mpc_decoder/mppdec/mpc_dec.cpp @@ -0,0 +1,1074 @@ +#include "stdafx.h" + +void +MPC_decoder::RESET_Synthesis ( void ) +{ + Reset_V (); +} + +void +MPC_decoder::RESET_Y ( void ) +{ + memset ( Y_L, 0, sizeof Y_L ); + memset ( Y_R, 0, sizeof Y_R ); +} + +void +MPC_decoder::RESET_Globals ( void ) +{ + Reset_BitstreamDecode (); + + DecodedFrames = 0; + StreamVersion = 0; + MS_used = 0; + + memset ( Y_L , 0, sizeof Y_L ); + memset ( Y_R , 0, sizeof Y_R ); + memset ( SCF_Index_L , 0, sizeof SCF_Index_L ); + memset ( SCF_Index_R , 0, sizeof SCF_Index_R ); + memset ( Res_L , 0, sizeof Res_L ); + memset ( Res_R , 0, sizeof Res_R ); + memset ( SCFI_L , 0, sizeof SCFI_L ); + memset ( SCFI_R , 0, sizeof SCFI_R ); + memset ( DSCF_Flag_L , 0, sizeof DSCF_Flag_L ); + memset ( DSCF_Flag_R , 0, sizeof DSCF_Flag_R ); + memset ( DSCF_Reference_L, 0, sizeof DSCF_Reference_L ); + memset ( DSCF_Reference_R, 0, sizeof DSCF_Reference_R ); + memset ( Q , 0, sizeof Q ); + memset ( MS_Flag , 0, sizeof MS_Flag ); +} + +unsigned int +MPC_decoder::decode_internal ( MPC_SAMPLE_FORMAT *buffer ) +{ + unsigned int output_frame_length = FrameLength; + + unsigned int FrameBitCnt = 0; + + if ( DecodedFrames >= OverallFrames ) + return (unsigned int)(-1); // end of file -> abort decoding + + // read jump-info for validity check of frame + FwdJumpInfo = Bitstream_read (20); + SeekTable [DecodedFrames] = 20 + FwdJumpInfo; // ... + + ActDecodePos = (Zaehler << 5) + pos; + + // decode data and check for validity of frame + FrameBitCnt = BitsRead (); + switch ( StreamVersion ) { + case 0x04: + case 0x05: + case 0x06: + Lese_Bitstrom_SV6 (); + break; + case 0x07: + case 0x17: + Lese_Bitstrom_SV7 (); + break; + default: + return (unsigned int)(-1); + } + FrameWasValid = BitsRead() - FrameBitCnt == FwdJumpInfo; + + // synthesize signal + Requantisierung ( Max_Band ); + + //if ( EQ_activated && PluginSettings.EQbyMPC ) + // perform_EQ (); + + Synthese_Filter_float ( buffer ); + + + DecodedFrames++; + + // cut off first SynthDelay zero-samples + if ( DecodedFrames == OverallFrames && StreamVersion >= 6 ) + { // reconstruct exact filelength + int mod_block = Bitstream_read (11); + int FilterDecay; + + if (mod_block == 0) mod_block = 1152; // Encoder bugfix + FilterDecay = (mod_block + SynthDelay) % FrameLength; + + // additional FilterDecay samples are needed for decay of synthesis filter + if ( SynthDelay + mod_block >= FrameLength ) { + + // ********************************************************************** + // Rhoades 4/16/2002 + // Commented out are blocks of code which cause gapless playback to fail. + // Temporary fix... + // ********************************************************************** + + if ( ! TrueGaplessPresent ) { + RESET_Y (); + } else { + //if ( FrameLength != LastValidSamples ) { + Bitstream_read (20); + Lese_Bitstrom_SV7 (); + Requantisierung ( Max_Band ); + //FilterDecay = LastValidSamples; + //} + //else { + //FilterDecay = 0; + //} + } + + Synthese_Filter_float ( buffer + 2304 ); + + output_frame_length = FrameLength + FilterDecay; + } + else { // there are only FilterDecay samples needed for this frame + output_frame_length = FilterDecay; + } + } + + if ( samples_to_skip ) { + if (output_frame_length < samples_to_skip) + { + samples_to_skip -= output_frame_length; + output_frame_length = 0; + } + else + { + output_frame_length -= samples_to_skip; + memmove ( buffer, buffer + samples_to_skip * 2, output_frame_length * 2 * sizeof (MPC_SAMPLE_FORMAT) ); + samples_to_skip = 0; + } + } + + return output_frame_length; + +} + +unsigned int MPC_decoder::Decode ( MPC_SAMPLE_FORMAT *buffer, unsigned int * vbr_update_acc, unsigned int * vbr_update_bits ) +{ + for(;;) + { + const int MaxBrokenFrames = 0; // PluginSettings.MaxBrokenFrames + + unsigned int RING = Zaehler; + int vbr_ring = (RING << 5) + pos; + + unsigned int valid_samples = decode_internal ( buffer ); + + if ( valid_samples == (unsigned int)(-1) ) return 0; + + /**************** ERROR CONCEALMENT *****************/ + if ( FrameWasValid == 0 ) { // error occurred in bitstream + return (unsigned int)(-1); + } else + { + if (vbr_update_acc && vbr_update_bits) + { + (*vbr_update_acc) ++; + vbr_ring = (Zaehler << 5) + pos - vbr_ring; + if (vbr_ring < 0) vbr_ring += 524288; + (*vbr_update_bits) += vbr_ring; + } + + } + UpdateBuffer ( RING ); + + if (valid_samples > 0) return valid_samples; + } +} + +void +MPC_decoder::Requantisierung ( const int Last_Band ) +{ + int Band; + int n; + MPC_SAMPLE_FORMAT facL; + MPC_SAMPLE_FORMAT facR; + MPC_SAMPLE_FORMAT templ; + MPC_SAMPLE_FORMAT tempr; + MPC_SAMPLE_FORMAT* YL; + MPC_SAMPLE_FORMAT* YR; + int* L; + int* R; + +#ifdef MPC_FIXED_POINT +#if MPC_FIXED_POINT_FRACTPART == 14 +#define MPC_MULTIPLY_SCF(CcVal, SCF_idx) \ + MPC_MULTIPLY_EX(CcVal,SCF[SCF_idx],SCF_shift[SCF_idx]) +#else + +#error FIXME, Cc table is in 18.14 format + +#endif +#else +#define MPC_MULTIPLY_SCF(CcVal, SCF_idx) \ + MPC_MULTIPLY(CcVal,SCF[SCF_idx]) +#endif + // requantization and scaling of subband-samples + for ( Band = 0; Band <= Last_Band; Band++ ) { // setting pointers + YL = Y_L [0] + Band; + YR = Y_R [0] + Band; + L = Q [Band].L; + R = Q [Band].R; + /************************** MS-coded **************************/ + if ( MS_Flag [Band] ) { + if ( Res_L [Band] ) { + if ( Res_R [Band] ) { // M!=0, S!=0 + facL = MPC_MULTIPLY_SCF( Cc[Res_L[Band]] , (unsigned char)SCF_Index_L[Band][0]); + facR = MPC_MULTIPLY_SCF( Cc[Res_R[Band]] , (unsigned char)SCF_Index_R[Band][0]); + for ( n = 0; n < 12; n++, YL += 32, YR += 32 ) { + *YL = (templ = MPC_MULTIPLY_FLOAT_INT(facL,*L++))+(tempr = MPC_MULTIPLY_FLOAT_INT(facR,*R++)); + *YR = templ - tempr; + } + facL = MPC_MULTIPLY_SCF( Cc[Res_L[Band]] , (unsigned char)SCF_Index_L[Band][1]); + facR = MPC_MULTIPLY_SCF( Cc[Res_R[Band]] , (unsigned char)SCF_Index_R[Band][1]); + for ( ; n < 24; n++, YL += 32, YR += 32 ) { + *YL = (templ = MPC_MULTIPLY_FLOAT_INT(facL,*L++))+(tempr = MPC_MULTIPLY_FLOAT_INT(facR,*R++)); + *YR = templ - tempr; + } + facL = MPC_MULTIPLY_SCF( Cc[Res_L[Band]] , (unsigned char)SCF_Index_L[Band][2]); + facR = MPC_MULTIPLY_SCF( Cc[Res_R[Band]] , (unsigned char)SCF_Index_R[Band][2]); + for ( ; n < 36; n++, YL += 32, YR += 32 ) { + *YL = (templ = MPC_MULTIPLY_FLOAT_INT(facL,*L++))+(tempr = MPC_MULTIPLY_FLOAT_INT(facR,*R++)); + *YR = templ - tempr; + } + } else { // M!=0, S==0 + facL = MPC_MULTIPLY_SCF( Cc[Res_L[Band]] , (unsigned char)SCF_Index_L[Band][0]); + for ( n = 0; n < 12; n++, YL += 32, YR += 32 ) { + *YR = *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + } + facL = MPC_MULTIPLY_SCF( Cc[Res_L[Band]] , (unsigned char)SCF_Index_L[Band][1]); + for ( ; n < 24; n++, YL += 32, YR += 32 ) { + *YR = *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + } + facL = MPC_MULTIPLY_SCF( Cc[Res_L[Band]] , (unsigned char)SCF_Index_L[Band][2]); + for ( ; n < 36; n++, YL += 32, YR += 32 ) { + *YR = *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + } + } + } else { + if (Res_R[Band]) // M==0, S!=0 + { + facR = MPC_MULTIPLY_SCF( Cc[Res_R[Band]] , (unsigned char)SCF_Index_R[Band][0]); + for ( n = 0; n < 12; n++, YL += 32, YR += 32 ) { + *YR = - (*YL = MPC_MULTIPLY_FLOAT_INT(facR,*(R++))); + } + facR = MPC_MULTIPLY_SCF( Cc[Res_R[Band]] , (unsigned char)SCF_Index_R[Band][1]); + for ( ; n < 24; n++, YL += 32, YR += 32 ) { + *YR = - (*YL = MPC_MULTIPLY_FLOAT_INT(facR,*(R++))); + } + facR = MPC_MULTIPLY_SCF( Cc[Res_R[Band]] , (unsigned char)SCF_Index_R[Band][2]); + for ( ; n < 36; n++, YL += 32, YR += 32 ) { + *YR = - (*YL = MPC_MULTIPLY_FLOAT_INT(facR,*(R++))); + } + } else { // M==0, S==0 + for ( n = 0; n < 36; n++, YL += 32, YR += 32 ) { + *YR = *YL = 0; + } + } + } + } + /************************** LR-coded **************************/ + else { + if ( Res_L [Band] ) { + if ( Res_R [Band] ) { // L!=0, R!=0 + facL = MPC_MULTIPLY_SCF( Cc[Res_L[Band]] , (unsigned char)SCF_Index_L[Band][0]); + facR = MPC_MULTIPLY_SCF( Cc[Res_R[Band]] , (unsigned char)SCF_Index_R[Band][0]); + for (n = 0; n < 12; n++, YL += 32, YR += 32 ) { + *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++); + } + facL = MPC_MULTIPLY_SCF( Cc[Res_L[Band]] , (unsigned char)SCF_Index_L[Band][1]); + facR = MPC_MULTIPLY_SCF( Cc[Res_R[Band]] , (unsigned char)SCF_Index_R[Band][1]); + for (; n < 24; n++, YL += 32, YR += 32 ) { + *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++); + } + facL = MPC_MULTIPLY_SCF( Cc[Res_L[Band]] , (unsigned char)SCF_Index_L[Band][2]); + facR = MPC_MULTIPLY_SCF( Cc[Res_R[Band]] , (unsigned char)SCF_Index_R[Band][2]); + for (; n < 36; n++, YL += 32, YR += 32 ) { + *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++); + } + } else { // L!=0, R==0 + facL = MPC_MULTIPLY_SCF( Cc[Res_L[Band]] , (unsigned char)SCF_Index_L[Band][0]); + for ( n = 0; n < 12; n++, YL += 32, YR += 32 ) { + *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + *YR = 0; + } + facL = MPC_MULTIPLY_SCF( Cc[Res_L[Band]] , (unsigned char)SCF_Index_L[Band][1]); + for ( ; n < 24; n++, YL += 32, YR += 32 ) { + *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + *YR = 0; + } + facL = MPC_MULTIPLY_SCF( Cc[Res_L[Band]] , (unsigned char)SCF_Index_L[Band][2]); + for ( ; n < 36; n++, YL += 32, YR += 32 ) { + *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + *YR = 0; + } + } + } + else { + if ( Res_R [Band] ) { // L==0, R!=0 + facR = MPC_MULTIPLY_SCF( Cc[Res_R[Band]] , (unsigned char)SCF_Index_R[Band][0]); + for ( n = 0; n < 12; n++, YL += 32, YR += 32 ) { + *YL = 0; + *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++); + } + facR = MPC_MULTIPLY_SCF( Cc[Res_R[Band]] , (unsigned char)SCF_Index_R[Band][1]); + for ( ; n < 24; n++, YL += 32, YR += 32 ) { + *YL = 0; + *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++); + } + facR = MPC_MULTIPLY_SCF( Cc[Res_R[Band]] , (unsigned char)SCF_Index_R[Band][2]); + for ( ; n < 36; n++, YL += 32, YR += 32 ) { + *YL = 0; + *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++); + } + } else { // L==0, R==0 + for ( n = 0; n < 36; n++, YL += 32, YR += 32 ) { + *YR = *YL = 0; + } + } + } + } + } +} + +/****************************************** SV 6 ******************************************/ +void +MPC_decoder::Lese_Bitstrom_SV6 ( void ) +{ + int n,k; + int Max_used_Band=0; + HuffmanTyp *Table; + const HuffmanTyp *x1; + const HuffmanTyp *x2; + int *L; + int *R; + int *ResL = Res_L; + int *ResR = Res_R; + + /************************ HEADER **************************/ + ResL = Res_L; + ResR = Res_R; + for (n=0; n<=Max_Band; ++n, ++ResL, ++ResR) + { + if (n<11) Table = Region_A; + else if (n>=11 && n<=22) Table = Region_B; + else /*if (n>=23)*/ Table = Region_C; + + *ResL = Q_res[n][Huffman_Decode(Table)]; + if (MS_used) MS_Flag[n] = Bitstream_read(1); + *ResR = Q_res[n][Huffman_Decode(Table)]; + + // only perform the following procedure up to the maximum non-zero subband + if (*ResL || *ResR) Max_used_Band = n; + } + + /************************* SCFI-Bundle *****************************/ + ResL = Res_L; + ResR = Res_R; + for (n=0; n<=Max_used_Band; ++n, ++ResL, ++ResR) { + if (*ResL) SCFI_Bundle_read(SCFI_Bundle, &SCFI_L[n], &DSCF_Flag_L[n]); + if (*ResR) SCFI_Bundle_read(SCFI_Bundle, &SCFI_R[n], &DSCF_Flag_R[n]); + } + + /***************************** SCFI ********************************/ + ResL = Res_L; + ResR = Res_R; + L = SCF_Index_L[0]; + R = SCF_Index_R[0]; + for (n=0; n<=Max_used_Band; ++n, ++ResL, ++ResR, L+=3, R+=3) + { + if (*ResL) + { + /*********** DSCF ************/ + if (DSCF_Flag_L[n]==1) + { + L[2] = DSCF_Reference_L[n]; + switch (SCFI_L[n]) + { + case 3: + L[0] = L[2] + Huffman_Decode_fast(DSCF_Entropie); + L[1] = L[0]; + L[2] = L[1]; + break; + case 1: + L[0] = L[2] + Huffman_Decode_fast(DSCF_Entropie); + L[1] = L[0] + Huffman_Decode_fast(DSCF_Entropie); + L[2] = L[1]; + break; + case 2: + L[0] = L[2] + Huffman_Decode_fast(DSCF_Entropie); + L[1] = L[0]; + L[2] = L[1] + Huffman_Decode_fast(DSCF_Entropie); + break; + case 0: + L[0] = L[2] + Huffman_Decode_fast(DSCF_Entropie); + L[1] = L[0] + Huffman_Decode_fast(DSCF_Entropie); + L[2] = L[1] + Huffman_Decode_fast(DSCF_Entropie); + break; + default: + return; + break; + } + } + /************ SCF ************/ + else + { + switch (SCFI_L[n]) + { + case 3: + L[0] = Bitstream_read(6); + L[1] = L[0]; + L[2] = L[1]; + break; + case 1: + L[0] = Bitstream_read(6); + L[1] = Bitstream_read(6); + L[2] = L[1]; + break; + case 2: + L[0] = Bitstream_read(6); + L[1] = L[0]; + L[2] = Bitstream_read(6); + break; + case 0: + L[0] = Bitstream_read(6); + L[1] = Bitstream_read(6); + L[2] = Bitstream_read(6); + break; + default: + return; + break; + } + } + // update Reference for DSCF + DSCF_Reference_L[n] = L[2]; + } + if (*ResR) + { + R[2] = DSCF_Reference_R[n]; + /*********** DSCF ************/ + if (DSCF_Flag_R[n]==1) + { + switch (SCFI_R[n]) + { + case 3: + R[0] = R[2] + Huffman_Decode_fast(DSCF_Entropie); + R[1] = R[0]; + R[2] = R[1]; + break; + case 1: + R[0] = R[2] + Huffman_Decode_fast(DSCF_Entropie); + R[1] = R[0] + Huffman_Decode_fast(DSCF_Entropie); + R[2] = R[1]; + break; + case 2: + R[0] = R[2] + Huffman_Decode_fast(DSCF_Entropie); + R[1] = R[0]; + R[2] = R[1] + Huffman_Decode_fast(DSCF_Entropie); + break; + case 0: + R[0] = R[2] + Huffman_Decode_fast(DSCF_Entropie); + R[1] = R[0] + Huffman_Decode_fast(DSCF_Entropie); + R[2] = R[1] + Huffman_Decode_fast(DSCF_Entropie); + break; + default: + return; + break; + } + } + /************ SCF ************/ + else + { + switch (SCFI_R[n]) + { + case 3: + R[0] = Bitstream_read(6); + R[1] = R[0]; + R[2] = R[1]; + break; + case 1: + R[0] = Bitstream_read(6); + R[1] = Bitstream_read(6); + R[2] = R[1]; + break; + case 2: + R[0] = Bitstream_read(6); + R[1] = R[0]; + R[2] = Bitstream_read(6); + break; + case 0: + R[0] = Bitstream_read(6); + R[1] = Bitstream_read(6); + R[2] = Bitstream_read(6); + break; + default: + return; + break; + } + } + // update Reference for DSCF + DSCF_Reference_R[n] = R[2]; + } + } + + /**************************** Samples ****************************/ + ResL = Res_L; + ResR = Res_R; + for (n=0; n<=Max_used_Band; ++n, ++ResL, ++ResR) + { + // setting pointers + x1 = SampleHuff[*ResL]; + x2 = SampleHuff[*ResR]; + L = Q[n].L; + R = Q[n].R; + + if (x1!=NULL || x2!=NULL) + for (k=0; k<36; ++k) + { + if (x1 != NULL) *L++ = Huffman_Decode_fast (x1); + if (x2 != NULL) *R++ = Huffman_Decode_fast (x2); + } + + if (*ResL>7 || *ResR>7) + for (k=0; k<36; ++k) + { + if (*ResL>7) *L++ = (int)Bitstream_read(Res_bit[*ResL]) - Dc[*ResL]; + if (*ResR>7) *R++ = (int)Bitstream_read(Res_bit[*ResR]) - Dc[*ResR]; + } + } +} + +/****************************************** SV 7 ******************************************/ +void +MPC_decoder::Lese_Bitstrom_SV7 ( void ) +{ + // these arrays hold decoding results for bundled quantizers (3- and 5-step) + /*static*/ int 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*/ int 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*/ int 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*/ int 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*/ int 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}; + + int n,k; + int Max_used_Band=0; + const HuffmanTyp *Table; + int idx; + int *L ,*R; + int *ResL,*ResR; + unsigned int tmp; + + /***************************** Header *****************************/ + ResL = Res_L; + ResR = Res_R; + + // first subband + *ResL = Bitstream_read(4); + *ResR = Bitstream_read(4); + if (MS_used && !(*ResL==0 && *ResR==0)) MS_Flag[0] = Bitstream_read(1); + + // consecutive subbands + ++ResL; ++ResR; // increase pointers + for (n=1; n<=Max_Band; ++n, ++ResL, ++ResR) + { + idx = Huffman_Decode_fast(HuffHdr); + *ResL = (idx!=4) ? *(ResL-1) + idx : Bitstream_read(4); + + idx = Huffman_Decode_fast(HuffHdr); + *ResR = (idx!=4) ? *(ResR-1) + idx : Bitstream_read(4); + + if (MS_used && !(*ResL==0 && *ResR==0)) MS_Flag[n] = Bitstream_read(1); + + // only perform following procedures up to the maximum non-zero subband + if (*ResL!=0 || *ResR!=0) Max_used_Band = n; + } + /****************************** SCFI ******************************/ + L = SCFI_L; + R = SCFI_R; + ResL = Res_L; + ResR = Res_R; + for (n=0; n<=Max_used_Band; ++n, ++L, ++R, ++ResL, ++ResR) { + if (*ResL) *L = Huffman_Decode_faster(HuffSCFI); + if (*ResR) *R = Huffman_Decode_faster(HuffSCFI); + } + + /**************************** SCF/DSCF ****************************/ + ResL = Res_L; + ResR = Res_R; + L = SCF_Index_L[0]; + R = SCF_Index_R[0]; + for (n=0; n<=Max_used_Band; ++n, ++ResL, ++ResR, L+=3, R+=3) { + if (*ResL) + { + L[2] = DSCF_Reference_L[n]; + switch (SCFI_L[n]) + { + case 1: + idx = Huffman_Decode_fast(HuffDSCF); + L[0] = (idx!=8) ? L[2] + idx : Bitstream_read(6); + idx = Huffman_Decode_fast(HuffDSCF); + L[1] = (idx!=8) ? L[0] + idx : Bitstream_read(6); + L[2] = L[1]; + break; + case 3: + idx = Huffman_Decode_fast(HuffDSCF); + L[0] = (idx!=8) ? L[2] + idx : Bitstream_read(6); + L[1] = L[0]; + L[2] = L[1]; + break; + case 2: + idx = Huffman_Decode_fast(HuffDSCF); + L[0] = (idx!=8) ? L[2] + idx : Bitstream_read(6); + L[1] = L[0]; + idx = Huffman_Decode_fast(HuffDSCF); + L[2] = (idx!=8) ? L[1] + idx : Bitstream_read(6); + break; + case 0: + idx = Huffman_Decode_fast(HuffDSCF); + L[0] = (idx!=8) ? L[2] + idx : Bitstream_read(6); + idx = Huffman_Decode_fast(HuffDSCF); + L[1] = (idx!=8) ? L[0] + idx : Bitstream_read(6); + idx = Huffman_Decode_fast(HuffDSCF); + L[2] = (idx!=8) ? L[1] + idx : Bitstream_read(6); + break; + default: + return; + break; + } + // update Reference for DSCF + DSCF_Reference_L[n] = L[2]; + } + if (*ResR) + { + R[2] = DSCF_Reference_R[n]; + switch (SCFI_R[n]) + { + case 1: + idx = Huffman_Decode_fast(HuffDSCF); + R[0] = (idx!=8) ? R[2] + idx : Bitstream_read(6); + idx = Huffman_Decode_fast(HuffDSCF); + R[1] = (idx!=8) ? R[0] + idx : Bitstream_read(6); + R[2] = R[1]; + break; + case 3: + idx = Huffman_Decode_fast(HuffDSCF); + R[0] = (idx!=8) ? R[2] + idx : Bitstream_read(6); + R[1] = R[0]; + R[2] = R[1]; + break; + case 2: + idx = Huffman_Decode_fast(HuffDSCF); + R[0] = (idx!=8) ? R[2] + idx : Bitstream_read(6); + R[1] = R[0]; + idx = Huffman_Decode_fast(HuffDSCF); + R[2] = (idx!=8) ? R[1] + idx : Bitstream_read(6); + break; + case 0: + idx = Huffman_Decode_fast(HuffDSCF); + R[0] = (idx!=8) ? R[2] + idx : Bitstream_read(6); + idx = Huffman_Decode_fast(HuffDSCF); + R[1] = (idx!=8) ? R[0] + idx : Bitstream_read(6); + idx = Huffman_Decode_fast(HuffDSCF); + R[2] = (idx!=8) ? R[1] + idx : Bitstream_read(6); + break; + default: + return; + break; + } + // update Reference for DSCF + DSCF_Reference_R[n] = R[2]; + } + } + /***************************** Samples ****************************/ + ResL = Res_L; + ResR = Res_R; + L = Q[0].L; + R = Q[0].R; + for (n=0; n<=Max_used_Band; ++n, ++ResL, ++ResR, L+=36, R+=36) + { + /************** links **************/ + switch (*ResL) + { + case -2: case -3: case -4: case -5: case -6: case -7: case -8: case -9: + case -10: case -11: case -12: case -13: case -14: case -15: case -16: case -17: + L += 36; + break; + case -1: + for (k=0; k<36; k++ ) { + tmp = random_int (); + *L++ = ((tmp >> 24) & 0xFF) + ((tmp >> 16) & 0xFF) + ((tmp >> 8) & 0xFF) + ((tmp >> 0) & 0xFF) - 510; + } + break; + case 0: + L += 36;// increase pointer + break; + case 1: + Table = HuffQ[Bitstream_read(1)][1]; + for (k=0; k<12; ++k) + { + idx = Huffman_Decode_fast(Table); + *L++ = idx30[idx]; + *L++ = idx31[idx]; + *L++ = idx32[idx]; + } + break; + case 2: + Table = HuffQ[Bitstream_read(1)][2]; + for (k=0; k<18; ++k) + { + idx = Huffman_Decode_fast(Table); + *L++ = idx50[idx]; + *L++ = idx51[idx]; + } + break; + case 3: + case 4: + Table = HuffQ[Bitstream_read(1)][*ResL]; + for (k=0; k<36; ++k) + *L++ = Huffman_Decode_faster(Table); + break; + case 5: + Table = HuffQ[Bitstream_read(1)][*ResL]; + for (k=0; k<36; ++k) + *L++ = Huffman_Decode_fast(Table); + break; + case 6: + case 7: + Table = HuffQ[Bitstream_read(1)][*ResL]; + for (k=0; k<36; ++k) + *L++ = Huffman_Decode(Table); + break; + case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: + tmp = Dc[*ResL]; + for (k=0; k<36; ++k) + *L++ = (int)Bitstream_read(Res_bit[*ResL]) - tmp; + break; + default: + return; + } + /************** rechts **************/ + switch (*ResR) + { + case -2: case -3: case -4: case -5: case -6: case -7: case -8: case -9: + case -10: case -11: case -12: case -13: case -14: case -15: case -16: case -17: + R += 36; + break; + case -1: + for (k=0; k<36; k++ ) { + tmp = random_int (); + *R++ = ((tmp >> 24) & 0xFF) + ((tmp >> 16) & 0xFF) + ((tmp >> 8) & 0xFF) + ((tmp >> 0) & 0xFF) - 510; + } + break; + case 0: + R += 36;// increase pointer + break; + case 1: + Table = HuffQ[Bitstream_read(1)][1]; + for (k=0; k<12; ++k) + { + idx = Huffman_Decode_fast(Table); + *R++ = idx30[idx]; + *R++ = idx31[idx]; + *R++ = idx32[idx]; + } + break; + case 2: + Table = HuffQ[Bitstream_read(1)][2]; + for (k=0; k<18; ++k) + { + idx = Huffman_Decode_fast(Table); + *R++ = idx50[idx]; + *R++ = idx51[idx]; + } + break; + case 3: + case 4: + Table = HuffQ[Bitstream_read(1)][*ResR]; + for (k=0; k<36; ++k) + *R++ = Huffman_Decode_faster(Table); + break; + case 5: + Table = HuffQ[Bitstream_read(1)][*ResR]; + for (k=0; k<36; ++k) + *R++ = Huffman_Decode_fast(Table); + break; + case 6: + case 7: + Table = HuffQ[Bitstream_read(1)][*ResR]; + for (k=0; k<36; ++k) + *R++ = Huffman_Decode(Table); + break; + case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: + tmp = Dc[*ResR]; + for (k=0; k<36; ++k) + *R++ = (int)Bitstream_read(Res_bit[*ResR]) - tmp; + break; + default: + return; + } + } +} + +MPC_decoder::~MPC_decoder () +{ + if (SeekTable) free ( SeekTable ); +} + +MPC_decoder::MPC_decoder ( MPC_reader *r, double scale_factor ) +{ + m_reader = r; + + HuffQ[0][0] = 0; + HuffQ[1][0] = 0; + HuffQ[0][1] = HuffQ1[0]; + HuffQ[1][1] = HuffQ1[1]; + HuffQ[0][2] = HuffQ2[0]; + HuffQ[1][2] = HuffQ2[1]; + HuffQ[0][3] = HuffQ3[0]; + HuffQ[1][3] = HuffQ3[1]; + HuffQ[0][4] = HuffQ4[0]; + HuffQ[1][4] = HuffQ4[1]; + HuffQ[0][5] = HuffQ5[0]; + HuffQ[1][5] = HuffQ5[1]; + HuffQ[0][6] = HuffQ6[0]; + HuffQ[1][6] = HuffQ6[1]; + HuffQ[0][7] = HuffQ7[0]; + HuffQ[1][7] = HuffQ7[1]; + + SampleHuff[0] = NULL; + SampleHuff[1] = Entropie_1; + SampleHuff[2] = Entropie_2; + SampleHuff[3] = Entropie_3; + SampleHuff[4] = Entropie_4; + SampleHuff[5] = Entropie_5; + SampleHuff[6] = Entropie_6; + SampleHuff[7] = Entropie_7; + SampleHuff[8] = NULL; + SampleHuff[9] = NULL; + SampleHuff[10] = NULL; + SampleHuff[11] = NULL; + SampleHuff[12] = NULL; + SampleHuff[13] = NULL; + SampleHuff[14] = NULL; + SampleHuff[15] = NULL; + SampleHuff[16] = NULL; + SampleHuff[17] = NULL; + + SeekTable = NULL; + EQ_activated = 0; + MPCHeaderPos = 0; + StreamVersion = 0; + MS_used = 0; + FwdJumpInfo = 0; + ActDecodePos = 0; + FrameWasValid = 0; + OverallFrames = 0; + DecodedFrames = 0; + LastValidSamples = 0; + TrueGaplessPresent = 0; + WordsRead = 0; + Max_Band = 0; + SampleRate = 0; +// clips = 0; + __r1 = 1; + __r2 = 1; + + dword = 0; + pos = 0; + Zaehler = 0; + WordsRead = 0; + Max_Band = 0; + + initialisiere_Quantisierungstabellen (scale_factor); + Huffman_SV6_Decoder (); + Huffman_SV7_Decoder (); +} + +void MPC_decoder::SetStreamInfo ( const StreamInfo *si ) +{ + RESET_Synthesis (); + RESET_Globals (); + + StreamVersion = si->simple.StreamVersion; + MS_used = si->simple.MS; + Max_Band = si->simple.MaxBand; + OverallFrames = si->simple.Frames; + MPCHeaderPos = si->simple.HeaderPosition; + LastValidSamples = si->simple.LastFrameSamples; + TrueGaplessPresent = si->simple.IsTrueGapless; + SampleRate = (int)si->simple.SampleFreq; + + if ( SeekTable != NULL ) free ( SeekTable ); + SeekTable = (unsigned short *)calloc ( sizeof(unsigned short), OverallFrames+64 ); + + samples_to_skip = SynthDelay; +} + +bool MPC_decoder::Initialize(const StreamInfo * info) +{ + SetStreamInfo(info); + + // AB: setting position to the beginning of the data-bitstream + switch ( StreamVersion ) { + case 0x04: f_seek ( 4 + MPCHeaderPos, SEEK_SET); pos = 16; break; // Geht auch über eine der Helperfunktionen + case 0x05: + case 0x06: f_seek ( 8 + MPCHeaderPos, SEEK_SET); pos = 0; break; + case 0x07: + case 0x17: /*f_seek ( 24 + MPCHeaderPos, SEEK_SET);*/ pos = 8; break; + default: return false; + } + + // AB: fill buffer and initialize decoder + f_read_dword ( Speicher, MEMSIZE ); + dword = Speicher [Zaehler = 0]; + + return true; +} + +//--------------------------------------------------------------- +// will seek from the beginning of the file to the desired +// position in ms (given by seek_needed) +//--------------------------------------------------------------- + +void +MPC_decoder::Helper1 ( unsigned long bitpos ) +{ + f_seek ( (bitpos>>5) * 4 + MPCHeaderPos, SEEK_SET ); + f_read_dword ( Speicher, 2 ); + dword = Speicher [ Zaehler = 0]; + pos = bitpos & 31; +} + +void +MPC_decoder::Helper2 ( unsigned long bitpos ) +{ + f_seek ( (bitpos>>5) * 4 + MPCHeaderPos, SEEK_SET ); + f_read_dword ( Speicher, MEMSIZE ); + dword = Speicher [ Zaehler = 0]; + pos = bitpos & 31; +} + +void +MPC_decoder::Helper3 ( unsigned long bitpos, unsigned long* buffoffs ) +{ + pos = bitpos & 31; + bitpos >>= 5; + if ( (unsigned long)(bitpos - *buffoffs) >= MEMSIZE-2 ) { + *buffoffs = bitpos; + f_seek ( bitpos * 4L + MPCHeaderPos, SEEK_SET ); + f_read_dword ( Speicher, MEMSIZE ); + } + dword = Speicher [ Zaehler = bitpos - *buffoffs ]; +} + +static unsigned int get_initial_fpos(unsigned int StreamVersion) +{ + unsigned int fpos = 0; + switch ( 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; +} + +bool MPC_decoder::SeekSeconds ( double seconds ) +{ + return SeekSample((MPC_INT64)(seconds * (double)SampleRate + 0.5)); +} + + +bool MPC_decoder::SeekSample(MPC_INT64 destsample) +{ + unsigned long fpos; + unsigned int fwd; + + fwd = (unsigned) (destsample / FrameLength); + samples_to_skip = SynthDelay + (unsigned)(destsample % FrameLength); + + memset ( Y_L , 0, sizeof Y_L ); + memset ( Y_R , 0, sizeof Y_R ); + memset ( SCF_Index_L , 0, sizeof SCF_Index_L ); + memset ( SCF_Index_R , 0, sizeof SCF_Index_R ); + memset ( Res_L , 0, sizeof Res_L ); + memset ( Res_R , 0, sizeof Res_R ); + memset ( SCFI_L , 0, sizeof SCFI_L ); + memset ( SCFI_R , 0, sizeof SCFI_R ); + memset ( DSCF_Flag_L , 0, sizeof DSCF_Flag_L ); + memset ( DSCF_Flag_R , 0, sizeof DSCF_Flag_R ); + memset ( DSCF_Reference_L, 0, sizeof DSCF_Reference_L ); + memset ( DSCF_Reference_R, 0, sizeof DSCF_Reference_R ); + memset ( Q , 0, sizeof Q ); + memset ( MS_Flag , 0, sizeof MS_Flag ); + + RESET_Synthesis (); // resetting synthesis filter to avoid "clicks" + + fwd = fwd < OverallFrames ? fwd : OverallFrames; // prevent from desired position out of allowed range + DecodedFrames = 0; // reset number of decoded frames + + fpos = get_initial_fpos(StreamVersion); + if (fpos == 0) return false; + +#if 1 + { + unsigned long buffoffs = 0x80000000; + for ( ; DecodedFrames + 1024 < fwd; DecodedFrames++ ) { // proceed until 32 frames before (!!) desired position (allows to scan the scalefactors) + if ( SeekTable [DecodedFrames] == 0 ) { + Helper3 ( fpos, &buffoffs ); + fpos += SeekTable [DecodedFrames] = 20 + Bitstream_read (20); // calculate desired pos (in Bits) + } else { + fpos += SeekTable [DecodedFrames]; + } + } + } +#endif + Helper2 ( fpos ); + + for ( ; DecodedFrames < fwd; DecodedFrames++ ) { // read the last 32 frames before the desired position to scan the scalefactors (artifactless jumping) + unsigned int FrameBitCnt; + unsigned int RING; + RING = Zaehler; + FwdJumpInfo = Bitstream_read (20); // read jump-info + SeekTable [DecodedFrames] = 20 + FwdJumpInfo; + ActDecodePos = (Zaehler << 5) + pos; + FrameBitCnt = BitsRead (); // scanning the scalefactors and check for validity of frame + if (StreamVersion >= 7) Lese_Bitstrom_SV7 (); + else Lese_Bitstrom_SV6 (); + if ( BitsRead() - FrameBitCnt != FwdJumpInfo ) { +// Box ("Bug in perform_jump"); + return false; + } + if ( (RING ^ Zaehler) & MEMSIZE2 ) // update buffer + f_read_dword ( Speicher + (RING & MEMSIZE2), MEMSIZE2 ); + } + +// LastBitsRead = BitsRead (); + // LastFrame = DecodedFrames; + + return true; +} + +void MPC_decoder::UpdateBuffer ( unsigned int RING ) +{ + if ( (RING ^ Zaehler) & MEMSIZE2 ) + f_read_dword ( Speicher + (RING & MEMSIZE2), MEMSIZE2 ); // update buffer +} + +static unsigned long swap32(unsigned long val) +{ + const unsigned char * src = (const unsigned char*)&val; + return (unsigned long)src[0] | ((unsigned long)src[1] << 8) | ((unsigned long)src[2] << 16) | ((unsigned long)src[3] << 24); +} + +int MPC_decoder::f_read_dword( unsigned int * ptr, unsigned int count) +{ + count = f_read(ptr,count << 2) >> 2; +#ifndef MPC_LITTLE_ENDIAN + unsigned int n; + for(n=0;n<count;n++) + ptr[n] = swap32(ptr[n]); +#endif + return count; +} diff --git a/akode/plugins/mpc_decoder/mppdec/mpc_dec.h b/akode/plugins/mpc_decoder/mppdec/mpc_dec.h new file mode 100644 index 0000000..e6d37ae --- /dev/null +++ b/akode/plugins/mpc_decoder/mppdec/mpc_dec.h @@ -0,0 +1,200 @@ +#ifndef _mpp_dec_h_ +#define _mpp_dec_h_ + + +#ifdef WIN32 +#define MPC_LITTLE_ENDIAN +#endif + + +#include <assert.h> + +#include "mpc_math.h" + + +class MPC_reader { +public: + virtual size_t read ( void *ptr, size_t size ) = 0; + virtual bool seek ( int offset, int origin ) = 0; + virtual long tell () = 0; + virtual long get_size () = 0; + virtual bool canseek() = 0; +}; + +class MPC_decoder { +public: + MPC_decoder(MPC_reader *r, double scale_factor = 1.0); + ~MPC_decoder(); + + bool Initialize(const class StreamInfo *si); + void ScaleOutput(double factor); + unsigned int Decode(MPC_SAMPLE_FORMAT *buffer, unsigned int * vbr_update_acc = 0, unsigned int * vbr_update_bits = 0); + bool SeekSeconds(double seconds); + bool SeekSample(MPC_INT64 sample); + +public: + enum + { + FrameLength = (36 * 32), // samples per frame + SynthDelay = 481, + DecodeBufferLength = 4 * FrameLength + }; +private: + enum + { + EQ_TAP = 13, // length of FIR filter for EQ + DELAY = ((EQ_TAP + 1) / 2), // delay of FIR + FIR_BANDS = 4, // number of subbands to be FIR filtered + MEMSIZE = 16384, // overall buffer size + MEMSIZE2 = (MEMSIZE/2), // size of one buffer + MEMMASK = (MEMSIZE-1), + V_MEM = 2304 + }; + void SetStreamInfo ( const class StreamInfo *si ); + void UpdateBuffer ( unsigned int RING ); + void RESET_Synthesis ( void ); + void RESET_Globals ( void ); + + unsigned int BitsRead ( void ); + unsigned int decode_internal ( MPC_SAMPLE_FORMAT *buffer ); + void RESET_Y ( void ); + void Lese_Bitstrom_SV6 ( void ); + void Lese_Bitstrom_SV7 ( void ); + + void Requantisierung ( const int Last_Band ); + + unsigned int samples_to_skip; + + typedef struct { + int L [36]; + int R [36]; + } QuantTyp; + + typedef struct { + unsigned int Code; + unsigned int Length; + int Value; + } HuffmanTyp; + + static int HuffmanTyp_cmpfn ( const void* p1, const void* p2 ); + + MPC_reader *m_reader; + + unsigned int dword; // actually decoded 32bit-word + unsigned int pos; // bit-position within dword + unsigned int Speicher [MEMSIZE]; // read-buffer + unsigned int Zaehler; // actual index within read-buffer + + unsigned int FwdJumpInfo; + unsigned int ActDecodePos; + unsigned int FrameWasValid; + + unsigned int DecodedFrames; + unsigned int OverallFrames; + int SampleRate; // Sample frequency + + unsigned int StreamVersion; // version of bitstream + unsigned int MS_used; // MS-coding used ? + int Max_Band; + unsigned int MPCHeaderPos; // AB: needed to support ID3v2 + //unsigned int OverallFrames; + //unsigned int DecodedFrames; + unsigned int LastValidSamples; + unsigned int TrueGaplessPresent; + + unsigned int EQ_activated; + + unsigned int WordsRead; // counts amount of decoded dwords + unsigned short* SeekTable; + + /*static*/ unsigned int __r1; + /*static*/ unsigned int __r2; + + + int SCF_Index_L [32] [3]; + int SCF_Index_R [32] [3]; // holds scalefactor-indices + QuantTyp Q [32]; // holds quantized samples + int Res_L [32]; + int Res_R [32]; // holds the chosen quantizer for each subband + int DSCF_Flag_L [32]; + int DSCF_Flag_R [32]; // differential SCF used? + int SCFI_L [32]; + int SCFI_R [32]; // describes order of transmitted SCF + int DSCF_Reference_L [32]; + int DSCF_Reference_R [32]; // holds last frames SCF + int MS_Flag[32]; // MS used? + + + 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_SAMPLE_FORMAT V_L [V_MEM + 960]; + MPC_SAMPLE_FORMAT V_R [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) +#ifdef MPC_FIXED_POINT + unsigned char SCF_shift[256]; +#endif + unsigned int Q_bit [32]; // holds amount of bits to save chosen quantizer (SV6) + unsigned int Q_res [32] [16]; // holds conversion: index -> quantizer (SV6) + +private: // functions + void Reset_BitstreamDecode ( void ); + unsigned int Bitstream_read ( const unsigned int ); + int Huffman_Decode ( const HuffmanTyp* ); // works with maximum lengths up to 14 + int Huffman_Decode_fast ( const HuffmanTyp* ); // works with maximum lengths up to 10 + int Huffman_Decode_faster ( const HuffmanTyp* ); // works with maximum lengths up to 5 + void SCFI_Bundle_read ( const HuffmanTyp*, int*, int* ); + + void Reset_V ( void ); + void Synthese_Filter_float ( MPC_SAMPLE_FORMAT * dst ); + unsigned int random_int ( void ); + + void EQSet ( int on, char data[10], int preamp ); + void Helper1 ( unsigned long bitpos ); + void Helper2 ( unsigned long bitpos ); + void Helper3 ( unsigned long bitpos, unsigned long* buffoffs ); + void Huffman_SV6_Encoder ( void ); + void Huffman_SV6_Decoder ( void ); + void Huffman_SV7_Encoder ( void ); + void Huffman_SV7_Decoder ( void ); + + void initialisiere_Quantisierungstabellen ( double ); + void Quantisierungsmodes ( void ); // conversion: index -> quantizer (bitstream reading) + void Resort_HuffTables ( const unsigned int elements, HuffmanTyp* Table, const int offset ); +private: + inline int f_read ( void *ptr, size_t size) { return m_reader->read (ptr, size); }; + int f_read_dword( unsigned int * ptr, unsigned int count); + inline bool f_seek ( int offset, int origin) { return m_reader->seek (offset, origin); }; +}; + +#include "streaminfo.h" + +#endif diff --git a/akode/plugins/mpc_decoder/mppdec/mpc_math.h b/akode/plugins/mpc_decoder/mppdec/mpc_math.h new file mode 100644 index 0000000..df894be --- /dev/null +++ b/akode/plugins/mpc_decoder/mppdec/mpc_math.h @@ -0,0 +1,88 @@ +#ifndef _MPC_MATH_H_ +#define _MPC_MATH_H_ + + +// #define MPC_FIXED_POINT + + +#ifdef _MSC_VER +typedef __int64 MPC_INT64; +#else +typedef long long MPC_INT64; +#endif + + +#define MPC_FIXED_POINT_SHIFT 16 + +#ifdef MPC_FIXED_POINT + +#define MPC_FIXED_POINT_SCALE_SHIFT (MPC_FIXED_POINT_SHIFT + MPC_FIXED_POINT_FRACTPART) +#define MPC_FIXED_POINT_SCALE (1 << (MPC_FIXED_POINT_SCALE_SHIFT - 1)) + + +//in fixedpoint mode, results in decode output buffer are in -MPC_FIXED_POINT_SCALE ... MPC_FIXED_POINT_SCALE range + +#define MPC_FIXED_POINT_FRACTPART 14 +typedef int MPC_SAMPLE_FORMAT; + +typedef MPC_INT64 MPC_SAMPLE_FORMAT_MULTIPLY; + +#define MAKE_MPC_SAMPLE(X) (MPC_SAMPLE_FORMAT)((double)(X) * (double)(((MPC_INT64)1)<<MPC_FIXED_POINT_FRACTPART)) +#define MAKE_MPC_SAMPLE_EX(X,Y) (MPC_SAMPLE_FORMAT)((double)(X) * (double)(((MPC_INT64)1)<<(Y))) + +#define MPC_MULTIPLY_NOTRUNCATE(X,Y) \ + (((MPC_SAMPLE_FORMAT_MULTIPLY)(X) * (MPC_SAMPLE_FORMAT_MULTIPLY)(Y)) >> MPC_FIXED_POINT_FRACTPART) + +#define MPC_MULTIPLY_EX_NOTRUNCATE(X,Y,Z) \ + (((MPC_SAMPLE_FORMAT_MULTIPLY)(X) * (MPC_SAMPLE_FORMAT_MULTIPLY)(Y)) >> (Z)) + +#ifdef _DEBUG +static inline MPC_SAMPLE_FORMAT MPC_MULTIPLY(MPC_SAMPLE_FORMAT item1,MPC_SAMPLE_FORMAT item2) +{ + MPC_SAMPLE_FORMAT_MULTIPLY temp = MPC_MULTIPLY_NOTRUNCATE(item1,item2); + assert(temp == (MPC_SAMPLE_FORMAT_MULTIPLY)(MPC_SAMPLE_FORMAT)temp); + return (MPC_SAMPLE_FORMAT)temp; +} + +static inline MPC_SAMPLE_FORMAT MPC_MULTIPLY_EX(MPC_SAMPLE_FORMAT item1,MPC_SAMPLE_FORMAT item2,unsigned shift) +{ + MPC_SAMPLE_FORMAT_MULTIPLY temp = MPC_MULTIPLY_EX_NOTRUNCATE(item1,item2,shift); + assert(temp == (MPC_SAMPLE_FORMAT_MULTIPLY)(MPC_SAMPLE_FORMAT)temp); + return (MPC_SAMPLE_FORMAT)temp; +} + +#else + +#define MPC_MULTIPLY(X,Y) ((MPC_SAMPLE_FORMAT)MPC_MULTIPLY_NOTRUNCATE(X,Y)) +#define MPC_MULTIPLY_EX(X,Y,Z) ((MPC_SAMPLE_FORMAT)MPC_MULTIPLY_EX_NOTRUNCATE(X,Y,Z)) + +#endif + +#define MPC_MULTIPLY_FLOAT_INT(X,Y) ((X)*(Y)) +#define MPC_SCALE_CONST(X,Y,Z) MPC_MULTIPLY_EX(X,MAKE_MPC_SAMPLE_EX(Y,Z),(Z)) +#define MPC_SCALE_CONST_SHL(X,Y,Z,S) MPC_MULTIPLY_EX(X,MAKE_MPC_SAMPLE_EX(Y,Z),(Z)-(S)) +#define MPC_SCALE_CONST_SHR(X,Y,Z,S) MPC_MULTIPLY_EX(X,MAKE_MPC_SAMPLE_EX(Y,Z),(Z)+(S)) +#define MPC_SHR(X,Y) ((X)>>(Y)) +#define MPC_SHL(X,Y) ((X)<<(Y)) + +#else + +//in floating-point mode, decoded samples are in -1...1 range + +typedef float MPC_SAMPLE_FORMAT; + +#define MAKE_MPC_SAMPLE(X) ((MPC_SAMPLE_FORMAT)(X)) +#define MAKE_MPC_SAMPLE_EX(X,Y) ((MPC_SAMPLE_FORMAT)(X)) + +#define MPC_MULTIPLY_FLOAT_INT(X,Y) ((X)*(Y)) +#define MPC_MULTIPLY(X,Y) ((X)*(Y)) +#define MPC_MULTIPLY_EX(X,Y,Z) ((X)*(Y)) +#define MPC_SCALE_CONST(X,Y,Z) ((X)*(Y)) +#define MPC_SCALE_CONST_SHL(X,Y,Z,S) ((X)*(Y)) +#define MPC_SCALE_CONST_SHR(X,Y,Z,S) ((X)*(Y)) +#define MPC_SHR(X,Y) (X) +#define MPC_SHL(X,Y) (X) + +#endif + +#endif diff --git a/akode/plugins/mpc_decoder/mppdec/readme.txt b/akode/plugins/mpc_decoder/mppdec/readme.txt new file mode 100644 index 0000000..f4e3d62 --- /dev/null +++ b/akode/plugins/mpc_decoder/mppdec/readme.txt @@ -0,0 +1,23 @@ +Portable Musepack decoder +(C) 1999-2002 Buschmann/Klemm/Piecha/Wolf +(C) 2003-2004 Peter Pawlowski + +See LGPL.txt for license/redistribution info. + +Usage: see sample.cpp + +Features: +- Switchable fixed-point and floating-point modes - enable/disable "#define MPC_FIXED_POINT" in mpc_math.h +- Endian-safe, verified running correctly on big-endian machines +- Multiinstance and multithread safe +- File access callbacks +- No assembly code used, for full portability + +Verified correctly compiling/running under: +- win32 / x86 / MSVC6 + SP5 + processor pack - very fast floating-point mode (goes above 200x on ~2GHz machines), fixed-point mode is significantly slower (~60x) +- win32 / x86 / MSVC7.1 - slightly faster than MSVC6, fixed-point mode still relatively slow +- win32 / x86 / DMCPP - fixed-point mode faster than MSVC, floating-point mode slower than expected with strange slowdowns when compiled with speed optimizations enabled +- wince / ARM (32bit) / eVC4 + SP3 - fixed-point decoding speed on 400MHz XScale CPU is about 10x realtime +- Darwin 7.3.0, MacOS X 10.3.3 / PowerPC970/G5 / GCC 3.3 - about 80x-100x decoding speed in both modes on 2GHz G5, thanks to TrNSZ for testing/feedback + +Package includes project files for MSVC6 and eVC4.
\ No newline at end of file diff --git a/akode/plugins/mpc_decoder/mppdec/requant.cpp b/akode/plugins/mpc_decoder/mppdec/requant.cpp new file mode 100644 index 0000000..b2e22c9 --- /dev/null +++ b/akode/plugins/mpc_decoder/mppdec/requant.cpp @@ -0,0 +1,112 @@ +#include "stdafx.h" + +/* C O N S T A N T S */ +// bits per sample for chosen quantizer +const unsigned int Res_bit [18] = { + 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 +}; + +// coefficients for requantization +// 65536/step bzw. 65536/(2*D+1) + + + +#define _(X) MAKE_MPC_SAMPLE_EX(X,14) + +const MPC_SAMPLE_FORMAT __Cc [1 + 18] = { + _(111.285962475327f), // 32768/2/255*sqrt(3) + _(65536.000000000000f), _(21845.333333333332f), _(13107.200000000001f), _(9362.285714285713f), + _(7281.777777777777f), _(4369.066666666666f), _(2114.064516129032f), _(1040.253968253968f), + _(516.031496062992f), _(257.003921568627f), _(128.250489236790f), _(64.062561094819f), + _(32.015632633121f), _(16.003907203907f), _(8.000976681723f), _(4.000244155527f), + _(2.000061037018f), _(1.000015259021f) +}; + +#undef _ + +// offset for requantization +// 2*D+1 = steps of quantizer +const int __Dc [1 + 18] = { + 2, + 0, 1, 2, 3, 4, 7, 15, 31, 63, + 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767 +}; + +static unsigned find_shift(double fval) +{ + MPC_INT64 val = (MPC_INT64)fval; + if (val<0) val = -val; + unsigned ptr = 0; + while(val) {val>>=1;ptr++;} + + return ptr > 31 ? 0 : 31 - ptr; +} + +/* F U N C T I O N S */ + +#define SET_SCF(N,X) SCF[N] = MAKE_MPC_SAMPLE_EX(X,SCF_shift[N] = find_shift(X)); + +void +MPC_decoder::ScaleOutput ( double factor ) +{ +#ifndef MPC_FIXED_POINT + factor *= 1.0 / (double)(1<<(MPC_FIXED_POINT_SHIFT-1)); +#else + factor *= 1.0 / (double)(1<<(16 - MPC_FIXED_POINT_SHIFT)); +#endif + int n; + double f1 = factor; + double f2 = factor; + + // handles +1.58...-98.41 dB, where's scf[n] / scf[n-1] = 1.20050805774840750476 + + SET_SCF(1,factor); + + f1 *= 0.83298066476582673961; + f2 *= 1/0.83298066476582673961; + + for ( n = 1; n <= 128; n++ ) { + SET_SCF((unsigned char)(1+n),f1); + SET_SCF((unsigned char)(1-n),f2); + f1 *= 0.83298066476582673961; + f2 *= 1/0.83298066476582673961; + } +} + +void +MPC_decoder::Quantisierungsmodes ( void ) // conversion: index -> quantizer (bitstream reading) +{ // conversion: quantizer -> index (bitstream writing) + int Band = 0; + int i; + + do { + Q_bit [Band] = 4; + for ( i = 0; i < 16-1; i++ ) + Q_res [Band] [i] = i; + Q_res [Band][i] = 17; + Band++; + } while ( Band < 11 ); + + do { + Q_bit [Band] = 3; + for ( i = 0; i < 8-1; i++ ) + Q_res [Band] [i] = i; + Q_res [Band] [i] = 17; + Band++; + } while ( Band < 23 ); + + do { + Q_bit [Band] = 2; + for ( i = 0; i < 4-1; i++ ) + Q_res [Band] [i] = i; + Q_res [Band] [i] = 17; + Band++; + } while ( Band < 32 ); +} + +void +MPC_decoder::initialisiere_Quantisierungstabellen ( double scale_factor ) +{ + Quantisierungsmodes (); + ScaleOutput ( scale_factor ); +} diff --git a/akode/plugins/mpc_decoder/mppdec/requant.h b/akode/plugins/mpc_decoder/mppdec/requant.h new file mode 100644 index 0000000..c5b8794 --- /dev/null +++ b/akode/plugins/mpc_decoder/mppdec/requant.h @@ -0,0 +1,14 @@ +#ifndef _requant_h +#define _requant_h_ + +#include "mpc_dec.h" + +/* C O N S T A N T S */ +extern const unsigned int Res_bit [18]; // bits per sample for chosen quantizer +extern const MPC_SAMPLE_FORMAT __Cc [1 + 18]; // coefficients for requantization +extern const int __Dc [1 + 18]; // offset for requantization + +#define Cc (__Cc + 1) +#define Dc (__Dc + 1) + +#endif diff --git a/akode/plugins/mpc_decoder/mppdec/stdafx.cpp b/akode/plugins/mpc_decoder/mppdec/stdafx.cpp new file mode 100644 index 0000000..81b3bac --- /dev/null +++ b/akode/plugins/mpc_decoder/mppdec/stdafx.cpp @@ -0,0 +1,6 @@ +// stdafx.cpp : source file that includes just the standard includes +// mpcdec.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + diff --git a/akode/plugins/mpc_decoder/mppdec/stdafx.h b/akode/plugins/mpc_decoder/mppdec/stdafx.h new file mode 100644 index 0000000..771f6fe --- /dev/null +++ b/akode/plugins/mpc_decoder/mppdec/stdafx.h @@ -0,0 +1,27 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__B71FBBBC_81CB_47B5_A555_53A45CFD74F3__INCLUDED_) +#define AFX_STDAFX_H__B71FBBBC_81CB_47B5_A555_53A45CFD74F3__INCLUDED_ + +#ifdef _MSC_VER +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#endif // _MSC_VER + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#include "mpc_dec.h" +#include "requant.h" + + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__B71FBBBC_81CB_47B5_A555_53A45CFD74F3__INCLUDED_) diff --git a/akode/plugins/mpc_decoder/mppdec/streaminfo.cpp b/akode/plugins/mpc_decoder/mppdec/streaminfo.cpp new file mode 100644 index 0000000..fa61a23 --- /dev/null +++ b/akode/plugins/mpc_decoder/mppdec/streaminfo.cpp @@ -0,0 +1,210 @@ +#include "stdafx.h" + +long JumpID3v2 ( MPC_reader* fp );//idtag.cpp + +static const char* +Stringify ( unsigned int profile ) // profile is 0...15, where 7...13 is used +{ + static const char na [] = "n.a."; + static const char* Names [] = { + na, "'Unstable/Experimental'", na, na, + na, "'quality 0'", "'quality 1'", "'Telephone'", + "'Thumb'", "'Radio'", "'Standard'", "'Xtreme'", + "'Insane'", "'BrainDead'", "'quality 9'", "'quality 10'" + }; + + return profile >= sizeof(Names)/sizeof(*Names) ? na : Names [profile]; +} + +// read information from SV8 header +int StreamInfo::ReadHeaderSV8 ( MPC_reader* fp ) +{ + return 0; +} + +// read information from SV7 header +int StreamInfo::ReadHeaderSV7 ( unsigned int HeaderData [8] ) +{ + const int samplefreqs [4] = { 44100, 48000, 37800, 32000 }; + + //unsigned int HeaderData [8]; + unsigned short EstimatedPeakTitle = 0; + + if ( simple.StreamVersion > 0x71 ) { +// Update (simple.StreamVersion); + return 0; + } + + /* + if ( !fp->seek ( simple.HeaderPosition, SEEK_SET ) ) // seek to header start + return ERROR_CODE_FILE; + if ( fp->read ( HeaderData, sizeof HeaderData) != sizeof HeaderData ) + return ERROR_CODE_FILE; + */ + + simple.Bitrate = 0; + simple.Frames = HeaderData[1]; + simple.IS = 0; + simple.MS = (HeaderData[2] >> 30) & 0x0001; + simple.MaxBand = (HeaderData[2] >> 24) & 0x003F; + simple.BlockSize = 1; + simple.Profile = (HeaderData[2] << 8) >> 28; + simple.ProfileName = Stringify ( simple.Profile ); + + simple.SampleFreq = samplefreqs [(HeaderData[2]>>16) & 0x0003]; + + EstimatedPeakTitle = (unsigned short)( HeaderData[2] & 0xFFFF ); // read the ReplayGain data + simple.GainTitle = (unsigned short)((HeaderData[3] >> 16) & 0xFFFF ); + simple.PeakTitle = (unsigned short)( HeaderData[3] & 0xFFFF ); + simple.GainAlbum = (unsigned short)((HeaderData[4] >> 16) & 0xFFFF ); + simple.PeakAlbum = (unsigned short)( HeaderData[4] & 0xFFFF ); + + simple.IsTrueGapless = (HeaderData[5] >> 31) & 0x0001; // true gapless: used? + simple.LastFrameSamples = (HeaderData[5] >> 20) & 0x07FF; // true gapless: valid samples for last frame + + simple.EncoderVersion = (HeaderData[6] >> 24) & 0x00FF; + if ( simple.EncoderVersion == 0 ) { + sprintf ( simple.Encoder, "Buschmann 1.7.0...9, Klemm 0.90...1.05" ); + } else { + switch ( simple.EncoderVersion % 10 ) { + case 0: + sprintf ( simple.Encoder, "Release %u.%u", simple.EncoderVersion/100, simple.EncoderVersion/10%10 ); + break; + case 2: case 4: case 6: case 8: + sprintf ( simple.Encoder, "Beta %u.%02u", simple.EncoderVersion/100, simple.EncoderVersion%100 ); + break; + default: + sprintf ( simple.Encoder, "--Alpha-- %u.%02u", simple.EncoderVersion/100, simple.EncoderVersion%100 ); + break; + } + } + +// if ( simple.PeakTitle == 0 ) // there is no correct PeakTitle contained within header +// simple.PeakTitle = (unsigned short)(EstimatedPeakTitle * 1.18); +// if ( simple.PeakAlbum == 0 ) +// simple.PeakAlbum = simple.PeakTitle; // no correct PeakAlbum, use PeakTitle + + //simple.SampleFreq = 44100; // AB: used by all files up to SV7 + simple.Channels = 2; + + return ERROR_CODE_OK; +} + +// read information from SV4-SV6 header +int StreamInfo::ReadHeaderSV6 ( unsigned int HeaderData [8] ) +{ + //unsigned int HeaderData [8]; + + /* + if ( !fp->seek ( simple.HeaderPosition, SEEK_SET ) ) // seek to header start + return ERROR_CODE_FILE; + if ( fp->read ( HeaderData, sizeof HeaderData ) != sizeof HeaderData ) + return ERROR_CODE_FILE; + */ + + simple.Bitrate = (HeaderData[0] >> 23) & 0x01FF; // read the file-header (SV6 and below) + simple.IS = (HeaderData[0] >> 22) & 0x0001; + simple.MS = (HeaderData[0] >> 21) & 0x0001; + simple.StreamVersion = (HeaderData[0] >> 11) & 0x03FF; + simple.MaxBand = (HeaderData[0] >> 6) & 0x001F; + simple.BlockSize = (HeaderData[0] ) & 0x003F; + simple.Profile = 0; + simple.ProfileName = Stringify ( (unsigned)(-1) ); + if ( simple.StreamVersion >= 5 ) + simple.Frames = HeaderData[1]; // 32 bit + else + simple.Frames = (HeaderData[1]>>16); // 16 bit + + simple.GainTitle = 0; // not supported + simple.PeakTitle = 0; + simple.GainAlbum = 0; + simple.PeakAlbum = 0; + + simple.LastFrameSamples = 0; + simple.IsTrueGapless = 0; + + simple.EncoderVersion = 0; + simple.Encoder[0] = '\0'; + + if ( simple.StreamVersion == 7 ) return ERROR_CODE_SV7BETA; // are there any unsupported parameters used? + if ( simple.Bitrate != 0 ) return ERROR_CODE_CBR; + if ( simple.IS != 0 ) return ERROR_CODE_IS; + if ( simple.BlockSize != 1 ) return ERROR_CODE_BLOCKSIZE; + + if ( simple.StreamVersion < 6 ) // Bugfix: last frame was invalid for up to SV5 + simple.Frames -= 1; + + simple.SampleFreq = 44100; // AB: used by all files up to SV7 + simple.Channels = 2; + + if ( simple.StreamVersion < 4 || simple.StreamVersion > 7 ) + return ERROR_CODE_INVALIDSV; + + return ERROR_CODE_OK; +} + +static unsigned int swap32(unsigned int val) +{ + const unsigned char * src = (const unsigned char*)&val; + return (unsigned int)src[0] | ((unsigned int)src[1] << 8) | ((unsigned int)src[2] << 16) | ((unsigned int)src[3] << 24); +} + +// reads file header and tags +int StreamInfo::ReadStreamInfo ( MPC_reader* fp) +{ + unsigned int HeaderData[8]; + int Error = 0; + + //memset ( &simple, 0, sizeof (BasicData) ); // Reset Info-Data + + + if ( (simple.HeaderPosition = JumpID3v2 (fp)) < 0 ) // get header position + return ERROR_CODE_FILE; + + if ( !fp->seek ( simple.HeaderPosition, SEEK_SET ) ) // seek to first byte of mpc data + return ERROR_CODE_FILE; + if ( fp->read ( HeaderData, 8*4 ) != 8*4 ) + return ERROR_CODE_FILE; + if (!fp->seek(simple.HeaderPosition+6*4,SEEK_SET)) return ERROR_CODE_FILE; + +/* if ( fp->read ( HeaderData, 6*4 ) != 6*4 ) + return ERROR_CODE_FILE; + HeaderData[6]=HeaderData[7]=0; + */ + /* + if ( fp->seek ( 0L, SEEK_END ) != 0 ) // get filelength + return ERROR_CODE_FILE; + simple.TotalFileLength = fp->tell(); + */ + simple.TotalFileLength = fp->get_size (); + simple.TagOffset = simple.TotalFileLength; + + if ( memcmp ( HeaderData, "MP+", 3 ) == 0 ) + { +#ifndef MPC_LITTLE_ENDIAN + { + unsigned int ptr; + for(ptr=0;ptr<8;ptr++) HeaderData[ptr] = swap32(HeaderData[ptr]); + } +#endif + simple.StreamVersion = HeaderData[0] >> 24; + + if ( (simple.StreamVersion & 15) >= 8 ) // StreamVersion 8 + Error = ReadHeaderSV8 ( fp ); + else if ( (simple.StreamVersion & 15) == 7 ) // StreamVersion 7 + Error = ReadHeaderSV7 ( HeaderData ); + } else { // StreamVersion 4-6 + Error = ReadHeaderSV6 ( HeaderData ); + } + + + simple.PCMSamples = 1152 * simple.Frames - 576; // estimation, exact value needs too much time + if ( simple.PCMSamples > 0 ) + simple.AverageBitrate = (simple.TagOffset - simple.HeaderPosition) * 8. * simple.SampleFreq / simple.PCMSamples; + else + simple.AverageBitrate = 0; + + return Error; +} + +/* end of in_mpc.c */ diff --git a/akode/plugins/mpc_decoder/mppdec/streaminfo.h b/akode/plugins/mpc_decoder/mppdec/streaminfo.h new file mode 100644 index 0000000..19bf2e9 --- /dev/null +++ b/akode/plugins/mpc_decoder/mppdec/streaminfo.h @@ -0,0 +1,70 @@ +#ifndef _mpc_streaminfo_h_ +#define _mpc_streaminfo_h_ + +#ifndef _mpc_dec_h_ +class MPC_reader; +#endif + + +// error codes +#define ERROR_CODE_OK 0 +#define ERROR_CODE_FILE -1 +#define ERROR_CODE_SV7BETA 1 +#define ERROR_CODE_CBR 2 +#define ERROR_CODE_IS 3 +#define ERROR_CODE_BLOCKSIZE 4 +#define ERROR_CODE_INVALIDSV 5 + + +class StreamInfo { +public: + typedef long off_t; + + typedef struct { + unsigned int SampleFreq; + unsigned int Channels; + off_t HeaderPosition; // byte position of header + unsigned int StreamVersion; // Streamversion of current file + unsigned int Bitrate; // bitrate of current file (bps) + double AverageBitrate; // Average bitrate in bits/sec + unsigned int Frames; // number of frames contained + MPC_INT64 PCMSamples; + unsigned int MaxBand; // maximum band-index used (0...31) + unsigned int IS; // Intensity Stereo (0: off, 1: on) + unsigned int MS; // Mid/Side Stereo (0: off, 1: on) + unsigned int BlockSize; // only needed for SV4...SV6 -> not supported + unsigned int Profile; // quality profile + const char* ProfileName; + + // ReplayGain related data + short GainTitle; + short GainAlbum; + unsigned short PeakAlbum; + unsigned short PeakTitle; + + // true gapless stuff + unsigned int IsTrueGapless; // is true gapless used? + unsigned int LastFrameSamples; // number of valid samples within last frame + + unsigned int EncoderVersion; // version of encoder used + char Encoder[256]; + + off_t TagOffset; + off_t TotalFileLength; + } BasicData; + + BasicData simple; + +public: + StreamInfo (); + int ReadStreamInfo ( MPC_reader *fp ); + MPC_INT64 GetLenthSamples(); + double GetLength();//in seconds + +private: + int ReadHeaderSV6 ( unsigned int HeaderData [8] ); + int ReadHeaderSV7 ( unsigned int HeaderData [8] ); + int ReadHeaderSV8 ( MPC_reader* fp ); +}; + +#endif //_mpc_streaminfo_h_ diff --git a/akode/plugins/mpc_decoder/mppdec/synth_filter.cpp b/akode/plugins/mpc_decoder/mppdec/synth_filter.cpp new file mode 100644 index 0000000..256417a --- /dev/null +++ b/akode/plugins/mpc_decoder/mppdec/synth_filter.cpp @@ -0,0 +1,403 @@ +#include "stdafx.h" + +typedef int ptrdiff_t; + + +/* C O N S T A N T S */ +#undef _ + +#define MPC_FIXED_POINT_SYNTH_FIX 2 +#define MPC_FIXED_POINT_SYNTH_FIX2 0 + +#define Di_opt_shift 30 +#define _(value) MAKE_MPC_SAMPLE_EX((double)value/(double)(0x10000 << MPC_FIXED_POINT_SYNTH_FIX2),Di_opt_shift) + + +static const MPC_SAMPLE_FORMAT Di_opt [32] [16] = { + { _( 0), _( -29), _( 213), _( -459), _( 2037), _(-5153), _( 6574), _(-37489), _(75038), _(37489), _(6574), _( 5153), _(2037), _( 459), _(213), _(29) }, + { _( -1), _( -31), _( 218), _( -519), _( 2000), _(-5517), _( 5959), _(-39336), _(74992), _(35640), _(7134), _( 4788), _(2063), _( 401), _(208), _(26) }, + { _( -1), _( -35), _( 222), _( -581), _( 1952), _(-5879), _( 5288), _(-41176), _(74856), _(33791), _(7640), _( 4425), _(2080), _( 347), _(202), _(24) }, + { _( -1), _( -38), _( 225), _( -645), _( 1893), _(-6237), _( 4561), _(-43006), _(74630), _(31947), _(8092), _( 4063), _(2087), _( 294), _(196), _(21) }, + { _( -1), _( -41), _( 227), _( -711), _( 1822), _(-6589), _( 3776), _(-44821), _(74313), _(30112), _(8492), _( 3705), _(2085), _( 244), _(190), _(19) }, + { _( -1), _( -45), _( 228), _( -779), _( 1739), _(-6935), _( 2935), _(-46617), _(73908), _(28289), _(8840), _( 3351), _(2075), _( 197), _(183), _(17) }, + { _( -1), _( -49), _( 228), _( -848), _( 1644), _(-7271), _( 2037), _(-48390), _(73415), _(26482), _(9139), _( 3004), _(2057), _( 153), _(176), _(16) }, + { _( -2), _( -53), _( 227), _( -919), _( 1535), _(-7597), _( 1082), _(-50137), _(72835), _(24694), _(9389), _( 2663), _(2032), _( 111), _(169), _(14) }, + { _( -2), _( -58), _( 224), _( -991), _( 1414), _(-7910), _( 70), _(-51853), _(72169), _(22929), _(9592), _( 2330), _(2001), _( 72), _(161), _(13) }, + { _( -2), _( -63), _( 221), _(-1064), _( 1280), _(-8209), _( -998), _(-53534), _(71420), _(21189), _(9750), _( 2006), _(1962), _( 36), _(154), _(11) }, + { _( -2), _( -68), _( 215), _(-1137), _( 1131), _(-8491), _( -2122), _(-55178), _(70590), _(19478), _(9863), _( 1692), _(1919), _( 2), _(147), _(10) }, + { _( -3), _( -73), _( 208), _(-1210), _( 970), _(-8755), _( -3300), _(-56778), _(69679), _(17799), _(9935), _( 1388), _(1870), _( -29), _(139), _( 9) }, + { _( -3), _( -79), _( 200), _(-1283), _( 794), _(-8998), _( -4533), _(-58333), _(68692), _(16155), _(9966), _( 1095), _(1817), _( -57), _(132), _( 8) }, + { _( -4), _( -85), _( 189), _(-1356), _( 605), _(-9219), _( -5818), _(-59838), _(67629), _(14548), _(9959), _( 814), _(1759), _( -83), _(125), _( 7) }, + { _( -4), _( -91), _( 177), _(-1428), _( 402), _(-9416), _( -7154), _(-61289), _(66494), _(12980), _(9916), _( 545), _(1698), _(-106), _(117), _( 7) }, + { _( -5), _( -97), _( 163), _(-1498), _( 185), _(-9585), _( -8540), _(-62684), _(65290), _(11455), _(9838), _( 288), _(1634), _(-127), _(111), _( 6) }, + { _( -5), _(-104), _( 146), _(-1567), _( -45), _(-9727), _( -9975), _(-64019), _(64019), _( 9975), _(9727), _( 45), _(1567), _(-146), _(104), _( 5) }, + { _( -6), _(-111), _( 127), _(-1634), _( -288), _(-9838), _(-11455), _(-65290), _(62684), _( 8540), _(9585), _( -185), _(1498), _(-163), _( 97), _( 5) }, + { _( -7), _(-117), _( 106), _(-1698), _( -545), _(-9916), _(-12980), _(-66494), _(61289), _( 7154), _(9416), _( -402), _(1428), _(-177), _( 91), _( 4) }, + { _( -7), _(-125), _( 83), _(-1759), _( -814), _(-9959), _(-14548), _(-67629), _(59838), _( 5818), _(9219), _( -605), _(1356), _(-189), _( 85), _( 4) }, + { _( -8), _(-132), _( 57), _(-1817), _(-1095), _(-9966), _(-16155), _(-68692), _(58333), _( 4533), _(8998), _( -794), _(1283), _(-200), _( 79), _( 3) }, + { _( -9), _(-139), _( 29), _(-1870), _(-1388), _(-9935), _(-17799), _(-69679), _(56778), _( 3300), _(8755), _( -970), _(1210), _(-208), _( 73), _( 3) }, + { _(-10), _(-147), _( -2), _(-1919), _(-1692), _(-9863), _(-19478), _(-70590), _(55178), _( 2122), _(8491), _(-1131), _(1137), _(-215), _( 68), _( 2) }, + { _(-11), _(-154), _( -36), _(-1962), _(-2006), _(-9750), _(-21189), _(-71420), _(53534), _( 998), _(8209), _(-1280), _(1064), _(-221), _( 63), _( 2) }, + { _(-13), _(-161), _( -72), _(-2001), _(-2330), _(-9592), _(-22929), _(-72169), _(51853), _( -70), _(7910), _(-1414), _( 991), _(-224), _( 58), _( 2) }, + { _(-14), _(-169), _(-111), _(-2032), _(-2663), _(-9389), _(-24694), _(-72835), _(50137), _(-1082), _(7597), _(-1535), _( 919), _(-227), _( 53), _( 2) }, + { _(-16), _(-176), _(-153), _(-2057), _(-3004), _(-9139), _(-26482), _(-73415), _(48390), _(-2037), _(7271), _(-1644), _( 848), _(-228), _( 49), _( 1) }, + { _(-17), _(-183), _(-197), _(-2075), _(-3351), _(-8840), _(-28289), _(-73908), _(46617), _(-2935), _(6935), _(-1739), _( 779), _(-228), _( 45), _( 1) }, + { _(-19), _(-190), _(-244), _(-2085), _(-3705), _(-8492), _(-30112), _(-74313), _(44821), _(-3776), _(6589), _(-1822), _( 711), _(-227), _( 41), _( 1) }, + { _(-21), _(-196), _(-294), _(-2087), _(-4063), _(-8092), _(-31947), _(-74630), _(43006), _(-4561), _(6237), _(-1893), _( 645), _(-225), _( 38), _( 1) }, + { _(-24), _(-202), _(-347), _(-2080), _(-4425), _(-7640), _(-33791), _(-74856), _(41176), _(-5288), _(5879), _(-1952), _( 581), _(-222), _( 35), _( 1) }, + { _(-26), _(-208), _(-401), _(-2063), _(-4788), _(-7134), _(-35640), _(-74992), _(39336), _(-5959), _(5517), _(-2000), _( 519), _(-218), _( 31), _( 1) } +}; + +#undef _ + +/* F U N K T I O N E N */ +void +MPC_decoder::Reset_V ( void ) +{ + memset ( V_L, 0, sizeof V_L ); + memset ( V_R, 0, sizeof V_R ); +} + + +static void Calculate_New_V ( const MPC_SAMPLE_FORMAT * Sample, MPC_SAMPLE_FORMAT * V ) +{ + // Calculating new V-buffer values for left channel + // calculate new V-values (ISO-11172-3, p. 39) + // based upon fast-MDCT algorithm by Byeong Gi Lee + /*static*/ MPC_SAMPLE_FORMAT A00, A01, A02, A03, A04, A05, A06, A07, A08, A09, A10, A11, A12, A13, A14, A15; + /*static*/ MPC_SAMPLE_FORMAT B00, B01, B02, B03, B04, B05, B06, B07, B08, B09, B10, B11, B12, B13, B14, B15; + MPC_SAMPLE_FORMAT tmp; + + A00 = Sample[ 0] + Sample[31]; + A01 = Sample[ 1] + Sample[30]; + A02 = Sample[ 2] + Sample[29]; + A03 = Sample[ 3] + Sample[28]; + A04 = Sample[ 4] + Sample[27]; + A05 = Sample[ 5] + Sample[26]; + A06 = Sample[ 6] + Sample[25]; + A07 = Sample[ 7] + Sample[24]; + A08 = Sample[ 8] + Sample[23]; + A09 = Sample[ 9] + Sample[22]; + A10 = Sample[10] + Sample[21]; + A11 = Sample[11] + Sample[20]; + A12 = Sample[12] + Sample[19]; + A13 = Sample[13] + Sample[18]; + A14 = Sample[14] + Sample[17]; + A15 = Sample[15] + Sample[16]; + + B00 = A00 + A15; + B01 = A01 + A14; + B02 = A02 + A13; + B03 = A03 + A12; + B04 = A04 + A11; + B05 = A05 + A10; + B06 = A06 + A09; + B07 = A07 + A08;; + B08 = MPC_SCALE_CONST((A00 - A15) , 0.5024192929f , 31); + B09 = MPC_SCALE_CONST((A01 - A14) , 0.5224986076f , 31); + B10 = MPC_SCALE_CONST((A02 - A13) , 0.5669440627f , 31); + B11 = MPC_SCALE_CONST((A03 - A12) , 0.6468217969f , 31); + B12 = MPC_SCALE_CONST((A04 - A11) , 0.7881546021f , 31); + B13 = MPC_SCALE_CONST((A05 - A10) , 1.0606776476f , 30); + B14 = MPC_SCALE_CONST((A06 - A09) , 1.7224471569f , 30); + B15 = MPC_SCALE_CONST((A07 - A08) , 5.1011486053f , 28); + + A00 = B00 + B07; + A01 = B01 + B06; + A02 = B02 + B05; + A03 = B03 + B04; + A04 = MPC_SCALE_CONST((B00 - B07) , 0.5097956061f , 31); + A05 = MPC_SCALE_CONST((B01 - B06) , 0.6013448834f , 31); + A06 = MPC_SCALE_CONST((B02 - B05) , 0.8999761939f , 31); + A07 = MPC_SCALE_CONST((B03 - B04) , 2.5629155636f , 29); + A08 = B08 + B15; + A09 = B09 + B14; + A10 = B10 + B13; + A11 = B11 + B12; + A12 = MPC_SCALE_CONST((B08 - B15) , 0.5097956061f , 31); + A13 = MPC_SCALE_CONST((B09 - B14) , 0.6013448834f , 31); + A14 = MPC_SCALE_CONST((B10 - B13) , 0.8999761939f , 31); + A15 = MPC_SCALE_CONST((B11 - B12) , 2.5629155636f , 29); + + B00 = A00 + A03; + B01 = A01 + A02; + B02 = MPC_SCALE_CONST((A00 - A03) , 0.5411961079f , 31); + B03 = MPC_SCALE_CONST((A01 - A02) , 1.3065630198f , 30); + B04 = A04 + A07; + B05 = A05 + A06; + B06 = MPC_SCALE_CONST((A04 - A07) , 0.5411961079f , 31); + B07 = MPC_SCALE_CONST((A05 - A06) , 1.3065630198f , 30); + B08 = A08 + A11; + B09 = A09 + A10; + B10 = MPC_SCALE_CONST((A08 - A11) , 0.5411961079f , 31); + B11 = MPC_SCALE_CONST((A09 - A10) , 1.3065630198f , 30); + B12 = A12 + A15; + B13 = A13 + A14; + B14 = MPC_SCALE_CONST((A12 - A15) , 0.5411961079f , 31); + B15 = MPC_SCALE_CONST((A13 - A14) , 1.3065630198f , 30); + + A00 = B00 + B01; + A01 = MPC_SCALE_CONST((B00 - B01) , 0.7071067691f , 31); + A02 = B02 + B03; + A03 = MPC_SCALE_CONST((B02 - B03) , 0.7071067691f , 31); + A04 = B04 + B05; + A05 = MPC_SCALE_CONST((B04 - B05) , 0.7071067691f , 31); + A06 = B06 + B07; + A07 = MPC_SCALE_CONST((B06 - B07) , 0.7071067691f , 31); + A08 = B08 + B09; + A09 = MPC_SCALE_CONST((B08 - B09) , 0.7071067691f , 31); + A10 = B10 + B11; + A11 = MPC_SCALE_CONST((B10 - B11) , 0.7071067691f , 31); + A12 = B12 + B13; + A13 = MPC_SCALE_CONST((B12 - B13) , 0.7071067691f , 31); + A14 = B14 + B15; + A15 = MPC_SCALE_CONST((B14 - B15) , 0.7071067691f , 31); + + V[48] = -A00; + V[ 0] = A01; + V[40] = -A02 - (V[ 8] = A03); + V[36] = -((V[ 4] = A05 + (V[12] = A07)) + A06); + V[44] = - A04 - A06 - A07; + V[ 6] = (V[10] = A11 + (V[14] = A15)) + A13; + V[38] = (V[34] = -(V[ 2] = A09 + A13 + A15) - A14) + A09 - A10 - A11; + V[46] = (tmp = -(A12 + A14 + A15)) - A08; + V[42] = tmp - A10 - A11; + + A00 = MPC_SCALE_CONST_SHR((Sample[ 0] - Sample[31]) , 0.5006030202f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A01 = MPC_SCALE_CONST_SHR((Sample[ 1] - Sample[30]) , 0.5054709315f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A02 = MPC_SCALE_CONST_SHR((Sample[ 2] - Sample[29]) , 0.5154473186f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A03 = MPC_SCALE_CONST_SHR((Sample[ 3] - Sample[28]) , 0.5310425758f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A04 = MPC_SCALE_CONST_SHR((Sample[ 4] - Sample[27]) , 0.5531039238f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A05 = MPC_SCALE_CONST_SHR((Sample[ 5] - Sample[26]) , 0.5829349756f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A06 = MPC_SCALE_CONST_SHR((Sample[ 6] - Sample[25]) , 0.6225041151f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A07 = MPC_SCALE_CONST_SHR((Sample[ 7] - Sample[24]) , 0.6748083234f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A08 = MPC_SCALE_CONST_SHR((Sample[ 8] - Sample[23]) , 0.7445362806f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A09 = MPC_SCALE_CONST_SHR((Sample[ 9] - Sample[22]) , 0.8393496275f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A10 = MPC_SCALE_CONST_SHR((Sample[10] - Sample[21]) , 0.9725682139f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A11 = MPC_SCALE_CONST_SHR((Sample[11] - Sample[20]) , 1.1694399118f , 30, MPC_FIXED_POINT_SYNTH_FIX); + A12 = MPC_SCALE_CONST_SHR((Sample[12] - Sample[19]) , 1.4841645956f , 30, MPC_FIXED_POINT_SYNTH_FIX); + A13 = MPC_SCALE_CONST_SHR((Sample[13] - Sample[18]) , 2.0577809811f , 29, MPC_FIXED_POINT_SYNTH_FIX); + A14 = MPC_SCALE_CONST_SHR((Sample[14] - Sample[17]) , 3.4076085091f , 29, MPC_FIXED_POINT_SYNTH_FIX); + A15 = MPC_SCALE_CONST_SHR((Sample[15] - Sample[16]) , 10.1900081635f, 27 ,MPC_FIXED_POINT_SYNTH_FIX); + + B00 = A00 + A15; + B01 = A01 + A14; + B02 = A02 + A13; + B03 = A03 + A12; + B04 = A04 + A11; + B05 = A05 + A10; + B06 = A06 + A09; + B07 = A07 + A08; + B08 = MPC_SCALE_CONST((A00 - A15) , 0.5024192929f , 31); + B09 = MPC_SCALE_CONST((A01 - A14) , 0.5224986076f , 31); + B10 = MPC_SCALE_CONST((A02 - A13) , 0.5669440627f , 31); + B11 = MPC_SCALE_CONST((A03 - A12) , 0.6468217969f , 31); + B12 = MPC_SCALE_CONST((A04 - A11) , 0.7881546021f , 31); + B13 = MPC_SCALE_CONST((A05 - A10) , 1.0606776476f , 30); + B14 = MPC_SCALE_CONST((A06 - A09) , 1.7224471569f , 30); + B15 = MPC_SCALE_CONST((A07 - A08) , 5.1011486053f , 28); + + A00 = B00 + B07; + A01 = B01 + B06; + A02 = B02 + B05; + A03 = B03 + B04; + A04 = MPC_SCALE_CONST((B00 - B07) , 0.5097956061f , 31); + A05 = MPC_SCALE_CONST((B01 - B06) , 0.6013448834f , 31); + A06 = MPC_SCALE_CONST((B02 - B05) , 0.8999761939f , 31); + A07 = MPC_SCALE_CONST((B03 - B04) , 2.5629155636f , 29); + A08 = B08 + B15; + A09 = B09 + B14; + A10 = B10 + B13; + A11 = B11 + B12; + A12 = MPC_SCALE_CONST((B08 - B15) , 0.5097956061f , 31); + A13 = MPC_SCALE_CONST((B09 - B14) , 0.6013448834f , 31); + A14 = MPC_SCALE_CONST((B10 - B13) , 0.8999761939f , 31); + A15 = MPC_SCALE_CONST((B11 - B12) , 2.5629155636f , 29); + + B00 = A00 + A03; + B01 = A01 + A02; + B02 = MPC_SCALE_CONST((A00 - A03) , 0.5411961079f , 31); + B03 = MPC_SCALE_CONST((A01 - A02) , 1.3065630198f , 30); + B04 = A04 + A07; + B05 = A05 + A06; + B06 = MPC_SCALE_CONST((A04 - A07) , 0.5411961079f , 31); + B07 = MPC_SCALE_CONST((A05 - A06) , 1.3065630198f , 30); + B08 = A08 + A11; + B09 = A09 + A10; + B10 = MPC_SCALE_CONST((A08 - A11) , 0.5411961079f , 31); + B11 = MPC_SCALE_CONST((A09 - A10) , 1.3065630198f , 30); + B12 = A12 + A15; + B13 = A13 + A14; + B14 = MPC_SCALE_CONST((A12 - A15) , 0.5411961079f , 31); + B15 = MPC_SCALE_CONST((A13 - A14) , 1.3065630198f , 30); + + A00 = MPC_SHL(B00 + B01, MPC_FIXED_POINT_SYNTH_FIX); + A01 = MPC_SCALE_CONST_SHL((B00 - B01) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A02 = MPC_SHL(B02 + B03, MPC_FIXED_POINT_SYNTH_FIX); + A03 = MPC_SCALE_CONST_SHL((B02 - B03) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A04 = MPC_SHL(B04 + B05, MPC_FIXED_POINT_SYNTH_FIX); + A05 = MPC_SCALE_CONST_SHL((B04 - B05) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A06 = MPC_SHL(B06 + B07, MPC_FIXED_POINT_SYNTH_FIX); + A07 = MPC_SCALE_CONST_SHL((B06 - B07) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A08 = MPC_SHL(B08 + B09, MPC_FIXED_POINT_SYNTH_FIX); + A09 = MPC_SCALE_CONST_SHL((B08 - B09) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A10 = MPC_SHL(B10 + B11, MPC_FIXED_POINT_SYNTH_FIX); + A11 = MPC_SCALE_CONST_SHL((B10 - B11) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A12 = MPC_SHL(B12 + B13, MPC_FIXED_POINT_SYNTH_FIX); + A13 = MPC_SCALE_CONST_SHL((B12 - B13) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A14 = MPC_SHL(B14 + B15, MPC_FIXED_POINT_SYNTH_FIX); + A15 = MPC_SCALE_CONST_SHL((B14 - B15) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX); + + // mehrfach verwendete Ausdrücke: A04+A06+A07, A09+A13+A15 + V[ 5] = (V[11] = (V[13] = A07 + (V[15] = A15)) + A11) + A05 + A13; + V[ 7] = (V[ 9] = A03 + A11 + A15) + A13; + V[33] = -(V[ 1] = A01 + A09 + A13 + A15) - A14; + V[35] = -(V[ 3] = A05 + A07 + A09 + A13 + A15) - A06 - A14; + V[37] = (tmp = -(A10 + A11 + A13 + A14 + A15)) - A05 - A06 - A07; + V[39] = tmp - A02 - A03; // abhängig vom Befehl drüber + V[41] = (tmp += A13 - A12) - A02 - A03; // abhängig vom Befehl 2 drüber + V[43] = tmp - A04 - A06 - A07; // abhängig von Befehlen 1 und 3 drüber + V[47] = (tmp = -(A08 + A12 + A14 + A15)) - A00; + V[45] = tmp - A04 - A06 - A07; // abhängig vom Befehl drüber + + V[32] = -V[ 0]; + V[31] = -V[ 1]; + V[30] = -V[ 2]; + V[29] = -V[ 3]; + V[28] = -V[ 4]; + V[27] = -V[ 5]; + V[26] = -V[ 6]; + V[25] = -V[ 7]; + V[24] = -V[ 8]; + V[23] = -V[ 9]; + V[22] = -V[10]; + V[21] = -V[11]; + V[20] = -V[12]; + V[19] = -V[13]; + V[18] = -V[14]; + V[17] = -V[15]; + + V[63] = V[33]; + V[62] = V[34]; + V[61] = V[35]; + V[60] = V[36]; + V[59] = V[37]; + V[58] = V[38]; + V[57] = V[39]; + V[56] = V[40]; + V[55] = V[41]; + V[54] = V[42]; + V[53] = V[43]; + V[52] = V[44]; + V[51] = V[45]; + V[50] = V[46]; + V[49] = V[47]; +} + +static void Synthese_Filter_float_internal(MPC_SAMPLE_FORMAT * OutData,MPC_SAMPLE_FORMAT * V,const MPC_SAMPLE_FORMAT * Y) +{ + unsigned n; + for ( n = 0; n < 36; n++, Y += 32 ) { + V -= 64; + Calculate_New_V ( Y, V ); + { + MPC_SAMPLE_FORMAT * Data = OutData; + const MPC_SAMPLE_FORMAT * D = (const MPC_SAMPLE_FORMAT *) &Di_opt; + int k; + //int tmp; + + + + for ( k = 0; k < 32; k++, D += 16, V++ ) { + *Data = ( + ( MPC_MULTIPLY_EX(V[ 0],D[ 0],Di_opt_shift) + MPC_MULTIPLY_EX(V[ 96],D[ 1],Di_opt_shift) + MPC_MULTIPLY_EX(V[128],D[ 2],Di_opt_shift) + MPC_MULTIPLY_EX(V[224],D[ 3],Di_opt_shift) + + MPC_MULTIPLY_EX(V[256],D[ 4],Di_opt_shift) + MPC_MULTIPLY_EX(V[352],D[ 5],Di_opt_shift) + MPC_MULTIPLY_EX(V[384],D[ 6],Di_opt_shift) + MPC_MULTIPLY_EX(V[480],D[ 7],Di_opt_shift) + + MPC_MULTIPLY_EX(V[512],D[ 8],Di_opt_shift) + MPC_MULTIPLY_EX(V[608],D[ 9],Di_opt_shift) + MPC_MULTIPLY_EX(V[640],D[10],Di_opt_shift) + MPC_MULTIPLY_EX(V[736],D[11],Di_opt_shift) + + MPC_MULTIPLY_EX(V[768],D[12],Di_opt_shift) + MPC_MULTIPLY_EX(V[864],D[13],Di_opt_shift) + MPC_MULTIPLY_EX(V[896],D[14],Di_opt_shift) + MPC_MULTIPLY_EX(V[992],D[15],Di_opt_shift) ) ); + + Data += 2; + } + V -= 32;//bleh + OutData+=64; + } + } +} + +void +MPC_decoder::Synthese_Filter_float ( MPC_SAMPLE_FORMAT* OutData ) +{ + /********* left channel ********/ + memmove ( V_L + V_MEM, V_L, 960 * sizeof(MPC_SAMPLE_FORMAT) ); + + Synthese_Filter_float_internal(OutData,reinterpret_cast<MPC_SAMPLE_FORMAT*>(V_L + V_MEM),reinterpret_cast<MPC_SAMPLE_FORMAT*>(Y_L [0])); + + /******** right channel ********/ + memmove ( V_R + V_MEM, V_R, 960 * sizeof(MPC_SAMPLE_FORMAT) ); + + Synthese_Filter_float_internal(OutData+1,reinterpret_cast<MPC_SAMPLE_FORMAT*>(V_R + V_MEM),reinterpret_cast<MPC_SAMPLE_FORMAT*>(Y_R [0])); + +} + + + +/*******************************************/ +/* */ +/* dithered synthesis */ +/* */ +/*******************************************/ + +static const unsigned char Parity [256] = { // parity + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0 +}; + +/* + * This is a simple random number generator with good quality for audio purposes. + * It consists of two polycounters with opposite rotation direction and different + * periods. The periods are coprime, so the total period is the product of both. + * + * ------------------------------------------------------------------------------------------------- + * +-> |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| + * | ------------------------------------------------------------------------------------------------- + * | | | | | | | + * | +--+--+--+-XOR-+--------+ + * | | + * +--------------------------------------------------------------------------------------+ + * + * ------------------------------------------------------------------------------------------------- + * |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| <-+ + * ------------------------------------------------------------------------------------------------- | + * | | | | | + * +--+----XOR----+--+ | + * | | + * +----------------------------------------------------------------------------------------+ + * + * + * The first has an period of 3*5*17*257*65537, the second of 7*47*73*178481, + * which gives a period of 18.410.713.077.675.721.215. The result is the + * XORed values of both generators. + */ + +unsigned int +MPC_decoder::random_int ( void ) +{ +#if 1 + unsigned int t1, t2, t3, t4; + + t3 = t1 = __r1; t4 = t2 = __r2; // Parity calculation is done via table lookup, this is also available + t1 &= 0xF5; t2 >>= 25; // on CPUs without parity, can be implemented in C and avoid unpredictable + t1 = Parity [t1]; t2 &= 0x63; // jumps and slow rotate through the carry flag operations. + t1 <<= 31; t2 = Parity [t2]; + + return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 ); +#else + return (__r1 = (__r1 >> 1) | ((unsigned int)Parity [__r1 & 0xF5] << 31) ) ^ + (__r2 = (__r2 << 1) | (unsigned int)Parity [(__r2 >> 25) & 0x63] ); +#endif +} |