Skip to content
This repository was archived by the owner on Feb 8, 2025. It is now read-only.

Commit

Permalink
Parallelizing SampleAndHold processor.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtytel committed Jun 24, 2016
1 parent 4ad7bd4 commit 7ef0d72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,14 @@ namespace mopo {
}

void SampleAndHoldBuffer::process() {
if (input()->source->buffer[0] == output()->buffer[0])
mopo_float value = input()->source->buffer[0];
mopo_float* dest = output()->buffer;
if (value == dest[0])
return;

#pragma clang loop vectorize(enable) interleave(enable)
for (int i = 0; i < buffer_size_; ++i)
tick(i);
bufferTick(dest, value, i);
processTriggers();
}

Expand Down
6 changes: 3 additions & 3 deletions src/operators.h
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,11 @@ namespace mopo {
void process() override;

inline void tick(int i) override {
bufferTick(output()->buffer, input()->source->buffer, i);
bufferTick(output()->buffer, input()->source->buffer[0], i);
}

inline void bufferTick(mopo_float* dest, const mopo_float* source, int i) {
dest[i] = source[0];
inline void bufferTick(mopo_float* dest, mopo_float value, int i) {
dest[i] = value;
}
};

Expand Down

0 comments on commit 7ef0d72

Please sign in to comment.