Skip to content

Commit

Permalink
Fix performance drop caused by subnormal numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
ryukau committed May 6, 2023
1 parent 9ddefee commit 54f2fd9
Show file tree
Hide file tree
Showing 79 changed files with 367 additions and 208 deletions.
4 changes: 4 additions & 0 deletions AccumulativeRingMod/source/dsp/dspcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// You should have received a copy of the GNU General Public License
// along with AccumulativeRingMod. If not, see <https://www.gnu.org/licenses/>.

#include "../../../lib/juce_ScopedNoDenormal.hpp"

#include "dspcore.hpp"

#include <algorithm>
Expand Down Expand Up @@ -266,6 +268,8 @@ void DSPCore::process(
float *out0,
float *out1)
{
ScopedNoDenormals scopedDenormals;

using ID = ParameterID::ID;
const auto &pv = param.value;

Expand Down
8 changes: 4 additions & 4 deletions AccumulativeRingMod/source/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
#define SUB_VERSION_STR "1"
#define SUB_VERSION_INT 1

#define RELEASE_NUMBER_STR "0"
#define RELEASE_NUMBER_INT 0
#define RELEASE_NUMBER_STR "1"
#define RELEASE_NUMBER_INT 1

#define BUILD_NUMBER_STR "5"
#define BUILD_NUMBER_INT 5
#define BUILD_NUMBER_STR "6"
#define BUILD_NUMBER_INT 6

#define FULL_VERSION_STR \
MAJOR_VERSION_STR "." SUB_VERSION_STR "." RELEASE_NUMBER_STR "." BUILD_NUMBER_STR
Expand Down
4 changes: 4 additions & 0 deletions BasicLimiter/source/dsp/dspcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// You should have received a copy of the GNU General Public License
// along with BasicLimiter. If not, see <https://www.gnu.org/licenses/>.

#include "../../../lib/juce_ScopedNoDenormal.hpp"

#include "dspcore.hpp"

#include <algorithm>
Expand Down Expand Up @@ -102,6 +104,8 @@ std::array<float, 2> DSPCore::processStereoLink(float in0, float in1)
void DSPCore::process(
const size_t length, const float *in0, const float *in1, float *out0, float *out1)
{
ScopedNoDenormals scopedDenormals;

SmootherCommon<float>::setBufferSize(float(length));

if (param.value[ParameterID::truePeak]->getInt()) {
Expand Down
8 changes: 4 additions & 4 deletions BasicLimiter/source/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
#define SUB_VERSION_STR "1"
#define SUB_VERSION_INT 1

#define RELEASE_NUMBER_STR "17"
#define RELEASE_NUMBER_INT 17
#define RELEASE_NUMBER_STR "18"
#define RELEASE_NUMBER_INT 18

#define BUILD_NUMBER_STR "18"
#define BUILD_NUMBER_INT 18
#define BUILD_NUMBER_STR "19"
#define BUILD_NUMBER_INT 19

#define FULL_VERSION_STR \
MAJOR_VERSION_STR "." SUB_VERSION_STR "." RELEASE_NUMBER_STR "." BUILD_NUMBER_STR
Expand Down
4 changes: 4 additions & 0 deletions BasicLimiterAutoMake/source/dsp/dspcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// You should have received a copy of the GNU General Public License
// along with BasicLimiterAutoMake. If not, see <https://www.gnu.org/licenses/>.

#include "../../../lib/juce_ScopedNoDenormal.hpp"

#include "dspcore.hpp"

#include <algorithm>
Expand Down Expand Up @@ -139,6 +141,8 @@ void DSPCore::process(
float *out0,
float *out1)
{
ScopedNoDenormals scopedDenormals;

using ID = ParameterID::ID;
const auto &pv = param.value;

Expand Down
8 changes: 4 additions & 4 deletions BasicLimiterAutoMake/source/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
#define SUB_VERSION_STR "1"
#define SUB_VERSION_INT 1

#define RELEASE_NUMBER_STR "17"
#define RELEASE_NUMBER_INT 17
#define RELEASE_NUMBER_STR "18"
#define RELEASE_NUMBER_INT 18

#define BUILD_NUMBER_STR "19"
#define BUILD_NUMBER_INT 19
#define BUILD_NUMBER_STR "20"
#define BUILD_NUMBER_INT 20

#define FULL_VERSION_STR \
MAJOR_VERSION_STR "." SUB_VERSION_STR "." RELEASE_NUMBER_STR "." BUILD_NUMBER_STR
Expand Down
76 changes: 38 additions & 38 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,45 @@ cmake_minimum_required(VERSION 3.20)

add_subdirectory(common)

# add_subdirectory(AccumulativeRingMod)
# add_subdirectory(BasicLimiter)
# add_subdirectory(BasicLimiterAutoMake)
# add_subdirectory(ClangCymbal)
# add_subdirectory(ClangSynth)
# add_subdirectory(CollidingCombSynth)
# add_subdirectory(CombDistortion)
# add_subdirectory(CubicPadSynth)
# add_subdirectory(EnvelopedSine)
# add_subdirectory(EsPhaser)
# add_subdirectory(FDN64Reverb)
# add_subdirectory(FDNCymbal)
# add_subdirectory(FeedbackPhaser)
# add_subdirectory(FoldShaper)
# add_subdirectory(IterativeSinCluster)
# add_subdirectory(L3Reverb)
# add_subdirectory(L4Reverb)
# add_subdirectory(LatticeReverb)
# add_subdirectory(LightPadSynth)
# add_subdirectory(LongPhaser)
# add_subdirectory(MatrixShifter)
# add_subdirectory(MaybeSnare)
# add_subdirectory(MembraneSynth)
# add_subdirectory(MiniCliffEQ)
# add_subdirectory(ModuloShaper)
# add_subdirectory(NarrowingDelay)
# add_subdirectory(OddPowShaper)
# add_subdirectory(OrdinaryPhaser)
# add_subdirectory(ParallelComb)
# add_subdirectory(ParallelDetune)
# add_subdirectory(PitchShiftDelay)
# add_subdirectory(RingModSpacer)
# add_subdirectory(SevenDelay)
# add_subdirectory(SoftClipper)
# add_subdirectory(SyncSawSynth)
# add_subdirectory(TrapezoidSynth)
# add_subdirectory(UltraSynth)
add_subdirectory(AccumulativeRingMod)
add_subdirectory(BasicLimiter)
add_subdirectory(BasicLimiterAutoMake)
add_subdirectory(ClangCymbal)
add_subdirectory(ClangSynth)
add_subdirectory(CollidingCombSynth)
add_subdirectory(CombDistortion)
add_subdirectory(CubicPadSynth)
add_subdirectory(EnvelopedSine)
add_subdirectory(EsPhaser)
add_subdirectory(FDN64Reverb)
add_subdirectory(FDNCymbal)
add_subdirectory(FeedbackPhaser)
add_subdirectory(FoldShaper)
add_subdirectory(IterativeSinCluster)
add_subdirectory(L3Reverb)
add_subdirectory(L4Reverb)
add_subdirectory(LatticeReverb)
add_subdirectory(LightPadSynth)
add_subdirectory(LongPhaser)
add_subdirectory(MatrixShifter)
add_subdirectory(MaybeSnare)
add_subdirectory(MembraneSynth)
add_subdirectory(MiniCliffEQ)
add_subdirectory(ModuloShaper)
add_subdirectory(NarrowingDelay)
add_subdirectory(OddPowShaper)
add_subdirectory(OrdinaryPhaser)
add_subdirectory(ParallelComb)
add_subdirectory(ParallelDetune)
add_subdirectory(PitchShiftDelay)
add_subdirectory(RingModSpacer)
add_subdirectory(SevenDelay)
add_subdirectory(SoftClipper)
add_subdirectory(SyncSawSynth)
add_subdirectory(TrapezoidSynth)
add_subdirectory(UltraSynth)
add_subdirectory(UltrasonicRingMod)
# add_subdirectory(WaveCymbal)
add_subdirectory(WaveCymbal)

## TestBedSynth is a prototype. Breaking changes will be introduced.
# add_subdirectory(TestBedSynth)
4 changes: 4 additions & 0 deletions ClangCymbal/source/dsp/dspcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// You should have received a copy of the GNU General Public License
// along with ClangCymbal. If not, see <https://www.gnu.org/licenses/>.

#include "../../../lib/juce_ScopedNoDenormal.hpp"

#include "dspcore.hpp"

#include <algorithm>
Expand Down Expand Up @@ -396,6 +398,8 @@ float Note::process(float sampleRate)

void DSPCore::process(const size_t length, float *out0, float *out1)
{
ScopedNoDenormals scopedDenormals;

using ID = ParameterID::ID;
const auto &pv = param.value;

Expand Down
8 changes: 4 additions & 4 deletions ClangCymbal/source/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
#define SUB_VERSION_STR "1"
#define SUB_VERSION_INT 1

#define RELEASE_NUMBER_STR "6"
#define RELEASE_NUMBER_INT 6
#define RELEASE_NUMBER_STR "7"
#define RELEASE_NUMBER_INT 7

#define BUILD_NUMBER_STR "9"
#define BUILD_NUMBER_INT 9
#define BUILD_NUMBER_STR "10"
#define BUILD_NUMBER_INT 10

#define FULL_VERSION_STR \
MAJOR_VERSION_STR "." SUB_VERSION_STR "." RELEASE_NUMBER_STR "." BUILD_NUMBER_STR
Expand Down
4 changes: 4 additions & 0 deletions ClangSynth/source/dsp/dspcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// You should have received a copy of the GNU General Public License
// along with ClangSynth. If not, see <https://www.gnu.org/licenses/>.

#include "../../../lib/juce_ScopedNoDenormal.hpp"

#include "dspcore.hpp"

#include <algorithm>
Expand Down Expand Up @@ -302,6 +304,8 @@ std::array<float, 2> Note::process(float sampleRate, NoteProcessInfo &info)

void DSPCore::process(const size_t length, float *out0, float *out1)
{
ScopedNoDenormals scopedDenormals;

using ID = ParameterID::ID;
const auto &pv = param.value;

Expand Down
8 changes: 4 additions & 4 deletions ClangSynth/source/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
#define SUB_VERSION_STR "1"
#define SUB_VERSION_INT 1

#define RELEASE_NUMBER_STR "6"
#define RELEASE_NUMBER_INT 6
#define RELEASE_NUMBER_STR "7"
#define RELEASE_NUMBER_INT 7

#define BUILD_NUMBER_STR "7"
#define BUILD_NUMBER_INT 7
#define BUILD_NUMBER_STR "8"
#define BUILD_NUMBER_INT 8

#define FULL_VERSION_STR \
MAJOR_VERSION_STR "." SUB_VERSION_STR "." RELEASE_NUMBER_STR "." BUILD_NUMBER_STR
Expand Down
4 changes: 4 additions & 0 deletions CollidingCombSynth/source/dsp/dspcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// You should have received a copy of the GNU General Public License
// along with CollidingCombSynth. If not, see <https://www.gnu.org/licenses/>.

#include "../../../lib/juce_ScopedNoDenormal.hpp"

#include "dspcore.hpp"

#include <algorithm>
Expand Down Expand Up @@ -247,6 +249,8 @@ void DSPCore::setParameters(float /* tempo */)

void DSPCore::process(const size_t length, float *out0, float *out1)
{
ScopedNoDenormals scopedDenormals;

SmootherCommon<float>::setBufferSize(float(length));

std::array<float, 2> frame{};
Expand Down
8 changes: 4 additions & 4 deletions CollidingCombSynth/source/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
#define SUB_VERSION_STR "1"
#define SUB_VERSION_INT 1

#define RELEASE_NUMBER_STR "13"
#define RELEASE_NUMBER_INT 13
#define RELEASE_NUMBER_STR "14"
#define RELEASE_NUMBER_INT 14

#define BUILD_NUMBER_STR "13"
#define BUILD_NUMBER_INT 13
#define BUILD_NUMBER_STR "14"
#define BUILD_NUMBER_INT 14

#define FULL_VERSION_STR \
MAJOR_VERSION_STR "." SUB_VERSION_STR "." RELEASE_NUMBER_STR "." BUILD_NUMBER_STR
Expand Down
4 changes: 4 additions & 0 deletions CombDistortion/source/dsp/dspcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// You should have received a copy of the GNU General Public License
// along with CombDistortion. If not, see <https://www.gnu.org/licenses/>.

#include "../../../lib/juce_ScopedNoDenormal.hpp"

#include "dspcore.hpp"

#include <algorithm>
Expand Down Expand Up @@ -166,6 +168,8 @@ std::array<double, 2> DSPCore::processFrame(const std::array<double, 2> &frame)
void DSPCore::process(
const size_t length, const float *in0, const float *in1, float *out0, float *out1)
{
ScopedNoDenormals scopedDenormals;

using ID = ParameterID::ID;
const auto &pv = param.value;

Expand Down
8 changes: 4 additions & 4 deletions CombDistortion/source/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
#define SUB_VERSION_STR "1"
#define SUB_VERSION_INT 1

#define RELEASE_NUMBER_STR "2"
#define RELEASE_NUMBER_INT 2
#define RELEASE_NUMBER_STR "3"
#define RELEASE_NUMBER_INT 3

#define BUILD_NUMBER_STR "2"
#define BUILD_NUMBER_INT 2
#define BUILD_NUMBER_STR "3"
#define BUILD_NUMBER_INT 3

#define FULL_VERSION_STR \
MAJOR_VERSION_STR "." SUB_VERSION_STR "." RELEASE_NUMBER_STR "." BUILD_NUMBER_STR
Expand Down
4 changes: 4 additions & 0 deletions CubicPadSynth/source/dsp/dspcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// You should have received a copy of the GNU General Public License
// along with CubicPadSynth. If not, see <https://www.gnu.org/licenses/>.

#include "../../../lib/juce_ScopedNoDenormal.hpp"

#include "dspcore.hpp"

#include "../../../lib/juce_FastMathApproximations.h"
Expand Down Expand Up @@ -319,6 +321,8 @@ std::array<float, 2> PROCESSING_UNIT_NAME::process(

void DSPCORE_NAME::process(const size_t length, float *out0, float *out1)
{
ScopedNoDenormals scopedDenormals;

if (wavetable.isRefreshing) {
for (int i = 0; i < length; ++i) {
processMidiNote(i);
Expand Down
8 changes: 4 additions & 4 deletions CubicPadSynth/source/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
#define SUB_VERSION_STR "1"
#define SUB_VERSION_INT 1

#define RELEASE_NUMBER_STR "23"
#define RELEASE_NUMBER_INT 23
#define RELEASE_NUMBER_STR "24"
#define RELEASE_NUMBER_INT 24

#define BUILD_NUMBER_STR "23"
#define BUILD_NUMBER_INT 23
#define BUILD_NUMBER_STR "24"
#define BUILD_NUMBER_INT 24

#define FULL_VERSION_STR \
MAJOR_VERSION_STR "." SUB_VERSION_STR "." RELEASE_NUMBER_STR "." BUILD_NUMBER_STR
Expand Down
4 changes: 4 additions & 0 deletions EnvelopedSine/source/dsp/dspcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// You should have received a copy of the GNU General Public License
// along with EnvelopedSine. If not, see <https://www.gnu.org/licenses/>.

#include "../../../lib/juce_ScopedNoDenormal.hpp"

#include "dspcore.hpp"

#include "../../../lib/vcl/vectormath_exp.h"
Expand Down Expand Up @@ -281,6 +283,8 @@ void DSPCORE_NAME::setParameters()

void DSPCORE_NAME::process(const size_t length, float *out0, float *out1)
{
ScopedNoDenormals scopedDenormals;

SmootherCommon<float>::setBufferSize(float(length));

std::array<float, 2> frame{};
Expand Down
8 changes: 4 additions & 4 deletions EnvelopedSine/source/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
#define SUB_VERSION_STR "1"
#define SUB_VERSION_INT 1

#define RELEASE_NUMBER_STR "22"
#define RELEASE_NUMBER_INT 22
#define RELEASE_NUMBER_STR "23"
#define RELEASE_NUMBER_INT 23

#define BUILD_NUMBER_STR "22"
#define BUILD_NUMBER_INT 22
#define BUILD_NUMBER_STR "23"
#define BUILD_NUMBER_INT 23

#define FULL_VERSION_STR \
MAJOR_VERSION_STR "." SUB_VERSION_STR "." RELEASE_NUMBER_STR "." BUILD_NUMBER_STR
Expand Down
Loading

0 comments on commit 54f2fd9

Please sign in to comment.