From 8a2c2824a59d7644e13bc52c9a0ecbd641f21f95 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Wed, 13 Oct 2010 19:34:22 +0000 Subject: new branch muse2, first checkin --- muse2/al/Makefile.am | 18 ++ muse2/al/Makefile.in | 595 +++++++++++++++++++++++++++++++++++++++++++++++++++ muse2/al/al.cpp | 29 +++ muse2/al/al.h | 34 +++ muse2/al/dsp.cpp | 182 ++++++++++++++++ muse2/al/dsp.h | 107 +++++++++ muse2/al/dspSSE.cpp | 531 +++++++++++++++++++++++++++++++++++++++++++++ muse2/al/dspXMM.cpp | 119 +++++++++++ 8 files changed, 1615 insertions(+) create mode 100644 muse2/al/Makefile.am create mode 100644 muse2/al/Makefile.in create mode 100644 muse2/al/al.cpp create mode 100644 muse2/al/al.h create mode 100644 muse2/al/dsp.cpp create mode 100644 muse2/al/dsp.h create mode 100644 muse2/al/dspSSE.cpp create mode 100644 muse2/al/dspXMM.cpp (limited to 'muse2/al') diff --git a/muse2/al/Makefile.am b/muse2/al/Makefile.am new file mode 100644 index 00000000..f2464217 --- /dev/null +++ b/muse2/al/Makefile.am @@ -0,0 +1,18 @@ +include $(top_srcdir)/common.am + +if PCH +AM_CXXFLAGS += -include $(top_srcdir)/all.h +endif + +noinst_LIBRARIES = libal.a + +dist_libal_a_SOURCES = \ + al.cpp al.h \ + dsp.cpp dsp.h + +if USE_SSE +dist_libal_a_SOURCES += dspSSE.cpp dspXMM.cpp +dspSSE.o: dspSSE.cpp + $(CXXCOMPILE) -x assembler -c dspSSE.cpp +endif + diff --git a/muse2/al/Makefile.in b/muse2/al/Makefile.in new file mode 100644 index 00000000..7f747537 --- /dev/null +++ b/muse2/al/Makefile.in @@ -0,0 +1,595 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ + +VPATH = @srcdir@ +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@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/common.am +@PCH_TRUE@am__append_1 = -include $(top_srcdir)/all.h +@USE_SSE_TRUE@am__append_2 = dspSSE.cpp dspXMM.cpp +subdir = al +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \ + $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libal_a_AR = $(AR) $(ARFLAGS) +libal_a_LIBADD = +am__dist_libal_a_SOURCES_DIST = al.cpp al.h dsp.cpp dsp.h dspSSE.cpp \ + dspXMM.cpp +@USE_SSE_TRUE@am__objects_1 = dspSSE.$(OBJEXT) dspXMM.$(OBJEXT) +dist_libal_a_OBJECTS = al.$(OBJEXT) dsp.$(OBJEXT) $(am__objects_1) +libal_a_OBJECTS = $(dist_libal_a_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(dist_libal_a_SOURCES) +DIST_SOURCES = $(am__dist_libal_a_SOURCES_DIST) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOKSTYLE = @DOCBOOKSTYLE@ +DOCBOOKTARGETS = @DOCBOOKTARGETS@ +DOT = @DOT@ +DOTPATH = @DOTPATH@ +DOXYGEN = @DOXYGEN@ +DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@ +FST_CFLAGS = @FST_CFLAGS@ +FST_LIBS = @FST_LIBS@ +Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@ +Fluidsynth_LIBS = @Fluidsynth_LIBS@ +GIVERTCAP = @GIVERTCAP@ +GREP = @GREP@ +HAVEDOT = @HAVEDOT@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JACK_CFLAGS = @JACK_CFLAGS@ +JACK_LIBS = @JACK_LIBS@ +JADE = @JADE@ +LASH_CFLAGS = @LASH_CFLAGS@ +LASH_LIBS = @LASH_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LO_CFLAGS = @LO_CFLAGS@ +LO_LIBS = @LO_LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MUSECXXFLAGS = @MUSECXXFLAGS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSGMLS = @NSGMLS@ +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@ +PCH = @PCH@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_INCLUDES = @PYTHON_INCLUDES@ +PYTHON_LIB = @PYTHON_LIB@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +QTDIR_BIN = @QTDIR_BIN@ +QTDIR_INC = @QTDIR_INC@ +QT_LIBS = @QT_LIBS@ +RANLIB = @RANLIB@ +SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@ +SAMPLERATE_LIBS = @SAMPLERATE_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SNDFILE_CFLAGS = @SNDFILE_CFLAGS@ +SNDFILE_LIBS = @SNDFILE_LIBS@ +STRIP = @STRIP@ +SUIDBUILD = @SUIDBUILD@ +SUIDINSTALL = @SUIDINSTALL@ +USE_SSE = @USE_SSE@ +UUID_CFLAGS = @UUID_CFLAGS@ +UUID_LIBS = @UUID_LIBS@ +VERSION = @VERSION@ +XMKMF = @XMKMF@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +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@ +have_docbook = @have_docbook@ +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@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +synth_fluid = @synth_fluid@ +synth_fluidsynth = @synth_fluidsynth@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \ + -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \ + -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT $(am__append_1) +AM_CPPFLAGS = +MOC = $(QTDIR_BIN)/moc +#UIC = $(QTDIR_BIN)/uic3 +UIC = /usr/bin/uic3 +UIFILES = $(wildcard *.ui) +MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \ + if grep -q Q_OBJECT $$h; then \ + echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \ + fi; \ + done) + +BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h) +MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h) +SUFFIXES = .ui .h.gch +noinst_LIBRARIES = libal.a +dist_libal_a_SOURCES = al.cpp al.h dsp.cpp dsp.h $(am__append_2) +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .ui .h.gch .cpp .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(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) --gnu al/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu al/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libal.a: $(libal_a_OBJECTS) $(libal_a_DEPENDENCIES) + -rm -f libal.a + $(libal_a_AR) libal.a $(libal_a_OBJECTS) $(libal_a_LIBADD) + $(RANLIB) libal.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/al.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dsp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dspSSE.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dspXMM.Po@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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 +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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" + +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: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(LIBRARIES) +installdirs: +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +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." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ + 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: all check install install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-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 uninstall uninstall-am + + +de: + @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done + +nde: + @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done + +.ui.o: %.h + $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui + $(MOC) $*.h >> $*.cpp + $(CXXCOMPILE) -c $*.cpp -o $*.o + $(RM) $*.cpp moc_$*.cpp moc_$*.o + +.ui.lo: %.h + $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui + $(MOC) $*.h >> $*.cpp + $(LTCXXCOMPILE) -c $*.cpp -o $*.lo + $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o + +moc_%.cpp: %.h + $(MOC) $< -o $@ + +%.h: %.ui + $(UIC) -o $@ $< +# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $< +@USE_SSE_TRUE@dspSSE.o: dspSSE.cpp +@USE_SSE_TRUE@ $(CXXCOMPILE) -x assembler -c dspSSE.cpp + +# 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/muse2/al/al.cpp b/muse2/al/al.cpp new file mode 100644 index 00000000..dddb6805 --- /dev/null +++ b/muse2/al/al.cpp @@ -0,0 +1,29 @@ +//============================================================================= +// AL +// Audio Utility Library +// $Id: al.cpp,v 1.1.2.2 2009/12/06 01:39:33 terminator356 Exp $ +// +// Copyright (C) 2002-2006 by Werner Schweer and others +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//============================================================================= + +#include "al.h" + +namespace AL { + int sampleRate = 44100; + int mtcType = 0; + int division = 384; + bool debugMsg = false; + }; + diff --git a/muse2/al/al.h b/muse2/al/al.h new file mode 100644 index 00000000..2f1a02d9 --- /dev/null +++ b/muse2/al/al.h @@ -0,0 +1,34 @@ +//============================================================================= +// AL +// Audio Utility Library +// $Id: al.h,v 1.1.2.2 2009/12/06 01:39:33 terminator356 Exp $ +// +// Copyright (C) 2002-2006 by Werner Schweer and others +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//============================================================================= + +#ifndef __AL_H__ +#define __AL_H__ + +namespace AL { + + extern bool debugMsg; + extern int sampleRate; + extern int mtcType; + extern int division; + + } + +#endif + diff --git a/muse2/al/dsp.cpp b/muse2/al/dsp.cpp new file mode 100644 index 00000000..fa9fa18b --- /dev/null +++ b/muse2/al/dsp.cpp @@ -0,0 +1,182 @@ +//============================================================================= +// AL +// Audio Utility Library +// $Id: dsp.cpp,v 1.1.2.1 2009/12/06 01:39:33 terminator356 Exp $ +// +// Copyright (C) 2002-2006 by Werner Schweer and others +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//============================================================================= + +#include +#include +#include "dsp.h" +#include "config.h" +#include "../globals.h" + +namespace AL { + +Dsp* dsp = 0; + +#ifdef __i386__ + +//--------------------------------------------------------- +// DspSSE86 +//--------------------------------------------------------- + +extern "C" { +extern float x86_sse_compute_peak(float*, unsigned, float); +extern void x86_sse_apply_gain_to_buffer(float*, unsigned, float); +extern void x86_sse_mix_buffers_with_gain(float*, float*, unsigned, float); +extern void x86_sse_mix_buffers_no_gain(float*, float*, unsigned); + }; + +class DspSSE86 : public Dsp { + public: + DspSSE86() {} + virtual ~DspSSE86() {} + + virtual float peak(float* buf, unsigned n, float current) { + if ( ((intptr_t)buf % 16) != 0) { + fprintf(stderr, "peak(): buffer unaligned! (%p)\n", buf); + return Dsp::peak(buf, n, current); + } + return x86_sse_compute_peak(buf, n, current); + } + + virtual void applyGainToBuffer(float* buf, unsigned n, float gain) { + if ( ((intptr_t)buf % 16) != 0) { + fprintf(stderr, "applyGainToBuffer(): buffer unaligned! (%p)\n", buf); + Dsp::applyGainToBuffer(buf, n, gain); + } + else + x86_sse_apply_gain_to_buffer(buf, n, gain); + } + + virtual void mixWithGain(float* dst, float* src, unsigned n, float gain) { + if ( ((intptr_t)dst & 15) != 0) + fprintf(stderr, "mixWithGainain(): dst unaligned! (%p)\n", dst); + if (((intptr_t)dst & 15) != ((intptr_t)src & 15) ) { + fprintf(stderr, "mixWithGain(): dst & src don't have the same alignment!\n"); + Dsp::mixWithGain(dst, src,n, gain); + } + else + x86_sse_mix_buffers_with_gain(dst, src, n, gain); + } + virtual void mix(float* dst, float* src, unsigned n) { + if ( ((intptr_t)dst & 15) != 0) + fprintf(stderr, "mix_buffers_no_gain(): dst unaligned! %p\n", dst); + if ( ((intptr_t)dst & 15) != ((intptr_t)src & 15) ) { + fprintf(stderr, "mix_buffers_no_gain(): dst & src don't have the same alignment!\n"); + Dsp::mix(dst, src, n); + } + else + x86_sse_mix_buffers_no_gain(dst, src, n); + } + }; +#endif + +//--------------------------------------------------------- +// initDsp +//--------------------------------------------------------- + +void initDsp() + { +#if 0 // Disabled for now. +#if defined(__i386__) || defined(__x86_64__) + if(debugMsg) + printf("Muse: __i386__ or __x86_64__ defined. Using optimized float buffer copying (asm movsl).\n"); +#else + if(debugMsg) + printf("Muse: __i386__ or __x86_64__ not defined. Using non-optimized memcpy for float buffer copying.\n"); +#endif +#endif + +#if defined(__i386__) && defined(USE_SSE) + unsigned long useSSE = 0; + if(debugMsg) + printf("initDsp: __i386__ and USE_SSE defined\n"); + +// FIXME: 64? Shouldn't these routines work on 32 bit? +#ifdef __x86_64__ + useSSE = 1 << 25; // we know the platform has SSE + if(debugMsg) + printf("initDsp: __x86_64__ defined\n"); +#else + if(debugMsg) + printf("initDsp: getting cpuid via asm\n"); + asm ( + "mov $1, %%eax\n" + "pushl %%ebx\n" + "cpuid\n" + "movl %%edx, %0\n" + "popl %%ebx\n" + : "=r" (useSSE) + : + : "%eax", "%ecx", "%edx", "memory"); +#endif + if(debugMsg) + printf("initDsp: checking for bit 25 SSE support:%lX\n", useSSE); + useSSE &= (1 << 25); // bit 25 = SSE support + if (useSSE) { + printf("Using SSE optimized routines\n"); + dsp = new DspSSE86(); + return; + } + // fall through to not hardware optimized routines +#endif + if(debugMsg) + printf("Muse: using unoptimized non-SSE dsp routines\n"); + dsp = new Dsp(); + } + +//--------------------------------------------------------- +// exitDsp +//--------------------------------------------------------- + +void exitDsp() +{ + if(dsp) + delete dsp; + dsp = 0; +} + +void Dsp::cpy(float* dst, float* src, unsigned n) +{ +// FIXME: Changed by T356. Not defined. Where are these??? +//#if defined(ARCH_X86) || defined(ARCH_X86_64) +///#if defined(__i386__) || defined(__x86_64__) +#if 0 // Disabled for now. + //printf("Dsp: using asm cpy\n"); + // Changed by T356. Get To and From not declared in scope compile errors. + //register unsigned long int dummy; + //__asm__ __volatile__ ("rep; movsl" :"=&D"(dst), "=&S"(src), "=&c"(dummy) :"0" (to), "1" (from),"2" (n) : "memory"); + // FIXME: FIXME: I don't think this is correct but it works so far... + // Tried clobbering, get "Can't find a register in class `CREG' while reloading `asm'" + __asm__ __volatile__ ( + "cld\n\t" + "rep\n\t" + "movsl" + : + : "S" (src), "D" (dst), "c" (n) + : "memory" + ); + + //: "%ecx", "%esi", "%edi", "memory" +#else + //printf("Dsp: using memcpy\n"); + memcpy(dst, src, sizeof(float) * n); +#endif +} + +} // namespace AL diff --git a/muse2/al/dsp.h b/muse2/al/dsp.h new file mode 100644 index 00000000..f88a0122 --- /dev/null +++ b/muse2/al/dsp.h @@ -0,0 +1,107 @@ +//============================================================================= +// AL +// Audio Utility Library +// $Id: dsp.h,v 1.1.2.1 2009/12/06 01:39:33 terminator356 Exp $ +// +// Copyright (C) 2002-2006 by Werner Schweer and others +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//============================================================================= + +#ifndef __DSP_H__ +#define __DSP_H__ + +#include +#include + +namespace AL { + +//--------------------------------------------------------- +// f_max +//--------------------------------------------------------- + +static inline float f_max(float x, float a) + { + x -= a; + x += fabsf(x); + x *= 0.5f; + x += a; + return x; + } + +//--------------------------------------------------------- +// Dsp +// standard version of all dsp routines without any +// hw acceleration +//--------------------------------------------------------- + +class Dsp { + public: + Dsp() {} + virtual ~Dsp() {} + + virtual float peak(float* buf, unsigned n, float current) { + for (unsigned i = 0; i < n; ++i) + current = f_max(current, fabsf(buf[i])); + return current; + } + virtual void applyGainToBuffer(float* buf, unsigned n, float gain) { + for (unsigned i = 0; i < n; ++i) + buf[i] *= gain; + } + virtual void mixWithGain(float* dst, float* src, unsigned n, float gain) { + for (unsigned i = 0; i < n; ++i) + dst[i] += src[i] * gain; + } + virtual void mix(float* dst, float* src, unsigned n) { + for (unsigned i = 0; i < n; ++i) + dst[i] += src[i]; + } + virtual void cpy(float* dst, float* src, unsigned n); +/* + { +// Changed by T356. Not defined. Where are these??? +//#if defined(ARCH_X86) || defined(ARCH_X86_64) +#if defined(__i386__) || defined(__x86_64__) + printf("Dsp: using asm cpy\n"); + // Changed by T356. Get To and From not declared in scope compile errors. + register unsigned long int dummy; + //__asm__ __volatile__ ("rep; movsl" :"=&D"(dst), "=&S"(src), "=&c"(dummy) :"0" (to), "1" (from),"2" (n) : "memory"); + // From http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html + __asm__ __volatile__ ( \ + "cld\n\t" \ + "rep\n\t" \ + "movsl" \ + : \ + : "S" (src), "D" (dst), "c" (n) \ + : "memory" + ); + + //: "%ecx", "%esi", "%edi", "memory" +#else + printf("Dsp: using memcpy\n"); + memcpy(dst, src, sizeof(float) * n); +#endif + } +*/ + + }; + +extern void initDsp(); +extern void exitDsp(); +extern Dsp* dsp; + +} + +#endif + diff --git a/muse2/al/dspSSE.cpp b/muse2/al/dspSSE.cpp new file mode 100644 index 00000000..a345e308 --- /dev/null +++ b/muse2/al/dspSSE.cpp @@ -0,0 +1,531 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: dspSSE.cpp,v 1.1.2.3 2009/12/20 00:04:25 spamatica Exp $ +// +// (C) Copyright 2007-2009 Werner Schweer (ws@seh.de) +// file originally from Ardour DAW project by Paul Davis (c) 2005 +// licensed through GPL +// Original author Sampo Savolainen +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//====================================================================== + +#; void x86_sse_mix_buffers_with_gain (float *dst, float *src, long nframes, float gain); + +.globl x86_sse_mix_buffers_with_gain + .type x86_sse_mix_buffers_with_gain,@function + +x86_sse_mix_buffers_with_gain: +#; 8(%ebp) = float *dst = %edi +#; 12(%ebp) = float *src = %esi +#; 16(%ebp) = long nframes = %ecx +#; 20(%ebp) = float gain = st(0) + + pushl %ebp + movl %esp, %ebp + + #; save the registers +#; pushl %eax + pushl %ebx +#; pushl %ecx + pushl %edi + pushl %esi + + #; if nframes == 0, go to end + movl 16(%ebp), %ecx #; nframes + cmp $0, %ecx + je .MBWG_END + + #; Check for alignment + + movl 8(%ebp), %edi #; dst + movl 12(%ebp), %esi #; src + + movl %edi, %eax + andl $12, %eax #; mask alignemnt offset + + movl %esi, %ebx + andl $12, %ebx #; mask alignment offset + + cmp %eax, %ebx + jne .MBWG_NONALIGN #; if not aligned, calculate manually + + #; if we are aligned + cmp $0, %ebx + jz .MBWG_SSE + + #; Pre-loop, we need to run 1-3 frames "manually" without + #; SSE instructions + + movss 20(%ebp), %xmm1 #; xmm1 + +.MBWG_PRELOOP: + + movss (%esi), %xmm0 + mulss %xmm1, %xmm0 + addss (%edi), %xmm0 + movss %xmm0, (%edi) + + addl $4, %edi #; dst++ + addl $4, %esi #; src++ + decl %ecx #; nframes-- + jz .MBWG_END + +#; cmp $0, %ecx +#; je .MBWG_END #; if we run out of frames, go to end + + addl $4, %ebx + + cmp $16, %ebx #; test if we've reached 16 byte alignment + jne .MBWG_PRELOOP + + +.MBWG_SSE: + + cmp $4, %ecx #; we know it's not zero, but if it's not >=4, then + jnge .MBWG_NONALIGN #; we jump straight to the "normal" code + + #; copy gain to fill %xmm1 + movss 20(%ebp), %xmm1 + shufps $0x00, %xmm1, %xmm1 + + +.MBWG_SSELOOP: + + movaps (%esi), %xmm0 #; source => xmm0 + mulps %xmm1, %xmm0 #; apply gain to source + addps (%edi), %xmm0 #; mix with destination + movaps %xmm0, (%edi) #; copy result to destination + + addl $16, %edi #; dst+=4 + addl $16, %esi #; src+=4 + + subl $4, %ecx #; nframes-=4 + cmp $4, %ecx + jge .MBWG_SSELOOP + + cmp $0, %ecx + je .MBWG_END + + #; if there are remaining frames, the nonalign code will do nicely + #; for the rest 1-3 frames. + +.MBWG_NONALIGN: + #; not aligned! + + movss 20(%ebp), %xmm1 #; gain => xmm1 + +.MBWG_NONALIGNLOOP: + + movss (%esi), %xmm0 + mulss %xmm1, %xmm0 + addss (%edi), %xmm0 + movss %xmm0, (%edi) + + addl $4, %edi + addl $4, %esi + + decl %ecx + jnz .MBWG_NONALIGNLOOP + +.MBWG_END: + + popl %esi + popl %edi +#; popl %ecx + popl %ebx +#; popl %eax + + #; return + leave + ret + +.size x86_sse_mix_buffers_with_gain, .-x86_sse_mix_buffers_with_gain + + + + +#; void x86_sse_mix_buffers_no_gain (float *dst, float *src, long nframes); + +.globl x86_sse_mix_buffers_no_gain + .type x86_sse_mix_buffers_no_gain,@function + +x86_sse_mix_buffers_no_gain: +#; 8(%ebp) = float *dst = %edi +#; 12(%ebp) = float *src = %esi +#; 16(%ebp) = long nframes = %ecx + + pushl %ebp + movl %esp, %ebp + + #; save the registers +#; pushl %eax + pushl %ebx +#; pushl %ecx + pushl %edi + pushl %esi + + #; the real function + + #; if nframes == 0, go to end + movl 16(%ebp), %ecx #; nframes + cmp $0, %ecx + je .MBNG_END + + #; Check for alignment + + movl 8(%ebp), %edi #; dst + movl 12(%ebp), %esi #; src + + movl %edi, %eax + andl $12, %eax #; mask alignemnt offset + + movl %esi, %ebx + andl $12, %ebx #; mask alignment offset + + cmp %eax, %ebx + jne .MBNG_NONALIGN #; if not aligned, calculate manually + + cmp $0, %ebx + je .MBNG_SSE + + #; Pre-loop, we need to run 1-3 frames "manually" without + #; SSE instructions + +.MBNG_PRELOOP: + + movss (%esi), %xmm0 + addss (%edi), %xmm0 + movss %xmm0, (%edi) + + addl $4, %edi #; dst++ + addl $4, %esi #; src++ + decl %ecx #; nframes-- + jz .MBNG_END + addl $4, %ebx + + cmp $16, %ebx #; test if we've reached 16 byte alignment + jne .MBNG_PRELOOP + +.MBNG_SSE: + + cmp $4, %ecx #; if there are frames left, but less than 4 + jnge .MBNG_NONALIGN #; we can't run SSE + +.MBNG_SSELOOP: + + movaps (%esi), %xmm0 #; source => xmm0 + addps (%edi), %xmm0 #; mix with destination + movaps %xmm0, (%edi) #; copy result to destination + + addl $16, %edi #; dst+=4 + addl $16, %esi #; src+=4 + + subl $4, %ecx #; nframes-=4 + cmp $4, %ecx + jge .MBNG_SSELOOP + + cmp $0, %ecx + je .MBNG_END + + #; if there are remaining frames, the nonalign code will do nicely + #; for the rest 1-3 frames. + +.MBNG_NONALIGN: + #; not aligned! + + movss (%esi), %xmm0 #; src => xmm0 + addss (%edi), %xmm0 #; xmm0 += dst + movss %xmm0, (%edi) #; xmm0 => dst + + addl $4, %edi + addl $4, %esi + + decl %ecx + jnz .MBNG_NONALIGN + +.MBNG_END: + + popl %esi + popl %edi +#; popl %ecx + popl %ebx +#; popl %eax + + #; return + leave + ret + +.size x86_sse_mix_buffers_no_gain, .-x86_sse_mix_buffers_no_gain + + + + +#; void x86_sse_apply_gain_to_buffer (float *buf, long nframes, float gain); + +.globl x86_sse_apply_gain_to_buffer + .type x86_sse_apply_gain_to_buffer,@function + +x86_sse_apply_gain_to_buffer: +#; 8(%ebp) = float *buf = %edi +#; 12(%ebp) = long nframes = %ecx +#; 16(%ebp) = float gain = st(0) + + pushl %ebp + movl %esp, %ebp + + #; save %edi + pushl %edi + + #; the real function + + #; if nframes == 0, go to end + movl 12(%ebp), %ecx #; nframes + cmp $0, %ecx + je .AG_END + + #; create the gain buffer in %xmm1 + movss 16(%ebp), %xmm1 + shufps $0x00, %xmm1, %xmm1 + + #; Check for alignment + + movl 8(%ebp), %edi #; buf + movl %edi, %edx #; buf => %edx + andl $12, %edx #; mask bits 1 & 2, result = 0, 4, 8 or 12 + jz .AG_SSE #; if buffer IS aligned + + #; PRE-LOOP + #; we iterate 1-3 times, doing normal x87 float comparison + #; so we reach a 16 byte aligned "buf" (=%edi) value + +.AGLP_START: + + #; Load next value from the buffer + movss (%edi), %xmm0 + mulss %xmm1, %xmm0 + movss %xmm0, (%edi) + + #; increment buffer, decrement counter + addl $4, %edi #; buf++; + + decl %ecx #; nframes-- + jz .AG_END #; if we run out of frames, we go to the end + + addl $4, %edx #; one non-aligned byte less + cmp $16, %edx + jne .AGLP_START #; if more non-aligned frames exist, we do a do-over + +.AG_SSE: + + #; We have reached the 16 byte aligned "buf" ("edi") value + + #; Figure out how many loops we should do + movl %ecx, %eax #; copy remaining nframes to %eax for division + movl $0, %edx #; 0 the edx register + + + pushl %edi + movl $4, %edi + divl %edi #; %edx = remainder == 0 + popl %edi + + #; %eax = SSE iterations + cmp $0, %eax + je .AGPOST_START + + +.AGLP_SSE: + + movaps (%edi), %xmm0 + mulps %xmm1, %xmm0 + movaps %xmm0, (%edi) + + addl $16, %edi +#; subl $4, %ecx #; nframes-=4 + + decl %eax + jnz .AGLP_SSE + + #; Next we need to post-process all remaining frames + #; the remaining frame count is in %ecx + + #; if no remaining frames, jump to the end +#; cmp $0, %ecx + andl $3, %ecx #; nframes % 4 + je .AG_END + +.AGPOST_START: + + movss (%edi), %xmm0 + mulss %xmm1, %xmm0 + movss %xmm0, (%edi) + + #; increment buffer, decrement counter + addl $4, %edi #; buf++; + + decl %ecx #; nframes-- + jnz .AGPOST_START #; if we run out of frames, we go to the end + +.AG_END: + + + popl %edi + + #; return + leave + ret + +.size x86_sse_apply_gain_to_buffer, .-x86_sse_apply_gain_to_buffer +#; end proc + + + +#; float x86_sse_compute_peak(float *buf, long nframes, float current); + +.globl x86_sse_compute_peak + .type x86_sse_compute_peak,@function + +x86_sse_compute_peak: +#; 8(%ebp) = float *buf = %edi +#; 12(%ebp) = long nframes = %ecx +#; 16(%ebp) = float current = st(0) + + pushl %ebp + movl %esp, %ebp + + #; save %edi + pushl %edi + + #; the real function + + #; Load "current" in xmm0 + movss 16(%ebp), %xmm0 + + #; if nframes == 0, go to end + movl 12(%ebp), %ecx #; nframes + cmp $0, %ecx + je .CP_END + + #; create the "abs" mask in %xmm2 + pushl $2147483647 + movss (%esp), %xmm2 + addl $4, %esp + shufps $0x00, %xmm2, %xmm2 + + #; Check for alignment + + movl 8(%ebp), %edi #; buf + movl %edi, %edx #; buf => %edx + andl $12, %edx #; mask bits 1 & 2, result = 0, 4, 8 or 12 + jz .CP_SSE #; if buffer IS aligned + + #; PRE-LOOP + #; we iterate 1-3 times, doing normal x87 float comparison + #; so we reach a 16 byte aligned "buf" (=%edi) value + +.LP_START: + + #; Load next value from the buffer + movss (%edi), %xmm1 + andps %xmm2, %xmm1 + maxss %xmm1, %xmm0 + + #; increment buffer, decrement counter + addl $4, %edi #; buf++; + + decl %ecx #; nframes-- + jz .CP_END #; if we run out of frames, we go to the end + + addl $4, %edx #; one non-aligned byte less + cmp $16, %edx + jne .LP_START #; if more non-aligned frames exist, we do a do-over + +.CP_SSE: + + #; We have reached the 16 byte aligned "buf" ("edi") value + + #; Figure out how many loops we should do + movl %ecx, %eax #; copy remaining nframes to %eax for division + + shr $2,%eax #; unsigned divide by 4 + jz .POST_START + + #; %eax = SSE iterations + + #; current maximum is at %xmm0, but we need to .. + shufps $0x00, %xmm0, %xmm0 #; shuffle "current" to all 4 FP's + + #;prefetcht0 16(%edi) + +.LP_SSE: + + movaps (%edi), %xmm1 + andps %xmm2, %xmm1 + maxps %xmm1, %xmm0 + + addl $16, %edi + + decl %eax + jnz .LP_SSE + + #; Calculate the maximum value contained in the 4 FP's in %xmm0 + movaps %xmm0, %xmm1 + shufps $0x4e, %xmm1, %xmm1 #; shuffle left & right pairs (1234 => 3412) + maxps %xmm1, %xmm0 #; maximums of the two pairs + movaps %xmm0, %xmm1 + shufps $0xb1, %xmm1, %xmm1 #; shuffle the floats inside the two pairs (1234 => 2143) + maxps %xmm1, %xmm0 + + #; now every float in %xmm0 is the same value, current maximum value + + #; Next we need to post-process all remaining frames + #; the remaining frame count is in %ecx + + #; if no remaining frames, jump to the end + + andl $3, %ecx #; nframes % 4 + jz .CP_END + +.POST_START: + + movss (%edi), %xmm1 + andps %xmm2, %xmm1 + maxss %xmm1, %xmm0 + + addl $4, %edi #; buf++; + + decl %ecx #; nframes--; + jnz .POST_START + +.CP_END: + + #; Load the value from xmm0 to the float stack for returning + movss %xmm0, 16(%ebp) + flds 16(%ebp) + + popl %edi + + #; return + leave + ret + +.size x86_sse_compute_peak, .-x86_sse_compute_peak +#; end proc + +#ifdef __ELF__ +.section .note.GNU-stack,"",%progbits +#endif + + diff --git a/muse2/al/dspXMM.cpp b/muse2/al/dspXMM.cpp new file mode 100644 index 00000000..99893c3f --- /dev/null +++ b/muse2/al/dspXMM.cpp @@ -0,0 +1,119 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: dspXMM.cpp,v 1.1.2.2 2009/12/20 00:04:25 spamatica Exp $ +// +// (C) Copyright 2007-2009 Werner Schweer (ws@seh.de) +// file originally from Ardour DAW project by Paul Davis (c) 2007 +// licensed through GPL +// Original author Sampo Savolainen +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//====================================================================== + + +#include + +void +x86_sse_find_peaks(float *buf, unsigned nframes, float *min, float *max) +{ + __m128 current_max, current_min, work; + + // Load max and min values into all four slots of the XMM registers + current_min = _mm_set1_ps(*min); + current_max = _mm_set1_ps(*max); + + // Work input until "buf" reaches 16 byte alignment + while ( ((unsigned long)buf) % 16 != 0 && nframes > 0) { + + // Load the next float into the work buffer + work = _mm_set1_ps(*buf); + + current_min = _mm_min_ps(current_min, work); + current_max = _mm_max_ps(current_max, work); + + buf++; + nframes--; + } + + // use 64 byte prefetch for quadruple quads + while (nframes >= 16) { + __builtin_prefetch(buf+64,0,0); + + work = _mm_load_ps(buf); + current_min = _mm_min_ps(current_min, work); + current_max = _mm_max_ps(current_max, work); + buf+=4; + work = _mm_load_ps(buf); + current_min = _mm_min_ps(current_min, work); + current_max = _mm_max_ps(current_max, work); + buf+=4; + work = _mm_load_ps(buf); + current_min = _mm_min_ps(current_min, work); + current_max = _mm_max_ps(current_max, work); + buf+=4; + work = _mm_load_ps(buf); + current_min = _mm_min_ps(current_min, work); + current_max = _mm_max_ps(current_max, work); + buf+=4; + nframes-=16; + } + + // work through aligned buffers + while (nframes >= 4) { + + work = _mm_load_ps(buf); + + current_min = _mm_min_ps(current_min, work); + current_max = _mm_max_ps(current_max, work); + + buf+=4; + nframes-=4; + } + + // work through the rest < 4 samples + while ( nframes > 0) { + + // Load the next float into the work buffer + work = _mm_set1_ps(*buf); + + current_min = _mm_min_ps(current_min, work); + current_max = _mm_max_ps(current_max, work); + + buf++; + nframes--; + } + + // Find min & max value in current_max through shuffle tricks + + work = current_min; + work = _mm_shuffle_ps(work, work, _MM_SHUFFLE(2, 3, 0, 1)); + work = _mm_min_ps (work, current_min); + current_min = work; + work = _mm_shuffle_ps(work, work, _MM_SHUFFLE(1, 0, 3, 2)); + work = _mm_min_ps (work, current_min); + + _mm_store_ss(min, work); + + work = current_max; + work = _mm_shuffle_ps(work, work, _MM_SHUFFLE(2, 3, 0, 1)); + work = _mm_max_ps (work, current_max); + current_max = work; + work = _mm_shuffle_ps(work, work, _MM_SHUFFLE(1, 0, 3, 2)); + work = _mm_max_ps (work, current_max); + + _mm_store_ss(max, work); +} + + + -- cgit v1.2.3