summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBe <be@mixxx.org>2021-09-30 18:27:26 -0500
committerGitHub <noreply@github.com>2021-09-30 18:27:26 -0500
commit12a772069e59974821609582c9f9a8ae583550d5 (patch)
tree867f5b0aad64f3031fea909564efeb2c4b0c01b9
parenta0b3f73531738d69d7d269303d80bb83df761d05 (diff)
parent7ad1bb3e365876fd37a77f54a5451dbc909bfef1 (diff)
Merge pull request #4343 from daschuer/lv2vectorize
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];
}
}