summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2021-10-01 00:23:05 +0200
committerDaniel Schürmann <daschuer@mixxx.org>2021-10-01 00:23:05 +0200
commit7ad1bb3e365876fd37a77f54a5451dbc909bfef1 (patch)
tree4cb00133437131150323b0d136390790961c50e5
parente4d2e5a8a4034afc3a0ab3dd683bf3342fea3e55 (diff)
Vectorize two loops in the LV2 process function
-rw-r--r--src/effects/lv2/lv2effectprocessor.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/effects/lv2/lv2effectprocessor.cpp b/src/effects/lv2/lv2effectprocessor.cpp
index d455c4a4f6..5ac3632a2c 100644
--- a/src/effects/lv2/lv2effectprocessor.cpp
+++ b/src/effects/lv2/lv2effectprocessor.cpp
@@ -120,20 +120,19 @@ void LV2EffectProcessor::process(const ChannelHandle& inputHandle,
m_params[i] = static_cast<float>(m_parameters[i]->value());
}
- int j = 0;
- for (SINT i = 0; i < bufferParameters.samplesPerBuffer(); i += 2) {
- m_inputL[j] = pInput[i];
- m_inputR[j] = pInput[i + 1];
- j++;
+ SINT framesPerBuffer = bufferParameters.framesPerBuffer();
+ // note: LOOP VECTORIZED.
+ for (SINT i = 0; i < framesPerBuffer; ++i) {
+ m_inputL[i] = pInput[i * 2];
+ m_inputR[i] = pInput[i * 2 + 1];
}
- lilv_instance_run(pState->lilvIinstance(), bufferParameters.framesPerBuffer());
+ lilv_instance_run(pState->lilvIinstance(), framesPerBuffer);
- j = 0;
- for (SINT i = 0; i < bufferParameters.samplesPerBuffer(); i += 2) {
- pOutput[i] = m_outputL[j];
- pOutput[i + 1] = m_outputR[j];
- j++;
+ // note: LOOP VECTORIZED.
+ for (SINT i = 0; i < framesPerBuffer; ++i) {
+ pOutput[i * 2] = m_outputL[i];
+ pOutput[i * 2 + 1] = m_outputR[i];
}
}