audio: Revert one of the resampler optimizations. This is the one that splits the "left wing" into two for loops to bubble out the conditional that decides if it should read from the left padding or the input buffer. I still believe the optimization is good, but the basic logic of it was incorrect, and needs to be reexamined and fixed before going back into revision control.
diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c
index 6ecc2c9..0b95b41 100644
--- a/src/audio/SDL_audiocvt.c
+++ b/src/audio/SDL_audiocvt.c
@@ -757,21 +757,11 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate,
float outsample = 0.0f;
/* do this twice to calculate the sample, once for the "left wing" and then same for the right. */
-
- /* Left wing! split the "srcframe < 0" condition out into a preloop. */
- for (j = 0; srcindex < j; j++) {
- const int jsamples = j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING;
- const int srcframe = srcindex - j;
- const float insample = lpadding[((paddinglen + srcframe) * chans) + chan];
- outsample += (float)(insample * (ResamplerFilter[filterindex1 + jsamples] + (interpolation1 * ResamplerFilterDifference[filterindex1 + jsamples])));
- }
-
- /* Finish the left wing now that srcframe >= 0 */
- for (; (filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) < RESAMPLER_FILTER_SIZE; j++) {
- const int jsamples = j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING;
+ for (j = 0; (filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) < RESAMPLER_FILTER_SIZE; j++) {
const int srcframe = srcindex - j;
- const float insample = inbuf[(srcframe * chans) + chan];
- outsample += (float)(insample * (ResamplerFilter[filterindex1 + jsamples] + (interpolation1 * ResamplerFilterDifference[filterindex1 + jsamples])));
+ /* !!! FIXME: we can bubble this conditional out of here by doing a pre loop. */
+ const float insample = (srcframe < 0) ? lpadding[((paddinglen + srcframe) * chans) + chan] : inbuf[(srcframe * chans) + chan];
+ outsample += (float)(insample * (ResamplerFilter[filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)] + (interpolation1 * ResamplerFilterDifference[filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)])));
}
/* Do the right wing! */