Possibly improve MAD sample conversion speed

No idea if this brings a noticeable improvement, but it probably makes
better sense to only do the division step one time instead of doing it
twice interleaved when processing stereo files, which are the most
common scenario anyway.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
CQTexperiment
Christopher Snowhill 2022-02-26 01:08:55 -08:00
parent 51e9648865
commit 2c0f04bbeb
1 changed files with 2 additions and 2 deletions

View File

@ -469,11 +469,11 @@
int ch;
// samples [0 ... n]
float scale = (float)MAD_F_ONE;
for(ch = 0; ch < channels; ch++) {
vDSP_vflt32(&_synth.pcm.samples[ch][startingSample], 1, &_outputBuffer[ch], channels, _outputFrames);
vDSP_vsdiv(&_outputBuffer[ch], channels, &scale, &_outputBuffer[ch], channels, _outputFrames);
}
float scale = (float)MAD_F_ONE;
vDSP_vsdiv(&_outputBuffer[0], 1, &scale, &_outputBuffer[0], 1, _outputFrames * channels);
// Output to a file
// FILE *f = fopen("data.raw", "a");