Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@roxlu
Created May 6, 2016 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roxlu/585d3e4a15044352b1b762a5d91f6a7f to your computer and use it in GitHub Desktop.
Save roxlu/585d3e4a15044352b1b762a5d91f6a7f to your computer and use it in GitHub Desktop.
#if 0
/* takes ~0.038ms */
for (size_t k = 0; k < convert_from.nchannels; ++k) {
std::vector<double>& prepared_data = channel_data[k];
for (size_t i = 0; i < nframes; i++) {
prepared_data[i] = src_ptr[k + (i * convert_from.nchannels)];
}
}
#else
/* takes 0.0025 ms*/
if (2 == resamplers.size()) {
double* prepared_data = &channel_data[0][0];
for (size_t i = 0; i < nframes; ++i) {
prepared_data[i] = src_ptr[i * 2];
}
prepared_data = &channel_data[1][0];
for (size_t i = 0; i < nframes; ++i) {
prepared_data[i] = src_ptr[(i * 2) + 1];
}
}
else {
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment