Use a SIMD helper for copying

This commit is contained in:
Paul Fd 2020-02-03 01:14:36 +01:00
parent a05717d100
commit fa6bae879c

View file

@ -9,6 +9,7 @@
#include "SfzFilterImpls.cxx" #include "SfzFilterImpls.cxx"
#include <cstring> #include <cstring>
#include <cassert> #include <cassert>
#include "SIMDHelpers.h"
namespace sfz { namespace sfz {
@ -128,12 +129,8 @@ template <unsigned NCh>
void Filter<NCh>::process(const float *const in[NCh], float *const out[NCh], float cutoff, float q, float pksh, unsigned nframes) void Filter<NCh>::process(const float *const in[NCh], float *const out[NCh], float cutoff, float q, float pksh, unsigned nframes)
{ {
if (P->fType == kFilterNone) { if (P->fType == kFilterNone) {
for (unsigned c = 0; c < NCh; ++c) { for (unsigned c = 0; c < NCh; ++c)
const float *ch_in = in[c]; copy<float>({ in[c], nframes }, { out[c], nframes });
float *ch_out = out[c];
if (ch_in != ch_out)
std::memcpy(ch_out, ch_in, nframes * sizeof(float));
}
return; return;
} }
@ -198,12 +195,8 @@ template <unsigned NCh>
void Filter<NCh>::processModulated(const float *const in[NCh], float *const out[NCh], const float *cutoff, const float *q, const float *pksh, unsigned nframes) void Filter<NCh>::processModulated(const float *const in[NCh], float *const out[NCh], const float *cutoff, const float *q, const float *pksh, unsigned nframes)
{ {
if (P->fType == kFilterNone) { if (P->fType == kFilterNone) {
for (unsigned c = 0; c < NCh; ++c) { for (unsigned c = 0; c < NCh; ++c)
const float *ch_in = in[c]; copy<float>({ in[c], nframes }, { out[c], nframes });
float *ch_out = out[c];
if (ch_in != ch_out)
std::memcpy(ch_out, ch_in, nframes * sizeof(float));
}
return; return;
} }