diff options
author | Chris Johnson <jinx6568@sover.net> | 2019-02-19 08:35:31 -0500 |
---|---|---|
committer | Chris Johnson <jinx6568@sover.net> | 2019-02-19 08:35:31 -0500 |
commit | 83f022409ae017f4ac947430b4ec185f0196badc (patch) | |
tree | 0695ba5bdb872cd72356a62c280fbef490c5aac4 /plugins/MacAU/DitherFloat | |
parent | e5da517d26576cbae2f3bc64fc0b9733a5555815 (diff) | |
download | airwindows-lv2-port-83f022409ae017f4ac947430b4ec185f0196badc.tar.gz airwindows-lv2-port-83f022409ae017f4ac947430b4ec185f0196badc.tar.bz2 airwindows-lv2-port-83f022409ae017f4ac947430b4ec185f0196badc.zip |
DitherFloat update
Diffstat (limited to 'plugins/MacAU/DitherFloat')
4 files changed, 73 insertions, 55 deletions
diff --git a/plugins/MacAU/DitherFloat/DitherFloat.cpp b/plugins/MacAU/DitherFloat/DitherFloat.cpp index 7939fbe..f03ca76 100755 --- a/plugins/MacAU/DitherFloat/DitherFloat.cpp +++ b/plugins/MacAU/DitherFloat/DitherFloat.cpp @@ -165,7 +165,7 @@ ComponentResult DitherFloat::Initialize() //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void DitherFloat::DitherFloatKernel::Reset() { - fpNShape = 0.0; + fpd = 17; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -226,26 +226,37 @@ void DitherFloat::DitherFloatKernel::Process( const Float32 *inSourceP, case 32: gain = 4294967296.0; break; } //we are directly punching in the gain values rather than calculating them + //gain *= gain; //for testing with double precision, 64 bit while (nSampleFrames-- > 0) { long double inputSample = *sourceP + (gain-1); //this offsets the float into total truncation-land. - - - //begin 32 bit floating point dither - int expon; frexpf((Float32)inputSample, &expon); - long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo - inputSample += (dither-fpNShape); fpNShape = dither; + int expon; frexpf((float)inputSample, &expon); + fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; + inputSample += (fpd*3.4e-36l*pow(2,expon+62) * blend); //remove 'blend' for real use, it's for the demo + //end 32 bit floating point dither + + /* copy and paste into code, fpd is a uint32_t initialized as 17 (NOT 0) + + //begin 32 bit floating point dither + int expon; frexpf((float)inputSample, &expon); + fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; + inputSample += (fpd*3.4e-36l*pow(2,expon+62)); //end 32 bit floating point dither + //begin 64 bit floating point dither + int expon; frexp((double)inputSample, &expon); + fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; + inputSample += (fpd*6.4e-45l*pow(2,expon+62)); + //end 64 bit floating point dither + + */ - - - inputSample = (Float32)inputSample; //equivalent of 'floor' for 32 bit floating point + inputSample = (float)inputSample; //equivalent of 'floor' for 32 bit floating point //We do that separately, we're truncating to floating point WHILE heavily offset. *destP = inputSample - (gain-1); //this de-offsets the float. diff --git a/plugins/MacAU/DitherFloat/DitherFloat.h b/plugins/MacAU/DitherFloat/DitherFloat.h index 0eea62e..f692eff 100755 --- a/plugins/MacAU/DitherFloat/DitherFloat.h +++ b/plugins/MacAU/DitherFloat/DitherFloat.h @@ -128,7 +128,7 @@ public: virtual void Reset(); private: - long double fpNShape; + uint32_t fpd; }; }; diff --git a/plugins/MacAU/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.pbxuser index b851c08..3614dab 100755 --- a/plugins/MacAU/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.pbxuser @@ -49,24 +49,44 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 569802726; - PBXWorkspaceStateSaveDate = 569802726; + PBXPerProjectTemplateStateSaveDate = 572274037; + PBXWorkspaceStateSaveDate = 572274037; }; perUserProjectItems = { + 8B6F22BF221C34010084A947 /* PBXTextBookmark */ = 8B6F22BF221C34010084A947 /* PBXTextBookmark */; + 8B6F22E7221C35D70084A947 /* PBXTextBookmark */ = 8B6F22E7221C35D70084A947 /* PBXTextBookmark */; 8BEF85AB21F6801300FEF113 /* PlistBookmark */ = 8BEF85AB21F6801300FEF113 /* PlistBookmark */; - 8BEF85AC21F6801300FEF113 /* PBXBookmark */ = 8BEF85AC21F6801300FEF113 /* PBXBookmark */; - 8BEF85AD21F6801300FEF113 /* PBXTextBookmark */ = 8BEF85AD21F6801300FEF113 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; + 8B6F22BF221C34010084A947 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* DitherFloat.cpp */; + name = "DitherFloat.cpp: 257"; + rLen = 0; + rLoc = 10887; + rType = 0; + vrLen = 1139; + vrLoc = 9739; + }; + 8B6F22E7221C35D70084A947 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* DitherFloat.cpp */; + name = "DitherFloat.cpp: 257"; + rLen = 0; + rLoc = 10887; + rType = 0; + vrLen = 1139; + vrLoc = 9739; + }; 8BA05A660720730100365D66 /* DitherFloat.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1048, 3588}}"; - sepNavSelRange = "{10182, 58}"; - sepNavVisRange = "{9784, 862}"; - sepNavWindowFrame = "{{643, 56}, {1300, 822}}"; + sepNavIntBoundsRect = "{{0, 0}, {824, 3731}}"; + sepNavSelRange = "{10887, 0}"; + sepNavVisRange = "{9739, 1139}"; + sepNavWindowFrame = "{{526, 20}, {901, 799}}"; }; }; 8BA05A690720730100365D66 /* DitherFloatVersion.h */ = { @@ -80,9 +100,9 @@ 8BC6025B073B072D006C4272 /* DitherFloat.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1253, 1794}}"; - sepNavSelRange = "{3211, 0}"; - sepNavVisRange = "{2595, 1482}"; - sepNavWindowFrame = "{{717, 56}, {1300, 822}}"; + sepNavSelRange = "{5227, 16}"; + sepNavVisRange = "{3668, 1685}"; + sepNavWindowFrame = "{{140, 56}, {1300, 822}}"; }; }; 8BD3CCB8148830B20062E48C /* Source Control */ = { @@ -109,21 +129,7 @@ ); name = /Users/christopherjohnson/Desktop/MacAU/DitherFloat/Info.plist; rLen = 0; - rLoc = 9223372036854775807; - }; - 8BEF85AC21F6801300FEF113 /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = 8BA05A660720730100365D66 /* DitherFloat.cpp */; - }; - 8BEF85AD21F6801300FEF113 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8BA05A660720730100365D66 /* DitherFloat.cpp */; - name = "DitherFloat.cpp: 240"; - rLen = 58; - rLoc = 10182; - rType = 0; - vrLen = 862; - vrLoc = 9784; + rLoc = 9223372036854775808; }; 8D01CCC60486CAD60068D4B7 /* DitherFloat */ = { activeExec = 0; diff --git a/plugins/MacAU/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.perspectivev3 index c05c55f..c26487f 100755 --- a/plugins/MacAU/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.perspectivev3 @@ -256,6 +256,8 @@ <key>Layout</key> <array> <dict> + <key>BecomeActive</key> + <true/> <key>ContentConfiguration</key> <dict> <key>PBXBottomSmartGroupGIDs</key> @@ -300,7 +302,7 @@ <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> <array> <array> - <integer>4</integer> + <integer>3</integer> <integer>2</integer> <integer>1</integer> <integer>0</integer> @@ -324,7 +326,7 @@ <real>288</real> </array> <key>RubberWindowFrame</key> - <string>566 208 841 654 0 0 1440 878 </string> + <string>75 187 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -335,8 +337,6 @@ <key>Dock</key> <array> <dict> - <key>BecomeActive</key> - <true/> <key>ContentConfiguration</key> <dict> <key>PBXProjectModuleGUID</key> @@ -354,11 +354,11 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8BEF85AD21F6801300FEF113</string> + <string>8B6F22E7221C35D70084A947</string> <key>history</key> <array> <string>8BEF85AB21F6801300FEF113</string> - <string>8BEF85AC21F6801300FEF113</string> + <string>8B6F22BF221C34010084A947</string> </array> </dict> <key>SplitCount</key> @@ -372,18 +372,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {531, 413}}</string> + <string>{{0, 0}, {531, 399}}</string> <key>RubberWindowFrame</key> - <string>566 208 841 654 0 0 1440 878 </string> + <string>75 187 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>413pt</string> + <string>399pt</string> </dict> <dict> <key>Proportion</key> - <string>195pt</string> + <string>209pt</string> <key>Tabs</key> <array> <dict> @@ -397,9 +397,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 168}}</string> + <string>{{10, 27}, {531, 182}}</string> <key>RubberWindowFrame</key> - <string>566 208 841 654 0 0 1440 878 </string> + <string>75 187 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -453,7 +453,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 365}}</string> + <string>{{10, 27}, {531, 175}}</string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -481,11 +481,11 @@ </array> <key>TableOfContents</key> <array> - <string>8BEF85AE21F6801300FEF113</string> + <string>8B6F22E8221C35D70084A947</string> <string>1CA23ED40692098700951B8B</string> - <string>8BEF85AF21F6801300FEF113</string> + <string>8B6F22E9221C35D70084A947</string> <string>8BD7274A1D46E5A5000176F0</string> - <string>8BEF85B021F6801300FEF113</string> + <string>8B6F22EA221C35D70084A947</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -658,7 +658,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>569802771.16773605</real> + <real>572274135.023754</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -675,10 +675,11 @@ <integer>5</integer> <key>WindowOrderList</key> <array> + <string>8B6F22EB221C35D70084A947</string> <string>/Users/christopherjohnson/Desktop/MacAU/DitherFloat/DitherFloat.xcodeproj</string> </array> <key>WindowString</key> - <string>566 208 841 654 0 0 1440 878 </string> + <string>75 187 841 654 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |