Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libsidplayfp for openSUSE:Factory checked in at 2024-01-03 12:26:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libsidplayfp (Old) and /work/SRC/openSUSE:Factory/.libsidplayfp.new.28375 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libsidplayfp" Wed Jan 3 12:26:49 2024 rev:10 rq:1136207 version:2.6.0 Changes: -------- --- /work/SRC/openSUSE:Factory/libsidplayfp/libsidplayfp.changes 2023-07-08 22:47:52.303386087 +0200 +++ /work/SRC/openSUSE:Factory/.libsidplayfp.new.28375/libsidplayfp.changes 2024-01-03 12:26:51.351571106 +0100 @@ -1,0 +2,21 @@ +Mon Jan 1 10:04:11 UTC 2024 - Martin Hauke <[email protected]> + +- Update to version 2.6.0 + * residfp is now thread-safe. + * residfp: fixed SSE2 version of convolve. + * residfp: updated combined waveforms model. + * residfp: amplify the output by a model dependent scale factor. + * a couple of autotools fixes. + +------------------------------------------------------------------- +Sat Dec 23 11:33:14 UTC 2023 - Martin Hauke <[email protected]> + +- >Update to version 2.5.1 + * Check for {g,}od at configure time. + * residfp: fix a 6581 filter bug where values could actually go + negative. + * Sync resid with upstream. +- Drop patch: + * fix-missing-include.patch (not longer needed) + +------------------------------------------------------------------- Old: ---- fix-missing-include.patch libsidplayfp-2.5.0.tar.gz New: ---- libsidplayfp-2.6.0.tar.gz BETA DEBUG BEGIN: Old:- Drop patch: * fix-missing-include.patch (not longer needed) BETA DEBUG END: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libsidplayfp.spec ++++++ --- /var/tmp/diff_new_pack.DExsAi/_old 2024-01-03 12:26:53.015631873 +0100 +++ /var/tmp/diff_new_pack.DExsAi/_new 2024-01-03 12:26:53.023632165 +0100 @@ -1,7 +1,7 @@ # # spec file for package libsidplayfp # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,15 +19,14 @@ %define soname 6 %define stilview_soname 0 Name: libsidplayfp -Version: 2.5.0 +Version: 2.6.0 Release: 0 Summary: A library to play Commodore 64 music License: GPL-2.0-or-later Group: System/Libraries #Git-Clone: https://github.com/libsidplayfp/libsidplayfp.git URL: https://sourceforge.net/projects/sidplay-residfp/ -Source0: https://sourceforge.net/projects/sidplay-residfp/files/libsidplayfp/2.5/libsidplayfp-%{version}.tar.gz -Patch0: fix-missing-include.patch +Source0: https://sourceforge.net/projects/sidplay-residfp/files/libsidplayfp/2.6/libsidplayfp-%{version}.tar.gz BuildRequires: gcc-c++ BuildRequires: libgcrypt-devel BuildRequires: pkgconfig ++++++ libsidplayfp-2.5.0.tar.gz -> libsidplayfp-2.6.0.tar.gz ++++++ ++++ 1910 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/AUTHORS new/libsidplayfp-2.6.0/AUTHORS --- old/libsidplayfp-2.5.0/AUTHORS 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/AUTHORS 2024-01-01 08:59:03.000000000 +0100 @@ -5,7 +5,7 @@ Copyright (c) 2000 Simon White Copyright (c) 2007-2010 Antti Lankila -Copyright (c) 2010-2023 Leandro Nini +Copyright (c) 2010-2024 Leandro Nini This version of the freely available libsidplayfp emulator engine source code contains the following contributed or derived work. In the order they first diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/Makefile.am new/libsidplayfp-2.6.0/Makefile.am --- old/libsidplayfp-2.5.0/Makefile.am 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/Makefile.am 2024-01-01 08:59:03.000000000 +0100 @@ -13,12 +13,6 @@ W32_LDFLAGS = -no-undefined endif -if MACOS - OD = god -else - OD = od -endif - if HAVE_VISIBILITY VISIBILITY_CXXFLAGS = -fvisibility=hidden -fvisibility-inlines-hidden endif @@ -466,6 +460,8 @@ .a65.bin: o65file=`echo $@ | sed 's/bin/o65/'`;\ - xa -R -G $< -o $$o65file &&\ + [ -n "$(OD)" ] || { echo "od not found"; false; } &&\ + [ -n "$(XA)" ] || { echo "xa not found"; false; } &&\ + ${XA} -R -G $< -o $$o65file &&\ ${OD} -v -An -w8 -tx1 $$o65file | sed -re 's/[[:alnum:]]+/0x&,/g' > $@ &&\ ${RM} $$o65file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/NEWS new/libsidplayfp-2.6.0/NEWS --- old/libsidplayfp-2.5.0/NEWS 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/NEWS 2024-01-01 08:59:03.000000000 +0100 @@ -1,3 +1,19 @@ +2.6.0 2024-01-01 +* residfp is now thread-safe (#71) +* residfp: fixed SSE2 version of convolve (#105) +* residfp: updated combined waveforms model (#97) +* residfp: amplify the output by a model dependent scale factor (#78, #79) +* a couple of autotools fixes (#103, #104, #108) + + + +2.5.1 2023-12-23 +* Check for {g,}od at configure time (#87) +* residfp: fix a 6581 filter bug where values could actually go negative +* Sync resid with upstream + + + 2.5.0 2023-06-02 * residfp: reworked the combined waveforms model by separating pulldown effect from waveform generation * residfp: tweaked the 8580 filter parameters for increased volume and less distortion (#45) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/configure.ac new/libsidplayfp-2.6.0/configure.ac --- old/libsidplayfp-2.5.0/configure.ac 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/configure.ac 2024-01-01 08:59:03.000000000 +0100 @@ -1,8 +1,9 @@ m4_define([lib_major], [2]) -m4_define([lib_minor], [5]) +m4_define([lib_minor], [6]) m4_define([lib_level], [0]) m4_define([lib_version], [lib_major.lib_minor.lib_level]) +AC_PREREQ([2.62]) AC_INIT([libsidplayfp],[lib_version],[],[],[https://github.com/libsidplayfp/libsidplayfp/]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIRS([m4 src/builders/exsid-builder/driver/m4]) @@ -37,12 +38,12 @@ AC_LANG([C++]) AX_CXX_COMPILE_STDCXX_17([noext], [optional]) -AS_IF([test $ax_cv_cxx_compile_cxx17__std_cpp17 != "yes"], +AS_IF([test $ax_cv_cxx_compile_cxx17__std_cpp17 != "yes"], [ AX_CXX_COMPILE_STDCXX_14([noext], [optional]) AS_IF([test $ax_cv_cxx_compile_cxx14__std_cpp14 != "yes"], AX_CXX_COMPILE_STDCXX_11([noext], [optional]) ) -) +]) dnl check for hidden visibility support AX_CHECK_COMPILE_FLAG([-fvisibility=hidden -fvisibility-inlines-hidden], [has_visibility=yes], [has_visibility=no]) @@ -80,6 +81,14 @@ [AC_CHECK_FUNCS([strncasecmp])] ) +AC_CHECK_PROGS([XA], [xa]) + +# od on macOS doesn't support the -w parameter +AC_CACHE_CHECK([for od that supports -w], [ac_cv_path_OD], + [AC_PATH_PROGS_FEATURE_CHECK([OD], [od god], + [[$ac_path_OD -w > /dev/null 2>&1 && ac_cv_path_OD=$ac_path_OD]])] +) +AC_SUBST([OD], [$ac_cv_path_OD]) dnl libtool-style version-info number # @@ -92,7 +101,7 @@ # Increase the age value only if the changes made to the ABI are backward compatible. LIBSIDPLAYCUR=9 -LIBSIDPLAYREV=27 +LIBSIDPLAYREV=29 LIBSIDPLAYAGE=3 LIBSIDPLAYVERSION=$LIBSIDPLAYCUR:$LIBSIDPLAYREV:$LIBSIDPLAYAGE @@ -243,14 +252,17 @@ [AS_HELP_STRING([--enable-tests], [enable unit tests [default=no]] )], + [], + [enable_tests=no] +) + +AS_IF([test "x$enable_tests" != "xno"], [[echo Enabling unit tests] PKG_CHECK_MODULES(UNITTEST, [UnitTest++]) - [am_unittest=true] - ], - [am_unittest=false] + ] ) -AM_CONDITIONAL([ENABLE_TEST], [test x$am_unittest = xtrue]) +AM_CONDITIONAL([ENABLE_TEST], [test x$enable_tests = xyes]) AC_ARG_WITH([gcrypt], AS_HELP_STRING([--with-gcrypt], [Build with the gcrypt library])) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/docs/mainpage.dox new/libsidplayfp-2.6.0/docs/mainpage.dox --- old/libsidplayfp-2.5.0/docs/mainpage.dox 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/docs/mainpage.dox 2024-01-01 08:59:03.000000000 +0100 @@ -11,7 +11,7 @@ Copyright (c) 2000-2001 Simon White<br/> Copyright (c) 2007-2010 Antti Lankila<br/> -Copyright (c) 2010-2023 Leandro Nini <[email protected]><br/> +Copyright (c) 2010-2024 Leandro Nini <[email protected]><br/> <br/> STILView (or more precisely, the STIL class written in C++) is intended to be diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/m4/ax_cxx_compile_stdcxx.m4 new/libsidplayfp-2.6.0/m4/ax_cxx_compile_stdcxx.m4 --- old/libsidplayfp-2.5.0/m4/ax_cxx_compile_stdcxx.m4 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/m4/ax_cxx_compile_stdcxx.m4 2024-01-01 08:59:03.000000000 +0100 @@ -43,7 +43,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 15 +#serial 18 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro dnl (serial version number 13). @@ -104,9 +104,18 @@ dnl HP's aCC needs +std=c++11 according to: dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf dnl Cray's crayCC needs "-h std=c++11" + dnl MSVC needs -std:c++NN for C++17 and later (default is C++14) for alternative in ${ax_cxx_compile_alternatives}; do - for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}" MSVC; do + if test x"$switch" = xMSVC; then + dnl AS_TR_SH maps both `:` and `=` to `_` so -std:c++17 would collide + dnl with -std=c++17. We suffix the cache variable name with _MSVC to + dnl avoid this. + switch=-std:c++${alternative} + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_${switch}_MSVC]) + else + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + fi AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, [ac_save_CXX="$CXX" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/exsid-builder/exsid-emu.cpp new/libsidplayfp-2.6.0/src/builders/exsid-builder/exsid-emu.cpp --- old/libsidplayfp-2.5.0/src/builders/exsid-builder/exsid-emu.cpp 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/exsid-builder/exsid-emu.cpp 2024-01-01 08:59:03.000000000 +0100 @@ -35,18 +35,9 @@ const char* exSID::getCredits() { - static std::string credits; - - if (credits.empty()) - { - // Setup credits - std::ostringstream ss; - ss << "exSID V" << VERSION << " Engine:\n"; - ss << "\t(C) 2015-2017,2021 Thibaut VARENE\n"; - credits = ss.str(); - } - - return credits.c_str(); + return + "exSID V" VERSION " Engine:\n" + "\t(C) 2015-2017,2021 Thibaut VARENE\n"; } exSID::exSID(sidbuilder *builder) : diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/hardsid-builder/hardsid-emu-unix.cpp new/libsidplayfp-2.6.0/src/builders/hardsid-builder/hardsid-emu-unix.cpp --- old/libsidplayfp-2.5.0/src/builders/hardsid-builder/hardsid-emu-unix.cpp 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/hardsid-builder/hardsid-emu-unix.cpp 2024-01-01 08:59:03.000000000 +0100 @@ -55,18 +55,9 @@ const char* HardSID::getCredits() { - static std::string credits; - - if (credits.empty()) - { - // Setup credits - std::ostringstream ss; - ss << "HardSID V" << VERSION << " Engine:\n"; - ss << "\t(C) 2001-2002 Jarno Paanenen\n"; - credits = ss.str(); - } - - return credits.c_str(); + return + "HardSID V" VERSION " Engine:\n" + "\t(C) 2001-2002 Jarno Paanenen\n"; } HardSID::HardSID (sidbuilder *builder) : diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/hardsid-builder/hardsid-emu-win.cpp new/libsidplayfp-2.6.0/src/builders/hardsid-builder/hardsid-emu-win.cpp --- old/libsidplayfp-2.5.0/src/builders/hardsid-builder/hardsid-emu-win.cpp 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/hardsid-builder/hardsid-emu-win.cpp 2024-01-01 08:59:03.000000000 +0100 @@ -48,18 +48,9 @@ const char* HardSID::getCredits() { - static std::string credits; - - if (credits.empty()) - { - // Setup credits - std::ostringstream ss; - ss << "HardSID V" << VERSION << " Engine:\n"; - ss << "\t(C) 1999-2002 Simon White\n"; - credits = ss.str(); - } - - return credits.c_str(); + return + "HardSID V" VERSION " Engine:\n" + "\t(C) 1999-2002 Simon White\n"; } HardSID::HardSID(sidbuilder *builder) : diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/resid-builder/resid/filter8580new.cc new/libsidplayfp-2.6.0/src/builders/resid-builder/resid/filter8580new.cc --- old/libsidplayfp-2.5.0/src/builders/resid-builder/resid/filter8580new.cc 2023-06-02 14:55:03.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/resid-builder/resid/filter8580new.cc 2024-01-01 08:59:05.000000000 +0100 @@ -508,10 +508,11 @@ // kVg_Vx = k*Vg - Vx // I.e. if k != 1.0, Vg must be scaled accordingly. - for (int kVg_Vx = 0; kVg_Vx < (1 << 16); kVg_Vx++) { + for (int i = 0; i < (1 << 16); i++) { + int kVg_Vx = i - (1 << 15); double log_term = log1p(exp((kVg_Vx/N16 - kVt)/(2*Ut))); // Scaled by m*2^15 - vcr_n_Ids_term[kVg_Vx] = (unsigned short)(n_Is*log_term*log_term); + vcr_n_Ids_term[i] = (unsigned short)(n_Is*log_term*log_term); } } else { // 8580 only diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/resid-builder/resid/filter8580new.h new/libsidplayfp-2.6.0/src/builders/resid-builder/resid/filter8580new.h --- old/libsidplayfp-2.5.0/src/builders/resid-builder/resid/filter8580new.h 2023-06-02 14:55:03.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/resid-builder/resid/filter8580new.h 2024-01-01 08:59:05.000000000 +0100 @@ -1799,10 +1799,8 @@ int kVg = vcr_kVg[(Vddt_Vw_2 + (Vgdt_2 >> 1)) >> 16]; // VCR voltages for EKV model table lookup. - int Vgs = kVg - vx; - if (Vgs < 0) Vgs = 0; - int Vgd = kVg - vi; - if (Vgd < 0) Vgd = 0; + int Vgs = kVg - vx + (1 << 15); + int Vgd = kVg - vi + (1 << 15); // VCR current, scaled by m*2^15*2^15 = m*2^30 int n_I_vcr = int(unsigned(vcr_n_Ids_term[Vgs] - vcr_n_Ids_term[Vgd]) << 15); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/resid-builder/resid/wave.cc new/libsidplayfp-2.6.0/src/builders/resid-builder/resid/wave.cc --- old/libsidplayfp-2.5.0/src/builders/resid-builder/resid/wave.cc 2023-06-02 14:55:03.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/resid-builder/resid/wave.cc 2024-01-01 08:59:05.000000000 +0100 @@ -172,22 +172,28 @@ bool do_pre_writeback(reg8 waveform_prev, reg8 waveform, bool is6581) { // no writeback without combined waveforms - if (likely(waveform_prev <= 0x8)) + if (likely(waveform_prev <= 0x8)) { return false; + } +#if 0 // This need more investigation - if (waveform == 8) + if (waveform == 8) { return false; + } +#endif if (waveform_prev == 0xc) { - if (is6581) + if (is6581) { return false; - else if ((waveform != 0x9) && (waveform != 0xe)) + } else if ((waveform != 0x9) && (waveform != 0xe)) { return false; + } } // What's happening here? if (is6581 && ((((waveform_prev & 0x3) == 0x1) && ((waveform & 0x3) == 0x2)) - || (((waveform_prev & 0x3) == 0x2) && ((waveform & 0x3) == 0x1)))) + || (((waveform_prev & 0x3) == 0x2) && ((waveform & 0x3) == 0x1)))) { return false; + } // ok do the writeback return true; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/Dac.cpp new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/Dac.cpp --- old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/Dac.cpp 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/Dac.cpp 2024-01-01 08:59:03.000000000 +0100 @@ -60,6 +60,8 @@ // 6581 DACs are not terminated by a 2R resistor const bool term = chipModel == MOS8580; + double Vsum = 0.; + // Calculate voltage contribution by each individual bit in the R-2R ladder. for (unsigned int set_bit = 0; set_bit < dacLength; set_bit++) { @@ -102,16 +104,10 @@ } dac[set_bit] = Vn; + Vsum += Vn; } // Normalize to integerish behavior - double Vsum = 0.; - - for (unsigned int i = 0; i < dacLength; i++) - { - Vsum += dac[i]; - } - Vsum /= 1 << dacLength; for (unsigned int i = 0; i < dacLength; i++) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/ExternalFilter.h new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/ExternalFilter.h --- old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/ExternalFilter.h 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/ExternalFilter.h 2024-01-01 08:59:03.000000000 +0100 @@ -35,7 +35,7 @@ * equipment impedance. Here we suppose an impedance of 10kOhm resulting * in a 3 dB attenuation at 1.6Hz. * To operate properly the 6581 audio output needs a pull-down resistor - *(1KOhm recommended, not needed on 8580) + * (1KOhm recommended, not needed on 8580) * * ~~~ * 9/12V @@ -80,7 +80,7 @@ * * @param input */ - int clock(unsigned short input); + int clock(int input); /** * Constructor. @@ -108,9 +108,9 @@ { RESID_INLINE -int ExternalFilter::clock(unsigned short input) +int ExternalFilter::clock(int input) { - const int Vi = (static_cast<unsigned int>(input)<<11) - (1 << (11+15)); + const int Vi = (input<<11) - (1 << (11+15)); const int dVlp = (w0lp_1_s7 * (Vi - Vlp) >> 7); const int dVhp = (w0hp_1_s17 * (Vlp - Vhp) >> 17); Vlp += dVlp; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/FilterModelConfig6581.cpp new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/FilterModelConfig6581.cpp --- old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/FilterModelConfig6581.cpp 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/FilterModelConfig6581.cpp 2024-01-01 08:59:03.000000000 +0100 @@ -22,11 +22,16 @@ #include "FilterModelConfig6581.h" -#include <cmath> - #include "Integrator6581.h" #include "OpAmp.h" +#include "sidcxx11.h" + +#ifdef HAVE_CXX11 +# include <mutex> +#endif +#include <cmath> + namespace reSIDfp { @@ -90,8 +95,16 @@ std::unique_ptr<FilterModelConfig6581> FilterModelConfig6581::instance(nullptr); +#ifdef HAVE_CXX11 +std::mutex Instance6581_Lock; +#endif + FilterModelConfig6581* FilterModelConfig6581::getInstance() { +#ifdef HAVE_CXX11 + std::lock_guard<std::mutex> lock(Instance6581_Lock); +#endif + if (!instance.get()) { instance.reset(new FilterModelConfig6581()); @@ -293,13 +306,14 @@ // kVgt_Vx = k*(Vg - Vt) - Vx // I.e. if k != 1.0, Vg must be scaled accordingly. - for (int kVgt_Vx = 0; kVgt_Vx < (1 << 16); kVgt_Vx++) + for (int i = 0; i < (1 << 16); i++) { + const int kVgt_Vx = i - (1 << 15); const double log_term = log1p(exp((kVgt_Vx / N16) / (2. * Ut))); // Scaled by m*2^15 const double tmp = n_Is * log_term * log_term; assert(tmp > -0.5 && tmp < 65535.5); - vcr_n_Ids_term[kVgt_Vx] = static_cast<unsigned short>(tmp + 0.5); + vcr_n_Ids_term[i] = static_cast<unsigned short>(tmp + 0.5); } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/FilterModelConfig8580.cpp new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/FilterModelConfig8580.cpp --- old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/FilterModelConfig8580.cpp 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/FilterModelConfig8580.cpp 2024-01-01 08:59:03.000000000 +0100 @@ -25,7 +25,12 @@ #include "Integrator8580.h" #include "OpAmp.h" +#include "sidcxx11.h" +#ifdef HAVE_CXX11 +# include <mutex> +#endif + namespace reSIDfp { @@ -110,8 +115,16 @@ std::unique_ptr<FilterModelConfig8580> FilterModelConfig8580::instance(nullptr); +#ifdef HAVE_CXX11 +std::mutex Instance8580_Lock; +#endif + FilterModelConfig8580* FilterModelConfig8580::getInstance() { +#ifdef HAVE_CXX11 + std::lock_guard<std::mutex> lock(Instance8580_Lock); +#endif + if (!instance.get()) { instance.reset(new FilterModelConfig8580()); @@ -122,7 +135,7 @@ FilterModelConfig8580::FilterModelConfig8580() : FilterModelConfig( - 0.30, // voice voltage range FIXME measure + 0.24, // voice voltage range FIXME measure 4.84, // voice DC voltage FIXME measure 22e-9, // capacitor value 9.09, // Vdd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/Integrator6581.h new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/Integrator6581.h --- old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/Integrator6581.h 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/Integrator6581.h 2024-01-01 08:59:03.000000000 +0100 @@ -1,7 +1,7 @@ /* * This file is part of libsidplayfp, a SID player engine. * - * Copyright 2011-2022 Leandro Nini <[email protected]> + * Copyright 2011-2023 Leandro Nini <[email protected]> * Copyright 2007-2010 Antti Lankila * Copyright 2004, 2010 Dag Lem <[email protected]> * @@ -242,10 +242,10 @@ #endif // VCR voltages for EKV model table lookup. - const int kVgt_Vs = (vx < kVgt) ? kVgt - vx : 0; - assert(kVgt_Vs < (1 << 16)); - const int kVgt_Vd = (vi < kVgt) ? kVgt - vi : 0; - assert(kVgt_Vd < (1 << 16)); + const int kVgt_Vs = (kVgt - vx) + (1 << 15); + assert((kVgt_Vs >= 0) && (kVgt_Vs < (1 << 16))); + const int kVgt_Vd = (kVgt - vi) + (1 << 15); + assert((kVgt_Vd >= 0) && (kVgt_Vd < (1 << 16))); // VCR current, scaled by m*2^15*2^15 = m*2^30 const unsigned int If = static_cast<unsigned int>(fmc->getVcr_n_Ids_term(kVgt_Vs)) << 15; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/SID.cpp new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/SID.cpp --- old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/SID.cpp 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/SID.cpp 2024-01-01 08:59:03.000000000 +0100 @@ -106,8 +106,8 @@ * On my 6581R4AR has 0x3A as the only value giving the same output level as 1.prg */ //@{ -unsigned int constexpr OFFSET_6581 = 0x380; -unsigned int constexpr OFFSET_8580 = 0x9c0; +const unsigned int OFFSET_6581 = 0x380; +const unsigned int OFFSET_8580 = 0x9c0; //@} /** @@ -128,8 +128,8 @@ * [2]: http://noname.c64.org/csdb/forums/?roomid=11&topicid=29025&showallposts=1 */ //@{ -int constexpr BUS_TTL_6581 = 0x01d00; -int constexpr BUS_TTL_8580 = 0xa2000; +const int BUS_TTL_6581 = 0x01d00; +const int BUS_TTL_8580 = 0xa2000; //@} SID::SID() : @@ -211,11 +211,13 @@ { case MOS6581: filter = filter6581.get(); + scaleFactor = 3; modelTTL = BUS_TTL_6581; break; case MOS8580: filter = filter8580.get(); + scaleFactor = 5; modelTTL = BUS_TTL_8580; break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/SID.h new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/SID.h --- old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/SID.h 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/SID.h 2024-01-01 08:59:03.000000000 +0100 @@ -87,6 +87,9 @@ /// SID voices std::unique_ptr<Voice> voice[3]; + /// Used to amplify the output by x/2 to get an adequate playback volume + int scaleFactor; + /// Time to live for the last written value int busValueTtl; @@ -318,7 +321,9 @@ const int v2 = voice[1]->output(voice[0]->wave()); const int v3 = voice[2]->output(voice[1]->wave()); - return externalFilter->clock(filter->clock(v1, v2, v3)); + const int input = (scaleFactor * static_cast<unsigned int>(filter->clock(v1, v2, v3))) / 2; + + return externalFilter->clock(input); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/WaveformCalculator.cpp new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/WaveformCalculator.cpp --- old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/WaveformCalculator.cpp 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/WaveformCalculator.cpp 2024-01-01 08:59:03.000000000 +0100 @@ -21,47 +21,45 @@ #include "WaveformCalculator.h" +#include "sidcxx11.h" + +#include <map> +#ifdef HAVE_CXX11 +# include <mutex> +#endif #include <cmath> namespace reSIDfp { +/** + * Combined waveform model parameters. + */ +typedef float (*distance_t)(float, int); + +typedef struct +{ + distance_t distFunc; + float threshold; + float topbit; + float pulsestrength; + float distance1; + float distance2; +} CombinedWaveformConfig; + +typedef std::map<const CombinedWaveformConfig*, matrix_t> cw_cache_t; + +cw_cache_t PULLDOWN_CACHE; +#ifdef HAVE_CXX11 +std::mutex PULLDOWN_CACHE_Lock; +#endif + WaveformCalculator* WaveformCalculator::getInstance() { static WaveformCalculator instance; return &instance; } -/** - * Parameters derived with the Monte Carlo method based on - * samplings by kevtris. Code and data available in the project repository [1]. - * - * The score here reported is the acoustic error - * calculated XORing the estimated and the sampled values. - * In parentheses the number of mispredicted bits. - * - * [1] https://github.com/libsidplayfp/combined-waveforms - */ -const CombinedWaveformConfig config[2][5] = -{ - { /* kevtris chip G (6581 R2) */ - {0.862147212f, 0.f, 10.8962431f, 2.50848103f }, // TS error 1941 (327/28672) - {0.932746708f, 2.07508397f, 1.03668225f, 1.14876997f }, // PT error 5992 (126/32768) - {0.860927045f, 2.43506575f, 0.908603609f, 1.07907593f }, // PS error 3693 (521/28672) - {0.741343081f, 0.0452554375f, 1.1439606f, 1.05711341f }, // PTS error 338 ( 29/28672) - {0.96f, 2.5f, 1.1f, 1.2f }, // NP guessed - }, - { /* kevtris chip V (8580 R5) */ - {0.715788841f, 0.f, 1.32999945f, 2.2172699f }, // TS error 928 (135/32768) - {0.93500334f, 1.05977178f, 1.08629429f, 1.43518543f }, // PT error 7991 (212/32768) - {0.920648575f, 0.943601072f, 1.13034654f, 1.41881108f }, // PS error 12566 (394/32768) - {0.90921098f, 0.979807794f, 0.942194462f, 1.40958893f }, // PTS error 2092 ( 60/32768) - {0.95f, 1.15f, 1.f, 1.45f }, // NP guessed - }, -}; - -typedef float (*distance_t)(float, int); - // Distance functions static float exponentialDistance(float distance, int i) { @@ -73,11 +71,80 @@ return 1.f / (1.f + i * distance); } -MAYBE_UNUSED static float quadraticDistance(float distance, int i) +static float quadraticDistance(float distance, int i) { return 1.f / (1.f + (i*i) * distance); } +/** + * Parameters derived with the Monte Carlo method based on + * samplings from real machines. + * Code and data available in the project repository [1]. + * Sampling program made by Dag Lem [2]. + * + * The score here reported is the acoustic error + * calculated XORing the estimated and the sampled values. + * In parentheses the number of mispredicted bits. + * + * [1] https://github.com/libsidplayfp/combined-waveforms + * [2] https://github.com/daglem/reDIP-SID/blob/master/research/combsample.d64 + */ +const CombinedWaveformConfig config[2][5] = +{ + { /* 6581 R3 4785 sampled by Trurl */ + // TS error 2298 (339/32768) + { exponentialDistance, 0.776678205f, 1.18439901f, 0.f, 2.25732255f, 5.12803745f }, + // PT error 582 (57/32768) + { linearDistance, 1.01866758f, 1.f, 2.69177628f, 0.0233543925f, 0.0850229636f }, + // PS error 9242 (679/32768) + { linearDistance, 2.20329857f, 1.04501438f, 10.5146885f, 0.277294368f, 0.143747061f }, + // PTS error 2799 (71/32768) + { linearDistance, 1.35652959f, 1.09051275f, 3.21098137f, 0.16658926f, 0.370252877f }, + // NP guessed + { exponentialDistance, 0.96f, 1.f, 2.5f, 1.1f, 1.2f }, + }, +#if 0 + // weak cw + { /* 6581 R2 4383 sampled by ltx128 */ + // TS error 1858 (204/32768) + { exponentialDistance, 0.886832297f, 1.f, 0.f, 2.14438701f, 9.51839447f }, + // PT error 612 (102/32768) + { linearDistance, 1.01262534f, 1.f, 2.46070528f, 0.0537485816f, 0.0986242667f }, + // PS error 8135 (575/32768) + { linearDistance, 2.14896345f, 1.0216713f, 10.5400085f, 0.244498149f, 0.126134038f }, + // PTS error 2505 (63/32768) + { linearDistance, 1.29061747f, 0.9754318f, 3.15377498f, 0.0968349651f, 0.318573922f }, + // NP guessed + { exponentialDistance, 0.96f, 1.f, 2.5f, 1.1f, 1.2f }, + }, + // strong cw + { /* 6581 R2 0384 sampled by Trurl */ + // TS error 20337 (1579/32768) + { exponentialDistance, 0.000637792516f, 1.56725872f, 0.f, 0.00036806846f, 1.51800942f }, + // PT error 5194 (240/32768) + { linearDistance, 0.924824238f, 1.f, 1.96749473f, 0.0891806409f, 0.234794483f }, + // PS error 31015 (2181/32768) + { linearDistance, 1.2328074f, 0.73079139f, 3.9719491f, 0.00156516861f, 0.314677745f }, + // PTS error 9874 (201/32768) + { linearDistance, 1.08558261f, 0.857638359f, 1.52781796f, 0.152927235f, 1.02657032f }, + // NP guessed + { exponentialDistance, 0.96f, 1.f, 2.5f, 1.1f, 1.2f }, + }, +#endif + { /* 8580 R5 5092 25 sampled by reFX-Mike */ + // TS error 1212 (183/32768) + { exponentialDistance, 0.684999049f, 0.916620493f, 0.f, 1.14715648f, 2.02339816f }, + // PT error 6153 (295/32768) + { exponentialDistance, 0.940367579, 1.f, 1.26695442f, 0.976729453f, 1.57954705f }, + // PS error 7620 (454/32768) + { quadraticDistance, 0.963866293f, 1.22095084f, 1.01380754f, 0.0110885892f, 0.381492466f }, + // PTS error 3701 (117/32768) + { linearDistance, 0.976761818f, 0.202727556f, 0.988633931f, 0.939373314f, 9.37139416f }, + // NP guessed + { exponentialDistance, 0.95f, 1.f, 1.15f, 1.f, 1.45f }, + }, +}; + /// Calculate triangle waveform static unsigned int triXor(unsigned int val) { @@ -92,7 +159,7 @@ * @param threshold * @param accumulator the high bits of the accumulator value */ -short calculatePulldown(float distancetable[], float pulsestrength, float threshold, unsigned int accumulator) +short calculatePulldown(float distancetable[], float topbit, float pulsestrength, float threshold, unsigned int accumulator) { unsigned char bit[12]; @@ -101,6 +168,8 @@ bit[i] = (accumulator & (1u << i)) != 0 ? 1 : 0; } + bit[11] *= topbit; + float pulldown[12]; for (int sb = 0; sb < 12; sb++) @@ -155,6 +224,10 @@ matrix_t* WaveformCalculator::buildPulldownTable(ChipModel model) { +#ifdef HAVE_CXX11 + std::lock_guard<std::mutex> lock(PULLDOWN_CACHE_Lock); +#endif + const CombinedWaveformConfig* cfgArray = config[model == MOS6581 ? 0 : 1]; cw_cache_t::iterator lb = PULLDOWN_CACHE.lower_bound(cfgArray); @@ -170,7 +243,7 @@ { const CombinedWaveformConfig& cfg = cfgArray[wav]; - const distance_t distFunc = exponentialDistance; + const distance_t distFunc = cfg.distFunc; float distancetable[12 * 2 + 1]; distancetable[12] = 1.f; @@ -182,7 +255,7 @@ for (unsigned int idx = 0; idx < (1u << 12); idx++) { - pdTable[wav][idx] = calculatePulldown(distancetable, cfg.pulsestrength, cfg.threshold, idx); + pdTable[wav][idx] = calculatePulldown(distancetable, cfg.topbit, cfg.pulsestrength, cfg.threshold, idx); } } #ifdef HAVE_CXX11 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/WaveformCalculator.h new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/WaveformCalculator.h --- old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/WaveformCalculator.h 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/WaveformCalculator.h 2024-01-01 08:59:03.000000000 +0100 @@ -22,10 +22,8 @@ #ifndef WAVEFORMCALCULATOR_h #define WAVEFORMCALCULATOR_h -#include <map> - #include "array.h" -#include "sidcxx11.h" + #include "siddefs-fp.h" @@ -33,35 +31,24 @@ { /** - * Combined waveform model parameters. - */ -typedef struct -{ - float threshold; - float pulsestrength; - float distance1; - float distance2; -} CombinedWaveformConfig; - -/** * Combined waveform calculator for WaveformGenerator. * By combining waveforms, the bits of each waveform are effectively short - * circuited. A zero bit in one waveform will result in a zero output bit - * (thus the infamous claim that the waveforms are AND'ed). + * circuited, a zero bit in one waveform will result in a zero output bit, + * thus the claim that the waveforms are AND'ed. * However, a zero bit in one waveform may also affect the neighboring bits * in the output. * * Example: - * + * * 1 1 * Bit # 1 0 9 8 7 6 5 4 3 2 1 0 * ----------------------- * Sawtooth 0 0 0 1 1 1 1 1 1 0 0 0 - * + * * Triangle 0 0 1 1 1 1 1 1 0 0 0 0 - * + * * AND 0 0 0 1 1 1 1 1 0 0 0 0 - * + * * Output 0 0 0 0 1 1 1 0 0 0 0 0 * * @@ -99,13 +86,8 @@ class WaveformCalculator { private: - typedef std::map<const CombinedWaveformConfig*, matrix_t> cw_cache_t; - -private: matrix_t wftable; - cw_cache_t PULLDOWN_CACHE; - private: WaveformCalculator(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/WaveformGenerator.cpp new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/WaveformGenerator.cpp --- old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/WaveformGenerator.cpp 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/WaveformGenerator.cpp 2024-01-01 08:59:03.000000000 +0100 @@ -1,7 +1,7 @@ /* * This file is part of libsidplayfp, a SID player engine. * - * Copyright 2011-2022 Leandro Nini <[email protected]> + * Copyright 2011-2023 Leandro Nini <[email protected]> * Copyright 2007-2010 Antti Lankila * Copyright 2004 Dag Lem <[email protected]> * @@ -24,19 +24,6 @@ #include "WaveformGenerator.h" -/* - * This fixes tests - * SID/wb_testsuite/noise_writeback_check_8_to_C_old - * SID/wb_testsuite/noise_writeback_check_9_to_C_old - * SID/wb_testsuite/noise_writeback_check_A_to_C_old - * SID/wb_testsuite/noise_writeback_check_C_to_C_old - * - * but breaks SID/wf12nsr/wf12nsr - * - * needs more digging... - */ -//#define NO_WB_NOI_PUL - namespace reSIDfp { @@ -120,16 +107,134 @@ * -----+-------+--------------+-------------- * phi1 | 1 | X --> X | A --> A <- shift phase 2 * phi2 | 1 | X <-> X | A <-> A + * + * + * Normal cycles + * ------------- + * Normally, when noise is selected along with another waveform, + * c1 and c2 are closed and the output bits pull down the corresponding + * shift register bits. + * + * noi_out_x noi_out_x+1 + * ^ ^ + * | | + * +-------------+ +-------------+ + * | | | | + * +---o<|---+ | +---o<|---+ | + * | | | | | | + * c2 | c1 | | c2 | c1 | | + * | | | | | | + * >---/---+---|>o---+ +---/---+---|>o---+ +---/---> + * LC LC LC + * + * + * Shift phase 1 + * ------------- + * During shift phase 1 c1 and c2 are open, the SR bits are floating + * and will be driven by the output of combined waveforms, + * or slowly turn high. + * + * noi_out_x noi_out_x+1 + * ^ ^ + * | | + * +-------------+ +-------------+ + * | | | | + * +---o<|---+ | +---o<|---+ | + * | | | | | | + * c2 / c1 / | c2 / c1 / | + * | | | | | | + * >-------+---|>o---+ +-------+---|>o---+ +-------> + * LC LC LC + * + * + * Shift phase 2 (phi1) + * -------------------- + * During the first half cycle of shift phase 2 c1 is closed + * so the value from of noi_out_x-1 enters the bit. + * + * noi_out_x noi_out_x+1 + * ^ ^ + * | | + * +-------------+ +-------------+ + * | | | | + * +---o<|---+ | +---o<|---+ | + * | | | | | | + * c2 / c1 | | c2 / c1 | | + * | | | | | | + * >---/---+---|>o---+ +---/---+---|>o---+ +---/---> + * LC LC LC + * + * + * Shift phase 2 (phi2) + * -------------------- + * On the second half of shift phase 2 c2 closes and + * we're back to normal cycles. */ -void WaveformGenerator::clock_shift_register(unsigned int bit0) + +inline bool do_writeback(unsigned int waveform_old, unsigned int waveform_new, bool is6581) { - shift_register = (shift_register >> 1) | bit0; + // no writeback without combined waveforms - // New noise waveform output. - set_noise_output(); + if (waveform_old <= 8) + // fixes SID/noisewriteback/noise_writeback_test2-{old,new} + return false; + + if (waveform_new < 8) + return false; + + if ((waveform_new == 8) + // breaks noise_writeback_check_F_to_8_old + // but fixes simple and scan + && (waveform_old != 0xf)) + { + // fixes + // noise_writeback_check_9_to_8_old + // noise_writeback_check_A_to_8_old + // noise_writeback_check_B_to_8_old + // noise_writeback_check_D_to_8_old + // noise_writeback_check_E_to_8_old + // noise_writeback_check_F_to_8_old + // noise_writeback_check_9_to_8_new + // noise_writeback_check_A_to_8_new + // noise_writeback_check_D_to_8_new + // noise_writeback_check_E_to_8_new + // noise_writeback_test1-{old,new} + return false; + } + + // What's happening here? + if (is6581 && + ((((waveform_old & 0x3) == 0x1) && ((waveform_new & 0x3) == 0x2)) + || (((waveform_old & 0x3) == 0x2) && ((waveform_new & 0x3) == 0x1)))) + { + // fixes + // noise_writeback_check_9_to_A_old + // noise_writeback_check_9_to_E_old + // noise_writeback_check_A_to_9_old + // noise_writeback_check_A_to_D_old + // noise_writeback_check_D_to_A_old + // noise_writeback_check_E_to_9_old + return false; + } + if (waveform_old == 0xc) + { + // fixes + // noise_writeback_check_C_to_A_new + return false; + } + if (waveform_new == 0xc) + { + // fixes + // noise_writeback_check_9_to_C_old + // noise_writeback_check_A_to_C_old + return false; + } + + // ok do the writeback + return true; } -unsigned int WaveformGenerator::get_noise_writeback() +inline unsigned int get_noise_writeback(unsigned int waveform_output) { return ((waveform_output & (1u << 11)) >> 9) | // Bit 11 -> bit 20 @@ -142,24 +247,65 @@ ((waveform_output & (1u << 4)) << 18); // Bit 4 -> bit 0 } -void WaveformGenerator::write_shift_register() +/* + * Perform the actual shifting, moving the latched value into following bits. + * The XORing for bit0 is done in this cycle using the test bit latched during + * the previous phi2 cycle. + */ +void WaveformGenerator::shift_phase2(unsigned int waveform_old, unsigned int waveform_new) { - if (unlikely(waveform > 0x8) && likely(!test) && likely(shift_pipeline != 1)) + if (do_writeback(waveform_old, waveform_new, is6581)) { - // Write changes to the shift register output caused by combined waveforms - // back into the shift register. This happens only when the register is clocked - // (see $D1+$81_wave_test [1]) or when the test bit is falling. - // A bit once set to zero cannot be changed, hence the and'ing. - // - // [1] ftp://ftp.untergrund.net/users/nata/sid_test/$D1+$81_wave_test.7z + // if noise is combined with another waveform the output drives the SR bits + shift_latch = (shift_register & shift_mask) | get_noise_writeback(waveform_output); + } -#ifdef NO_WB_NOI_PUL + // bit0 = (bit22 | test | reset) ^ bit17 = 1 ^ bit17 = ~bit17 + const unsigned int bit22 = ((test_or_reset ? 1 : 0) | shift_latch) << 22; + const unsigned int bit0 = (bit22 ^ (shift_latch << 17)) & (1 << 22); + + shift_register = (shift_latch >> 1) | bit0; +#ifdef TRACE + std::cout << std::hex << shift_latch << " -> " << shift_register << std::endl; +#endif + set_noise_output(); +} + +void WaveformGenerator::write_shift_register() +{ + if (unlikely(waveform > 0x8)) + { +#if 0 + // FIXME this breaks SID/wf12nsr/wf12nsr if (waveform == 0xc) + // fixes + // noise_writeback_check_8_to_C_old + // noise_writeback_check_9_to_C_old + // noise_writeback_check_A_to_C_old + // noise_writeback_check_C_to_C_old return; #endif - shift_register &= shift_mask | get_noise_writeback(); - noise_output &= waveform_output; + // Write changes to the shift register output caused by combined waveforms + // back into the shift register. + if (likely(shift_pipeline != 1) && !test) + { +#ifdef TRACE + std::cout << "write shift_register" << std::endl; +#endif + // the output pulls down the SR bits + shift_register = shift_register & (shift_mask | get_noise_writeback(waveform_output)); + noise_output &= waveform_output; + } + else + { +#ifdef TRACE + std::cout << "write shift_latch" << std::endl; +#endif + // shift phase 1: the output drives the SR bits + noise_output = waveform_output; + } + set_no_noise_or_noise_output(); } } @@ -200,26 +346,6 @@ } } -bool do_pre_writeback(unsigned int waveform_prev, unsigned int waveform, bool is6581) -{ - // no writeback without combined waveforms - if (waveform <= 8) - return false; - // What's happening here? - if (is6581 && - ((((waveform_prev & 0x3) == 0x1) && ((waveform & 0x3) == 0x2)) - || (((waveform_prev & 0x3) == 0x2) && ((waveform & 0x3) == 0x1)))) - return false; - if (waveform_prev == 0xc) - return false; -#ifdef NO_WB_NOI_PUL - if (waveform == 0xc) - return false; -#endif - // ok do the writeback - return true; -} - void WaveformGenerator::set_no_noise_or_noise_output() { no_noise_or_noise_output = no_noise | noise_output; @@ -290,6 +416,12 @@ // Flush shift pipeline. shift_pipeline = 0; + // Latch the shift register value. + shift_latch = shift_register; +#ifdef TRACE + std::cout << "shift phase 1 (test)" << std::endl; +#endif + // Set reset time for shift register. shift_register_reset = is6581 ? SHIFT_REGISTER_RESET_6581R3 : SHIFT_REGISTER_RESET_8580R5; } @@ -297,17 +429,7 @@ { // When the test bit is falling, the second phase of the shift is // completed by enabling SRAM write. - - // During first phase of the shift the bits are interconnected - // and the output of each bit is loaded into the following. - // The output may overwrite the latched value. - if (do_pre_writeback(waveform_prev, waveform, is6581)) - { - shift_register = (shift_register & shift_mask) | get_noise_writeback(); - } - - // bit0 = (bit22 | test) ^ bit17 = 1 ^ bit17 = ~bit17 - clock_shift_register((~shift_register << 17) & (1 << 22)); + shift_phase2(waveform_prev, waveform); } } } @@ -355,7 +477,9 @@ // when reset is released the shift register is clocked once // so the lower bit is zeroed out // bit0 = (bit22 | test) ^ bit17 = 1 ^ 1 = 0 - clock_shift_register(0); + test_or_reset = true; + shift_latch = shift_register; + shift_phase2(0, 0); shift_pipeline = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/WaveformGenerator.h new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/WaveformGenerator.h --- old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/WaveformGenerator.h 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/WaveformGenerator.h 2024-01-01 08:59:03.000000000 +0100 @@ -1,7 +1,7 @@ /* * This file is part of libsidplayfp, a SID player engine. * - * Copyright 2011-2022 Leandro Nini <[email protected]> + * Copyright 2011-2023 Leandro Nini <[email protected]> * Copyright 2007-2010 Antti Lankila * Copyright 2004,2010 Dag Lem <[email protected]> * @@ -28,6 +28,13 @@ #include "sidcxx11.h" +// print SR debugging info +//#define TRACE 1 + +#ifdef TRACE +# include <iostream> +#endif + namespace reSIDfp { @@ -97,6 +104,9 @@ unsigned int shift_register; + /// Shift register is latched when transitioning to shift phase 1. + unsigned int shift_latch; + /// Emulation of pipeline causing bit 19 to clock the shift register. int shift_pipeline; @@ -127,7 +137,7 @@ /// Remaining time to fully reset shift register. unsigned int shift_register_reset; - // The wave signal TTL when no waveform is selected + // The wave signal TTL when no waveform is selected. unsigned int floating_output_ttl; /// The control register bits. Gate is handled by EnvelopeGenerator. @@ -136,15 +146,16 @@ bool sync; //@} + /// Test bit is latched at phi2 for the noise XOR. + bool test_or_reset; + /// Tell whether the accumulator MSB was set high on this cycle. bool msb_rising; bool is6581; //-V730_NOINIT this is initialized in the SID constructor private: - void clock_shift_register(unsigned int bit0); - - unsigned int get_noise_writeback(); + void shift_phase2(unsigned int waveform_old, unsigned int waveform_new); void write_shift_register(); @@ -300,12 +311,19 @@ { if (unlikely(shift_register_reset != 0) && unlikely(--shift_register_reset == 0)) { +#ifdef TRACE + std::cout << "shiftregBitfade" << std::endl; +#endif shiftregBitfade(); + shift_latch = shift_register; // New noise waveform output. set_noise_output(); } + // Latch the test bit value for shift phase 2. + test_or_reset = true; + // The test bit sets pulse high. pulse_output = 0xfff; } @@ -328,10 +346,25 @@ // Pipeline: Detect rising bit, shift phase 1, shift phase 2. shift_pipeline = 2; } - else if (unlikely(shift_pipeline != 0) && --shift_pipeline == 0) + else if (unlikely(shift_pipeline != 0)) { - // bit0 = (bit22 | test) ^ bit17 - clock_shift_register(((shift_register << 22) ^ (shift_register << 17)) & (1u << 22)); + switch (--shift_pipeline) + { + case 0: +#ifdef TRACE + std::cout << "shift phase 2" << std::endl; +#endif + shift_phase2(waveform, waveform); + break; + case 1: +#ifdef TRACE + std::cout << "shift phase 1" << std::endl; +#endif + // Start shift phase 1. + test_or_reset = false; + shift_latch = shift_register; + break; + } } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/resample/SincResampler.cpp new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/resample/SincResampler.cpp --- old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp/resample/SincResampler.cpp 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp/resample/SincResampler.cpp 2024-01-01 08:59:03.000000000 +0100 @@ -30,6 +30,8 @@ #include "siddefs-fp.h" +#include "sidcxx11.h" + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -41,6 +43,9 @@ #elif defined(HAVE_ARM_NEON_H) # include <arm_neon.h> #endif +#ifdef HAVE_CXX11 +# include <mutex> +#endif namespace reSIDfp { @@ -49,6 +54,9 @@ /// Cache for the expensive FIR table computation results. fir_cache_t FIR_CACHE; +#ifdef HAVE_CXX11 +std::mutex FIR_CACHE_Lock; +#endif /// Maximum error acceptable in I0 is 1e-6, or ~96 dB. const double I0E = 1e-6; @@ -119,7 +127,7 @@ for (int i = 0; i < n; i++) { const __m128i tmp = _mm_madd_epi16(*(__m128i*)a, *(__m128i*)b); - acc = _mm_add_epi16(acc, tmp); + acc = _mm_add_epi32(acc, tmp); a += 8; b += 8; } @@ -313,6 +321,11 @@ std::ostringstream o; o << firN << "," << firRES << "," << cyclesPerSampleD; const std::string firKey = o.str(); + +#ifdef HAVE_CXX11 + std::lock_guard<std::mutex> lock(FIR_CACHE_Lock); +#endif + fir_cache_t::iterator lb = FIR_CACHE.lower_bound(firKey); // The FIR computation is expensive and we set sampling parameters often, but diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp-emu.cpp new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp-emu.cpp --- old/libsidplayfp-2.5.0/src/builders/residfp-builder/residfp-emu.cpp 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/src/builders/residfp-builder/residfp-emu.cpp 2024-01-01 08:59:03.000000000 +0100 @@ -38,22 +38,13 @@ const char* ReSIDfp::getCredits() { - static std::string credits; - - if (credits.empty()) - { - // Setup credits - std::ostringstream ss; - ss << "ReSIDfp V" << VERSION << " Engine:\n"; - ss << "\t(C) 1999-2002 Simon White\n"; - ss << "MOS6581 (SID) Emulation (ReSIDfp V" << residfp_version_string << "):\n"; - ss << "\t(C) 1999-2002 Dag Lem\n"; - ss << "\t(C) 2005-2011 Antti S. Lankila\n"; - ss << "\t(C) 2010-2015 Leandro Nini\n"; - credits = ss.str(); - } - - return credits.c_str(); + return + "ReSIDfp V" VERSION " Engine:\n" + "\t(C) 1999-2002 Simon White\n" + "MOS6581/CSG8580 (SID) Emulation:\n" + "\t(C) 1999-2002 Dag Lem\n" + "\t(C) 2005-2011 Antti S. Lankila\n" + "\t(C) 2010-2023 Leandro Nini\n"; } ReSIDfp::ReSIDfp(sidbuilder *builder) : diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/test/testlist new/libsidplayfp-2.6.0/test/testlist --- old/libsidplayfp-2.5.0/test/testlist 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/test/testlist 2024-01-01 08:59:03.000000000 +0100 @@ -757,6 +757,8 @@ SID/writedelay/writedelay --sid old SID/wf12nsr/wf12nsr --sid old SID/wf12nsr/wf12nsr-8580 --sid new +SID/noiselfsrinit/simple --sid old +SID/noiselfsrinit/scan --sid old ### VICII ### VICII/colorram/test VICII/split-tests/bascan/bascan diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libsidplayfp-2.5.0/tests/TestWaveformGenerator.cpp new/libsidplayfp-2.6.0/tests/TestWaveformGenerator.cpp --- old/libsidplayfp-2.5.0/tests/TestWaveformGenerator.cpp 2023-06-02 14:55:01.000000000 +0200 +++ new/libsidplayfp-2.6.0/tests/TestWaveformGenerator.cpp 2024-01-01 08:59:03.000000000 +0100 @@ -1,7 +1,7 @@ /* * This file is part of libsidplayfp, a SID player engine. * - * Copyright (C) 2014-2022 Leandro Nini + * Copyright (C) 2014-2023 Leandro Nini * * 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 @@ -52,7 +52,11 @@ generator.reset(); generator.shift_register = 0x35555e; - generator.clock_shift_register(0); + // shift phase 1 + generator.test_or_reset = false; + generator.shift_latch = generator.shift_register; + // shift phase 2 + generator.shift_phase2(0, 0); CHECK_EQUAL(0x9e0, generator.noise_output); }
