Skip to content

Instantly share code, notes, and snippets.

@bnjbvr
Forked from padenot/gist:64d001ee1e396794331c
Last active August 29, 2015 14:13
Show Gist options
  • Save bnjbvr/e268b2eba1f6dc32b4ec to your computer and use it in GitHub Desktop.
Save bnjbvr/e268b2eba1f6dc32b4ec to your computer and use it in GitHub Desktop.
SIMD example for padenot
if (window.SIMD) {
// yay, SIMD available, let's do a little stereo mixdown routine
for (var i = 0; i < bufsize; i+=4) {
var lhs = SIMD.float32x4(left[i+0], left[i+1],
left[i+2], left[i+3]),
rhs = SIMD.float32x4(right[i+0], right[i+1],
right[i+2], right[i+3]);
var mixdown = SIMD.float32x4.add(lhs, rhs);
SIMD.float32x4.store(center, i, mixdown);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment