Fix the alignment problem
This commit is contained in:
parent
f32f14dfa2
commit
bcb0c91599
4 changed files with 14 additions and 18 deletions
|
|
@ -5,7 +5,6 @@
|
|||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
||||
|
||||
#include "ResonantArrayAVX.h"
|
||||
#include "ResonantStringAVX.h"
|
||||
#include "Config.h"
|
||||
#include <cstring>
|
||||
|
||||
|
|
@ -30,9 +29,9 @@ void ResonantArrayAVX::setup(
|
|||
const float feedbacks[], const float gains[])
|
||||
{
|
||||
const unsigned numStringPacks = (numStrings + avxVectorSize - 1) / avxVectorSize;
|
||||
ResonantStringAVX* stringPacks = new ResonantStringAVX[numStringPacks];
|
||||
_stringPacks.resize(numStringPacks);
|
||||
ResonantStringAVX* stringPacks = _stringPacks.data();
|
||||
|
||||
_stringPacks.reset(stringPacks);
|
||||
_numStrings = numStrings;
|
||||
|
||||
for (unsigned p = 0; p < numStringPacks; ++p) {
|
||||
|
|
@ -65,18 +64,18 @@ void ResonantArrayAVX::setSamplesPerBlock(unsigned samplesPerBlock)
|
|||
|
||||
void ResonantArrayAVX::clear()
|
||||
{
|
||||
ResonantStringAVX* stringPacks = _stringPacks.get();
|
||||
ResonantStringAVX* stringPacks = _stringPacks.data();
|
||||
const unsigned numStringPacks = (_numStrings + avxVectorSize - 1) / avxVectorSize;
|
||||
|
||||
for (unsigned p = 0; p < numStringPacks; ++p) {
|
||||
ResonantStringAVX& rs = stringPacks[p];
|
||||
ResonantStringAVX& rs = reinterpret_cast<ResonantStringAVX&>(stringPacks[p]);
|
||||
rs.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void ResonantArrayAVX::process(const float *inPtr, float *outPtr, unsigned numFrames)
|
||||
{
|
||||
ResonantStringAVX* stringPacks = _stringPacks.get();
|
||||
ResonantStringAVX* stringPacks = _stringPacks.data();
|
||||
const unsigned numStringPacks = (_numStrings + avxVectorSize - 1) / avxVectorSize;
|
||||
|
||||
// receive 8 resonator outputs per pack
|
||||
|
|
@ -84,7 +83,7 @@ void ResonantArrayAVX::process(const float *inPtr, float *outPtr, unsigned numFr
|
|||
std::memset(outputs8, 0, numFrames * sizeof(__m256));
|
||||
|
||||
for (unsigned p = 0; p < numStringPacks; ++p) {
|
||||
ResonantStringAVX& rs = stringPacks[p];
|
||||
ResonantStringAVX& rs = reinterpret_cast<ResonantStringAVX&>(stringPacks[p]);
|
||||
for (unsigned i = 0; i < numFrames; ++i)
|
||||
outputs8[i] = _mm256_add_ps(
|
||||
outputs8[i], rs.process(_mm256_broadcast_ss(&inPtr[i])));
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
#include "ResonantArray.h"
|
||||
#include "ResonantStringAVX.h"
|
||||
#include "Buffer.h"
|
||||
#include "SIMDConfig.h"
|
||||
|
||||
|
|
@ -13,8 +14,6 @@
|
|||
namespace sfz {
|
||||
namespace fx {
|
||||
|
||||
class ResonantStringAVX;
|
||||
|
||||
class ResonantArrayAVX final : public ResonantArray {
|
||||
public:
|
||||
ResonantArrayAVX();
|
||||
|
|
@ -32,7 +31,7 @@ public:
|
|||
void process(const float *inPtr, float *outPtr, unsigned numFrames) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<ResonantStringAVX[]> _stringPacks;
|
||||
Buffer<ResonantStringAVX, 32> _stringPacks;
|
||||
unsigned _numStrings = 0;
|
||||
Buffer<float, 32> _workBuffer;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
||||
|
||||
#include "ResonantArraySSE.h"
|
||||
#include "ResonantStringSSE.h"
|
||||
#include "Config.h"
|
||||
#include <cstring>
|
||||
|
||||
|
|
@ -30,9 +29,9 @@ void ResonantArraySSE::setup(
|
|||
const float feedbacks[], const float gains[])
|
||||
{
|
||||
const unsigned numStringPacks = (numStrings + sseVectorSize - 1) / sseVectorSize;
|
||||
ResonantStringSSE* stringPacks = new ResonantStringSSE[numStringPacks];
|
||||
_stringPacks.resize(numStringPacks);
|
||||
ResonantStringSSE* stringPacks = _stringPacks.data();
|
||||
|
||||
_stringPacks.reset(stringPacks);
|
||||
_numStrings = numStrings;
|
||||
|
||||
for (unsigned p = 0; p < numStringPacks; ++p) {
|
||||
|
|
@ -65,7 +64,7 @@ void ResonantArraySSE::setSamplesPerBlock(unsigned samplesPerBlock)
|
|||
|
||||
void ResonantArraySSE::clear()
|
||||
{
|
||||
ResonantStringSSE* stringPacks = _stringPacks.get();
|
||||
ResonantStringSSE* stringPacks = _stringPacks.data();
|
||||
const unsigned numStringPacks = (_numStrings + sseVectorSize - 1) / sseVectorSize;
|
||||
|
||||
for (unsigned p = 0; p < numStringPacks; ++p) {
|
||||
|
|
@ -76,7 +75,7 @@ void ResonantArraySSE::clear()
|
|||
|
||||
void ResonantArraySSE::process(const float *inPtr, float *outPtr, unsigned numFrames)
|
||||
{
|
||||
ResonantStringSSE* stringPacks = _stringPacks.get();
|
||||
ResonantStringSSE* stringPacks = _stringPacks.data();
|
||||
const unsigned numStringPacks = (_numStrings + sseVectorSize - 1) / sseVectorSize;
|
||||
|
||||
// receive 4 resonator outputs per pack
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
#include "ResonantArray.h"
|
||||
#include "ResonantStringSSE.h"
|
||||
#include "Buffer.h"
|
||||
#include "SIMDConfig.h"
|
||||
|
||||
|
|
@ -13,8 +14,6 @@
|
|||
namespace sfz {
|
||||
namespace fx {
|
||||
|
||||
class ResonantStringSSE;
|
||||
|
||||
class ResonantArraySSE final : public ResonantArray {
|
||||
public:
|
||||
ResonantArraySSE();
|
||||
|
|
@ -32,7 +31,7 @@ public:
|
|||
void process(const float *inPtr, float *outPtr, unsigned numFrames) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<ResonantStringSSE[]> _stringPacks;
|
||||
Buffer<ResonantStringSSE, 16> _stringPacks;
|
||||
unsigned _numStrings = 0;
|
||||
Buffer<float, 16> _workBuffer;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue