From d738d35a7bd72a1589962bcffc5c3b8ae0edd161 Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Tue, 26 May 2020 01:44:58 -0500 Subject: [PATCH] Remove mpglib as it's not needed And slower than libmad --- cmake-proxies/lame/CMakeLists.txt | 14 - lib-src/mpglib/AUTHORS | 16 - lib-src/mpglib/Makefile.am | 55 - lib-src/mpglib/Makefile.in | 675 ---------- lib-src/mpglib/README | 26 - lib-src/mpglib/common.c | 364 ------ lib-src/mpglib/common.h | 43 - lib-src/mpglib/config.h | 130 -- lib-src/mpglib/dct64_i386.c | 348 ----- lib-src/mpglib/dct64_i386.h | 30 - lib-src/mpglib/decode_i386.c | 224 ---- lib-src/mpglib/decode_i386.h | 33 - lib-src/mpglib/depcomp | 791 ------------ lib-src/mpglib/huffman.h | 353 ------ lib-src/mpglib/interface.c | 718 ----------- lib-src/mpglib/interface.h | 56 - lib-src/mpglib/junk/machine.h | 189 --- lib-src/mpglib/junk/version.h | 68 - lib-src/mpglib/l2tables.h | 183 --- lib-src/mpglib/lame.h | 1342 -------------------- lib-src/mpglib/layer1.c | 232 ---- lib-src/mpglib/layer1.h | 29 - lib-src/mpglib/layer2.c | 403 ------ lib-src/mpglib/layer2.h | 39 - lib-src/mpglib/layer3.c | 1969 ----------------------------- lib-src/mpglib/layer3.h | 32 - lib-src/mpglib/mpg123.h | 152 --- lib-src/mpglib/mpglib.h | 96 -- lib-src/mpglib/tabinit.c | 152 --- lib-src/mpglib/tabinit.h | 32 - 30 files changed, 8794 deletions(-) delete mode 100644 lib-src/mpglib/AUTHORS delete mode 100644 lib-src/mpglib/Makefile.am delete mode 100644 lib-src/mpglib/Makefile.in delete mode 100644 lib-src/mpglib/README delete mode 100644 lib-src/mpglib/common.c delete mode 100644 lib-src/mpglib/common.h delete mode 100644 lib-src/mpglib/config.h delete mode 100644 lib-src/mpglib/dct64_i386.c delete mode 100644 lib-src/mpglib/dct64_i386.h delete mode 100644 lib-src/mpglib/decode_i386.c delete mode 100644 lib-src/mpglib/decode_i386.h delete mode 100644 lib-src/mpglib/depcomp delete mode 100644 lib-src/mpglib/huffman.h delete mode 100644 lib-src/mpglib/interface.c delete mode 100644 lib-src/mpglib/interface.h delete mode 100644 lib-src/mpglib/junk/machine.h delete mode 100644 lib-src/mpglib/junk/version.h delete mode 100644 lib-src/mpglib/l2tables.h delete mode 100644 lib-src/mpglib/lame.h delete mode 100644 lib-src/mpglib/layer1.c delete mode 100644 lib-src/mpglib/layer1.h delete mode 100644 lib-src/mpglib/layer2.c delete mode 100644 lib-src/mpglib/layer2.h delete mode 100644 lib-src/mpglib/layer3.c delete mode 100644 lib-src/mpglib/layer3.h delete mode 100644 lib-src/mpglib/mpg123.h delete mode 100644 lib-src/mpglib/mpglib.h delete mode 100644 lib-src/mpglib/tabinit.c delete mode 100644 lib-src/mpglib/tabinit.h diff --git a/cmake-proxies/lame/CMakeLists.txt b/cmake-proxies/lame/CMakeLists.txt index d1bdcdd4c..660525e40 100644 --- a/cmake-proxies/lame/CMakeLists.txt +++ b/cmake-proxies/lame/CMakeLists.txt @@ -12,7 +12,6 @@ list( APPEND SOURCES ${TARGET_ROOT}/../libmp3lame/gain_analysis.c ${TARGET_ROOT}/../libmp3lame/id3tag.c ${TARGET_ROOT}/../libmp3lame/lame.c - ${TARGET_ROOT}/../libmp3lame/mpglib_interface.c ${TARGET_ROOT}/../libmp3lame/newmdct.c ${TARGET_ROOT}/../libmp3lame/presets.c ${TARGET_ROOT}/../libmp3lame/psymodel.c @@ -27,23 +26,12 @@ list( APPEND SOURCES ${TARGET_ROOT}/../libmp3lame/VbrTag.c ${TARGET_ROOT}/../libmp3lame/version.c ${TARGET_ROOT}/../libmp3lame/vector/xmm_quantize_sub.c - - # mpglib - ${TARGET_ROOT}/../mpglib/common.c - ${TARGET_ROOT}/../mpglib/dct64_i386.c - ${TARGET_ROOT}/../mpglib/decode_i386.c - ${TARGET_ROOT}/../mpglib/interface.c - ${TARGET_ROOT}/../mpglib/layer1.c - ${TARGET_ROOT}/../mpglib/layer2.c - ${TARGET_ROOT}/../mpglib/layer3.c - ${TARGET_ROOT}/../mpglib/tabinit.c ) list( APPEND INCLUDES PRIVATE ${_PRVDIR} ${TARGET_ROOT}/../libmp3lame - ${TARGET_ROOT}/../mpglib PUBLIC ${_PUBDIR} ) @@ -83,8 +71,6 @@ elseif( SIZEOF_LONG_LONG EQUAL 8 ) set( A_INT64_T long long ) endif() -set( DECODE_ON_THE_FLY 1 ) -set( HAVE_MPGLIB 1 ) set( TAKEHIRO_IEEE754_HACK 1 ) set( USE_FAST_LOG 1 ) if( ${CMakeDetermineASM_NASMCompiler} ) diff --git a/lib-src/mpglib/AUTHORS b/lib-src/mpglib/AUTHORS deleted file mode 100644 index 0a6a10b07..000000000 --- a/lib-src/mpglib/AUTHORS +++ /dev/null @@ -1,16 +0,0 @@ -Michael Hipp Author of orignal mpglib version 0.2a. - -Albert L. Faber -Aleksander Korzynski -Alexander Leidinger -Frank Klemm -Gabriel Bouvigne -Leigh Smith -Mark Taylor -Myers Carpenter -Naoki Shibata -Robert Hegemann -Sigbjorn Skjaeret -Stefan Bellon -Steve Lhomme -Takehiro TOMINAGA diff --git a/lib-src/mpglib/Makefile.am b/lib-src/mpglib/Makefile.am deleted file mode 100644 index b521f2086..000000000 --- a/lib-src/mpglib/Makefile.am +++ /dev/null @@ -1,55 +0,0 @@ -## $Id: Makefile.am,v 1.18 2010/10/30 13:21:02 robert Exp $ - -include $(top_srcdir)/Makefile.am.global - -INCLUDES = @INCLUDES@ -I$(top_srcdir)/libmp3lame -I$(top_builddir) - -EXTRA_DIST = \ - AUTHORS \ - README - -DEFS = @DEFS@ @CONFIG_DEFS@ - -noinst_LTLIBRARIES = libmpgdecoder.la - -libmpgdecoder_la_SOURCES = common.c \ - dct64_i386.c \ - decode_i386.c \ - interface.c \ - layer1.c \ - layer2.c \ - layer3.c \ - tabinit.c - -noinst_HEADERS = common.h \ - dct64_i386.h \ - decode_i386.h \ - huffman.h \ - interface.h \ - l2tables.h \ - layer1.h \ - layer2.h \ - layer3.h \ - mpg123.h \ - mpglib.h \ - tabinit.h - -LCLINTFLAGS= \ - +posixlib \ - +showsummary \ - +showalluses \ - +whichlib \ - +forcehints \ - -fixedformalarray \ - +matchanyintegral \ - -Dlint - -lclint.txt: ${libmpgdecoder_la_SOURCES} ${noinst_HEADERS} - @lclint ${LCLINTFLAGS} ${INCLUDES} ${DEFS} ${libmpgdecoder_la_SOURCES} 2>&1 >lclint.txt || true - -lclint: lclint.txt - more lclint.txt - -#$(OBJECTS): libtool -#libtool: $(LIBTOOL_DEPS) -# $(SHELL) $(top_builddir)/config.status --recheck diff --git a/lib-src/mpglib/Makefile.in b/lib-src/mpglib/Makefile.in deleted file mode 100644 index edc519fe1..000000000 --- a/lib-src/mpglib/Makefile.in +++ /dev/null @@ -1,675 +0,0 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2017 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@ - -# global section for every Makefile.am - - -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -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@ -subdir = mpglib -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) -DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ - $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libmpgdecoder_la_LIBADD = -am_libmpgdecoder_la_OBJECTS = common.lo dct64_i386.lo decode_i386.lo \ - interface.lo layer1.lo layer2.lo layer3.lo tabinit.lo -libmpgdecoder_la_OBJECTS = $(am_libmpgdecoder_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(libmpgdecoder_la_SOURCES) -DIST_SOURCES = $(libmpgdecoder_la_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -HEADERS = $(noinst_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -am__DIST_COMMON = $(srcdir)/Makefile.in \ - $(top_srcdir)/Makefile.am.global $(top_srcdir)/depcomp AUTHORS \ - README depcomp -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CONFIG_DEFS = @CONFIG_DEFS@ -CONFIG_MATH_LIB = @CONFIG_MATH_LIB@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CPUCCODE = @CPUCCODE@ -CPUTYPE = @CPUTYPE@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ @CONFIG_DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -FRONTEND_CFLAGS = @FRONTEND_CFLAGS@ -FRONTEND_LDADD = @FRONTEND_LDADD@ -FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@ -GREP = @GREP@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_CONFIG = @GTK_CONFIG@ -GTK_LIBS = @GTK_LIBS@ -INCLUDES = @INCLUDES@ -I$(top_srcdir)/libmp3lame -I$(top_builddir) -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ -LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@ -LIB_MINOR_VERSION = @LIB_MINOR_VERSION@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEDEP = @MAKEDEP@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NASM = @NASM@ -NASM_FORMAT = @NASM_FORMAT@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -RANLIB = @RANLIB@ -RM_F = @RM_F@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SNDFILE_CFLAGS = @SNDFILE_CFLAGS@ -SNDFILE_LIBS = @SNDFILE_LIBS@ -STRIP = @STRIP@ -VERSION = @VERSION@ -WITH_FRONTEND = @WITH_FRONTEND@ -WITH_MP3RTP = @WITH_MP3RTP@ -WITH_MP3X = @WITH_MP3X@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -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@ -builddir = @builddir@ -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@ -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@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = 1.15 foreign -EXTRA_DIST = \ - AUTHORS \ - README - -noinst_LTLIBRARIES = libmpgdecoder.la -libmpgdecoder_la_SOURCES = common.c \ - dct64_i386.c \ - decode_i386.c \ - interface.c \ - layer1.c \ - layer2.c \ - layer3.c \ - tabinit.c - -noinst_HEADERS = common.h \ - dct64_i386.h \ - decode_i386.h \ - huffman.h \ - interface.h \ - l2tables.h \ - layer1.h \ - layer2.h \ - layer3.h \ - mpg123.h \ - mpglib.h \ - tabinit.h - -LCLINTFLAGS = \ - +posixlib \ - +showsummary \ - +showalluses \ - +whichlib \ - +forcehints \ - -fixedformalarray \ - +matchanyintegral \ - -Dlint - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mpglib/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign mpglib/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_srcdir)/Makefile.am.global $(am__empty): - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -libmpgdecoder.la: $(libmpgdecoder_la_OBJECTS) $(libmpgdecoder_la_DEPENDENCIES) $(EXTRA_libmpgdecoder_la_DEPENDENCIES) - $(AM_V_CCLD)$(LINK) $(libmpgdecoder_la_OBJECTS) $(libmpgdecoder_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dct64_i386.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decode_i386.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interface.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layer1.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layer2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layer3.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tabinit.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -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)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$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) $(HEADERS) -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: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 - -clean-am: 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-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -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: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ - ctags-am 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-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am 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 tags-am uninstall uninstall-am - -.PRECIOUS: Makefile - - -# end global section - -lclint.txt: ${libmpgdecoder_la_SOURCES} ${noinst_HEADERS} - @lclint ${LCLINTFLAGS} ${INCLUDES} ${DEFS} ${libmpgdecoder_la_SOURCES} 2>&1 >lclint.txt || true - -lclint: lclint.txt - more lclint.txt - -#$(OBJECTS): libtool -#libtool: $(LIBTOOL_DEPS) -# $(SHELL) $(top_builddir)/config.status --recheck - -# 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: diff --git a/lib-src/mpglib/README b/lib-src/mpglib/README deleted file mode 100644 index 7155d004c..000000000 --- a/lib-src/mpglib/README +++ /dev/null @@ -1,26 +0,0 @@ -hip - Hip Isn't a Player -A LGPLed mpeg audio decoding library. - -Based off of Michael Hipp's mpglib 0.2a , with many -improvements by the lame development team (see AUTHORS). - -The interface to the library is based off of vorbisfile. If you add mp3 -support to your app using this library it should be a snap to add Ogg Vorbis -support as well. - -This isn't as fast as mpg123 will be for decoding as none of it is in -assmbler. - -Seeking currently isn't implemented. - - -From mpglib's orginal README: -============================= - -PLEASE NOTE: This software may contain patented algorithms (at least - patented in some countries). It may be not allowed to sell/use products - based on this source code in these countries. Check this out first! - -COPYRIGHT of MP3 music: - Please note, that the duplicating of copyrighted music without explicit - permission violates the rights of the owner. diff --git a/lib-src/mpglib/common.c b/lib-src/mpglib/common.c deleted file mode 100644 index b6ba14454..000000000 --- a/lib-src/mpglib/common.c +++ /dev/null @@ -1,364 +0,0 @@ -/* - * common.c: some common bitstream operations - * - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* $Id: common.c,v 1.42 2017/08/19 14:20:27 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include - -#ifdef HAVE_FCNTL_H -#include -#endif - -#ifdef macintosh -#include -#include -#else -#include -#include -#endif - -#include - -#include "common.h" - -#ifdef WITH_DMALLOC -#include -#endif - -/* In C++ the array first must be prototyped, why ? */ - - - /* *INDENT-OFF* */ -const int tabsel_123 [2] [3] [16] = { - { {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,}, - {0,32,48,56, 64, 80, 96,112,128,160,192,224,256,320,384,}, - {0,32,40,48, 56, 64, 80, 96,112,128,160,192,224,256,320,} }, - - { {0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,}, - {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,}, - {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,} } -}; - -const long freqs[9] = { 44100, 48000, 32000, - 22050, 24000, 16000, - 11025, 12000, 8000 }; - - /* *INDENT-ON* */ - - -real muls[27][64]; - -#if 0 -static void -get_II_stuff(struct frame *fr) -{ - /* *INDENT-OFF* */ - static const int translate [3] [2] [16] = /* char ? */ - { { { 0,2,2,2,2,2,2,0,0,0,1,1,1,1,1,0 } , - { 0,2,2,0,0,0,1,1,1,1,1,1,1,1,1,0 } } , - { { 0,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0 } , - { 0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0 } } , - { { 0,3,3,3,3,3,3,0,0,0,1,1,1,1,1,0 } , - { 0,3,3,0,0,0,1,1,1,1,1,1,1,1,1,0 } } }; - /* *INDENT-ON* */ - - int table, sblim; - static const struct al_table2 *tables[5] = { alloc_0, alloc_1, alloc_2, alloc_3, alloc_4 }; - static int sblims[5] = { 27, 30, 8, 12, 30 }; - - if (fr->lsf) - table = 4; - else - table = translate[fr->sampling_frequency][2 - fr->stereo][fr->bitrate_index]; - sblim = sblims[table]; - - fr->alloc = tables[table]; - fr->II_sblimit = sblim; -} -#endif - -#define HDRCMPMASK 0xfffffd00 - -#define MAX_INPUT_FRAMESIZE 4096 - -int -head_check(unsigned long head, int check_layer) -{ - /* - look for a valid header. - if check_layer > 0, then require that - nLayer = check_layer. - */ - - /* bits 13-14 = layer 3 */ - int nLayer = 4 - ((head >> 17) & 3); - - if ((head & 0xffe00000) != 0xffe00000) { - /* syncword */ - return FALSE; - } - - if (nLayer == 4) - return FALSE; - - if (check_layer > 0 && nLayer != check_layer) - return FALSE; - - if (((head >> 12) & 0xf) == 0xf) { - /* bits 16,17,18,19 = 1111 invalid bitrate */ - return FALSE; - } - if (((head >> 10) & 0x3) == 0x3) { - /* bits 20,21 = 11 invalid sampling freq */ - return FALSE; - } - if ((head & 0x3) == 0x2) - /* invalid emphasis */ - return FALSE; - return TRUE; -} - - -#if 0 -static void -print_header(PMPSTR mp, struct frame *fr) -{ - static const char *modes[4] = { "Stereo", "Joint-Stereo", "Dual-Channel", "Single-Channel" }; - static const char *layers[4] = { "Unknown", "I", "II", "III" }; - - lame_report_fnc(mp->report_msg, "MPEG %s, Layer: %s, Freq: %ld, mode: %s, modext: %d, BPF : %d\n", - fr->mpeg25 ? "2.5" : (fr->lsf ? "2.0" : "1.0"), - layers[fr->lay], freqs[fr->sampling_frequency], - modes[fr->mode], fr->mode_ext, fr->framesize + 4); - lame_report_fnc(mp->report_msg, "Channels: %d, copyright: %s, original: %s, CRC: %s, emphasis: %d.\n", - fr->stereo, fr->copyright ? "Yes" : "No", - fr->original ? "Yes" : "No", fr->error_protection ? "Yes" : "No", fr->emphasis); - lame_report_fnc(mp->report_msg, "Bitrate: %d Kbits/s, Extension value: %d\n", - tabsel_123[fr->lsf][fr->lay - 1][fr->bitrate_index], fr->extension); -} - -static void -print_header_compact(PMPSTR mp, struct frame *fr) -{ - static const char *modes[4] = { "stereo", "joint-stereo", "dual-channel", "mono" }; - static const char *layers[4] = { "Unknown", "I", "II", "III" }; - - lame_report_fnc(mp->report_err, "MPEG %s layer %s, %d kbit/s, %ld Hz %s\n", - fr->mpeg25 ? "2.5" : (fr->lsf ? "2.0" : "1.0"), - layers[fr->lay], - tabsel_123[fr->lsf][fr->lay - 1][fr->bitrate_index], - freqs[fr->sampling_frequency], modes[fr->mode]); -} - -#endif - -/* - * decode a header and write the information - * into the frame structure - */ -int -decode_header(PMPSTR mp, struct frame *fr, unsigned long newhead) -{ - - - if (newhead & (1 << 20)) { - fr->lsf = (newhead & (1 << 19)) ? 0x0 : 0x1; - fr->mpeg25 = 0; - } - else { - fr->lsf = 1; - fr->mpeg25 = 1; - } - - - fr->lay = 4 - ((newhead >> 17) & 3); - - if (fr->lay != 3 && fr->mpeg25) { - lame_report_fnc(mp->report_err, "MPEG-2.5 is supported by Layer3 only\n"); - return 0; - } - if (((newhead >> 10) & 0x3) == 0x3) { - lame_report_fnc(mp->report_err, "Stream error\n"); - return 0; - } - if (fr->mpeg25) { - fr->sampling_frequency = 6 + ((newhead >> 10) & 0x3); - } - else - fr->sampling_frequency = ((newhead >> 10) & 0x3) + (fr->lsf * 3); - - fr->error_protection = ((newhead >> 16) & 0x1) ^ 0x1; - - if (fr->mpeg25) /* allow Bitrate change for 2.5 ... */ - fr->bitrate_index = ((newhead >> 12) & 0xf); - - fr->bitrate_index = ((newhead >> 12) & 0xf); - fr->padding = ((newhead >> 9) & 0x1); - fr->extension = ((newhead >> 8) & 0x1); - fr->mode = ((newhead >> 6) & 0x3); - fr->mode_ext = ((newhead >> 4) & 0x3); - fr->copyright = ((newhead >> 3) & 0x1); - fr->original = ((newhead >> 2) & 0x1); - fr->emphasis = newhead & 0x3; - - fr->stereo = (fr->mode == MPG_MD_MONO) ? 1 : 2; - - switch (fr->lay) { - case 1: - fr->framesize = (long) tabsel_123[fr->lsf][0][fr->bitrate_index] * 12000; - fr->framesize /= freqs[fr->sampling_frequency]; - fr->framesize = ((fr->framesize + fr->padding) << 2) - 4; - fr->down_sample = 0; - fr->down_sample_sblimit = SBLIMIT >> (fr->down_sample); - break; - - case 2: - fr->framesize = (long) tabsel_123[fr->lsf][1][fr->bitrate_index] * 144000; - fr->framesize /= freqs[fr->sampling_frequency]; - fr->framesize += fr->padding - 4; - fr->down_sample = 0; - fr->down_sample_sblimit = SBLIMIT >> (fr->down_sample); - break; - - case 3: -#if 0 - fr->do_layer = do_layer3; - if (fr->lsf) - ssize = (fr->stereo == 1) ? 9 : 17; - else - ssize = (fr->stereo == 1) ? 17 : 32; -#endif - -#if 0 - if (fr->error_protection) - ssize += 2; -#endif - if (fr->framesize > MAX_INPUT_FRAMESIZE) { - lame_report_fnc(mp->report_err, "Frame size too big.\n"); - fr->framesize = MAX_INPUT_FRAMESIZE; - return (0); - } - - - if (fr->bitrate_index == 0) - fr->framesize = 0; - else { - fr->framesize = (long) tabsel_123[fr->lsf][2][fr->bitrate_index] * 144000; - fr->framesize /= freqs[fr->sampling_frequency] << (fr->lsf); - fr->framesize = fr->framesize + fr->padding - 4; - } - break; - default: - lame_report_fnc(mp->report_err, "Sorry, layer %d not supported\n", fr->lay); - return (0); - } - /* print_header(mp, fr); */ - - return 1; -} - - -unsigned int -getbits(PMPSTR mp, int number_of_bits) -{ - unsigned long rval; - - if (number_of_bits <= 0 || !mp->wordpointer) - return 0; - - { - rval = mp->wordpointer[0]; - rval <<= 8; - rval |= mp->wordpointer[1]; - rval <<= 8; - rval |= mp->wordpointer[2]; - rval <<= mp->bitindex; - rval &= 0xffffff; - - mp->bitindex += number_of_bits; - - rval >>= (24 - number_of_bits); - - mp->wordpointer += (mp->bitindex >> 3); - mp->bitindex &= 7; - } - return rval; -} - -unsigned int -getbits_fast(PMPSTR mp, int number_of_bits) -{ - unsigned long rval; - - { - rval = mp->wordpointer[0]; - rval <<= 8; - rval |= mp->wordpointer[1]; - rval <<= mp->bitindex; - rval &= 0xffff; - mp->bitindex += number_of_bits; - - rval >>= (16 - number_of_bits); - - mp->wordpointer += (mp->bitindex >> 3); - mp->bitindex &= 7; - } - return rval; -} - -unsigned char -get_leq_8_bits(PMPSTR mp, unsigned int number_of_bits) -{ - assert(number_of_bits <= 8); - return (unsigned char) getbits_fast(mp, number_of_bits); -} - -unsigned short -get_leq_16_bits(PMPSTR mp, unsigned int number_of_bits) -{ - assert(number_of_bits <= 16); - return (unsigned short) getbits_fast(mp, number_of_bits); -} - -int -set_pointer(PMPSTR mp, long backstep) -{ - unsigned char *bsbufold; - - if (mp->fsizeold < 0 && backstep > 0) { - lame_report_fnc(mp->report_err, "hip: Can't step back %ld bytes!\n", backstep); - return MP3_ERR; - } - bsbufold = mp->bsspace[1 - mp->bsnum] + 512; - mp->wordpointer -= backstep; - if (backstep) - memcpy(mp->wordpointer, bsbufold + mp->fsizeold - backstep, (size_t) backstep); - mp->bitindex = 0; - return MP3_OK; -} diff --git a/lib-src/mpglib/common.h b/lib-src/mpglib/common.h deleted file mode 100644 index 62cf17e53..000000000 --- a/lib-src/mpglib/common.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef COMMON_H_INCLUDED -#define COMMON_H_INCLUDED - -#include "mpg123.h" -#include "mpglib.h" - -extern const int tabsel_123[2][3][16]; -extern const long freqs[9]; - -extern real muls[27][64]; - - -int head_check(unsigned long head, int check_layer); -int decode_header(PMPSTR mp, struct frame *fr, unsigned long newhead); -unsigned int getbits(PMPSTR mp, int number_of_bits); -unsigned int getbits_fast(PMPSTR mp, int number_of_bits); -unsigned char get_leq_8_bits(PMPSTR mp, unsigned int number_of_bits); -unsigned short get_leq_16_bits(PMPSTR mp, unsigned int number_of_bits); -int set_pointer(PMPSTR mp, long backstep); - -#endif diff --git a/lib-src/mpglib/config.h b/lib-src/mpglib/config.h deleted file mode 100644 index 77f3bf0ca..000000000 --- a/lib-src/mpglib/config.h +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef CONFIGMS_H_INCLUDED -#define CONFIGMS_H_INCLUDED - -/*#if defined(_MSC_VER)*/ -#if 0 -/* The number of bytes in a double. */ -#define SIZEOF_DOUBLE 8 - -/* The number of bytes in a float. */ -#define SIZEOF_FLOAT 4 - -/* The number of bytes in a int. */ -#define SIZEOF_INT 4 - -/* The number of bytes in a long. */ -#define SIZEOF_LONG 4 - -/* The number of bytes in a long double. */ -#define SIZEOF_LONG_DOUBLE 12 - -/* The number of bytes in a short. */ -#define SIZEOF_SHORT 2 - -/* The number of bytes in a unsigned int. */ -#define SIZEOF_UNSIGNED_INT 4 - -/* The number of bytes in a unsigned long. */ -#define SIZEOF_UNSIGNED_LONG 4 - -/* The number of bytes in a unsigned short. */ -#define SIZEOF_UNSIGNED_SHORT 2 -#endif - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS - -/* Define if you have the header file. */ -#define HAVE_ERRNO_H - -/* Define if you have the header file. */ -#define HAVE_FCNTL_H - -/* Define if you have the header file. */ -#define HAVE_LIMITS_H - -/* Name of package */ -#define PACKAGE "lame" - -/* Define if compiler has function prototypes */ -#define PROTOTYPES 1 - -/* faster log implementation with less but enough precission */ -#define USE_FAST_LOG 1 - -#define HAVE_STRCHR -#define HAVE_MEMCPY - -#if defined(_MSC_VER) || defined(__BORLANDC__) -#pragma warning( disable : 4305 ) - typedef __int8 int8_t; - typedef __int16 int16_t; - typedef __int32 int32_t; - typedef __int64 int64_t; - - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; - typedef unsigned __int64 uint64_t; - - typedef float float32_t; - typedef double float64_t; -#elif defined(STDC_HEADERS) - -#include -typedef u_int8_t uint8_t; -typedef u_int16_t uint16_t; -typedef u_int32_t uint32_t; - -#elif defined (__GNUC__) -#define __int8_t_defined -#define uint8_t unsigned char -#define uint16_t unsigned short -#define uint32_t unsigned int -#define uint64_t unsigned long long - -#define int8_t signed char -#define int16_t signed short -#define int32_t signed int -#define int64_t signed long long -#endif - -typedef long double ieee854_float80_t; -typedef double ieee754_float64_t; -typedef float ieee754_float32_t; - -#ifdef HAVE_MPGLIB -# define DECODE_ON_THE_FLY 1 -#endif - -#ifdef LAME_ACM -/* memory hacking for driver purposes */ -#define calloc(x,y) acm_Calloc(x,y) -#define free(x) acm_Free(x) -#define malloc(x) acm_Malloc(x) - -#include -void *acm_Calloc( size_t num, size_t size ); -void *acm_Malloc( size_t size ); -void acm_Free( void * mem); -#endif /* LAME_ACM */ - -#define LAME_LIBRARY_BUILD - - -#ifdef HAVE_NASM - #if (defined(__ICL) && (__ICL >= 450)) - #define HAVE_XMMINTRIN_H - #elif defined(_MSC_VER) - #include - #ifdef _mm_malloc - #define HAVE_XMMINTRIN_H - #endif - #endif -#endif - -#if defined(_M_X64) && !defined(HAVE_XMMINTRIN_H) - #define HAVE_XMMINTRIN_H -#endif - -#endif diff --git a/lib-src/mpglib/dct64_i386.c b/lib-src/mpglib/dct64_i386.c deleted file mode 100644 index 0bf1509ed..000000000 --- a/lib-src/mpglib/dct64_i386.c +++ /dev/null @@ -1,348 +0,0 @@ -/* - * dct64_i368.c - * - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * - * Discrete Cosine Tansform (DCT) for subband synthesis - * optimized for machines with no auto-increment. - * The performance is highly compiler dependend. Maybe - * the dct64.c version for 'normal' processor may be faster - * even for Intel processors. - */ - -/* $Id: dct64_i386.c,v 1.14 2010/03/22 14:30:19 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "dct64_i386.h" -#include "tabinit.h" - -#ifdef WITH_DMALLOC -#include -#endif - -static void -dct64_1(real * out0, real * out1, real * b1, real * b2, real * samples) -{ - - { - real *costab = pnts[0]; - - b1[0x00] = samples[0x00] + samples[0x1F]; - b1[0x1F] = (samples[0x00] - samples[0x1F]) * costab[0x0]; - - b1[0x01] = samples[0x01] + samples[0x1E]; - b1[0x1E] = (samples[0x01] - samples[0x1E]) * costab[0x1]; - - b1[0x02] = samples[0x02] + samples[0x1D]; - b1[0x1D] = (samples[0x02] - samples[0x1D]) * costab[0x2]; - - b1[0x03] = samples[0x03] + samples[0x1C]; - b1[0x1C] = (samples[0x03] - samples[0x1C]) * costab[0x3]; - - b1[0x04] = samples[0x04] + samples[0x1B]; - b1[0x1B] = (samples[0x04] - samples[0x1B]) * costab[0x4]; - - b1[0x05] = samples[0x05] + samples[0x1A]; - b1[0x1A] = (samples[0x05] - samples[0x1A]) * costab[0x5]; - - b1[0x06] = samples[0x06] + samples[0x19]; - b1[0x19] = (samples[0x06] - samples[0x19]) * costab[0x6]; - - b1[0x07] = samples[0x07] + samples[0x18]; - b1[0x18] = (samples[0x07] - samples[0x18]) * costab[0x7]; - - b1[0x08] = samples[0x08] + samples[0x17]; - b1[0x17] = (samples[0x08] - samples[0x17]) * costab[0x8]; - - b1[0x09] = samples[0x09] + samples[0x16]; - b1[0x16] = (samples[0x09] - samples[0x16]) * costab[0x9]; - - b1[0x0A] = samples[0x0A] + samples[0x15]; - b1[0x15] = (samples[0x0A] - samples[0x15]) * costab[0xA]; - - b1[0x0B] = samples[0x0B] + samples[0x14]; - b1[0x14] = (samples[0x0B] - samples[0x14]) * costab[0xB]; - - b1[0x0C] = samples[0x0C] + samples[0x13]; - b1[0x13] = (samples[0x0C] - samples[0x13]) * costab[0xC]; - - b1[0x0D] = samples[0x0D] + samples[0x12]; - b1[0x12] = (samples[0x0D] - samples[0x12]) * costab[0xD]; - - b1[0x0E] = samples[0x0E] + samples[0x11]; - b1[0x11] = (samples[0x0E] - samples[0x11]) * costab[0xE]; - - b1[0x0F] = samples[0x0F] + samples[0x10]; - b1[0x10] = (samples[0x0F] - samples[0x10]) * costab[0xF]; - } - - - { - real *costab = pnts[1]; - - b2[0x00] = b1[0x00] + b1[0x0F]; - b2[0x0F] = (b1[0x00] - b1[0x0F]) * costab[0]; - b2[0x01] = b1[0x01] + b1[0x0E]; - b2[0x0E] = (b1[0x01] - b1[0x0E]) * costab[1]; - b2[0x02] = b1[0x02] + b1[0x0D]; - b2[0x0D] = (b1[0x02] - b1[0x0D]) * costab[2]; - b2[0x03] = b1[0x03] + b1[0x0C]; - b2[0x0C] = (b1[0x03] - b1[0x0C]) * costab[3]; - b2[0x04] = b1[0x04] + b1[0x0B]; - b2[0x0B] = (b1[0x04] - b1[0x0B]) * costab[4]; - b2[0x05] = b1[0x05] + b1[0x0A]; - b2[0x0A] = (b1[0x05] - b1[0x0A]) * costab[5]; - b2[0x06] = b1[0x06] + b1[0x09]; - b2[0x09] = (b1[0x06] - b1[0x09]) * costab[6]; - b2[0x07] = b1[0x07] + b1[0x08]; - b2[0x08] = (b1[0x07] - b1[0x08]) * costab[7]; - - b2[0x10] = b1[0x10] + b1[0x1F]; - b2[0x1F] = (b1[0x1F] - b1[0x10]) * costab[0]; - b2[0x11] = b1[0x11] + b1[0x1E]; - b2[0x1E] = (b1[0x1E] - b1[0x11]) * costab[1]; - b2[0x12] = b1[0x12] + b1[0x1D]; - b2[0x1D] = (b1[0x1D] - b1[0x12]) * costab[2]; - b2[0x13] = b1[0x13] + b1[0x1C]; - b2[0x1C] = (b1[0x1C] - b1[0x13]) * costab[3]; - b2[0x14] = b1[0x14] + b1[0x1B]; - b2[0x1B] = (b1[0x1B] - b1[0x14]) * costab[4]; - b2[0x15] = b1[0x15] + b1[0x1A]; - b2[0x1A] = (b1[0x1A] - b1[0x15]) * costab[5]; - b2[0x16] = b1[0x16] + b1[0x19]; - b2[0x19] = (b1[0x19] - b1[0x16]) * costab[6]; - b2[0x17] = b1[0x17] + b1[0x18]; - b2[0x18] = (b1[0x18] - b1[0x17]) * costab[7]; - } - - { - real *costab = pnts[2]; - - b1[0x00] = b2[0x00] + b2[0x07]; - b1[0x07] = (b2[0x00] - b2[0x07]) * costab[0]; - b1[0x01] = b2[0x01] + b2[0x06]; - b1[0x06] = (b2[0x01] - b2[0x06]) * costab[1]; - b1[0x02] = b2[0x02] + b2[0x05]; - b1[0x05] = (b2[0x02] - b2[0x05]) * costab[2]; - b1[0x03] = b2[0x03] + b2[0x04]; - b1[0x04] = (b2[0x03] - b2[0x04]) * costab[3]; - - b1[0x08] = b2[0x08] + b2[0x0F]; - b1[0x0F] = (b2[0x0F] - b2[0x08]) * costab[0]; - b1[0x09] = b2[0x09] + b2[0x0E]; - b1[0x0E] = (b2[0x0E] - b2[0x09]) * costab[1]; - b1[0x0A] = b2[0x0A] + b2[0x0D]; - b1[0x0D] = (b2[0x0D] - b2[0x0A]) * costab[2]; - b1[0x0B] = b2[0x0B] + b2[0x0C]; - b1[0x0C] = (b2[0x0C] - b2[0x0B]) * costab[3]; - - b1[0x10] = b2[0x10] + b2[0x17]; - b1[0x17] = (b2[0x10] - b2[0x17]) * costab[0]; - b1[0x11] = b2[0x11] + b2[0x16]; - b1[0x16] = (b2[0x11] - b2[0x16]) * costab[1]; - b1[0x12] = b2[0x12] + b2[0x15]; - b1[0x15] = (b2[0x12] - b2[0x15]) * costab[2]; - b1[0x13] = b2[0x13] + b2[0x14]; - b1[0x14] = (b2[0x13] - b2[0x14]) * costab[3]; - - b1[0x18] = b2[0x18] + b2[0x1F]; - b1[0x1F] = (b2[0x1F] - b2[0x18]) * costab[0]; - b1[0x19] = b2[0x19] + b2[0x1E]; - b1[0x1E] = (b2[0x1E] - b2[0x19]) * costab[1]; - b1[0x1A] = b2[0x1A] + b2[0x1D]; - b1[0x1D] = (b2[0x1D] - b2[0x1A]) * costab[2]; - b1[0x1B] = b2[0x1B] + b2[0x1C]; - b1[0x1C] = (b2[0x1C] - b2[0x1B]) * costab[3]; - } - - { - real const cos0 = pnts[3][0]; - real const cos1 = pnts[3][1]; - - b2[0x00] = b1[0x00] + b1[0x03]; - b2[0x03] = (b1[0x00] - b1[0x03]) * cos0; - b2[0x01] = b1[0x01] + b1[0x02]; - b2[0x02] = (b1[0x01] - b1[0x02]) * cos1; - - b2[0x04] = b1[0x04] + b1[0x07]; - b2[0x07] = (b1[0x07] - b1[0x04]) * cos0; - b2[0x05] = b1[0x05] + b1[0x06]; - b2[0x06] = (b1[0x06] - b1[0x05]) * cos1; - - b2[0x08] = b1[0x08] + b1[0x0B]; - b2[0x0B] = (b1[0x08] - b1[0x0B]) * cos0; - b2[0x09] = b1[0x09] + b1[0x0A]; - b2[0x0A] = (b1[0x09] - b1[0x0A]) * cos1; - - b2[0x0C] = b1[0x0C] + b1[0x0F]; - b2[0x0F] = (b1[0x0F] - b1[0x0C]) * cos0; - b2[0x0D] = b1[0x0D] + b1[0x0E]; - b2[0x0E] = (b1[0x0E] - b1[0x0D]) * cos1; - - b2[0x10] = b1[0x10] + b1[0x13]; - b2[0x13] = (b1[0x10] - b1[0x13]) * cos0; - b2[0x11] = b1[0x11] + b1[0x12]; - b2[0x12] = (b1[0x11] - b1[0x12]) * cos1; - - b2[0x14] = b1[0x14] + b1[0x17]; - b2[0x17] = (b1[0x17] - b1[0x14]) * cos0; - b2[0x15] = b1[0x15] + b1[0x16]; - b2[0x16] = (b1[0x16] - b1[0x15]) * cos1; - - b2[0x18] = b1[0x18] + b1[0x1B]; - b2[0x1B] = (b1[0x18] - b1[0x1B]) * cos0; - b2[0x19] = b1[0x19] + b1[0x1A]; - b2[0x1A] = (b1[0x19] - b1[0x1A]) * cos1; - - b2[0x1C] = b1[0x1C] + b1[0x1F]; - b2[0x1F] = (b1[0x1F] - b1[0x1C]) * cos0; - b2[0x1D] = b1[0x1D] + b1[0x1E]; - b2[0x1E] = (b1[0x1E] - b1[0x1D]) * cos1; - } - - { - real const cos0 = pnts[4][0]; - - b1[0x00] = b2[0x00] + b2[0x01]; - b1[0x01] = (b2[0x00] - b2[0x01]) * cos0; - b1[0x02] = b2[0x02] + b2[0x03]; - b1[0x03] = (b2[0x03] - b2[0x02]) * cos0; - b1[0x02] += b1[0x03]; - - b1[0x04] = b2[0x04] + b2[0x05]; - b1[0x05] = (b2[0x04] - b2[0x05]) * cos0; - b1[0x06] = b2[0x06] + b2[0x07]; - b1[0x07] = (b2[0x07] - b2[0x06]) * cos0; - b1[0x06] += b1[0x07]; - b1[0x04] += b1[0x06]; - b1[0x06] += b1[0x05]; - b1[0x05] += b1[0x07]; - - b1[0x08] = b2[0x08] + b2[0x09]; - b1[0x09] = (b2[0x08] - b2[0x09]) * cos0; - b1[0x0A] = b2[0x0A] + b2[0x0B]; - b1[0x0B] = (b2[0x0B] - b2[0x0A]) * cos0; - b1[0x0A] += b1[0x0B]; - - b1[0x0C] = b2[0x0C] + b2[0x0D]; - b1[0x0D] = (b2[0x0C] - b2[0x0D]) * cos0; - b1[0x0E] = b2[0x0E] + b2[0x0F]; - b1[0x0F] = (b2[0x0F] - b2[0x0E]) * cos0; - b1[0x0E] += b1[0x0F]; - b1[0x0C] += b1[0x0E]; - b1[0x0E] += b1[0x0D]; - b1[0x0D] += b1[0x0F]; - - b1[0x10] = b2[0x10] + b2[0x11]; - b1[0x11] = (b2[0x10] - b2[0x11]) * cos0; - b1[0x12] = b2[0x12] + b2[0x13]; - b1[0x13] = (b2[0x13] - b2[0x12]) * cos0; - b1[0x12] += b1[0x13]; - - b1[0x14] = b2[0x14] + b2[0x15]; - b1[0x15] = (b2[0x14] - b2[0x15]) * cos0; - b1[0x16] = b2[0x16] + b2[0x17]; - b1[0x17] = (b2[0x17] - b2[0x16]) * cos0; - b1[0x16] += b1[0x17]; - b1[0x14] += b1[0x16]; - b1[0x16] += b1[0x15]; - b1[0x15] += b1[0x17]; - - b1[0x18] = b2[0x18] + b2[0x19]; - b1[0x19] = (b2[0x18] - b2[0x19]) * cos0; - b1[0x1A] = b2[0x1A] + b2[0x1B]; - b1[0x1B] = (b2[0x1B] - b2[0x1A]) * cos0; - b1[0x1A] += b1[0x1B]; - - b1[0x1C] = b2[0x1C] + b2[0x1D]; - b1[0x1D] = (b2[0x1C] - b2[0x1D]) * cos0; - b1[0x1E] = b2[0x1E] + b2[0x1F]; - b1[0x1F] = (b2[0x1F] - b2[0x1E]) * cos0; - b1[0x1E] += b1[0x1F]; - b1[0x1C] += b1[0x1E]; - b1[0x1E] += b1[0x1D]; - b1[0x1D] += b1[0x1F]; - } - - out0[0x10 * 16] = b1[0x00]; - out0[0x10 * 12] = b1[0x04]; - out0[0x10 * 8] = b1[0x02]; - out0[0x10 * 4] = b1[0x06]; - out0[0x10 * 0] = b1[0x01]; - out1[0x10 * 0] = b1[0x01]; - out1[0x10 * 4] = b1[0x05]; - out1[0x10 * 8] = b1[0x03]; - out1[0x10 * 12] = b1[0x07]; - - b1[0x08] += b1[0x0C]; - out0[0x10 * 14] = b1[0x08]; - b1[0x0C] += b1[0x0a]; - out0[0x10 * 10] = b1[0x0C]; - b1[0x0A] += b1[0x0E]; - out0[0x10 * 6] = b1[0x0A]; - b1[0x0E] += b1[0x09]; - out0[0x10 * 2] = b1[0x0E]; - b1[0x09] += b1[0x0D]; - out1[0x10 * 2] = b1[0x09]; - b1[0x0D] += b1[0x0B]; - out1[0x10 * 6] = b1[0x0D]; - b1[0x0B] += b1[0x0F]; - out1[0x10 * 10] = b1[0x0B]; - out1[0x10 * 14] = b1[0x0F]; - - b1[0x18] += b1[0x1C]; - out0[0x10 * 15] = b1[0x10] + b1[0x18]; - out0[0x10 * 13] = b1[0x18] + b1[0x14]; - b1[0x1C] += b1[0x1a]; - out0[0x10 * 11] = b1[0x14] + b1[0x1C]; - out0[0x10 * 9] = b1[0x1C] + b1[0x12]; - b1[0x1A] += b1[0x1E]; - out0[0x10 * 7] = b1[0x12] + b1[0x1A]; - out0[0x10 * 5] = b1[0x1A] + b1[0x16]; - b1[0x1E] += b1[0x19]; - out0[0x10 * 3] = b1[0x16] + b1[0x1E]; - out0[0x10 * 1] = b1[0x1E] + b1[0x11]; - b1[0x19] += b1[0x1D]; - out1[0x10 * 1] = b1[0x11] + b1[0x19]; - out1[0x10 * 3] = b1[0x19] + b1[0x15]; - b1[0x1D] += b1[0x1B]; - out1[0x10 * 5] = b1[0x15] + b1[0x1D]; - out1[0x10 * 7] = b1[0x1D] + b1[0x13]; - b1[0x1B] += b1[0x1F]; - out1[0x10 * 9] = b1[0x13] + b1[0x1B]; - out1[0x10 * 11] = b1[0x1B] + b1[0x17]; - out1[0x10 * 13] = b1[0x17] + b1[0x1F]; - out1[0x10 * 15] = b1[0x1F]; -} - -/* - * the call via dct64 is a trick to force GCC to use - * (new) registers for the b1,b2 pointer to the bufs[xx] field - */ -void -dct64(real * a, real * b, real * c) -{ - real bufs[0x40]; - dct64_1(a, b, bufs, bufs + 0x20, c); -} diff --git a/lib-src/mpglib/dct64_i386.h b/lib-src/mpglib/dct64_i386.h deleted file mode 100644 index a140ee71f..000000000 --- a/lib-src/mpglib/dct64_i386.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef MPGLIB_DCT64_I386_H_INCLUDED -#define MPGLIB_DCT64_I386_H_INCLUDED - -#include "common.h" - -void dct64(real * a, real * b, real * c); - - -#endif diff --git a/lib-src/mpglib/decode_i386.c b/lib-src/mpglib/decode_i386.c deleted file mode 100644 index 8ffcab36c..000000000 --- a/lib-src/mpglib/decode_i386.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * decode_i396.c: Mpeg Layer-1,2,3 audio decoder - * - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * - * Slighlty optimized for machines without autoincrement/decrement. - * The performance is highly compiler dependend. Maybe - * the decode.c version for 'normal' processor may be faster - * even for Intel processors. - */ - -/* $Id: decode_i386.c,v 1.22 2010/03/22 14:30:19 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef STDC_HEADERS -# include -# include -#else -# ifndef HAVE_STRCHR -# define strchr index -# define strrchr rindex -# endif -char *strchr(), *strrchr(); -# ifndef HAVE_MEMCPY -# define memcpy(d, s, n) bcopy ((s), (d), (n)) -# define memmove(d, s, n) bcopy ((s), (d), (n)) -# endif -#endif - -#if defined(__riscos__) && defined(FPA10) -#include "ymath.h" -#else -#include -#endif - -#include "decode_i386.h" -#include "dct64_i386.h" -#include "tabinit.h" - -#ifdef WITH_DMALLOC -#include -#endif - - - /* old WRITE_SAMPLE_CLIPPED */ -#define WRITE_SAMPLE_CLIPPED(TYPE,samples,sum,clip) \ - if( (sum) > 32767.0) { *(samples) = 0x7fff; (clip)++; } \ - else if( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; } \ - else { *(samples) = (TYPE)((sum)>0 ? (sum)+0.5 : (sum)-0.5) ; } - -#define WRITE_SAMPLE_UNCLIPPED(TYPE,samples,sum,clip) \ - *samples = (TYPE)sum; - - /* *INDENT-OFF* */ - - /* versions: clipped (when TYPE == short) and unclipped (when TYPE == real) of synth_1to1_mono* functions */ -#define SYNTH_1TO1_MONO_CLIPCHOICE(TYPE,SYNTH_1TO1) \ - TYPE samples_tmp[64]; \ - TYPE *tmp1 = samples_tmp; \ - int i,ret; \ - int pnt1 = 0; \ - \ - ret = SYNTH_1TO1 (mp,bandPtr,0,(unsigned char *) samples_tmp,&pnt1); \ - out += *pnt; \ - \ - for(i=0;i<32;i++) { \ - *( (TYPE *) out) = *tmp1; \ - out += sizeof(TYPE); \ - tmp1 += 2; \ - } \ - *pnt += 32*sizeof(TYPE); \ - \ - return ret; - - /* *INDENT-ON* */ - - -int -synth_1to1_mono(PMPSTR mp, real * bandPtr, unsigned char *out, int *pnt) -{ - SYNTH_1TO1_MONO_CLIPCHOICE(short, synth_1to1) -} int -synth_1to1_mono_unclipped(PMPSTR mp, real * bandPtr, unsigned char *out, int *pnt) -{ - SYNTH_1TO1_MONO_CLIPCHOICE(real, synth_1to1_unclipped) -} - - /* *INDENT-OFF* */ -/* versions: clipped (when TYPE == short) and unclipped (when TYPE == real) of synth_1to1* functions */ -#define SYNTH_1TO1_CLIPCHOICE(TYPE,WRITE_SAMPLE) \ - static const int step = 2; \ - int bo; \ - TYPE *samples = (TYPE *) (out + *pnt); \ - \ - real *b0,(*buf)[0x110]; \ - int clip = 0; \ - int bo1; \ - \ - bo = mp->synth_bo; \ - \ - if(!channel) { \ - bo--; \ - bo &= 0xf; \ - buf = mp->synth_buffs[0]; \ - } \ - else { \ - samples++; \ - buf = mp->synth_buffs[1]; \ - } \ - \ - if(bo & 0x1) { \ - b0 = buf[0]; \ - bo1 = bo; \ - dct64(buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr); \ - } \ - else { \ - b0 = buf[1]; \ - bo1 = bo+1; \ - dct64(buf[0]+bo,buf[1]+bo+1,bandPtr); \ - } \ - \ - mp->synth_bo = bo; \ - \ - { \ - int j; \ - real *window = decwin + 16 - bo1; \ - \ - for (j=16;j;j--,b0+=0x10,window+=0x20,samples+=step) \ - { \ - real sum; \ - sum = window[0x0] * b0[0x0]; \ - sum -= window[0x1] * b0[0x1]; \ - sum += window[0x2] * b0[0x2]; \ - sum -= window[0x3] * b0[0x3]; \ - sum += window[0x4] * b0[0x4]; \ - sum -= window[0x5] * b0[0x5]; \ - sum += window[0x6] * b0[0x6]; \ - sum -= window[0x7] * b0[0x7]; \ - sum += window[0x8] * b0[0x8]; \ - sum -= window[0x9] * b0[0x9]; \ - sum += window[0xA] * b0[0xA]; \ - sum -= window[0xB] * b0[0xB]; \ - sum += window[0xC] * b0[0xC]; \ - sum -= window[0xD] * b0[0xD]; \ - sum += window[0xE] * b0[0xE]; \ - sum -= window[0xF] * b0[0xF]; \ - \ - WRITE_SAMPLE (TYPE,samples,sum,clip); \ - } \ - \ - { \ - real sum; \ - sum = window[0x0] * b0[0x0]; \ - sum += window[0x2] * b0[0x2]; \ - sum += window[0x4] * b0[0x4]; \ - sum += window[0x6] * b0[0x6]; \ - sum += window[0x8] * b0[0x8]; \ - sum += window[0xA] * b0[0xA]; \ - sum += window[0xC] * b0[0xC]; \ - sum += window[0xE] * b0[0xE]; \ - WRITE_SAMPLE (TYPE,samples,sum,clip); \ - b0-=0x10,window-=0x20,samples+=step; \ - } \ - window += bo1<<1; \ - \ - for (j=15;j;j--,b0-=0x10,window-=0x20,samples+=step) \ - { \ - real sum; \ - sum = -window[-0x1] * b0[0x0]; \ - sum -= window[-0x2] * b0[0x1]; \ - sum -= window[-0x3] * b0[0x2]; \ - sum -= window[-0x4] * b0[0x3]; \ - sum -= window[-0x5] * b0[0x4]; \ - sum -= window[-0x6] * b0[0x5]; \ - sum -= window[-0x7] * b0[0x6]; \ - sum -= window[-0x8] * b0[0x7]; \ - sum -= window[-0x9] * b0[0x8]; \ - sum -= window[-0xA] * b0[0x9]; \ - sum -= window[-0xB] * b0[0xA]; \ - sum -= window[-0xC] * b0[0xB]; \ - sum -= window[-0xD] * b0[0xC]; \ - sum -= window[-0xE] * b0[0xD]; \ - sum -= window[-0xF] * b0[0xE]; \ - sum -= window[-0x0] * b0[0xF]; \ - \ - WRITE_SAMPLE (TYPE,samples,sum,clip); \ - } \ - } \ - *pnt += 64*sizeof(TYPE); \ - \ - return clip; - /* *INDENT-ON* */ - - -int -synth_1to1(PMPSTR mp, real * bandPtr, int channel, unsigned char *out, int *pnt) -{ - SYNTH_1TO1_CLIPCHOICE(short, WRITE_SAMPLE_CLIPPED) -} int -synth_1to1_unclipped(PMPSTR mp, real * bandPtr, int channel, unsigned char *out, int *pnt) -{ - SYNTH_1TO1_CLIPCHOICE(real, WRITE_SAMPLE_UNCLIPPED) -} diff --git a/lib-src/mpglib/decode_i386.h b/lib-src/mpglib/decode_i386.h deleted file mode 100644 index 8fc9dbe8c..000000000 --- a/lib-src/mpglib/decode_i386.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef DECODE_I386_H_INCLUDED -#define DECODE_I386_H_INCLUDED - -#include "common.h" - -int synth_1to1_mono(PMPSTR mp, real * bandPtr, unsigned char *out, int *pnt); -int synth_1to1(PMPSTR mp, real * bandPtr, int channel, unsigned char *out, int *pnt); - -int synth_1to1_mono_unclipped(PMPSTR mp, real * bandPtr, unsigned char *out, int *pnt); -int synth_1to1_unclipped(PMPSTR mp, real * bandPtr, int channel, unsigned char *out, int *pnt); - -#endif diff --git a/lib-src/mpglib/depcomp b/lib-src/mpglib/depcomp deleted file mode 100644 index b39f98f9a..000000000 --- a/lib-src/mpglib/depcomp +++ /dev/null @@ -1,791 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2016-01-11.22; # UTC - -# Copyright (C) 1999-2017 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by 'PROGRAMS ARGS'. - object Object file output by 'PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputting dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit $? - ;; -esac - -# Get the directory component of the given path, and save it in the -# global variables '$dir'. Note that this directory component will -# be either empty or ending with a '/' character. This is deliberate. -set_dir_from () -{ - case $1 in - */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; - *) dir=;; - esac -} - -# Get the suffix-stripped basename of the given path, and save it the -# global variable '$base'. -set_base_from () -{ - base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` -} - -# If no dependency file was actually created by the compiler invocation, -# we still have to create a dummy depfile, to avoid errors with the -# Makefile "include basename.Plo" scheme. -make_dummy_depfile () -{ - echo "#dummy" > "$depfile" -} - -# Factor out some common post-processing of the generated depfile. -# Requires the auxiliary global variable '$tmpdepfile' to be set. -aix_post_process_depfile () -{ - # If the compiler actually managed to produce a dependency file, - # post-process it. - if test -f "$tmpdepfile"; then - # Each line is of the form 'foo.o: dependency.h'. - # Do two passes, one to just change these to - # $object: dependency.h - # and one to simply output - # dependency.h: - # which is needed to avoid the deleted-header problem. - { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" - sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" - } > "$depfile" - rm -f "$tmpdepfile" - else - make_dummy_depfile - fi -} - -# A tabulation character. -tab=' ' -# A newline character. -nl=' -' -# Character ranges might be problematic outside the C locale. -# These definitions help. -upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ -lower=abcdefghijklmnopqrstuvwxyz -digits=0123456789 -alpha=${upper}${lower} - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi - -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Avoid interferences from the environment. -gccflag= dashmflag= - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -cygpath_u="cygpath -u -f -" -if test "$depmode" = msvcmsys; then - # This is just like msvisualcpp but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvisualcpp -fi - -if test "$depmode" = msvc7msys; then - # This is just like msvc7 but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvc7 -fi - -if test "$depmode" = xlc; then - # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. - gccflag=-qmakedep=gcc,-MF - depmode=gcc -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. -## Unfortunately, FreeBSD c89 acceptance of flags depends upon -## the command line argument order; so add the flags where they -## appear in depend2.am. Note that the slowdown incurred here -## affects only configure: in makefiles, %FASTDEP% shortcuts this. - for arg - do - case $arg in - -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; - *) set fnord "$@" "$arg" ;; - esac - shift # fnord - shift # $arg - done - "$@" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. -## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. -## (see the conditional assignment to $gccflag above). -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). Also, it might not be -## supported by the other compilers which use the 'gcc' depmode. -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - # The second -e expression handles DOS-style file names with drive - # letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the "deleted header file" problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. -## Some versions of gcc put a space before the ':'. On the theory -## that the space means something, we add a space to the output as -## well. hp depmode also adds that space, but also prefixes the VPATH -## to the object. Take care to not repeat it in the output. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like '#:fec' to the end of the - # dependency line. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ - | tr "$nl" ' ' >> "$depfile" - echo >> "$depfile" - # The second pass generates a dummy entry for each header file. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> "$depfile" - else - make_dummy_depfile - fi - rm -f "$tmpdepfile" - ;; - -xlc) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts '$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - set_dir_from "$object" - set_base_from "$object" - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.u - tmpdepfile2=$base.u - tmpdepfile3=$dir.libs/$base.u - "$@" -Wc,-M - else - tmpdepfile1=$dir$base.u - tmpdepfile2=$dir$base.u - tmpdepfile3=$dir$base.u - "$@" -M - fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done - aix_post_process_depfile - ;; - -tcc) - # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 - # FIXME: That version still under development at the moment of writing. - # Make that this statement remains true also for stable, released - # versions. - # It will wrap lines (doesn't matter whether long or short) with a - # trailing '\', as in: - # - # foo.o : \ - # foo.c \ - # foo.h \ - # - # It will put a trailing '\' even on the last line, and will use leading - # spaces rather than leading tabs (at least since its commit 0394caf7 - # "Emit spaces for -MD"). - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. - # We have to change lines of the first kind to '$object: \'. - sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" - # And for each line of the second kind, we have to emit a 'dep.h:' - # dummy dependency, to avoid the deleted-header problem. - sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" - rm -f "$tmpdepfile" - ;; - -## The order of this option in the case statement is important, since the -## shell code in configure will try each of these formats in the order -## listed in this file. A plain '-MD' option would be understood by many -## compilers, so we must ensure this comes after the gcc and icc options. -pgcc) - # Portland's C compiler understands '-MD'. - # Will always output deps to 'file.d' where file is the root name of the - # source file under compilation, even if file resides in a subdirectory. - # The object file name does not affect the name of the '.d' file. - # pgcc 10.2 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using '\' : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - set_dir_from "$object" - # Use the source, not the object, to determine the base name, since - # that's sadly what pgcc will do too. - set_base_from "$source" - tmpdepfile=$base.d - - # For projects that build the same source file twice into different object - # files, the pgcc approach of using the *source* file root name can cause - # problems in parallel builds. Use a locking strategy to avoid stomping on - # the same $tmpdepfile. - lockdir=$base.d-lock - trap " - echo '$0: caught signal, cleaning up...' >&2 - rmdir '$lockdir' - exit 1 - " 1 2 13 15 - numtries=100 - i=$numtries - while test $i -gt 0; do - # mkdir is a portable test-and-set. - if mkdir "$lockdir" 2>/dev/null; then - # This process acquired the lock. - "$@" -MD - stat=$? - # Release the lock. - rmdir "$lockdir" - break - else - # If the lock is being held by a different process, wait - # until the winning process is done or we timeout. - while test -d "$lockdir" && test $i -gt 0; do - sleep 1 - i=`expr $i - 1` - done - fi - i=`expr $i - 1` - done - trap - 1 2 13 15 - if test $i -le 0; then - echo "$0: failed to acquire lock after $numtries attempts" >&2 - echo "$0: check lockdir '$lockdir'" >&2 - exit 1 - fi - - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp2) - # The "hp" stanza above does not work with aCC (C++) and HP's ia64 - # compilers, which have integrated preprocessors. The correct option - # to use with these is +Maked; it writes dependencies to a file named - # 'foo.d', which lands next to the object file, wherever that - # happens to be. - # Much of this is similar to the tru64 case; see comments there. - set_dir_from "$object" - set_base_from "$object" - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir.libs/$base.d - "$@" -Wc,+Maked - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - "$@" +Maked - fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" - # Add 'dependent.h:' lines. - sed -ne '2,${ - s/^ *// - s/ \\*$// - s/$/:/ - p - }' "$tmpdepfile" >> "$depfile" - else - make_dummy_depfile - fi - rm -f "$tmpdepfile" "$tmpdepfile2" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in 'foo.d' instead, so we check for that too. - # Subdirectories are respected. - set_dir_from "$object" - set_base_from "$object" - - if test "$libtool" = yes; then - # Libtool generates 2 separate objects for the 2 libraries. These - # two compilations output dependencies in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir$base.o.d # libtool 1.5 - tmpdepfile2=$dir.libs/$base.o.d # Likewise. - tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done - # Same post-processing that is required for AIX mode. - aix_post_process_depfile - ;; - -msvc7) - if test "$libtool" = yes; then - showIncludes=-Wc,-showIncludes - else - showIncludes=-showIncludes - fi - "$@" $showIncludes > "$tmpdepfile" - stat=$? - grep -v '^Note: including file: ' "$tmpdepfile" - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - # The first sed program below extracts the file names and escapes - # backslashes for cygpath. The second sed program outputs the file - # name when reading, but also accumulates all include files in the - # hold buffer in order to output them again at the end. This only - # works with sed implementations that can handle large buffers. - sed < "$tmpdepfile" -n ' -/^Note: including file: *\(.*\)/ { - s//\1/ - s/\\/\\\\/g - p -}' | $cygpath_u | sort -u | sed -n ' -s/ /\\ /g -s/\(.*\)/'"$tab"'\1 \\/p -s/.\(.*\) \\/\1:/ -H -$ { - s/.*/'"$tab"'/ - G - p -}' >> "$depfile" - echo >> "$depfile" # make sure the fragment doesn't end with a backslash - rm -f "$tmpdepfile" - ;; - -msvc7msys) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove '-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for ':' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. - "$@" $dashmflag | - sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this sed invocation - # correctly. Breaking it into two sed invocations is a workaround. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no eat=no - for arg - do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - if test $eat = yes; then - eat=no - continue - fi - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -arch) - eat=yes ;; - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix=`echo "$object" | sed 's/^.*\././'` - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - # makedepend may prepend the VPATH from the source file name to the object. - # No need to regex-escape $object, excess matching of '.' is harmless. - sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process the last invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed '1,2d' "$tmpdepfile" \ - | tr ' ' "$nl" \ - | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove '-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E \ - | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - | sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - IFS=" " - for arg - do - case "$arg" in - -o) - shift - ;; - $object) - shift - ;; - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E 2>/dev/null | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" - echo "$tab" >> "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvcmsys) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC0" -# time-stamp-end: "; # UTC" -# End: diff --git a/lib-src/mpglib/huffman.h b/lib-src/mpglib/huffman.h deleted file mode 100644 index 7d73a74ba..000000000 --- a/lib-src/mpglib/huffman.h +++ /dev/null @@ -1,353 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * huffman tables ... recalcualted to work with my optimzed - * decoder scheme (MH) - * - * probably we could save a few bytes of memory, because the - * smaller tables are often the part of a bigger table - */ - -/* *INDENT-OFF* */ - - -struct newhuff -{ - const unsigned int linbits; - const short * const table; -}; - -static const short tab0[] = -{ - 0 -}; - -static const short tab1[] = -{ - -5, -3, -1, 17, 1, 16, 0 -}; - -static const short tab2[] = -{ - -15, -11, -9, -5, -3, -1, 34, 2, 18, -1, 33, 32, 17, -1, 1, 16, 0 -}; - -static const short tab3[] = -{ - -13, -11, -9, -5, -3, -1, 34, 2, 18, -1, 33, 32, 16, 17, -1, - 1, 0 -}; - -static const short tab5[] = -{ - -29, -25, -23, -15, -7, -5, -3, -1, 51, 35, 50, 49, -3, -1, 19, - 3, -1, 48, 34, -3, -1, 18, 33, -1, 2, 32, 17, -1, 1, 16, - 0 -}; - -static const short tab6[] = -{ - -25, -19, -13, -9, -5, -3, -1, 51, 3, 35, -1, 50, 48, -1, 19, - 49, -3, -1, 34, 2, 18, -3, -1, 33, 32, 1, -1, 17, -1, 16, - 0 -}; - -static const short tab7[] = -{ - -69, -65, -57, -39, -29, -17, -11, -7, -3, -1, 85, 69, -1, 84, 83, - -1, 53, 68, -3, -1, 37, 82, 21, -5, -1, 81, -1, 5, 52, -1, - 80, -1, 67, 51, -5, -3, -1, 36, 66, 20, -1, 65, 64, -11, -7, - -3, -1, 4, 35, -1, 50, 3, -1, 19, 49, -3, -1, 48, 34, 18, - -5, -1, 33, -1, 2, 32, 17, -1, 1, 16, 0 -}; - -static const short tab8[] = -{ - -65, -63, -59, -45, -31, -19, -13, -7, -5, -3, -1, 85, 84, 69, 83, - -3, -1, 53, 68, 37, -3, -1, 82, 5, 21, -5, -1, 81, -1, 52, - 67, -3, -1, 80, 51, 36, -5, -3, -1, 66, 20, 65, -3, -1, 4, - 64, -1, 35, 50, -9, -7, -3, -1, 19, 49, -1, 3, 48, 34, -1, - 2, 32, -1, 18, 33, 17, -3, -1, 1, 16, 0 -}; - -static const short tab9[] = -{ - -63, -53, -41, -29, -19, -11, -5, -3, -1, 85, 69, 53, -1, 83, -1, - 84, 5, -3, -1, 68, 37, -1, 82, 21, -3, -1, 81, 52, -1, 67, - -1, 80, 4, -7, -3, -1, 36, 66, -1, 51, 64, -1, 20, 65, -5, - -3, -1, 35, 50, 19, -1, 49, -1, 3, 48, -5, -3, -1, 34, 2, - 18, -1, 33, 32, -3, -1, 17, 1, -1, 16, 0 -}; - -static const short tab10[] = -{ --125,-121,-111, -83, -55, -35, -21, -13, -7, -3, -1, 119, 103, -1, 118, - 87, -3, -1, 117, 102, 71, -3, -1, 116, 86, -1, 101, 55, -9, -3, - -1, 115, 70, -3, -1, 85, 84, 99, -1, 39, 114, -11, -5, -3, -1, - 100, 7, 112, -1, 98, -1, 69, 53, -5, -1, 6, -1, 83, 68, 23, - -17, -5, -1, 113, -1, 54, 38, -5, -3, -1, 37, 82, 21, -1, 81, - -1, 52, 67, -3, -1, 22, 97, -1, 96, -1, 5, 80, -19, -11, -7, - -3, -1, 36, 66, -1, 51, 4, -1, 20, 65, -3, -1, 64, 35, -1, - 50, 3, -3, -1, 19, 49, -1, 48, 34, -7, -3, -1, 18, 33, -1, - 2, 32, 17, -1, 1, 16, 0 -}; - -static const short tab11[] = -{ --121,-113, -89, -59, -43, -27, -17, -7, -3, -1, 119, 103, -1, 118, 117, - -3, -1, 102, 71, -1, 116, -1, 87, 85, -5, -3, -1, 86, 101, 55, - -1, 115, 70, -9, -7, -3, -1, 69, 84, -1, 53, 83, 39, -1, 114, - -1, 100, 7, -5, -1, 113, -1, 23, 112, -3, -1, 54, 99, -1, 96, - -1, 68, 37, -13, -7, -5, -3, -1, 82, 5, 21, 98, -3, -1, 38, - 6, 22, -5, -1, 97, -1, 81, 52, -5, -1, 80, -1, 67, 51, -1, - 36, 66, -15, -11, -7, -3, -1, 20, 65, -1, 4, 64, -1, 35, 50, - -1, 19, 49, -5, -3, -1, 3, 48, 34, 33, -5, -1, 18, -1, 2, - 32, 17, -3, -1, 1, 16, 0 -}; - -static const short tab12[] = -{ --115, -99, -73, -45, -27, -17, -9, -5, -3, -1, 119, 103, 118, -1, 87, - 117, -3, -1, 102, 71, -1, 116, 101, -3, -1, 86, 55, -3, -1, 115, - 85, 39, -7, -3, -1, 114, 70, -1, 100, 23, -5, -1, 113, -1, 7, - 112, -1, 54, 99, -13, -9, -3, -1, 69, 84, -1, 68, -1, 6, 5, - -1, 38, 98, -5, -1, 97, -1, 22, 96, -3, -1, 53, 83, -1, 37, - 82, -17, -7, -3, -1, 21, 81, -1, 52, 67, -5, -3, -1, 80, 4, - 36, -1, 66, 20, -3, -1, 51, 65, -1, 35, 50, -11, -7, -5, -3, - -1, 64, 3, 48, 19, -1, 49, 34, -1, 18, 33, -7, -5, -3, -1, - 2, 32, 0, 17, -1, 1, 16 -}; - -static const short tab13[] = -{ --509,-503,-475,-405,-333,-265,-205,-153,-115, -83, -53, -35, -21, -13, -9, - -7, -5, -3, -1, 254, 252, 253, 237, 255, -1, 239, 223, -3, -1, 238, - 207, -1, 222, 191, -9, -3, -1, 251, 206, -1, 220, -1, 175, 233, -1, - 236, 221, -9, -5, -3, -1, 250, 205, 190, -1, 235, 159, -3, -1, 249, - 234, -1, 189, 219, -17, -9, -3, -1, 143, 248, -1, 204, -1, 174, 158, - -5, -1, 142, -1, 127, 126, 247, -5, -1, 218, -1, 173, 188, -3, -1, - 203, 246, 111, -15, -7, -3, -1, 232, 95, -1, 157, 217, -3, -1, 245, - 231, -1, 172, 187, -9, -3, -1, 79, 244, -3, -1, 202, 230, 243, -1, - 63, -1, 141, 216, -21, -9, -3, -1, 47, 242, -3, -1, 110, 156, 15, - -5, -3, -1, 201, 94, 171, -3, -1, 125, 215, 78, -11, -5, -3, -1, - 200, 214, 62, -1, 185, -1, 155, 170, -1, 31, 241, -23, -13, -5, -1, - 240, -1, 186, 229, -3, -1, 228, 140, -1, 109, 227, -5, -1, 226, -1, - 46, 14, -1, 30, 225, -15, -7, -3, -1, 224, 93, -1, 213, 124, -3, - -1, 199, 77, -1, 139, 184, -7, -3, -1, 212, 154, -1, 169, 108, -1, - 198, 61, -37, -21, -9, -5, -3, -1, 211, 123, 45, -1, 210, 29, -5, - -1, 183, -1, 92, 197, -3, -1, 153, 122, 195, -7, -5, -3, -1, 167, - 151, 75, 209, -3, -1, 13, 208, -1, 138, 168, -11, -7, -3, -1, 76, - 196, -1, 107, 182, -1, 60, 44, -3, -1, 194, 91, -3, -1, 181, 137, - 28, -43, -23, -11, -5, -1, 193, -1, 152, 12, -1, 192, -1, 180, 106, - -5, -3, -1, 166, 121, 59, -1, 179, -1, 136, 90, -11, -5, -1, 43, - -1, 165, 105, -1, 164, -1, 120, 135, -5, -1, 148, -1, 119, 118, 178, - -11, -3, -1, 27, 177, -3, -1, 11, 176, -1, 150, 74, -7, -3, -1, - 58, 163, -1, 89, 149, -1, 42, 162, -47, -23, -9, -3, -1, 26, 161, - -3, -1, 10, 104, 160, -5, -3, -1, 134, 73, 147, -3, -1, 57, 88, - -1, 133, 103, -9, -3, -1, 41, 146, -3, -1, 87, 117, 56, -5, -1, - 131, -1, 102, 71, -3, -1, 116, 86, -1, 101, 115, -11, -3, -1, 25, - 145, -3, -1, 9, 144, -1, 72, 132, -7, -5, -1, 114, -1, 70, 100, - 40, -1, 130, 24, -41, -27, -11, -5, -3, -1, 55, 39, 23, -1, 113, - -1, 85, 7, -7, -3, -1, 112, 54, -1, 99, 69, -3, -1, 84, 38, - -1, 98, 53, -5, -1, 129, -1, 8, 128, -3, -1, 22, 97, -1, 6, - 96, -13, -9, -5, -3, -1, 83, 68, 37, -1, 82, 5, -1, 21, 81, - -7, -3, -1, 52, 67, -1, 80, 36, -3, -1, 66, 51, 20, -19, -11, - -5, -1, 65, -1, 4, 64, -3, -1, 35, 50, 19, -3, -1, 49, 3, - -1, 48, 34, -3, -1, 18, 33, -1, 2, 32, -3, -1, 17, 1, 16, - 0 -}; - -static const short tab15[] = -{ --495,-445,-355,-263,-183,-115, -77, -43, -27, -13, -7, -3, -1, 255, 239, - -1, 254, 223, -1, 238, -1, 253, 207, -7, -3, -1, 252, 222, -1, 237, - 191, -1, 251, -1, 206, 236, -7, -3, -1, 221, 175, -1, 250, 190, -3, - -1, 235, 205, -1, 220, 159, -15, -7, -3, -1, 249, 234, -1, 189, 219, - -3, -1, 143, 248, -1, 204, 158, -7, -3, -1, 233, 127, -1, 247, 173, - -3, -1, 218, 188, -1, 111, -1, 174, 15, -19, -11, -3, -1, 203, 246, - -3, -1, 142, 232, -1, 95, 157, -3, -1, 245, 126, -1, 231, 172, -9, - -3, -1, 202, 187, -3, -1, 217, 141, 79, -3, -1, 244, 63, -1, 243, - 216, -33, -17, -9, -3, -1, 230, 47, -1, 242, -1, 110, 240, -3, -1, - 31, 241, -1, 156, 201, -7, -3, -1, 94, 171, -1, 186, 229, -3, -1, - 125, 215, -1, 78, 228, -15, -7, -3, -1, 140, 200, -1, 62, 109, -3, - -1, 214, 227, -1, 155, 185, -7, -3, -1, 46, 170, -1, 226, 30, -5, - -1, 225, -1, 14, 224, -1, 93, 213, -45, -25, -13, -7, -3, -1, 124, - 199, -1, 77, 139, -1, 212, -1, 184, 154, -7, -3, -1, 169, 108, -1, - 198, 61, -1, 211, 210, -9, -5, -3, -1, 45, 13, 29, -1, 123, 183, - -5, -1, 209, -1, 92, 208, -1, 197, 138, -17, -7, -3, -1, 168, 76, - -1, 196, 107, -5, -1, 182, -1, 153, 12, -1, 60, 195, -9, -3, -1, - 122, 167, -1, 166, -1, 192, 11, -1, 194, -1, 44, 91, -55, -29, -15, - -7, -3, -1, 181, 28, -1, 137, 152, -3, -1, 193, 75, -1, 180, 106, - -5, -3, -1, 59, 121, 179, -3, -1, 151, 136, -1, 43, 90, -11, -5, - -1, 178, -1, 165, 27, -1, 177, -1, 176, 105, -7, -3, -1, 150, 74, - -1, 164, 120, -3, -1, 135, 58, 163, -17, -7, -3, -1, 89, 149, -1, - 42, 162, -3, -1, 26, 161, -3, -1, 10, 160, 104, -7, -3, -1, 134, - 73, -1, 148, 57, -5, -1, 147, -1, 119, 9, -1, 88, 133, -53, -29, - -13, -7, -3, -1, 41, 103, -1, 118, 146, -1, 145, -1, 25, 144, -7, - -3, -1, 72, 132, -1, 87, 117, -3, -1, 56, 131, -1, 102, 71, -7, - -3, -1, 40, 130, -1, 24, 129, -7, -3, -1, 116, 8, -1, 128, 86, - -3, -1, 101, 55, -1, 115, 70, -17, -7, -3, -1, 39, 114, -1, 100, - 23, -3, -1, 85, 113, -3, -1, 7, 112, 54, -7, -3, -1, 99, 69, - -1, 84, 38, -3, -1, 98, 22, -3, -1, 6, 96, 53, -33, -19, -9, - -5, -1, 97, -1, 83, 68, -1, 37, 82, -3, -1, 21, 81, -3, -1, - 5, 80, 52, -7, -3, -1, 67, 36, -1, 66, 51, -1, 65, -1, 20, - 4, -9, -3, -1, 35, 50, -3, -1, 64, 3, 19, -3, -1, 49, 48, - 34, -9, -7, -3, -1, 18, 33, -1, 2, 32, 17, -3, -1, 1, 16, - 0 -}; - -static const short tab16[] = -{ --509,-503,-461,-323,-103, -37, -27, -15, -7, -3, -1, 239, 254, -1, 223, - 253, -3, -1, 207, 252, -1, 191, 251, -5, -1, 175, -1, 250, 159, -3, - -1, 249, 248, 143, -7, -3, -1, 127, 247, -1, 111, 246, 255, -9, -5, - -3, -1, 95, 245, 79, -1, 244, 243, -53, -1, 240, -1, 63, -29, -19, - -13, -7, -5, -1, 206, -1, 236, 221, 222, -1, 233, -1, 234, 217, -1, - 238, -1, 237, 235, -3, -1, 190, 205, -3, -1, 220, 219, 174, -11, -5, - -1, 204, -1, 173, 218, -3, -1, 126, 172, 202, -5, -3, -1, 201, 125, - 94, 189, 242, -93, -5, -3, -1, 47, 15, 31, -1, 241, -49, -25, -13, - -5, -1, 158, -1, 188, 203, -3, -1, 142, 232, -1, 157, 231, -7, -3, - -1, 187, 141, -1, 216, 110, -1, 230, 156, -13, -7, -3, -1, 171, 186, - -1, 229, 215, -1, 78, -1, 228, 140, -3, -1, 200, 62, -1, 109, -1, - 214, 155, -19, -11, -5, -3, -1, 185, 170, 225, -1, 212, -1, 184, 169, - -5, -1, 123, -1, 183, 208, 227, -7, -3, -1, 14, 224, -1, 93, 213, - -3, -1, 124, 199, -1, 77, 139, -75, -45, -27, -13, -7, -3, -1, 154, - 108, -1, 198, 61, -3, -1, 92, 197, 13, -7, -3, -1, 138, 168, -1, - 153, 76, -3, -1, 182, 122, 60, -11, -5, -3, -1, 91, 137, 28, -1, - 192, -1, 152, 121, -1, 226, -1, 46, 30, -15, -7, -3, -1, 211, 45, - -1, 210, 209, -5, -1, 59, -1, 151, 136, 29, -7, -3, -1, 196, 107, - -1, 195, 167, -1, 44, -1, 194, 181, -23, -13, -7, -3, -1, 193, 12, - -1, 75, 180, -3, -1, 106, 166, 179, -5, -3, -1, 90, 165, 43, -1, - 178, 27, -13, -5, -1, 177, -1, 11, 176, -3, -1, 105, 150, -1, 74, - 164, -5, -3, -1, 120, 135, 163, -3, -1, 58, 89, 42, -97, -57, -33, - -19, -11, -5, -3, -1, 149, 104, 161, -3, -1, 134, 119, 148, -5, -3, - -1, 73, 87, 103, 162, -5, -1, 26, -1, 10, 160, -3, -1, 57, 147, - -1, 88, 133, -9, -3, -1, 41, 146, -3, -1, 118, 9, 25, -5, -1, - 145, -1, 144, 72, -3, -1, 132, 117, -1, 56, 131, -21, -11, -5, -3, - -1, 102, 40, 130, -3, -1, 71, 116, 24, -3, -1, 129, 128, -3, -1, - 8, 86, 55, -9, -5, -1, 115, -1, 101, 70, -1, 39, 114, -5, -3, - -1, 100, 85, 7, 23, -23, -13, -5, -1, 113, -1, 112, 54, -3, -1, - 99, 69, -1, 84, 38, -3, -1, 98, 22, -1, 97, -1, 6, 96, -9, - -5, -1, 83, -1, 53, 68, -1, 37, 82, -1, 81, -1, 21, 5, -33, - -23, -13, -7, -3, -1, 52, 67, -1, 80, 36, -3, -1, 66, 51, 20, - -5, -1, 65, -1, 4, 64, -1, 35, 50, -3, -1, 19, 49, -3, -1, - 3, 48, 34, -3, -1, 18, 33, -1, 2, 32, -3, -1, 17, 1, 16, - 0 -}; - -static const short tab24[] = -{ --451,-117, -43, -25, -15, -7, -3, -1, 239, 254, -1, 223, 253, -3, -1, - 207, 252, -1, 191, 251, -5, -1, 250, -1, 175, 159, -1, 249, 248, -9, - -5, -3, -1, 143, 127, 247, -1, 111, 246, -3, -1, 95, 245, -1, 79, - 244, -71, -7, -3, -1, 63, 243, -1, 47, 242, -5, -1, 241, -1, 31, - 240, -25, -9, -1, 15, -3, -1, 238, 222, -1, 237, 206, -7, -3, -1, - 236, 221, -1, 190, 235, -3, -1, 205, 220, -1, 174, 234, -15, -7, -3, - -1, 189, 219, -1, 204, 158, -3, -1, 233, 173, -1, 218, 188, -7, -3, - -1, 203, 142, -1, 232, 157, -3, -1, 217, 126, -1, 231, 172, 255,-235, --143, -77, -45, -25, -15, -7, -3, -1, 202, 187, -1, 141, 216, -5, -3, - -1, 14, 224, 13, 230, -5, -3, -1, 110, 156, 201, -1, 94, 186, -9, - -5, -1, 229, -1, 171, 125, -1, 215, 228, -3, -1, 140, 200, -3, -1, - 78, 46, 62, -15, -7, -3, -1, 109, 214, -1, 227, 155, -3, -1, 185, - 170, -1, 226, 30, -7, -3, -1, 225, 93, -1, 213, 124, -3, -1, 199, - 77, -1, 139, 184, -31, -15, -7, -3, -1, 212, 154, -1, 169, 108, -3, - -1, 198, 61, -1, 211, 45, -7, -3, -1, 210, 29, -1, 123, 183, -3, - -1, 209, 92, -1, 197, 138, -17, -7, -3, -1, 168, 153, -1, 76, 196, - -3, -1, 107, 182, -3, -1, 208, 12, 60, -7, -3, -1, 195, 122, -1, - 167, 44, -3, -1, 194, 91, -1, 181, 28, -57, -35, -19, -7, -3, -1, - 137, 152, -1, 193, 75, -5, -3, -1, 192, 11, 59, -3, -1, 176, 10, - 26, -5, -1, 180, -1, 106, 166, -3, -1, 121, 151, -3, -1, 160, 9, - 144, -9, -3, -1, 179, 136, -3, -1, 43, 90, 178, -7, -3, -1, 165, - 27, -1, 177, 105, -1, 150, 164, -17, -9, -5, -3, -1, 74, 120, 135, - -1, 58, 163, -3, -1, 89, 149, -1, 42, 162, -7, -3, -1, 161, 104, - -1, 134, 119, -3, -1, 73, 148, -1, 57, 147, -63, -31, -15, -7, -3, - -1, 88, 133, -1, 41, 103, -3, -1, 118, 146, -1, 25, 145, -7, -3, - -1, 72, 132, -1, 87, 117, -3, -1, 56, 131, -1, 102, 40, -17, -7, - -3, -1, 130, 24, -1, 71, 116, -5, -1, 129, -1, 8, 128, -1, 86, - 101, -7, -5, -1, 23, -1, 7, 112, 115, -3, -1, 55, 39, 114, -15, - -7, -3, -1, 70, 100, -1, 85, 113, -3, -1, 54, 99, -1, 69, 84, - -7, -3, -1, 38, 98, -1, 22, 97, -5, -3, -1, 6, 96, 53, -1, - 83, 68, -51, -37, -23, -15, -9, -3, -1, 37, 82, -1, 21, -1, 5, - 80, -1, 81, -1, 52, 67, -3, -1, 36, 66, -1, 51, 20, -9, -5, - -1, 65, -1, 4, 64, -1, 35, 50, -1, 19, 49, -7, -5, -3, -1, - 3, 48, 34, 18, -1, 33, -1, 2, 32, -3, -1, 17, 1, -1, 16, - 0 -}; - -static const short tab_c0[] = -{ - -29, -21, -13, -7, -3, -1, 11, 15, -1, 13, 14, -3, -1, 7, 5, - 9, -3, -1, 6, 3, -1, 10, 12, -3, -1, 2, 1, -1, 4, 8, - 0 -}; - -static const short tab_c1[] = -{ - -15, -7, -3, -1, 15, 14, -1, 13, 12, -3, -1, 11, 10, -1, 9, - 8, -7, -3, -1, 7, 6, -1, 5, 4, -3, -1, 3, 2, -1, 1, - 0 -}; - - - -static const struct newhuff ht[] = -{ - { /* 0 */ 0 , tab0 } , - { /* 2 */ 0 , tab1 } , - { /* 3 */ 0 , tab2 } , - { /* 3 */ 0 , tab3 } , - { /* 0 */ 0 , tab0 } , - { /* 4 */ 0 , tab5 } , - { /* 4 */ 0 , tab6 } , - { /* 6 */ 0 , tab7 } , - { /* 6 */ 0 , tab8 } , - { /* 6 */ 0 , tab9 } , - { /* 8 */ 0 , tab10 } , - { /* 8 */ 0 , tab11 } , - { /* 8 */ 0 , tab12 } , - { /* 16 */ 0 , tab13 } , - { /* 0 */ 0 , tab0 } , - { /* 16 */ 0 , tab15 } , - - { /* 16 */ 1 , tab16 } , - { /* 16 */ 2 , tab16 } , - { /* 16 */ 3 , tab16 } , - { /* 16 */ 4 , tab16 } , - { /* 16 */ 6 , tab16 } , - { /* 16 */ 8 , tab16 } , - { /* 16 */ 10, tab16 } , - { /* 16 */ 13, tab16 } , - { /* 16 */ 4 , tab24 } , - { /* 16 */ 5 , tab24 } , - { /* 16 */ 6 , tab24 } , - { /* 16 */ 7 , tab24 } , - { /* 16 */ 8 , tab24 } , - { /* 16 */ 9 , tab24 } , - { /* 16 */ 11, tab24 } , - { /* 16 */ 13, tab24 } -}; - -static const struct newhuff htc[] = -{ - { /* 1 , 1 , */ 0 , tab_c0 } , - { /* 1 , 1 , */ 0 , tab_c1 } -}; - - /* *INDENT-ON* */ diff --git a/lib-src/mpglib/interface.c b/lib-src/mpglib/interface.c deleted file mode 100644 index 9719ff999..000000000 --- a/lib-src/mpglib/interface.c +++ /dev/null @@ -1,718 +0,0 @@ -/* - * interface.c - * - * Copyright (C) 1999-2012 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* $Id: interface.c,v 1.69 2017/09/06 15:07:30 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include - -#include "common.h" -#include "interface.h" -#include "tabinit.h" -#include "layer3.h" -#include "lame.h" -#include "machine.h" -#include "VbrTag.h" -#include "decode_i386.h" - -#include "layer1.h" -#include "layer2.h" - -#ifdef WITH_DMALLOC -#include -#endif - -extern void lame_report_def(const char* format, va_list args); - -/* #define HIP_DEBUG */ - -int -InitMP3(PMPSTR mp) -{ - hip_init_tables_layer1(); - hip_init_tables_layer2(); - hip_init_tables_layer3(); - - if (mp) { - memset(mp, 0, sizeof(MPSTR)); - - mp->framesize = 0; - mp->num_frames = 0; - mp->enc_delay = -1; - mp->enc_padding = -1; - mp->vbr_header = 0; - mp->header_parsed = 0; - mp->side_parsed = 0; - mp->data_parsed = 0; - mp->free_format = 0; - mp->old_free_format = 0; - mp->ssize = 0; - mp->dsize = 0; - mp->fsizeold = -1; - mp->bsize = 0; - mp->head = mp->tail = NULL; - mp->fr.single = -1; - mp->bsnum = 0; - mp->wordpointer = mp->bsspace[mp->bsnum] + 512; - mp->bitindex = 0; - mp->synth_bo = 1; - mp->sync_bitstream = 1; - - mp->report_dbg = &lame_report_def; - mp->report_err = &lame_report_def; - mp->report_msg = &lame_report_def; - } - make_decode_tables(32767); - - return 1; -} - -void -ExitMP3(PMPSTR mp) -{ - if (mp) { - struct buf *b, *bn; - - b = mp->tail; - while (b) { - free(b->pnt); - bn = b->next; - free(b); - b = bn; - } - } -} - -static struct buf * -addbuf(PMPSTR mp, unsigned char *buf, int size) -{ - struct buf *nbuf; - - nbuf = (struct buf *) malloc(sizeof(struct buf)); - if (!nbuf) { - lame_report_fnc(mp->report_err, "hip: addbuf() Out of memory!\n"); - return NULL; - } - nbuf->pnt = (unsigned char *) malloc((size_t) size); - if (!nbuf->pnt) { - free(nbuf); - return NULL; - } - nbuf->size = size; - memcpy(nbuf->pnt, buf, (size_t) size); - nbuf->next = NULL; - nbuf->prev = mp->head; - nbuf->pos = 0; - - if (!mp->tail) { - mp->tail = nbuf; - } - else { - mp->head->next = nbuf; - } - - mp->head = nbuf; - mp->bsize += size; - - return nbuf; -} - -void -remove_buf(PMPSTR mp) -{ - struct buf *buf = mp->tail; - - mp->tail = buf->next; - if (mp->tail) - mp->tail->prev = NULL; - else { - mp->tail = mp->head = NULL; - } - - free(buf->pnt); - free(buf); - -} - -static int -read_buf_byte(PMPSTR mp) -{ - unsigned int b; - - int pos; - - - pos = mp->tail->pos; - while (pos >= mp->tail->size) { - remove_buf(mp); - if (!mp->tail) { - lame_report_fnc(mp->report_err, "hip: Fatal error! tried to read past mp buffer\n"); - exit(1); - } - pos = mp->tail->pos; - } - - b = mp->tail->pnt[pos]; - mp->bsize--; - mp->tail->pos++; - - - return b; -} - - - -static void -read_head(PMPSTR mp) -{ - unsigned long head; - - head = read_buf_byte(mp); - head <<= 8; - head |= read_buf_byte(mp); - head <<= 8; - head |= read_buf_byte(mp); - head <<= 8; - head |= read_buf_byte(mp); - - mp->header = head; -} - - - - -static void -copy_mp(PMPSTR mp, int size, unsigned char *ptr) -{ - int len = 0; - - while (len < size && mp->tail) { - int nlen; - int blen = mp->tail->size - mp->tail->pos; - if ((size - len) <= blen) { - nlen = size - len; - } - else { - nlen = blen; - } - memcpy(ptr + len, mp->tail->pnt + mp->tail->pos, (size_t) nlen); - len += nlen; - mp->tail->pos += nlen; - mp->bsize -= nlen; - if (mp->tail->pos == mp->tail->size) { - remove_buf(mp); - } - } -} - -/* number of bytes needed by GetVbrTag to parse header */ -#define XING_HEADER_SIZE 194 - -/* -traverse mp data structure without changing it -(just like sync_buffer) -pull out Xing bytes -call vbr header check code from LAME -if we find a header, parse it and also compute the VBR header size -if no header, do nothing. - -bytes = number of bytes before MPEG header. skip this many bytes -before starting to read -return value: number of bytes in VBR header, including syncword -*/ -static int -check_vbr_header(PMPSTR mp, int bytes) -{ - int i, pos; - struct buf *buf = mp->tail; - unsigned char xing[XING_HEADER_SIZE]; - VBRTAGDATA pTagData; - - pos = buf->pos; - /* skip to valid header */ - for (i = 0; i < bytes; ++i) { - while (pos >= buf->size) { - buf = buf->next; - if (!buf) - return -1; /* fatal error */ - pos = buf->pos; - } - ++pos; - } - /* now read header */ - for (i = 0; i < XING_HEADER_SIZE; ++i) { - while (pos >= buf->size) { - buf = buf->next; - if (!buf) - return -1; /* fatal error */ - pos = buf->pos; - } - xing[i] = buf->pnt[pos]; - ++pos; - } - - /* check first bytes for Xing header */ - mp->vbr_header = GetVbrTag(&pTagData, xing); - if (mp->vbr_header) { - mp->num_frames = pTagData.frames; - mp->enc_delay = pTagData.enc_delay; - mp->enc_padding = pTagData.enc_padding; - - /* lame_report_fnc(mp->report_msg,"hip: delays: %i %i \n",mp->enc_delay,mp->enc_padding); */ - /* lame_report_fnc(mp->report_msg,"hip: Xing VBR header dectected. MP3 file has %i frames\n", pTagData.frames); */ - if (pTagData.headersize < 1) - return 1; - return pTagData.headersize; - } - return 0; -} - - - - - -static int -sync_buffer(PMPSTR mp, int free_match) -{ - /* traverse mp structure without modifying pointers, looking - * for a frame valid header. - * if free_format, valid header must also have the same - * samplerate. - * return number of bytes in mp, before the header - * return -1 if header is not found - */ - unsigned int b[4] = { 0, 0, 0, 0 }; - int i, h, pos; - struct buf *buf = mp->tail; - if (!buf) - return -1; - - pos = buf->pos; - for (i = 0; i < mp->bsize; i++) { - /* get 4 bytes */ - - b[0] = b[1]; - b[1] = b[2]; - b[2] = b[3]; - while (pos >= buf->size) { - buf = buf->next; - if (!buf) { - return -1; - /* not enough data to read 4 bytes */ - } - pos = buf->pos; - } - b[3] = buf->pnt[pos]; - ++pos; - - if (i >= 3) { - struct frame *fr = &mp->fr; - unsigned long head; - - head = b[0]; - head <<= 8; - head |= b[1]; - head <<= 8; - head |= b[2]; - head <<= 8; - head |= b[3]; - h = head_check(head, fr->lay); - - if (h && free_match) { - /* just to be even more thorough, match the sample rate */ - int mode, stereo, sampling_frequency, mpeg25, lsf; - - if (head & (1 << 20)) { - lsf = (head & (1 << 19)) ? 0x0 : 0x1; - mpeg25 = 0; - } - else { - lsf = 1; - mpeg25 = 1; - } - - mode = ((head >> 6) & 0x3); - stereo = (mode == MPG_MD_MONO) ? 1 : 2; - - if (mpeg25) - sampling_frequency = 6 + ((head >> 10) & 0x3); - else - sampling_frequency = ((head >> 10) & 0x3) + (lsf * 3); - h = ((stereo == fr->stereo) && (lsf == fr->lsf) && (mpeg25 == fr->mpeg25) && - (sampling_frequency == fr->sampling_frequency)); - } - - if (h) { - return i - 3; - } - } - } - return -1; -} - - -void -decode_reset(PMPSTR mp) -{ -#if 0 - remove_buf(mp); - /* start looking for next frame */ - /* mp->fsizeold = mp->framesize; */ - mp->fsizeold = -1; - mp->old_free_format = mp->free_format; - mp->framesize = 0; - mp->header_parsed = 0; - mp->side_parsed = 0; - mp->data_parsed = 0; - mp->sync_bitstream = 1; /* TODO check if this is right */ -#else - InitMP3(mp); /* Less error prone to just to reinitialise. */ -#endif -} - -int -audiodata_precedesframes(PMPSTR mp) -{ - if (mp->fr.lay == 3) - return layer3_audiodata_precedesframes(mp); - else - return 0; /* For Layer 1 & 2 the audio data starts at the frame that describes it, so no audio data precedes. */ -} - -static int -decodeMP3_clipchoice(PMPSTR mp, unsigned char *in, int isize, char *out, int *done, - int (*synth_1to1_mono_ptr) (PMPSTR, real *, unsigned char *, int *), - int (*synth_1to1_ptr) (PMPSTR, real *, int, unsigned char *, int *)) -{ - int i, iret, bits, bytes; - - if (in && isize && addbuf(mp, in, isize) == NULL) - return MP3_ERR; - - /* First decode header */ - if (!mp->header_parsed) { - - if (mp->fsizeold == -1 || mp->sync_bitstream) { - int vbrbytes; - mp->sync_bitstream = 0; - - /* This is the very first call. sync with anything */ - /* bytes= number of bytes before header */ - bytes = sync_buffer(mp, 0); - - /* now look for Xing VBR header */ - if (mp->bsize >= bytes + XING_HEADER_SIZE) { - /* vbrbytes = number of bytes in entire vbr header */ - vbrbytes = check_vbr_header(mp, bytes); - } - else { - /* not enough data to look for Xing header */ -#ifdef HIP_DEBUG - lame_report_fnc(mp->report_dbg, "hip: not enough data to look for Xing header\n"); -#endif - return MP3_NEED_MORE; - } - - if (mp->vbr_header) { - /* do we have enough data to parse entire Xing header? */ - if (bytes + vbrbytes > mp->bsize) { - /* lame_report_fnc(mp->report_err,"hip: not enough data to parse entire Xing header\n"); */ - return MP3_NEED_MORE; - } - - /* read in Xing header. Buffer data in case it - * is used by a non zero main_data_begin for the next - * frame, but otherwise dont decode Xing header */ -#ifdef HIP_DEBUG - lame_report_fnc(mp->report_dbg, "hip: found xing header, skipping %i bytes\n", vbrbytes + bytes); -#endif - for (i = 0; i < vbrbytes + bytes; ++i) - read_buf_byte(mp); - /* now we need to find another syncword */ - /* just return and make user send in more data */ - - return MP3_NEED_MORE; - } - } - else { - /* match channels, samplerate, etc, when syncing */ - bytes = sync_buffer(mp, 1); - } - - /* buffer now synchronized */ - if (bytes < 0) { - /* lame_report_fnc(mp->report_err,"hip: need more bytes %d\n", bytes); */ - return MP3_NEED_MORE; - } - if (bytes > 0) { - /* there were some extra bytes in front of header. - * bitstream problem, but we are now resynced - * should try to buffer previous data in case new - * frame has nonzero main_data_begin, but we need - * to make sure we do not overflow buffer - */ - int size; - if (mp->fsizeold != -1) { - lame_report_fnc(mp->report_err, "hip: bitstream problem, resyncing skipping %d bytes...\n", bytes); - } - mp->old_free_format = 0; -#if 1 - /* FIXME: correct ??? */ - mp->sync_bitstream = 1; -#endif - /* skip some bytes, buffer the rest */ - size = (int) (mp->wordpointer - (mp->bsspace[mp->bsnum] + 512)); - - if (size > MAXFRAMESIZE) { - /* wordpointer buffer is trashed. probably cant recover, but try anyway */ - lame_report_fnc(mp->report_err, "hip: wordpointer trashed. size=%i (%i) bytes=%i \n", - size, MAXFRAMESIZE, bytes); - size = 0; - mp->wordpointer = mp->bsspace[mp->bsnum] + 512; - } - - /* buffer contains 'size' data right now - we want to add 'bytes' worth of data, but do not - exceed MAXFRAMESIZE, so we through away 'i' bytes */ - i = (size + bytes) - MAXFRAMESIZE; - for (; i > 0; --i) { - --bytes; - read_buf_byte(mp); - } - - copy_mp(mp, bytes, mp->wordpointer); - mp->fsizeold += bytes; - } - - read_head(mp); - if (!decode_header(mp, &mp->fr, mp->header)) - return MP3_ERR; - mp->header_parsed = 1; - mp->framesize = mp->fr.framesize; - mp->free_format = (mp->framesize == 0); - - if (mp->fr.lsf) - mp->ssize = (mp->fr.stereo == 1) ? 9 : 17; - else - mp->ssize = (mp->fr.stereo == 1) ? 17 : 32; - if (mp->fr.error_protection) - mp->ssize += 2; - - mp->bsnum = 1 - mp->bsnum; /* toggle buffer */ - mp->wordpointer = mp->bsspace[mp->bsnum] + 512; - mp->bitindex = 0; - - /* for very first header, never parse rest of data */ - if (mp->fsizeold == -1) { -#ifdef HIP_DEBUG - lame_report_fnc(mp->report_dbg, "hip: not parsing the rest of the data of the first header\n"); -#endif - return MP3_NEED_MORE; - } - } /* end of header parsing block */ - - /* now decode side information */ - if (!mp->side_parsed) { - - /* Layer 3 only */ - if (mp->fr.lay == 3) { - if (mp->bsize < mp->ssize) - return MP3_NEED_MORE; - - copy_mp(mp, mp->ssize, mp->wordpointer); - - if (mp->fr.error_protection) - getbits(mp, 16); - bits = decode_layer3_sideinfo(mp); - /* bits = actual number of bits needed to parse this frame */ - /* can be negative, if all bits needed are in the reservoir */ - if (bits < 0) - bits = 0; - - /* read just as many bytes as necessary before decoding */ - mp->dsize = (bits + 7) / 8; - - if (!mp->free_format) { - /* do not read more than framsize data */ - int framesize = mp->fr.framesize - mp->ssize; - if (mp->dsize > framesize) { - lame_report_fnc(mp->report_err, - "hip: error audio data exceeds framesize by %d bytes\n", - mp->dsize - framesize); - mp->dsize = framesize; - } - } -#ifdef HIP_DEBUG - lame_report_fnc(mp->report_dbg, - "hip: %d bits needed to parse layer III frame, number of bytes to read before decoding dsize = %d\n", - bits, mp->dsize); -#endif - - /* this will force mpglib to read entire frame before decoding */ - /* mp->dsize= mp->framesize - mp->ssize; */ - - } - else { - /* Layers 1 and 2 */ - - /* check if there is enough input data */ - if (mp->fr.framesize > mp->bsize) - return MP3_NEED_MORE; - - /* takes care that the right amount of data is copied into wordpointer */ - mp->dsize = mp->fr.framesize; - mp->ssize = 0; - } - - mp->side_parsed = 1; - } - - /* now decode main data */ - iret = MP3_NEED_MORE; - if (!mp->data_parsed) { - if (mp->dsize > mp->bsize) { - return MP3_NEED_MORE; - } - - copy_mp(mp, mp->dsize, mp->wordpointer); - - *done = 0; - - /*do_layer3(&mp->fr,(unsigned char *) out,done); */ - switch (mp->fr.lay) { - case 1: - if (mp->fr.error_protection) - getbits(mp, 16); - - if (decode_layer1_frame(mp, (unsigned char *) out, done) < 0) - return MP3_ERR; - break; - - case 2: - if (mp->fr.error_protection) - getbits(mp, 16); - - decode_layer2_frame(mp, (unsigned char *) out, done); - break; - - case 3: - decode_layer3_frame(mp, (unsigned char *) out, done, synth_1to1_mono_ptr, synth_1to1_ptr); - break; - default: - lame_report_fnc(mp->report_err, "hip: invalid layer %d\n", mp->fr.lay); - } - - mp->wordpointer = mp->bsspace[mp->bsnum] + 512 + mp->ssize + mp->dsize; - - mp->data_parsed = 1; - iret = MP3_OK; - } - - - /* remaining bits are ancillary data, or reservoir for next frame - * If free format, scan stream looking for next frame to determine - * mp->framesize */ - if (mp->free_format) { - if (mp->old_free_format) { - /* free format. bitrate must not vary */ - mp->framesize = mp->fsizeold_nopadding + (mp->fr.padding); - } - else { - bytes = sync_buffer(mp, 1); - if (bytes < 0) - return iret; - mp->framesize = bytes + mp->ssize + mp->dsize; - mp->fsizeold_nopadding = mp->framesize - mp->fr.padding; -#if 0 - lame_report_fnc(mp->report_dbg,"hip: freeformat bitstream: estimated bitrate=%ikbs \n", - 8*(4+mp->framesize)*freqs[mp->fr.sampling_frequency]/ - (1000*576*(2-mp->fr.lsf))); -#endif - } - } - - /* buffer the ancillary data and reservoir for next frame */ - bytes = mp->framesize - (mp->ssize + mp->dsize); - if (bytes > mp->bsize) { - return iret; - } - - if (bytes > 0) { - int size; -#if 1 - /* FIXME: while loop OK ??? */ - while (bytes > 512) { - read_buf_byte(mp); - bytes--; - mp->framesize--; - } -#endif - copy_mp(mp, bytes, mp->wordpointer); - mp->wordpointer += bytes; - - size = (int) (mp->wordpointer - (mp->bsspace[mp->bsnum] + 512)); - if (size > MAXFRAMESIZE) { - lame_report_fnc(mp->report_err, "hip: fatal error. MAXFRAMESIZE not large enough.\n"); - } - - } - - /* the above frame is completely parsed. start looking for next frame */ - mp->fsizeold = mp->framesize; - mp->old_free_format = mp->free_format; - mp->framesize = 0; - mp->header_parsed = 0; - mp->side_parsed = 0; - mp->data_parsed = 0; - - return iret; -} - -int -decodeMP3(PMPSTR mp, unsigned char *in, int isize, char *out, int osize, int *done) -{ - if (osize < 4608) { - lame_report_fnc(mp->report_err, "hip: Insufficient memory for decoding buffer %d\n", osize); - return MP3_ERR; - } - - /* passing pointers to the functions which clip the samples */ - return decodeMP3_clipchoice(mp, in, isize, out, done, synth_1to1_mono, synth_1to1); -} - -int -decodeMP3_unclipped(PMPSTR mp, unsigned char *in, int isize, char *out, int osize, int *done) -{ - /* we forbid input with more than 1152 samples per channel for output in unclipped mode */ - if (osize < (int) (1152 * 2 * sizeof(real))) { - lame_report_fnc(mp->report_err, "hip: out space too small for unclipped mode\n"); - return MP3_ERR; - } - - /* passing pointers to the functions which don't clip the samples */ - return decodeMP3_clipchoice(mp, in, isize, out, done, synth_1to1_mono_unclipped, - synth_1to1_unclipped); -} diff --git a/lib-src/mpglib/interface.h b/lib-src/mpglib/interface.h deleted file mode 100644 index f713b4665..000000000 --- a/lib-src/mpglib/interface.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef INTERFACE_H_INCLUDED -#define INTERFACE_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -#include "common.h" - - int InitMP3(PMPSTR mp); - int decodeMP3(PMPSTR mp, unsigned char *inmemory, int inmemsize, char *outmemory, - int outmemsize, int *done); - void ExitMP3(PMPSTR mp); - -/* added decodeMP3_unclipped to support returning raw floating-point values of samples. The representation - of the floating-point numbers is defined in mpg123.h as #define real. It is 64-bit double by default. - No more than 1152 samples per channel are allowed. */ - int decodeMP3_unclipped(PMPSTR mp, unsigned char *inmemory, int inmemsize, char *outmemory, - int outmemsize, int *done); - -/* added remove_buf to support mpglib seeking */ - void remove_buf(PMPSTR mp); - -/* added audiodata_precedesframes to return the number of bitstream frames the audio data will precede the - current frame by for Layer 3 data. Aids seeking. - */ - int audiodata_precedesframes(PMPSTR mp); - -/* Resets decoding. Aids seeking. */ - void decode_reset(PMPSTR mp); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/lib-src/mpglib/junk/machine.h b/lib-src/mpglib/junk/machine.h deleted file mode 100644 index bf6fff21a..000000000 --- a/lib-src/mpglib/junk/machine.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Machine dependent defines/includes for LAME. - * - * Copyright (c) 1999 A.L. Faber - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef LAME_MACHINE_H -#define LAME_MACHINE_H - -#include "version.h" - -#include -#include - -#ifdef STDC_HEADERS -# include -# include -#else -# ifndef HAVE_STRCHR -# define strchr index -# define strrchr rindex -# endif -char *strchr(), *strrchr(); -# ifndef HAVE_MEMCPY -# define memcpy(d, s, n) bcopy ((s), (d), (n)) -# define memmove(d, s, n) bcopy ((s), (d), (n)) -# endif -#endif - -#if defined(__riscos__) && defined(FPA10) -# include "ymath.h" -#else -# include -#endif -#include - -#include - -#ifdef HAVE_ERRNO_H -# include -#endif -#ifdef HAVE_FCNTL_H -# include -#endif - -#if defined(macintosh) -# include -# include -#else -# include -# include -#endif - -#ifdef HAVE_INTTYPES_H -# include -#else -# ifdef HAVE_STDINT_H -# include -# endif -#endif - -#ifdef WITH_DMALLOC -#include -#endif - -/* - * 3 different types of pow() functions: - * - table lookup - * - pow() - * - exp() on some machines this is claimed to be faster than pow() - */ - -#define POW20(x) (assert(0 <= (x+Q_MAX2) && x < Q_MAX), pow20[x+Q_MAX2]) -/*#define POW20(x) pow(2.0,((double)(x)-210)*.25) */ -/*#define POW20(x) exp( ((double)(x)-210)*(.25*LOG2) ) */ - -#define IPOW20(x) (assert(0 <= x && x < Q_MAX), ipow20[x]) -/*#define IPOW20(x) exp( -((double)(x)-210)*.1875*LOG2 ) */ -/*#define IPOW20(x) pow(2.0,-((double)(x)-210)*.1875) */ - -/* in case this is used without configure */ -#ifndef inline -# define inline -#endif - -#if defined(_MSC_VER) -# undef inline -# define inline _inline -#elif defined(__SASC) || defined(__GNUC__) || defined(__ICC) || defined(__ECC) -/* if __GNUC__ we always want to inline, not only if the user requests it */ -# undef inline -# define inline __inline -#endif - -#if defined(_MSC_VER) -# pragma warning( disable : 4244 ) -/*# pragma warning( disable : 4305 ) */ -#endif - -/* - * FLOAT for variables which require at least 32 bits - * FLOAT8 for variables which require at least 64 bits - * - * On some machines, 64 bit will be faster than 32 bit. Also, some math - * routines require 64 bit float, so setting FLOAT=float will result in a - * lot of conversions. - */ - -#if ( defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__) ) -# define WIN32_LEAN_AND_MEAN -# include -# include -# define FLOAT_MAX FLT_MAX -#else -# ifndef FLOAT -typedef float FLOAT; -# ifdef FLT_MAX -# define FLOAT_MAX FLT_MAX -# else -# define FLOAT_MAX 1e37 /* approx */ -# endif -# endif -#endif - -#ifndef FLOAT8 -typedef double FLOAT8; -# ifdef DBL_MAX -# define FLOAT8_MAX DBL_MAX -# else -# define FLOAT8_MAX 1e99 /* approx */ -# endif -#else -# ifdef FLT_MAX -# define FLOAT8_MAX FLT_MAX -# else -# define FLOAT8_MAX 1e37 /* approx */ -# endif -#endif - -/* sample_t must be floating point, at least 32 bits */ -typedef FLOAT sample_t; - -#define dimension_of(array) (sizeof(array)/sizeof(array[0])) -#define beyond(array) (array+dimension_of(array)) -#define compiletime_assert(expression) enum{static_assert_##FILE##_##LINE = 1/((expression)?1:0)} -#define lame_calloc(TYPE, COUNT) ((TYPE*)calloc(COUNT, sizeof(TYPE))) -#define multiple_of(CHUNK, COUNT) (\ - ( (COUNT) < 1 || (CHUNK) < 1 || (COUNT) % (CHUNK) == 0 ) \ - ? (COUNT) \ - : ((COUNT) + (CHUNK) - (COUNT) % (CHUNK)) \ - ) - -#if 1 -#define EQ(a,b) (\ -(fabs(a) > fabs(b)) \ - ? (fabs((a)-(b)) <= (fabs(a) * 1e-6f)) \ - : (fabs((a)-(b)) <= (fabs(b) * 1e-6f))) -#else -#define EQ(a,b) (fabs((a)-(b))<1E-37) -#endif - -#define NEQ(a,b) (!EQ(a,b)) - -#ifdef _MSC_VER -# if _MSC_VER < 1400 -# define fabsf fabs -# define powf pow -# define log10f log10 -# endif -#endif - -#endif - -/* end of machine.h */ diff --git a/lib-src/mpglib/junk/version.h b/lib-src/mpglib/junk/version.h deleted file mode 100644 index f5fef508a..000000000 --- a/lib-src/mpglib/junk/version.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Version numbering for LAME. - * - * Copyright (c) 1999 A.L. Faber - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef LAME_VERSION_H -#define LAME_VERSION_H - - -/* - * To make a string from a token, use the # operator: - */ -#ifndef STR -# define __STR(x) #x -# define STR(x) __STR(x) -#endif - -# define LAME_URL "http://lame.sf.net" - - -# define LAME_MAJOR_VERSION 3 /* Major version number */ -# define LAME_MINOR_VERSION 100 /* Minor version number */ -# define LAME_TYPE_VERSION 2 /* 0:alpha 1:beta 2:release */ -# define LAME_PATCH_VERSION 0 /* Patch level */ -# define LAME_ALPHA_VERSION (LAME_TYPE_VERSION==0) -# define LAME_BETA_VERSION (LAME_TYPE_VERSION==1) -# define LAME_RELEASE_VERSION (LAME_TYPE_VERSION==2) - -# define PSY_MAJOR_VERSION 1 /* Major version number */ -# define PSY_MINOR_VERSION 0 /* Minor version number */ -# define PSY_ALPHA_VERSION 0 /* Set number if this is an alpha version, otherwise zero */ -# define PSY_BETA_VERSION 0 /* Set number if this is a beta version, otherwise zero */ - -#if LAME_ALPHA_VERSION -#define LAME_PATCH_LEVEL_STRING " alpha " STR(LAME_PATCH_VERSION) -#endif -#if LAME_BETA_VERSION -#define LAME_PATCH_LEVEL_STRING " beta " STR(LAME_PATCH_VERSION) -#endif -#if LAME_RELEASE_VERSION -#if LAME_PATCH_VERSION -#define LAME_PATCH_LEVEL_STRING " release " STR(LAME_PATCH_VERSION) -#else -#define LAME_PATCH_LEVEL_STRING "" -#endif -#endif - -# define LAME_VERSION_STRING STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) LAME_PATCH_LEVEL_STRING - -#endif /* LAME_VERSION_H */ - -/* End of version.h */ diff --git a/lib-src/mpglib/l2tables.h b/lib-src/mpglib/l2tables.h deleted file mode 100644 index 6a3deace2..000000000 --- a/lib-src/mpglib/l2tables.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Layer 2 Alloc tables .. - * most other tables are calculated on program start (which is (of course) - * not ISO-conform) .. - * Layer-3 huffman table is in huffman.h - */ - -const struct al_table2 alloc_0[] = { - {4, 0}, {5, 3}, {3, -3}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255}, {10, - -511}, - {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383}, {16, -32767}, - {4, 0}, {5, 3}, {3, -3}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255}, {10, - -511}, - {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383}, {16, -32767}, - {4, 0}, {5, 3}, {3, -3}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255}, {10, - -511}, - {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383}, {16, -32767}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {2, 0}, {5, 3}, {7, 5}, {16, -32767}, - {2, 0}, {5, 3}, {7, 5}, {16, -32767}, - {2, 0}, {5, 3}, {7, 5}, {16, -32767}, - {2, 0}, {5, 3}, {7, 5}, {16, -32767} -}; - -const struct al_table2 alloc_1[] = { - {4, 0}, {5, 3}, {3, -3}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255}, {10, - -511}, - {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383}, {16, -32767}, - {4, 0}, {5, 3}, {3, -3}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255}, {10, - -511}, - {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383}, {16, -32767}, - {4, 0}, {5, 3}, {3, -3}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255}, {10, - -511}, - {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383}, {16, -32767}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {3, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {16, -32767}, - {2, 0}, {5, 3}, {7, 5}, {16, -32767}, - {2, 0}, {5, 3}, {7, 5}, {16, -32767}, - {2, 0}, {5, 3}, {7, 5}, {16, -32767}, - {2, 0}, {5, 3}, {7, 5}, {16, -32767}, - {2, 0}, {5, 3}, {7, 5}, {16, -32767}, - {2, 0}, {5, 3}, {7, 5}, {16, -32767}, - {2, 0}, {5, 3}, {7, 5}, {16, -32767} -}; - -const struct al_table2 alloc_2[] = { - {4, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255}, - {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383}, - {4, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255}, - {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63} -}; - -const struct al_table2 alloc_3[] = { - {4, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255}, - {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383}, - {4, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, {9, -255}, - {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, {15, -16383}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63} -}; - -const struct al_table2 alloc_4[] = { - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, - {4, 0}, {5, 3}, {7, 5}, {3, -3}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, {8, -127}, - {9, -255}, {10, -511}, {11, -1023}, {12, -2047}, {13, -4095}, {14, -8191}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {3, 0}, {5, 3}, {7, 5}, {10, 9}, {4, -7}, {5, -15}, {6, -31}, {7, -63}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9}, - {2, 0}, {5, 3}, {7, 5}, {10, 9} -}; diff --git a/lib-src/mpglib/lame.h b/lib-src/mpglib/lame.h deleted file mode 100644 index 5196690ff..000000000 --- a/lib-src/mpglib/lame.h +++ /dev/null @@ -1,1342 +0,0 @@ -/* - * Interface to MP3 LAME encoding engine - * - * Copyright (c) 1999 Mark Taylor - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* $Id: lame.h,v 1.192 2017/08/31 14:14:46 robert Exp $ */ - -#ifndef LAME_LAME_H -#define LAME_LAME_H - -/* for size_t typedef */ -#include -/* for va_list typedef */ -#include -/* for FILE typedef, TODO: remove when removing lame_mp3_tags_fid */ -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -typedef void (*lame_report_function)(const char *format, va_list ap); - -#if defined(WIN32) || defined(_WIN32) -#undef CDECL -#define CDECL __cdecl -#else -#define CDECL -#endif - -#define DEPRECATED_OR_OBSOLETE_CODE_REMOVED 1 - -typedef enum vbr_mode_e { - vbr_off=0, - vbr_mt, /* obsolete, same as vbr_mtrh */ - vbr_rh, - vbr_abr, - vbr_mtrh, - vbr_max_indicator, /* Don't use this! It's used for sanity checks. */ - vbr_default=vbr_mtrh /* change this to change the default VBR mode of LAME */ -} vbr_mode; - - -/* MPEG modes */ -typedef enum MPEG_mode_e { - STEREO = 0, - JOINT_STEREO, - DUAL_CHANNEL, /* LAME doesn't supports this! */ - MONO, - NOT_SET, - MAX_INDICATOR /* Don't use this! It's used for sanity checks. */ -} MPEG_mode; - -/* Padding types */ -typedef enum Padding_type_e { - PAD_NO = 0, - PAD_ALL, - PAD_ADJUST, - PAD_MAX_INDICATOR /* Don't use this! It's used for sanity checks. */ -} Padding_type; - - - -/*presets*/ -typedef enum preset_mode_e { - /*values from 8 to 320 should be reserved for abr bitrates*/ - /*for abr I'd suggest to directly use the targeted bitrate as a value*/ - ABR_8 = 8, - ABR_320 = 320, - - V9 = 410, /*Vx to match Lame and VBR_xx to match FhG*/ - VBR_10 = 410, - V8 = 420, - VBR_20 = 420, - V7 = 430, - VBR_30 = 430, - V6 = 440, - VBR_40 = 440, - V5 = 450, - VBR_50 = 450, - V4 = 460, - VBR_60 = 460, - V3 = 470, - VBR_70 = 470, - V2 = 480, - VBR_80 = 480, - V1 = 490, - VBR_90 = 490, - V0 = 500, - VBR_100 = 500, - - - - /*still there for compatibility*/ - R3MIX = 1000, - STANDARD = 1001, - EXTREME = 1002, - INSANE = 1003, - STANDARD_FAST = 1004, - EXTREME_FAST = 1005, - MEDIUM = 1006, - MEDIUM_FAST = 1007 -} preset_mode; - - -/*asm optimizations*/ -typedef enum asm_optimizations_e { - MMX = 1, - AMD_3DNOW = 2, - SSE = 3 -} asm_optimizations; - - -/* psychoacoustic model */ -typedef enum Psy_model_e { - PSY_GPSYCHO = 1, - PSY_NSPSYTUNE = 2 -} Psy_model; - - -/* buffer considerations */ -typedef enum buffer_constraint_e { - MDB_DEFAULT=0, - MDB_STRICT_ISO=1, - MDB_MAXIMUM=2 -} buffer_constraint; - - -struct lame_global_struct; -typedef struct lame_global_struct lame_global_flags; -typedef lame_global_flags *lame_t; - - - - -/*********************************************************************** - * - * The LAME API - * These functions should be called, in this order, for each - * MP3 file to be encoded. See the file "API" for more documentation - * - ***********************************************************************/ - - -/* - * REQUIRED: - * initialize the encoder. sets default for all encoder parameters, - * returns NULL if some malloc()'s failed - * otherwise returns pointer to structure needed for all future - * API calls. - */ -lame_global_flags * CDECL lame_init(void); -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* obsolete version */ -int CDECL lame_init_old(lame_global_flags *); -#endif - -/* - * OPTIONAL: - * set as needed to override defaults - */ - -/******************************************************************** - * input stream description - ***********************************************************************/ -/* number of samples. default = 2^32-1 */ -int CDECL lame_set_num_samples(lame_global_flags *, unsigned long); -unsigned long CDECL lame_get_num_samples(const lame_global_flags *); - -/* input sample rate in Hz. default = 44100hz */ -int CDECL lame_set_in_samplerate(lame_global_flags *, int); -int CDECL lame_get_in_samplerate(const lame_global_flags *); - -/* number of channels in input stream. default=2 */ -int CDECL lame_set_num_channels(lame_global_flags *, int); -int CDECL lame_get_num_channels(const lame_global_flags *); - -/* - scale the input by this amount before encoding. default=1 - (not used by decoding routines) -*/ -int CDECL lame_set_scale(lame_global_flags *, float); -float CDECL lame_get_scale(const lame_global_flags *); - -/* - scale the channel 0 (left) input by this amount before encoding. default=1 - (not used by decoding routines) -*/ -int CDECL lame_set_scale_left(lame_global_flags *, float); -float CDECL lame_get_scale_left(const lame_global_flags *); - -/* - scale the channel 1 (right) input by this amount before encoding. default=1 - (not used by decoding routines) -*/ -int CDECL lame_set_scale_right(lame_global_flags *, float); -float CDECL lame_get_scale_right(const lame_global_flags *); - -/* - output sample rate in Hz. default = 0, which means LAME picks best value - based on the amount of compression. MPEG only allows: - MPEG1 32, 44.1, 48khz - MPEG2 16, 22.05, 24 - MPEG2.5 8, 11.025, 12 - (not used by decoding routines) -*/ -int CDECL lame_set_out_samplerate(lame_global_flags *, int); -int CDECL lame_get_out_samplerate(const lame_global_flags *); - - -/******************************************************************** - * general control parameters - ***********************************************************************/ -/* 1=cause LAME to collect data for an MP3 frame analyzer. default=0 */ -int CDECL lame_set_analysis(lame_global_flags *, int); -int CDECL lame_get_analysis(const lame_global_flags *); - -/* - 1 = write a Xing VBR header frame. - default = 1 - this variable must have been added by a Hungarian notation Windows programmer :-) -*/ -int CDECL lame_set_bWriteVbrTag(lame_global_flags *, int); -int CDECL lame_get_bWriteVbrTag(const lame_global_flags *); - -/* 1=decode only. use lame/mpglib to convert mp3/ogg to wav. default=0 */ -int CDECL lame_set_decode_only(lame_global_flags *, int); -int CDECL lame_get_decode_only(const lame_global_flags *); - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* 1=encode a Vorbis .ogg file. default=0 */ -/* DEPRECATED */ -int CDECL lame_set_ogg(lame_global_flags *, int); -int CDECL lame_get_ogg(const lame_global_flags *); -#endif - -/* - internal algorithm selection. True quality is determined by the bitrate - but this variable will effect quality by selecting expensive or cheap algorithms. - quality=0..9. 0=best (very slow). 9=worst. - recommended: 2 near-best quality, not too slow - 5 good quality, fast - 7 ok quality, really fast -*/ -int CDECL lame_set_quality(lame_global_flags *, int); -int CDECL lame_get_quality(const lame_global_flags *); - -/* - mode = 0,1,2,3 = stereo, jstereo, dual channel (not supported), mono - default: lame picks based on compression ration and input channels -*/ -int CDECL lame_set_mode(lame_global_flags *, MPEG_mode); -MPEG_mode CDECL lame_get_mode(const lame_global_flags *); - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* - mode_automs. Use a M/S mode with a switching threshold based on - compression ratio - DEPRECATED -*/ -int CDECL lame_set_mode_automs(lame_global_flags *, int); -int CDECL lame_get_mode_automs(const lame_global_flags *); -#endif - -/* - force_ms. Force M/S for all frames. For testing only. - default = 0 (disabled) -*/ -int CDECL lame_set_force_ms(lame_global_flags *, int); -int CDECL lame_get_force_ms(const lame_global_flags *); - -/* use free_format? default = 0 (disabled) */ -int CDECL lame_set_free_format(lame_global_flags *, int); -int CDECL lame_get_free_format(const lame_global_flags *); - -/* perform ReplayGain analysis? default = 0 (disabled) */ -int CDECL lame_set_findReplayGain(lame_global_flags *, int); -int CDECL lame_get_findReplayGain(const lame_global_flags *); - -/* decode on the fly. Search for the peak sample. If the ReplayGain - * analysis is enabled then perform the analysis on the decoded data - * stream. default = 0 (disabled) - * NOTE: if this option is set the build-in decoder should not be used */ -int CDECL lame_set_decode_on_the_fly(lame_global_flags *, int); -int CDECL lame_get_decode_on_the_fly(const lame_global_flags *); - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* DEPRECATED: now does the same as lame_set_findReplayGain() - default = 0 (disabled) */ -int CDECL lame_set_ReplayGain_input(lame_global_flags *, int); -int CDECL lame_get_ReplayGain_input(const lame_global_flags *); - -/* DEPRECATED: now does the same as - lame_set_decode_on_the_fly() && lame_set_findReplayGain() - default = 0 (disabled) */ -int CDECL lame_set_ReplayGain_decode(lame_global_flags *, int); -int CDECL lame_get_ReplayGain_decode(const lame_global_flags *); - -/* DEPRECATED: now does the same as lame_set_decode_on_the_fly() - default = 0 (disabled) */ -int CDECL lame_set_findPeakSample(lame_global_flags *, int); -int CDECL lame_get_findPeakSample(const lame_global_flags *); -#endif - -/* counters for gapless encoding */ -int CDECL lame_set_nogap_total(lame_global_flags*, int); -int CDECL lame_get_nogap_total(const lame_global_flags*); - -int CDECL lame_set_nogap_currentindex(lame_global_flags* , int); -int CDECL lame_get_nogap_currentindex(const lame_global_flags*); - - -/* - * OPTIONAL: - * Set printf like error/debug/message reporting functions. - * The second argument has to be a pointer to a function which looks like - * void my_debugf(const char *format, va_list ap) - * { - * (void) vfprintf(stdout, format, ap); - * } - * If you use NULL as the value of the pointer in the set function, the - * lame buildin function will be used (prints to stderr). - * To quiet any output you have to replace the body of the example function - * with just "return;" and use it in the set function. - */ -int CDECL lame_set_errorf(lame_global_flags *, lame_report_function); -int CDECL lame_set_debugf(lame_global_flags *, lame_report_function); -int CDECL lame_set_msgf (lame_global_flags *, lame_report_function); - - - -/* set one of brate compression ratio. default is compression ratio of 11. */ -int CDECL lame_set_brate(lame_global_flags *, int); -int CDECL lame_get_brate(const lame_global_flags *); -int CDECL lame_set_compression_ratio(lame_global_flags *, float); -float CDECL lame_get_compression_ratio(const lame_global_flags *); - - -int CDECL lame_set_preset( lame_global_flags* gfp, int ); -int CDECL lame_set_asm_optimizations( lame_global_flags* gfp, int, int ); - - - -/******************************************************************** - * frame params - ***********************************************************************/ -/* mark as copyright. default=0 */ -int CDECL lame_set_copyright(lame_global_flags *, int); -int CDECL lame_get_copyright(const lame_global_flags *); - -/* mark as original. default=1 */ -int CDECL lame_set_original(lame_global_flags *, int); -int CDECL lame_get_original(const lame_global_flags *); - -/* error_protection. Use 2 bytes from each frame for CRC checksum. default=0 */ -int CDECL lame_set_error_protection(lame_global_flags *, int); -int CDECL lame_get_error_protection(const lame_global_flags *); - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* padding_type. 0=pad no frames 1=pad all frames 2=adjust padding(default) */ -int CDECL lame_set_padding_type(lame_global_flags *, Padding_type); -Padding_type CDECL lame_get_padding_type(const lame_global_flags *); -#endif - -/* MP3 'private extension' bit Meaningless. default=0 */ -int CDECL lame_set_extension(lame_global_flags *, int); -int CDECL lame_get_extension(const lame_global_flags *); - -/* enforce strict ISO compliance. default=0 */ -int CDECL lame_set_strict_ISO(lame_global_flags *, int); -int CDECL lame_get_strict_ISO(const lame_global_flags *); - - -/******************************************************************** - * quantization/noise shaping - ***********************************************************************/ - -/* disable the bit reservoir. For testing only. default=0 */ -int CDECL lame_set_disable_reservoir(lame_global_flags *, int); -int CDECL lame_get_disable_reservoir(const lame_global_flags *); - -/* select a different "best quantization" function. default=0 */ -int CDECL lame_set_quant_comp(lame_global_flags *, int); -int CDECL lame_get_quant_comp(const lame_global_flags *); -int CDECL lame_set_quant_comp_short(lame_global_flags *, int); -int CDECL lame_get_quant_comp_short(const lame_global_flags *); - -int CDECL lame_set_experimentalX(lame_global_flags *, int); /* compatibility*/ -int CDECL lame_get_experimentalX(const lame_global_flags *); - -/* another experimental option. for testing only */ -int CDECL lame_set_experimentalY(lame_global_flags *, int); -int CDECL lame_get_experimentalY(const lame_global_flags *); - -/* another experimental option. for testing only */ -int CDECL lame_set_experimentalZ(lame_global_flags *, int); -int CDECL lame_get_experimentalZ(const lame_global_flags *); - -/* Naoki's psycho acoustic model. default=0 */ -int CDECL lame_set_exp_nspsytune(lame_global_flags *, int); -int CDECL lame_get_exp_nspsytune(const lame_global_flags *); - -void CDECL lame_set_msfix(lame_global_flags *, double); -float CDECL lame_get_msfix(const lame_global_flags *); - - -/******************************************************************** - * VBR control - ***********************************************************************/ -/* Types of VBR. default = vbr_off = CBR */ -int CDECL lame_set_VBR(lame_global_flags *, vbr_mode); -vbr_mode CDECL lame_get_VBR(const lame_global_flags *); - -/* VBR quality level. 0=highest 9=lowest */ -int CDECL lame_set_VBR_q(lame_global_flags *, int); -int CDECL lame_get_VBR_q(const lame_global_flags *); - -/* VBR quality level. 0=highest 9=lowest, Range [0,...,10[ */ -int CDECL lame_set_VBR_quality(lame_global_flags *, float); -float CDECL lame_get_VBR_quality(const lame_global_flags *); - -/* Ignored except for VBR=vbr_abr (ABR mode) */ -int CDECL lame_set_VBR_mean_bitrate_kbps(lame_global_flags *, int); -int CDECL lame_get_VBR_mean_bitrate_kbps(const lame_global_flags *); - -int CDECL lame_set_VBR_min_bitrate_kbps(lame_global_flags *, int); -int CDECL lame_get_VBR_min_bitrate_kbps(const lame_global_flags *); - -int CDECL lame_set_VBR_max_bitrate_kbps(lame_global_flags *, int); -int CDECL lame_get_VBR_max_bitrate_kbps(const lame_global_flags *); - -/* - 1=strictly enforce VBR_min_bitrate. Normally it will be violated for - analog silence -*/ -int CDECL lame_set_VBR_hard_min(lame_global_flags *, int); -int CDECL lame_get_VBR_hard_min(const lame_global_flags *); - -/* for preset */ -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -int CDECL lame_set_preset_expopts(lame_global_flags *, int); -#endif - -/******************************************************************** - * Filtering control - ***********************************************************************/ -/* freq in Hz to apply lowpass. Default = 0 = lame chooses. -1 = disabled */ -int CDECL lame_set_lowpassfreq(lame_global_flags *, int); -int CDECL lame_get_lowpassfreq(const lame_global_flags *); -/* width of transition band, in Hz. Default = one polyphase filter band */ -int CDECL lame_set_lowpasswidth(lame_global_flags *, int); -int CDECL lame_get_lowpasswidth(const lame_global_flags *); - -/* freq in Hz to apply highpass. Default = 0 = lame chooses. -1 = disabled */ -int CDECL lame_set_highpassfreq(lame_global_flags *, int); -int CDECL lame_get_highpassfreq(const lame_global_flags *); -/* width of transition band, in Hz. Default = one polyphase filter band */ -int CDECL lame_set_highpasswidth(lame_global_flags *, int); -int CDECL lame_get_highpasswidth(const lame_global_flags *); - - -/******************************************************************** - * psycho acoustics and other arguments which you should not change - * unless you know what you are doing - ***********************************************************************/ - -/* only use ATH for masking */ -int CDECL lame_set_ATHonly(lame_global_flags *, int); -int CDECL lame_get_ATHonly(const lame_global_flags *); - -/* only use ATH for short blocks */ -int CDECL lame_set_ATHshort(lame_global_flags *, int); -int CDECL lame_get_ATHshort(const lame_global_flags *); - -/* disable ATH */ -int CDECL lame_set_noATH(lame_global_flags *, int); -int CDECL lame_get_noATH(const lame_global_flags *); - -/* select ATH formula */ -int CDECL lame_set_ATHtype(lame_global_flags *, int); -int CDECL lame_get_ATHtype(const lame_global_flags *); - -/* lower ATH by this many db */ -int CDECL lame_set_ATHlower(lame_global_flags *, float); -float CDECL lame_get_ATHlower(const lame_global_flags *); - -/* select ATH adaptive adjustment type */ -int CDECL lame_set_athaa_type( lame_global_flags *, int); -int CDECL lame_get_athaa_type( const lame_global_flags *); - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* select the loudness approximation used by the ATH adaptive auto-leveling */ -int CDECL lame_set_athaa_loudapprox( lame_global_flags *, int); -int CDECL lame_get_athaa_loudapprox( const lame_global_flags *); -#endif - -/* adjust (in dB) the point below which adaptive ATH level adjustment occurs */ -int CDECL lame_set_athaa_sensitivity( lame_global_flags *, float); -float CDECL lame_get_athaa_sensitivity( const lame_global_flags* ); - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* OBSOLETE: predictability limit (ISO tonality formula) */ -int CDECL lame_set_cwlimit(lame_global_flags *, int); -int CDECL lame_get_cwlimit(const lame_global_flags *); -#endif - -/* - allow blocktypes to differ between channels? - default: 0 for jstereo, 1 for stereo -*/ -int CDECL lame_set_allow_diff_short(lame_global_flags *, int); -int CDECL lame_get_allow_diff_short(const lame_global_flags *); - -/* use temporal masking effect (default = 1) */ -int CDECL lame_set_useTemporal(lame_global_flags *, int); -int CDECL lame_get_useTemporal(const lame_global_flags *); - -/* use temporal masking effect (default = 1) */ -int CDECL lame_set_interChRatio(lame_global_flags *, float); -float CDECL lame_get_interChRatio(const lame_global_flags *); - -/* disable short blocks */ -int CDECL lame_set_no_short_blocks(lame_global_flags *, int); -int CDECL lame_get_no_short_blocks(const lame_global_flags *); - -/* force short blocks */ -int CDECL lame_set_force_short_blocks(lame_global_flags *, int); -int CDECL lame_get_force_short_blocks(const lame_global_flags *); - -/* Input PCM is emphased PCM (for instance from one of the rarely - emphased CDs), it is STRONGLY not recommended to use this, because - psycho does not take it into account, and last but not least many decoders - ignore these bits */ -int CDECL lame_set_emphasis(lame_global_flags *, int); -int CDECL lame_get_emphasis(const lame_global_flags *); - - - -/************************************************************************/ -/* internal variables, cannot be set... */ -/* provided because they may be of use to calling application */ -/************************************************************************/ -/* version 0=MPEG-2 1=MPEG-1 (2=MPEG-2.5) */ -int CDECL lame_get_version(const lame_global_flags *); - -/* encoder delay */ -int CDECL lame_get_encoder_delay(const lame_global_flags *); - -/* - padding appended to the input to make sure decoder can fully decode - all input. Note that this value can only be calculated during the - call to lame_encoder_flush(). Before lame_encoder_flush() has - been called, the value of encoder_padding = 0. -*/ -int CDECL lame_get_encoder_padding(const lame_global_flags *); - -/* size of MPEG frame */ -int CDECL lame_get_framesize(const lame_global_flags *); - -/* number of PCM samples buffered, but not yet encoded to mp3 data. */ -int CDECL lame_get_mf_samples_to_encode( const lame_global_flags* gfp ); - -/* - size (bytes) of mp3 data buffered, but not yet encoded. - this is the number of bytes which would be output by a call to - lame_encode_flush_nogap. NOTE: lame_encode_flush() will return - more bytes than this because it will encode the reamining buffered - PCM samples before flushing the mp3 buffers. -*/ -int CDECL lame_get_size_mp3buffer( const lame_global_flags* gfp ); - -/* number of frames encoded so far */ -int CDECL lame_get_frameNum(const lame_global_flags *); - -/* - lame's estimate of the total number of frames to be encoded - only valid if calling program set num_samples -*/ -int CDECL lame_get_totalframes(const lame_global_flags *); - -/* RadioGain value. Multiplied by 10 and rounded to the nearest. */ -int CDECL lame_get_RadioGain(const lame_global_flags *); - -/* AudiophileGain value. Multipled by 10 and rounded to the nearest. */ -int CDECL lame_get_AudiophileGain(const lame_global_flags *); - -/* the peak sample */ -float CDECL lame_get_PeakSample(const lame_global_flags *); - -/* Gain change required for preventing clipping. The value is correct only if - peak sample searching was enabled. If negative then the waveform - already does not clip. The value is multiplied by 10 and rounded up. */ -int CDECL lame_get_noclipGainChange(const lame_global_flags *); - -/* user-specified scale factor required for preventing clipping. Value is - correct only if peak sample searching was enabled and no user-specified - scaling was performed. If negative then either the waveform already does - not clip or the value cannot be determined */ -float CDECL lame_get_noclipScale(const lame_global_flags *); - -/* returns the limit of PCM samples, which one can pass in an encode call - under the constrain of a provided buffer of size buffer_size */ -int CDECL lame_get_maximum_number_of_samples(lame_t gfp, size_t buffer_size); - - - - -/* - * REQUIRED: - * sets more internal configuration based on data provided above. - * returns -1 if something failed. - */ -int CDECL lame_init_params(lame_global_flags *); - - -/* - * OPTIONAL: - * get the version number, in a string. of the form: - * "3.63 (beta)" or just "3.63". - */ -const char* CDECL get_lame_version ( void ); -const char* CDECL get_lame_short_version ( void ); -const char* CDECL get_lame_very_short_version ( void ); -const char* CDECL get_psy_version ( void ); -const char* CDECL get_lame_url ( void ); -const char* CDECL get_lame_os_bitness ( void ); - -/* - * OPTIONAL: - * get the version numbers in numerical form. - */ -typedef struct { - /* generic LAME version */ - int major; - int minor; - int alpha; /* 0 if not an alpha version */ - int beta; /* 0 if not a beta version */ - - /* version of the psy model */ - int psy_major; - int psy_minor; - int psy_alpha; /* 0 if not an alpha version */ - int psy_beta; /* 0 if not a beta version */ - - /* compile time features */ - const char *features; /* Don't make assumptions about the contents! */ -} lame_version_t; -void CDECL get_lame_version_numerical(lame_version_t *); - - -/* - * OPTIONAL: - * print internal lame configuration to message handler - */ -void CDECL lame_print_config(const lame_global_flags* gfp); - -void CDECL lame_print_internals( const lame_global_flags *gfp); - - -/* - * input pcm data, output (maybe) mp3 frames. - * This routine handles all buffering, resampling and filtering for you. - * - * return code number of bytes output in mp3buf. Can be 0 - * -1: mp3buf was too small - * -2: malloc() problem - * -3: lame_init_params() not called - * -4: psycho acoustic problems - * - * The required mp3buf_size can be computed from num_samples, - * samplerate and encoding rate, but here is a worst case estimate: - * - * mp3buf_size in bytes = 1.25*num_samples + 7200 - * - * I think a tighter bound could be: (mt, March 2000) - * MPEG1: - * num_samples*(bitrate/8)/samplerate + 4*1152*(bitrate/8)/samplerate + 512 - * MPEG2: - * num_samples*(bitrate/8)/samplerate + 4*576*(bitrate/8)/samplerate + 256 - * - * but test first if you use that! - * - * set mp3buf_size = 0 and LAME will not check if mp3buf_size is - * large enough. - * - * NOTE: - * if gfp->num_channels=2, but gfp->mode = 3 (mono), the L & R channels - * will be averaged into the L channel before encoding only the L channel - * This will overwrite the data in buffer_l[] and buffer_r[]. - * -*/ -int CDECL lame_encode_buffer ( - lame_global_flags* gfp, /* global context handle */ - const short int buffer_l [], /* PCM data for left channel */ - const short int buffer_r [], /* PCM data for right channel */ - const int nsamples, /* number of samples per channel */ - unsigned char* mp3buf, /* pointer to encoded MP3 stream */ - const int mp3buf_size ); /* number of valid octets in this - stream */ - -/* - * as above, but input has L & R channel data interleaved. - * NOTE: - * num_samples = number of samples in the L (or R) - * channel, not the total number of samples in pcm[] - */ -int CDECL lame_encode_buffer_interleaved( - lame_global_flags* gfp, /* global context handlei */ - short int pcm[], /* PCM data for left and right - channel, interleaved */ - int num_samples, /* number of samples per channel, - _not_ number of samples in - pcm[] */ - unsigned char* mp3buf, /* pointer to encoded MP3 stream */ - int mp3buf_size ); /* number of valid octets in this - stream */ - - -/* as lame_encode_buffer, but for 'float's. - * !! NOTE: !! data must still be scaled to be in the same range as - * short int, +/- 32768 - */ -int CDECL lame_encode_buffer_float( - lame_global_flags* gfp, /* global context handle */ - const float pcm_l [], /* PCM data for left channel */ - const float pcm_r [], /* PCM data for right channel */ - const int nsamples, /* number of samples per channel */ - unsigned char* mp3buf, /* pointer to encoded MP3 stream */ - const int mp3buf_size ); /* number of valid octets in this - stream */ - -/* as lame_encode_buffer, but for 'float's. - * !! NOTE: !! data must be scaled to +/- 1 full scale - */ -int CDECL lame_encode_buffer_ieee_float( - lame_t gfp, - const float pcm_l [], /* PCM data for left channel */ - const float pcm_r [], /* PCM data for right channel */ - const int nsamples, - unsigned char * mp3buf, - const int mp3buf_size); -int CDECL lame_encode_buffer_interleaved_ieee_float( - lame_t gfp, - const float pcm[], /* PCM data for left and right - channel, interleaved */ - const int nsamples, - unsigned char * mp3buf, - const int mp3buf_size); - -/* as lame_encode_buffer, but for 'double's. - * !! NOTE: !! data must be scaled to +/- 1 full scale - */ -int CDECL lame_encode_buffer_ieee_double( - lame_t gfp, - const double pcm_l [], /* PCM data for left channel */ - const double pcm_r [], /* PCM data for right channel */ - const int nsamples, - unsigned char * mp3buf, - const int mp3buf_size); -int CDECL lame_encode_buffer_interleaved_ieee_double( - lame_t gfp, - const double pcm[], /* PCM data for left and right - channel, interleaved */ - const int nsamples, - unsigned char * mp3buf, - const int mp3buf_size); - -/* as lame_encode_buffer, but for long's - * !! NOTE: !! data must still be scaled to be in the same range as - * short int, +/- 32768 - * - * This scaling was a mistake (doesn't allow one to exploit full - * precision of type 'long'. Use lame_encode_buffer_long2() instead. - * - */ -int CDECL lame_encode_buffer_long( - lame_global_flags* gfp, /* global context handle */ - const long buffer_l [], /* PCM data for left channel */ - const long buffer_r [], /* PCM data for right channel */ - const int nsamples, /* number of samples per channel */ - unsigned char* mp3buf, /* pointer to encoded MP3 stream */ - const int mp3buf_size ); /* number of valid octets in this - stream */ - -/* Same as lame_encode_buffer_long(), but with correct scaling. - * !! NOTE: !! data must still be scaled to be in the same range as - * type 'long'. Data should be in the range: +/- 2^(8*size(long)-1) - * - */ -int CDECL lame_encode_buffer_long2( - lame_global_flags* gfp, /* global context handle */ - const long buffer_l [], /* PCM data for left channel */ - const long buffer_r [], /* PCM data for right channel */ - const int nsamples, /* number of samples per channel */ - unsigned char* mp3buf, /* pointer to encoded MP3 stream */ - const int mp3buf_size ); /* number of valid octets in this - stream */ - -/* as lame_encode_buffer, but for int's - * !! NOTE: !! input should be scaled to the maximum range of 'int' - * If int is 4 bytes, then the values should range from - * +/- 2147483648. - * - * This routine does not (and cannot, without loosing precision) use - * the same scaling as the rest of the lame_encode_buffer() routines. - * - */ -int CDECL lame_encode_buffer_int( - lame_global_flags* gfp, /* global context handle */ - const int buffer_l [], /* PCM data for left channel */ - const int buffer_r [], /* PCM data for right channel */ - const int nsamples, /* number of samples per channel */ - unsigned char* mp3buf, /* pointer to encoded MP3 stream */ - const int mp3buf_size ); /* number of valid octets in this - stream */ - -/* - * as above, but for interleaved data. - * !! NOTE: !! data must still be scaled to be in the same range as - * type 'int32_t'. Data should be in the range: +/- 2^(8*size(int32_t)-1) - * NOTE: - * num_samples = number of samples in the L (or R) - * channel, not the total number of samples in pcm[] - */ -int -lame_encode_buffer_interleaved_int( - lame_t gfp, - const int pcm [], /* PCM data for left and right - channel, interleaved */ - const int nsamples, /* number of samples per channel, - _not_ number of samples in - pcm[] */ - unsigned char* mp3buf, /* pointer to encoded MP3 stream */ - const int mp3buf_size ); /* number of valid octets in this - stream */ - - - -/* - * REQUIRED: - * lame_encode_flush will flush the intenal PCM buffers, padding with - * 0's to make sure the final frame is complete, and then flush - * the internal MP3 buffers, and thus may return a - * final few mp3 frames. 'mp3buf' should be at least 7200 bytes long - * to hold all possible emitted data. - * - * will also write id3v1 tags (if any) into the bitstream - * - * return code = number of bytes output to mp3buf. Can be 0 - */ -int CDECL lame_encode_flush( - lame_global_flags * gfp, /* global context handle */ - unsigned char* mp3buf, /* pointer to encoded MP3 stream */ - int size); /* number of valid octets in this stream */ - -/* - * OPTIONAL: - * lame_encode_flush_nogap will flush the internal mp3 buffers and pad - * the last frame with ancillary data so it is a complete mp3 frame. - * - * 'mp3buf' should be at least 7200 bytes long - * to hold all possible emitted data. - * - * After a call to this routine, the outputed mp3 data is complete, but - * you may continue to encode new PCM samples and write future mp3 data - * to a different file. The two mp3 files will play back with no gaps - * if they are concatenated together. - * - * This routine will NOT write id3v1 tags into the bitstream. - * - * return code = number of bytes output to mp3buf. Can be 0 - */ -int CDECL lame_encode_flush_nogap( - lame_global_flags * gfp, /* global context handle */ - unsigned char* mp3buf, /* pointer to encoded MP3 stream */ - int size); /* number of valid octets in this stream */ - -/* - * OPTIONAL: - * Normally, this is called by lame_init_params(). It writes id3v2 and - * Xing headers into the front of the bitstream, and sets frame counters - * and bitrate histogram data to 0. You can also call this after - * lame_encode_flush_nogap(). - */ -int CDECL lame_init_bitstream( - lame_global_flags * gfp); /* global context handle */ - - - -/* - * OPTIONAL: some simple statistics - * a bitrate histogram to visualize the distribution of used frame sizes - * a stereo mode histogram to visualize the distribution of used stereo - * modes, useful in joint-stereo mode only - * 0: LR left-right encoded - * 1: LR-I left-right and intensity encoded (currently not supported) - * 2: MS mid-side encoded - * 3: MS-I mid-side and intensity encoded (currently not supported) - * - * attention: don't call them after lame_encode_finish - * suggested: lame_encode_flush -> lame_*_hist -> lame_close - */ - -void CDECL lame_bitrate_hist( - const lame_global_flags * gfp, - int bitrate_count[14] ); -void CDECL lame_bitrate_kbps( - const lame_global_flags * gfp, - int bitrate_kbps [14] ); -void CDECL lame_stereo_mode_hist( - const lame_global_flags * gfp, - int stereo_mode_count[4] ); - -void CDECL lame_bitrate_stereo_mode_hist ( - const lame_global_flags * gfp, - int bitrate_stmode_count[14][4] ); - -void CDECL lame_block_type_hist ( - const lame_global_flags * gfp, - int btype_count[6] ); - -void CDECL lame_bitrate_block_type_hist ( - const lame_global_flags * gfp, - int bitrate_btype_count[14][6] ); - -#if (DEPRECATED_OR_OBSOLETE_CODE_REMOVED && 0) -#else -/* - * OPTIONAL: - * lame_mp3_tags_fid will rewrite a Xing VBR tag to the mp3 file with file - * pointer fid. These calls perform forward and backwards seeks, so make - * sure fid is a real file. Make sure lame_encode_flush has been called, - * and all mp3 data has been written to the file before calling this - * function. - * NOTE: - * if VBR tags are turned off by the user, or turned off by LAME because - * the output is not a regular file, this call does nothing - * NOTE: - * LAME wants to read from the file to skip an optional ID3v2 tag, so - * make sure you opened the file for writing and reading. - * NOTE: - * You can call lame_get_lametag_frame instead, if you want to insert - * the lametag yourself. -*/ -void CDECL lame_mp3_tags_fid(lame_global_flags *, FILE* fid); -#endif - -/* - * OPTIONAL: - * lame_get_lametag_frame copies the final LAME-tag into 'buffer'. - * The function returns the number of bytes copied into buffer, or - * the required buffer size, if the provided buffer is too small. - * Function failed, if the return value is larger than 'size'! - * Make sure lame_encode flush has been called before calling this function. - * NOTE: - * if VBR tags are turned off by the user, or turned off by LAME, - * this call does nothing and returns 0. - * NOTE: - * LAME inserted an empty frame in the beginning of mp3 audio data, - * which you have to replace by the final LAME-tag frame after encoding. - * In case there is no ID3v2 tag, usually this frame will be the very first - * data in your mp3 file. If you put some other leading data into your - * file, you'll have to do some bookkeeping about where to write this buffer. - */ -size_t CDECL lame_get_lametag_frame( - const lame_global_flags *, unsigned char* buffer, size_t size); - -/* - * REQUIRED: - * final call to free all remaining buffers - */ -int CDECL lame_close (lame_global_flags *); - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* - * OBSOLETE: - * lame_encode_finish combines lame_encode_flush() and lame_close() in - * one call. However, once this call is made, the statistics routines - * will no longer work because the data will have been cleared, and - * lame_mp3_tags_fid() cannot be called to add data to the VBR header - */ -int CDECL lame_encode_finish( - lame_global_flags* gfp, - unsigned char* mp3buf, - int size ); -#endif - - - - - - -/********************************************************************* - * - * decoding - * - * a simple interface to mpglib, part of mpg123, is also included if - * libmp3lame is compiled with HAVE_MPGLIB - * - *********************************************************************/ - -struct hip_global_struct; -typedef struct hip_global_struct hip_global_flags; -typedef hip_global_flags *hip_t; - - -typedef struct { - int header_parsed; /* 1 if header was parsed and following data was - computed */ - int stereo; /* number of channels */ - int samplerate; /* sample rate */ - int bitrate; /* bitrate */ - int mode; /* mp3 frame type */ - int mode_ext; /* mp3 frame type */ - int framesize; /* number of samples per mp3 frame */ - - /* this data is only computed if mpglib detects a Xing VBR header */ - unsigned long nsamp; /* number of samples in mp3 file. */ - int totalframes; /* total number of frames in mp3 file */ - - /* this data is not currently computed by the mpglib routines */ - int framenum; /* frames decoded counter */ -} mp3data_struct; - -/* required call to initialize decoder */ -hip_t CDECL hip_decode_init(void); - -/* cleanup call to exit decoder */ -int CDECL hip_decode_exit(hip_t gfp); - -/* HIP reporting functions */ -void CDECL hip_set_errorf(hip_t gfp, lame_report_function f); -void CDECL hip_set_debugf(hip_t gfp, lame_report_function f); -void CDECL hip_set_msgf (hip_t gfp, lame_report_function f); - -/********************************************************************* - * input 1 mp3 frame, output (maybe) pcm data. - * - * nout = hip_decode(hip, mp3buf,len,pcm_l,pcm_r); - * - * input: - * len : number of bytes of mp3 data in mp3buf - * mp3buf[len] : mp3 data to be decoded - * - * output: - * nout: -1 : decoding error - * 0 : need more data before we can complete the decode - * >0 : returned 'nout' samples worth of data in pcm_l,pcm_r - * pcm_l[nout] : left channel data - * pcm_r[nout] : right channel data - * - *********************************************************************/ -int CDECL hip_decode( hip_t gfp - , unsigned char * mp3buf - , size_t len - , short pcm_l[] - , short pcm_r[] - ); - -/* same as hip_decode, and also returns mp3 header data */ -int CDECL hip_decode_headers( hip_t gfp - , unsigned char* mp3buf - , size_t len - , short pcm_l[] - , short pcm_r[] - , mp3data_struct* mp3data - ); - -/* same as hip_decode, but returns at most one frame */ -int CDECL hip_decode1( hip_t gfp - , unsigned char* mp3buf - , size_t len - , short pcm_l[] - , short pcm_r[] - ); - -/* same as hip_decode1, but returns at most one frame and mp3 header data */ -int CDECL hip_decode1_headers( hip_t gfp - , unsigned char* mp3buf - , size_t len - , short pcm_l[] - , short pcm_r[] - , mp3data_struct* mp3data - ); - -/* same as hip_decode1_headers, but also returns enc_delay and enc_padding - from VBR Info tag, (-1 if no info tag was found) */ -int CDECL hip_decode1_headersB( hip_t gfp - , unsigned char* mp3buf - , size_t len - , short pcm_l[] - , short pcm_r[] - , mp3data_struct* mp3data - , int *enc_delay - , int *enc_padding - ); - - - -/* OBSOLETE: - * lame_decode... functions are there to keep old code working - * but it is strongly recommended to replace calls by hip_decode... - * function calls, see above. - */ -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -int CDECL lame_decode_init(void); -int CDECL lame_decode( - unsigned char * mp3buf, - int len, - short pcm_l[], - short pcm_r[] ); -int CDECL lame_decode_headers( - unsigned char* mp3buf, - int len, - short pcm_l[], - short pcm_r[], - mp3data_struct* mp3data ); -int CDECL lame_decode1( - unsigned char* mp3buf, - int len, - short pcm_l[], - short pcm_r[] ); -int CDECL lame_decode1_headers( - unsigned char* mp3buf, - int len, - short pcm_l[], - short pcm_r[], - mp3data_struct* mp3data ); -int CDECL lame_decode1_headersB( - unsigned char* mp3buf, - int len, - short pcm_l[], - short pcm_r[], - mp3data_struct* mp3data, - int *enc_delay, - int *enc_padding ); -int CDECL lame_decode_exit(void); - -#endif /* obsolete lame_decode API calls */ - - -/********************************************************************* - * - * id3tag stuff - * - *********************************************************************/ - -/* - * id3tag.h -- Interface to write ID3 version 1 and 2 tags. - * - * Copyright (C) 2000 Don Melton. - * - * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -/* utility to obtain alphabetically sorted list of genre names with numbers */ -void CDECL id3tag_genre_list( - void (*handler)(int, const char *, void *), - void* cookie); - -void CDECL id3tag_init (lame_t gfp); - -/* force addition of version 2 tag */ -void CDECL id3tag_add_v2 (lame_t gfp); - -/* add only a version 1 tag */ -void CDECL id3tag_v1_only (lame_t gfp); - -/* add only a version 2 tag */ -void CDECL id3tag_v2_only (lame_t gfp); - -/* pad version 1 tag with spaces instead of nulls */ -void CDECL id3tag_space_v1 (lame_t gfp); - -/* pad version 2 tag with extra 128 bytes */ -void CDECL id3tag_pad_v2 (lame_t gfp); - -/* pad version 2 tag with extra n bytes */ -void CDECL id3tag_set_pad (lame_t gfp, size_t n); - -void CDECL id3tag_set_title(lame_t gfp, const char* title); -void CDECL id3tag_set_artist(lame_t gfp, const char* artist); -void CDECL id3tag_set_album(lame_t gfp, const char* album); -void CDECL id3tag_set_year(lame_t gfp, const char* year); -void CDECL id3tag_set_comment(lame_t gfp, const char* comment); - -/* return -1 result if track number is out of ID3v1 range - and ignored for ID3v1 */ -int CDECL id3tag_set_track(lame_t gfp, const char* track); - -/* return non-zero result if genre name or number is invalid - result 0: OK - result -1: genre number out of range - result -2: no valid ID3v1 genre name, mapped to ID3v1 'Other' - but taken as-is for ID3v2 genre tag */ -int CDECL id3tag_set_genre(lame_t gfp, const char* genre); - -/* return non-zero result if field name is invalid */ -int CDECL id3tag_set_fieldvalue(lame_t gfp, const char* fieldvalue); - -/* return non-zero result if image type is invalid */ -int CDECL id3tag_set_albumart(lame_t gfp, const char* image, size_t size); - -/* lame_get_id3v1_tag copies ID3v1 tag into buffer. - * Function returns number of bytes copied into buffer, or number - * of bytes rquired if buffer 'size' is too small. - * Function fails, if returned value is larger than 'size'. - * NOTE: - * This functions does nothing, if user/LAME disabled ID3v1 tag. - */ -size_t CDECL lame_get_id3v1_tag(lame_t gfp, unsigned char* buffer, size_t size); - -/* lame_get_id3v2_tag copies ID3v2 tag into buffer. - * Function returns number of bytes copied into buffer, or number - * of bytes rquired if buffer 'size' is too small. - * Function fails, if returned value is larger than 'size'. - * NOTE: - * This functions does nothing, if user/LAME disabled ID3v2 tag. - */ -size_t CDECL lame_get_id3v2_tag(lame_t gfp, unsigned char* buffer, size_t size); - -/* normaly lame_init_param writes ID3v2 tags into the audio stream - * Call lame_set_write_id3tag_automatic(gfp, 0) before lame_init_param - * to turn off this behaviour and get ID3v2 tag with above function - * write it yourself into your file. - */ -void CDECL lame_set_write_id3tag_automatic(lame_global_flags * gfp, int); -int CDECL lame_get_write_id3tag_automatic(lame_global_flags const* gfp); - -/* experimental */ -int CDECL id3tag_set_textinfo_latin1(lame_t gfp, char const *id, char const *text); - -/* experimental */ -int CDECL id3tag_set_comment_latin1(lame_t gfp, char const *lang, char const *desc, char const *text); - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* experimental */ -int CDECL id3tag_set_textinfo_ucs2(lame_t gfp, char const *id, unsigned short const *text); - -/* experimental */ -int CDECL id3tag_set_comment_ucs2(lame_t gfp, char const *lang, - unsigned short const *desc, unsigned short const *text); - -/* experimental */ -int CDECL id3tag_set_fieldvalue_ucs2(lame_t gfp, const unsigned short *fieldvalue); -#endif - -/* experimental */ -int CDECL id3tag_set_fieldvalue_utf16(lame_t gfp, const unsigned short *fieldvalue); - -/* experimental */ -int CDECL id3tag_set_textinfo_utf16(lame_t gfp, char const *id, unsigned short const *text); - -/* experimental */ -int CDECL id3tag_set_comment_utf16(lame_t gfp, char const *lang, unsigned short const *desc, unsigned short const *text); - - -/*********************************************************************** -* -* list of valid bitrates [kbps] & sample frequencies [Hz]. -* first index: 0: MPEG-2 values (sample frequencies 16...24 kHz) -* 1: MPEG-1 values (sample frequencies 32...48 kHz) -* 2: MPEG-2.5 values (sample frequencies 8...12 kHz) -***********************************************************************/ - -extern const int bitrate_table [3][16]; -extern const int samplerate_table [3][ 4]; - -/* access functions for use in DLL, global vars are not exported */ -int CDECL lame_get_bitrate(int mpeg_version, int table_index); -int CDECL lame_get_samplerate(int mpeg_version, int table_index); - - -/* maximum size of albumart image (128KB), which affects LAME_MAXMP3BUFFER - as well since lame_encode_buffer() also returns ID3v2 tag data */ -#define LAME_MAXALBUMART (128 * 1024) - -/* maximum size of mp3buffer needed if you encode at most 1152 samples for - each call to lame_encode_buffer. see lame_encode_buffer() below - (LAME_MAXMP3BUFFER is now obsolete) */ -#define LAME_MAXMP3BUFFER (16384 + LAME_MAXALBUMART) - - -typedef enum { - LAME_OKAY = 0, - LAME_NOERROR = 0, - LAME_GENERICERROR = -1, - LAME_NOMEM = -10, - LAME_BADBITRATE = -11, - LAME_BADSAMPFREQ = -12, - LAME_INTERNALERROR = -13, - - FRONTEND_READERROR = -80, - FRONTEND_WRITEERROR = -81, - FRONTEND_FILETOOLARGE = -82 - -} lame_errorcodes_t; - -#if defined(__cplusplus) -} -#endif -#endif /* LAME_LAME_H */ - diff --git a/lib-src/mpglib/layer1.c b/lib-src/mpglib/layer1.c deleted file mode 100644 index 7101a4663..000000000 --- a/lib-src/mpglib/layer1.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * layer1.c: Mpeg Layer-1 audio decoder - * - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* $Id: layer1.c,v 1.31 2017/08/23 13:22:23 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include "common.h" -#include "decode_i386.h" - -#ifdef WITH_DMALLOC -#include -#endif - -#include "layer1.h" - -static int gd_are_hip_tables_layer1_initialized = 0; - -void -hip_init_tables_layer1(void) -{ - if (gd_are_hip_tables_layer1_initialized) { - return; - } - gd_are_hip_tables_layer1_initialized = 1; -} - -typedef struct sideinfo_layer_I_struct -{ - unsigned char allocation[SBLIMIT][2]; - unsigned char scalefactor[SBLIMIT][2]; -} sideinfo_layer_I; - -static int -I_step_one(PMPSTR mp, sideinfo_layer_I* si) -{ - struct frame *fr = &(mp->fr); - int jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext << 2) + 4 : 32; - int i; - int illegal_value_detected = 0; - unsigned char const ba15 = 15; /* bit pattern not allowed, looks like sync(?) */ - memset(si, 0, sizeof(*si)); - assert(fr->stereo == 1 || fr->stereo == 2); - - if (fr->stereo == 2) { - for (i = 0; i < jsbound; i++) { - unsigned char b0 = get_leq_8_bits(mp, 4); /* values 0-15 */ - unsigned char b1 = get_leq_8_bits(mp, 4); /* values 0-15 */ - si->allocation[i][0] = b0; - si->allocation[i][1] = b1; - if (b0 == ba15 || b1 == ba15) - illegal_value_detected = 1; - } - for (i = jsbound; i < SBLIMIT; i++) { - unsigned char b = get_leq_8_bits(mp, 4); /* values 0-15 */ - si->allocation[i][0] = b; - si->allocation[i][1] = b; - if (b == ba15) - illegal_value_detected = 1; - } - for (i = 0; i < SBLIMIT; i++) { - unsigned char n0 = si->allocation[i][0]; - unsigned char n1 = si->allocation[i][1]; - unsigned char b0 = n0 ? get_leq_8_bits(mp, 6) : 0; /* values 0-63 */ - unsigned char b1 = n1 ? get_leq_8_bits(mp, 6) : 0; /* values 0-63 */ - si->scalefactor[i][0] = b0; - si->scalefactor[i][1] = b1; - } - } - else { - for (i = 0; i < SBLIMIT; i++) { - unsigned char b0 = get_leq_8_bits(mp, 4); /* values 0-15 */ - si->allocation[i][0] = b0; - if (b0 == ba15) - illegal_value_detected = 1; - } - for (i = 0; i < SBLIMIT; i++) { - unsigned char n0 = si->allocation[i][0]; - unsigned char b0 = n0 ? get_leq_8_bits(mp, 6) : 0; /* values 0-63 */ - si->scalefactor[i][0] = b0; - } - } - return illegal_value_detected; -} - -static void -I_step_two(PMPSTR mp, sideinfo_layer_I *si, real fraction[2][SBLIMIT]) -{ - double r0, r1; - struct frame *fr = &(mp->fr); - int ds_limit = fr->down_sample_sblimit; - int i; - - assert(fr->stereo == 1 || fr->stereo == 2); - if (fr->stereo == 2) { - int jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext << 2) + 4 : 32; - for (i = 0; i < jsbound; i++) { - unsigned char i0 = si->scalefactor[i][0]; - unsigned char i1 = si->scalefactor[i][1]; - unsigned char n0 = si->allocation[i][0]; - unsigned char n1 = si->allocation[i][1]; - assert( i0 < 64 ); - assert( i1 < 64 ); - assert( n0 < 16 ); - assert( n1 < 16 ); - if (n0 > 0) { - unsigned short v = get_leq_16_bits(mp, n0 + 1); /* 0-65535 */ - r0 = (((-1) << n0) + v + 1) * muls[n0 + 1][i0]; - } - else { - r0 = 0; - } - if (n1 > 0) { - unsigned short v = get_leq_16_bits(mp, n1 + 1); /* 0-65535 */ - r1 = (((-1) << n1) + v + 1) * muls[n1 + 1][i1]; - } - else { - r1 = 0; - } - fraction[0][i] = (real)r0; - fraction[1][i] = (real)r1; - } - for (i = jsbound; i < SBLIMIT; i++) { - unsigned char i0 = si->scalefactor[i][0]; - unsigned char i1 = si->scalefactor[i][1]; - unsigned char n = si->allocation[i][0]; - assert( i0 < 64 ); - assert( i1 < 64 ); - assert( n < 16 ); - if (n > 0) { - unsigned short v = get_leq_16_bits(mp, n + 1); /* 0-65535 */ - unsigned int w = (((-1) << n) + v + 1); - r0 = w * muls[n + 1][i0]; - r1 = w * muls[n + 1][i1]; - } - else { - r0 = r1 = 0; - } - fraction[0][i] = (real)r0; - fraction[1][i] = (real)r1; - } - for (i = ds_limit; i < SBLIMIT; i++) { - fraction[0][i] = 0.0; - fraction[1][i] = 0.0; - } - } - else { - for (i = 0; i < SBLIMIT; i++) { - unsigned char n = si->allocation[i][0]; - unsigned char j = si->scalefactor[i][0]; - assert( j < 64 ); - assert( n < 16 ); - if (n > 0) { - unsigned short v = get_leq_16_bits(mp, n + 1); - r0 = (((-1) << n) + v + 1) * muls[n + 1][j]; - } - else { - r0 = 0; - } - fraction[0][i] = (real)r0; - } - for (i = ds_limit; i < SBLIMIT; i++) { - fraction[0][i] = 0.0; - } - } -} - -int -decode_layer1_sideinfo(PMPSTR mp) -{ - (void) mp; - /* FIXME: extract side information and check values */ - return 0; -} - -int -decode_layer1_frame(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point) -{ - real fraction[2][SBLIMIT]; /* FIXME: change real -> double ? */ - sideinfo_layer_I si; - struct frame *fr = &(mp->fr); - int single = fr->single; - int i, clip = 0; - - if (I_step_one(mp, &si)) { - lame_report_fnc(mp->report_err, "hip: Aborting layer 1 decode, illegal bit allocation value\n"); - return -1; - } - if (fr->stereo == 1 || single == 3) - single = 0; - - if (single >= 0) { - /* decoding one of possibly two channels */ - for (i = 0; i < SCALE_BLOCK; i++) { - I_step_two(mp, &si, fraction); - clip += synth_1to1_mono(mp, (real *) fraction[single], pcm_sample, pcm_point); - } - } - else { - for (i = 0; i < SCALE_BLOCK; i++) { - int p1 = *pcm_point; - I_step_two(mp, &si, fraction); - clip += synth_1to1(mp, (real *) fraction[0], 0, pcm_sample, &p1); - clip += synth_1to1(mp, (real *) fraction[1], 1, pcm_sample, pcm_point); - } - } - - return clip; -} diff --git a/lib-src/mpglib/layer1.h b/lib-src/mpglib/layer1.h deleted file mode 100644 index 308c43794..000000000 --- a/lib-src/mpglib/layer1.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef LAYER1_H_INCLUDED -#define LAYER1_H_INCLUDED - -void hip_init_tables_layer1(void); -int decode_layer1_sideinfo(PMPSTR mp); -int decode_layer1_frame(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point); - -#endif diff --git a/lib-src/mpglib/layer2.c b/lib-src/mpglib/layer2.c deleted file mode 100644 index d3f869d9c..000000000 --- a/lib-src/mpglib/layer2.c +++ /dev/null @@ -1,403 +0,0 @@ -/* - * layer2.c: Mpeg Layer-2 audio decoder - * - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* $Id: layer2.c,v 1.34 2017/08/22 23:31:07 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "common.h" -#include "layer2.h" -#include "l2tables.h" -#include "decode_i386.h" - -#ifdef WITH_DMALLOC -#include -#endif -#include - -static int gd_are_hip_tables_layer2_initialized = 0; - -static unsigned char grp_3tab[32 * 3] = { 0, }; /* used: 27 */ -static unsigned char grp_5tab[128 * 3] = { 0, }; /* used: 125 */ -static unsigned char grp_9tab[1024 * 3] = { 0, }; /* used: 729 */ - - -void -hip_init_tables_layer2(void) -{ - static const double mulmul[27] = { - 0.0, -2.0 / 3.0, 2.0 / 3.0, - 2.0 / 7.0, 2.0 / 15.0, 2.0 / 31.0, 2.0 / 63.0, 2.0 / 127.0, 2.0 / 255.0, - 2.0 / 511.0, 2.0 / 1023.0, 2.0 / 2047.0, 2.0 / 4095.0, 2.0 / 8191.0, - 2.0 / 16383.0, 2.0 / 32767.0, 2.0 / 65535.0, - -4.0 / 5.0, -2.0 / 5.0, 2.0 / 5.0, 4.0 / 5.0, - -8.0 / 9.0, -4.0 / 9.0, -2.0 / 9.0, 2.0 / 9.0, 4.0 / 9.0, 8.0 / 9.0 - }; - static const unsigned char base[3][9] = { - {1, 0, 2,}, - {17, 18, 0, 19, 20,}, - {21, 1, 22, 23, 0, 24, 25, 2, 26} - }; - int i, j, k, l, len; - real *table; - static const int tablen[3] = { 3, 5, 9 }; - static unsigned char *itable, *tables[3] = { grp_3tab, grp_5tab, grp_9tab }; - - if (gd_are_hip_tables_layer2_initialized) { - return; - } - gd_are_hip_tables_layer2_initialized = 1; - - for (i = 0; i < 3; i++) { - itable = tables[i]; - len = tablen[i]; - for (j = 0; j < len; j++) - for (k = 0; k < len; k++) - for (l = 0; l < len; l++) { - *itable++ = base[i][l]; - *itable++ = base[i][k]; - *itable++ = base[i][j]; - } - } - - for (k = 0; k < 27; k++) { - double m = mulmul[k]; - table = muls[k]; - for (j = 3, i = 0; i < 63; i++, j--) - *table++ = (real) (m * pow(2.0, (double) j / 3.0)); - *table++ = 0.0; - } -} - - -static unsigned char* -grp_table_select(short d1, unsigned int idx) -{ - /* RH: it seems to be common, that idx is larger than the table's sizes. - is it OK to return a zero vector in this case? FIXME - /*/ - static unsigned char dummy_table[] = { 0,0,0 }; - unsigned int x; - switch (d1) { - case 3: - x = 3*3*3; - idx = idx < x ? idx : x; - return &grp_3tab[3 * idx]; - case 5: - x = 5*5*5; - idx = idx < x ? idx : x; - return &grp_5tab[3 * idx]; - case 9: - x = 9*9*9; - idx = idx < x ? idx : x; - return &grp_9tab[3 * idx]; - default: - /* fatal error */ - assert(0); - } - return &dummy_table[0]; -} - -typedef struct sideinfo_layer_II_struct -{ - unsigned char allocation[SBLIMIT][2]; - unsigned char scalefactor[SBLIMIT][2][3]; /* subband / channel / block */ -} sideinfo_layer_II; - - - -static void -II_step_one(PMPSTR mp, sideinfo_layer_II *si, struct frame *fr) -{ - int nch = fr->stereo; - int sblimit = fr->II_sblimit; - int jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext << 2) + 4 : fr->II_sblimit; - struct al_table2 const *alloc1 = fr->alloc; - unsigned char scfsi[SBLIMIT][2]; - int i, ch; - - memset(si, 0, sizeof(*si)); - if (jsbound > sblimit) - jsbound = sblimit; - if (nch == 2) { - for (i = 0; i < jsbound; ++i) { - short step = alloc1->bits; - unsigned char b0 = get_leq_8_bits(mp, step); - unsigned char b1 = get_leq_8_bits(mp, step); - alloc1 += ((size_t)1 << step); - si->allocation[i][0] = b0; - si->allocation[i][1] = b1; - } - for (i = jsbound; i < sblimit; ++i) { - short step = alloc1->bits; - unsigned char b0 = get_leq_8_bits(mp, step); - alloc1 += ((size_t)1 << step); - si->allocation[i][0] = b0; - si->allocation[i][1] = b0; - } - for (i = 0; i < sblimit; ++i) { - unsigned char n0 = si->allocation[i][0]; - unsigned char n1 = si->allocation[i][1]; - unsigned char b0 = n0 ? get_leq_8_bits(mp, 2) : 0; - unsigned char b1 = n1 ? get_leq_8_bits(mp, 2) : 0; - scfsi[i][0] = b0; - scfsi[i][1] = b1; - } - } - else { /* mono */ - for (i = 0; i < sblimit; ++i) { - short step = alloc1->bits; - unsigned char b0 = get_leq_8_bits(mp, step); - alloc1 += ((size_t)1 << step); - si->allocation[i][0] = b0; - } - for (i = 0; i < sblimit; ++i) { - unsigned char n0 = si->allocation[i][0]; - unsigned char b0 = n0 ? get_leq_8_bits(mp, 2) : 0; - scfsi[i][0] = b0; - } - } - for (i = 0; i < sblimit; ++i) { - for (ch = 0; ch < nch; ++ch) { - unsigned char s0 = 0, s1 = 0, s2 = 0; - if (si->allocation[i][ch]) { - switch (scfsi[i][ch]) { - case 0: - s0 = get_leq_8_bits(mp, 6); - s1 = get_leq_8_bits(mp, 6); - s2 = get_leq_8_bits(mp, 6); - break; - case 1: - s0 = get_leq_8_bits(mp, 6); - s1 = s0; - s2 = get_leq_8_bits(mp, 6); - break; - case 2: - s0 = get_leq_8_bits(mp, 6); - s1 = s0; - s2 = s0; - break; - case 3: - s0 = get_leq_8_bits(mp, 6); - s1 = get_leq_8_bits(mp, 6); - s2 = s1; - break; - default: - assert(0); - } - } - si->scalefactor[i][ch][0] = s0; - si->scalefactor[i][ch][1] = s1; - si->scalefactor[i][ch][2] = s2; - } - } -} - -static void -II_step_two(PMPSTR mp, sideinfo_layer_II* si, struct frame *fr, int gr, real fraction[2][4][SBLIMIT]) -{ - struct al_table2 const *alloc1 = fr->alloc; - int sblimit = fr->II_sblimit; - int jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext << 2) + 4 : fr->II_sblimit; - int i, ch, nch = fr->stereo; - double cm, r0, r1, r2; - - if (jsbound > sblimit) - jsbound = sblimit; - for (i = 0; i < jsbound; ++i) { - short step = alloc1->bits; - for (ch = 0; ch < nch; ++ch) { - unsigned char ba = si->allocation[i][ch]; - if (ba) { - unsigned char x1 = si->scalefactor[i][ch][gr]; - struct al_table2 const *alloc2 = alloc1 + ba; - short k = alloc2->bits; - short d1 = alloc2->d; - assert( k <= 16 ); - k = (k <= 16) ? k : 16; - assert( x1 < 64 ); - x1 = (x1 < 64) ? x1 : 63; - if (d1 < 0) { - int v0 = getbits(mp, k); - int v1 = getbits(mp, k); - int v2 = getbits(mp, k); - cm = muls[k][x1]; - r0 = (v0 + d1) * cm; - r1 = (v1 + d1) * cm; - r2 = (v2 + d1) * cm; - } - else { - unsigned int idx = getbits(mp, k); - unsigned char *tab = grp_table_select(d1, idx); - unsigned char k0 = tab[0]; - unsigned char k1 = tab[1]; - unsigned char k2 = tab[2]; - r0 = muls[k0][x1]; - r1 = muls[k1][x1]; - r2 = muls[k2][x1]; - } - fraction[ch][0][i] = (real) r0; - fraction[ch][1][i] = (real) r1; - fraction[ch][2][i] = (real) r2; - } - else { - fraction[ch][0][i] = fraction[ch][1][i] = fraction[ch][2][i] = 0.0; - } - } - alloc1 += ((size_t)1 << step); - } - - for (i = jsbound; i < sblimit; i++) { - short step = alloc1->bits; - unsigned char ba = si->allocation[i][0]; - if (ba) { - struct al_table2 const *alloc2 = alloc1 + ba; - short k = alloc2->bits; - short d1 = alloc2->d; - assert( k <= 16 ); - k = (k <= 16) ? k : 16; - if (d1 < 0) { - int v0 = getbits(mp, k); - int v1 = getbits(mp, k); - int v2 = getbits(mp, k); - for (ch = 0; ch < nch; ++ch) { - unsigned char x1 = si->scalefactor[i][ch][gr]; - assert( x1 < 64 ); - x1 = (x1 < 64) ? x1 : 63; - cm = muls[k][x1]; - r0 = (v0 + d1) * cm; - r1 = (v1 + d1) * cm; - r2 = (v2 + d1) * cm; - fraction[ch][0][i] = (real) r0; - fraction[ch][1][i] = (real) r1; - fraction[ch][2][i] = (real) r2; - } - } - else { - unsigned int idx = getbits(mp, k); - unsigned char *tab = grp_table_select(d1, idx); - unsigned char k0 = tab[0]; - unsigned char k1 = tab[1]; - unsigned char k2 = tab[2]; - for (ch = 0; ch < nch; ++ch) { - unsigned char x1 = si->scalefactor[i][ch][gr]; - assert( x1 < 64 ); - x1 = (x1 < 64) ? x1 : 63; - r0 = muls[k0][x1]; - r1 = muls[k1][x1]; - r2 = muls[k2][x1]; - fraction[ch][0][i] = (real) r0; - fraction[ch][1][i] = (real) r1; - fraction[ch][2][i] = (real) r2; - } - } - } - else { - fraction[0][0][i] = fraction[0][1][i] = fraction[0][2][i] = 0.0; - fraction[1][0][i] = fraction[1][1][i] = fraction[1][2][i] = 0.0; - } - alloc1 += ((size_t)1 << step); - } - if (sblimit > fr->down_sample_sblimit) { - sblimit = fr->down_sample_sblimit; - } - for (ch = 0; ch < nch; ++ch) { - for (i = sblimit; i < SBLIMIT; ++i) { - fraction[ch][0][i] = fraction[ch][1][i] = fraction[ch][2][i] = 0.0; - } - } -} - -static void -II_select_table(struct frame *fr) -{ - /* *INDENT-OFF* */ - static const int translate[3][2][16] = - { { { 0,2,2,2,2,2,2,0,0,0,1,1,1,1,1,0 } , - { 0,2,2,0,0,0,1,1,1,1,1,1,1,1,1,0 } } , - { { 0,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0 } , - { 0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0 } } , - { { 0,3,3,3,3,3,3,0,0,0,1,1,1,1,1,0 } , - { 0,3,3,0,0,0,1,1,1,1,1,1,1,1,1,0 } } }; - /* *INDENT-ON* */ - - int table, sblim; - static const struct al_table2 *tables[5] = { alloc_0, alloc_1, alloc_2, alloc_3, alloc_4 }; - static const int sblims[5] = { 27, 30, 8, 12, 30 }; - - if (fr->lsf) - table = 4; - else - table = translate[fr->sampling_frequency][2 - fr->stereo][fr->bitrate_index]; - sblim = sblims[table]; - - fr->alloc = (struct al_table2 const *) tables[table]; - fr->II_sblimit = sblim; -} - - -int -decode_layer2_sideinfo(PMPSTR mp) -{ - (void) mp; - /* FIXME: extract side information and check values */ - return 0; -} - -int -decode_layer2_frame(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point) -{ - real fraction[2][4][SBLIMIT]; /* pick_table clears unused subbands */ - sideinfo_layer_II si; - struct frame *fr = &(mp->fr); - int single = fr->single; - int i, j, clip = 0; - - II_select_table(fr); - II_step_one(mp, &si, fr); - - if (fr->stereo == 1 || single == 3) - single = 0; - - if (single >= 0) { - for (i = 0; i < SCALE_BLOCK; i++) { - II_step_two(mp, &si, fr, i >> 2, fraction); - for (j = 0; j < 3; j++) { - clip += synth_1to1_mono(mp, fraction[single][j], pcm_sample, pcm_point); - } - } - } - else { - for (i = 0; i < SCALE_BLOCK; i++) { - II_step_two(mp, &si, fr, i >> 2, fraction); - for (j = 0; j < 3; j++) { - int p1 = *pcm_point; - clip += synth_1to1(mp, fraction[0][j], 0, pcm_sample, &p1); - clip += synth_1to1(mp, fraction[1][j], 1, pcm_sample, pcm_point); - } - } - } - - return clip; -} diff --git a/lib-src/mpglib/layer2.h b/lib-src/mpglib/layer2.h deleted file mode 100644 index fafc9a73f..000000000 --- a/lib-src/mpglib/layer2.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef LAYER2_H_INCLUDED -#define LAYER2_H_INCLUDED - - -struct al_table2 { - short bits; - short d; -}; - - - -void hip_init_tables_layer2(void); -int decode_layer2_sideinfo(PMPSTR mp); -int decode_layer2_frame(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point); - - -#endif diff --git a/lib-src/mpglib/layer3.c b/lib-src/mpglib/layer3.c deleted file mode 100644 index af5b69e7c..000000000 --- a/lib-src/mpglib/layer3.c +++ /dev/null @@ -1,1969 +0,0 @@ -/* - * layer3.c: Mpeg Layer-3 audio decoder - * - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* $Id: layer3.c,v 1.69 2017/08/20 20:06:57 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include "common.h" -#include "huffman.h" -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "lame-analysis.h" -#include "decode_i386.h" -#include "layer3.h" - -#ifdef WITH_DMALLOC -#include -#endif - - -static int gd_are_hip_tables_layer3_initialized = 0; - -static real ispow[8207]; -static real aa_ca[8], aa_cs[8]; -static real COS1[12][6]; -static real win[4][36]; -static real win1[4][36]; -static real gainpow2[256 + 118 + 4]; -static real COS9[9]; -static real COS6_1, COS6_2; -static real tfcos36[9]; -static real tfcos12[3]; - -struct bandInfoStruct { - short longIdx[23]; - short longDiff[22]; - short shortIdx[14]; - short shortDiff[13]; -}; - -static int longLimit[9][23]; -static int shortLimit[9][14]; - -/* *INDENT-OFF* */ - -static const struct bandInfoStruct bandInfo[9] = { - -/* MPEG 1.0 */ - { {0,4,8,12,16,20,24,30,36,44,52,62,74, 90,110,134,162,196,238,288,342,418,576}, - {4,4,4,4,4,4,6,6,8, 8,10,12,16,20,24,28,34,42,50,54, 76,158}, - {0,4*3,8*3,12*3,16*3,22*3,30*3,40*3,52*3,66*3, 84*3,106*3,136*3,192*3}, - {4,4,4,4,6,8,10,12,14,18,22,30,56} } , - - { {0,4,8,12,16,20,24,30,36,42,50,60,72, 88,106,128,156,190,230,276,330,384,576}, - {4,4,4,4,4,4,6,6,6, 8,10,12,16,18,22,28,34,40,46,54, 54,192}, - {0,4*3,8*3,12*3,16*3,22*3,28*3,38*3,50*3,64*3, 80*3,100*3,126*3,192*3}, - {4,4,4,4,6,6,10,12,14,16,20,26,66} } , - - { {0,4,8,12,16,20,24,30,36,44,54,66,82,102,126,156,194,240,296,364,448,550,576} , - {4,4,4,4,4,4,6,6,8,10,12,16,20,24,30,38,46,56,68,84,102, 26} , - {0,4*3,8*3,12*3,16*3,22*3,30*3,42*3,58*3,78*3,104*3,138*3,180*3,192*3} , - {4,4,4,4,6,8,12,16,20,26,34,42,12} } , - -/* MPEG 2.0 */ - { {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, - {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54 } , - {0,4*3,8*3,12*3,18*3,24*3,32*3,42*3,56*3,74*3,100*3,132*3,174*3,192*3} , - {4,4,4,6,6,8,10,14,18,26,32,42,18 } } , - /* docs: 332. mpg123: 330 */ - { {0,6,12,18,24,30,36,44,54,66,80,96,114,136,162,194,232,278,332,394,464,540,576}, - {6,6,6,6,6,6,8,10,12,14,16,18,22,26,32,38,46,54,62,70,76,36 } , - {0,4*3,8*3,12*3,18*3,26*3,36*3,48*3,62*3,80*3,104*3,136*3,180*3,192*3} , - {4,4,4,6,8,10,12,14,18,24,32,44,12 } } , - - { {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, - {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54 }, - {0,4*3,8*3,12*3,18*3,26*3,36*3,48*3,62*3,80*3,104*3,134*3,174*3,192*3}, - {4,4,4,6,8,10,12,14,18,24,30,40,18 } } , -/* MPEG 2.5 */ - { {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576} , - {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54}, - {0,12,24,36,54,78,108,144,186,240,312,402,522,576}, - {4,4,4,6,8,10,12,14,18,24,30,40,18} }, - { {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576} , - {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54}, - {0,12,24,36,54,78,108,144,186,240,312,402,522,576}, - {4,4,4,6,8,10,12,14,18,24,30,40,18} }, - { {0,12,24,36,48,60,72,88,108,132,160,192,232,280,336,400,476,566,568,570,572,574,576}, - {12,12,12,12,12,12,16,20,24,28,32,40,48,56,64,76,90,2,2,2,2,2}, - {0, 24, 48, 72,108,156,216,288,372,480,486,492,498,576}, - {8,8,8,12,16,20,24,28,36,2,2,2,26} } , -}; -/* *INDENT-ON* */ - -static int mapbuf0[9][152]; -static int mapbuf1[9][156]; -static int mapbuf2[9][44]; -static int *map[9][3]; -static int *mapend[9][3]; - -static unsigned int n_slen2[512]; /* MPEG 2.0 slen for 'normal' mode */ -static unsigned int i_slen2[256]; /* MPEG 2.0 slen for intensity stereo */ - -static real tan1_1[16], tan2_1[16], tan1_2[16], tan2_2[16]; -static real pow1_1[2][16], pow2_1[2][16], pow1_2[2][16], pow2_2[2][16]; - -static unsigned int -get1bit(PMPSTR mp) -{ - unsigned char rval; - rval = *mp->wordpointer << mp->bitindex; - - mp->bitindex++; - mp->wordpointer += (mp->bitindex >> 3); - mp->bitindex &= 7; - - return rval >> 7; -} - -static real -get_gain(real const* gain_ptr, int idx, int* overflow) -{ - static const real* const gainpow2_end_ptr = gainpow2 + (sizeof(gainpow2)/sizeof(gainpow2[0])) -1; - real const * ptr = &gain_ptr[idx]; - if (&gain_ptr[idx] > gainpow2_end_ptr) { - ptr = gainpow2_end_ptr; - if (overflow) *overflow = 1; - } - return *ptr; -} - - -/* - * init tables for layer-3 - */ -void -hip_init_tables_layer3(void) -{ - int i, j, k; - - if (gd_are_hip_tables_layer3_initialized) { - return; - } - gd_are_hip_tables_layer3_initialized = 1; - - for (i = -256; i < 118 + 4; i++) - gainpow2[i + 256] = pow((double) 2.0, -0.25 * (double) (i + 210)); - - for (i = 0; i < 8207; i++) - ispow[i] = pow((double) i, (double) 4.0 / 3.0); - - for (i = 0; i < 8; i++) { - static const double Ci[8] = { -0.6, -0.535, -0.33, -0.185, -0.095, -0.041, -0.0142, -0.0037 }; - double sq = sqrt(1.0 + Ci[i] * Ci[i]); - aa_cs[i] = 1.0 / sq; - aa_ca[i] = Ci[i] / sq; - } - - for (i = 0; i < 18; i++) { - win[0][i] = win[1][i] = - 0.5 * sin(M_PI / 72.0 * (double) (2 * (i + 0) + 1)) / cos(M_PI * - (double) (2 * (i + 0) + - 19) / 72.0); - win[0][i + 18] = win[3][i + 18] = - 0.5 * sin(M_PI / 72.0 * (double) (2 * (i + 18) + 1)) / cos(M_PI * - (double) (2 * (i + 18) + - 19) / 72.0); - } - for (i = 0; i < 6; i++) { - win[1][i + 18] = 0.5 / cos(M_PI * (double) (2 * (i + 18) + 19) / 72.0); - win[3][i + 12] = 0.5 / cos(M_PI * (double) (2 * (i + 12) + 19) / 72.0); - win[1][i + 24] = - 0.5 * sin(M_PI / 24.0 * (double) (2 * i + 13)) / cos(M_PI * - (double) (2 * (i + 24) + - 19) / 72.0); - win[1][i + 30] = win[3][i] = 0.0; - win[3][i + 6] = - 0.5 * sin(M_PI / 24.0 * (double) (2 * i + 1)) / cos(M_PI * (double) (2 * (i + 6) + 19) / - 72.0); - } - - for (i = 0; i < 9; i++) - COS9[i] = cos(M_PI / 18.0 * (double) i); - - for (i = 0; i < 9; i++) - tfcos36[i] = 0.5 / cos(M_PI * (double) (i * 2 + 1) / 36.0); - for (i = 0; i < 3; i++) - tfcos12[i] = 0.5 / cos(M_PI * (double) (i * 2 + 1) / 12.0); - - COS6_1 = cos(M_PI / 6.0 * (double) 1); - COS6_2 = cos(M_PI / 6.0 * (double) 2); - - for (i = 0; i < 12; i++) { - win[2][i] = - 0.5 * sin(M_PI / 24.0 * (double) (2 * i + 1)) / cos(M_PI * (double) (2 * i + 7) / 24.0); - for (j = 0; j < 6; j++) - COS1[i][j] = cos(M_PI / 24.0 * (double) ((2 * i + 7) * (2 * j + 1))); - } - - for (j = 0; j < 4; j++) { - static int const len[4] = { 36, 36, 12, 36 }; - for (i = 0; i < len[j]; i += 2) - win1[j][i] = +win[j][i]; - for (i = 1; i < len[j]; i += 2) - win1[j][i] = -win[j][i]; - } - - for (i = 0; i < 16; i++) { - double t = tan((double) i * M_PI / 12.0); - tan1_1[i] = t / (1.0 + t); - tan2_1[i] = 1.0 / (1.0 + t); - tan1_2[i] = M_SQRT2 * t / (1.0 + t); - tan2_2[i] = M_SQRT2 / (1.0 + t); - - for (j = 0; j < 2; j++) { - double base = pow(2.0, -0.25 * (j + 1.0)); - double p1 = 1.0, p2 = 1.0; - if (i > 0) { - if (i & 1) - p1 = pow(base, (i + 1.0) * 0.5); - else - p2 = pow(base, i * 0.5); - } - pow1_1[j][i] = p1; - pow2_1[j][i] = p2; - pow1_2[j][i] = M_SQRT2 * p1; - pow2_2[j][i] = M_SQRT2 * p2; - } - } - - for (j = 0; j < 9; j++) { - struct bandInfoStruct const *bi = (struct bandInfoStruct const *) &bandInfo[j]; - int *mp; - int cb, lwin; - short const *bdf; - int switch_idx = (j < 3) ? 8 : 6; - - mp = map[j][0] = mapbuf0[j]; - bdf = bi->longDiff; - for (i = 0, cb = 0; cb < switch_idx; cb++, i += *bdf++) { - *mp++ = (*bdf) >> 1; - *mp++ = i; - *mp++ = 3; - *mp++ = cb; - } - bdf = bi->shortDiff + 3; - for (cb = 3; cb < 13; cb++) { - int l = (*bdf++) >> 1; - for (lwin = 0; lwin < 3; lwin++) { - *mp++ = l; - *mp++ = i + lwin; - *mp++ = lwin; - *mp++ = cb; - } - i += 6 * l; - } - mapend[j][0] = mp; - - mp = map[j][1] = mapbuf1[j]; - bdf = bi->shortDiff + 0; - for (i = 0, cb = 0; cb < 13; cb++) { - int l = (*bdf++) >> 1; - for (lwin = 0; lwin < 3; lwin++) { - *mp++ = l; - *mp++ = i + lwin; - *mp++ = lwin; - *mp++ = cb; - } - i += 6 * l; - } - mapend[j][1] = mp; - - mp = map[j][2] = mapbuf2[j]; - bdf = bi->longDiff; - for (cb = 0; cb < 22; cb++) { - *mp++ = (*bdf++) >> 1; - *mp++ = cb; - } - mapend[j][2] = mp; - - } - - for (j = 0; j < 9; j++) { - for (i = 0; i < 23; i++) { - longLimit[j][i] = (bandInfo[j].longIdx[i] - 1 + 8) / 18 + 1; - if (longLimit[j][i] > SBLIMIT) - longLimit[j][i] = SBLIMIT; - } - for (i = 0; i < 14; i++) { - shortLimit[j][i] = (bandInfo[j].shortIdx[i] - 1) / 18 + 1; - if (shortLimit[j][i] > SBLIMIT) - shortLimit[j][i] = SBLIMIT; - } - } - - for (i = 0; i < 5; i++) { - for (j = 0; j < 6; j++) { - for (k = 0; k < 6; k++) { - int n = k + j * 6 + i * 36; - i_slen2[n] = i | (j << 3) | (k << 6) | (3 << 12); - } - } - } - for (i = 0; i < 4; i++) { - for (j = 0; j < 4; j++) { - for (k = 0; k < 4; k++) { - int n = k + j * 4 + i * 16; - i_slen2[n + 180] = i | (j << 3) | (k << 6) | (4 << 12); - } - } - } - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { - int n = j + i * 3; - i_slen2[n + 244] = i | (j << 3) | (5 << 12); - n_slen2[n + 500] = i | (j << 3) | (2 << 12) | (1 << 15); - } - } - - for (i = 0; i < 5; i++) { - for (j = 0; j < 5; j++) { - for (k = 0; k < 4; k++) { - int l; - for (l = 0; l < 4; l++) { - int n = l + k * 4 + j * 16 + i * 80; - n_slen2[n] = i | (j << 3) | (k << 6) | (l << 9) | (0 << 12); - } - } - } - } - for (i = 0; i < 5; i++) { - for (j = 0; j < 5; j++) { - for (k = 0; k < 4; k++) { - int n = k + j * 4 + i * 20; - n_slen2[n + 400] = i | (j << 3) | (k << 6) | (1 << 12); - } - } - } -} - -/* - * read additional side information - */ - -static void -III_get_side_info_1(PMPSTR mp, int stereo, - int ms_stereo, long sfreq, int single) -{ - int ch, gr; - int powdiff = (single == 3) ? 4 : 0; - - mp->sideinfo.main_data_begin = getbits(mp, 9); - if (stereo == 1) - mp->sideinfo.private_bits = getbits_fast(mp, 5); - else - mp->sideinfo.private_bits = getbits_fast(mp, 3); - - for (ch = 0; ch < stereo; ch++) { - mp->sideinfo.ch[ch].gr[0].scfsi = -1; - mp->sideinfo.ch[ch].gr[1].scfsi = getbits_fast(mp, 4); - } - - for (gr = 0; gr < 2; gr++) { - for (ch = 0; ch < stereo; ch++) { - struct gr_info_s *gr_infos = &(mp->sideinfo.ch[ch].gr[gr]); - - gr_infos->part2_3_length = getbits(mp, 12); - gr_infos->big_values = getbits_fast(mp, 9); - if (gr_infos->big_values > 288) { - lame_report_fnc(mp->report_err, "big_values too large! %i\n", gr_infos->big_values); - gr_infos->big_values = 288; - } - { - unsigned int qss = getbits_fast(mp, 8); - gr_infos->pow2gain = gainpow2 + 256 - qss + powdiff; - if (mp->pinfo != NULL) { - mp->pinfo->qss[gr][ch] = qss; - } - } - if (ms_stereo) - gr_infos->pow2gain += 2; - gr_infos->scalefac_compress = getbits_fast(mp, 4); -/* window-switching flag == 1 for block_Type != 0 .. and block-type == 0 -> win-sw-flag = 0 */ - if (get1bit(mp)) { - int i; - gr_infos->block_type = getbits_fast(mp, 2); - gr_infos->mixed_block_flag = get1bit(mp); - gr_infos->table_select[0] = getbits_fast(mp, 5); - gr_infos->table_select[1] = getbits_fast(mp, 5); - - - /* - * table_select[2] not needed, because there is no region2, - * but to satisfy some verifications tools we set it either. - */ - gr_infos->table_select[2] = 0; - for (i = 0; i < 3; i++) { - unsigned int sbg = (getbits_fast(mp, 3) << 3); - gr_infos->full_gain[i] = gr_infos->pow2gain + sbg; - if (mp->pinfo != NULL) - mp->pinfo->sub_gain[gr][ch][i] = sbg / 8; - } - - if (gr_infos->block_type == 0) { - lame_report_fnc(mp->report_err, "Blocktype == 0 and window-switching == 1 not allowed.\n"); - /* error seems to be very good recoverable, so don't exit */ - /* exit(1); */ - } - /* region_count/start parameters are implicit in this case. */ - gr_infos->region1start = 36 >> 1; - gr_infos->region2start = 576 >> 1; - } - else { - unsigned int i, r0c, r1c, region0index, region1index; - for (i = 0; i < 3; i++) - gr_infos->table_select[i] = getbits_fast(mp, 5); - r0c = getbits_fast(mp, 4); - r1c = getbits_fast(mp, 3); - region0index = r0c+1; - if (region0index > 22) { - lame_report_fnc(mp->report_err, "region0index=%d > 22\n", region0index); - region0index = 22; - } - region1index = r0c+1 + r1c+1; - if (region1index > 22) { - lame_report_fnc(mp->report_err, "region1index=%d > 22\n", region1index); - region1index = 22; - } - gr_infos->region1start = bandInfo[sfreq].longIdx[region0index] >> 1; - gr_infos->region2start = bandInfo[sfreq].longIdx[region1index] >> 1; - gr_infos->block_type = 0; - gr_infos->mixed_block_flag = 0; - } - gr_infos->preflag = get1bit(mp); - gr_infos->scalefac_scale = get1bit(mp); - gr_infos->count1table_select = get1bit(mp); - } - } -} - -/* - * Side Info for MPEG 2.0 / LSF - */ -static void -III_get_side_info_2(PMPSTR mp, int stereo, int ms_stereo, long sfreq, int single) -{ - int ch; - int powdiff = (single == 3) ? 4 : 0; - - mp->sideinfo.main_data_begin = getbits(mp, 8); - - if (stereo == 1) - mp->sideinfo.private_bits = get1bit(mp); - else - mp->sideinfo.private_bits = getbits_fast(mp, 2); - - for (ch = 0; ch < stereo; ch++) { - struct gr_info_s *gr_infos = &(mp->sideinfo.ch[ch].gr[0]); - unsigned int qss; - - gr_infos->part2_3_length = getbits(mp, 12); - gr_infos->big_values = getbits_fast(mp, 9); - if (gr_infos->big_values > 288) { - lame_report_fnc(mp->report_err, "big_values too large! %i\n", gr_infos->big_values); - gr_infos->big_values = 288; - } - qss = getbits_fast(mp, 8); - gr_infos->pow2gain = gainpow2 + 256 - qss + powdiff; - if (mp->pinfo != NULL) { - mp->pinfo->qss[0][ch] = qss; - } - - - if (ms_stereo) - gr_infos->pow2gain += 2; - gr_infos->scalefac_compress = getbits(mp, 9); -/* window-switching flag == 1 for block_Type != 0 .. and block-type == 0 -> win-sw-flag = 0 */ - if (get1bit(mp)) { - int i; - gr_infos->block_type = getbits_fast(mp, 2); - gr_infos->mixed_block_flag = get1bit(mp); - gr_infos->table_select[0] = getbits_fast(mp, 5); - gr_infos->table_select[1] = getbits_fast(mp, 5); - /* - * table_select[2] not needed, because there is no region2, - * but to satisfy some verifications tools we set it either. - */ - gr_infos->table_select[2] = 0; - for (i = 0; i < 3; i++) { - unsigned int sbg = (getbits_fast(mp, 3) << 3); - gr_infos->full_gain[i] = gr_infos->pow2gain + sbg; - if (mp->pinfo != NULL) - mp->pinfo->sub_gain[0][ch][i] = sbg / 8; - - } - - if (gr_infos->block_type == 0) { - lame_report_fnc(mp->report_err, "Blocktype == 0 and window-switching == 1 not allowed.\n"); - /* error seems to be very good recoverable, so don't exit */ - /* exit(1); */ - } - /* region_count/start parameters are implicit in this case. */ - if (gr_infos->block_type == 2) { - if (gr_infos->mixed_block_flag == 0) - gr_infos->region1start = 36 >> 1; - else - gr_infos->region1start = 48 >> 1; - } - else - gr_infos->region1start = 54 >> 1; - if (sfreq == 8) - gr_infos->region1start *= 2; - gr_infos->region2start = 576 >> 1; - } - else { - unsigned int i, r0c, r1c, region0index, region1index; - for (i = 0; i < 3; i++) - gr_infos->table_select[i] = getbits_fast(mp, 5); - r0c = getbits_fast(mp, 4); - r1c = getbits_fast(mp, 3); - region0index = r0c+1; - if (region0index > 22) { - lame_report_fnc(mp->report_err, "region0index=%d > 22\n", region0index); - region0index = 22; - } - region1index = r0c+1 + r1c+1; - if (region1index > 22) { - lame_report_fnc(mp->report_err, "region1index=%d > 22\n", region1index); - region1index = 22; - } - gr_infos->region1start = bandInfo[sfreq].longIdx[region0index] >> 1; - gr_infos->region2start = bandInfo[sfreq].longIdx[region1index] >> 1; - gr_infos->block_type = 0; - gr_infos->mixed_block_flag = 0; - } - gr_infos->scalefac_scale = get1bit(mp); - gr_infos->count1table_select = get1bit(mp); - } -} - -/* - * read scalefactors - */ - -static int -III_get_scale_factors_1(PMPSTR mp, int *scf, struct gr_info_s *gr_infos) -{ - static const unsigned char slen[2][16] = { - {0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4}, - {0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3} - }; - int numbits; - int num0 = slen[0][gr_infos->scalefac_compress]; - int num1 = slen[1][gr_infos->scalefac_compress]; - - if (gr_infos->block_type == 2) { - int i = 18; - numbits = (num0 + num1) * 18; - - if (gr_infos->mixed_block_flag) { - for (i = 8; i; i--) - *scf++ = getbits_fast(mp, num0); - i = 9; - numbits -= num0; /* num0 * 17 + num1 * 18 */ - } - - for (; i; i--) - *scf++ = getbits_fast(mp, num0); - for (i = 18; i; i--) - *scf++ = getbits_fast(mp, num1); - *scf++ = 0; - *scf++ = 0; - *scf++ = 0; /* short[13][0..2] = 0 */ - } - else { - int i; - int scfsi = gr_infos->scfsi; - - if (scfsi < 0) { /* scfsi < 0 => granule == 0 */ - for (i = 11; i; i--) - *scf++ = getbits_fast(mp, num0); - for (i = 10; i; i--) - *scf++ = getbits_fast(mp, num1); - numbits = (num0 + num1) * 10 + num0; - } - else { - numbits = 0; - if (!(scfsi & 0x8)) { - for (i = 6; i; i--) - *scf++ = getbits_fast(mp, num0); - numbits += num0 * 6; - } - else { - scf += 6; - } - - if (!(scfsi & 0x4)) { - for (i = 5; i; i--) - *scf++ = getbits_fast(mp, num0); - numbits += num0 * 5; - } - else { - scf += 5; - } - - if (!(scfsi & 0x2)) { - for (i = 5; i; i--) - *scf++ = getbits_fast(mp, num1); - numbits += num1 * 5; - } - else { - scf += 5; - } - - if (!(scfsi & 0x1)) { - for (i = 5; i; i--) - *scf++ = getbits_fast(mp, num1); - numbits += num1 * 5; - } - else { - scf += 5; - } - } - - *scf++ = 0; /* no l[21] in original sources */ - } - return numbits; -} - - -static int -III_get_scale_factors_2(PMPSTR mp, int *scf, struct gr_info_s *gr_infos, int i_stereo) -{ - unsigned char const *pnt; - int i, j; - unsigned int slen; - int n = 0; - int numbits = 0; - - /* *INDENT-OFF* */ - static const unsigned char stab[3][6][4] = { - { { 6, 5, 5,5 } , { 6, 5, 7,3 } , { 11,10,0,0} , - { 7, 7, 7,0 } , { 6, 6, 6,3 } , { 8, 8,5,0} } , - { { 9, 9, 9,9 } , { 9, 9,12,6 } , { 18,18,0,0} , - {12,12,12,0 } , {12, 9, 9,6 } , { 15,12,9,0} } , - { { 6, 9, 9,9 } , { 6, 9,12,6 } , { 15,18,0,0} , - { 6,15,12,0 } , { 6,12, 9,6 } , { 6,18,9,0} } }; - /* *INDENT-ON* */ - - if (i_stereo) /* i_stereo AND second channel -> do_layer3() checks this */ - slen = i_slen2[gr_infos->scalefac_compress >> 1]; - else - slen = n_slen2[gr_infos->scalefac_compress]; - - gr_infos->preflag = (slen >> 15) & 0x1; - - n = 0; - if (gr_infos->block_type == 2) { - n++; - if (gr_infos->mixed_block_flag) - n++; - } - - pnt = (unsigned char const *) stab[n][(slen >> 12) & 0x7]; - - for (i = 0; i < 4; i++) { - int num = slen & 0x7; - slen >>= 3; - if (num) { - for (j = 0; j < (int) (pnt[i]); j++) - *scf++ = getbits_fast(mp, num); - numbits += pnt[i] * num; - } - else { - for (j = 0; j < (int) (pnt[i]); j++) - *scf++ = 0; - } - } - - n = (n << 1) + 1; - for (i = 0; i < n; i++) - *scf++ = 0; - - return numbits; -} - -/* *INDENT-OFF* */ -static const int pretab1 [22] = {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0}; /* char enough ? */ -static const int pretab2 [22] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -/* *INDENT-ON* */ - -/* - * don't forget to apply the same changes to III_dequantize_sample_ms() !!! - */ -static int -III_dequantize_sample(PMPSTR mp, real xr[SBLIMIT][SSLIMIT], int *scf, - struct gr_info_s *gr_infos, int sfreq, int part2bits) -{ - int shift = 1 + gr_infos->scalefac_scale; - real *xrpnt = (real *) xr, xr_value=0; - int l[3], l3; - int part2remain = gr_infos->part2_3_length - part2bits; - int *me; - real const * const xr_endptr = &xr[SBLIMIT-1][SSLIMIT-1]; - - int isbug = 0; - int bobug = 0; - int bobug_sb = 0, bobug_l3=0; -#define BUFFER_OVERFLOW_BUG() if(!bobug){bobug=1;bobug_sb=cb;bobug_l3=l3;}else - - /* lame_report_fnc(mp->report_dbg,"part2remain = %d, gr_infos->part2_3_length = %d, part2bits = %d\n", - part2remain, gr_infos->part2_3_length, part2bits); */ - - { - int i; - - for (i = (&xr[SBLIMIT][0] - xrpnt) >> 1; i > 0; i--) { - *xrpnt++ = 0.0; - *xrpnt++ = 0.0; - } - - xrpnt = (real *) xr; - } - - { - int bv = gr_infos->big_values; - int region1 = gr_infos->region1start; - int region2 = gr_infos->region2start; - - l3 = ((576 >> 1) - bv) >> 1; -/* - * we may lose the 'odd' bit here !! - * check this later again - */ - if (bv <= region1) { - l[0] = bv; - l[1] = 0; - l[2] = 0; - } - else { - l[0] = region1; - if (bv <= region2) { - l[1] = bv - l[0]; - l[2] = 0; - } - else { - l[1] = region2 - l[0]; - l[2] = bv - region2; - } - } - } - /* MDH crash fix */ - { - int i; - for (i = 0; i < 3; i++) { - if (l[i] < 0) { - lame_report_fnc(mp->report_err, "hip: Bogus region length (%d)\n", l[i]); - l[i] = 0; - } - } - } - /* end MDH crash fix */ - - if (gr_infos->block_type == 2) { - /* - * decoding with short or mixed mode BandIndex table - */ - int i, max[4]; - int step = 0, lwin = 0, cb = 0; - real v = 0.0; - int *m, mc; - - if (gr_infos->mixed_block_flag) { - max[3] = -1; - max[0] = max[1] = max[2] = 2; - m = map[sfreq][0]; - me = mapend[sfreq][0]; - } - else { - max[0] = max[1] = max[2] = max[3] = -1; - /* max[3] not really needed in this case */ - m = map[sfreq][1]; - me = mapend[sfreq][1]; - } - - mc = 0; - for (i = 0; i < 2; i++) { - int lp = l[i]; - struct newhuff const *h = (struct newhuff const *) (ht + gr_infos->table_select[i]); - for (; lp; lp--, mc--) { - int x, y; - if ((!mc)) { - mc = *m++; - xrpnt = ((real *) xr) + (*m++); - lwin = *m++; - cb = *m++; - if (lwin == 3) { - v = get_gain(gr_infos->pow2gain, (*scf++) << shift, &isbug); - step = 1; - } - else { - v = get_gain(gr_infos->full_gain[lwin], (*scf++) << shift, &isbug); - step = 3; - } - } - { - short const *val = (short const *) h->table; - while ((y = *val++) < 0) { - if (get1bit(mp)) - val -= y; - part2remain--; - } - x = y >> 4; - y &= 0xf; - } - if (x == 15) { - max[lwin] = cb; - part2remain -= h->linbits + 1; - x += getbits(mp, (int) h->linbits); - if (get1bit(mp)) - xr_value = -ispow[x] * v; - else - xr_value = ispow[x] * v; - } - else if (x) { - max[lwin] = cb; - if (get1bit(mp)) - xr_value = -ispow[x] * v; - else - xr_value = ispow[x] * v; - part2remain--; - } - else - xr_value = 0.0; - - if (xrpnt <= xr_endptr) - *xrpnt = xr_value; - else - BUFFER_OVERFLOW_BUG(); - xrpnt += step; - if (y == 15) { - max[lwin] = cb; - part2remain -= h->linbits + 1; - y += getbits(mp, (int) h->linbits); - if (get1bit(mp)) - xr_value = -ispow[y] * v; - else - xr_value = ispow[y] * v; - } - else if (y) { - max[lwin] = cb; - if (get1bit(mp)) - xr_value = -ispow[y] * v; - else - xr_value = ispow[y] * v; - part2remain--; - } - else - xr_value = 0.0; - - if (xrpnt <= xr_endptr) - *xrpnt = xr_value; - else - BUFFER_OVERFLOW_BUG(); - xrpnt += step; - } - } - for (; (l3 > 0) && (part2remain > 0); l3--) { - struct newhuff const *h = (struct newhuff const *) (htc + gr_infos->count1table_select); - short const *val = (short const *) h->table; - short a; - - while ((a = *val++) < 0) { - part2remain--; - if (part2remain < 0) { - part2remain++; - a = 0; - break; - } - if (get1bit(mp)) - val -= a; - } - for (i = 0; i < 4; i++) { - if (!(i & 1)) { - if (!mc) { - mc = *m++; - xrpnt = ((real *) xr) + (*m++); - lwin = *m++; - cb = *m++; - if (lwin == 3) { - v = get_gain(gr_infos->pow2gain, (*scf++) << shift, &isbug); - step = 1; - } - else { - v = get_gain(gr_infos->full_gain[lwin], (*scf++) << shift, &isbug); - step = 3; - } - } - mc--; - } - if ((a & (0x8 >> i))) { - max[lwin] = cb; - part2remain--; - if (part2remain < 0) { - part2remain++; - break; - } - if (get1bit(mp)) - xr_value = -v; - else - xr_value = v; - } - else - xr_value = 0.0; - - if (xrpnt <= xr_endptr) - *xrpnt = xr_value; - else - BUFFER_OVERFLOW_BUG(); - xrpnt += step; - } - } - while (m < me) { - if (!mc) { - mc = *m++; - xrpnt = ((real *) xr) + *m++; - if ((*m++) == 3) - step = 1; - else - step = 3; - m++; /* cb */ - } - mc--; - if (xrpnt <= xr_endptr) - *xrpnt = 0.0; - else - BUFFER_OVERFLOW_BUG(); - xrpnt += step; - if (xrpnt <= xr_endptr) - *xrpnt = 0.0; - else - BUFFER_OVERFLOW_BUG(); - xrpnt += step; -/* we could add a little opt. here: - * if we finished a band for window 3 or a long band - * further bands could copied in a simple loop without a - * special 'map' decoding - */ - } - - gr_infos->maxband[0] = max[0] + 1; - gr_infos->maxband[1] = max[1] + 1; - gr_infos->maxband[2] = max[2] + 1; - gr_infos->maxbandl = max[3] + 1; - - { - int rmax = max[0] > max[1] ? max[0] : max[1]; - rmax = (rmax > max[2] ? rmax : max[2]) + 1; - gr_infos->maxb = rmax ? shortLimit[sfreq][rmax] : longLimit[sfreq][max[3] + 1]; - } - - } - else { - /* - * decoding with 'long' BandIndex table (block_type != 2) - */ - int const *pretab = (int const *) (gr_infos->preflag ? pretab1 : pretab2); - int i, max = -1; - int cb = 0; - int *m = map[sfreq][2]; - real v = 0.0; - int mc = 0; - - /* - * long hash table values - */ - for (i = 0; i < 3; i++) { - int lp = l[i]; - struct newhuff const *h = (struct newhuff const *) (ht + gr_infos->table_select[i]); - - for (; lp; lp--, mc--) { - int x, y; - - if (!mc) { - mc = *m++; - v = get_gain(gr_infos->pow2gain, ((*scf++) + (*pretab++)) << shift, &isbug); - cb = *m++; - } - { - short const *val = (short const *) h->table; - while ((y = *val++) < 0) { - if (get1bit(mp)) - val -= y; - part2remain--; - } - x = y >> 4; - y &= 0xf; - } - if (x == 15) { - max = cb; - part2remain -= h->linbits + 1; - x += getbits(mp, (int) h->linbits); - if (get1bit(mp)) - xr_value = -ispow[x] * v; - else - xr_value = ispow[x] * v; - } - else if (x) { - max = cb; - if (get1bit(mp)) - xr_value = -ispow[x] * v; - else - xr_value = ispow[x] * v; - part2remain--; - } - else - xr_value = 0.0; - - if (xrpnt <= xr_endptr) - *xrpnt++ = xr_value; - else - BUFFER_OVERFLOW_BUG(); - - if (y == 15) { - max = cb; - part2remain -= h->linbits + 1; - y += getbits(mp, (int) h->linbits); - if (get1bit(mp)) - xr_value = -ispow[y] * v; - else - xr_value = ispow[y] * v; - } - else if (y) { - max = cb; - if (get1bit(mp)) - xr_value = -ispow[y] * v; - else - xr_value = ispow[y] * v; - part2remain--; - } - else - xr_value = 0.0; - - if (xrpnt <= xr_endptr) - *xrpnt++ = xr_value; - else - BUFFER_OVERFLOW_BUG(); - } - } - - /* - * short (count1table) values - */ - for (; l3 && (part2remain > 0); l3--) { - struct newhuff const *h = (struct newhuff const *) (htc + gr_infos->count1table_select); - short const *val = (short const *) h->table; - short a; - - while ((a = *val++) < 0) { - part2remain--; - if (part2remain < 0) { - part2remain++; - a = 0; - break; - } - if (get1bit(mp)) - val -= a; - } - for (i = 0; i < 4; i++) { - if (!(i & 1)) { - if (!mc) { - mc = *m++; - cb = *m++; - v = get_gain(gr_infos->pow2gain, ((*scf++) + (*pretab++)) << shift, &isbug); - } - mc--; - } - if ((a & (0x8 >> i))) { - max = cb; - part2remain--; - if (part2remain < 0) { - part2remain++; - break; - } - if (get1bit(mp)) - xr_value = -v; - else - xr_value = v; - } - else - xr_value = 0.0; - - if (xrpnt <= xr_endptr) - *xrpnt++ = xr_value; - else - BUFFER_OVERFLOW_BUG(); - } - } - - /* - * zero part - */ - while (xrpnt <= xr_endptr) - *xrpnt++ = 0.0; - - gr_infos->maxbandl = max + 1; - gr_infos->maxb = longLimit[sfreq][gr_infos->maxbandl]; - } -#undef BUFFER_OVERFLOW_BUG - if (bobug) { - /* well, there was a bug report, where this happened! - The problem was, that mixed blocks summed up to over 576, - because of a wrong long/short switching index. - It's likely, that the buffer overflow is fixed now, after correcting mixed block map. - */ - lame_report_fnc - (mp->report_err - ,"hip: OOPS, part2remain=%d l3=%d cb=%d bv=%d region1=%d region2=%d b-type=%d mixed=%d\n" - ,part2remain - ,bobug_l3 - ,bobug_sb - ,gr_infos->big_values - ,gr_infos->region1start - ,gr_infos->region2start - ,gr_infos->block_type - ,gr_infos->mixed_block_flag - ); - } - if (isbug) { - /* there is a bug report, where there is trouble with IS coded short block gain. - Is intensity stereo coding implementation correct? Likely not. - */ - int i_stereo = 0; - if (mp->fr.mode == MPG_MD_JOINT_STEREO) { - i_stereo = mp->fr.mode_ext & 0x1; - } - lame_report_fnc - (mp->report_err - ,"hip: OOPS, 'gainpow2' buffer overflow lsf=%d i-stereo=%d b-type=%d mixed=%d\n" - ,mp->fr.lsf - ,i_stereo - ,gr_infos->block_type - ,gr_infos->mixed_block_flag - ); - } - - while (part2remain > 16) { - getbits(mp, 16); /* Dismiss stuffing Bits */ - part2remain -= 16; - } - if (part2remain > 0) - getbits(mp, part2remain); - else if (part2remain < 0) { - lame_report_fnc(mp->report_err, "hip: Can't rewind stream by %d bits!\n", -part2remain); - return 1; /* -> error */ - } - return 0; -} - -/* intensity position, transmitted via a scalefactor value, allowed range is 0 - 15 */ -static -int scalefac_to_is_pos(int sf) -{ - if (0 <= sf && sf <= 15) - return sf; - return (sf < 0 ? 0 : 15); -} - -/* - * III_stereo: calculate real channel values for Joint-I-Stereo-mode - */ -static void -III_i_stereo(real xr_buf[2][SBLIMIT][SSLIMIT], int *scalefac, - struct gr_info_s *gr_infos, int sfreq, int ms_stereo, int lsf) -{ - real(*xr)[SBLIMIT * SSLIMIT] = (real(*)[SBLIMIT * SSLIMIT]) xr_buf; - struct bandInfoStruct const *bi = (struct bandInfoStruct const *) &bandInfo[sfreq]; - real *tabl1, *tabl2; - - if (lsf) { - int p = gr_infos->scalefac_compress & 0x1; - if (ms_stereo) { - tabl1 = pow1_2[p]; - tabl2 = pow2_2[p]; - } - else { - tabl1 = pow1_1[p]; - tabl2 = pow2_1[p]; - } - } - else { - if (ms_stereo) { - tabl1 = tan1_2; - tabl2 = tan2_2; - } - else { - tabl1 = tan1_1; - tabl2 = tan2_1; - } - } - - if (gr_infos->block_type == 2) { - int lwin, do_l = 0; - if (gr_infos->mixed_block_flag) - do_l = 1; - - for (lwin = 0; lwin < 3; lwin++) { /* process each window */ - /* get first band with zero values */ - int is_p, sb, idx, sfb = gr_infos->maxband[lwin]; /* sfb is minimal 3 for mixed mode */ - if (sfb > 3) - do_l = 0; - - for (; sfb < 12; sfb++) { - is_p = scalefac[sfb * 3 + lwin - gr_infos->mixed_block_flag]; /* scale: 0-15 */ - is_p = scalefac_to_is_pos(is_p); - if (is_p != 7) { - real t1, t2; - sb = bi->shortDiff[sfb]; - idx = bi->shortIdx[sfb] + lwin; - t1 = tabl1[is_p]; - t2 = tabl2[is_p]; - for (; sb > 0; sb--, idx += 3) { - real v = xr[0][idx]; - xr[0][idx] = v * t1; - xr[1][idx] = v * t2; - } - } - } - -#if 1 -/* in the original: copy 10 to 11 , here: copy 11 to 12 -maybe still wrong??? (copy 12 to 13?) */ - is_p = scalefac[11 * 3 + lwin - gr_infos->mixed_block_flag]; /* scale: 0-15 */ - sb = bi->shortDiff[12]; - idx = bi->shortIdx[12] + lwin; -#else - is_p = scalefac[10 * 3 + lwin - gr_infos->mixed_block_flag]; /* scale: 0-15 */ - sb = bi->shortDiff[11]; - idx = bi->shortIdx[11] + lwin; -#endif - is_p = scalefac_to_is_pos(is_p); - if (is_p != 7) { - real t1, t2; - t1 = tabl1[is_p]; - t2 = tabl2[is_p]; - for (; sb > 0; sb--, idx += 3) { - real v = xr[0][idx]; - xr[0][idx] = v * t1; - xr[1][idx] = v * t2; - } - } - } /* end for(lwin; .. ; . ) */ - - if (do_l) { -/* also check l-part, if ALL bands in the three windows are 'empty' - * and mode = mixed_mode - */ - int sfb = gr_infos->maxbandl; - int idx = bi->longIdx[sfb]; - - for (; sfb < 8; sfb++) { - int sb = bi->longDiff[sfb]; - int is_p = scalefac[sfb]; /* scale: 0-15 */ - is_p = scalefac_to_is_pos(is_p); - if (is_p != 7) { - real t1, t2; - t1 = tabl1[is_p]; - t2 = tabl2[is_p]; - for (; sb > 0; sb--, idx++) { - real v = xr[0][idx]; - xr[0][idx] = v * t1; - xr[1][idx] = v * t2; - } - } - else - idx += sb; - } - } - } - else { /* ((gr_infos->block_type != 2)) */ - - int sfb = gr_infos->maxbandl; - int is_p, idx = bi->longIdx[sfb]; - for (; sfb < 21; sfb++) { - int sb = bi->longDiff[sfb]; - is_p = scalefac[sfb]; /* scale: 0-15 */ - is_p = scalefac_to_is_pos(is_p); - if (is_p != 7) { - real t1, t2; - t1 = tabl1[is_p]; - t2 = tabl2[is_p]; - for (; sb > 0; sb--, idx++) { - real v = xr[0][idx]; - xr[0][idx] = v * t1; - xr[1][idx] = v * t2; - } - } - else - idx += sb; - } - - is_p = scalefac[20]; /* copy l-band 20 to l-band 21 */ - is_p = scalefac_to_is_pos(is_p); - idx = bi->longIdx[21]; - if (is_p != 7) { - int sb; - real t1 = tabl1[is_p], t2 = tabl2[is_p]; - - for (sb = bi->longDiff[21]; sb > 0; sb--, idx++) { - real v = xr[0][idx]; - xr[0][idx] = v * t1; - xr[1][idx] = v * t2; - } - } - } /* ... */ -} - -static void -III_antialias(real xr[SBLIMIT][SSLIMIT], struct gr_info_s *gr_infos) -{ - int sblim; - - if (gr_infos->block_type == 2) { - if (!gr_infos->mixed_block_flag) - return; - sblim = 1; - } - else { - sblim = gr_infos->maxb - 1; - } - - /* 31 alias-reduction operations between each pair of sub-bands */ - /* with 8 butterflies between each pair */ - - { - int sb; - real *xr1 = (real *) xr[1]; - - for (sb = sblim; sb; sb--, xr1 += 10) { - int ss; - real *cs = aa_cs, *ca = aa_ca; - real *xr2 = xr1; - - for (ss = 7; ss >= 0; ss--) { /* upper and lower butterfly inputs */ - real bu = *--xr2, bd = *xr1; - *xr2 = (bu * (*cs)) - (bd * (*ca)); - *xr1++ = (bd * (*cs++)) + (bu * (*ca++)); - } - } - } -} - - -/* *INDENT-OFF* */ - -/* - DCT insipired by Jeff Tsay's DCT from the maplay package - this is an optimized version with manual unroll. - - References: - [1] S. Winograd: "On Computing the Discrete Fourier Transform", - Mathematics of Computation, Volume 32, Number 141, January 1978, - Pages 175-199 -*/ - -static void dct36(real *inbuf,real *o1,real *o2,real *wintab,real *tsbuf) -{ - { - real *in = inbuf; - - in[17]+=in[16]; in[16]+=in[15]; in[15]+=in[14]; - in[14]+=in[13]; in[13]+=in[12]; in[12]+=in[11]; - in[11]+=in[10]; in[10]+=in[9]; in[9] +=in[8]; - in[8] +=in[7]; in[7] +=in[6]; in[6] +=in[5]; - in[5] +=in[4]; in[4] +=in[3]; in[3] +=in[2]; - in[2] +=in[1]; in[1] +=in[0]; - - in[17]+=in[15]; in[15]+=in[13]; in[13]+=in[11]; in[11]+=in[9]; - in[9] +=in[7]; in[7] +=in[5]; in[5] +=in[3]; in[3] +=in[1]; - - { - -#define MACRO0(v) { \ - real tmp; \ - out2[9+(v)] = (tmp = sum0 + sum1) * w[27+(v)]; \ - out2[8-(v)] = tmp * w[26-(v)]; } \ - sum0 -= sum1; \ - ts[SBLIMIT*(8-(v))] = out1[8-(v)] + sum0 * w[8-(v)]; \ - ts[SBLIMIT*(9+(v))] = out1[9+(v)] + sum0 * w[9+(v)]; -#define MACRO1(v) { \ - real sum0,sum1; \ - sum0 = tmp1a + tmp2a; \ - sum1 = (tmp1b + tmp2b) * tfcos36[(v)]; \ - MACRO0(v); } -#define MACRO2(v) { \ - real sum0,sum1; \ - sum0 = tmp2a - tmp1a; \ - sum1 = (tmp2b - tmp1b) * tfcos36[(v)]; \ - MACRO0(v); } - - const real *c = COS9; - real *out2 = o2; - real *w = wintab; - real *out1 = o1; - real *ts = tsbuf; - - real ta33,ta66,tb33,tb66; - - ta33 = in[2*3+0] * c[3]; - ta66 = in[2*6+0] * c[6]; - tb33 = in[2*3+1] * c[3]; - tb66 = in[2*6+1] * c[6]; - - { - real tmp1a,tmp2a,tmp1b,tmp2b; - tmp1a = in[2*1+0] * c[1] + ta33 + in[2*5+0] * c[5] + in[2*7+0] * c[7]; - tmp1b = in[2*1+1] * c[1] + tb33 + in[2*5+1] * c[5] + in[2*7+1] * c[7]; - tmp2a = in[2*0+0] + in[2*2+0] * c[2] + in[2*4+0] * c[4] + ta66 + in[2*8+0] * c[8]; - tmp2b = in[2*0+1] + in[2*2+1] * c[2] + in[2*4+1] * c[4] + tb66 + in[2*8+1] * c[8]; - - MACRO1(0); - MACRO2(8); - } - - { - real tmp1a,tmp2a,tmp1b,tmp2b; - tmp1a = ( in[2*1+0] - in[2*5+0] - in[2*7+0] ) * c[3]; - tmp1b = ( in[2*1+1] - in[2*5+1] - in[2*7+1] ) * c[3]; - tmp2a = ( in[2*2+0] - in[2*4+0] - in[2*8+0] ) * c[6] - in[2*6+0] + in[2*0+0]; - tmp2b = ( in[2*2+1] - in[2*4+1] - in[2*8+1] ) * c[6] - in[2*6+1] + in[2*0+1]; - - MACRO1(1); - MACRO2(7); - } - - { - real tmp1a,tmp2a,tmp1b,tmp2b; - tmp1a = in[2*1+0] * c[5] - ta33 - in[2*5+0] * c[7] + in[2*7+0] * c[1]; - tmp1b = in[2*1+1] * c[5] - tb33 - in[2*5+1] * c[7] + in[2*7+1] * c[1]; - tmp2a = in[2*0+0] - in[2*2+0] * c[8] - in[2*4+0] * c[2] + ta66 + in[2*8+0] * c[4]; - tmp2b = in[2*0+1] - in[2*2+1] * c[8] - in[2*4+1] * c[2] + tb66 + in[2*8+1] * c[4]; - - MACRO1(2); - MACRO2(6); - } - - { - real tmp1a,tmp2a,tmp1b,tmp2b; - tmp1a = in[2*1+0] * c[7] - ta33 + in[2*5+0] * c[1] - in[2*7+0] * c[5]; - tmp1b = in[2*1+1] * c[7] - tb33 + in[2*5+1] * c[1] - in[2*7+1] * c[5]; - tmp2a = in[2*0+0] - in[2*2+0] * c[4] + in[2*4+0] * c[8] + ta66 - in[2*8+0] * c[2]; - tmp2b = in[2*0+1] - in[2*2+1] * c[4] + in[2*4+1] * c[8] + tb66 - in[2*8+1] * c[2]; - - MACRO1(3); - MACRO2(5); - } - - { - real sum0,sum1; - sum0 = in[2*0+0] - in[2*2+0] + in[2*4+0] - in[2*6+0] + in[2*8+0]; - sum1 = (in[2*0+1] - in[2*2+1] + in[2*4+1] - in[2*6+1] + in[2*8+1] ) * tfcos36[4]; - MACRO0(4); - } - } - - } -} - - -/* - * new DCT12 - */ -static void dct12(real *in,real *rawout1,real *rawout2,real *wi,real *ts) -{ -#define DCT12_PART1 \ - in5 = in[5*3]; \ - in5 += (in4 = in[4*3]); \ - in4 += (in3 = in[3*3]); \ - in3 += (in2 = in[2*3]); \ - in2 += (in1 = in[1*3]); \ - in1 += (in0 = in[0*3]); \ - \ - in5 += in3; in3 += in1; \ - \ - in2 *= COS6_1; \ - in3 *= COS6_1; \ - -#define DCT12_PART2 \ - in0 += in4 * COS6_2; \ - \ - in4 = in0 + in2; \ - in0 -= in2; \ - \ - in1 += in5 * COS6_2; \ - \ - in5 = (in1 + in3) * tfcos12[0]; \ - in1 = (in1 - in3) * tfcos12[2]; \ - \ - in3 = in4 + in5; \ - in4 -= in5; \ - \ - in2 = in0 + in1; \ - in0 -= in1; - - - { - real in0,in1,in2,in3,in4,in5; - real *out1 = rawout1; - ts[SBLIMIT*0] = out1[0]; ts[SBLIMIT*1] = out1[1]; ts[SBLIMIT*2] = out1[2]; - ts[SBLIMIT*3] = out1[3]; ts[SBLIMIT*4] = out1[4]; ts[SBLIMIT*5] = out1[5]; - - DCT12_PART1 - - { - real tmp0,tmp1 = (in0 - in4); - { - real tmp2 = (in1 - in5) * tfcos12[1]; - tmp0 = tmp1 + tmp2; - tmp1 -= tmp2; - } - ts[(17-1)*SBLIMIT] = out1[17-1] + tmp0 * wi[11-1]; - ts[(12+1)*SBLIMIT] = out1[12+1] + tmp0 * wi[6+1]; - ts[(6 +1)*SBLIMIT] = out1[6 +1] + tmp1 * wi[1]; - ts[(11-1)*SBLIMIT] = out1[11-1] + tmp1 * wi[5-1]; - } - - DCT12_PART2 - - ts[(17-0)*SBLIMIT] = out1[17-0] + in2 * wi[11-0]; - ts[(12+0)*SBLIMIT] = out1[12+0] + in2 * wi[6+0]; - ts[(12+2)*SBLIMIT] = out1[12+2] + in3 * wi[6+2]; - ts[(17-2)*SBLIMIT] = out1[17-2] + in3 * wi[11-2]; - - ts[(6+0)*SBLIMIT] = out1[6+0] + in0 * wi[0]; - ts[(11-0)*SBLIMIT] = out1[11-0] + in0 * wi[5-0]; - ts[(6+2)*SBLIMIT] = out1[6+2] + in4 * wi[2]; - ts[(11-2)*SBLIMIT] = out1[11-2] + in4 * wi[5-2]; - } - - in++; - - { - real in0,in1,in2,in3,in4,in5; - real *out2 = rawout2; - - DCT12_PART1 - - { - real tmp0,tmp1 = (in0 - in4); - { - real tmp2 = (in1 - in5) * tfcos12[1]; - tmp0 = tmp1 + tmp2; - tmp1 -= tmp2; - } - out2[5-1] = tmp0 * wi[11-1]; - out2[0+1] = tmp0 * wi[6+1]; - ts[(12+1)*SBLIMIT] += tmp1 * wi[1]; - ts[(17-1)*SBLIMIT] += tmp1 * wi[5-1]; - } - - DCT12_PART2 - - out2[5-0] = in2 * wi[11-0]; - out2[0+0] = in2 * wi[6+0]; - out2[0+2] = in3 * wi[6+2]; - out2[5-2] = in3 * wi[11-2]; - - ts[(12+0)*SBLIMIT] += in0 * wi[0]; - ts[(17-0)*SBLIMIT] += in0 * wi[5-0]; - ts[(12+2)*SBLIMIT] += in4 * wi[2]; - ts[(17-2)*SBLIMIT] += in4 * wi[5-2]; - } - - in++; - - { - real in0,in1,in2,in3,in4,in5; - real *out2 = rawout2; - out2[12]=out2[13]=out2[14]=out2[15]=out2[16]=out2[17]=0.0; - - DCT12_PART1 - - { - real tmp0,tmp1 = (in0 - in4); - { - real tmp2 = (in1 - in5) * tfcos12[1]; - tmp0 = tmp1 + tmp2; - tmp1 -= tmp2; - } - out2[11-1] = tmp0 * wi[11-1]; - out2[6 +1] = tmp0 * wi[6+1]; - out2[0+1] += tmp1 * wi[1]; - out2[5-1] += tmp1 * wi[5-1]; - } - - DCT12_PART2 - - out2[11-0] = in2 * wi[11-0]; - out2[6 +0] = in2 * wi[6+0]; - out2[6 +2] = in3 * wi[6+2]; - out2[11-2] = in3 * wi[11-2]; - - out2[0+0] += in0 * wi[0]; - out2[5-0] += in0 * wi[5-0]; - out2[0+2] += in4 * wi[2]; - out2[5-2] += in4 * wi[5-2]; - } -} -/* *INDENT-ON* */ - -/* - * III_hybrid - */ -static void -III_hybrid(PMPSTR mp, real fsIn[SBLIMIT][SSLIMIT], real tsOut[SSLIMIT][SBLIMIT], - int ch, struct gr_info_s *gr_infos) -{ - real *tspnt = (real *) tsOut; - real(*block)[2][SBLIMIT * SSLIMIT] = mp->hybrid_block; - int *blc = mp->hybrid_blc; - real *rawout1, *rawout2; - int bt; - int sb = 0; - - { - int b = blc[ch]; - rawout1 = block[b][ch]; - b = -b + 1; - rawout2 = block[b][ch]; - blc[ch] = b; - } - - - if (gr_infos->mixed_block_flag) { - sb = 2; - dct36(fsIn[0], rawout1, rawout2, win[0], tspnt); - dct36(fsIn[1], rawout1 + 18, rawout2 + 18, win1[0], tspnt + 1); - rawout1 += 36; - rawout2 += 36; - tspnt += 2; - } - - bt = gr_infos->block_type; - if (bt == 2) { - for (; sb < (int) gr_infos->maxb; sb += 2, tspnt += 2, rawout1 += 36, rawout2 += 36) { - dct12(fsIn[sb], rawout1, rawout2, win[2], tspnt); - dct12(fsIn[sb + 1], rawout1 + 18, rawout2 + 18, win1[2], tspnt + 1); - } - } - else { - for (; sb < (int) gr_infos->maxb; sb += 2, tspnt += 2, rawout1 += 36, rawout2 += 36) { - dct36(fsIn[sb], rawout1, rawout2, win[bt], tspnt); - dct36(fsIn[sb + 1], rawout1 + 18, rawout2 + 18, win1[bt], tspnt + 1); - } - } - - for (; sb < SBLIMIT; sb++, tspnt++) { - int i; - for (i = 0; i < SSLIMIT; i++) { - tspnt[i * SBLIMIT] = *rawout1++; - *rawout2++ = 0.0; - } - } -} - -/* - * main layer3 handler - */ - -int -layer3_audiodata_precedesframes(PMPSTR mp) -{ - int audioDataInFrame; - int framesToBacktrack; - - /* specific to Layer 3, since Layer 1 & 2 the audio data starts at the frame that describes it. */ - /* determine how many bytes and therefore bitstream frames the audio data precedes it's matching frame */ - /* lame_report_fnc(mp->report_err, "hip: main_data_begin = %d, mp->bsize %d, mp->fsizeold %d, mp->ssize %d\n", - sideinfo.main_data_begin, mp->bsize, mp->fsizeold, mp->ssize); */ - /* compute the number of frames to backtrack, 4 for the header, ssize already holds the CRC */ - /* TODO Erroneously assumes current frame is same as previous frame. */ - audioDataInFrame = mp->bsize - 4 - mp->ssize; - framesToBacktrack = (mp->sideinfo.main_data_begin + audioDataInFrame - 1) / audioDataInFrame; - /* lame_report_fnc(mp->report_err, "hip: audioDataInFrame %d framesToBacktrack %d\n", audioDataInFrame, framesToBacktrack); */ - return framesToBacktrack; -} - -int -decode_layer3_sideinfo(PMPSTR mp) -{ - struct frame *fr = &mp->fr; - int stereo = fr->stereo; - int single = fr->single; - int ms_stereo; - int sfreq = fr->sampling_frequency; - int granules; - int ch, gr, databits; - - if (stereo == 1) { /* stream is mono */ - single = 0; - } - - if (fr->mode == MPG_MD_JOINT_STEREO) { - ms_stereo = fr->mode_ext & 0x2; - } - else - ms_stereo = 0; - - - if (fr->lsf) { - granules = 1; - III_get_side_info_2(mp, stereo, ms_stereo, sfreq, single); - } - else { - granules = 2; - III_get_side_info_1(mp, stereo, ms_stereo, sfreq, single); - } - - databits = 0; - for (gr = 0; gr < granules; ++gr) { - for (ch = 0; ch < stereo; ++ch) { - struct gr_info_s *gr_infos = &(mp->sideinfo.ch[ch].gr[gr]); - databits += gr_infos->part2_3_length; - } - } - return databits - 8 * mp->sideinfo.main_data_begin; -} - - - -int -decode_layer3_frame(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point, - int (*synth_1to1_mono_ptr) (PMPSTR, real *, unsigned char *, int *), - int (*synth_1to1_ptr) (PMPSTR, real *, int, unsigned char *, int *)) -{ - int gr, ch, ss, clip = 0; - int scalefacs[2][39]; /* max 39 for short[13][3] mode, mixed: 38, long: 22 */ - /* struct III_sideinfo sideinfo; */ - struct frame *fr = &(mp->fr); - int stereo = fr->stereo; - int single = fr->single; - int ms_stereo, i_stereo; - int sfreq = fr->sampling_frequency; - int stereo1, granules; - real hybridIn[2][SBLIMIT][SSLIMIT]; - real hybridOut[2][SSLIMIT][SBLIMIT]; - - if (set_pointer(mp, (int) mp->sideinfo.main_data_begin) == MP3_ERR) - return 0; - - if (stereo == 1) { /* stream is mono */ - stereo1 = 1; - single = 0; - } - else if (single >= 0) /* stream is stereo, but force to mono */ - stereo1 = 1; - else - stereo1 = 2; - - if (fr->mode == MPG_MD_JOINT_STEREO) { - ms_stereo = fr->mode_ext & 0x2; - i_stereo = fr->mode_ext & 0x1; - } - else - ms_stereo = i_stereo = 0; - - - if (fr->lsf) { - granules = 1; - } - else { - granules = 2; - } - - for (gr = 0; gr < granules; gr++) { - - { - struct gr_info_s *gr_infos = &(mp->sideinfo.ch[0].gr[gr]); - long part2bits; - - if (fr->lsf) - part2bits = III_get_scale_factors_2(mp, scalefacs[0], gr_infos, 0); - else { - part2bits = III_get_scale_factors_1(mp, scalefacs[0], gr_infos); - } - if (mp->pinfo != NULL) { - int i; - mp->pinfo->sfbits[gr][0] = part2bits; - for (i = 0; i < 39; i++) - mp->pinfo->sfb_s[gr][0][i] = scalefacs[0][i]; - } - - /* lame_report_fnc(mp->report_err, "calling III dequantize sample 1 gr_infos->part2_3_length %d\n", gr_infos->part2_3_length); */ - if (III_dequantize_sample(mp, hybridIn[0], scalefacs[0], gr_infos, sfreq, part2bits)) - return clip; - } - if (stereo == 2) { - struct gr_info_s *gr_infos = &(mp->sideinfo.ch[1].gr[gr]); - long part2bits; - if (fr->lsf) - part2bits = III_get_scale_factors_2(mp, scalefacs[1], gr_infos, i_stereo); - else { - part2bits = III_get_scale_factors_1(mp, scalefacs[1], gr_infos); - } - if (mp->pinfo != NULL) { - int i; - mp->pinfo->sfbits[gr][1] = part2bits; - for (i = 0; i < 39; i++) - mp->pinfo->sfb_s[gr][1][i] = scalefacs[1][i]; - } - - /* lame_report_fnc(mp->report_err, "calling III dequantize sample 2 gr_infos->part2_3_length %d\n", gr_infos->part2_3_length); */ - if (III_dequantize_sample(mp, hybridIn[1], scalefacs[1], gr_infos, sfreq, part2bits)) - return clip; - - if (ms_stereo) { - int i; - for (i = 0; i < SBLIMIT * SSLIMIT; i++) { - real tmp0, tmp1; - tmp0 = ((real *) hybridIn[0])[i]; - tmp1 = ((real *) hybridIn[1])[i]; - ((real *) hybridIn[1])[i] = tmp0 - tmp1; - ((real *) hybridIn[0])[i] = tmp0 + tmp1; - } - } - - if (i_stereo) - III_i_stereo(hybridIn, scalefacs[1], gr_infos, sfreq, ms_stereo, fr->lsf); - - if (ms_stereo || i_stereo || (single == 3)) { - if (gr_infos->maxb > mp->sideinfo.ch[0].gr[gr].maxb) - mp->sideinfo.ch[0].gr[gr].maxb = gr_infos->maxb; - else - gr_infos->maxb = mp->sideinfo.ch[0].gr[gr].maxb; - } - - switch (single) { - case 3: - { - int i; - real *in0 = (real *) hybridIn[0], *in1 = (real *) hybridIn[1]; - for (i = 0; i < (int) (SSLIMIT * gr_infos->maxb); i++, in0++) - *in0 = (*in0 + *in1++); /* *0.5 done by pow-scale */ - } - break; - case 1: - { - int i; - real *in0 = (real *) hybridIn[0], *in1 = (real *) hybridIn[1]; - for (i = 0; i < (int) (SSLIMIT * gr_infos->maxb); i++) - *in0++ = *in1++; - } - break; - } - } - - if (mp->pinfo != NULL) { - int i, sb; - float ifqstep; - - mp->pinfo->bitrate = tabsel_123[fr->lsf][fr->lay - 1][fr->bitrate_index]; - mp->pinfo->sampfreq = freqs[sfreq]; - mp->pinfo->emph = fr->emphasis; - mp->pinfo->crc = fr->error_protection; - mp->pinfo->padding = fr->padding; - mp->pinfo->stereo = fr->stereo; - mp->pinfo->js = (fr->mode == MPG_MD_JOINT_STEREO); - mp->pinfo->ms_stereo = ms_stereo; - mp->pinfo->i_stereo = i_stereo; - mp->pinfo->maindata = mp->sideinfo.main_data_begin; - - for (ch = 0; ch < stereo1; ch++) { - struct gr_info_s *gr_infos = &(mp->sideinfo.ch[ch].gr[gr]); - mp->pinfo->big_values[gr][ch] = gr_infos->big_values; - mp->pinfo->scalefac_scale[gr][ch] = gr_infos->scalefac_scale; - mp->pinfo->mixed[gr][ch] = gr_infos->mixed_block_flag; - mp->pinfo->mpg123blocktype[gr][ch] = gr_infos->block_type; - mp->pinfo->mainbits[gr][ch] = gr_infos->part2_3_length; - mp->pinfo->preflag[gr][ch] = gr_infos->preflag; - if (gr == 1) - mp->pinfo->scfsi[ch] = gr_infos->scfsi; - } - - - for (ch = 0; ch < stereo1; ch++) { - struct gr_info_s *gr_infos = &(mp->sideinfo.ch[ch].gr[gr]); - ifqstep = (mp->pinfo->scalefac_scale[gr][ch] == 0) ? .5 : 1.0; - if (2 == gr_infos->block_type) { - for (i = 0; i < 3; i++) { - for (sb = 0; sb < 12; sb++) { - int j = 3 * sb + i; - /* - is_p = scalefac[sfb*3+lwin-gr_infos->mixed_block_flag]; - */ - /* scalefac was copied into pinfo->sfb_s[] above */ - mp->pinfo->sfb_s[gr][ch][j] = - -ifqstep * mp->pinfo->sfb_s[gr][ch][j - gr_infos->mixed_block_flag]; - mp->pinfo->sfb_s[gr][ch][j] -= 2 * (mp->pinfo->sub_gain[gr][ch][i]); - } - mp->pinfo->sfb_s[gr][ch][3 * sb + i] = - -2 * (mp->pinfo->sub_gain[gr][ch][i]); - } - } - else { - for (sb = 0; sb < 21; sb++) { - /* scalefac was copied into pinfo->sfb[] above */ - mp->pinfo->sfb[gr][ch][sb] = mp->pinfo->sfb_s[gr][ch][sb]; - if (gr_infos->preflag) - mp->pinfo->sfb[gr][ch][sb] += pretab1[sb]; - mp->pinfo->sfb[gr][ch][sb] *= -ifqstep; - } - mp->pinfo->sfb[gr][ch][21] = 0; - } - } - - - - for (ch = 0; ch < stereo1; ch++) { - int j = 0; - for (sb = 0; sb < SBLIMIT; sb++) - for (ss = 0; ss < SSLIMIT; ss++, j++) - mp->pinfo->mpg123xr[gr][ch][j] = hybridIn[ch][sb][ss]; - } - } - - - for (ch = 0; ch < stereo1; ch++) { - struct gr_info_s *gr_infos = &(mp->sideinfo.ch[ch].gr[gr]); - III_antialias(hybridIn[ch], gr_infos); - III_hybrid(mp, hybridIn[ch], hybridOut[ch], ch, gr_infos); - } - - for (ss = 0; ss < SSLIMIT; ss++) { - if (single >= 0) { - clip += (*synth_1to1_mono_ptr) (mp, hybridOut[0][ss], pcm_sample, pcm_point); - } - else { - int p1 = *pcm_point; - clip += (*synth_1to1_ptr) (mp, hybridOut[0][ss], 0, pcm_sample, &p1); - clip += (*synth_1to1_ptr) (mp, hybridOut[1][ss], 1, pcm_sample, pcm_point); - } - } - } - - return clip; -} diff --git a/lib-src/mpglib/layer3.h b/lib-src/mpglib/layer3.h deleted file mode 100644 index 2e3019207..000000000 --- a/lib-src/mpglib/layer3.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef LAYER3_H_INCLUDED -#define LAYER3_H_INCLUDED - -void hip_init_tables_layer3(void); -int decode_layer3_sideinfo(PMPSTR mp); -int decode_layer3_frame(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point, - int (*synth_1to1_mono_ptr) (PMPSTR, real *, unsigned char *, int *), - int (*synth_1to1_ptr) (PMPSTR, real *, int, unsigned char *, int *)); -int layer3_audiodata_precedesframes(PMPSTR mp); - -#endif diff --git a/lib-src/mpglib/mpg123.h b/lib-src/mpglib/mpg123.h deleted file mode 100644 index 6ac8b67c5..000000000 --- a/lib-src/mpglib/mpg123.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef MPG123_H_INCLUDED -#define MPG123_H_INCLUDED - -#include - -#ifdef STDC_HEADERS -# include -#else -# ifndef HAVE_STRCHR -# define strchr index -# define strrchr rindex -# endif -char *strchr(), *strrchr(); -# ifndef HAVE_MEMCPY -# define memcpy(d, s, n) bcopy ((s), (d), (n)) -# define memmove(d, s, n) bcopy ((s), (d), (n)) -# endif -#endif - -#include - - -#if defined(__riscos__) && defined(FPA10) -#include "ymath.h" -#else -#include -#endif - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif -#ifndef M_SQRT2 -#define M_SQRT2 1.41421356237309504880 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - -#undef REAL_IS_FLOAT -#define REAL_IS_FLOAT - -#ifdef REAL_IS_FLOAT -# define real float -#elif defined(REAL_IS_LONG_DOUBLE) -# define real long double -#else -# define real double -#endif - -#define FALSE 0 -#define TRUE 1 - -#define SBLIMIT 32 -#define SSLIMIT 18 - -#define MPG_MD_STEREO 0 -#define MPG_MD_JOINT_STEREO 1 -#define MPG_MD_DUAL_CHANNEL 2 -#define MPG_MD_MONO 3 - -#define MAXFRAMESIZE 2880 - -/* AF: ADDED FOR LAYER1/LAYER2 */ -#define SCALE_BLOCK 12 - - -/* Pre Shift fo 16 to 8 bit converter table */ -#define AUSHIFT (3) - -struct frame { - int stereo; - int single; /* single channel (monophonic) */ - int lsf; /* 0 = MPEG-1, 1 = MPEG-2/2.5 */ - int mpeg25; /* 1 = MPEG-2.5, 0 = MPEG-1/2 */ - int header_change; - int lay; /* Layer */ - int error_protection; /* 1 = CRC-16 code following header */ - int bitrate_index; - int sampling_frequency; /* sample rate of decompressed audio in Hz */ - int padding; - int extension; - int mode; - int mode_ext; - int copyright; - int original; - int emphasis; - int framesize; /* computed framesize */ - - /* AF: ADDED FOR LAYER1/LAYER2 */ - int II_sblimit; - struct al_table2 const *alloc; - int down_sample_sblimit; - int down_sample; - - -}; - -struct gr_info_s { - int scfsi; - unsigned part2_3_length; - unsigned big_values; - unsigned scalefac_compress; - unsigned block_type; - unsigned mixed_block_flag; - unsigned table_select[3]; - unsigned subblock_gain[3]; - unsigned maxband[3]; - unsigned maxbandl; - unsigned maxb; - unsigned region1start; - unsigned region2start; - unsigned preflag; - unsigned scalefac_scale; - unsigned count1table_select; - real *full_gain[3]; - real *pow2gain; -}; - -struct III_sideinfo { - unsigned main_data_begin; - unsigned private_bits; - struct { - struct gr_info_s gr[2]; - } ch[2]; -}; - - -#endif diff --git a/lib-src/mpglib/mpglib.h b/lib-src/mpglib/mpglib.h deleted file mode 100644 index 7ab4d5f43..000000000 --- a/lib-src/mpglib/mpglib.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef _MPGLIB_H_ -#define _MPGLIB_H_ - -#include "lame.h" - -#ifndef plotting_data_defined -#define plotting_data_defined -struct plotting_data; -typedef struct plotting_data plotting_data; -#endif - - -extern void lame_report_fnc(lame_report_function f, const char *format, ...); - -struct buf { - unsigned char *pnt; - long size; - long pos; - struct buf *next; - struct buf *prev; -}; - -struct framebuf { - struct buf *buf; - long pos; - struct frame *next; - struct frame *prev; -}; - -typedef struct mpstr_tag { - struct buf *head, *tail; /* buffer linked list pointers, tail points to oldest buffer */ - int vbr_header; /* 1 if valid Xing vbr header detected */ - int num_frames; /* set if vbr header present */ - int enc_delay; /* set if vbr header present */ - int enc_padding; /* set if vbr header present */ - /* header_parsed, side_parsed and data_parsed must be all set 1 - before the full frame has been parsed */ - int header_parsed; /* 1 = header of current frame has been parsed */ - int side_parsed; /* 1 = header of sideinfo of current frame has been parsed */ - int data_parsed; - int free_format; /* 1 = free format frame */ - int old_free_format; /* 1 = last frame was free format */ - int bsize; - int framesize; - int ssize; /* number of bytes used for side information, including 2 bytes for CRC-16 if present */ - int dsize; - int fsizeold; /* size of previous frame, -1 for first */ - int fsizeold_nopadding; - struct frame fr; /* holds the parameters decoded from the header */ - struct III_sideinfo sideinfo; - unsigned char bsspace[2][MAXFRAMESIZE + 1024]; /* bit stream space used ???? */ /* MAXFRAMESIZE */ - real hybrid_block[2][2][SBLIMIT * SSLIMIT]; - int hybrid_blc[2]; - unsigned long header; - int bsnum; - real synth_buffs[2][2][0x110]; - int synth_bo; - int sync_bitstream; /* 1 = bitstream is yet to be synchronized */ - - int bitindex; - unsigned char *wordpointer; - plotting_data *pinfo; - - lame_report_function report_msg; - lame_report_function report_dbg; - lame_report_function report_err; -} MPSTR, *PMPSTR; - - -#define MP3_ERR -1 -#define MP3_OK 0 -#define MP3_NEED_MORE 1 - - - -#endif /* _MPGLIB_H_ */ diff --git a/lib-src/mpglib/tabinit.c b/lib-src/mpglib/tabinit.c deleted file mode 100644 index 7eeaca470..000000000 --- a/lib-src/mpglib/tabinit.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * tabinit.c - * - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* $Id: tabinit.c,v 1.17 2017/09/06 15:07:30 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include "tabinit.h" -#include "mpg123.h" - -#ifdef WITH_DMALLOC -#include -#endif - -static int table_init_called = 0; - -real decwin[512 + 32]; -static real cos64[16], cos32[8], cos16[4], cos8[2], cos4[1]; -real *pnts[] = { cos64, cos32, cos16, cos8, cos4 }; - -/* *INDENT-OFF* */ - -static const double dewin[512] = { - 0.000000000,-0.000015259,-0.000015259,-0.000015259, - -0.000015259,-0.000015259,-0.000015259,-0.000030518, - -0.000030518,-0.000030518,-0.000030518,-0.000045776, - -0.000045776,-0.000061035,-0.000061035,-0.000076294, - -0.000076294,-0.000091553,-0.000106812,-0.000106812, - -0.000122070,-0.000137329,-0.000152588,-0.000167847, - -0.000198364,-0.000213623,-0.000244141,-0.000259399, - -0.000289917,-0.000320435,-0.000366211,-0.000396729, - -0.000442505,-0.000473022,-0.000534058,-0.000579834, - -0.000625610,-0.000686646,-0.000747681,-0.000808716, - -0.000885010,-0.000961304,-0.001037598,-0.001113892, - -0.001205444,-0.001296997,-0.001388550,-0.001480103, - -0.001586914,-0.001693726,-0.001785278,-0.001907349, - -0.002014160,-0.002120972,-0.002243042,-0.002349854, - -0.002456665,-0.002578735,-0.002685547,-0.002792358, - -0.002899170,-0.002990723,-0.003082275,-0.003173828, - -0.003250122,-0.003326416,-0.003387451,-0.003433228, - -0.003463745,-0.003479004,-0.003479004,-0.003463745, - -0.003417969,-0.003372192,-0.003280640,-0.003173828, - -0.003051758,-0.002883911,-0.002700806,-0.002487183, - -0.002227783,-0.001937866,-0.001617432,-0.001266479, - -0.000869751,-0.000442505, 0.000030518, 0.000549316, - 0.001098633, 0.001693726, 0.002334595, 0.003005981, - 0.003723145, 0.004486084, 0.005294800, 0.006118774, - 0.007003784, 0.007919312, 0.008865356, 0.009841919, - 0.010848999, 0.011886597, 0.012939453, 0.014022827, - 0.015121460, 0.016235352, 0.017349243, 0.018463135, - 0.019577026, 0.020690918, 0.021789551, 0.022857666, - 0.023910522, 0.024932861, 0.025909424, 0.026840210, - 0.027725220, 0.028533936, 0.029281616, 0.029937744, - 0.030532837, 0.031005859, 0.031387329, 0.031661987, - 0.031814575, 0.031845093, 0.031738281, 0.031478882, - 0.031082153, 0.030517578, 0.029785156, 0.028884888, - 0.027801514, 0.026535034, 0.025085449, 0.023422241, - 0.021575928, 0.019531250, 0.017257690, 0.014801025, - 0.012115479, 0.009231567, 0.006134033, 0.002822876, - -0.000686646,-0.004394531,-0.008316040,-0.012420654, - -0.016708374,-0.021179199,-0.025817871,-0.030609131, - -0.035552979,-0.040634155,-0.045837402,-0.051132202, - -0.056533813,-0.061996460,-0.067520142,-0.073059082, - -0.078628540,-0.084182739,-0.089706421,-0.095169067, - -0.100540161,-0.105819702,-0.110946655,-0.115921021, - -0.120697021,-0.125259399,-0.129562378,-0.133590698, - -0.137298584,-0.140670776,-0.143676758,-0.146255493, - -0.148422241,-0.150115967,-0.151306152,-0.151962280, - -0.152069092,-0.151596069,-0.150497437,-0.148773193, - -0.146362305,-0.143264771,-0.139450073,-0.134887695, - -0.129577637,-0.123474121,-0.116577148,-0.108856201, - -0.100311279,-0.090927124,-0.080688477,-0.069595337, - -0.057617187,-0.044784546,-0.031082153,-0.016510010, - -0.001068115, 0.015228271, 0.032379150, 0.050354004, - 0.069168091, 0.088775635, 0.109161377, 0.130310059, - 0.152206421, 0.174789429, 0.198059082, 0.221984863, - 0.246505737, 0.271591187, 0.297210693, 0.323318481, - 0.349868774, 0.376800537, 0.404083252, 0.431655884, - 0.459472656, 0.487472534, 0.515609741, 0.543823242, - 0.572036743, 0.600219727, 0.628295898, 0.656219482, - 0.683914185, 0.711318970, 0.738372803, 0.765029907, - 0.791213989, 0.816864014, 0.841949463, 0.866363525, - 0.890090942, 0.913055420, 0.935195923, 0.956481934, - 0.976852417, 0.996246338, 1.014617920, 1.031936646, - 1.048156738, 1.063217163, 1.077117920, 1.089782715, - 1.101211548, 1.111373901, 1.120223999, 1.127746582, - 1.133926392, 1.138763428, 1.142211914, 1.144287109, - 1.144989014 -}; -/* *INDENT-ON* */ - -void -make_decode_tables(long scaleval) -{ - int i, j, k, kr, divv; - real *table, *costab; - - if (table_init_called) - return; - - table_init_called = 1; - - for (i = 0; i < 5; i++) { - kr = 0x10 >> i; - divv = 0x40 >> i; - costab = pnts[i]; - for (k = 0; k < kr; k++) - costab[k] = (real) (1.0 / (2.0 * cos(M_PI * ((double) k * 2.0 + 1.0) / (double) divv))); - } - - table = decwin; - scaleval = -scaleval; - for (i = 0, j = 0; i < 256; i++, j++, table += 32) { - if (table < decwin + 512 + 16) - table[16] = table[0] = (real) (dewin[j] * scaleval); - if (i % 32 == 31) - table -= 1023; - if (i % 64 == 63) - scaleval = -scaleval; - } - - for ( /* i=256 */ ; i < 512; i++, j--, table += 32) { - if (table < decwin + 512 + 16) - table[16] = table[0] = (real) (dewin[j] * scaleval); - if (i % 32 == 31) - table -= 1023; - if (i % 64 == 63) - scaleval = -scaleval; - } -} diff --git a/lib-src/mpglib/tabinit.h b/lib-src/mpglib/tabinit.h deleted file mode 100644 index 76f4c42a6..000000000 --- a/lib-src/mpglib/tabinit.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef MPGLIB_TABINIT_H_INCLUDED -#define MPGLIB_TABINIT_H_INCLUDED - -#include "mpg123.h" - -extern real decwin[512 + 32]; -extern real *pnts[5]; - -void make_decode_tables(long scale); - -#endif