1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
#if 0
// TODO: make this work again
#include <benchmark/benchmark.h>
#include <gtest/gtest.h>
#include "control/controlpotmeter.h"
#include "effects/builtin/autopaneffect.h"
#include "effects/builtin/bessel4lvmixeqeffect.h"
#include "effects/builtin/bessel8lvmixeqeffect.h"
#include "effects/builtin/bitcrushereffect.h"
#include "effects/builtin/echoeffect.h"
#include "effects/builtin/filtereffect.h"
#include "effects/builtin/flangereffect.h"
#include "effects/builtin/graphiceqeffect.h"
#include "effects/builtin/linkwitzriley8eqeffect.h"
#include "effects/builtin/moogladder4filtereffect.h"
#include "effects/builtin/phasereffect.h"
#include "effects/builtin/reverbeffect.h"
#include "engine/channelhandle.h"
#include "engine/effects/groupfeaturestate.h"
#include "test/baseeffecttest.h"
#include "util/samplebuffer.h"
namespace {
class EffectsBenchmarkTest : public BaseEffectTest {
protected:
void SetUp() override {
registerTestBackend();
}
};
template <class EffectType>
void benchmarkBuiltInEffectDefaultParameters(const mixxx::EngineParameters& bufferParameters,
benchmark::State* pState, EffectsManager* pEffectsManager) {
EffectManifestPointer pManifest = EffectType::getManifest();
ChannelHandleFactory factory;
QSet<ChannelHandleAndGroup> activeInputChannels;
QString channel1_group = QString("[Channel1]");
ChannelHandle channel1 = factory.getOrCreateHandle(channel1_group);
ChannelHandleAndGroup handle_and_group(channel1, channel1_group);
pEffectsManager->registerInputChannel(handle_and_group);
pEffectsManager->registerOutputChannel(handle_and_group);
activeInputChannels.insert(handle_and_group);
EffectInstantiatorPointer pInstantiator = EffectInstantiatorPointer(
new EffectProcessorInstantiator<EffectType>());
EngineEffect effect(pManifest, activeInputChannels, pEffectsManager, pInstantiator);
GroupFeatureState featureState;
EffectEnableState enableState = EffectEnableState::Enabled;
mixxx::SampleBuffer input(bufferParameters.samplesPerBuffer());
mixxx::SampleBuffer output(bufferParameters.samplesPerBuffer());
while (pState->KeepRunning()) {
effect.process(channel1, channel1, input.data(), output.data(),
bufferParameters.samplesPerBuffer(),
bufferParameters.sampleRate(),
enableState, featureState);
}
}
#define FOR_COMMON_BUFFER_SIZES(bm) bm->Arg(32)->Arg(64)->Arg(128)->Arg(256)->Arg(512)->Arg(1024)->Arg(2048)->Arg(4096);
#define DECLARE_EFFECT_BENCHMARK(EffectName) \
TEST_F(EffectsBenchmarkTest, BM_BuiltInEffects_DefaultParameters_##EffectName) { \
ControlPotmeter loEqFrequency( \
ConfigKey("[Mixer Profile]", "LoEQFrequency"), 0., 22040); \
loEqFrequency.setDefaultValue(250.0); \
ControlPotmeter hiEqFrequency( \
ConfigKey("[Mixer Profile]", "HiEQFrequency"), 0., 22040); \
hiEqFrequency.setDefaultValue(2500.0); \
mixxx::EngineParameters bufferParameters( \
mixxx::AudioSignal::SampleRate(44100), \
state.range_x()); \
benchmarkBuiltInEffectDefaultParameters<EffectName>( \
bufferParameters, &state, m_pEffectsManager); \
} \
FOR_COMMON_BUFFER_SIZES(BENCHMARK(BM_BuiltInEffects_DefaultParameters_##EffectName));
DECLARE_EFFECT_BENCHMARK(Bessel4LVMixEQEffect)
DECLARE_EFFECT_BENCHMARK(Bessel8LVMixEQEffect)
DECLARE_EFFECT_BENCHMARK(BitCrusherEffect)
DECLARE_EFFECT_BENCHMARK(EchoEffect)
DECLARE_EFFECT_BENCHMARK(FilterEffect)
DECLARE_EFFECT_BENCHMARK(FlangerEffect)
DECLARE_EFFECT_BENCHMARK(GraphicEQEffect)
DECLARE_EFFECT_BENCHMARK(LinkwitzRiley8EQEffect)
DECLARE_EFFECT_BENCHMARK(MoogLadder4FilterEffect)
DECLARE_EFFECT_BENCHMARK(PhaserEffect)
DECLARE_EFFECT_BENCHMARK(ReverbEffect)
} // namespace
#endif
|