From a064ce0c94e61628e4f47273577c7f72ed9f87fe Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Thu, 14 Oct 2021 00:49:08 -0700 Subject: [PATCH] mathnodebase: use func ptr instead of switch inside loop --- app/node/math/math/mathbase.cpp | 74 ++++++++++++++++++++------------- app/node/math/math/mathbase.h | 1 + 2 files changed, 45 insertions(+), 30 deletions(-) diff --git a/app/node/math/math/mathbase.cpp b/app/node/math/math/mathbase.cpp index 4723a9db9..420ad4ac9 100644 --- a/app/node/math/math/mathbase.cpp +++ b/app/node/math/math/mathbase.cpp @@ -167,42 +167,58 @@ void MathNodeBase::PushVector(NodeValueTable *output, olive::NodeValue::Type typ } } +void MathNodeBase::PerformAllOnFloatBuffer(Operation operation, float *a, float b, int start, int end) +{ + for (int j=start;jdata(i), number, 0, job.samples()->sample_count()); #else - for (int j=0;jsample_count();j++) { - job.samples()->data(i)[j] = PerformAll(operation, job.samples()->data(i)[j], number); - } + PerformAllOnFloatBuffer(operation, job.samples()->data(i), number, 0, job.samples()->sample_count()); #endif } } diff --git a/app/node/math/math/mathbase.h b/app/node/math/math/mathbase.h index 2a8c291a0..940bbee21 100644 --- a/app/node/math/math/mathbase.h +++ b/app/node/math/math/mathbase.h @@ -102,6 +102,7 @@ protected: static T PerformAddSubMultDiv(Operation operation, T a, U b); #ifdef Q_PROCESSOR_X86 + static void PerformAllOnFloatBuffer(Operation operation, float *a, float b, int start, int end); static void PerformAllOnFloatBufferSSE(Operation operation, float *a, float b, int start, int end); #endif