From 966f2d253cd2ee6ce140ad68095a20a9d2b63052 Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Sun, 27 Jan 2019 21:13:54 -0500 Subject: Floating Point Dither For All --- .../christopherjohnson.pbxuser | 47 ++++++++-------- .../christopherjohnson.perspectivev3 | 34 +++++------ .../project.xcworkspace/contents.xcworkspacedata | 0 .../UserInterfaceState.xcuserstate | Bin .../UserInterfaceState.xcuserstate | Bin .../Acceleration.xcodeproj/spiadmin.mode1v3 | 0 .../Acceleration.xcodeproj/spiadmin.pbxuser | 0 .../xcschemes/Gain.xcscheme | 0 .../xcschemes/xcschememanagement.plist | 0 .../xcschemes/xcschememanagement.plist | 0 .../\302\253PROJECTNAME\302\273.xcscheme" | 0 .../MacVST/Acceleration/source/Acceleration.cpp | 7 +-- plugins/MacVST/Acceleration/source/Acceleration.h | 7 +-- .../Acceleration/source/AccelerationProc.cpp | 62 ++++++--------------- 14 files changed, 62 insertions(+), 95 deletions(-) mode change 100644 => 100755 plugins/MacVST/Acceleration/Acceleration.xcodeproj/christopherjohnson.pbxuser mode change 100644 => 100755 plugins/MacVST/Acceleration/Acceleration.xcodeproj/christopherjohnson.perspectivev3 mode change 100644 => 100755 plugins/MacVST/Acceleration/Acceleration.xcodeproj/project.xcworkspace/contents.xcworkspacedata mode change 100644 => 100755 plugins/MacVST/Acceleration/Acceleration.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate mode change 100644 => 100755 plugins/MacVST/Acceleration/Acceleration.xcodeproj/project.xcworkspace/xcuserdata/spiadmin.xcuserdatad/UserInterfaceState.xcuserstate mode change 100644 => 100755 plugins/MacVST/Acceleration/Acceleration.xcodeproj/spiadmin.mode1v3 mode change 100644 => 100755 plugins/MacVST/Acceleration/Acceleration.xcodeproj/spiadmin.pbxuser mode change 100644 => 100755 plugins/MacVST/Acceleration/Acceleration.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/Gain.xcscheme mode change 100644 => 100755 plugins/MacVST/Acceleration/Acceleration.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/xcschememanagement.plist mode change 100644 => 100755 plugins/MacVST/Acceleration/Acceleration.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/xcschememanagement.plist mode change 100644 => 100755 "plugins/MacVST/Acceleration/Acceleration.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/\302\253PROJECTNAME\302\273.xcscheme" (limited to 'plugins/MacVST/Acceleration') diff --git a/plugins/MacVST/Acceleration/Acceleration.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Acceleration/Acceleration.xcodeproj/christopherjohnson.pbxuser old mode 100644 new mode 100755 index 6146ccc..de2e9ea --- a/plugins/MacVST/Acceleration/Acceleration.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/Acceleration/Acceleration.xcodeproj/christopherjohnson.pbxuser @@ -49,12 +49,12 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 539484698; - PBXWorkspaceStateSaveDate = 539484698; + PBXPerProjectTemplateStateSaveDate = 569706438; + PBXWorkspaceStateSaveDate = 569706438; }; perUserProjectItems = { - 8BCA6F6E2027E22B00D92BAD /* PBXTextBookmark */ = 8BCA6F6E2027E22B00D92BAD /* PBXTextBookmark */; - 8BCA6F6F2027E22B00D92BAD /* PBXTextBookmark */ = 8BCA6F6F2027E22B00D92BAD /* PBXTextBookmark */; + 8B7932FD21F507DF006E9731 /* XCBuildMessageTextBookmark */ = 8B7932FD21F507DF006E9731 /* XCBuildMessageTextBookmark */; + 8B79330721F50B3A006E9731 /* PBXTextBookmark */ = 8B79330721F50B3A006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; userBuildSettings = { @@ -63,16 +63,16 @@ 2407DEB6089929BA00EB68BF /* Acceleration.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {848, 1820}}"; - sepNavSelRange = "{671, 0}"; - sepNavVisRange = "{2909, 2099}"; + sepNavSelRange = "{681, 92}"; + sepNavVisRange = "{0, 2007}"; sepNavWindowFrame = "{{12, 47}, {895, 831}}"; }; }; 245463B80991757100464AD3 /* Acceleration.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {866, 1157}}"; - sepNavSelRange = "{2833, 0}"; - sepNavVisRange = "{720, 2154}"; + sepNavIntBoundsRect = "{{0, 0}, {866, 1118}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{661, 2147}"; sepNavWindowFrame = "{{20, 47}, {895, 831}}"; }; }; @@ -86,9 +86,9 @@ }; 24D8286F09A914000093AEF8 /* AccelerationProc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {554, 4277}}"; - sepNavSelRange = "{5841, 0}"; - sepNavVisRange = "{5761, 137}"; + sepNavIntBoundsRect = "{{0, 0}, {621, 3822}}"; + sepNavSelRange = "{9506, 0}"; + sepNavVisRange = "{4212, 165}"; sepNavWindowFrame = "{{25, 47}, {895, 831}}"; }; }; @@ -106,25 +106,24 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; - 8BCA6F6E2027E22B00D92BAD /* PBXTextBookmark */ = { + 8B7932FD21F507DF006E9731 /* XCBuildMessageTextBookmark */ = { isa = PBXTextBookmark; + comments = "'Float32' was not declared in this scope"; fRef = 24D8286F09A914000093AEF8 /* AccelerationProc.cpp */; - name = "AccelerationProc.cpp: 196"; - rLen = 0; - rLoc = 5841; - rType = 0; - vrLen = 137; - vrLoc = 5761; + fallbackIsa = XCBuildMessageTextBookmark; + rLen = 1; + rLoc = 135; + rType = 1; }; - 8BCA6F6F2027E22B00D92BAD /* PBXTextBookmark */ = { + 8B79330721F50B3A006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 24D8286F09A914000093AEF8 /* AccelerationProc.cpp */; - name = "AccelerationProc.cpp: 196"; + name = "AccelerationProc.cpp: 298"; rLen = 0; - rLoc = 5841; + rLoc = 9506; rType = 0; - vrLen = 137; - vrLoc = 5761; + vrLen = 165; + vrLoc = 4212; }; 8D01CCC60486CAD60068D4B7 /* Acceleration */ = { activeExec = 0; diff --git a/plugins/MacVST/Acceleration/Acceleration.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Acceleration/Acceleration.xcodeproj/christopherjohnson.perspectivev3 old mode 100644 new mode 100755 index c17455b..6330e85 --- a/plugins/MacVST/Acceleration/Acceleration.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/Acceleration/Acceleration.xcodeproj/christopherjohnson.perspectivev3 @@ -323,7 +323,7 @@ 185 RubberWindowFrame - 9 374 810 487 0 0 1440 878 + 7 375 810 487 0 0 1440 878 Module PBXSmartGroupTreeModule @@ -351,10 +351,10 @@ _historyCapacity 0 bookmark - 8BCA6F6F2027E22B00D92BAD + 8B79330721F50B3A006E9731 history - 8BCA6F6E2027E22B00D92BAD + 8B7932FD21F507DF006E9731 SplitCount @@ -368,18 +368,18 @@ GeometryConfiguration Frame - {{0, 0}, {603, 117}} + {{0, 0}, {603, 86}} RubberWindowFrame - 9 374 810 487 0 0 1440 878 + 7 375 810 487 0 0 1440 878 Module PBXNavigatorGroup Proportion - 117pt + 86pt Proportion - 324pt + 355pt Tabs @@ -393,9 +393,7 @@ GeometryConfiguration Frame - {{10, 27}, {603, 297}} - RubberWindowFrame - 9 374 810 487 0 0 1440 878 + {{10, 27}, {603, 328}} Module XCDetailModule @@ -449,7 +447,9 @@ GeometryConfiguration Frame - {{10, 27}, {603, 282}} + {{10, 27}, {603, 328}} + RubberWindowFrame + 7 375 810 487 0 0 1440 878 Module PBXBuildResultsModule @@ -477,11 +477,11 @@ TableOfContents - 8BCA6F702027E22B00D92BAD + 8B7932EA21F507C8006E9731 1CA23ED40692098700951B8B - 8BCA6F712027E22B00D92BAD + 8B7932EB21F507C8006E9731 8B0237581D42B1C400E1E8C8 - 8BCA6F722027E22B00D92BAD + 8B7932EC21F507C8006E9731 1CA23EDF0692099D00951B8B 1CA23EE00692099D00951B8B 1CA23EE10692099D00951B8B @@ -634,7 +634,7 @@ StatusbarIsVisible TimeStamp - 539484715.52542996 + 569707322.35574102 ToolbarConfigUserDefaultsMinorVersion 2 ToolbarDisplayMode @@ -651,11 +651,11 @@ 5 WindowOrderList - 8BCA6F732027E22B00D92BAD + 8B79330821F50B3A006E9731 /Users/christopherjohnson/Desktop/MacVST/Acceleration/Acceleration.xcodeproj WindowString - 9 374 810 487 0 0 1440 878 + 7 375 810 487 0 0 1440 878 WindowToolsV3 diff --git a/plugins/MacVST/Acceleration/Acceleration.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/plugins/MacVST/Acceleration/Acceleration.xcodeproj/project.xcworkspace/contents.xcworkspacedata old mode 100644 new mode 100755 diff --git a/plugins/MacVST/Acceleration/Acceleration.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate b/plugins/MacVST/Acceleration/Acceleration.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate old mode 100644 new mode 100755 diff --git a/plugins/MacVST/Acceleration/Acceleration.xcodeproj/project.xcworkspace/xcuserdata/spiadmin.xcuserdatad/UserInterfaceState.xcuserstate b/plugins/MacVST/Acceleration/Acceleration.xcodeproj/project.xcworkspace/xcuserdata/spiadmin.xcuserdatad/UserInterfaceState.xcuserstate old mode 100644 new mode 100755 diff --git a/plugins/MacVST/Acceleration/Acceleration.xcodeproj/spiadmin.mode1v3 b/plugins/MacVST/Acceleration/Acceleration.xcodeproj/spiadmin.mode1v3 old mode 100644 new mode 100755 diff --git a/plugins/MacVST/Acceleration/Acceleration.xcodeproj/spiadmin.pbxuser b/plugins/MacVST/Acceleration/Acceleration.xcodeproj/spiadmin.pbxuser old mode 100644 new mode 100755 diff --git a/plugins/MacVST/Acceleration/Acceleration.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/Gain.xcscheme b/plugins/MacVST/Acceleration/Acceleration.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/Gain.xcscheme old mode 100644 new mode 100755 diff --git a/plugins/MacVST/Acceleration/Acceleration.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/xcschememanagement.plist b/plugins/MacVST/Acceleration/Acceleration.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/xcschememanagement.plist old mode 100644 new mode 100755 diff --git a/plugins/MacVST/Acceleration/Acceleration.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/xcschememanagement.plist b/plugins/MacVST/Acceleration/Acceleration.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/xcschememanagement.plist old mode 100644 new mode 100755 diff --git "a/plugins/MacVST/Acceleration/Acceleration.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/\302\253PROJECTNAME\302\273.xcscheme" "b/plugins/MacVST/Acceleration/Acceleration.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/\302\253PROJECTNAME\302\273.xcscheme" old mode 100644 new mode 100755 diff --git a/plugins/MacVST/Acceleration/source/Acceleration.cpp b/plugins/MacVST/Acceleration/source/Acceleration.cpp index f20c8f2..b2721d9 100755 --- a/plugins/MacVST/Acceleration/source/Acceleration.cpp +++ b/plugins/MacVST/Acceleration/source/Acceleration.cpp @@ -23,11 +23,8 @@ Acceleration::Acceleration(audioMasterCallback audioMaster) : o1R = o2R = o3R = 0.0; m1R = m2R = desR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //this is reset: values being initialized only once. Startup values, whatever they are. _canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect. diff --git a/plugins/MacVST/Acceleration/source/Acceleration.h b/plugins/MacVST/Acceleration/source/Acceleration.h index a152e25..02a3760 100755 --- a/plugins/MacVST/Acceleration/source/Acceleration.h +++ b/plugins/MacVST/Acceleration/source/Acceleration.h @@ -53,11 +53,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double ataLastOutL; double s1L; diff --git a/plugins/MacVST/Acceleration/source/AccelerationProc.cpp b/plugins/MacVST/Acceleration/source/AccelerationProc.cpp index 4785e37..0151dbe 100755 --- a/plugins/MacVST/Acceleration/source/AccelerationProc.cpp +++ b/plugins/MacVST/Acceleration/source/AccelerationProc.cpp @@ -17,9 +17,6 @@ void Acceleration::processReplacing(float **inputs, float **outputs, VstInt32 sa double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double intensity = pow(A,3)*(32/overallscale); double wet = B; @@ -135,25 +132,14 @@ void Acceleration::processReplacing(float **inputs, float **outputs, VstInt32 sa inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -175,9 +161,6 @@ void Acceleration::processDoubleReplacing(double **inputs, double **outputs, Vst double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double intensity = pow(A,3)*(32/overallscale); double wet = B; @@ -293,25 +276,16 @@ void Acceleration::processDoubleReplacing(double **inputs, double **outputs, Vst inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; -- cgit v1.2.3