src/audio/SDL_audiotypecvt.c
changeset 3021 f3dcf04412cf
parent 2956 1210d5a28e16
child 3032 77c3e67f0740
     1.1 --- a/src/audio/SDL_audiotypecvt.c	Sun Jan 11 04:46:14 2009 +0000
     1.2 +++ b/src/audio/SDL_audiotypecvt.c	Sun Jan 11 04:46:42 2009 +0000
     1.3 @@ -25,12 +25,37 @@
     1.4  #include "SDL_audio.h"
     1.5  #include "SDL_audio_c.h"
     1.6  
     1.7 +#ifndef DEBUG_CONVERT
     1.8 +#define DEBUG_CONVERT 0
     1.9 +#endif
    1.10 +
    1.11 +
    1.12 +/* If you can guarantee your data and need space, you can eliminate code... */
    1.13 +
    1.14 +/* Just build the arbitrary resamplers if you're saving code space. */
    1.15 +#ifndef LESS_RESAMPLERS
    1.16 +#define LESS_RESAMPLERS 0
    1.17 +#endif
    1.18 +
    1.19 +/* Don't build any resamplers if you're REALLY saving code space. */
    1.20 +#ifndef NO_RESAMPLERS
    1.21 +#define NO_RESAMPLERS 0
    1.22 +#endif
    1.23 +
    1.24 +/* Don't build any type converters if you're saving code space. */
    1.25 +#ifndef NO_CONVERTERS
    1.26 +#define NO_CONVERTERS 0
    1.27 +#endif
    1.28 +
    1.29 +
    1.30  /* *INDENT-OFF* */
    1.31  
    1.32  #define DIVBY127 0.0078740157480315f
    1.33  #define DIVBY32767 3.05185094759972e-05f
    1.34  #define DIVBY2147483647 4.6566128752458e-10f
    1.35  
    1.36 +#if !NO_CONVERTERS
    1.37 +
    1.38  static void SDLCALL
    1.39  SDL_Convert_U8_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
    1.40  {
    1.41 @@ -2165,8 +2190,12 @@
    1.42      }
    1.43  }
    1.44  
    1.45 +#endif  /* !NO_CONVERTERS */
    1.46 +
    1.47 +
    1.48  const SDL_AudioTypeFilters sdl_audio_type_filters[] =
    1.49  {
    1.50 +#if !NO_CONVERTERS
    1.51      { AUDIO_U8, AUDIO_S8, SDL_Convert_U8_to_S8 },
    1.52      { AUDIO_U8, AUDIO_U16LSB, SDL_Convert_U8_to_U16LSB },
    1.53      { AUDIO_U8, AUDIO_S16LSB, SDL_Convert_U8_to_S16LSB },
    1.54 @@ -2257,9 +2286,13931 @@
    1.55      { AUDIO_F32MSB, AUDIO_S32LSB, SDL_Convert_F32MSB_to_S32LSB },
    1.56      { AUDIO_F32MSB, AUDIO_S32MSB, SDL_Convert_F32MSB_to_S32MSB },
    1.57      { AUDIO_F32MSB, AUDIO_F32LSB, SDL_Convert_F32MSB_to_F32LSB },
    1.58 +#endif  /* !NO_CONVERTERS */
    1.59 +    { 0, 0, NULL }
    1.60  };
    1.61  
    1.62  
    1.63 +#if !NO_RESAMPLERS
    1.64 +
    1.65 +static void SDLCALL
    1.66 +SDL_Upsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
    1.67 +{
    1.68 +#ifdef DEBUG_CONVERT
    1.69 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr);
    1.70 +#endif
    1.71 +
    1.72 +    const int srcsize = cvt->len_cvt - 16;
    1.73 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
    1.74 +    register int eps = 0;
    1.75 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1;
    1.76 +    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
    1.77 +    const Uint8 *target = ((const Uint8 *) cvt->buf) - 1;
    1.78 +    Uint8 sample0 = src[0];
    1.79 +    Uint8 last_sample0 = sample0;
    1.80 +    while (dst != target) {
    1.81 +        dst[0] = sample0;
    1.82 +        dst--;
    1.83 +        eps += srcsize;
    1.84 +        if ((eps << 1) >= dstsize) {
    1.85 +            src--;
    1.86 +            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
    1.87 +            last_sample0 = sample0;
    1.88 +            eps -= dstsize;
    1.89 +        }
    1.90 +    }
    1.91 +    cvt->len_cvt = dstsize;
    1.92 +    if (cvt->filters[++cvt->filter_index]) {
    1.93 +        cvt->filters[cvt->filter_index] (cvt, format);
    1.94 +    }
    1.95 +}
    1.96 +
    1.97 +static void SDLCALL
    1.98 +SDL_Downsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
    1.99 +{
   1.100 +#ifdef DEBUG_CONVERT
   1.101 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr);
   1.102 +#endif
   1.103 +
   1.104 +    const int srcsize = cvt->len_cvt - 16;
   1.105 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.106 +    register int eps = 0;
   1.107 +    Uint8 *dst = (Uint8 *) cvt->buf;
   1.108 +    const Uint8 *src = (Uint8 *) cvt->buf;
   1.109 +    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
   1.110 +    Uint8 sample0 = src[0];
   1.111 +    Uint8 last_sample0 = sample0;
   1.112 +    while (dst != target) {
   1.113 +        src++;
   1.114 +        eps += dstsize;
   1.115 +        if ((eps << 1) >= srcsize) {
   1.116 +            dst[0] = sample0;
   1.117 +            dst++;
   1.118 +            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
   1.119 +            last_sample0 = sample0;
   1.120 +            eps -= srcsize;
   1.121 +        }
   1.122 +    }
   1.123 +    cvt->len_cvt = dstsize;
   1.124 +    if (cvt->filters[++cvt->filter_index]) {
   1.125 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.126 +    }
   1.127 +}
   1.128 +
   1.129 +static void SDLCALL
   1.130 +SDL_Upsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.131 +{
   1.132 +#ifdef DEBUG_CONVERT
   1.133 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr);
   1.134 +#endif
   1.135 +
   1.136 +    const int srcsize = cvt->len_cvt - 32;
   1.137 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.138 +    register int eps = 0;
   1.139 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2;
   1.140 +    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
   1.141 +    const Uint8 *target = ((const Uint8 *) cvt->buf) - 2;
   1.142 +    Uint8 sample1 = src[1];
   1.143 +    Uint8 sample0 = src[0];
   1.144 +    Uint8 last_sample1 = sample1;
   1.145 +    Uint8 last_sample0 = sample0;
   1.146 +    while (dst != target) {
   1.147 +        dst[1] = sample1;
   1.148 +        dst[0] = sample0;
   1.149 +        dst -= 2;
   1.150 +        eps += srcsize;
   1.151 +        if ((eps << 1) >= dstsize) {
   1.152 +            src -= 2;
   1.153 +            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
   1.154 +            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
   1.155 +            last_sample1 = sample1;
   1.156 +            last_sample0 = sample0;
   1.157 +            eps -= dstsize;
   1.158 +        }
   1.159 +    }
   1.160 +    cvt->len_cvt = dstsize;
   1.161 +    if (cvt->filters[++cvt->filter_index]) {
   1.162 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.163 +    }
   1.164 +}
   1.165 +
   1.166 +static void SDLCALL
   1.167 +SDL_Downsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.168 +{
   1.169 +#ifdef DEBUG_CONVERT
   1.170 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr);
   1.171 +#endif
   1.172 +
   1.173 +    const int srcsize = cvt->len_cvt - 32;
   1.174 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.175 +    register int eps = 0;
   1.176 +    Uint8 *dst = (Uint8 *) cvt->buf;
   1.177 +    const Uint8 *src = (Uint8 *) cvt->buf;
   1.178 +    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
   1.179 +    Uint8 sample0 = src[0];
   1.180 +    Uint8 sample1 = src[1];
   1.181 +    Uint8 last_sample0 = sample0;
   1.182 +    Uint8 last_sample1 = sample1;
   1.183 +    while (dst != target) {
   1.184 +        src += 2;
   1.185 +        eps += dstsize;
   1.186 +        if ((eps << 1) >= srcsize) {
   1.187 +            dst[0] = sample0;
   1.188 +            dst[1] = sample1;
   1.189 +            dst += 2;
   1.190 +            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
   1.191 +            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
   1.192 +            last_sample0 = sample0;
   1.193 +            last_sample1 = sample1;
   1.194 +            eps -= srcsize;
   1.195 +        }
   1.196 +    }
   1.197 +    cvt->len_cvt = dstsize;
   1.198 +    if (cvt->filters[++cvt->filter_index]) {
   1.199 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.200 +    }
   1.201 +}
   1.202 +
   1.203 +static void SDLCALL
   1.204 +SDL_Upsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.205 +{
   1.206 +#ifdef DEBUG_CONVERT
   1.207 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr);
   1.208 +#endif
   1.209 +
   1.210 +    const int srcsize = cvt->len_cvt - 64;
   1.211 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.212 +    register int eps = 0;
   1.213 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4;
   1.214 +    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
   1.215 +    const Uint8 *target = ((const Uint8 *) cvt->buf) - 4;
   1.216 +    Uint8 sample3 = src[3];
   1.217 +    Uint8 sample2 = src[2];
   1.218 +    Uint8 sample1 = src[1];
   1.219 +    Uint8 sample0 = src[0];
   1.220 +    Uint8 last_sample3 = sample3;
   1.221 +    Uint8 last_sample2 = sample2;
   1.222 +    Uint8 last_sample1 = sample1;
   1.223 +    Uint8 last_sample0 = sample0;
   1.224 +    while (dst != target) {
   1.225 +        dst[3] = sample3;
   1.226 +        dst[2] = sample2;
   1.227 +        dst[1] = sample1;
   1.228 +        dst[0] = sample0;
   1.229 +        dst -= 4;
   1.230 +        eps += srcsize;
   1.231 +        if ((eps << 1) >= dstsize) {
   1.232 +            src -= 4;
   1.233 +            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
   1.234 +            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
   1.235 +            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
   1.236 +            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
   1.237 +            last_sample3 = sample3;
   1.238 +            last_sample2 = sample2;
   1.239 +            last_sample1 = sample1;
   1.240 +            last_sample0 = sample0;
   1.241 +            eps -= dstsize;
   1.242 +        }
   1.243 +    }
   1.244 +    cvt->len_cvt = dstsize;
   1.245 +    if (cvt->filters[++cvt->filter_index]) {
   1.246 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.247 +    }
   1.248 +}
   1.249 +
   1.250 +static void SDLCALL
   1.251 +SDL_Downsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.252 +{
   1.253 +#ifdef DEBUG_CONVERT
   1.254 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr);
   1.255 +#endif
   1.256 +
   1.257 +    const int srcsize = cvt->len_cvt - 64;
   1.258 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.259 +    register int eps = 0;
   1.260 +    Uint8 *dst = (Uint8 *) cvt->buf;
   1.261 +    const Uint8 *src = (Uint8 *) cvt->buf;
   1.262 +    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
   1.263 +    Uint8 sample0 = src[0];
   1.264 +    Uint8 sample1 = src[1];
   1.265 +    Uint8 sample2 = src[2];
   1.266 +    Uint8 sample3 = src[3];
   1.267 +    Uint8 last_sample0 = sample0;
   1.268 +    Uint8 last_sample1 = sample1;
   1.269 +    Uint8 last_sample2 = sample2;
   1.270 +    Uint8 last_sample3 = sample3;
   1.271 +    while (dst != target) {
   1.272 +        src += 4;
   1.273 +        eps += dstsize;
   1.274 +        if ((eps << 1) >= srcsize) {
   1.275 +            dst[0] = sample0;
   1.276 +            dst[1] = sample1;
   1.277 +            dst[2] = sample2;
   1.278 +            dst[3] = sample3;
   1.279 +            dst += 4;
   1.280 +            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
   1.281 +            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
   1.282 +            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
   1.283 +            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
   1.284 +            last_sample0 = sample0;
   1.285 +            last_sample1 = sample1;
   1.286 +            last_sample2 = sample2;
   1.287 +            last_sample3 = sample3;
   1.288 +            eps -= srcsize;
   1.289 +        }
   1.290 +    }
   1.291 +    cvt->len_cvt = dstsize;
   1.292 +    if (cvt->filters[++cvt->filter_index]) {
   1.293 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.294 +    }
   1.295 +}
   1.296 +
   1.297 +static void SDLCALL
   1.298 +SDL_Upsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.299 +{
   1.300 +#ifdef DEBUG_CONVERT
   1.301 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr);
   1.302 +#endif
   1.303 +
   1.304 +    const int srcsize = cvt->len_cvt - 96;
   1.305 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.306 +    register int eps = 0;
   1.307 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6;
   1.308 +    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
   1.309 +    const Uint8 *target = ((const Uint8 *) cvt->buf) - 6;
   1.310 +    Uint8 sample5 = src[5];
   1.311 +    Uint8 sample4 = src[4];
   1.312 +    Uint8 sample3 = src[3];
   1.313 +    Uint8 sample2 = src[2];
   1.314 +    Uint8 sample1 = src[1];
   1.315 +    Uint8 sample0 = src[0];
   1.316 +    Uint8 last_sample5 = sample5;
   1.317 +    Uint8 last_sample4 = sample4;
   1.318 +    Uint8 last_sample3 = sample3;
   1.319 +    Uint8 last_sample2 = sample2;
   1.320 +    Uint8 last_sample1 = sample1;
   1.321 +    Uint8 last_sample0 = sample0;
   1.322 +    while (dst != target) {
   1.323 +        dst[5] = sample5;
   1.324 +        dst[4] = sample4;
   1.325 +        dst[3] = sample3;
   1.326 +        dst[2] = sample2;
   1.327 +        dst[1] = sample1;
   1.328 +        dst[0] = sample0;
   1.329 +        dst -= 6;
   1.330 +        eps += srcsize;
   1.331 +        if ((eps << 1) >= dstsize) {
   1.332 +            src -= 6;
   1.333 +            sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
   1.334 +            sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
   1.335 +            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
   1.336 +            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
   1.337 +            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
   1.338 +            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
   1.339 +            last_sample5 = sample5;
   1.340 +            last_sample4 = sample4;
   1.341 +            last_sample3 = sample3;
   1.342 +            last_sample2 = sample2;
   1.343 +            last_sample1 = sample1;
   1.344 +            last_sample0 = sample0;
   1.345 +            eps -= dstsize;
   1.346 +        }
   1.347 +    }
   1.348 +    cvt->len_cvt = dstsize;
   1.349 +    if (cvt->filters[++cvt->filter_index]) {
   1.350 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.351 +    }
   1.352 +}
   1.353 +
   1.354 +static void SDLCALL
   1.355 +SDL_Downsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.356 +{
   1.357 +#ifdef DEBUG_CONVERT
   1.358 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr);
   1.359 +#endif
   1.360 +
   1.361 +    const int srcsize = cvt->len_cvt - 96;
   1.362 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.363 +    register int eps = 0;
   1.364 +    Uint8 *dst = (Uint8 *) cvt->buf;
   1.365 +    const Uint8 *src = (Uint8 *) cvt->buf;
   1.366 +    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
   1.367 +    Uint8 sample0 = src[0];
   1.368 +    Uint8 sample1 = src[1];
   1.369 +    Uint8 sample2 = src[2];
   1.370 +    Uint8 sample3 = src[3];
   1.371 +    Uint8 sample4 = src[4];
   1.372 +    Uint8 sample5 = src[5];
   1.373 +    Uint8 last_sample0 = sample0;
   1.374 +    Uint8 last_sample1 = sample1;
   1.375 +    Uint8 last_sample2 = sample2;
   1.376 +    Uint8 last_sample3 = sample3;
   1.377 +    Uint8 last_sample4 = sample4;
   1.378 +    Uint8 last_sample5 = sample5;
   1.379 +    while (dst != target) {
   1.380 +        src += 6;
   1.381 +        eps += dstsize;
   1.382 +        if ((eps << 1) >= srcsize) {
   1.383 +            dst[0] = sample0;
   1.384 +            dst[1] = sample1;
   1.385 +            dst[2] = sample2;
   1.386 +            dst[3] = sample3;
   1.387 +            dst[4] = sample4;
   1.388 +            dst[5] = sample5;
   1.389 +            dst += 6;
   1.390 +            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
   1.391 +            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
   1.392 +            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
   1.393 +            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
   1.394 +            sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
   1.395 +            sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
   1.396 +            last_sample0 = sample0;
   1.397 +            last_sample1 = sample1;
   1.398 +            last_sample2 = sample2;
   1.399 +            last_sample3 = sample3;
   1.400 +            last_sample4 = sample4;
   1.401 +            last_sample5 = sample5;
   1.402 +            eps -= srcsize;
   1.403 +        }
   1.404 +    }
   1.405 +    cvt->len_cvt = dstsize;
   1.406 +    if (cvt->filters[++cvt->filter_index]) {
   1.407 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.408 +    }
   1.409 +}
   1.410 +
   1.411 +static void SDLCALL
   1.412 +SDL_Upsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.413 +{
   1.414 +#ifdef DEBUG_CONVERT
   1.415 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr);
   1.416 +#endif
   1.417 +
   1.418 +    const int srcsize = cvt->len_cvt - 128;
   1.419 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.420 +    register int eps = 0;
   1.421 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8;
   1.422 +    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
   1.423 +    const Uint8 *target = ((const Uint8 *) cvt->buf) - 8;
   1.424 +    Uint8 sample7 = src[7];
   1.425 +    Uint8 sample6 = src[6];
   1.426 +    Uint8 sample5 = src[5];
   1.427 +    Uint8 sample4 = src[4];
   1.428 +    Uint8 sample3 = src[3];
   1.429 +    Uint8 sample2 = src[2];
   1.430 +    Uint8 sample1 = src[1];
   1.431 +    Uint8 sample0 = src[0];
   1.432 +    Uint8 last_sample7 = sample7;
   1.433 +    Uint8 last_sample6 = sample6;
   1.434 +    Uint8 last_sample5 = sample5;
   1.435 +    Uint8 last_sample4 = sample4;
   1.436 +    Uint8 last_sample3 = sample3;
   1.437 +    Uint8 last_sample2 = sample2;
   1.438 +    Uint8 last_sample1 = sample1;
   1.439 +    Uint8 last_sample0 = sample0;
   1.440 +    while (dst != target) {
   1.441 +        dst[7] = sample7;
   1.442 +        dst[6] = sample6;
   1.443 +        dst[5] = sample5;
   1.444 +        dst[4] = sample4;
   1.445 +        dst[3] = sample3;
   1.446 +        dst[2] = sample2;
   1.447 +        dst[1] = sample1;
   1.448 +        dst[0] = sample0;
   1.449 +        dst -= 8;
   1.450 +        eps += srcsize;
   1.451 +        if ((eps << 1) >= dstsize) {
   1.452 +            src -= 8;
   1.453 +            sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1);
   1.454 +            sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1);
   1.455 +            sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
   1.456 +            sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
   1.457 +            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
   1.458 +            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
   1.459 +            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
   1.460 +            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
   1.461 +            last_sample7 = sample7;
   1.462 +            last_sample6 = sample6;
   1.463 +            last_sample5 = sample5;
   1.464 +            last_sample4 = sample4;
   1.465 +            last_sample3 = sample3;
   1.466 +            last_sample2 = sample2;
   1.467 +            last_sample1 = sample1;
   1.468 +            last_sample0 = sample0;
   1.469 +            eps -= dstsize;
   1.470 +        }
   1.471 +    }
   1.472 +    cvt->len_cvt = dstsize;
   1.473 +    if (cvt->filters[++cvt->filter_index]) {
   1.474 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.475 +    }
   1.476 +}
   1.477 +
   1.478 +static void SDLCALL
   1.479 +SDL_Downsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.480 +{
   1.481 +#ifdef DEBUG_CONVERT
   1.482 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr);
   1.483 +#endif
   1.484 +
   1.485 +    const int srcsize = cvt->len_cvt - 128;
   1.486 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.487 +    register int eps = 0;
   1.488 +    Uint8 *dst = (Uint8 *) cvt->buf;
   1.489 +    const Uint8 *src = (Uint8 *) cvt->buf;
   1.490 +    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
   1.491 +    Uint8 sample0 = src[0];
   1.492 +    Uint8 sample1 = src[1];
   1.493 +    Uint8 sample2 = src[2];
   1.494 +    Uint8 sample3 = src[3];
   1.495 +    Uint8 sample4 = src[4];
   1.496 +    Uint8 sample5 = src[5];
   1.497 +    Uint8 sample6 = src[6];
   1.498 +    Uint8 sample7 = src[7];
   1.499 +    Uint8 last_sample0 = sample0;
   1.500 +    Uint8 last_sample1 = sample1;
   1.501 +    Uint8 last_sample2 = sample2;
   1.502 +    Uint8 last_sample3 = sample3;
   1.503 +    Uint8 last_sample4 = sample4;
   1.504 +    Uint8 last_sample5 = sample5;
   1.505 +    Uint8 last_sample6 = sample6;
   1.506 +    Uint8 last_sample7 = sample7;
   1.507 +    while (dst != target) {
   1.508 +        src += 8;
   1.509 +        eps += dstsize;
   1.510 +        if ((eps << 1) >= srcsize) {
   1.511 +            dst[0] = sample0;
   1.512 +            dst[1] = sample1;
   1.513 +            dst[2] = sample2;
   1.514 +            dst[3] = sample3;
   1.515 +            dst[4] = sample4;
   1.516 +            dst[5] = sample5;
   1.517 +            dst[6] = sample6;
   1.518 +            dst[7] = sample7;
   1.519 +            dst += 8;
   1.520 +            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
   1.521 +            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
   1.522 +            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
   1.523 +            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
   1.524 +            sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
   1.525 +            sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
   1.526 +            sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1);
   1.527 +            sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1);
   1.528 +            last_sample0 = sample0;
   1.529 +            last_sample1 = sample1;
   1.530 +            last_sample2 = sample2;
   1.531 +            last_sample3 = sample3;
   1.532 +            last_sample4 = sample4;
   1.533 +            last_sample5 = sample5;
   1.534 +            last_sample6 = sample6;
   1.535 +            last_sample7 = sample7;
   1.536 +            eps -= srcsize;
   1.537 +        }
   1.538 +    }
   1.539 +    cvt->len_cvt = dstsize;
   1.540 +    if (cvt->filters[++cvt->filter_index]) {
   1.541 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.542 +    }
   1.543 +}
   1.544 +
   1.545 +static void SDLCALL
   1.546 +SDL_Upsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.547 +{
   1.548 +#ifdef DEBUG_CONVERT
   1.549 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr);
   1.550 +#endif
   1.551 +
   1.552 +    const int srcsize = cvt->len_cvt - 16;
   1.553 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.554 +    register int eps = 0;
   1.555 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1;
   1.556 +    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.557 +    const Sint8 *target = ((const Sint8 *) cvt->buf) - 1;
   1.558 +    Sint8 sample0 = ((Sint8) src[0]);
   1.559 +    Sint8 last_sample0 = sample0;
   1.560 +    while (dst != target) {
   1.561 +        dst[0] = ((Sint8) sample0);
   1.562 +        dst--;
   1.563 +        eps += srcsize;
   1.564 +        if ((eps << 1) >= dstsize) {
   1.565 +            src--;
   1.566 +            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
   1.567 +            last_sample0 = sample0;
   1.568 +            eps -= dstsize;
   1.569 +        }
   1.570 +    }
   1.571 +    cvt->len_cvt = dstsize;
   1.572 +    if (cvt->filters[++cvt->filter_index]) {
   1.573 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.574 +    }
   1.575 +}
   1.576 +
   1.577 +static void SDLCALL
   1.578 +SDL_Downsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.579 +{
   1.580 +#ifdef DEBUG_CONVERT
   1.581 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr);
   1.582 +#endif
   1.583 +
   1.584 +    const int srcsize = cvt->len_cvt - 16;
   1.585 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.586 +    register int eps = 0;
   1.587 +    Sint8 *dst = (Sint8 *) cvt->buf;
   1.588 +    const Sint8 *src = (Sint8 *) cvt->buf;
   1.589 +    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
   1.590 +    Sint8 sample0 = ((Sint8) src[0]);
   1.591 +    Sint8 last_sample0 = sample0;
   1.592 +    while (dst != target) {
   1.593 +        src++;
   1.594 +        eps += dstsize;
   1.595 +        if ((eps << 1) >= srcsize) {
   1.596 +            dst[0] = ((Sint8) sample0);
   1.597 +            dst++;
   1.598 +            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
   1.599 +            last_sample0 = sample0;
   1.600 +            eps -= srcsize;
   1.601 +        }
   1.602 +    }
   1.603 +    cvt->len_cvt = dstsize;
   1.604 +    if (cvt->filters[++cvt->filter_index]) {
   1.605 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.606 +    }
   1.607 +}
   1.608 +
   1.609 +static void SDLCALL
   1.610 +SDL_Upsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.611 +{
   1.612 +#ifdef DEBUG_CONVERT
   1.613 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr);
   1.614 +#endif
   1.615 +
   1.616 +    const int srcsize = cvt->len_cvt - 32;
   1.617 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.618 +    register int eps = 0;
   1.619 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2;
   1.620 +    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
   1.621 +    const Sint8 *target = ((const Sint8 *) cvt->buf) - 2;
   1.622 +    Sint8 sample1 = ((Sint8) src[1]);
   1.623 +    Sint8 sample0 = ((Sint8) src[0]);
   1.624 +    Sint8 last_sample1 = sample1;
   1.625 +    Sint8 last_sample0 = sample0;
   1.626 +    while (dst != target) {
   1.627 +        dst[1] = ((Sint8) sample1);
   1.628 +        dst[0] = ((Sint8) sample0);
   1.629 +        dst -= 2;
   1.630 +        eps += srcsize;
   1.631 +        if ((eps << 1) >= dstsize) {
   1.632 +            src -= 2;
   1.633 +            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
   1.634 +            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
   1.635 +            last_sample1 = sample1;
   1.636 +            last_sample0 = sample0;
   1.637 +            eps -= dstsize;
   1.638 +        }
   1.639 +    }
   1.640 +    cvt->len_cvt = dstsize;
   1.641 +    if (cvt->filters[++cvt->filter_index]) {
   1.642 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.643 +    }
   1.644 +}
   1.645 +
   1.646 +static void SDLCALL
   1.647 +SDL_Downsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.648 +{
   1.649 +#ifdef DEBUG_CONVERT
   1.650 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr);
   1.651 +#endif
   1.652 +
   1.653 +    const int srcsize = cvt->len_cvt - 32;
   1.654 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.655 +    register int eps = 0;
   1.656 +    Sint8 *dst = (Sint8 *) cvt->buf;
   1.657 +    const Sint8 *src = (Sint8 *) cvt->buf;
   1.658 +    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
   1.659 +    Sint8 sample0 = ((Sint8) src[0]);
   1.660 +    Sint8 sample1 = ((Sint8) src[1]);
   1.661 +    Sint8 last_sample0 = sample0;
   1.662 +    Sint8 last_sample1 = sample1;
   1.663 +    while (dst != target) {
   1.664 +        src += 2;
   1.665 +        eps += dstsize;
   1.666 +        if ((eps << 1) >= srcsize) {
   1.667 +            dst[0] = ((Sint8) sample0);
   1.668 +            dst[1] = ((Sint8) sample1);
   1.669 +            dst += 2;
   1.670 +            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
   1.671 +            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
   1.672 +            last_sample0 = sample0;
   1.673 +            last_sample1 = sample1;
   1.674 +            eps -= srcsize;
   1.675 +        }
   1.676 +    }
   1.677 +    cvt->len_cvt = dstsize;
   1.678 +    if (cvt->filters[++cvt->filter_index]) {
   1.679 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.680 +    }
   1.681 +}
   1.682 +
   1.683 +static void SDLCALL
   1.684 +SDL_Upsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.685 +{
   1.686 +#ifdef DEBUG_CONVERT
   1.687 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr);
   1.688 +#endif
   1.689 +
   1.690 +    const int srcsize = cvt->len_cvt - 64;
   1.691 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.692 +    register int eps = 0;
   1.693 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4;
   1.694 +    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
   1.695 +    const Sint8 *target = ((const Sint8 *) cvt->buf) - 4;
   1.696 +    Sint8 sample3 = ((Sint8) src[3]);
   1.697 +    Sint8 sample2 = ((Sint8) src[2]);
   1.698 +    Sint8 sample1 = ((Sint8) src[1]);
   1.699 +    Sint8 sample0 = ((Sint8) src[0]);
   1.700 +    Sint8 last_sample3 = sample3;
   1.701 +    Sint8 last_sample2 = sample2;
   1.702 +    Sint8 last_sample1 = sample1;
   1.703 +    Sint8 last_sample0 = sample0;
   1.704 +    while (dst != target) {
   1.705 +        dst[3] = ((Sint8) sample3);
   1.706 +        dst[2] = ((Sint8) sample2);
   1.707 +        dst[1] = ((Sint8) sample1);
   1.708 +        dst[0] = ((Sint8) sample0);
   1.709 +        dst -= 4;
   1.710 +        eps += srcsize;
   1.711 +        if ((eps << 1) >= dstsize) {
   1.712 +            src -= 4;
   1.713 +            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
   1.714 +            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
   1.715 +            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
   1.716 +            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
   1.717 +            last_sample3 = sample3;
   1.718 +            last_sample2 = sample2;
   1.719 +            last_sample1 = sample1;
   1.720 +            last_sample0 = sample0;
   1.721 +            eps -= dstsize;
   1.722 +        }
   1.723 +    }
   1.724 +    cvt->len_cvt = dstsize;
   1.725 +    if (cvt->filters[++cvt->filter_index]) {
   1.726 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.727 +    }
   1.728 +}
   1.729 +
   1.730 +static void SDLCALL
   1.731 +SDL_Downsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.732 +{
   1.733 +#ifdef DEBUG_CONVERT
   1.734 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr);
   1.735 +#endif
   1.736 +
   1.737 +    const int srcsize = cvt->len_cvt - 64;
   1.738 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.739 +    register int eps = 0;
   1.740 +    Sint8 *dst = (Sint8 *) cvt->buf;
   1.741 +    const Sint8 *src = (Sint8 *) cvt->buf;
   1.742 +    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
   1.743 +    Sint8 sample0 = ((Sint8) src[0]);
   1.744 +    Sint8 sample1 = ((Sint8) src[1]);
   1.745 +    Sint8 sample2 = ((Sint8) src[2]);
   1.746 +    Sint8 sample3 = ((Sint8) src[3]);
   1.747 +    Sint8 last_sample0 = sample0;
   1.748 +    Sint8 last_sample1 = sample1;
   1.749 +    Sint8 last_sample2 = sample2;
   1.750 +    Sint8 last_sample3 = sample3;
   1.751 +    while (dst != target) {
   1.752 +        src += 4;
   1.753 +        eps += dstsize;
   1.754 +        if ((eps << 1) >= srcsize) {
   1.755 +            dst[0] = ((Sint8) sample0);
   1.756 +            dst[1] = ((Sint8) sample1);
   1.757 +            dst[2] = ((Sint8) sample2);
   1.758 +            dst[3] = ((Sint8) sample3);
   1.759 +            dst += 4;
   1.760 +            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
   1.761 +            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
   1.762 +            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
   1.763 +            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
   1.764 +            last_sample0 = sample0;
   1.765 +            last_sample1 = sample1;
   1.766 +            last_sample2 = sample2;
   1.767 +            last_sample3 = sample3;
   1.768 +            eps -= srcsize;
   1.769 +        }
   1.770 +    }
   1.771 +    cvt->len_cvt = dstsize;
   1.772 +    if (cvt->filters[++cvt->filter_index]) {
   1.773 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.774 +    }
   1.775 +}
   1.776 +
   1.777 +static void SDLCALL
   1.778 +SDL_Upsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.779 +{
   1.780 +#ifdef DEBUG_CONVERT
   1.781 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr);
   1.782 +#endif
   1.783 +
   1.784 +    const int srcsize = cvt->len_cvt - 96;
   1.785 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.786 +    register int eps = 0;
   1.787 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6;
   1.788 +    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
   1.789 +    const Sint8 *target = ((const Sint8 *) cvt->buf) - 6;
   1.790 +    Sint8 sample5 = ((Sint8) src[5]);
   1.791 +    Sint8 sample4 = ((Sint8) src[4]);
   1.792 +    Sint8 sample3 = ((Sint8) src[3]);
   1.793 +    Sint8 sample2 = ((Sint8) src[2]);
   1.794 +    Sint8 sample1 = ((Sint8) src[1]);
   1.795 +    Sint8 sample0 = ((Sint8) src[0]);
   1.796 +    Sint8 last_sample5 = sample5;
   1.797 +    Sint8 last_sample4 = sample4;
   1.798 +    Sint8 last_sample3 = sample3;
   1.799 +    Sint8 last_sample2 = sample2;
   1.800 +    Sint8 last_sample1 = sample1;
   1.801 +    Sint8 last_sample0 = sample0;
   1.802 +    while (dst != target) {
   1.803 +        dst[5] = ((Sint8) sample5);
   1.804 +        dst[4] = ((Sint8) sample4);
   1.805 +        dst[3] = ((Sint8) sample3);
   1.806 +        dst[2] = ((Sint8) sample2);
   1.807 +        dst[1] = ((Sint8) sample1);
   1.808 +        dst[0] = ((Sint8) sample0);
   1.809 +        dst -= 6;
   1.810 +        eps += srcsize;
   1.811 +        if ((eps << 1) >= dstsize) {
   1.812 +            src -= 6;
   1.813 +            sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
   1.814 +            sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
   1.815 +            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
   1.816 +            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
   1.817 +            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
   1.818 +            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
   1.819 +            last_sample5 = sample5;
   1.820 +            last_sample4 = sample4;
   1.821 +            last_sample3 = sample3;
   1.822 +            last_sample2 = sample2;
   1.823 +            last_sample1 = sample1;
   1.824 +            last_sample0 = sample0;
   1.825 +            eps -= dstsize;
   1.826 +        }
   1.827 +    }
   1.828 +    cvt->len_cvt = dstsize;
   1.829 +    if (cvt->filters[++cvt->filter_index]) {
   1.830 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.831 +    }
   1.832 +}
   1.833 +
   1.834 +static void SDLCALL
   1.835 +SDL_Downsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.836 +{
   1.837 +#ifdef DEBUG_CONVERT
   1.838 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr);
   1.839 +#endif
   1.840 +
   1.841 +    const int srcsize = cvt->len_cvt - 96;
   1.842 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.843 +    register int eps = 0;
   1.844 +    Sint8 *dst = (Sint8 *) cvt->buf;
   1.845 +    const Sint8 *src = (Sint8 *) cvt->buf;
   1.846 +    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
   1.847 +    Sint8 sample0 = ((Sint8) src[0]);
   1.848 +    Sint8 sample1 = ((Sint8) src[1]);
   1.849 +    Sint8 sample2 = ((Sint8) src[2]);
   1.850 +    Sint8 sample3 = ((Sint8) src[3]);
   1.851 +    Sint8 sample4 = ((Sint8) src[4]);
   1.852 +    Sint8 sample5 = ((Sint8) src[5]);
   1.853 +    Sint8 last_sample0 = sample0;
   1.854 +    Sint8 last_sample1 = sample1;
   1.855 +    Sint8 last_sample2 = sample2;
   1.856 +    Sint8 last_sample3 = sample3;
   1.857 +    Sint8 last_sample4 = sample4;
   1.858 +    Sint8 last_sample5 = sample5;
   1.859 +    while (dst != target) {
   1.860 +        src += 6;
   1.861 +        eps += dstsize;
   1.862 +        if ((eps << 1) >= srcsize) {
   1.863 +            dst[0] = ((Sint8) sample0);
   1.864 +            dst[1] = ((Sint8) sample1);
   1.865 +            dst[2] = ((Sint8) sample2);
   1.866 +            dst[3] = ((Sint8) sample3);
   1.867 +            dst[4] = ((Sint8) sample4);
   1.868 +            dst[5] = ((Sint8) sample5);
   1.869 +            dst += 6;
   1.870 +            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
   1.871 +            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
   1.872 +            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
   1.873 +            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
   1.874 +            sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
   1.875 +            sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
   1.876 +            last_sample0 = sample0;
   1.877 +            last_sample1 = sample1;
   1.878 +            last_sample2 = sample2;
   1.879 +            last_sample3 = sample3;
   1.880 +            last_sample4 = sample4;
   1.881 +            last_sample5 = sample5;
   1.882 +            eps -= srcsize;
   1.883 +        }
   1.884 +    }
   1.885 +    cvt->len_cvt = dstsize;
   1.886 +    if (cvt->filters[++cvt->filter_index]) {
   1.887 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.888 +    }
   1.889 +}
   1.890 +
   1.891 +static void SDLCALL
   1.892 +SDL_Upsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.893 +{
   1.894 +#ifdef DEBUG_CONVERT
   1.895 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr);
   1.896 +#endif
   1.897 +
   1.898 +    const int srcsize = cvt->len_cvt - 128;
   1.899 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.900 +    register int eps = 0;
   1.901 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8;
   1.902 +    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
   1.903 +    const Sint8 *target = ((const Sint8 *) cvt->buf) - 8;
   1.904 +    Sint8 sample7 = ((Sint8) src[7]);
   1.905 +    Sint8 sample6 = ((Sint8) src[6]);
   1.906 +    Sint8 sample5 = ((Sint8) src[5]);
   1.907 +    Sint8 sample4 = ((Sint8) src[4]);
   1.908 +    Sint8 sample3 = ((Sint8) src[3]);
   1.909 +    Sint8 sample2 = ((Sint8) src[2]);
   1.910 +    Sint8 sample1 = ((Sint8) src[1]);
   1.911 +    Sint8 sample0 = ((Sint8) src[0]);
   1.912 +    Sint8 last_sample7 = sample7;
   1.913 +    Sint8 last_sample6 = sample6;
   1.914 +    Sint8 last_sample5 = sample5;
   1.915 +    Sint8 last_sample4 = sample4;
   1.916 +    Sint8 last_sample3 = sample3;
   1.917 +    Sint8 last_sample2 = sample2;
   1.918 +    Sint8 last_sample1 = sample1;
   1.919 +    Sint8 last_sample0 = sample0;
   1.920 +    while (dst != target) {
   1.921 +        dst[7] = ((Sint8) sample7);
   1.922 +        dst[6] = ((Sint8) sample6);
   1.923 +        dst[5] = ((Sint8) sample5);
   1.924 +        dst[4] = ((Sint8) sample4);
   1.925 +        dst[3] = ((Sint8) sample3);
   1.926 +        dst[2] = ((Sint8) sample2);
   1.927 +        dst[1] = ((Sint8) sample1);
   1.928 +        dst[0] = ((Sint8) sample0);
   1.929 +        dst -= 8;
   1.930 +        eps += srcsize;
   1.931 +        if ((eps << 1) >= dstsize) {
   1.932 +            src -= 8;
   1.933 +            sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1);
   1.934 +            sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1);
   1.935 +            sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
   1.936 +            sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
   1.937 +            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
   1.938 +            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
   1.939 +            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
   1.940 +            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
   1.941 +            last_sample7 = sample7;
   1.942 +            last_sample6 = sample6;
   1.943 +            last_sample5 = sample5;
   1.944 +            last_sample4 = sample4;
   1.945 +            last_sample3 = sample3;
   1.946 +            last_sample2 = sample2;
   1.947 +            last_sample1 = sample1;
   1.948 +            last_sample0 = sample0;
   1.949 +            eps -= dstsize;
   1.950 +        }
   1.951 +    }
   1.952 +    cvt->len_cvt = dstsize;
   1.953 +    if (cvt->filters[++cvt->filter_index]) {
   1.954 +        cvt->filters[cvt->filter_index] (cvt, format);
   1.955 +    }
   1.956 +}
   1.957 +
   1.958 +static void SDLCALL
   1.959 +SDL_Downsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.960 +{
   1.961 +#ifdef DEBUG_CONVERT
   1.962 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr);
   1.963 +#endif
   1.964 +
   1.965 +    const int srcsize = cvt->len_cvt - 128;
   1.966 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
   1.967 +    register int eps = 0;
   1.968 +    Sint8 *dst = (Sint8 *) cvt->buf;
   1.969 +    const Sint8 *src = (Sint8 *) cvt->buf;
   1.970 +    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
   1.971 +    Sint8 sample0 = ((Sint8) src[0]);
   1.972 +    Sint8 sample1 = ((Sint8) src[1]);
   1.973 +    Sint8 sample2 = ((Sint8) src[2]);
   1.974 +    Sint8 sample3 = ((Sint8) src[3]);
   1.975 +    Sint8 sample4 = ((Sint8) src[4]);
   1.976 +    Sint8 sample5 = ((Sint8) src[5]);
   1.977 +    Sint8 sample6 = ((Sint8) src[6]);
   1.978 +    Sint8 sample7 = ((Sint8) src[7]);
   1.979 +    Sint8 last_sample0 = sample0;
   1.980 +    Sint8 last_sample1 = sample1;
   1.981 +    Sint8 last_sample2 = sample2;
   1.982 +    Sint8 last_sample3 = sample3;
   1.983 +    Sint8 last_sample4 = sample4;
   1.984 +    Sint8 last_sample5 = sample5;
   1.985 +    Sint8 last_sample6 = sample6;
   1.986 +    Sint8 last_sample7 = sample7;
   1.987 +    while (dst != target) {
   1.988 +        src += 8;
   1.989 +        eps += dstsize;
   1.990 +        if ((eps << 1) >= srcsize) {
   1.991 +            dst[0] = ((Sint8) sample0);
   1.992 +            dst[1] = ((Sint8) sample1);
   1.993 +            dst[2] = ((Sint8) sample2);
   1.994 +            dst[3] = ((Sint8) sample3);
   1.995 +            dst[4] = ((Sint8) sample4);
   1.996 +            dst[5] = ((Sint8) sample5);
   1.997 +            dst[6] = ((Sint8) sample6);
   1.998 +            dst[7] = ((Sint8) sample7);
   1.999 +            dst += 8;
  1.1000 +            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
  1.1001 +            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
  1.1002 +            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
  1.1003 +            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
  1.1004 +            sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
  1.1005 +            sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
  1.1006 +            sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1);
  1.1007 +            sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1);
  1.1008 +            last_sample0 = sample0;
  1.1009 +            last_sample1 = sample1;
  1.1010 +            last_sample2 = sample2;
  1.1011 +            last_sample3 = sample3;
  1.1012 +            last_sample4 = sample4;
  1.1013 +            last_sample5 = sample5;
  1.1014 +            last_sample6 = sample6;
  1.1015 +            last_sample7 = sample7;
  1.1016 +            eps -= srcsize;
  1.1017 +        }
  1.1018 +    }
  1.1019 +    cvt->len_cvt = dstsize;
  1.1020 +    if (cvt->filters[++cvt->filter_index]) {
  1.1021 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1022 +    }
  1.1023 +}
  1.1024 +
  1.1025 +static void SDLCALL
  1.1026 +SDL_Upsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1027 +{
  1.1028 +#ifdef DEBUG_CONVERT
  1.1029 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr);
  1.1030 +#endif
  1.1031 +
  1.1032 +    const int srcsize = cvt->len_cvt - 32;
  1.1033 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1034 +    register int eps = 0;
  1.1035 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
  1.1036 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.1037 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
  1.1038 +    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.1039 +    Uint16 last_sample0 = sample0;
  1.1040 +    while (dst != target) {
  1.1041 +        dst[0] = SDL_SwapLE16(sample0);
  1.1042 +        dst--;
  1.1043 +        eps += srcsize;
  1.1044 +        if ((eps << 1) >= dstsize) {
  1.1045 +            src--;
  1.1046 +            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.1047 +            last_sample0 = sample0;
  1.1048 +            eps -= dstsize;
  1.1049 +        }
  1.1050 +    }
  1.1051 +    cvt->len_cvt = dstsize;
  1.1052 +    if (cvt->filters[++cvt->filter_index]) {
  1.1053 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1054 +    }
  1.1055 +}
  1.1056 +
  1.1057 +static void SDLCALL
  1.1058 +SDL_Downsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1059 +{
  1.1060 +#ifdef DEBUG_CONVERT
  1.1061 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr);
  1.1062 +#endif
  1.1063 +
  1.1064 +    const int srcsize = cvt->len_cvt - 32;
  1.1065 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1066 +    register int eps = 0;
  1.1067 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.1068 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.1069 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.1070 +    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.1071 +    Uint16 last_sample0 = sample0;
  1.1072 +    while (dst != target) {
  1.1073 +        src++;
  1.1074 +        eps += dstsize;
  1.1075 +        if ((eps << 1) >= srcsize) {
  1.1076 +            dst[0] = SDL_SwapLE16(sample0);
  1.1077 +            dst++;
  1.1078 +            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.1079 +            last_sample0 = sample0;
  1.1080 +            eps -= srcsize;
  1.1081 +        }
  1.1082 +    }
  1.1083 +    cvt->len_cvt = dstsize;
  1.1084 +    if (cvt->filters[++cvt->filter_index]) {
  1.1085 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1086 +    }
  1.1087 +}
  1.1088 +
  1.1089 +static void SDLCALL
  1.1090 +SDL_Upsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1091 +{
  1.1092 +#ifdef DEBUG_CONVERT
  1.1093 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr);
  1.1094 +#endif
  1.1095 +
  1.1096 +    const int srcsize = cvt->len_cvt - 64;
  1.1097 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1098 +    register int eps = 0;
  1.1099 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
  1.1100 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.1101 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 2;
  1.1102 +    Uint16 sample1 = SDL_SwapLE16(src[1]);
  1.1103 +    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.1104 +    Uint16 last_sample1 = sample1;
  1.1105 +    Uint16 last_sample0 = sample0;
  1.1106 +    while (dst != target) {
  1.1107 +        dst[1] = SDL_SwapLE16(sample1);
  1.1108 +        dst[0] = SDL_SwapLE16(sample0);
  1.1109 +        dst -= 2;
  1.1110 +        eps += srcsize;
  1.1111 +        if ((eps << 1) >= dstsize) {
  1.1112 +            src -= 2;
  1.1113 +            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.1114 +            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.1115 +            last_sample1 = sample1;
  1.1116 +            last_sample0 = sample0;
  1.1117 +            eps -= dstsize;
  1.1118 +        }
  1.1119 +    }
  1.1120 +    cvt->len_cvt = dstsize;
  1.1121 +    if (cvt->filters[++cvt->filter_index]) {
  1.1122 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1123 +    }
  1.1124 +}
  1.1125 +
  1.1126 +static void SDLCALL
  1.1127 +SDL_Downsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1128 +{
  1.1129 +#ifdef DEBUG_CONVERT
  1.1130 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr);
  1.1131 +#endif
  1.1132 +
  1.1133 +    const int srcsize = cvt->len_cvt - 64;
  1.1134 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1135 +    register int eps = 0;
  1.1136 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.1137 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.1138 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.1139 +    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.1140 +    Uint16 sample1 = SDL_SwapLE16(src[1]);
  1.1141 +    Uint16 last_sample0 = sample0;
  1.1142 +    Uint16 last_sample1 = sample1;
  1.1143 +    while (dst != target) {
  1.1144 +        src += 2;
  1.1145 +        eps += dstsize;
  1.1146 +        if ((eps << 1) >= srcsize) {
  1.1147 +            dst[0] = SDL_SwapLE16(sample0);
  1.1148 +            dst[1] = SDL_SwapLE16(sample1);
  1.1149 +            dst += 2;
  1.1150 +            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.1151 +            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.1152 +            last_sample0 = sample0;
  1.1153 +            last_sample1 = sample1;
  1.1154 +            eps -= srcsize;
  1.1155 +        }
  1.1156 +    }
  1.1157 +    cvt->len_cvt = dstsize;
  1.1158 +    if (cvt->filters[++cvt->filter_index]) {
  1.1159 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1160 +    }
  1.1161 +}
  1.1162 +
  1.1163 +static void SDLCALL
  1.1164 +SDL_Upsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1165 +{
  1.1166 +#ifdef DEBUG_CONVERT
  1.1167 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr);
  1.1168 +#endif
  1.1169 +
  1.1170 +    const int srcsize = cvt->len_cvt - 128;
  1.1171 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1172 +    register int eps = 0;
  1.1173 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
  1.1174 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.1175 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 4;
  1.1176 +    Uint16 sample3 = SDL_SwapLE16(src[3]);
  1.1177 +    Uint16 sample2 = SDL_SwapLE16(src[2]);
  1.1178 +    Uint16 sample1 = SDL_SwapLE16(src[1]);
  1.1179 +    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.1180 +    Uint16 last_sample3 = sample3;
  1.1181 +    Uint16 last_sample2 = sample2;
  1.1182 +    Uint16 last_sample1 = sample1;
  1.1183 +    Uint16 last_sample0 = sample0;
  1.1184 +    while (dst != target) {
  1.1185 +        dst[3] = SDL_SwapLE16(sample3);
  1.1186 +        dst[2] = SDL_SwapLE16(sample2);
  1.1187 +        dst[1] = SDL_SwapLE16(sample1);
  1.1188 +        dst[0] = SDL_SwapLE16(sample0);
  1.1189 +        dst -= 4;
  1.1190 +        eps += srcsize;
  1.1191 +        if ((eps << 1) >= dstsize) {
  1.1192 +            src -= 4;
  1.1193 +            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.1194 +            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.1195 +            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.1196 +            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.1197 +            last_sample3 = sample3;
  1.1198 +            last_sample2 = sample2;
  1.1199 +            last_sample1 = sample1;
  1.1200 +            last_sample0 = sample0;
  1.1201 +            eps -= dstsize;
  1.1202 +        }
  1.1203 +    }
  1.1204 +    cvt->len_cvt = dstsize;
  1.1205 +    if (cvt->filters[++cvt->filter_index]) {
  1.1206 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1207 +    }
  1.1208 +}
  1.1209 +
  1.1210 +static void SDLCALL
  1.1211 +SDL_Downsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1212 +{
  1.1213 +#ifdef DEBUG_CONVERT
  1.1214 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr);
  1.1215 +#endif
  1.1216 +
  1.1217 +    const int srcsize = cvt->len_cvt - 128;
  1.1218 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1219 +    register int eps = 0;
  1.1220 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.1221 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.1222 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.1223 +    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.1224 +    Uint16 sample1 = SDL_SwapLE16(src[1]);
  1.1225 +    Uint16 sample2 = SDL_SwapLE16(src[2]);
  1.1226 +    Uint16 sample3 = SDL_SwapLE16(src[3]);
  1.1227 +    Uint16 last_sample0 = sample0;
  1.1228 +    Uint16 last_sample1 = sample1;
  1.1229 +    Uint16 last_sample2 = sample2;
  1.1230 +    Uint16 last_sample3 = sample3;
  1.1231 +    while (dst != target) {
  1.1232 +        src += 4;
  1.1233 +        eps += dstsize;
  1.1234 +        if ((eps << 1) >= srcsize) {
  1.1235 +            dst[0] = SDL_SwapLE16(sample0);
  1.1236 +            dst[1] = SDL_SwapLE16(sample1);
  1.1237 +            dst[2] = SDL_SwapLE16(sample2);
  1.1238 +            dst[3] = SDL_SwapLE16(sample3);
  1.1239 +            dst += 4;
  1.1240 +            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.1241 +            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.1242 +            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.1243 +            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.1244 +            last_sample0 = sample0;
  1.1245 +            last_sample1 = sample1;
  1.1246 +            last_sample2 = sample2;
  1.1247 +            last_sample3 = sample3;
  1.1248 +            eps -= srcsize;
  1.1249 +        }
  1.1250 +    }
  1.1251 +    cvt->len_cvt = dstsize;
  1.1252 +    if (cvt->filters[++cvt->filter_index]) {
  1.1253 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1254 +    }
  1.1255 +}
  1.1256 +
  1.1257 +static void SDLCALL
  1.1258 +SDL_Upsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1259 +{
  1.1260 +#ifdef DEBUG_CONVERT
  1.1261 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr);
  1.1262 +#endif
  1.1263 +
  1.1264 +    const int srcsize = cvt->len_cvt - 192;
  1.1265 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1266 +    register int eps = 0;
  1.1267 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
  1.1268 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.1269 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 6;
  1.1270 +    Uint16 sample5 = SDL_SwapLE16(src[5]);
  1.1271 +    Uint16 sample4 = SDL_SwapLE16(src[4]);
  1.1272 +    Uint16 sample3 = SDL_SwapLE16(src[3]);
  1.1273 +    Uint16 sample2 = SDL_SwapLE16(src[2]);
  1.1274 +    Uint16 sample1 = SDL_SwapLE16(src[1]);
  1.1275 +    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.1276 +    Uint16 last_sample5 = sample5;
  1.1277 +    Uint16 last_sample4 = sample4;
  1.1278 +    Uint16 last_sample3 = sample3;
  1.1279 +    Uint16 last_sample2 = sample2;
  1.1280 +    Uint16 last_sample1 = sample1;
  1.1281 +    Uint16 last_sample0 = sample0;
  1.1282 +    while (dst != target) {
  1.1283 +        dst[5] = SDL_SwapLE16(sample5);
  1.1284 +        dst[4] = SDL_SwapLE16(sample4);
  1.1285 +        dst[3] = SDL_SwapLE16(sample3);
  1.1286 +        dst[2] = SDL_SwapLE16(sample2);
  1.1287 +        dst[1] = SDL_SwapLE16(sample1);
  1.1288 +        dst[0] = SDL_SwapLE16(sample0);
  1.1289 +        dst -= 6;
  1.1290 +        eps += srcsize;
  1.1291 +        if ((eps << 1) >= dstsize) {
  1.1292 +            src -= 6;
  1.1293 +            sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
  1.1294 +            sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
  1.1295 +            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.1296 +            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.1297 +            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.1298 +            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.1299 +            last_sample5 = sample5;
  1.1300 +            last_sample4 = sample4;
  1.1301 +            last_sample3 = sample3;
  1.1302 +            last_sample2 = sample2;
  1.1303 +            last_sample1 = sample1;
  1.1304 +            last_sample0 = sample0;
  1.1305 +            eps -= dstsize;
  1.1306 +        }
  1.1307 +    }
  1.1308 +    cvt->len_cvt = dstsize;
  1.1309 +    if (cvt->filters[++cvt->filter_index]) {
  1.1310 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1311 +    }
  1.1312 +}
  1.1313 +
  1.1314 +static void SDLCALL
  1.1315 +SDL_Downsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1316 +{
  1.1317 +#ifdef DEBUG_CONVERT
  1.1318 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr);
  1.1319 +#endif
  1.1320 +
  1.1321 +    const int srcsize = cvt->len_cvt - 192;
  1.1322 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1323 +    register int eps = 0;
  1.1324 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.1325 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.1326 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.1327 +    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.1328 +    Uint16 sample1 = SDL_SwapLE16(src[1]);
  1.1329 +    Uint16 sample2 = SDL_SwapLE16(src[2]);
  1.1330 +    Uint16 sample3 = SDL_SwapLE16(src[3]);
  1.1331 +    Uint16 sample4 = SDL_SwapLE16(src[4]);
  1.1332 +    Uint16 sample5 = SDL_SwapLE16(src[5]);
  1.1333 +    Uint16 last_sample0 = sample0;
  1.1334 +    Uint16 last_sample1 = sample1;
  1.1335 +    Uint16 last_sample2 = sample2;
  1.1336 +    Uint16 last_sample3 = sample3;
  1.1337 +    Uint16 last_sample4 = sample4;
  1.1338 +    Uint16 last_sample5 = sample5;
  1.1339 +    while (dst != target) {
  1.1340 +        src += 6;
  1.1341 +        eps += dstsize;
  1.1342 +        if ((eps << 1) >= srcsize) {
  1.1343 +            dst[0] = SDL_SwapLE16(sample0);
  1.1344 +            dst[1] = SDL_SwapLE16(sample1);
  1.1345 +            dst[2] = SDL_SwapLE16(sample2);
  1.1346 +            dst[3] = SDL_SwapLE16(sample3);
  1.1347 +            dst[4] = SDL_SwapLE16(sample4);
  1.1348 +            dst[5] = SDL_SwapLE16(sample5);
  1.1349 +            dst += 6;
  1.1350 +            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.1351 +            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.1352 +            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.1353 +            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.1354 +            sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
  1.1355 +            sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
  1.1356 +            last_sample0 = sample0;
  1.1357 +            last_sample1 = sample1;
  1.1358 +            last_sample2 = sample2;
  1.1359 +            last_sample3 = sample3;
  1.1360 +            last_sample4 = sample4;
  1.1361 +            last_sample5 = sample5;
  1.1362 +            eps -= srcsize;
  1.1363 +        }
  1.1364 +    }
  1.1365 +    cvt->len_cvt = dstsize;
  1.1366 +    if (cvt->filters[++cvt->filter_index]) {
  1.1367 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1368 +    }
  1.1369 +}
  1.1370 +
  1.1371 +static void SDLCALL
  1.1372 +SDL_Upsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1373 +{
  1.1374 +#ifdef DEBUG_CONVERT
  1.1375 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr);
  1.1376 +#endif
  1.1377 +
  1.1378 +    const int srcsize = cvt->len_cvt - 256;
  1.1379 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1380 +    register int eps = 0;
  1.1381 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
  1.1382 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.1383 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 8;
  1.1384 +    Uint16 sample7 = SDL_SwapLE16(src[7]);
  1.1385 +    Uint16 sample6 = SDL_SwapLE16(src[6]);
  1.1386 +    Uint16 sample5 = SDL_SwapLE16(src[5]);
  1.1387 +    Uint16 sample4 = SDL_SwapLE16(src[4]);
  1.1388 +    Uint16 sample3 = SDL_SwapLE16(src[3]);
  1.1389 +    Uint16 sample2 = SDL_SwapLE16(src[2]);
  1.1390 +    Uint16 sample1 = SDL_SwapLE16(src[1]);
  1.1391 +    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.1392 +    Uint16 last_sample7 = sample7;
  1.1393 +    Uint16 last_sample6 = sample6;
  1.1394 +    Uint16 last_sample5 = sample5;
  1.1395 +    Uint16 last_sample4 = sample4;
  1.1396 +    Uint16 last_sample3 = sample3;
  1.1397 +    Uint16 last_sample2 = sample2;
  1.1398 +    Uint16 last_sample1 = sample1;
  1.1399 +    Uint16 last_sample0 = sample0;
  1.1400 +    while (dst != target) {
  1.1401 +        dst[7] = SDL_SwapLE16(sample7);
  1.1402 +        dst[6] = SDL_SwapLE16(sample6);
  1.1403 +        dst[5] = SDL_SwapLE16(sample5);
  1.1404 +        dst[4] = SDL_SwapLE16(sample4);
  1.1405 +        dst[3] = SDL_SwapLE16(sample3);
  1.1406 +        dst[2] = SDL_SwapLE16(sample2);
  1.1407 +        dst[1] = SDL_SwapLE16(sample1);
  1.1408 +        dst[0] = SDL_SwapLE16(sample0);
  1.1409 +        dst -= 8;
  1.1410 +        eps += srcsize;
  1.1411 +        if ((eps << 1) >= dstsize) {
  1.1412 +            src -= 8;
  1.1413 +            sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1);
  1.1414 +            sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1);
  1.1415 +            sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
  1.1416 +            sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
  1.1417 +            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.1418 +            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.1419 +            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.1420 +            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.1421 +            last_sample7 = sample7;
  1.1422 +            last_sample6 = sample6;
  1.1423 +            last_sample5 = sample5;
  1.1424 +            last_sample4 = sample4;
  1.1425 +            last_sample3 = sample3;
  1.1426 +            last_sample2 = sample2;
  1.1427 +            last_sample1 = sample1;
  1.1428 +            last_sample0 = sample0;
  1.1429 +            eps -= dstsize;
  1.1430 +        }
  1.1431 +    }
  1.1432 +    cvt->len_cvt = dstsize;
  1.1433 +    if (cvt->filters[++cvt->filter_index]) {
  1.1434 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1435 +    }
  1.1436 +}
  1.1437 +
  1.1438 +static void SDLCALL
  1.1439 +SDL_Downsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1440 +{
  1.1441 +#ifdef DEBUG_CONVERT
  1.1442 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr);
  1.1443 +#endif
  1.1444 +
  1.1445 +    const int srcsize = cvt->len_cvt - 256;
  1.1446 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1447 +    register int eps = 0;
  1.1448 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.1449 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.1450 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.1451 +    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.1452 +    Uint16 sample1 = SDL_SwapLE16(src[1]);
  1.1453 +    Uint16 sample2 = SDL_SwapLE16(src[2]);
  1.1454 +    Uint16 sample3 = SDL_SwapLE16(src[3]);
  1.1455 +    Uint16 sample4 = SDL_SwapLE16(src[4]);
  1.1456 +    Uint16 sample5 = SDL_SwapLE16(src[5]);
  1.1457 +    Uint16 sample6 = SDL_SwapLE16(src[6]);
  1.1458 +    Uint16 sample7 = SDL_SwapLE16(src[7]);
  1.1459 +    Uint16 last_sample0 = sample0;
  1.1460 +    Uint16 last_sample1 = sample1;
  1.1461 +    Uint16 last_sample2 = sample2;
  1.1462 +    Uint16 last_sample3 = sample3;
  1.1463 +    Uint16 last_sample4 = sample4;
  1.1464 +    Uint16 last_sample5 = sample5;
  1.1465 +    Uint16 last_sample6 = sample6;
  1.1466 +    Uint16 last_sample7 = sample7;
  1.1467 +    while (dst != target) {
  1.1468 +        src += 8;
  1.1469 +        eps += dstsize;
  1.1470 +        if ((eps << 1) >= srcsize) {
  1.1471 +            dst[0] = SDL_SwapLE16(sample0);
  1.1472 +            dst[1] = SDL_SwapLE16(sample1);
  1.1473 +            dst[2] = SDL_SwapLE16(sample2);
  1.1474 +            dst[3] = SDL_SwapLE16(sample3);
  1.1475 +            dst[4] = SDL_SwapLE16(sample4);
  1.1476 +            dst[5] = SDL_SwapLE16(sample5);
  1.1477 +            dst[6] = SDL_SwapLE16(sample6);
  1.1478 +            dst[7] = SDL_SwapLE16(sample7);
  1.1479 +            dst += 8;
  1.1480 +            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.1481 +            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.1482 +            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.1483 +            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.1484 +            sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
  1.1485 +            sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
  1.1486 +            sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1);
  1.1487 +            sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1);
  1.1488 +            last_sample0 = sample0;
  1.1489 +            last_sample1 = sample1;
  1.1490 +            last_sample2 = sample2;
  1.1491 +            last_sample3 = sample3;
  1.1492 +            last_sample4 = sample4;
  1.1493 +            last_sample5 = sample5;
  1.1494 +            last_sample6 = sample6;
  1.1495 +            last_sample7 = sample7;
  1.1496 +            eps -= srcsize;
  1.1497 +        }
  1.1498 +    }
  1.1499 +    cvt->len_cvt = dstsize;
  1.1500 +    if (cvt->filters[++cvt->filter_index]) {
  1.1501 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1502 +    }
  1.1503 +}
  1.1504 +
  1.1505 +static void SDLCALL
  1.1506 +SDL_Upsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1507 +{
  1.1508 +#ifdef DEBUG_CONVERT
  1.1509 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr);
  1.1510 +#endif
  1.1511 +
  1.1512 +    const int srcsize = cvt->len_cvt - 32;
  1.1513 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1514 +    register int eps = 0;
  1.1515 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
  1.1516 +    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.1517 +    const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
  1.1518 +    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.1519 +    Sint16 last_sample0 = sample0;
  1.1520 +    while (dst != target) {
  1.1521 +        dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.1522 +        dst--;
  1.1523 +        eps += srcsize;
  1.1524 +        if ((eps << 1) >= dstsize) {
  1.1525 +            src--;
  1.1526 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.1527 +            last_sample0 = sample0;
  1.1528 +            eps -= dstsize;
  1.1529 +        }
  1.1530 +    }
  1.1531 +    cvt->len_cvt = dstsize;
  1.1532 +    if (cvt->filters[++cvt->filter_index]) {
  1.1533 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1534 +    }
  1.1535 +}
  1.1536 +
  1.1537 +static void SDLCALL
  1.1538 +SDL_Downsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1539 +{
  1.1540 +#ifdef DEBUG_CONVERT
  1.1541 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr);
  1.1542 +#endif
  1.1543 +
  1.1544 +    const int srcsize = cvt->len_cvt - 32;
  1.1545 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1546 +    register int eps = 0;
  1.1547 +    Sint16 *dst = (Sint16 *) cvt->buf;
  1.1548 +    const Sint16 *src = (Sint16 *) cvt->buf;
  1.1549 +    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.1550 +    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.1551 +    Sint16 last_sample0 = sample0;
  1.1552 +    while (dst != target) {
  1.1553 +        src++;
  1.1554 +        eps += dstsize;
  1.1555 +        if ((eps << 1) >= srcsize) {
  1.1556 +            dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.1557 +            dst++;
  1.1558 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.1559 +            last_sample0 = sample0;
  1.1560 +            eps -= srcsize;
  1.1561 +        }
  1.1562 +    }
  1.1563 +    cvt->len_cvt = dstsize;
  1.1564 +    if (cvt->filters[++cvt->filter_index]) {
  1.1565 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1566 +    }
  1.1567 +}
  1.1568 +
  1.1569 +static void SDLCALL
  1.1570 +SDL_Upsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1571 +{
  1.1572 +#ifdef DEBUG_CONVERT
  1.1573 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr);
  1.1574 +#endif
  1.1575 +
  1.1576 +    const int srcsize = cvt->len_cvt - 64;
  1.1577 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1578 +    register int eps = 0;
  1.1579 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
  1.1580 +    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.1581 +    const Sint16 *target = ((const Sint16 *) cvt->buf) - 2;
  1.1582 +    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
  1.1583 +    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.1584 +    Sint16 last_sample1 = sample1;
  1.1585 +    Sint16 last_sample0 = sample0;
  1.1586 +    while (dst != target) {
  1.1587 +        dst[1] = ((Sint16) SDL_SwapLE16(sample1));
  1.1588 +        dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.1589 +        dst -= 2;
  1.1590 +        eps += srcsize;
  1.1591 +        if ((eps << 1) >= dstsize) {
  1.1592 +            src -= 2;
  1.1593 +            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.1594 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.1595 +            last_sample1 = sample1;
  1.1596 +            last_sample0 = sample0;
  1.1597 +            eps -= dstsize;
  1.1598 +        }
  1.1599 +    }
  1.1600 +    cvt->len_cvt = dstsize;
  1.1601 +    if (cvt->filters[++cvt->filter_index]) {
  1.1602 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1603 +    }
  1.1604 +}
  1.1605 +
  1.1606 +static void SDLCALL
  1.1607 +SDL_Downsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1608 +{
  1.1609 +#ifdef DEBUG_CONVERT
  1.1610 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr);
  1.1611 +#endif
  1.1612 +
  1.1613 +    const int srcsize = cvt->len_cvt - 64;
  1.1614 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1615 +    register int eps = 0;
  1.1616 +    Sint16 *dst = (Sint16 *) cvt->buf;
  1.1617 +    const Sint16 *src = (Sint16 *) cvt->buf;
  1.1618 +    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.1619 +    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.1620 +    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
  1.1621 +    Sint16 last_sample0 = sample0;
  1.1622 +    Sint16 last_sample1 = sample1;
  1.1623 +    while (dst != target) {
  1.1624 +        src += 2;
  1.1625 +        eps += dstsize;
  1.1626 +        if ((eps << 1) >= srcsize) {
  1.1627 +            dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.1628 +            dst[1] = ((Sint16) SDL_SwapLE16(sample1));
  1.1629 +            dst += 2;
  1.1630 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.1631 +            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.1632 +            last_sample0 = sample0;
  1.1633 +            last_sample1 = sample1;
  1.1634 +            eps -= srcsize;
  1.1635 +        }
  1.1636 +    }
  1.1637 +    cvt->len_cvt = dstsize;
  1.1638 +    if (cvt->filters[++cvt->filter_index]) {
  1.1639 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1640 +    }
  1.1641 +}
  1.1642 +
  1.1643 +static void SDLCALL
  1.1644 +SDL_Upsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1645 +{
  1.1646 +#ifdef DEBUG_CONVERT
  1.1647 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr);
  1.1648 +#endif
  1.1649 +
  1.1650 +    const int srcsize = cvt->len_cvt - 128;
  1.1651 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1652 +    register int eps = 0;
  1.1653 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
  1.1654 +    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.1655 +    const Sint16 *target = ((const Sint16 *) cvt->buf) - 4;
  1.1656 +    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
  1.1657 +    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
  1.1658 +    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
  1.1659 +    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.1660 +    Sint16 last_sample3 = sample3;
  1.1661 +    Sint16 last_sample2 = sample2;
  1.1662 +    Sint16 last_sample1 = sample1;
  1.1663 +    Sint16 last_sample0 = sample0;
  1.1664 +    while (dst != target) {
  1.1665 +        dst[3] = ((Sint16) SDL_SwapLE16(sample3));
  1.1666 +        dst[2] = ((Sint16) SDL_SwapLE16(sample2));
  1.1667 +        dst[1] = ((Sint16) SDL_SwapLE16(sample1));
  1.1668 +        dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.1669 +        dst -= 4;
  1.1670 +        eps += srcsize;
  1.1671 +        if ((eps << 1) >= dstsize) {
  1.1672 +            src -= 4;
  1.1673 +            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.1674 +            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.1675 +            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.1676 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.1677 +            last_sample3 = sample3;
  1.1678 +            last_sample2 = sample2;
  1.1679 +            last_sample1 = sample1;
  1.1680 +            last_sample0 = sample0;
  1.1681 +            eps -= dstsize;
  1.1682 +        }
  1.1683 +    }
  1.1684 +    cvt->len_cvt = dstsize;
  1.1685 +    if (cvt->filters[++cvt->filter_index]) {
  1.1686 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1687 +    }
  1.1688 +}
  1.1689 +
  1.1690 +static void SDLCALL
  1.1691 +SDL_Downsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1692 +{
  1.1693 +#ifdef DEBUG_CONVERT
  1.1694 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr);
  1.1695 +#endif
  1.1696 +
  1.1697 +    const int srcsize = cvt->len_cvt - 128;
  1.1698 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1699 +    register int eps = 0;
  1.1700 +    Sint16 *dst = (Sint16 *) cvt->buf;
  1.1701 +    const Sint16 *src = (Sint16 *) cvt->buf;
  1.1702 +    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.1703 +    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.1704 +    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
  1.1705 +    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
  1.1706 +    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
  1.1707 +    Sint16 last_sample0 = sample0;
  1.1708 +    Sint16 last_sample1 = sample1;
  1.1709 +    Sint16 last_sample2 = sample2;
  1.1710 +    Sint16 last_sample3 = sample3;
  1.1711 +    while (dst != target) {
  1.1712 +        src += 4;
  1.1713 +        eps += dstsize;
  1.1714 +        if ((eps << 1) >= srcsize) {
  1.1715 +            dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.1716 +            dst[1] = ((Sint16) SDL_SwapLE16(sample1));
  1.1717 +            dst[2] = ((Sint16) SDL_SwapLE16(sample2));
  1.1718 +            dst[3] = ((Sint16) SDL_SwapLE16(sample3));
  1.1719 +            dst += 4;
  1.1720 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.1721 +            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.1722 +            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.1723 +            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.1724 +            last_sample0 = sample0;
  1.1725 +            last_sample1 = sample1;
  1.1726 +            last_sample2 = sample2;
  1.1727 +            last_sample3 = sample3;
  1.1728 +            eps -= srcsize;
  1.1729 +        }
  1.1730 +    }
  1.1731 +    cvt->len_cvt = dstsize;
  1.1732 +    if (cvt->filters[++cvt->filter_index]) {
  1.1733 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1734 +    }
  1.1735 +}
  1.1736 +
  1.1737 +static void SDLCALL
  1.1738 +SDL_Upsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1739 +{
  1.1740 +#ifdef DEBUG_CONVERT
  1.1741 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr);
  1.1742 +#endif
  1.1743 +
  1.1744 +    const int srcsize = cvt->len_cvt - 192;
  1.1745 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1746 +    register int eps = 0;
  1.1747 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
  1.1748 +    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.1749 +    const Sint16 *target = ((const Sint16 *) cvt->buf) - 6;
  1.1750 +    Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
  1.1751 +    Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
  1.1752 +    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
  1.1753 +    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
  1.1754 +    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
  1.1755 +    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.1756 +    Sint16 last_sample5 = sample5;
  1.1757 +    Sint16 last_sample4 = sample4;
  1.1758 +    Sint16 last_sample3 = sample3;
  1.1759 +    Sint16 last_sample2 = sample2;
  1.1760 +    Sint16 last_sample1 = sample1;
  1.1761 +    Sint16 last_sample0 = sample0;
  1.1762 +    while (dst != target) {
  1.1763 +        dst[5] = ((Sint16) SDL_SwapLE16(sample5));
  1.1764 +        dst[4] = ((Sint16) SDL_SwapLE16(sample4));
  1.1765 +        dst[3] = ((Sint16) SDL_SwapLE16(sample3));
  1.1766 +        dst[2] = ((Sint16) SDL_SwapLE16(sample2));
  1.1767 +        dst[1] = ((Sint16) SDL_SwapLE16(sample1));
  1.1768 +        dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.1769 +        dst -= 6;
  1.1770 +        eps += srcsize;
  1.1771 +        if ((eps << 1) >= dstsize) {
  1.1772 +            src -= 6;
  1.1773 +            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
  1.1774 +            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
  1.1775 +            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.1776 +            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.1777 +            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.1778 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.1779 +            last_sample5 = sample5;
  1.1780 +            last_sample4 = sample4;
  1.1781 +            last_sample3 = sample3;
  1.1782 +            last_sample2 = sample2;
  1.1783 +            last_sample1 = sample1;
  1.1784 +            last_sample0 = sample0;
  1.1785 +            eps -= dstsize;
  1.1786 +        }
  1.1787 +    }
  1.1788 +    cvt->len_cvt = dstsize;
  1.1789 +    if (cvt->filters[++cvt->filter_index]) {
  1.1790 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1791 +    }
  1.1792 +}
  1.1793 +
  1.1794 +static void SDLCALL
  1.1795 +SDL_Downsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1796 +{
  1.1797 +#ifdef DEBUG_CONVERT
  1.1798 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr);
  1.1799 +#endif
  1.1800 +
  1.1801 +    const int srcsize = cvt->len_cvt - 192;
  1.1802 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1803 +    register int eps = 0;
  1.1804 +    Sint16 *dst = (Sint16 *) cvt->buf;
  1.1805 +    const Sint16 *src = (Sint16 *) cvt->buf;
  1.1806 +    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.1807 +    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.1808 +    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
  1.1809 +    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
  1.1810 +    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
  1.1811 +    Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
  1.1812 +    Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
  1.1813 +    Sint16 last_sample0 = sample0;
  1.1814 +    Sint16 last_sample1 = sample1;
  1.1815 +    Sint16 last_sample2 = sample2;
  1.1816 +    Sint16 last_sample3 = sample3;
  1.1817 +    Sint16 last_sample4 = sample4;
  1.1818 +    Sint16 last_sample5 = sample5;
  1.1819 +    while (dst != target) {
  1.1820 +        src += 6;
  1.1821 +        eps += dstsize;
  1.1822 +        if ((eps << 1) >= srcsize) {
  1.1823 +            dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.1824 +            dst[1] = ((Sint16) SDL_SwapLE16(sample1));
  1.1825 +            dst[2] = ((Sint16) SDL_SwapLE16(sample2));
  1.1826 +            dst[3] = ((Sint16) SDL_SwapLE16(sample3));
  1.1827 +            dst[4] = ((Sint16) SDL_SwapLE16(sample4));
  1.1828 +            dst[5] = ((Sint16) SDL_SwapLE16(sample5));
  1.1829 +            dst += 6;
  1.1830 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.1831 +            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.1832 +            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.1833 +            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.1834 +            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
  1.1835 +            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
  1.1836 +            last_sample0 = sample0;
  1.1837 +            last_sample1 = sample1;
  1.1838 +            last_sample2 = sample2;
  1.1839 +            last_sample3 = sample3;
  1.1840 +            last_sample4 = sample4;
  1.1841 +            last_sample5 = sample5;
  1.1842 +            eps -= srcsize;
  1.1843 +        }
  1.1844 +    }
  1.1845 +    cvt->len_cvt = dstsize;
  1.1846 +    if (cvt->filters[++cvt->filter_index]) {
  1.1847 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1848 +    }
  1.1849 +}
  1.1850 +
  1.1851 +static void SDLCALL
  1.1852 +SDL_Upsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1853 +{
  1.1854 +#ifdef DEBUG_CONVERT
  1.1855 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr);
  1.1856 +#endif
  1.1857 +
  1.1858 +    const int srcsize = cvt->len_cvt - 256;
  1.1859 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1860 +    register int eps = 0;
  1.1861 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
  1.1862 +    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.1863 +    const Sint16 *target = ((const Sint16 *) cvt->buf) - 8;
  1.1864 +    Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7]));
  1.1865 +    Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6]));
  1.1866 +    Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
  1.1867 +    Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
  1.1868 +    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
  1.1869 +    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
  1.1870 +    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
  1.1871 +    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.1872 +    Sint16 last_sample7 = sample7;
  1.1873 +    Sint16 last_sample6 = sample6;
  1.1874 +    Sint16 last_sample5 = sample5;
  1.1875 +    Sint16 last_sample4 = sample4;
  1.1876 +    Sint16 last_sample3 = sample3;
  1.1877 +    Sint16 last_sample2 = sample2;
  1.1878 +    Sint16 last_sample1 = sample1;
  1.1879 +    Sint16 last_sample0 = sample0;
  1.1880 +    while (dst != target) {
  1.1881 +        dst[7] = ((Sint16) SDL_SwapLE16(sample7));
  1.1882 +        dst[6] = ((Sint16) SDL_SwapLE16(sample6));
  1.1883 +        dst[5] = ((Sint16) SDL_SwapLE16(sample5));
  1.1884 +        dst[4] = ((Sint16) SDL_SwapLE16(sample4));
  1.1885 +        dst[3] = ((Sint16) SDL_SwapLE16(sample3));
  1.1886 +        dst[2] = ((Sint16) SDL_SwapLE16(sample2));
  1.1887 +        dst[1] = ((Sint16) SDL_SwapLE16(sample1));
  1.1888 +        dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.1889 +        dst -= 8;
  1.1890 +        eps += srcsize;
  1.1891 +        if ((eps << 1) >= dstsize) {
  1.1892 +            src -= 8;
  1.1893 +            sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
  1.1894 +            sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
  1.1895 +            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
  1.1896 +            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
  1.1897 +            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.1898 +            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.1899 +            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.1900 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.1901 +            last_sample7 = sample7;
  1.1902 +            last_sample6 = sample6;
  1.1903 +            last_sample5 = sample5;
  1.1904 +            last_sample4 = sample4;
  1.1905 +            last_sample3 = sample3;
  1.1906 +            last_sample2 = sample2;
  1.1907 +            last_sample1 = sample1;
  1.1908 +            last_sample0 = sample0;
  1.1909 +            eps -= dstsize;
  1.1910 +        }
  1.1911 +    }
  1.1912 +    cvt->len_cvt = dstsize;
  1.1913 +    if (cvt->filters[++cvt->filter_index]) {
  1.1914 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1915 +    }
  1.1916 +}
  1.1917 +
  1.1918 +static void SDLCALL
  1.1919 +SDL_Downsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1920 +{
  1.1921 +#ifdef DEBUG_CONVERT
  1.1922 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr);
  1.1923 +#endif
  1.1924 +
  1.1925 +    const int srcsize = cvt->len_cvt - 256;
  1.1926 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1927 +    register int eps = 0;
  1.1928 +    Sint16 *dst = (Sint16 *) cvt->buf;
  1.1929 +    const Sint16 *src = (Sint16 *) cvt->buf;
  1.1930 +    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.1931 +    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.1932 +    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
  1.1933 +    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
  1.1934 +    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
  1.1935 +    Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
  1.1936 +    Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
  1.1937 +    Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6]));
  1.1938 +    Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7]));
  1.1939 +    Sint16 last_sample0 = sample0;
  1.1940 +    Sint16 last_sample1 = sample1;
  1.1941 +    Sint16 last_sample2 = sample2;
  1.1942 +    Sint16 last_sample3 = sample3;
  1.1943 +    Sint16 last_sample4 = sample4;
  1.1944 +    Sint16 last_sample5 = sample5;
  1.1945 +    Sint16 last_sample6 = sample6;
  1.1946 +    Sint16 last_sample7 = sample7;
  1.1947 +    while (dst != target) {
  1.1948 +        src += 8;
  1.1949 +        eps += dstsize;
  1.1950 +        if ((eps << 1) >= srcsize) {
  1.1951 +            dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.1952 +            dst[1] = ((Sint16) SDL_SwapLE16(sample1));
  1.1953 +            dst[2] = ((Sint16) SDL_SwapLE16(sample2));
  1.1954 +            dst[3] = ((Sint16) SDL_SwapLE16(sample3));
  1.1955 +            dst[4] = ((Sint16) SDL_SwapLE16(sample4));
  1.1956 +            dst[5] = ((Sint16) SDL_SwapLE16(sample5));
  1.1957 +            dst[6] = ((Sint16) SDL_SwapLE16(sample6));
  1.1958 +            dst[7] = ((Sint16) SDL_SwapLE16(sample7));
  1.1959 +            dst += 8;
  1.1960 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.1961 +            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.1962 +            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.1963 +            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.1964 +            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
  1.1965 +            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
  1.1966 +            sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
  1.1967 +            sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
  1.1968 +            last_sample0 = sample0;
  1.1969 +            last_sample1 = sample1;
  1.1970 +            last_sample2 = sample2;
  1.1971 +            last_sample3 = sample3;
  1.1972 +            last_sample4 = sample4;
  1.1973 +            last_sample5 = sample5;
  1.1974 +            last_sample6 = sample6;
  1.1975 +            last_sample7 = sample7;
  1.1976 +            eps -= srcsize;
  1.1977 +        }
  1.1978 +    }
  1.1979 +    cvt->len_cvt = dstsize;
  1.1980 +    if (cvt->filters[++cvt->filter_index]) {
  1.1981 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.1982 +    }
  1.1983 +}
  1.1984 +
  1.1985 +static void SDLCALL
  1.1986 +SDL_Upsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1987 +{
  1.1988 +#ifdef DEBUG_CONVERT
  1.1989 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr);
  1.1990 +#endif
  1.1991 +
  1.1992 +    const int srcsize = cvt->len_cvt - 32;
  1.1993 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.1994 +    register int eps = 0;
  1.1995 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
  1.1996 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.1997 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
  1.1998 +    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.1999 +    Uint16 last_sample0 = sample0;
  1.2000 +    while (dst != target) {
  1.2001 +        dst[0] = SDL_SwapBE16(sample0);
  1.2002 +        dst--;
  1.2003 +        eps += srcsize;
  1.2004 +        if ((eps << 1) >= dstsize) {
  1.2005 +            src--;
  1.2006 +            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.2007 +            last_sample0 = sample0;
  1.2008 +            eps -= dstsize;
  1.2009 +        }
  1.2010 +    }
  1.2011 +    cvt->len_cvt = dstsize;
  1.2012 +    if (cvt->filters[++cvt->filter_index]) {
  1.2013 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2014 +    }
  1.2015 +}
  1.2016 +
  1.2017 +static void SDLCALL
  1.2018 +SDL_Downsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2019 +{
  1.2020 +#ifdef DEBUG_CONVERT
  1.2021 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr);
  1.2022 +#endif
  1.2023 +
  1.2024 +    const int srcsize = cvt->len_cvt - 32;
  1.2025 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2026 +    register int eps = 0;
  1.2027 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.2028 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.2029 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.2030 +    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.2031 +    Uint16 last_sample0 = sample0;
  1.2032 +    while (dst != target) {
  1.2033 +        src++;
  1.2034 +        eps += dstsize;
  1.2035 +        if ((eps << 1) >= srcsize) {
  1.2036 +            dst[0] = SDL_SwapBE16(sample0);
  1.2037 +            dst++;
  1.2038 +            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.2039 +            last_sample0 = sample0;
  1.2040 +            eps -= srcsize;
  1.2041 +        }
  1.2042 +    }
  1.2043 +    cvt->len_cvt = dstsize;
  1.2044 +    if (cvt->filters[++cvt->filter_index]) {
  1.2045 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2046 +    }
  1.2047 +}
  1.2048 +
  1.2049 +static void SDLCALL
  1.2050 +SDL_Upsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2051 +{
  1.2052 +#ifdef DEBUG_CONVERT
  1.2053 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr);
  1.2054 +#endif
  1.2055 +
  1.2056 +    const int srcsize = cvt->len_cvt - 64;
  1.2057 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2058 +    register int eps = 0;
  1.2059 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
  1.2060 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.2061 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 2;
  1.2062 +    Uint16 sample1 = SDL_SwapBE16(src[1]);
  1.2063 +    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.2064 +    Uint16 last_sample1 = sample1;
  1.2065 +    Uint16 last_sample0 = sample0;
  1.2066 +    while (dst != target) {
  1.2067 +        dst[1] = SDL_SwapBE16(sample1);
  1.2068 +        dst[0] = SDL_SwapBE16(sample0);
  1.2069 +        dst -= 2;
  1.2070 +        eps += srcsize;
  1.2071 +        if ((eps << 1) >= dstsize) {
  1.2072 +            src -= 2;
  1.2073 +            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.2074 +            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.2075 +            last_sample1 = sample1;
  1.2076 +            last_sample0 = sample0;
  1.2077 +            eps -= dstsize;
  1.2078 +        }
  1.2079 +    }
  1.2080 +    cvt->len_cvt = dstsize;
  1.2081 +    if (cvt->filters[++cvt->filter_index]) {
  1.2082 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2083 +    }
  1.2084 +}
  1.2085 +
  1.2086 +static void SDLCALL
  1.2087 +SDL_Downsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2088 +{
  1.2089 +#ifdef DEBUG_CONVERT
  1.2090 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr);
  1.2091 +#endif
  1.2092 +
  1.2093 +    const int srcsize = cvt->len_cvt - 64;
  1.2094 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2095 +    register int eps = 0;
  1.2096 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.2097 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.2098 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.2099 +    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.2100 +    Uint16 sample1 = SDL_SwapBE16(src[1]);
  1.2101 +    Uint16 last_sample0 = sample0;
  1.2102 +    Uint16 last_sample1 = sample1;
  1.2103 +    while (dst != target) {
  1.2104 +        src += 2;
  1.2105 +        eps += dstsize;
  1.2106 +        if ((eps << 1) >= srcsize) {
  1.2107 +            dst[0] = SDL_SwapBE16(sample0);
  1.2108 +            dst[1] = SDL_SwapBE16(sample1);
  1.2109 +            dst += 2;
  1.2110 +            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.2111 +            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.2112 +            last_sample0 = sample0;
  1.2113 +            last_sample1 = sample1;
  1.2114 +            eps -= srcsize;
  1.2115 +        }
  1.2116 +    }
  1.2117 +    cvt->len_cvt = dstsize;
  1.2118 +    if (cvt->filters[++cvt->filter_index]) {
  1.2119 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2120 +    }
  1.2121 +}
  1.2122 +
  1.2123 +static void SDLCALL
  1.2124 +SDL_Upsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2125 +{
  1.2126 +#ifdef DEBUG_CONVERT
  1.2127 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr);
  1.2128 +#endif
  1.2129 +
  1.2130 +    const int srcsize = cvt->len_cvt - 128;
  1.2131 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2132 +    register int eps = 0;
  1.2133 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
  1.2134 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.2135 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 4;
  1.2136 +    Uint16 sample3 = SDL_SwapBE16(src[3]);
  1.2137 +    Uint16 sample2 = SDL_SwapBE16(src[2]);
  1.2138 +    Uint16 sample1 = SDL_SwapBE16(src[1]);
  1.2139 +    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.2140 +    Uint16 last_sample3 = sample3;
  1.2141 +    Uint16 last_sample2 = sample2;
  1.2142 +    Uint16 last_sample1 = sample1;
  1.2143 +    Uint16 last_sample0 = sample0;
  1.2144 +    while (dst != target) {
  1.2145 +        dst[3] = SDL_SwapBE16(sample3);
  1.2146 +        dst[2] = SDL_SwapBE16(sample2);
  1.2147 +        dst[1] = SDL_SwapBE16(sample1);
  1.2148 +        dst[0] = SDL_SwapBE16(sample0);
  1.2149 +        dst -= 4;
  1.2150 +        eps += srcsize;
  1.2151 +        if ((eps << 1) >= dstsize) {
  1.2152 +            src -= 4;
  1.2153 +            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.2154 +            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.2155 +            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.2156 +            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.2157 +            last_sample3 = sample3;
  1.2158 +            last_sample2 = sample2;
  1.2159 +            last_sample1 = sample1;
  1.2160 +            last_sample0 = sample0;
  1.2161 +            eps -= dstsize;
  1.2162 +        }
  1.2163 +    }
  1.2164 +    cvt->len_cvt = dstsize;
  1.2165 +    if (cvt->filters[++cvt->filter_index]) {
  1.2166 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2167 +    }
  1.2168 +}
  1.2169 +
  1.2170 +static void SDLCALL
  1.2171 +SDL_Downsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2172 +{
  1.2173 +#ifdef DEBUG_CONVERT
  1.2174 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr);
  1.2175 +#endif
  1.2176 +
  1.2177 +    const int srcsize = cvt->len_cvt - 128;
  1.2178 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2179 +    register int eps = 0;
  1.2180 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.2181 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.2182 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.2183 +    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.2184 +    Uint16 sample1 = SDL_SwapBE16(src[1]);
  1.2185 +    Uint16 sample2 = SDL_SwapBE16(src[2]);
  1.2186 +    Uint16 sample3 = SDL_SwapBE16(src[3]);
  1.2187 +    Uint16 last_sample0 = sample0;
  1.2188 +    Uint16 last_sample1 = sample1;
  1.2189 +    Uint16 last_sample2 = sample2;
  1.2190 +    Uint16 last_sample3 = sample3;
  1.2191 +    while (dst != target) {
  1.2192 +        src += 4;
  1.2193 +        eps += dstsize;
  1.2194 +        if ((eps << 1) >= srcsize) {
  1.2195 +            dst[0] = SDL_SwapBE16(sample0);
  1.2196 +            dst[1] = SDL_SwapBE16(sample1);
  1.2197 +            dst[2] = SDL_SwapBE16(sample2);
  1.2198 +            dst[3] = SDL_SwapBE16(sample3);
  1.2199 +            dst += 4;
  1.2200 +            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.2201 +            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.2202 +            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.2203 +            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.2204 +            last_sample0 = sample0;
  1.2205 +            last_sample1 = sample1;
  1.2206 +            last_sample2 = sample2;
  1.2207 +            last_sample3 = sample3;
  1.2208 +            eps -= srcsize;
  1.2209 +        }
  1.2210 +    }
  1.2211 +    cvt->len_cvt = dstsize;
  1.2212 +    if (cvt->filters[++cvt->filter_index]) {
  1.2213 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2214 +    }
  1.2215 +}
  1.2216 +
  1.2217 +static void SDLCALL
  1.2218 +SDL_Upsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2219 +{
  1.2220 +#ifdef DEBUG_CONVERT
  1.2221 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr);
  1.2222 +#endif
  1.2223 +
  1.2224 +    const int srcsize = cvt->len_cvt - 192;
  1.2225 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2226 +    register int eps = 0;
  1.2227 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
  1.2228 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.2229 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 6;
  1.2230 +    Uint16 sample5 = SDL_SwapBE16(src[5]);
  1.2231 +    Uint16 sample4 = SDL_SwapBE16(src[4]);
  1.2232 +    Uint16 sample3 = SDL_SwapBE16(src[3]);
  1.2233 +    Uint16 sample2 = SDL_SwapBE16(src[2]);
  1.2234 +    Uint16 sample1 = SDL_SwapBE16(src[1]);
  1.2235 +    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.2236 +    Uint16 last_sample5 = sample5;
  1.2237 +    Uint16 last_sample4 = sample4;
  1.2238 +    Uint16 last_sample3 = sample3;
  1.2239 +    Uint16 last_sample2 = sample2;
  1.2240 +    Uint16 last_sample1 = sample1;
  1.2241 +    Uint16 last_sample0 = sample0;
  1.2242 +    while (dst != target) {
  1.2243 +        dst[5] = SDL_SwapBE16(sample5);
  1.2244 +        dst[4] = SDL_SwapBE16(sample4);
  1.2245 +        dst[3] = SDL_SwapBE16(sample3);
  1.2246 +        dst[2] = SDL_SwapBE16(sample2);
  1.2247 +        dst[1] = SDL_SwapBE16(sample1);
  1.2248 +        dst[0] = SDL_SwapBE16(sample0);
  1.2249 +        dst -= 6;
  1.2250 +        eps += srcsize;
  1.2251 +        if ((eps << 1) >= dstsize) {
  1.2252 +            src -= 6;
  1.2253 +            sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
  1.2254 +            sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
  1.2255 +            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.2256 +            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.2257 +            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.2258 +            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.2259 +            last_sample5 = sample5;
  1.2260 +            last_sample4 = sample4;
  1.2261 +            last_sample3 = sample3;
  1.2262 +            last_sample2 = sample2;
  1.2263 +            last_sample1 = sample1;
  1.2264 +            last_sample0 = sample0;
  1.2265 +            eps -= dstsize;
  1.2266 +        }
  1.2267 +    }
  1.2268 +    cvt->len_cvt = dstsize;
  1.2269 +    if (cvt->filters[++cvt->filter_index]) {
  1.2270 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2271 +    }
  1.2272 +}
  1.2273 +
  1.2274 +static void SDLCALL
  1.2275 +SDL_Downsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2276 +{
  1.2277 +#ifdef DEBUG_CONVERT
  1.2278 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr);
  1.2279 +#endif
  1.2280 +
  1.2281 +    const int srcsize = cvt->len_cvt - 192;
  1.2282 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2283 +    register int eps = 0;
  1.2284 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.2285 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.2286 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.2287 +    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.2288 +    Uint16 sample1 = SDL_SwapBE16(src[1]);
  1.2289 +    Uint16 sample2 = SDL_SwapBE16(src[2]);
  1.2290 +    Uint16 sample3 = SDL_SwapBE16(src[3]);
  1.2291 +    Uint16 sample4 = SDL_SwapBE16(src[4]);
  1.2292 +    Uint16 sample5 = SDL_SwapBE16(src[5]);
  1.2293 +    Uint16 last_sample0 = sample0;
  1.2294 +    Uint16 last_sample1 = sample1;
  1.2295 +    Uint16 last_sample2 = sample2;
  1.2296 +    Uint16 last_sample3 = sample3;
  1.2297 +    Uint16 last_sample4 = sample4;
  1.2298 +    Uint16 last_sample5 = sample5;
  1.2299 +    while (dst != target) {
  1.2300 +        src += 6;
  1.2301 +        eps += dstsize;
  1.2302 +        if ((eps << 1) >= srcsize) {
  1.2303 +            dst[0] = SDL_SwapBE16(sample0);
  1.2304 +            dst[1] = SDL_SwapBE16(sample1);
  1.2305 +            dst[2] = SDL_SwapBE16(sample2);
  1.2306 +            dst[3] = SDL_SwapBE16(sample3);
  1.2307 +            dst[4] = SDL_SwapBE16(sample4);
  1.2308 +            dst[5] = SDL_SwapBE16(sample5);
  1.2309 +            dst += 6;
  1.2310 +            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.2311 +            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.2312 +            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.2313 +            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.2314 +            sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
  1.2315 +            sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
  1.2316 +            last_sample0 = sample0;
  1.2317 +            last_sample1 = sample1;
  1.2318 +            last_sample2 = sample2;
  1.2319 +            last_sample3 = sample3;
  1.2320 +            last_sample4 = sample4;
  1.2321 +            last_sample5 = sample5;
  1.2322 +            eps -= srcsize;
  1.2323 +        }
  1.2324 +    }
  1.2325 +    cvt->len_cvt = dstsize;
  1.2326 +    if (cvt->filters[++cvt->filter_index]) {
  1.2327 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2328 +    }
  1.2329 +}
  1.2330 +
  1.2331 +static void SDLCALL
  1.2332 +SDL_Upsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2333 +{
  1.2334 +#ifdef DEBUG_CONVERT
  1.2335 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr);
  1.2336 +#endif
  1.2337 +
  1.2338 +    const int srcsize = cvt->len_cvt - 256;
  1.2339 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2340 +    register int eps = 0;
  1.2341 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
  1.2342 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.2343 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 8;
  1.2344 +    Uint16 sample7 = SDL_SwapBE16(src[7]);
  1.2345 +    Uint16 sample6 = SDL_SwapBE16(src[6]);
  1.2346 +    Uint16 sample5 = SDL_SwapBE16(src[5]);
  1.2347 +    Uint16 sample4 = SDL_SwapBE16(src[4]);
  1.2348 +    Uint16 sample3 = SDL_SwapBE16(src[3]);
  1.2349 +    Uint16 sample2 = SDL_SwapBE16(src[2]);
  1.2350 +    Uint16 sample1 = SDL_SwapBE16(src[1]);
  1.2351 +    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.2352 +    Uint16 last_sample7 = sample7;
  1.2353 +    Uint16 last_sample6 = sample6;
  1.2354 +    Uint16 last_sample5 = sample5;
  1.2355 +    Uint16 last_sample4 = sample4;
  1.2356 +    Uint16 last_sample3 = sample3;
  1.2357 +    Uint16 last_sample2 = sample2;
  1.2358 +    Uint16 last_sample1 = sample1;
  1.2359 +    Uint16 last_sample0 = sample0;
  1.2360 +    while (dst != target) {
  1.2361 +        dst[7] = SDL_SwapBE16(sample7);
  1.2362 +        dst[6] = SDL_SwapBE16(sample6);
  1.2363 +        dst[5] = SDL_SwapBE16(sample5);
  1.2364 +        dst[4] = SDL_SwapBE16(sample4);
  1.2365 +        dst[3] = SDL_SwapBE16(sample3);
  1.2366 +        dst[2] = SDL_SwapBE16(sample2);
  1.2367 +        dst[1] = SDL_SwapBE16(sample1);
  1.2368 +        dst[0] = SDL_SwapBE16(sample0);
  1.2369 +        dst -= 8;
  1.2370 +        eps += srcsize;
  1.2371 +        if ((eps << 1) >= dstsize) {
  1.2372 +            src -= 8;
  1.2373 +            sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1);
  1.2374 +            sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1);
  1.2375 +            sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
  1.2376 +            sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
  1.2377 +            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.2378 +            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.2379 +            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.2380 +            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.2381 +            last_sample7 = sample7;
  1.2382 +            last_sample6 = sample6;
  1.2383 +            last_sample5 = sample5;
  1.2384 +            last_sample4 = sample4;
  1.2385 +            last_sample3 = sample3;
  1.2386 +            last_sample2 = sample2;
  1.2387 +            last_sample1 = sample1;
  1.2388 +            last_sample0 = sample0;
  1.2389 +            eps -= dstsize;
  1.2390 +        }
  1.2391 +    }
  1.2392 +    cvt->len_cvt = dstsize;
  1.2393 +    if (cvt->filters[++cvt->filter_index]) {
  1.2394 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2395 +    }
  1.2396 +}
  1.2397 +
  1.2398 +static void SDLCALL
  1.2399 +SDL_Downsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2400 +{
  1.2401 +#ifdef DEBUG_CONVERT
  1.2402 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr);
  1.2403 +#endif
  1.2404 +
  1.2405 +    const int srcsize = cvt->len_cvt - 256;
  1.2406 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2407 +    register int eps = 0;
  1.2408 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.2409 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.2410 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.2411 +    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.2412 +    Uint16 sample1 = SDL_SwapBE16(src[1]);
  1.2413 +    Uint16 sample2 = SDL_SwapBE16(src[2]);
  1.2414 +    Uint16 sample3 = SDL_SwapBE16(src[3]);
  1.2415 +    Uint16 sample4 = SDL_SwapBE16(src[4]);
  1.2416 +    Uint16 sample5 = SDL_SwapBE16(src[5]);
  1.2417 +    Uint16 sample6 = SDL_SwapBE16(src[6]);
  1.2418 +    Uint16 sample7 = SDL_SwapBE16(src[7]);
  1.2419 +    Uint16 last_sample0 = sample0;
  1.2420 +    Uint16 last_sample1 = sample1;
  1.2421 +    Uint16 last_sample2 = sample2;
  1.2422 +    Uint16 last_sample3 = sample3;
  1.2423 +    Uint16 last_sample4 = sample4;
  1.2424 +    Uint16 last_sample5 = sample5;
  1.2425 +    Uint16 last_sample6 = sample6;
  1.2426 +    Uint16 last_sample7 = sample7;
  1.2427 +    while (dst != target) {
  1.2428 +        src += 8;
  1.2429 +        eps += dstsize;
  1.2430 +        if ((eps << 1) >= srcsize) {
  1.2431 +            dst[0] = SDL_SwapBE16(sample0);
  1.2432 +            dst[1] = SDL_SwapBE16(sample1);
  1.2433 +            dst[2] = SDL_SwapBE16(sample2);
  1.2434 +            dst[3] = SDL_SwapBE16(sample3);
  1.2435 +            dst[4] = SDL_SwapBE16(sample4);
  1.2436 +            dst[5] = SDL_SwapBE16(sample5);
  1.2437 +            dst[6] = SDL_SwapBE16(sample6);
  1.2438 +            dst[7] = SDL_SwapBE16(sample7);
  1.2439 +            dst += 8;
  1.2440 +            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.2441 +            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.2442 +            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.2443 +            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.2444 +            sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
  1.2445 +            sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
  1.2446 +            sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1);
  1.2447 +            sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1);
  1.2448 +            last_sample0 = sample0;
  1.2449 +            last_sample1 = sample1;
  1.2450 +            last_sample2 = sample2;
  1.2451 +            last_sample3 = sample3;
  1.2452 +            last_sample4 = sample4;
  1.2453 +            last_sample5 = sample5;
  1.2454 +            last_sample6 = sample6;
  1.2455 +            last_sample7 = sample7;
  1.2456 +            eps -= srcsize;
  1.2457 +        }
  1.2458 +    }
  1.2459 +    cvt->len_cvt = dstsize;
  1.2460 +    if (cvt->filters[++cvt->filter_index]) {
  1.2461 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2462 +    }
  1.2463 +}
  1.2464 +
  1.2465 +static void SDLCALL
  1.2466 +SDL_Upsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2467 +{
  1.2468 +#ifdef DEBUG_CONVERT
  1.2469 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr);
  1.2470 +#endif
  1.2471 +
  1.2472 +    const int srcsize = cvt->len_cvt - 32;
  1.2473 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2474 +    register int eps = 0;
  1.2475 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
  1.2476 +    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.2477 +    const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
  1.2478 +    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.2479 +    Sint16 last_sample0 = sample0;
  1.2480 +    while (dst != target) {
  1.2481 +        dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.2482 +        dst--;
  1.2483 +        eps += srcsize;
  1.2484 +        if ((eps << 1) >= dstsize) {
  1.2485 +            src--;
  1.2486 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.2487 +            last_sample0 = sample0;
  1.2488 +            eps -= dstsize;
  1.2489 +        }
  1.2490 +    }
  1.2491 +    cvt->len_cvt = dstsize;
  1.2492 +    if (cvt->filters[++cvt->filter_index]) {
  1.2493 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2494 +    }
  1.2495 +}
  1.2496 +
  1.2497 +static void SDLCALL
  1.2498 +SDL_Downsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2499 +{
  1.2500 +#ifdef DEBUG_CONVERT
  1.2501 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr);
  1.2502 +#endif
  1.2503 +
  1.2504 +    const int srcsize = cvt->len_cvt - 32;
  1.2505 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2506 +    register int eps = 0;
  1.2507 +    Sint16 *dst = (Sint16 *) cvt->buf;
  1.2508 +    const Sint16 *src = (Sint16 *) cvt->buf;
  1.2509 +    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.2510 +    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.2511 +    Sint16 last_sample0 = sample0;
  1.2512 +    while (dst != target) {
  1.2513 +        src++;
  1.2514 +        eps += dstsize;
  1.2515 +        if ((eps << 1) >= srcsize) {
  1.2516 +            dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.2517 +            dst++;
  1.2518 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.2519 +            last_sample0 = sample0;
  1.2520 +            eps -= srcsize;
  1.2521 +        }
  1.2522 +    }
  1.2523 +    cvt->len_cvt = dstsize;
  1.2524 +    if (cvt->filters[++cvt->filter_index]) {
  1.2525 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2526 +    }
  1.2527 +}
  1.2528 +
  1.2529 +static void SDLCALL
  1.2530 +SDL_Upsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2531 +{
  1.2532 +#ifdef DEBUG_CONVERT
  1.2533 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr);
  1.2534 +#endif
  1.2535 +
  1.2536 +    const int srcsize = cvt->len_cvt - 64;
  1.2537 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2538 +    register int eps = 0;
  1.2539 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
  1.2540 +    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.2541 +    const Sint16 *target = ((const Sint16 *) cvt->buf) - 2;
  1.2542 +    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
  1.2543 +    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.2544 +    Sint16 last_sample1 = sample1;
  1.2545 +    Sint16 last_sample0 = sample0;
  1.2546 +    while (dst != target) {
  1.2547 +        dst[1] = ((Sint16) SDL_SwapBE16(sample1));
  1.2548 +        dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.2549 +        dst -= 2;
  1.2550 +        eps += srcsize;
  1.2551 +        if ((eps << 1) >= dstsize) {
  1.2552 +            src -= 2;
  1.2553 +            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.2554 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.2555 +            last_sample1 = sample1;
  1.2556 +            last_sample0 = sample0;
  1.2557 +            eps -= dstsize;
  1.2558 +        }
  1.2559 +    }
  1.2560 +    cvt->len_cvt = dstsize;
  1.2561 +    if (cvt->filters[++cvt->filter_index]) {
  1.2562 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2563 +    }
  1.2564 +}
  1.2565 +
  1.2566 +static void SDLCALL
  1.2567 +SDL_Downsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2568 +{
  1.2569 +#ifdef DEBUG_CONVERT
  1.2570 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr);
  1.2571 +#endif
  1.2572 +
  1.2573 +    const int srcsize = cvt->len_cvt - 64;
  1.2574 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2575 +    register int eps = 0;
  1.2576 +    Sint16 *dst = (Sint16 *) cvt->buf;
  1.2577 +    const Sint16 *src = (Sint16 *) cvt->buf;
  1.2578 +    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.2579 +    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.2580 +    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
  1.2581 +    Sint16 last_sample0 = sample0;
  1.2582 +    Sint16 last_sample1 = sample1;
  1.2583 +    while (dst != target) {
  1.2584 +        src += 2;
  1.2585 +        eps += dstsize;
  1.2586 +        if ((eps << 1) >= srcsize) {
  1.2587 +            dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.2588 +            dst[1] = ((Sint16) SDL_SwapBE16(sample1));
  1.2589 +            dst += 2;
  1.2590 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.2591 +            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.2592 +            last_sample0 = sample0;
  1.2593 +            last_sample1 = sample1;
  1.2594 +            eps -= srcsize;
  1.2595 +        }
  1.2596 +    }
  1.2597 +    cvt->len_cvt = dstsize;
  1.2598 +    if (cvt->filters[++cvt->filter_index]) {
  1.2599 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2600 +    }
  1.2601 +}
  1.2602 +
  1.2603 +static void SDLCALL
  1.2604 +SDL_Upsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2605 +{
  1.2606 +#ifdef DEBUG_CONVERT
  1.2607 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr);
  1.2608 +#endif
  1.2609 +
  1.2610 +    const int srcsize = cvt->len_cvt - 128;
  1.2611 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2612 +    register int eps = 0;
  1.2613 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
  1.2614 +    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.2615 +    const Sint16 *target = ((const Sint16 *) cvt->buf) - 4;
  1.2616 +    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
  1.2617 +    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
  1.2618 +    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
  1.2619 +    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.2620 +    Sint16 last_sample3 = sample3;
  1.2621 +    Sint16 last_sample2 = sample2;
  1.2622 +    Sint16 last_sample1 = sample1;
  1.2623 +    Sint16 last_sample0 = sample0;
  1.2624 +    while (dst != target) {
  1.2625 +        dst[3] = ((Sint16) SDL_SwapBE16(sample3));
  1.2626 +        dst[2] = ((Sint16) SDL_SwapBE16(sample2));
  1.2627 +        dst[1] = ((Sint16) SDL_SwapBE16(sample1));
  1.2628 +        dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.2629 +        dst -= 4;
  1.2630 +        eps += srcsize;
  1.2631 +        if ((eps << 1) >= dstsize) {
  1.2632 +            src -= 4;
  1.2633 +            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.2634 +            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.2635 +            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.2636 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.2637 +            last_sample3 = sample3;
  1.2638 +            last_sample2 = sample2;
  1.2639 +            last_sample1 = sample1;
  1.2640 +            last_sample0 = sample0;
  1.2641 +            eps -= dstsize;
  1.2642 +        }
  1.2643 +    }
  1.2644 +    cvt->len_cvt = dstsize;
  1.2645 +    if (cvt->filters[++cvt->filter_index]) {
  1.2646 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2647 +    }
  1.2648 +}
  1.2649 +
  1.2650 +static void SDLCALL
  1.2651 +SDL_Downsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2652 +{
  1.2653 +#ifdef DEBUG_CONVERT
  1.2654 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr);
  1.2655 +#endif
  1.2656 +
  1.2657 +    const int srcsize = cvt->len_cvt - 128;
  1.2658 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2659 +    register int eps = 0;
  1.2660 +    Sint16 *dst = (Sint16 *) cvt->buf;
  1.2661 +    const Sint16 *src = (Sint16 *) cvt->buf;
  1.2662 +    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.2663 +    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.2664 +    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
  1.2665 +    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
  1.2666 +    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
  1.2667 +    Sint16 last_sample0 = sample0;
  1.2668 +    Sint16 last_sample1 = sample1;
  1.2669 +    Sint16 last_sample2 = sample2;
  1.2670 +    Sint16 last_sample3 = sample3;
  1.2671 +    while (dst != target) {
  1.2672 +        src += 4;
  1.2673 +        eps += dstsize;
  1.2674 +        if ((eps << 1) >= srcsize) {
  1.2675 +            dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.2676 +            dst[1] = ((Sint16) SDL_SwapBE16(sample1));
  1.2677 +            dst[2] = ((Sint16) SDL_SwapBE16(sample2));
  1.2678 +            dst[3] = ((Sint16) SDL_SwapBE16(sample3));
  1.2679 +            dst += 4;
  1.2680 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.2681 +            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.2682 +            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.2683 +            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.2684 +            last_sample0 = sample0;
  1.2685 +            last_sample1 = sample1;
  1.2686 +            last_sample2 = sample2;
  1.2687 +            last_sample3 = sample3;
  1.2688 +            eps -= srcsize;
  1.2689 +        }
  1.2690 +    }
  1.2691 +    cvt->len_cvt = dstsize;
  1.2692 +    if (cvt->filters[++cvt->filter_index]) {
  1.2693 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2694 +    }
  1.2695 +}
  1.2696 +
  1.2697 +static void SDLCALL
  1.2698 +SDL_Upsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2699 +{
  1.2700 +#ifdef DEBUG_CONVERT
  1.2701 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr);
  1.2702 +#endif
  1.2703 +
  1.2704 +    const int srcsize = cvt->len_cvt - 192;
  1.2705 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2706 +    register int eps = 0;
  1.2707 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
  1.2708 +    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.2709 +    const Sint16 *target = ((const Sint16 *) cvt->buf) - 6;
  1.2710 +    Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
  1.2711 +    Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
  1.2712 +    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
  1.2713 +    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
  1.2714 +    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
  1.2715 +    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.2716 +    Sint16 last_sample5 = sample5;
  1.2717 +    Sint16 last_sample4 = sample4;
  1.2718 +    Sint16 last_sample3 = sample3;
  1.2719 +    Sint16 last_sample2 = sample2;
  1.2720 +    Sint16 last_sample1 = sample1;
  1.2721 +    Sint16 last_sample0 = sample0;
  1.2722 +    while (dst != target) {
  1.2723 +        dst[5] = ((Sint16) SDL_SwapBE16(sample5));
  1.2724 +        dst[4] = ((Sint16) SDL_SwapBE16(sample4));
  1.2725 +        dst[3] = ((Sint16) SDL_SwapBE16(sample3));
  1.2726 +        dst[2] = ((Sint16) SDL_SwapBE16(sample2));
  1.2727 +        dst[1] = ((Sint16) SDL_SwapBE16(sample1));
  1.2728 +        dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.2729 +        dst -= 6;
  1.2730 +        eps += srcsize;
  1.2731 +        if ((eps << 1) >= dstsize) {
  1.2732 +            src -= 6;
  1.2733 +            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
  1.2734 +            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
  1.2735 +            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.2736 +            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.2737 +            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.2738 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.2739 +            last_sample5 = sample5;
  1.2740 +            last_sample4 = sample4;
  1.2741 +            last_sample3 = sample3;
  1.2742 +            last_sample2 = sample2;
  1.2743 +            last_sample1 = sample1;
  1.2744 +            last_sample0 = sample0;
  1.2745 +            eps -= dstsize;
  1.2746 +        }
  1.2747 +    }
  1.2748 +    cvt->len_cvt = dstsize;
  1.2749 +    if (cvt->filters[++cvt->filter_index]) {
  1.2750 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2751 +    }
  1.2752 +}
  1.2753 +
  1.2754 +static void SDLCALL
  1.2755 +SDL_Downsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2756 +{
  1.2757 +#ifdef DEBUG_CONVERT
  1.2758 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr);
  1.2759 +#endif
  1.2760 +
  1.2761 +    const int srcsize = cvt->len_cvt - 192;
  1.2762 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2763 +    register int eps = 0;
  1.2764 +    Sint16 *dst = (Sint16 *) cvt->buf;
  1.2765 +    const Sint16 *src = (Sint16 *) cvt->buf;
  1.2766 +    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.2767 +    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.2768 +    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
  1.2769 +    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
  1.2770 +    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
  1.2771 +    Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
  1.2772 +    Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
  1.2773 +    Sint16 last_sample0 = sample0;
  1.2774 +    Sint16 last_sample1 = sample1;
  1.2775 +    Sint16 last_sample2 = sample2;
  1.2776 +    Sint16 last_sample3 = sample3;
  1.2777 +    Sint16 last_sample4 = sample4;
  1.2778 +    Sint16 last_sample5 = sample5;
  1.2779 +    while (dst != target) {
  1.2780 +        src += 6;
  1.2781 +        eps += dstsize;
  1.2782 +        if ((eps << 1) >= srcsize) {
  1.2783 +            dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.2784 +            dst[1] = ((Sint16) SDL_SwapBE16(sample1));
  1.2785 +            dst[2] = ((Sint16) SDL_SwapBE16(sample2));
  1.2786 +            dst[3] = ((Sint16) SDL_SwapBE16(sample3));
  1.2787 +            dst[4] = ((Sint16) SDL_SwapBE16(sample4));
  1.2788 +            dst[5] = ((Sint16) SDL_SwapBE16(sample5));
  1.2789 +            dst += 6;
  1.2790 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.2791 +            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.2792 +            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.2793 +            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.2794 +            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
  1.2795 +            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
  1.2796 +            last_sample0 = sample0;
  1.2797 +            last_sample1 = sample1;
  1.2798 +            last_sample2 = sample2;
  1.2799 +            last_sample3 = sample3;
  1.2800 +            last_sample4 = sample4;
  1.2801 +            last_sample5 = sample5;
  1.2802 +            eps -= srcsize;
  1.2803 +        }
  1.2804 +    }
  1.2805 +    cvt->len_cvt = dstsize;
  1.2806 +    if (cvt->filters[++cvt->filter_index]) {
  1.2807 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2808 +    }
  1.2809 +}
  1.2810 +
  1.2811 +static void SDLCALL
  1.2812 +SDL_Upsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2813 +{
  1.2814 +#ifdef DEBUG_CONVERT
  1.2815 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr);
  1.2816 +#endif
  1.2817 +
  1.2818 +    const int srcsize = cvt->len_cvt - 256;
  1.2819 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2820 +    register int eps = 0;
  1.2821 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
  1.2822 +    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.2823 +    const Sint16 *target = ((const Sint16 *) cvt->buf) - 8;
  1.2824 +    Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7]));
  1.2825 +    Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6]));
  1.2826 +    Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
  1.2827 +    Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
  1.2828 +    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
  1.2829 +    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
  1.2830 +    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
  1.2831 +    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.2832 +    Sint16 last_sample7 = sample7;
  1.2833 +    Sint16 last_sample6 = sample6;
  1.2834 +    Sint16 last_sample5 = sample5;
  1.2835 +    Sint16 last_sample4 = sample4;
  1.2836 +    Sint16 last_sample3 = sample3;
  1.2837 +    Sint16 last_sample2 = sample2;
  1.2838 +    Sint16 last_sample1 = sample1;
  1.2839 +    Sint16 last_sample0 = sample0;
  1.2840 +    while (dst != target) {
  1.2841 +        dst[7] = ((Sint16) SDL_SwapBE16(sample7));
  1.2842 +        dst[6] = ((Sint16) SDL_SwapBE16(sample6));
  1.2843 +        dst[5] = ((Sint16) SDL_SwapBE16(sample5));
  1.2844 +        dst[4] = ((Sint16) SDL_SwapBE16(sample4));
  1.2845 +        dst[3] = ((Sint16) SDL_SwapBE16(sample3));
  1.2846 +        dst[2] = ((Sint16) SDL_SwapBE16(sample2));
  1.2847 +        dst[1] = ((Sint16) SDL_SwapBE16(sample1));
  1.2848 +        dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.2849 +        dst -= 8;
  1.2850 +        eps += srcsize;
  1.2851 +        if ((eps << 1) >= dstsize) {
  1.2852 +            src -= 8;
  1.2853 +            sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
  1.2854 +            sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
  1.2855 +            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
  1.2856 +            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
  1.2857 +            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.2858 +            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.2859 +            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.2860 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.2861 +            last_sample7 = sample7;
  1.2862 +            last_sample6 = sample6;
  1.2863 +            last_sample5 = sample5;
  1.2864 +            last_sample4 = sample4;
  1.2865 +            last_sample3 = sample3;
  1.2866 +            last_sample2 = sample2;
  1.2867 +            last_sample1 = sample1;
  1.2868 +            last_sample0 = sample0;
  1.2869 +            eps -= dstsize;
  1.2870 +        }
  1.2871 +    }
  1.2872 +    cvt->len_cvt = dstsize;
  1.2873 +    if (cvt->filters[++cvt->filter_index]) {
  1.2874 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2875 +    }
  1.2876 +}
  1.2877 +
  1.2878 +static void SDLCALL
  1.2879 +SDL_Downsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2880 +{
  1.2881 +#ifdef DEBUG_CONVERT
  1.2882 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr);
  1.2883 +#endif
  1.2884 +
  1.2885 +    const int srcsize = cvt->len_cvt - 256;
  1.2886 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2887 +    register int eps = 0;
  1.2888 +    Sint16 *dst = (Sint16 *) cvt->buf;
  1.2889 +    const Sint16 *src = (Sint16 *) cvt->buf;
  1.2890 +    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.2891 +    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.2892 +    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
  1.2893 +    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
  1.2894 +    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
  1.2895 +    Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
  1.2896 +    Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
  1.2897 +    Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6]));
  1.2898 +    Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7]));
  1.2899 +    Sint16 last_sample0 = sample0;
  1.2900 +    Sint16 last_sample1 = sample1;
  1.2901 +    Sint16 last_sample2 = sample2;
  1.2902 +    Sint16 last_sample3 = sample3;
  1.2903 +    Sint16 last_sample4 = sample4;
  1.2904 +    Sint16 last_sample5 = sample5;
  1.2905 +    Sint16 last_sample6 = sample6;
  1.2906 +    Sint16 last_sample7 = sample7;
  1.2907 +    while (dst != target) {
  1.2908 +        src += 8;
  1.2909 +        eps += dstsize;
  1.2910 +        if ((eps << 1) >= srcsize) {
  1.2911 +            dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.2912 +            dst[1] = ((Sint16) SDL_SwapBE16(sample1));
  1.2913 +            dst[2] = ((Sint16) SDL_SwapBE16(sample2));
  1.2914 +            dst[3] = ((Sint16) SDL_SwapBE16(sample3));
  1.2915 +            dst[4] = ((Sint16) SDL_SwapBE16(sample4));
  1.2916 +            dst[5] = ((Sint16) SDL_SwapBE16(sample5));
  1.2917 +            dst[6] = ((Sint16) SDL_SwapBE16(sample6));
  1.2918 +            dst[7] = ((Sint16) SDL_SwapBE16(sample7));
  1.2919 +            dst += 8;
  1.2920 +            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.2921 +            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.2922 +            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.2923 +            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.2924 +            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
  1.2925 +            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
  1.2926 +            sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
  1.2927 +            sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
  1.2928 +            last_sample0 = sample0;
  1.2929 +            last_sample1 = sample1;
  1.2930 +            last_sample2 = sample2;
  1.2931 +            last_sample3 = sample3;
  1.2932 +            last_sample4 = sample4;
  1.2933 +            last_sample5 = sample5;
  1.2934 +            last_sample6 = sample6;
  1.2935 +            last_sample7 = sample7;
  1.2936 +            eps -= srcsize;
  1.2937 +        }
  1.2938 +    }
  1.2939 +    cvt->len_cvt = dstsize;
  1.2940 +    if (cvt->filters[++cvt->filter_index]) {
  1.2941 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2942 +    }
  1.2943 +}
  1.2944 +
  1.2945 +static void SDLCALL
  1.2946 +SDL_Upsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2947 +{
  1.2948 +#ifdef DEBUG_CONVERT
  1.2949 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr);
  1.2950 +#endif
  1.2951 +
  1.2952 +    const int srcsize = cvt->len_cvt - 64;
  1.2953 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2954 +    register int eps = 0;
  1.2955 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
  1.2956 +    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.2957 +    const Sint32 *target = ((const Sint32 *) cvt->buf) - 1;
  1.2958 +    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.2959 +    Sint32 last_sample0 = sample0;
  1.2960 +    while (dst != target) {
  1.2961 +        dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.2962 +        dst--;
  1.2963 +        eps += srcsize;
  1.2964 +        if ((eps << 1) >= dstsize) {
  1.2965 +            src--;
  1.2966 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.2967 +            last_sample0 = sample0;
  1.2968 +            eps -= dstsize;
  1.2969 +        }
  1.2970 +    }
  1.2971 +    cvt->len_cvt = dstsize;
  1.2972 +    if (cvt->filters[++cvt->filter_index]) {
  1.2973 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.2974 +    }
  1.2975 +}
  1.2976 +
  1.2977 +static void SDLCALL
  1.2978 +SDL_Downsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2979 +{
  1.2980 +#ifdef DEBUG_CONVERT
  1.2981 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr);
  1.2982 +#endif
  1.2983 +
  1.2984 +    const int srcsize = cvt->len_cvt - 64;
  1.2985 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.2986 +    register int eps = 0;
  1.2987 +    Sint32 *dst = (Sint32 *) cvt->buf;
  1.2988 +    const Sint32 *src = (Sint32 *) cvt->buf;
  1.2989 +    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.2990 +    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.2991 +    Sint32 last_sample0 = sample0;
  1.2992 +    while (dst != target) {
  1.2993 +        src++;
  1.2994 +        eps += dstsize;
  1.2995 +        if ((eps << 1) >= srcsize) {
  1.2996 +            dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.2997 +            dst++;
  1.2998 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.2999 +            last_sample0 = sample0;
  1.3000 +            eps -= srcsize;
  1.3001 +        }
  1.3002 +    }
  1.3003 +    cvt->len_cvt = dstsize;
  1.3004 +    if (cvt->filters[++cvt->filter_index]) {
  1.3005 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3006 +    }
  1.3007 +}
  1.3008 +
  1.3009 +static void SDLCALL
  1.3010 +SDL_Upsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3011 +{
  1.3012 +#ifdef DEBUG_CONVERT
  1.3013 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr);
  1.3014 +#endif
  1.3015 +
  1.3016 +    const int srcsize = cvt->len_cvt - 128;
  1.3017 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3018 +    register int eps = 0;
  1.3019 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
  1.3020 +    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.3021 +    const Sint32 *target = ((const Sint32 *) cvt->buf) - 2;
  1.3022 +    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
  1.3023 +    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.3024 +    Sint32 last_sample1 = sample1;
  1.3025 +    Sint32 last_sample0 = sample0;
  1.3026 +    while (dst != target) {
  1.3027 +        dst[1] = ((Sint32) SDL_SwapLE32(sample1));
  1.3028 +        dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.3029 +        dst -= 2;
  1.3030 +        eps += srcsize;
  1.3031 +        if ((eps << 1) >= dstsize) {
  1.3032 +            src -= 2;
  1.3033 +            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.3034 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3035 +            last_sample1 = sample1;
  1.3036 +            last_sample0 = sample0;
  1.3037 +            eps -= dstsize;
  1.3038 +        }
  1.3039 +    }
  1.3040 +    cvt->len_cvt = dstsize;
  1.3041 +    if (cvt->filters[++cvt->filter_index]) {
  1.3042 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3043 +    }
  1.3044 +}
  1.3045 +
  1.3046 +static void SDLCALL
  1.3047 +SDL_Downsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3048 +{
  1.3049 +#ifdef DEBUG_CONVERT
  1.3050 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr);
  1.3051 +#endif
  1.3052 +
  1.3053 +    const int srcsize = cvt->len_cvt - 128;
  1.3054 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3055 +    register int eps = 0;
  1.3056 +    Sint32 *dst = (Sint32 *) cvt->buf;
  1.3057 +    const Sint32 *src = (Sint32 *) cvt->buf;
  1.3058 +    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.3059 +    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.3060 +    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
  1.3061 +    Sint32 last_sample0 = sample0;
  1.3062 +    Sint32 last_sample1 = sample1;
  1.3063 +    while (dst != target) {
  1.3064 +        src += 2;
  1.3065 +        eps += dstsize;
  1.3066 +        if ((eps << 1) >= srcsize) {
  1.3067 +            dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.3068 +            dst[1] = ((Sint32) SDL_SwapLE32(sample1));
  1.3069 +            dst += 2;
  1.3070 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3071 +            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.3072 +            last_sample0 = sample0;
  1.3073 +            last_sample1 = sample1;
  1.3074 +            eps -= srcsize;
  1.3075 +        }
  1.3076 +    }
  1.3077 +    cvt->len_cvt = dstsize;
  1.3078 +    if (cvt->filters[++cvt->filter_index]) {
  1.3079 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3080 +    }
  1.3081 +}
  1.3082 +
  1.3083 +static void SDLCALL
  1.3084 +SDL_Upsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3085 +{
  1.3086 +#ifdef DEBUG_CONVERT
  1.3087 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr);
  1.3088 +#endif
  1.3089 +
  1.3090 +    const int srcsize = cvt->len_cvt - 256;
  1.3091 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3092 +    register int eps = 0;
  1.3093 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
  1.3094 +    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.3095 +    const Sint32 *target = ((const Sint32 *) cvt->buf) - 4;
  1.3096 +    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
  1.3097 +    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
  1.3098 +    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
  1.3099 +    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.3100 +    Sint32 last_sample3 = sample3;
  1.3101 +    Sint32 last_sample2 = sample2;
  1.3102 +    Sint32 last_sample1 = sample1;
  1.3103 +    Sint32 last_sample0 = sample0;
  1.3104 +    while (dst != target) {
  1.3105 +        dst[3] = ((Sint32) SDL_SwapLE32(sample3));
  1.3106 +        dst[2] = ((Sint32) SDL_SwapLE32(sample2));
  1.3107 +        dst[1] = ((Sint32) SDL_SwapLE32(sample1));
  1.3108 +        dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.3109 +        dst -= 4;
  1.3110 +        eps += srcsize;
  1.3111 +        if ((eps << 1) >= dstsize) {
  1.3112 +            src -= 4;
  1.3113 +            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.3114 +            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.3115 +            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.3116 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3117 +            last_sample3 = sample3;
  1.3118 +            last_sample2 = sample2;
  1.3119 +            last_sample1 = sample1;
  1.3120 +            last_sample0 = sample0;
  1.3121 +            eps -= dstsize;
  1.3122 +        }
  1.3123 +    }
  1.3124 +    cvt->len_cvt = dstsize;
  1.3125 +    if (cvt->filters[++cvt->filter_index]) {
  1.3126 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3127 +    }
  1.3128 +}
  1.3129 +
  1.3130 +static void SDLCALL
  1.3131 +SDL_Downsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3132 +{
  1.3133 +#ifdef DEBUG_CONVERT
  1.3134 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr);
  1.3135 +#endif
  1.3136 +
  1.3137 +    const int srcsize = cvt->len_cvt - 256;
  1.3138 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3139 +    register int eps = 0;
  1.3140 +    Sint32 *dst = (Sint32 *) cvt->buf;
  1.3141 +    const Sint32 *src = (Sint32 *) cvt->buf;
  1.3142 +    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.3143 +    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.3144 +    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
  1.3145 +    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
  1.3146 +    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
  1.3147 +    Sint32 last_sample0 = sample0;
  1.3148 +    Sint32 last_sample1 = sample1;
  1.3149 +    Sint32 last_sample2 = sample2;
  1.3150 +    Sint32 last_sample3 = sample3;
  1.3151 +    while (dst != target) {
  1.3152 +        src += 4;
  1.3153 +        eps += dstsize;
  1.3154 +        if ((eps << 1) >= srcsize) {
  1.3155 +            dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.3156 +            dst[1] = ((Sint32) SDL_SwapLE32(sample1));
  1.3157 +            dst[2] = ((Sint32) SDL_SwapLE32(sample2));
  1.3158 +            dst[3] = ((Sint32) SDL_SwapLE32(sample3));
  1.3159 +            dst += 4;
  1.3160 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3161 +            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.3162 +            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.3163 +            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.3164 +            last_sample0 = sample0;
  1.3165 +            last_sample1 = sample1;
  1.3166 +            last_sample2 = sample2;
  1.3167 +            last_sample3 = sample3;
  1.3168 +            eps -= srcsize;
  1.3169 +        }
  1.3170 +    }
  1.3171 +    cvt->len_cvt = dstsize;
  1.3172 +    if (cvt->filters[++cvt->filter_index]) {
  1.3173 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3174 +    }
  1.3175 +}
  1.3176 +
  1.3177 +static void SDLCALL
  1.3178 +SDL_Upsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3179 +{
  1.3180 +#ifdef DEBUG_CONVERT
  1.3181 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr);
  1.3182 +#endif
  1.3183 +
  1.3184 +    const int srcsize = cvt->len_cvt - 384;
  1.3185 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3186 +    register int eps = 0;
  1.3187 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
  1.3188 +    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.3189 +    const Sint32 *target = ((const Sint32 *) cvt->buf) - 6;
  1.3190 +    Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
  1.3191 +    Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
  1.3192 +    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
  1.3193 +    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
  1.3194 +    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
  1.3195 +    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.3196 +    Sint32 last_sample5 = sample5;
  1.3197 +    Sint32 last_sample4 = sample4;
  1.3198 +    Sint32 last_sample3 = sample3;
  1.3199 +    Sint32 last_sample2 = sample2;
  1.3200 +    Sint32 last_sample1 = sample1;
  1.3201 +    Sint32 last_sample0 = sample0;
  1.3202 +    while (dst != target) {
  1.3203 +        dst[5] = ((Sint32) SDL_SwapLE32(sample5));
  1.3204 +        dst[4] = ((Sint32) SDL_SwapLE32(sample4));
  1.3205 +        dst[3] = ((Sint32) SDL_SwapLE32(sample3));
  1.3206 +        dst[2] = ((Sint32) SDL_SwapLE32(sample2));
  1.3207 +        dst[1] = ((Sint32) SDL_SwapLE32(sample1));
  1.3208 +        dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.3209 +        dst -= 6;
  1.3210 +        eps += srcsize;
  1.3211 +        if ((eps << 1) >= dstsize) {
  1.3212 +            src -= 6;
  1.3213 +            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
  1.3214 +            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
  1.3215 +            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.3216 +            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.3217 +            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.3218 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3219 +            last_sample5 = sample5;
  1.3220 +            last_sample4 = sample4;
  1.3221 +            last_sample3 = sample3;
  1.3222 +            last_sample2 = sample2;
  1.3223 +            last_sample1 = sample1;
  1.3224 +            last_sample0 = sample0;
  1.3225 +            eps -= dstsize;
  1.3226 +        }
  1.3227 +    }
  1.3228 +    cvt->len_cvt = dstsize;
  1.3229 +    if (cvt->filters[++cvt->filter_index]) {
  1.3230 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3231 +    }
  1.3232 +}
  1.3233 +
  1.3234 +static void SDLCALL
  1.3235 +SDL_Downsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3236 +{
  1.3237 +#ifdef DEBUG_CONVERT
  1.3238 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr);
  1.3239 +#endif
  1.3240 +
  1.3241 +    const int srcsize = cvt->len_cvt - 384;
  1.3242 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3243 +    register int eps = 0;
  1.3244 +    Sint32 *dst = (Sint32 *) cvt->buf;
  1.3245 +    const Sint32 *src = (Sint32 *) cvt->buf;
  1.3246 +    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.3247 +    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.3248 +    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
  1.3249 +    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
  1.3250 +    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
  1.3251 +    Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
  1.3252 +    Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
  1.3253 +    Sint32 last_sample0 = sample0;
  1.3254 +    Sint32 last_sample1 = sample1;
  1.3255 +    Sint32 last_sample2 = sample2;
  1.3256 +    Sint32 last_sample3 = sample3;
  1.3257 +    Sint32 last_sample4 = sample4;
  1.3258 +    Sint32 last_sample5 = sample5;
  1.3259 +    while (dst != target) {
  1.3260 +        src += 6;
  1.3261 +        eps += dstsize;
  1.3262 +        if ((eps << 1) >= srcsize) {
  1.3263 +            dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.3264 +            dst[1] = ((Sint32) SDL_SwapLE32(sample1));
  1.3265 +            dst[2] = ((Sint32) SDL_SwapLE32(sample2));
  1.3266 +            dst[3] = ((Sint32) SDL_SwapLE32(sample3));
  1.3267 +            dst[4] = ((Sint32) SDL_SwapLE32(sample4));
  1.3268 +            dst[5] = ((Sint32) SDL_SwapLE32(sample5));
  1.3269 +            dst += 6;
  1.3270 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3271 +            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.3272 +            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.3273 +            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.3274 +            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
  1.3275 +            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
  1.3276 +            last_sample0 = sample0;
  1.3277 +            last_sample1 = sample1;
  1.3278 +            last_sample2 = sample2;
  1.3279 +            last_sample3 = sample3;
  1.3280 +            last_sample4 = sample4;
  1.3281 +            last_sample5 = sample5;
  1.3282 +            eps -= srcsize;
  1.3283 +        }
  1.3284 +    }
  1.3285 +    cvt->len_cvt = dstsize;
  1.3286 +    if (cvt->filters[++cvt->filter_index]) {
  1.3287 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3288 +    }
  1.3289 +}
  1.3290 +
  1.3291 +static void SDLCALL
  1.3292 +SDL_Upsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3293 +{
  1.3294 +#ifdef DEBUG_CONVERT
  1.3295 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr);
  1.3296 +#endif
  1.3297 +
  1.3298 +    const int srcsize = cvt->len_cvt - 512;
  1.3299 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3300 +    register int eps = 0;
  1.3301 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
  1.3302 +    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.3303 +    const Sint32 *target = ((const Sint32 *) cvt->buf) - 8;
  1.3304 +    Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7]));
  1.3305 +    Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6]));
  1.3306 +    Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
  1.3307 +    Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
  1.3308 +    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
  1.3309 +    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
  1.3310 +    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
  1.3311 +    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.3312 +    Sint32 last_sample7 = sample7;
  1.3313 +    Sint32 last_sample6 = sample6;
  1.3314 +    Sint32 last_sample5 = sample5;
  1.3315 +    Sint32 last_sample4 = sample4;
  1.3316 +    Sint32 last_sample3 = sample3;
  1.3317 +    Sint32 last_sample2 = sample2;
  1.3318 +    Sint32 last_sample1 = sample1;
  1.3319 +    Sint32 last_sample0 = sample0;
  1.3320 +    while (dst != target) {
  1.3321 +        dst[7] = ((Sint32) SDL_SwapLE32(sample7));
  1.3322 +        dst[6] = ((Sint32) SDL_SwapLE32(sample6));
  1.3323 +        dst[5] = ((Sint32) SDL_SwapLE32(sample5));
  1.3324 +        dst[4] = ((Sint32) SDL_SwapLE32(sample4));
  1.3325 +        dst[3] = ((Sint32) SDL_SwapLE32(sample3));
  1.3326 +        dst[2] = ((Sint32) SDL_SwapLE32(sample2));
  1.3327 +        dst[1] = ((Sint32) SDL_SwapLE32(sample1));
  1.3328 +        dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.3329 +        dst -= 8;
  1.3330 +        eps += srcsize;
  1.3331 +        if ((eps << 1) >= dstsize) {
  1.3332 +            src -= 8;
  1.3333 +            sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
  1.3334 +            sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
  1.3335 +            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
  1.3336 +            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
  1.3337 +            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.3338 +            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.3339 +            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.3340 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3341 +            last_sample7 = sample7;
  1.3342 +            last_sample6 = sample6;
  1.3343 +            last_sample5 = sample5;
  1.3344 +            last_sample4 = sample4;
  1.3345 +            last_sample3 = sample3;
  1.3346 +            last_sample2 = sample2;
  1.3347 +            last_sample1 = sample1;
  1.3348 +            last_sample0 = sample0;
  1.3349 +            eps -= dstsize;
  1.3350 +        }
  1.3351 +    }
  1.3352 +    cvt->len_cvt = dstsize;
  1.3353 +    if (cvt->filters[++cvt->filter_index]) {
  1.3354 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3355 +    }
  1.3356 +}
  1.3357 +
  1.3358 +static void SDLCALL
  1.3359 +SDL_Downsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3360 +{
  1.3361 +#ifdef DEBUG_CONVERT
  1.3362 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr);
  1.3363 +#endif
  1.3364 +
  1.3365 +    const int srcsize = cvt->len_cvt - 512;
  1.3366 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3367 +    register int eps = 0;
  1.3368 +    Sint32 *dst = (Sint32 *) cvt->buf;
  1.3369 +    const Sint32 *src = (Sint32 *) cvt->buf;
  1.3370 +    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.3371 +    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.3372 +    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
  1.3373 +    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
  1.3374 +    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
  1.3375 +    Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
  1.3376 +    Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
  1.3377 +    Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6]));
  1.3378 +    Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7]));
  1.3379 +    Sint32 last_sample0 = sample0;
  1.3380 +    Sint32 last_sample1 = sample1;
  1.3381 +    Sint32 last_sample2 = sample2;
  1.3382 +    Sint32 last_sample3 = sample3;
  1.3383 +    Sint32 last_sample4 = sample4;
  1.3384 +    Sint32 last_sample5 = sample5;
  1.3385 +    Sint32 last_sample6 = sample6;
  1.3386 +    Sint32 last_sample7 = sample7;
  1.3387 +    while (dst != target) {
  1.3388 +        src += 8;
  1.3389 +        eps += dstsize;
  1.3390 +        if ((eps << 1) >= srcsize) {
  1.3391 +            dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.3392 +            dst[1] = ((Sint32) SDL_SwapLE32(sample1));
  1.3393 +            dst[2] = ((Sint32) SDL_SwapLE32(sample2));
  1.3394 +            dst[3] = ((Sint32) SDL_SwapLE32(sample3));
  1.3395 +            dst[4] = ((Sint32) SDL_SwapLE32(sample4));
  1.3396 +            dst[5] = ((Sint32) SDL_SwapLE32(sample5));
  1.3397 +            dst[6] = ((Sint32) SDL_SwapLE32(sample6));
  1.3398 +            dst[7] = ((Sint32) SDL_SwapLE32(sample7));
  1.3399 +            dst += 8;
  1.3400 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3401 +            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.3402 +            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.3403 +            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.3404 +            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
  1.3405 +            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
  1.3406 +            sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
  1.3407 +            sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
  1.3408 +            last_sample0 = sample0;
  1.3409 +            last_sample1 = sample1;
  1.3410 +            last_sample2 = sample2;
  1.3411 +            last_sample3 = sample3;
  1.3412 +            last_sample4 = sample4;
  1.3413 +            last_sample5 = sample5;
  1.3414 +            last_sample6 = sample6;
  1.3415 +            last_sample7 = sample7;
  1.3416 +            eps -= srcsize;
  1.3417 +        }
  1.3418 +    }
  1.3419 +    cvt->len_cvt = dstsize;
  1.3420 +    if (cvt->filters[++cvt->filter_index]) {
  1.3421 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3422 +    }
  1.3423 +}
  1.3424 +
  1.3425 +static void SDLCALL
  1.3426 +SDL_Upsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3427 +{
  1.3428 +#ifdef DEBUG_CONVERT
  1.3429 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr);
  1.3430 +#endif
  1.3431 +
  1.3432 +    const int srcsize = cvt->len_cvt - 64;
  1.3433 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3434 +    register int eps = 0;
  1.3435 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
  1.3436 +    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.3437 +    const Sint32 *target = ((const Sint32 *) cvt->buf) - 1;
  1.3438 +    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.3439 +    Sint32 last_sample0 = sample0;
  1.3440 +    while (dst != target) {
  1.3441 +        dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.3442 +        dst--;
  1.3443 +        eps += srcsize;
  1.3444 +        if ((eps << 1) >= dstsize) {
  1.3445 +            src--;
  1.3446 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3447 +            last_sample0 = sample0;
  1.3448 +            eps -= dstsize;
  1.3449 +        }
  1.3450 +    }
  1.3451 +    cvt->len_cvt = dstsize;
  1.3452 +    if (cvt->filters[++cvt->filter_index]) {
  1.3453 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3454 +    }
  1.3455 +}
  1.3456 +
  1.3457 +static void SDLCALL
  1.3458 +SDL_Downsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3459 +{
  1.3460 +#ifdef DEBUG_CONVERT
  1.3461 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr);
  1.3462 +#endif
  1.3463 +
  1.3464 +    const int srcsize = cvt->len_cvt - 64;
  1.3465 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3466 +    register int eps = 0;
  1.3467 +    Sint32 *dst = (Sint32 *) cvt->buf;
  1.3468 +    const Sint32 *src = (Sint32 *) cvt->buf;
  1.3469 +    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.3470 +    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.3471 +    Sint32 last_sample0 = sample0;
  1.3472 +    while (dst != target) {
  1.3473 +        src++;
  1.3474 +        eps += dstsize;
  1.3475 +        if ((eps << 1) >= srcsize) {
  1.3476 +            dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.3477 +            dst++;
  1.3478 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3479 +            last_sample0 = sample0;
  1.3480 +            eps -= srcsize;
  1.3481 +        }
  1.3482 +    }
  1.3483 +    cvt->len_cvt = dstsize;
  1.3484 +    if (cvt->filters[++cvt->filter_index]) {
  1.3485 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3486 +    }
  1.3487 +}
  1.3488 +
  1.3489 +static void SDLCALL
  1.3490 +SDL_Upsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3491 +{
  1.3492 +#ifdef DEBUG_CONVERT
  1.3493 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr);
  1.3494 +#endif
  1.3495 +
  1.3496 +    const int srcsize = cvt->len_cvt - 128;
  1.3497 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3498 +    register int eps = 0;
  1.3499 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
  1.3500 +    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.3501 +    const Sint32 *target = ((const Sint32 *) cvt->buf) - 2;
  1.3502 +    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
  1.3503 +    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.3504 +    Sint32 last_sample1 = sample1;
  1.3505 +    Sint32 last_sample0 = sample0;
  1.3506 +    while (dst != target) {
  1.3507 +        dst[1] = ((Sint32) SDL_SwapBE32(sample1));
  1.3508 +        dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.3509 +        dst -= 2;
  1.3510 +        eps += srcsize;
  1.3511 +        if ((eps << 1) >= dstsize) {
  1.3512 +            src -= 2;
  1.3513 +            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.3514 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3515 +            last_sample1 = sample1;
  1.3516 +            last_sample0 = sample0;
  1.3517 +            eps -= dstsize;
  1.3518 +        }
  1.3519 +    }
  1.3520 +    cvt->len_cvt = dstsize;
  1.3521 +    if (cvt->filters[++cvt->filter_index]) {
  1.3522 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3523 +    }
  1.3524 +}
  1.3525 +
  1.3526 +static void SDLCALL
  1.3527 +SDL_Downsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3528 +{
  1.3529 +#ifdef DEBUG_CONVERT
  1.3530 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr);
  1.3531 +#endif
  1.3532 +
  1.3533 +    const int srcsize = cvt->len_cvt - 128;
  1.3534 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3535 +    register int eps = 0;
  1.3536 +    Sint32 *dst = (Sint32 *) cvt->buf;
  1.3537 +    const Sint32 *src = (Sint32 *) cvt->buf;
  1.3538 +    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.3539 +    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.3540 +    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
  1.3541 +    Sint32 last_sample0 = sample0;
  1.3542 +    Sint32 last_sample1 = sample1;
  1.3543 +    while (dst != target) {
  1.3544 +        src += 2;
  1.3545 +        eps += dstsize;
  1.3546 +        if ((eps << 1) >= srcsize) {
  1.3547 +            dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.3548 +            dst[1] = ((Sint32) SDL_SwapBE32(sample1));
  1.3549 +            dst += 2;
  1.3550 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3551 +            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.3552 +            last_sample0 = sample0;
  1.3553 +            last_sample1 = sample1;
  1.3554 +            eps -= srcsize;
  1.3555 +        }
  1.3556 +    }
  1.3557 +    cvt->len_cvt = dstsize;
  1.3558 +    if (cvt->filters[++cvt->filter_index]) {
  1.3559 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3560 +    }
  1.3561 +}
  1.3562 +
  1.3563 +static void SDLCALL
  1.3564 +SDL_Upsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3565 +{
  1.3566 +#ifdef DEBUG_CONVERT
  1.3567 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr);
  1.3568 +#endif
  1.3569 +
  1.3570 +    const int srcsize = cvt->len_cvt - 256;
  1.3571 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3572 +    register int eps = 0;
  1.3573 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
  1.3574 +    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.3575 +    const Sint32 *target = ((const Sint32 *) cvt->buf) - 4;
  1.3576 +    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
  1.3577 +    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
  1.3578 +    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
  1.3579 +    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.3580 +    Sint32 last_sample3 = sample3;
  1.3581 +    Sint32 last_sample2 = sample2;
  1.3582 +    Sint32 last_sample1 = sample1;
  1.3583 +    Sint32 last_sample0 = sample0;
  1.3584 +    while (dst != target) {
  1.3585 +        dst[3] = ((Sint32) SDL_SwapBE32(sample3));
  1.3586 +        dst[2] = ((Sint32) SDL_SwapBE32(sample2));
  1.3587 +        dst[1] = ((Sint32) SDL_SwapBE32(sample1));
  1.3588 +        dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.3589 +        dst -= 4;
  1.3590 +        eps += srcsize;
  1.3591 +        if ((eps << 1) >= dstsize) {
  1.3592 +            src -= 4;
  1.3593 +            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.3594 +            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.3595 +            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.3596 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3597 +            last_sample3 = sample3;
  1.3598 +            last_sample2 = sample2;
  1.3599 +            last_sample1 = sample1;
  1.3600 +            last_sample0 = sample0;
  1.3601 +            eps -= dstsize;
  1.3602 +        }
  1.3603 +    }
  1.3604 +    cvt->len_cvt = dstsize;
  1.3605 +    if (cvt->filters[++cvt->filter_index]) {
  1.3606 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3607 +    }
  1.3608 +}
  1.3609 +
  1.3610 +static void SDLCALL
  1.3611 +SDL_Downsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3612 +{
  1.3613 +#ifdef DEBUG_CONVERT
  1.3614 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr);
  1.3615 +#endif
  1.3616 +
  1.3617 +    const int srcsize = cvt->len_cvt - 256;
  1.3618 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3619 +    register int eps = 0;
  1.3620 +    Sint32 *dst = (Sint32 *) cvt->buf;
  1.3621 +    const Sint32 *src = (Sint32 *) cvt->buf;
  1.3622 +    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.3623 +    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.3624 +    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
  1.3625 +    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
  1.3626 +    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
  1.3627 +    Sint32 last_sample0 = sample0;
  1.3628 +    Sint32 last_sample1 = sample1;
  1.3629 +    Sint32 last_sample2 = sample2;
  1.3630 +    Sint32 last_sample3 = sample3;
  1.3631 +    while (dst != target) {
  1.3632 +        src += 4;
  1.3633 +        eps += dstsize;
  1.3634 +        if ((eps << 1) >= srcsize) {
  1.3635 +            dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.3636 +            dst[1] = ((Sint32) SDL_SwapBE32(sample1));
  1.3637 +            dst[2] = ((Sint32) SDL_SwapBE32(sample2));
  1.3638 +            dst[3] = ((Sint32) SDL_SwapBE32(sample3));
  1.3639 +            dst += 4;
  1.3640 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3641 +            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.3642 +            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.3643 +            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.3644 +            last_sample0 = sample0;
  1.3645 +            last_sample1 = sample1;
  1.3646 +            last_sample2 = sample2;
  1.3647 +            last_sample3 = sample3;
  1.3648 +            eps -= srcsize;
  1.3649 +        }
  1.3650 +    }
  1.3651 +    cvt->len_cvt = dstsize;
  1.3652 +    if (cvt->filters[++cvt->filter_index]) {
  1.3653 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3654 +    }
  1.3655 +}
  1.3656 +
  1.3657 +static void SDLCALL
  1.3658 +SDL_Upsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3659 +{
  1.3660 +#ifdef DEBUG_CONVERT
  1.3661 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr);
  1.3662 +#endif
  1.3663 +
  1.3664 +    const int srcsize = cvt->len_cvt - 384;
  1.3665 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3666 +    register int eps = 0;
  1.3667 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
  1.3668 +    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.3669 +    const Sint32 *target = ((const Sint32 *) cvt->buf) - 6;
  1.3670 +    Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
  1.3671 +    Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
  1.3672 +    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
  1.3673 +    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
  1.3674 +    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
  1.3675 +    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.3676 +    Sint32 last_sample5 = sample5;
  1.3677 +    Sint32 last_sample4 = sample4;
  1.3678 +    Sint32 last_sample3 = sample3;
  1.3679 +    Sint32 last_sample2 = sample2;
  1.3680 +    Sint32 last_sample1 = sample1;
  1.3681 +    Sint32 last_sample0 = sample0;
  1.3682 +    while (dst != target) {
  1.3683 +        dst[5] = ((Sint32) SDL_SwapBE32(sample5));
  1.3684 +        dst[4] = ((Sint32) SDL_SwapBE32(sample4));
  1.3685 +        dst[3] = ((Sint32) SDL_SwapBE32(sample3));
  1.3686 +        dst[2] = ((Sint32) SDL_SwapBE32(sample2));
  1.3687 +        dst[1] = ((Sint32) SDL_SwapBE32(sample1));
  1.3688 +        dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.3689 +        dst -= 6;
  1.3690 +        eps += srcsize;
  1.3691 +        if ((eps << 1) >= dstsize) {
  1.3692 +            src -= 6;
  1.3693 +            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
  1.3694 +            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
  1.3695 +            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.3696 +            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.3697 +            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.3698 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3699 +            last_sample5 = sample5;
  1.3700 +            last_sample4 = sample4;
  1.3701 +            last_sample3 = sample3;
  1.3702 +            last_sample2 = sample2;
  1.3703 +            last_sample1 = sample1;
  1.3704 +            last_sample0 = sample0;
  1.3705 +            eps -= dstsize;
  1.3706 +        }
  1.3707 +    }
  1.3708 +    cvt->len_cvt = dstsize;
  1.3709 +    if (cvt->filters[++cvt->filter_index]) {
  1.3710 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3711 +    }
  1.3712 +}
  1.3713 +
  1.3714 +static void SDLCALL
  1.3715 +SDL_Downsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3716 +{
  1.3717 +#ifdef DEBUG_CONVERT
  1.3718 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr);
  1.3719 +#endif
  1.3720 +
  1.3721 +    const int srcsize = cvt->len_cvt - 384;
  1.3722 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3723 +    register int eps = 0;
  1.3724 +    Sint32 *dst = (Sint32 *) cvt->buf;
  1.3725 +    const Sint32 *src = (Sint32 *) cvt->buf;
  1.3726 +    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.3727 +    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.3728 +    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
  1.3729 +    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
  1.3730 +    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
  1.3731 +    Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
  1.3732 +    Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
  1.3733 +    Sint32 last_sample0 = sample0;
  1.3734 +    Sint32 last_sample1 = sample1;
  1.3735 +    Sint32 last_sample2 = sample2;
  1.3736 +    Sint32 last_sample3 = sample3;
  1.3737 +    Sint32 last_sample4 = sample4;
  1.3738 +    Sint32 last_sample5 = sample5;
  1.3739 +    while (dst != target) {
  1.3740 +        src += 6;
  1.3741 +        eps += dstsize;
  1.3742 +        if ((eps << 1) >= srcsize) {
  1.3743 +            dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.3744 +            dst[1] = ((Sint32) SDL_SwapBE32(sample1));
  1.3745 +            dst[2] = ((Sint32) SDL_SwapBE32(sample2));
  1.3746 +            dst[3] = ((Sint32) SDL_SwapBE32(sample3));
  1.3747 +            dst[4] = ((Sint32) SDL_SwapBE32(sample4));
  1.3748 +            dst[5] = ((Sint32) SDL_SwapBE32(sample5));
  1.3749 +            dst += 6;
  1.3750 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3751 +            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.3752 +            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.3753 +            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.3754 +            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
  1.3755 +            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
  1.3756 +            last_sample0 = sample0;
  1.3757 +            last_sample1 = sample1;
  1.3758 +            last_sample2 = sample2;
  1.3759 +            last_sample3 = sample3;
  1.3760 +            last_sample4 = sample4;
  1.3761 +            last_sample5 = sample5;
  1.3762 +            eps -= srcsize;
  1.3763 +        }
  1.3764 +    }
  1.3765 +    cvt->len_cvt = dstsize;
  1.3766 +    if (cvt->filters[++cvt->filter_index]) {
  1.3767 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3768 +    }
  1.3769 +}
  1.3770 +
  1.3771 +static void SDLCALL
  1.3772 +SDL_Upsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3773 +{
  1.3774 +#ifdef DEBUG_CONVERT
  1.3775 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr);
  1.3776 +#endif
  1.3777 +
  1.3778 +    const int srcsize = cvt->len_cvt - 512;
  1.3779 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3780 +    register int eps = 0;
  1.3781 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
  1.3782 +    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.3783 +    const Sint32 *target = ((const Sint32 *) cvt->buf) - 8;
  1.3784 +    Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7]));
  1.3785 +    Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6]));
  1.3786 +    Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
  1.3787 +    Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
  1.3788 +    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
  1.3789 +    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
  1.3790 +    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
  1.3791 +    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.3792 +    Sint32 last_sample7 = sample7;
  1.3793 +    Sint32 last_sample6 = sample6;
  1.3794 +    Sint32 last_sample5 = sample5;
  1.3795 +    Sint32 last_sample4 = sample4;
  1.3796 +    Sint32 last_sample3 = sample3;
  1.3797 +    Sint32 last_sample2 = sample2;
  1.3798 +    Sint32 last_sample1 = sample1;
  1.3799 +    Sint32 last_sample0 = sample0;
  1.3800 +    while (dst != target) {
  1.3801 +        dst[7] = ((Sint32) SDL_SwapBE32(sample7));
  1.3802 +        dst[6] = ((Sint32) SDL_SwapBE32(sample6));
  1.3803 +        dst[5] = ((Sint32) SDL_SwapBE32(sample5));
  1.3804 +        dst[4] = ((Sint32) SDL_SwapBE32(sample4));
  1.3805 +        dst[3] = ((Sint32) SDL_SwapBE32(sample3));
  1.3806 +        dst[2] = ((Sint32) SDL_SwapBE32(sample2));
  1.3807 +        dst[1] = ((Sint32) SDL_SwapBE32(sample1));
  1.3808 +        dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.3809 +        dst -= 8;
  1.3810 +        eps += srcsize;
  1.3811 +        if ((eps << 1) >= dstsize) {
  1.3812 +            src -= 8;
  1.3813 +            sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
  1.3814 +            sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
  1.3815 +            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
  1.3816 +            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
  1.3817 +            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.3818 +            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.3819 +            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.3820 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3821 +            last_sample7 = sample7;
  1.3822 +            last_sample6 = sample6;
  1.3823 +            last_sample5 = sample5;
  1.3824 +            last_sample4 = sample4;
  1.3825 +            last_sample3 = sample3;
  1.3826 +            last_sample2 = sample2;
  1.3827 +            last_sample1 = sample1;
  1.3828 +            last_sample0 = sample0;
  1.3829 +            eps -= dstsize;
  1.3830 +        }
  1.3831 +    }
  1.3832 +    cvt->len_cvt = dstsize;
  1.3833 +    if (cvt->filters[++cvt->filter_index]) {
  1.3834 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3835 +    }
  1.3836 +}
  1.3837 +
  1.3838 +static void SDLCALL
  1.3839 +SDL_Downsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3840 +{
  1.3841 +#ifdef DEBUG_CONVERT
  1.3842 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr);
  1.3843 +#endif
  1.3844 +
  1.3845 +    const int srcsize = cvt->len_cvt - 512;
  1.3846 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3847 +    register int eps = 0;
  1.3848 +    Sint32 *dst = (Sint32 *) cvt->buf;
  1.3849 +    const Sint32 *src = (Sint32 *) cvt->buf;
  1.3850 +    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.3851 +    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.3852 +    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
  1.3853 +    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
  1.3854 +    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
  1.3855 +    Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
  1.3856 +    Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
  1.3857 +    Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6]));
  1.3858 +    Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7]));
  1.3859 +    Sint32 last_sample0 = sample0;
  1.3860 +    Sint32 last_sample1 = sample1;
  1.3861 +    Sint32 last_sample2 = sample2;
  1.3862 +    Sint32 last_sample3 = sample3;
  1.3863 +    Sint32 last_sample4 = sample4;
  1.3864 +    Sint32 last_sample5 = sample5;
  1.3865 +    Sint32 last_sample6 = sample6;
  1.3866 +    Sint32 last_sample7 = sample7;
  1.3867 +    while (dst != target) {
  1.3868 +        src += 8;
  1.3869 +        eps += dstsize;
  1.3870 +        if ((eps << 1) >= srcsize) {
  1.3871 +            dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.3872 +            dst[1] = ((Sint32) SDL_SwapBE32(sample1));
  1.3873 +            dst[2] = ((Sint32) SDL_SwapBE32(sample2));
  1.3874 +            dst[3] = ((Sint32) SDL_SwapBE32(sample3));
  1.3875 +            dst[4] = ((Sint32) SDL_SwapBE32(sample4));
  1.3876 +            dst[5] = ((Sint32) SDL_SwapBE32(sample5));
  1.3877 +            dst[6] = ((Sint32) SDL_SwapBE32(sample6));
  1.3878 +            dst[7] = ((Sint32) SDL_SwapBE32(sample7));
  1.3879 +            dst += 8;
  1.3880 +            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.3881 +            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.3882 +            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.3883 +            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.3884 +            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
  1.3885 +            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
  1.3886 +            sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
  1.3887 +            sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
  1.3888 +            last_sample0 = sample0;
  1.3889 +            last_sample1 = sample1;
  1.3890 +            last_sample2 = sample2;
  1.3891 +            last_sample3 = sample3;
  1.3892 +            last_sample4 = sample4;
  1.3893 +            last_sample5 = sample5;
  1.3894 +            last_sample6 = sample6;
  1.3895 +            last_sample7 = sample7;
  1.3896 +            eps -= srcsize;
  1.3897 +        }
  1.3898 +    }
  1.3899 +    cvt->len_cvt = dstsize;
  1.3900 +    if (cvt->filters[++cvt->filter_index]) {
  1.3901 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3902 +    }
  1.3903 +}
  1.3904 +
  1.3905 +static void SDLCALL
  1.3906 +SDL_Upsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3907 +{
  1.3908 +#ifdef DEBUG_CONVERT
  1.3909 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr);
  1.3910 +#endif
  1.3911 +
  1.3912 +    const int srcsize = cvt->len_cvt - 64;
  1.3913 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3914 +    register int eps = 0;
  1.3915 +    float *dst = ((float *) (cvt->buf + dstsize)) - 1;
  1.3916 +    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
  1.3917 +    const float *target = ((const float *) cvt->buf) - 1;
  1.3918 +    float sample0 = SDL_SwapFloatLE(src[0]);
  1.3919 +    float last_sample0 = sample0;
  1.3920 +    while (dst != target) {
  1.3921 +        dst[0] = SDL_SwapFloatLE(sample0);
  1.3922 +        dst--;
  1.3923 +        eps += srcsize;
  1.3924 +        if ((eps << 1) >= dstsize) {
  1.3925 +            src--;
  1.3926 +            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.3927 +            last_sample0 = sample0;
  1.3928 +            eps -= dstsize;
  1.3929 +        }
  1.3930 +    }
  1.3931 +    cvt->len_cvt = dstsize;
  1.3932 +    if (cvt->filters[++cvt->filter_index]) {
  1.3933 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3934 +    }
  1.3935 +}
  1.3936 +
  1.3937 +static void SDLCALL
  1.3938 +SDL_Downsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3939 +{
  1.3940 +#ifdef DEBUG_CONVERT
  1.3941 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr);
  1.3942 +#endif
  1.3943 +
  1.3944 +    const int srcsize = cvt->len_cvt - 64;
  1.3945 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3946 +    register int eps = 0;
  1.3947 +    float *dst = (float *) cvt->buf;
  1.3948 +    const float *src = (float *) cvt->buf;
  1.3949 +    const float *target = (const float *) (cvt->buf + dstsize);
  1.3950 +    float sample0 = SDL_SwapFloatLE(src[0]);
  1.3951 +    float last_sample0 = sample0;
  1.3952 +    while (dst != target) {
  1.3953 +        src++;
  1.3954 +        eps += dstsize;
  1.3955 +        if ((eps << 1) >= srcsize) {
  1.3956 +            dst[0] = SDL_SwapFloatLE(sample0);
  1.3957 +            dst++;
  1.3958 +            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.3959 +            last_sample0 = sample0;
  1.3960 +            eps -= srcsize;
  1.3961 +        }
  1.3962 +    }
  1.3963 +    cvt->len_cvt = dstsize;
  1.3964 +    if (cvt->filters[++cvt->filter_index]) {
  1.3965 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.3966 +    }
  1.3967 +}
  1.3968 +
  1.3969 +static void SDLCALL
  1.3970 +SDL_Upsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3971 +{
  1.3972 +#ifdef DEBUG_CONVERT
  1.3973 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr);
  1.3974 +#endif
  1.3975 +
  1.3976 +    const int srcsize = cvt->len_cvt - 128;
  1.3977 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.3978 +    register int eps = 0;
  1.3979 +    float *dst = ((float *) (cvt->buf + dstsize)) - 2;
  1.3980 +    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
  1.3981 +    const float *target = ((const float *) cvt->buf) - 2;
  1.3982 +    float sample1 = SDL_SwapFloatLE(src[1]);
  1.3983 +    float sample0 = SDL_SwapFloatLE(src[0]);
  1.3984 +    float last_sample1 = sample1;
  1.3985 +    float last_sample0 = sample0;
  1.3986 +    while (dst != target) {
  1.3987 +        dst[1] = SDL_SwapFloatLE(sample1);
  1.3988 +        dst[0] = SDL_SwapFloatLE(sample0);
  1.3989 +        dst -= 2;
  1.3990 +        eps += srcsize;
  1.3991 +        if ((eps << 1) >= dstsize) {
  1.3992 +            src -= 2;
  1.3993 +            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
  1.3994 +            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.3995 +            last_sample1 = sample1;
  1.3996 +            last_sample0 = sample0;
  1.3997 +            eps -= dstsize;
  1.3998 +        }
  1.3999 +    }
  1.4000 +    cvt->len_cvt = dstsize;
  1.4001 +    if (cvt->filters[++cvt->filter_index]) {
  1.4002 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4003 +    }
  1.4004 +}
  1.4005 +
  1.4006 +static void SDLCALL
  1.4007 +SDL_Downsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4008 +{
  1.4009 +#ifdef DEBUG_CONVERT
  1.4010 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr);
  1.4011 +#endif
  1.4012 +
  1.4013 +    const int srcsize = cvt->len_cvt - 128;
  1.4014 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.4015 +    register int eps = 0;
  1.4016 +    float *dst = (float *) cvt->buf;
  1.4017 +    const float *src = (float *) cvt->buf;
  1.4018 +    const float *target = (const float *) (cvt->buf + dstsize);
  1.4019 +    float sample0 = SDL_SwapFloatLE(src[0]);
  1.4020 +    float sample1 = SDL_SwapFloatLE(src[1]);
  1.4021 +    float last_sample0 = sample0;
  1.4022 +    float last_sample1 = sample1;
  1.4023 +    while (dst != target) {
  1.4024 +        src += 2;
  1.4025 +        eps += dstsize;
  1.4026 +        if ((eps << 1) >= srcsize) {
  1.4027 +            dst[0] = SDL_SwapFloatLE(sample0);
  1.4028 +            dst[1] = SDL_SwapFloatLE(sample1);
  1.4029 +            dst += 2;
  1.4030 +            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.4031 +            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
  1.4032 +            last_sample0 = sample0;
  1.4033 +            last_sample1 = sample1;
  1.4034 +            eps -= srcsize;
  1.4035 +        }
  1.4036 +    }
  1.4037 +    cvt->len_cvt = dstsize;
  1.4038 +    if (cvt->filters[++cvt->filter_index]) {
  1.4039 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4040 +    }
  1.4041 +}
  1.4042 +
  1.4043 +static void SDLCALL
  1.4044 +SDL_Upsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4045 +{
  1.4046 +#ifdef DEBUG_CONVERT
  1.4047 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr);
  1.4048 +#endif
  1.4049 +
  1.4050 +    const int srcsize = cvt->len_cvt - 256;
  1.4051 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.4052 +    register int eps = 0;
  1.4053 +    float *dst = ((float *) (cvt->buf + dstsize)) - 4;
  1.4054 +    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
  1.4055 +    const float *target = ((const float *) cvt->buf) - 4;
  1.4056 +    float sample3 = SDL_SwapFloatLE(src[3]);
  1.4057 +    float sample2 = SDL_SwapFloatLE(src[2]);
  1.4058 +    float sample1 = SDL_SwapFloatLE(src[1]);
  1.4059 +    float sample0 = SDL_SwapFloatLE(src[0]);
  1.4060 +    float last_sample3 = sample3;
  1.4061 +    float last_sample2 = sample2;
  1.4062 +    float last_sample1 = sample1;
  1.4063 +    float last_sample0 = sample0;
  1.4064 +    while (dst != target) {
  1.4065 +        dst[3] = SDL_SwapFloatLE(sample3);
  1.4066 +        dst[2] = SDL_SwapFloatLE(sample2);
  1.4067 +        dst[1] = SDL_SwapFloatLE(sample1);
  1.4068 +        dst[0] = SDL_SwapFloatLE(sample0);
  1.4069 +        dst -= 4;
  1.4070 +        eps += srcsize;
  1.4071 +        if ((eps << 1) >= dstsize) {
  1.4072 +            src -= 4;
  1.4073 +            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
  1.4074 +            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
  1.4075 +            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
  1.4076 +            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.4077 +            last_sample3 = sample3;
  1.4078 +            last_sample2 = sample2;
  1.4079 +            last_sample1 = sample1;
  1.4080 +            last_sample0 = sample0;
  1.4081 +            eps -= dstsize;
  1.4082 +        }
  1.4083 +    }
  1.4084 +    cvt->len_cvt = dstsize;
  1.4085 +    if (cvt->filters[++cvt->filter_index]) {
  1.4086 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4087 +    }
  1.4088 +}
  1.4089 +
  1.4090 +static void SDLCALL
  1.4091 +SDL_Downsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4092 +{
  1.4093 +#ifdef DEBUG_CONVERT
  1.4094 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr);
  1.4095 +#endif
  1.4096 +
  1.4097 +    const int srcsize = cvt->len_cvt - 256;
  1.4098 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.4099 +    register int eps = 0;
  1.4100 +    float *dst = (float *) cvt->buf;
  1.4101 +    const float *src = (float *) cvt->buf;
  1.4102 +    const float *target = (const float *) (cvt->buf + dstsize);
  1.4103 +    float sample0 = SDL_SwapFloatLE(src[0]);
  1.4104 +    float sample1 = SDL_SwapFloatLE(src[1]);
  1.4105 +    float sample2 = SDL_SwapFloatLE(src[2]);
  1.4106 +    float sample3 = SDL_SwapFloatLE(src[3]);
  1.4107 +    float last_sample0 = sample0;
  1.4108 +    float last_sample1 = sample1;
  1.4109 +    float last_sample2 = sample2;
  1.4110 +    float last_sample3 = sample3;
  1.4111 +    while (dst != target) {
  1.4112 +        src += 4;
  1.4113 +        eps += dstsize;
  1.4114 +        if ((eps << 1) >= srcsize) {
  1.4115 +            dst[0] = SDL_SwapFloatLE(sample0);
  1.4116 +            dst[1] = SDL_SwapFloatLE(sample1);
  1.4117 +            dst[2] = SDL_SwapFloatLE(sample2);
  1.4118 +            dst[3] = SDL_SwapFloatLE(sample3);
  1.4119 +            dst += 4;
  1.4120 +            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.4121 +            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
  1.4122 +            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
  1.4123 +            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
  1.4124 +            last_sample0 = sample0;
  1.4125 +            last_sample1 = sample1;
  1.4126 +            last_sample2 = sample2;
  1.4127 +            last_sample3 = sample3;
  1.4128 +            eps -= srcsize;
  1.4129 +        }
  1.4130 +    }
  1.4131 +    cvt->len_cvt = dstsize;
  1.4132 +    if (cvt->filters[++cvt->filter_index]) {
  1.4133 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4134 +    }
  1.4135 +}
  1.4136 +
  1.4137 +static void SDLCALL
  1.4138 +SDL_Upsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4139 +{
  1.4140 +#ifdef DEBUG_CONVERT
  1.4141 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr);
  1.4142 +#endif
  1.4143 +
  1.4144 +    const int srcsize = cvt->len_cvt - 384;
  1.4145 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.4146 +    register int eps = 0;
  1.4147 +    float *dst = ((float *) (cvt->buf + dstsize)) - 6;
  1.4148 +    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
  1.4149 +    const float *target = ((const float *) cvt->buf) - 6;
  1.4150 +    float sample5 = SDL_SwapFloatLE(src[5]);
  1.4151 +    float sample4 = SDL_SwapFloatLE(src[4]);
  1.4152 +    float sample3 = SDL_SwapFloatLE(src[3]);
  1.4153 +    float sample2 = SDL_SwapFloatLE(src[2]);
  1.4154 +    float sample1 = SDL_SwapFloatLE(src[1]);
  1.4155 +    float sample0 = SDL_SwapFloatLE(src[0]);
  1.4156 +    float last_sample5 = sample5;
  1.4157 +    float last_sample4 = sample4;
  1.4158 +    float last_sample3 = sample3;
  1.4159 +    float last_sample2 = sample2;
  1.4160 +    float last_sample1 = sample1;
  1.4161 +    float last_sample0 = sample0;
  1.4162 +    while (dst != target) {
  1.4163 +        dst[5] = SDL_SwapFloatLE(sample5);
  1.4164 +        dst[4] = SDL_SwapFloatLE(sample4);
  1.4165 +        dst[3] = SDL_SwapFloatLE(sample3);
  1.4166 +        dst[2] = SDL_SwapFloatLE(sample2);
  1.4167 +        dst[1] = SDL_SwapFloatLE(sample1);
  1.4168 +        dst[0] = SDL_SwapFloatLE(sample0);
  1.4169 +        dst -= 6;
  1.4170 +        eps += srcsize;
  1.4171 +        if ((eps << 1) >= dstsize) {
  1.4172 +            src -= 6;
  1.4173 +            sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
  1.4174 +            sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
  1.4175 +            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
  1.4176 +            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
  1.4177 +            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
  1.4178 +            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.4179 +            last_sample5 = sample5;
  1.4180 +            last_sample4 = sample4;
  1.4181 +            last_sample3 = sample3;
  1.4182 +            last_sample2 = sample2;
  1.4183 +            last_sample1 = sample1;
  1.4184 +            last_sample0 = sample0;
  1.4185 +            eps -= dstsize;
  1.4186 +        }
  1.4187 +    }
  1.4188 +    cvt->len_cvt = dstsize;
  1.4189 +    if (cvt->filters[++cvt->filter_index]) {
  1.4190 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4191 +    }
  1.4192 +}
  1.4193 +
  1.4194 +static void SDLCALL
  1.4195 +SDL_Downsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4196 +{
  1.4197 +#ifdef DEBUG_CONVERT
  1.4198 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr);
  1.4199 +#endif
  1.4200 +
  1.4201 +    const int srcsize = cvt->len_cvt - 384;
  1.4202 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.4203 +    register int eps = 0;
  1.4204 +    float *dst = (float *) cvt->buf;
  1.4205 +    const float *src = (float *) cvt->buf;
  1.4206 +    const float *target = (const float *) (cvt->buf + dstsize);
  1.4207 +    float sample0 = SDL_SwapFloatLE(src[0]);
  1.4208 +    float sample1 = SDL_SwapFloatLE(src[1]);
  1.4209 +    float sample2 = SDL_SwapFloatLE(src[2]);
  1.4210 +    float sample3 = SDL_SwapFloatLE(src[3]);
  1.4211 +    float sample4 = SDL_SwapFloatLE(src[4]);
  1.4212 +    float sample5 = SDL_SwapFloatLE(src[5]);
  1.4213 +    float last_sample0 = sample0;
  1.4214 +    float last_sample1 = sample1;
  1.4215 +    float last_sample2 = sample2;
  1.4216 +    float last_sample3 = sample3;
  1.4217 +    float last_sample4 = sample4;
  1.4218 +    float last_sample5 = sample5;
  1.4219 +    while (dst != target) {
  1.4220 +        src += 6;
  1.4221 +        eps += dstsize;
  1.4222 +        if ((eps << 1) >= srcsize) {
  1.4223 +            dst[0] = SDL_SwapFloatLE(sample0);
  1.4224 +            dst[1] = SDL_SwapFloatLE(sample1);
  1.4225 +            dst[2] = SDL_SwapFloatLE(sample2);
  1.4226 +            dst[3] = SDL_SwapFloatLE(sample3);
  1.4227 +            dst[4] = SDL_SwapFloatLE(sample4);
  1.4228 +            dst[5] = SDL_SwapFloatLE(sample5);
  1.4229 +            dst += 6;
  1.4230 +            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.4231 +            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
  1.4232 +            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
  1.4233 +            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
  1.4234 +            sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
  1.4235 +            sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
  1.4236 +            last_sample0 = sample0;
  1.4237 +            last_sample1 = sample1;
  1.4238 +            last_sample2 = sample2;
  1.4239 +            last_sample3 = sample3;
  1.4240 +            last_sample4 = sample4;
  1.4241 +            last_sample5 = sample5;
  1.4242 +            eps -= srcsize;
  1.4243 +        }
  1.4244 +    }
  1.4245 +    cvt->len_cvt = dstsize;
  1.4246 +    if (cvt->filters[++cvt->filter_index]) {
  1.4247 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4248 +    }
  1.4249 +}
  1.4250 +
  1.4251 +static void SDLCALL
  1.4252 +SDL_Upsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4253 +{
  1.4254 +#ifdef DEBUG_CONVERT
  1.4255 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr);
  1.4256 +#endif
  1.4257 +
  1.4258 +    const int srcsize = cvt->len_cvt - 512;
  1.4259 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.4260 +    register int eps = 0;
  1.4261 +    float *dst = ((float *) (cvt->buf + dstsize)) - 8;
  1.4262 +    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
  1.4263 +    const float *target = ((const float *) cvt->buf) - 8;
  1.4264 +    float sample7 = SDL_SwapFloatLE(src[7]);
  1.4265 +    float sample6 = SDL_SwapFloatLE(src[6]);
  1.4266 +    float sample5 = SDL_SwapFloatLE(src[5]);
  1.4267 +    float sample4 = SDL_SwapFloatLE(src[4]);
  1.4268 +    float sample3 = SDL_SwapFloatLE(src[3]);
  1.4269 +    float sample2 = SDL_SwapFloatLE(src[2]);
  1.4270 +    float sample1 = SDL_SwapFloatLE(src[1]);
  1.4271 +    float sample0 = SDL_SwapFloatLE(src[0]);
  1.4272 +    float last_sample7 = sample7;
  1.4273 +    float last_sample6 = sample6;
  1.4274 +    float last_sample5 = sample5;
  1.4275 +    float last_sample4 = sample4;
  1.4276 +    float last_sample3 = sample3;
  1.4277 +    float last_sample2 = sample2;
  1.4278 +    float last_sample1 = sample1;
  1.4279 +    float last_sample0 = sample0;
  1.4280 +    while (dst != target) {
  1.4281 +        dst[7] = SDL_SwapFloatLE(sample7);
  1.4282 +        dst[6] = SDL_SwapFloatLE(sample6);
  1.4283 +        dst[5] = SDL_SwapFloatLE(sample5);
  1.4284 +        dst[4] = SDL_SwapFloatLE(sample4);
  1.4285 +        dst[3] = SDL_SwapFloatLE(sample3);
  1.4286 +        dst[2] = SDL_SwapFloatLE(sample2);
  1.4287 +        dst[1] = SDL_SwapFloatLE(sample1);
  1.4288 +        dst[0] = SDL_SwapFloatLE(sample0);
  1.4289 +        dst -= 8;
  1.4290 +        eps += srcsize;
  1.4291 +        if ((eps << 1) >= dstsize) {
  1.4292 +            src -= 8;
  1.4293 +            sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5);
  1.4294 +            sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5);
  1.4295 +            sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
  1.4296 +            sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
  1.4297 +            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
  1.4298 +            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
  1.4299 +            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
  1.4300 +            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.4301 +            last_sample7 = sample7;
  1.4302 +            last_sample6 = sample6;
  1.4303 +            last_sample5 = sample5;
  1.4304 +            last_sample4 = sample4;
  1.4305 +            last_sample3 = sample3;
  1.4306 +            last_sample2 = sample2;
  1.4307 +            last_sample1 = sample1;
  1.4308 +            last_sample0 = sample0;
  1.4309 +            eps -= dstsize;
  1.4310 +        }
  1.4311 +    }
  1.4312 +    cvt->len_cvt = dstsize;
  1.4313 +    if (cvt->filters[++cvt->filter_index]) {
  1.4314 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4315 +    }
  1.4316 +}
  1.4317 +
  1.4318 +static void SDLCALL
  1.4319 +SDL_Downsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4320 +{
  1.4321 +#ifdef DEBUG_CONVERT
  1.4322 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr);
  1.4323 +#endif
  1.4324 +
  1.4325 +    const int srcsize = cvt->len_cvt - 512;
  1.4326 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.4327 +    register int eps = 0;
  1.4328 +    float *dst = (float *) cvt->buf;
  1.4329 +    const float *src = (float *) cvt->buf;
  1.4330 +    const float *target = (const float *) (cvt->buf + dstsize);
  1.4331 +    float sample0 = SDL_SwapFloatLE(src[0]);
  1.4332 +    float sample1 = SDL_SwapFloatLE(src[1]);
  1.4333 +    float sample2 = SDL_SwapFloatLE(src[2]);
  1.4334 +    float sample3 = SDL_SwapFloatLE(src[3]);
  1.4335 +    float sample4 = SDL_SwapFloatLE(src[4]);
  1.4336 +    float sample5 = SDL_SwapFloatLE(src[5]);
  1.4337 +    float sample6 = SDL_SwapFloatLE(src[6]);
  1.4338 +    float sample7 = SDL_SwapFloatLE(src[7]);
  1.4339 +    float last_sample0 = sample0;
  1.4340 +    float last_sample1 = sample1;
  1.4341 +    float last_sample2 = sample2;
  1.4342 +    float last_sample3 = sample3;
  1.4343 +    float last_sample4 = sample4;
  1.4344 +    float last_sample5 = sample5;
  1.4345 +    float last_sample6 = sample6;
  1.4346 +    float last_sample7 = sample7;
  1.4347 +    while (dst != target) {
  1.4348 +        src += 8;
  1.4349 +        eps += dstsize;
  1.4350 +        if ((eps << 1) >= srcsize) {
  1.4351 +            dst[0] = SDL_SwapFloatLE(sample0);
  1.4352 +            dst[1] = SDL_SwapFloatLE(sample1);
  1.4353 +            dst[2] = SDL_SwapFloatLE(sample2);
  1.4354 +            dst[3] = SDL_SwapFloatLE(sample3);
  1.4355 +            dst[4] = SDL_SwapFloatLE(sample4);
  1.4356 +            dst[5] = SDL_SwapFloatLE(sample5);
  1.4357 +            dst[6] = SDL_SwapFloatLE(sample6);
  1.4358 +            dst[7] = SDL_SwapFloatLE(sample7);
  1.4359 +            dst += 8;
  1.4360 +            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.4361 +            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
  1.4362 +            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
  1.4363 +            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
  1.4364 +            sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
  1.4365 +            sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
  1.4366 +            sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5);
  1.4367 +            sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5);
  1.4368 +            last_sample0 = sample0;
  1.4369 +            last_sample1 = sample1;
  1.4370 +            last_sample2 = sample2;
  1.4371 +            last_sample3 = sample3;
  1.4372 +            last_sample4 = sample4;
  1.4373 +            last_sample5 = sample5;
  1.4374 +            last_sample6 = sample6;
  1.4375 +            last_sample7 = sample7;
  1.4376 +            eps -= srcsize;
  1.4377 +        }
  1.4378 +    }
  1.4379 +    cvt->len_cvt = dstsize;
  1.4380 +    if (cvt->filters[++cvt->filter_index]) {
  1.4381 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4382 +    }
  1.4383 +}
  1.4384 +
  1.4385 +static void SDLCALL
  1.4386 +SDL_Upsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4387 +{
  1.4388 +#ifdef DEBUG_CONVERT
  1.4389 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr);
  1.4390 +#endif
  1.4391 +
  1.4392 +    const int srcsize = cvt->len_cvt - 64;
  1.4393 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.4394 +    register int eps = 0;
  1.4395 +    float *dst = ((float *) (cvt->buf + dstsize)) - 1;
  1.4396 +    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
  1.4397 +    const float *target = ((const float *) cvt->buf) - 1;
  1.4398 +    float sample0 = SDL_SwapFloatBE(src[0]);
  1.4399 +    float last_sample0 = sample0;
  1.4400 +    while (dst != target) {
  1.4401 +        dst[0] = SDL_SwapFloatBE(sample0);
  1.4402 +        dst--;
  1.4403 +        eps += srcsize;
  1.4404 +        if ((eps << 1) >= dstsize) {
  1.4405 +            src--;
  1.4406 +            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.4407 +            last_sample0 = sample0;
  1.4408 +            eps -= dstsize;
  1.4409 +        }
  1.4410 +    }
  1.4411 +    cvt->len_cvt = dstsize;
  1.4412 +    if (cvt->filters[++cvt->filter_index]) {
  1.4413 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4414 +    }
  1.4415 +}
  1.4416 +
  1.4417 +static void SDLCALL
  1.4418 +SDL_Downsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4419 +{
  1.4420 +#ifdef DEBUG_CONVERT
  1.4421 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr);
  1.4422 +#endif
  1.4423 +
  1.4424 +    const int srcsize = cvt->len_cvt - 64;
  1.4425 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.4426 +    register int eps = 0;
  1.4427 +    float *dst = (float *) cvt->buf;
  1.4428 +    const float *src = (float *) cvt->buf;
  1.4429 +    const float *target = (const float *) (cvt->buf + dstsize);
  1.4430 +    float sample0 = SDL_SwapFloatBE(src[0]);
  1.4431 +    float last_sample0 = sample0;
  1.4432 +    while (dst != target) {
  1.4433 +        src++;
  1.4434 +        eps += dstsize;
  1.4435 +        if ((eps << 1) >= srcsize) {
  1.4436 +            dst[0] = SDL_SwapFloatBE(sample0);
  1.4437 +            dst++;
  1.4438 +            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.4439 +            last_sample0 = sample0;
  1.4440 +            eps -= srcsize;
  1.4441 +        }
  1.4442 +    }
  1.4443 +    cvt->len_cvt = dstsize;
  1.4444 +    if (cvt->filters[++cvt->filter_index]) {
  1.4445 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4446 +    }
  1.4447 +}
  1.4448 +
  1.4449 +static void SDLCALL
  1.4450 +SDL_Upsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4451 +{
  1.4452 +#ifdef DEBUG_CONVERT
  1.4453 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr);
  1.4454 +#endif
  1.4455 +
  1.4456 +    const int srcsize = cvt->len_cvt - 128;
  1.4457 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.4458 +    register int eps = 0;
  1.4459 +    float *dst = ((float *) (cvt->buf + dstsize)) - 2;
  1.4460 +    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
  1.4461 +    const float *target = ((const float *) cvt->buf) - 2;
  1.4462 +    float sample1 = SDL_SwapFloatBE(src[1]);
  1.4463 +    float sample0 = SDL_SwapFloatBE(src[0]);
  1.4464 +    float last_sample1 = sample1;
  1.4465 +    float last_sample0 = sample0;
  1.4466 +    while (dst != target) {
  1.4467 +        dst[1] = SDL_SwapFloatBE(sample1);
  1.4468 +        dst[0] = SDL_SwapFloatBE(sample0);
  1.4469 +        dst -= 2;
  1.4470 +        eps += srcsize;
  1.4471 +        if ((eps << 1) >= dstsize) {
  1.4472 +            src -= 2;
  1.4473 +            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
  1.4474 +            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.4475 +            last_sample1 = sample1;
  1.4476 +            last_sample0 = sample0;
  1.4477 +            eps -= dstsize;
  1.4478 +        }
  1.4479 +    }
  1.4480 +    cvt->len_cvt = dstsize;
  1.4481 +    if (cvt->filters[++cvt->filter_index]) {
  1.4482 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4483 +    }
  1.4484 +}
  1.4485 +
  1.4486 +static void SDLCALL
  1.4487 +SDL_Downsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4488 +{
  1.4489 +#ifdef DEBUG_CONVERT
  1.4490 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr);
  1.4491 +#endif
  1.4492 +
  1.4493 +    const int srcsize = cvt->len_cvt - 128;
  1.4494 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.4495 +    register int eps = 0;
  1.4496 +    float *dst = (float *) cvt->buf;
  1.4497 +    const float *src = (float *) cvt->buf;
  1.4498 +    const float *target = (const float *) (cvt->buf + dstsize);
  1.4499 +    float sample0 = SDL_SwapFloatBE(src[0]);
  1.4500 +    float sample1 = SDL_SwapFloatBE(src[1]);
  1.4501 +    float last_sample0 = sample0;
  1.4502 +    float last_sample1 = sample1;
  1.4503 +    while (dst != target) {
  1.4504 +        src += 2;
  1.4505 +        eps += dstsize;
  1.4506 +        if ((eps << 1) >= srcsize) {
  1.4507 +            dst[0] = SDL_SwapFloatBE(sample0);
  1.4508 +            dst[1] = SDL_SwapFloatBE(sample1);
  1.4509 +            dst += 2;
  1.4510 +            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.4511 +            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
  1.4512 +            last_sample0 = sample0;
  1.4513 +            last_sample1 = sample1;
  1.4514 +            eps -= srcsize;
  1.4515 +        }
  1.4516 +    }
  1.4517 +    cvt->len_cvt = dstsize;
  1.4518 +    if (cvt->filters[++cvt->filter_index]) {
  1.4519 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4520 +    }
  1.4521 +}
  1.4522 +
  1.4523 +static void SDLCALL
  1.4524 +SDL_Upsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4525 +{
  1.4526 +#ifdef DEBUG_CONVERT
  1.4527 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr);
  1.4528 +#endif
  1.4529 +
  1.4530 +    const int srcsize = cvt->len_cvt - 256;
  1.4531 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.4532 +    register int eps = 0;
  1.4533 +    float *dst = ((float *) (cvt->buf + dstsize)) - 4;
  1.4534 +    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
  1.4535 +    const float *target = ((const float *) cvt->buf) - 4;
  1.4536 +    float sample3 = SDL_SwapFloatBE(src[3]);
  1.4537 +    float sample2 = SDL_SwapFloatBE(src[2]);
  1.4538 +    float sample1 = SDL_SwapFloatBE(src[1]);
  1.4539 +    float sample0 = SDL_SwapFloatBE(src[0]);
  1.4540 +    float last_sample3 = sample3;
  1.4541 +    float last_sample2 = sample2;
  1.4542 +    float last_sample1 = sample1;
  1.4543 +    float last_sample0 = sample0;
  1.4544 +    while (dst != target) {
  1.4545 +        dst[3] = SDL_SwapFloatBE(sample3);
  1.4546 +        dst[2] = SDL_SwapFloatBE(sample2);
  1.4547 +        dst[1] = SDL_SwapFloatBE(sample1);
  1.4548 +        dst[0] = SDL_SwapFloatBE(sample0);
  1.4549 +        dst -= 4;
  1.4550 +        eps += srcsize;
  1.4551 +        if ((eps << 1) >= dstsize) {
  1.4552 +            src -= 4;
  1.4553 +            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
  1.4554 +            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
  1.4555 +            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
  1.4556 +            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.4557 +            last_sample3 = sample3;
  1.4558 +            last_sample2 = sample2;
  1.4559 +            last_sample1 = sample1;
  1.4560 +            last_sample0 = sample0;
  1.4561 +            eps -= dstsize;
  1.4562 +        }
  1.4563 +    }
  1.4564 +    cvt->len_cvt = dstsize;
  1.4565 +    if (cvt->filters[++cvt->filter_index]) {
  1.4566 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4567 +    }
  1.4568 +}
  1.4569 +
  1.4570 +static void SDLCALL
  1.4571 +SDL_Downsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4572 +{
  1.4573 +#ifdef DEBUG_CONVERT
  1.4574 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr);
  1.4575 +#endif
  1.4576 +
  1.4577 +    const int srcsize = cvt->len_cvt - 256;
  1.4578 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.4579 +    register int eps = 0;
  1.4580 +    float *dst = (float *) cvt->buf;
  1.4581 +    const float *src = (float *) cvt->buf;
  1.4582 +    const float *target = (const float *) (cvt->buf + dstsize);
  1.4583 +    float sample0 = SDL_SwapFloatBE(src[0]);
  1.4584 +    float sample1 = SDL_SwapFloatBE(src[1]);
  1.4585 +    float sample2 = SDL_SwapFloatBE(src[2]);
  1.4586 +    float sample3 = SDL_SwapFloatBE(src[3]);
  1.4587 +    float last_sample0 = sample0;
  1.4588 +    float last_sample1 = sample1;
  1.4589 +    float last_sample2 = sample2;
  1.4590 +    float last_sample3 = sample3;
  1.4591 +    while (dst != target) {
  1.4592 +        src += 4;
  1.4593 +        eps += dstsize;
  1.4594 +        if ((eps << 1) >= srcsize) {
  1.4595 +            dst[0] = SDL_SwapFloatBE(sample0);
  1.4596 +            dst[1] = SDL_SwapFloatBE(sample1);
  1.4597 +            dst[2] = SDL_SwapFloatBE(sample2);
  1.4598 +            dst[3] = SDL_SwapFloatBE(sample3);
  1.4599 +            dst += 4;
  1.4600 +            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.4601 +            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
  1.4602 +            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
  1.4603 +            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
  1.4604 +            last_sample0 = sample0;
  1.4605 +            last_sample1 = sample1;
  1.4606 +            last_sample2 = sample2;
  1.4607 +            last_sample3 = sample3;
  1.4608 +            eps -= srcsize;
  1.4609 +        }
  1.4610 +    }
  1.4611 +    cvt->len_cvt = dstsize;
  1.4612 +    if (cvt->filters[++cvt->filter_index]) {
  1.4613 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4614 +    }
  1.4615 +}
  1.4616 +
  1.4617 +static void SDLCALL
  1.4618 +SDL_Upsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4619 +{
  1.4620 +#ifdef DEBUG_CONVERT
  1.4621 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr);
  1.4622 +#endif
  1.4623 +
  1.4624 +    const int srcsize = cvt->len_cvt - 384;
  1.4625 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.4626 +    register int eps = 0;
  1.4627 +    float *dst = ((float *) (cvt->buf + dstsize)) - 6;
  1.4628 +    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
  1.4629 +    const float *target = ((const float *) cvt->buf) - 6;
  1.4630 +    float sample5 = SDL_SwapFloatBE(src[5]);
  1.4631 +    float sample4 = SDL_SwapFloatBE(src[4]);
  1.4632 +    float sample3 = SDL_SwapFloatBE(src[3]);
  1.4633 +    float sample2 = SDL_SwapFloatBE(src[2]);
  1.4634 +    float sample1 = SDL_SwapFloatBE(src[1]);
  1.4635 +    float sample0 = SDL_SwapFloatBE(src[0]);
  1.4636 +    float last_sample5 = sample5;
  1.4637 +    float last_sample4 = sample4;
  1.4638 +    float last_sample3 = sample3;
  1.4639 +    float last_sample2 = sample2;
  1.4640 +    float last_sample1 = sample1;
  1.4641 +    float last_sample0 = sample0;
  1.4642 +    while (dst != target) {
  1.4643 +        dst[5] = SDL_SwapFloatBE(sample5);
  1.4644 +        dst[4] = SDL_SwapFloatBE(sample4);
  1.4645 +        dst[3] = SDL_SwapFloatBE(sample3);
  1.4646 +        dst[2] = SDL_SwapFloatBE(sample2);
  1.4647 +        dst[1] = SDL_SwapFloatBE(sample1);
  1.4648 +        dst[0] = SDL_SwapFloatBE(sample0);
  1.4649 +        dst -= 6;
  1.4650 +        eps += srcsize;
  1.4651 +        if ((eps << 1) >= dstsize) {
  1.4652 +            src -= 6;
  1.4653 +            sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
  1.4654 +            sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
  1.4655 +            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
  1.4656 +            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
  1.4657 +            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
  1.4658 +            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.4659 +            last_sample5 = sample5;
  1.4660 +            last_sample4 = sample4;
  1.4661 +            last_sample3 = sample3;
  1.4662 +            last_sample2 = sample2;
  1.4663 +            last_sample1 = sample1;
  1.4664 +            last_sample0 = sample0;
  1.4665 +            eps -= dstsize;
  1.4666 +        }
  1.4667 +    }
  1.4668 +    cvt->len_cvt = dstsize;
  1.4669 +    if (cvt->filters[++cvt->filter_index]) {
  1.4670 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4671 +    }
  1.4672 +}
  1.4673 +
  1.4674 +static void SDLCALL
  1.4675 +SDL_Downsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4676 +{
  1.4677 +#ifdef DEBUG_CONVERT
  1.4678 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr);
  1.4679 +#endif
  1.4680 +
  1.4681 +    const int srcsize = cvt->len_cvt - 384;
  1.4682 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.4683 +    register int eps = 0;
  1.4684 +    float *dst = (float *) cvt->buf;
  1.4685 +    const float *src = (float *) cvt->buf;
  1.4686 +    const float *target = (const float *) (cvt->buf + dstsize);
  1.4687 +    float sample0 = SDL_SwapFloatBE(src[0]);
  1.4688 +    float sample1 = SDL_SwapFloatBE(src[1]);
  1.4689 +    float sample2 = SDL_SwapFloatBE(src[2]);
  1.4690 +    float sample3 = SDL_SwapFloatBE(src[3]);
  1.4691 +    float sample4 = SDL_SwapFloatBE(src[4]);
  1.4692 +    float sample5 = SDL_SwapFloatBE(src[5]);
  1.4693 +    float last_sample0 = sample0;
  1.4694 +    float last_sample1 = sample1;
  1.4695 +    float last_sample2 = sample2;
  1.4696 +    float last_sample3 = sample3;
  1.4697 +    float last_sample4 = sample4;
  1.4698 +    float last_sample5 = sample5;
  1.4699 +    while (dst != target) {
  1.4700 +        src += 6;
  1.4701 +        eps += dstsize;
  1.4702 +        if ((eps << 1) >= srcsize) {
  1.4703 +            dst[0] = SDL_SwapFloatBE(sample0);
  1.4704 +            dst[1] = SDL_SwapFloatBE(sample1);
  1.4705 +            dst[2] = SDL_SwapFloatBE(sample2);
  1.4706 +            dst[3] = SDL_SwapFloatBE(sample3);
  1.4707 +            dst[4] = SDL_SwapFloatBE(sample4);
  1.4708 +            dst[5] = SDL_SwapFloatBE(sample5);
  1.4709 +            dst += 6;
  1.4710 +            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.4711 +            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
  1.4712 +            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
  1.4713 +            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
  1.4714 +            sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
  1.4715 +            sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
  1.4716 +            last_sample0 = sample0;
  1.4717 +            last_sample1 = sample1;
  1.4718 +            last_sample2 = sample2;
  1.4719 +            last_sample3 = sample3;
  1.4720 +            last_sample4 = sample4;
  1.4721 +            last_sample5 = sample5;
  1.4722 +            eps -= srcsize;
  1.4723 +        }
  1.4724 +    }
  1.4725 +    cvt->len_cvt = dstsize;
  1.4726 +    if (cvt->filters[++cvt->filter_index]) {
  1.4727 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4728 +    }
  1.4729 +}
  1.4730 +
  1.4731 +static void SDLCALL
  1.4732 +SDL_Upsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4733 +{
  1.4734 +#ifdef DEBUG_CONVERT
  1.4735 +    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr);
  1.4736 +#endif
  1.4737 +
  1.4738 +    const int srcsize = cvt->len_cvt - 512;
  1.4739 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.4740 +    register int eps = 0;
  1.4741 +    float *dst = ((float *) (cvt->buf + dstsize)) - 8;
  1.4742 +    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
  1.4743 +    const float *target = ((const float *) cvt->buf) - 8;
  1.4744 +    float sample7 = SDL_SwapFloatBE(src[7]);
  1.4745 +    float sample6 = SDL_SwapFloatBE(src[6]);
  1.4746 +    float sample5 = SDL_SwapFloatBE(src[5]);
  1.4747 +    float sample4 = SDL_SwapFloatBE(src[4]);
  1.4748 +    float sample3 = SDL_SwapFloatBE(src[3]);
  1.4749 +    float sample2 = SDL_SwapFloatBE(src[2]);
  1.4750 +    float sample1 = SDL_SwapFloatBE(src[1]);
  1.4751 +    float sample0 = SDL_SwapFloatBE(src[0]);
  1.4752 +    float last_sample7 = sample7;
  1.4753 +    float last_sample6 = sample6;
  1.4754 +    float last_sample5 = sample5;
  1.4755 +    float last_sample4 = sample4;
  1.4756 +    float last_sample3 = sample3;
  1.4757 +    float last_sample2 = sample2;
  1.4758 +    float last_sample1 = sample1;
  1.4759 +    float last_sample0 = sample0;
  1.4760 +    while (dst != target) {
  1.4761 +        dst[7] = SDL_SwapFloatBE(sample7);
  1.4762 +        dst[6] = SDL_SwapFloatBE(sample6);
  1.4763 +        dst[5] = SDL_SwapFloatBE(sample5);
  1.4764 +        dst[4] = SDL_SwapFloatBE(sample4);
  1.4765 +        dst[3] = SDL_SwapFloatBE(sample3);
  1.4766 +        dst[2] = SDL_SwapFloatBE(sample2);
  1.4767 +        dst[1] = SDL_SwapFloatBE(sample1);
  1.4768 +        dst[0] = SDL_SwapFloatBE(sample0);
  1.4769 +        dst -= 8;
  1.4770 +        eps += srcsize;
  1.4771 +        if ((eps << 1) >= dstsize) {
  1.4772 +            src -= 8;
  1.4773 +            sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5);
  1.4774 +            sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5);
  1.4775 +            sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
  1.4776 +            sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
  1.4777 +            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
  1.4778 +            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
  1.4779 +            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
  1.4780 +            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.4781 +            last_sample7 = sample7;
  1.4782 +            last_sample6 = sample6;
  1.4783 +            last_sample5 = sample5;
  1.4784 +            last_sample4 = sample4;
  1.4785 +            last_sample3 = sample3;
  1.4786 +            last_sample2 = sample2;
  1.4787 +            last_sample1 = sample1;
  1.4788 +            last_sample0 = sample0;
  1.4789 +            eps -= dstsize;
  1.4790 +        }
  1.4791 +    }
  1.4792 +    cvt->len_cvt = dstsize;
  1.4793 +    if (cvt->filters[++cvt->filter_index]) {
  1.4794 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4795 +    }
  1.4796 +}
  1.4797 +
  1.4798 +static void SDLCALL
  1.4799 +SDL_Downsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4800 +{
  1.4801 +#ifdef DEBUG_CONVERT
  1.4802 +    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr);
  1.4803 +#endif
  1.4804 +
  1.4805 +    const int srcsize = cvt->len_cvt - 512;
  1.4806 +    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
  1.4807 +    register int eps = 0;
  1.4808 +    float *dst = (float *) cvt->buf;
  1.4809 +    const float *src = (float *) cvt->buf;
  1.4810 +    const float *target = (const float *) (cvt->buf + dstsize);
  1.4811 +    float sample0 = SDL_SwapFloatBE(src[0]);
  1.4812 +    float sample1 = SDL_SwapFloatBE(src[1]);
  1.4813 +    float sample2 = SDL_SwapFloatBE(src[2]);
  1.4814 +    float sample3 = SDL_SwapFloatBE(src[3]);
  1.4815 +    float sample4 = SDL_SwapFloatBE(src[4]);
  1.4816 +    float sample5 = SDL_SwapFloatBE(src[5]);
  1.4817 +    float sample6 = SDL_SwapFloatBE(src[6]);
  1.4818 +    float sample7 = SDL_SwapFloatBE(src[7]);
  1.4819 +    float last_sample0 = sample0;
  1.4820 +    float last_sample1 = sample1;
  1.4821 +    float last_sample2 = sample2;
  1.4822 +    float last_sample3 = sample3;
  1.4823 +    float last_sample4 = sample4;
  1.4824 +    float last_sample5 = sample5;
  1.4825 +    float last_sample6 = sample6;
  1.4826 +    float last_sample7 = sample7;
  1.4827 +    while (dst != target) {
  1.4828 +        src += 8;
  1.4829 +        eps += dstsize;
  1.4830 +        if ((eps << 1) >= srcsize) {
  1.4831 +            dst[0] = SDL_SwapFloatBE(sample0);
  1.4832 +            dst[1] = SDL_SwapFloatBE(sample1);
  1.4833 +            dst[2] = SDL_SwapFloatBE(sample2);
  1.4834 +            dst[3] = SDL_SwapFloatBE(sample3);
  1.4835 +            dst[4] = SDL_SwapFloatBE(sample4);
  1.4836 +            dst[5] = SDL_SwapFloatBE(sample5);
  1.4837 +            dst[6] = SDL_SwapFloatBE(sample6);
  1.4838 +            dst[7] = SDL_SwapFloatBE(sample7);
  1.4839 +            dst += 8;
  1.4840 +            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.4841 +            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
  1.4842 +            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
  1.4843 +            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
  1.4844 +            sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
  1.4845 +            sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
  1.4846 +            sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5);
  1.4847 +            sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5);
  1.4848 +            last_sample0 = sample0;
  1.4849 +            last_sample1 = sample1;
  1.4850 +            last_sample2 = sample2;
  1.4851 +            last_sample3 = sample3;
  1.4852 +            last_sample4 = sample4;
  1.4853 +            last_sample5 = sample5;
  1.4854 +            last_sample6 = sample6;
  1.4855 +            last_sample7 = sample7;
  1.4856 +            eps -= srcsize;
  1.4857 +        }
  1.4858 +    }
  1.4859 +    cvt->len_cvt = dstsize;
  1.4860 +    if (cvt->filters[++cvt->filter_index]) {
  1.4861 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4862 +    }
  1.4863 +}
  1.4864 +
  1.4865 +
  1.4866 +#if !LESS_RESAMPLERS
  1.4867 +
  1.4868 +static void SDLCALL
  1.4869 +SDL_Upsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4870 +{
  1.4871 +#ifdef DEBUG_CONVERT
  1.4872 +    fprintf(stderr, "Upsample (x2) AUDIO_U8, 1 channels.\n");
  1.4873 +#endif
  1.4874 +
  1.4875 +    const int srcsize = cvt->len_cvt;
  1.4876 +    const int dstsize = cvt->len_cvt * 2;
  1.4877 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1;
  1.4878 +    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.4879 +    const Uint8 *target = ((const Uint8 *) cvt->buf) - 1;
  1.4880 +    Sint16 last_sample0 = (Sint16) src[0];
  1.4881 +    while (dst != target) {
  1.4882 +        const Sint16 sample0 = (Sint16) src[0];
  1.4883 +        src--;
  1.4884 +        dst[1] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.4885 +        dst[0] = (Uint8) sample0;
  1.4886 +        last_sample0 = sample0;
  1.4887 +        dst -= 2;
  1.4888 +    }
  1.4889 +
  1.4890 +    cvt->len_cvt = dstsize;
  1.4891 +    if (cvt->filters[++cvt->filter_index]) {
  1.4892 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4893 +    }
  1.4894 +}
  1.4895 +
  1.4896 +static void SDLCALL
  1.4897 +SDL_Downsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4898 +{
  1.4899 +#ifdef DEBUG_CONVERT
  1.4900 +    fprintf(stderr, "Downsample (x2) AUDIO_U8, 1 channels.\n");
  1.4901 +#endif
  1.4902 +
  1.4903 +    const int srcsize = cvt->len_cvt;
  1.4904 +    const int dstsize = cvt->len_cvt / 2;
  1.4905 +    Uint8 *dst = (Uint8 *) cvt->buf;
  1.4906 +    const Uint8 *src = (Uint8 *) cvt->buf;
  1.4907 +    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.4908 +    Sint16 last_sample0 = (Sint16) src[0];
  1.4909 +    while (dst != target) {
  1.4910 +        const Sint16 sample0 = (Sint16) src[0];
  1.4911 +        src += 2;
  1.4912 +        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.4913 +        last_sample0 = sample0;
  1.4914 +        dst++;
  1.4915 +    }
  1.4916 +
  1.4917 +    cvt->len_cvt = dstsize;
  1.4918 +    if (cvt->filters[++cvt->filter_index]) {
  1.4919 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4920 +    }
  1.4921 +}
  1.4922 +
  1.4923 +static void SDLCALL
  1.4924 +SDL_Upsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4925 +{
  1.4926 +#ifdef DEBUG_CONVERT
  1.4927 +    fprintf(stderr, "Upsample (x4) AUDIO_U8, 1 channels.\n");
  1.4928 +#endif
  1.4929 +
  1.4930 +    const int srcsize = cvt->len_cvt;
  1.4931 +    const int dstsize = cvt->len_cvt * 4;
  1.4932 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1;
  1.4933 +    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.4934 +    const Uint8 *target = ((const Uint8 *) cvt->buf) - 1;
  1.4935 +    Sint16 last_sample0 = (Sint16) src[0];
  1.4936 +    while (dst != target) {
  1.4937 +        const Sint16 sample0 = (Sint16) src[0];
  1.4938 +        src--;
  1.4939 +        dst[3] = (Uint8) sample0;
  1.4940 +        dst[2] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
  1.4941 +        dst[1] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.4942 +        dst[0] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
  1.4943 +        last_sample0 = sample0;
  1.4944 +        dst -= 4;
  1.4945 +    }
  1.4946 +
  1.4947 +    cvt->len_cvt = dstsize;
  1.4948 +    if (cvt->filters[++cvt->filter_index]) {
  1.4949 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4950 +    }
  1.4951 +}
  1.4952 +
  1.4953 +static void SDLCALL
  1.4954 +SDL_Downsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4955 +{
  1.4956 +#ifdef DEBUG_CONVERT
  1.4957 +    fprintf(stderr, "Downsample (x4) AUDIO_U8, 1 channels.\n");
  1.4958 +#endif
  1.4959 +
  1.4960 +    const int srcsize = cvt->len_cvt;
  1.4961 +    const int dstsize = cvt->len_cvt / 4;
  1.4962 +    Uint8 *dst = (Uint8 *) cvt->buf;
  1.4963 +    const Uint8 *src = (Uint8 *) cvt->buf;
  1.4964 +    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.4965 +    Sint16 last_sample0 = (Sint16) src[0];
  1.4966 +    while (dst != target) {
  1.4967 +        const Sint16 sample0 = (Sint16) src[0];
  1.4968 +        src += 4;
  1.4969 +        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.4970 +        last_sample0 = sample0;
  1.4971 +        dst++;
  1.4972 +    }
  1.4973 +
  1.4974 +    cvt->len_cvt = dstsize;
  1.4975 +    if (cvt->filters[++cvt->filter_index]) {
  1.4976 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.4977 +    }
  1.4978 +}
  1.4979 +
  1.4980 +static void SDLCALL
  1.4981 +SDL_Upsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4982 +{
  1.4983 +#ifdef DEBUG_CONVERT
  1.4984 +    fprintf(stderr, "Upsample (x2) AUDIO_U8, 2 channels.\n");
  1.4985 +#endif
  1.4986 +
  1.4987 +    const int srcsize = cvt->len_cvt;
  1.4988 +    const int dstsize = cvt->len_cvt * 2;
  1.4989 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2;
  1.4990 +    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.4991 +    const Uint8 *target = ((const Uint8 *) cvt->buf) - 2;
  1.4992 +    Sint16 last_sample1 = (Sint16) src[1];
  1.4993 +    Sint16 last_sample0 = (Sint16) src[0];
  1.4994 +    while (dst != target) {
  1.4995 +        const Sint16 sample1 = (Sint16) src[1];
  1.4996 +        const Sint16 sample0 = (Sint16) src[0];
  1.4997 +        src -= 2;
  1.4998 +        dst[3] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.4999 +        dst[2] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.5000 +        dst[1] = (Uint8) sample1;
  1.5001 +        dst[0] = (Uint8) sample0;
  1.5002 +        last_sample1 = sample1;
  1.5003 +        last_sample0 = sample0;
  1.5004 +        dst -= 4;
  1.5005 +    }
  1.5006 +
  1.5007 +    cvt->len_cvt = dstsize;
  1.5008 +    if (cvt->filters[++cvt->filter_index]) {
  1.5009 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5010 +    }
  1.5011 +}
  1.5012 +
  1.5013 +static void SDLCALL
  1.5014 +SDL_Downsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5015 +{
  1.5016 +#ifdef DEBUG_CONVERT
  1.5017 +    fprintf(stderr, "Downsample (x2) AUDIO_U8, 2 channels.\n");
  1.5018 +#endif
  1.5019 +
  1.5020 +    const int srcsize = cvt->len_cvt;
  1.5021 +    const int dstsize = cvt->len_cvt / 2;
  1.5022 +    Uint8 *dst = (Uint8 *) cvt->buf;
  1.5023 +    const Uint8 *src = (Uint8 *) cvt->buf;
  1.5024 +    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.5025 +    Sint16 last_sample0 = (Sint16) src[0];
  1.5026 +    Sint16 last_sample1 = (Sint16) src[1];
  1.5027 +    while (dst != target) {
  1.5028 +        const Sint16 sample0 = (Sint16) src[0];
  1.5029 +        const Sint16 sample1 = (Sint16) src[1];
  1.5030 +        src += 4;
  1.5031 +        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.5032 +        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.5033 +        last_sample0 = sample0;
  1.5034 +        last_sample1 = sample1;
  1.5035 +        dst += 2;
  1.5036 +    }
  1.5037 +
  1.5038 +    cvt->len_cvt = dstsize;
  1.5039 +    if (cvt->filters[++cvt->filter_index]) {
  1.5040 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5041 +    }
  1.5042 +}
  1.5043 +
  1.5044 +static void SDLCALL
  1.5045 +SDL_Upsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5046 +{
  1.5047 +#ifdef DEBUG_CONVERT
  1.5048 +    fprintf(stderr, "Upsample (x4) AUDIO_U8, 2 channels.\n");
  1.5049 +#endif
  1.5050 +
  1.5051 +    const int srcsize = cvt->len_cvt;
  1.5052 +    const int dstsize = cvt->len_cvt * 4;
  1.5053 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2;
  1.5054 +    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.5055 +    const Uint8 *target = ((const Uint8 *) cvt->buf) - 2;
  1.5056 +    Sint16 last_sample1 = (Sint16) src[1];
  1.5057 +    Sint16 last_sample0 = (Sint16) src[0];
  1.5058 +    while (dst != target) {
  1.5059 +        const Sint16 sample1 = (Sint16) src[1];
  1.5060 +        const Sint16 sample0 = (Sint16) src[0];
  1.5061 +        src -= 2;
  1.5062 +        dst[7] = (Uint8) sample1;
  1.5063 +        dst[6] = (Uint8) sample0;
  1.5064 +        dst[5] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
  1.5065 +        dst[4] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
  1.5066 +        dst[3] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.5067 +        dst[2] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.5068 +        dst[1] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
  1.5069 +        dst[0] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
  1.5070 +        last_sample1 = sample1;
  1.5071 +        last_sample0 = sample0;
  1.5072 +        dst -= 8;
  1.5073 +    }
  1.5074 +
  1.5075 +    cvt->len_cvt = dstsize;
  1.5076 +    if (cvt->filters[++cvt->filter_index]) {
  1.5077 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5078 +    }
  1.5079 +}
  1.5080 +
  1.5081 +static void SDLCALL
  1.5082 +SDL_Downsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5083 +{
  1.5084 +#ifdef DEBUG_CONVERT
  1.5085 +    fprintf(stderr, "Downsample (x4) AUDIO_U8, 2 channels.\n");
  1.5086 +#endif
  1.5087 +
  1.5088 +    const int srcsize = cvt->len_cvt;
  1.5089 +    const int dstsize = cvt->len_cvt / 4;
  1.5090 +    Uint8 *dst = (Uint8 *) cvt->buf;
  1.5091 +    const Uint8 *src = (Uint8 *) cvt->buf;
  1.5092 +    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.5093 +    Sint16 last_sample0 = (Sint16) src[0];
  1.5094 +    Sint16 last_sample1 = (Sint16) src[1];
  1.5095 +    while (dst != target) {
  1.5096 +        const Sint16 sample0 = (Sint16) src[0];
  1.5097 +        const Sint16 sample1 = (Sint16) src[1];
  1.5098 +        src += 8;
  1.5099 +        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.5100 +        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.5101 +        last_sample0 = sample0;
  1.5102 +        last_sample1 = sample1;
  1.5103 +        dst += 2;
  1.5104 +    }
  1.5105 +
  1.5106 +    cvt->len_cvt = dstsize;
  1.5107 +    if (cvt->filters[++cvt->filter_index]) {
  1.5108 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5109 +    }
  1.5110 +}
  1.5111 +
  1.5112 +static void SDLCALL
  1.5113 +SDL_Upsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5114 +{
  1.5115 +#ifdef DEBUG_CONVERT
  1.5116 +    fprintf(stderr, "Upsample (x2) AUDIO_U8, 4 channels.\n");
  1.5117 +#endif
  1.5118 +
  1.5119 +    const int srcsize = cvt->len_cvt;
  1.5120 +    const int dstsize = cvt->len_cvt * 2;
  1.5121 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4;
  1.5122 +    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.5123 +    const Uint8 *target = ((const Uint8 *) cvt->buf) - 4;
  1.5124 +    Sint16 last_sample3 = (Sint16) src[3];
  1.5125 +    Sint16 last_sample2 = (Sint16) src[2];
  1.5126 +    Sint16 last_sample1 = (Sint16) src[1];
  1.5127 +    Sint16 last_sample0 = (Sint16) src[0];
  1.5128 +    while (dst != target) {
  1.5129 +        const Sint16 sample3 = (Sint16) src[3];
  1.5130 +        const Sint16 sample2 = (Sint16) src[2];
  1.5131 +        const Sint16 sample1 = (Sint16) src[1];
  1.5132 +        const Sint16 sample0 = (Sint16) src[0];
  1.5133 +        src -= 4;
  1.5134 +        dst[7] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.5135 +        dst[6] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.5136 +        dst[5] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.5137 +        dst[4] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.5138 +        dst[3] = (Uint8) sample3;
  1.5139 +        dst[2] = (Uint8) sample2;
  1.5140 +        dst[1] = (Uint8) sample1;
  1.5141 +        dst[0] = (Uint8) sample0;
  1.5142 +        last_sample3 = sample3;
  1.5143 +        last_sample2 = sample2;
  1.5144 +        last_sample1 = sample1;
  1.5145 +        last_sample0 = sample0;
  1.5146 +        dst -= 8;
  1.5147 +    }
  1.5148 +
  1.5149 +    cvt->len_cvt = dstsize;
  1.5150 +    if (cvt->filters[++cvt->filter_index]) {
  1.5151 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5152 +    }
  1.5153 +}
  1.5154 +
  1.5155 +static void SDLCALL
  1.5156 +SDL_Downsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5157 +{
  1.5158 +#ifdef DEBUG_CONVERT
  1.5159 +    fprintf(stderr, "Downsample (x2) AUDIO_U8, 4 channels.\n");
  1.5160 +#endif
  1.5161 +
  1.5162 +    const int srcsize = cvt->len_cvt;
  1.5163 +    const int dstsize = cvt->len_cvt / 2;
  1.5164 +    Uint8 *dst = (Uint8 *) cvt->buf;
  1.5165 +    const Uint8 *src = (Uint8 *) cvt->buf;
  1.5166 +    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.5167 +    Sint16 last_sample0 = (Sint16) src[0];
  1.5168 +    Sint16 last_sample1 = (Sint16) src[1];
  1.5169 +    Sint16 last_sample2 = (Sint16) src[2];
  1.5170 +    Sint16 last_sample3 = (Sint16) src[3];
  1.5171 +    while (dst != target) {
  1.5172 +        const Sint16 sample0 = (Sint16) src[0];
  1.5173 +        const Sint16 sample1 = (Sint16) src[1];
  1.5174 +        const Sint16 sample2 = (Sint16) src[2];
  1.5175 +        const Sint16 sample3 = (Sint16) src[3];
  1.5176 +        src += 8;
  1.5177 +        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.5178 +        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.5179 +        dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.5180 +        dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.5181 +        last_sample0 = sample0;
  1.5182 +        last_sample1 = sample1;
  1.5183 +        last_sample2 = sample2;
  1.5184 +        last_sample3 = sample3;
  1.5185 +        dst += 4;
  1.5186 +    }
  1.5187 +
  1.5188 +    cvt->len_cvt = dstsize;
  1.5189 +    if (cvt->filters[++cvt->filter_index]) {
  1.5190 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5191 +    }
  1.5192 +}
  1.5193 +
  1.5194 +static void SDLCALL
  1.5195 +SDL_Upsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5196 +{
  1.5197 +#ifdef DEBUG_CONVERT
  1.5198 +    fprintf(stderr, "Upsample (x4) AUDIO_U8, 4 channels.\n");
  1.5199 +#endif
  1.5200 +
  1.5201 +    const int srcsize = cvt->len_cvt;
  1.5202 +    const int dstsize = cvt->len_cvt * 4;
  1.5203 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4;
  1.5204 +    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.5205 +    const Uint8 *target = ((const Uint8 *) cvt->buf) - 4;
  1.5206 +    Sint16 last_sample3 = (Sint16) src[3];
  1.5207 +    Sint16 last_sample2 = (Sint16) src[2];
  1.5208 +    Sint16 last_sample1 = (Sint16) src[1];
  1.5209 +    Sint16 last_sample0 = (Sint16) src[0];
  1.5210 +    while (dst != target) {
  1.5211 +        const Sint16 sample3 = (Sint16) src[3];
  1.5212 +        const Sint16 sample2 = (Sint16) src[2];
  1.5213 +        const Sint16 sample1 = (Sint16) src[1];
  1.5214 +        const Sint16 sample0 = (Sint16) src[0];
  1.5215 +        src -= 4;
  1.5216 +        dst[15] = (Uint8) sample3;
  1.5217 +        dst[14] = (Uint8) sample2;
  1.5218 +        dst[13] = (Uint8) sample1;
  1.5219 +        dst[12] = (Uint8) sample0;
  1.5220 +        dst[11] = (Uint8) (((3 * sample3) + last_sample3) >> 2);
  1.5221 +        dst[10] = (Uint8) (((3 * sample2) + last_sample2) >> 2);
  1.5222 +        dst[9] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
  1.5223 +        dst[8] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
  1.5224 +        dst[7] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.5225 +        dst[6] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.5226 +        dst[5] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.5227 +        dst[4] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.5228 +        dst[3] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2);
  1.5229 +        dst[2] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2);
  1.5230 +        dst[1] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
  1.5231 +        dst[0] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
  1.5232 +        last_sample3 = sample3;
  1.5233 +        last_sample2 = sample2;
  1.5234 +        last_sample1 = sample1;
  1.5235 +        last_sample0 = sample0;
  1.5236 +        dst -= 16;
  1.5237 +    }
  1.5238 +
  1.5239 +    cvt->len_cvt = dstsize;
  1.5240 +    if (cvt->filters[++cvt->filter_index]) {
  1.5241 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5242 +    }
  1.5243 +}
  1.5244 +
  1.5245 +static void SDLCALL
  1.5246 +SDL_Downsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5247 +{
  1.5248 +#ifdef DEBUG_CONVERT
  1.5249 +    fprintf(stderr, "Downsample (x4) AUDIO_U8, 4 channels.\n");
  1.5250 +#endif
  1.5251 +
  1.5252 +    const int srcsize = cvt->len_cvt;
  1.5253 +    const int dstsize = cvt->len_cvt / 4;
  1.5254 +    Uint8 *dst = (Uint8 *) cvt->buf;
  1.5255 +    const Uint8 *src = (Uint8 *) cvt->buf;
  1.5256 +    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.5257 +    Sint16 last_sample0 = (Sint16) src[0];
  1.5258 +    Sint16 last_sample1 = (Sint16) src[1];
  1.5259 +    Sint16 last_sample2 = (Sint16) src[2];
  1.5260 +    Sint16 last_sample3 = (Sint16) src[3];
  1.5261 +    while (dst != target) {
  1.5262 +        const Sint16 sample0 = (Sint16) src[0];
  1.5263 +        const Sint16 sample1 = (Sint16) src[1];
  1.5264 +        const Sint16 sample2 = (Sint16) src[2];
  1.5265 +        const Sint16 sample3 = (Sint16) src[3];
  1.5266 +        src += 16;
  1.5267 +        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.5268 +        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.5269 +        dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.5270 +        dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.5271 +        last_sample0 = sample0;
  1.5272 +        last_sample1 = sample1;
  1.5273 +        last_sample2 = sample2;
  1.5274 +        last_sample3 = sample3;
  1.5275 +        dst += 4;
  1.5276 +    }
  1.5277 +
  1.5278 +    cvt->len_cvt = dstsize;
  1.5279 +    if (cvt->filters[++cvt->filter_index]) {
  1.5280 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5281 +    }
  1.5282 +}
  1.5283 +
  1.5284 +static void SDLCALL
  1.5285 +SDL_Upsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5286 +{
  1.5287 +#ifdef DEBUG_CONVERT
  1.5288 +    fprintf(stderr, "Upsample (x2) AUDIO_U8, 6 channels.\n");
  1.5289 +#endif
  1.5290 +
  1.5291 +    const int srcsize = cvt->len_cvt;
  1.5292 +    const int dstsize = cvt->len_cvt * 2;
  1.5293 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6;
  1.5294 +    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.5295 +    const Uint8 *target = ((const Uint8 *) cvt->buf) - 6;
  1.5296 +    Sint16 last_sample5 = (Sint16) src[5];
  1.5297 +    Sint16 last_sample4 = (Sint16) src[4];
  1.5298 +    Sint16 last_sample3 = (Sint16) src[3];
  1.5299 +    Sint16 last_sample2 = (Sint16) src[2];
  1.5300 +    Sint16 last_sample1 = (Sint16) src[1];
  1.5301 +    Sint16 last_sample0 = (Sint16) src[0];
  1.5302 +    while (dst != target) {
  1.5303 +        const Sint16 sample5 = (Sint16) src[5];
  1.5304 +        const Sint16 sample4 = (Sint16) src[4];
  1.5305 +        const Sint16 sample3 = (Sint16) src[3];
  1.5306 +        const Sint16 sample2 = (Sint16) src[2];
  1.5307 +        const Sint16 sample1 = (Sint16) src[1];
  1.5308 +        const Sint16 sample0 = (Sint16) src[0];
  1.5309 +        src -= 6;
  1.5310 +        dst[11] = (Uint8) ((sample5 + last_sample5) >> 1);
  1.5311 +        dst[10] = (Uint8) ((sample4 + last_sample4) >> 1);
  1.5312 +        dst[9] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.5313 +        dst[8] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.5314 +        dst[7] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.5315 +        dst[6] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.5316 +        dst[5] = (Uint8) sample5;
  1.5317 +        dst[4] = (Uint8) sample4;
  1.5318 +        dst[3] = (Uint8) sample3;
  1.5319 +        dst[2] = (Uint8) sample2;
  1.5320 +        dst[1] = (Uint8) sample1;
  1.5321 +        dst[0] = (Uint8) sample0;
  1.5322 +        last_sample5 = sample5;
  1.5323 +        last_sample4 = sample4;
  1.5324 +        last_sample3 = sample3;
  1.5325 +        last_sample2 = sample2;
  1.5326 +        last_sample1 = sample1;
  1.5327 +        last_sample0 = sample0;
  1.5328 +        dst -= 12;
  1.5329 +    }
  1.5330 +
  1.5331 +    cvt->len_cvt = dstsize;
  1.5332 +    if (cvt->filters[++cvt->filter_index]) {
  1.5333 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5334 +    }
  1.5335 +}
  1.5336 +
  1.5337 +static void SDLCALL
  1.5338 +SDL_Downsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5339 +{
  1.5340 +#ifdef DEBUG_CONVERT
  1.5341 +    fprintf(stderr, "Downsample (x2) AUDIO_U8, 6 channels.\n");
  1.5342 +#endif
  1.5343 +
  1.5344 +    const int srcsize = cvt->len_cvt;
  1.5345 +    const int dstsize = cvt->len_cvt / 2;
  1.5346 +    Uint8 *dst = (Uint8 *) cvt->buf;
  1.5347 +    const Uint8 *src = (Uint8 *) cvt->buf;
  1.5348 +    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.5349 +    Sint16 last_sample0 = (Sint16) src[0];
  1.5350 +    Sint16 last_sample1 = (Sint16) src[1];
  1.5351 +    Sint16 last_sample2 = (Sint16) src[2];
  1.5352 +    Sint16 last_sample3 = (Sint16) src[3];
  1.5353 +    Sint16 last_sample4 = (Sint16) src[4];
  1.5354 +    Sint16 last_sample5 = (Sint16) src[5];
  1.5355 +    while (dst != target) {
  1.5356 +        const Sint16 sample0 = (Sint16) src[0];
  1.5357 +        const Sint16 sample1 = (Sint16) src[1];
  1.5358 +        const Sint16 sample2 = (Sint16) src[2];
  1.5359 +        const Sint16 sample3 = (Sint16) src[3];
  1.5360 +        const Sint16 sample4 = (Sint16) src[4];
  1.5361 +        const Sint16 sample5 = (Sint16) src[5];
  1.5362 +        src += 12;
  1.5363 +        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.5364 +        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.5365 +        dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.5366 +        dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.5367 +        dst[4] = (Uint8) ((sample4 + last_sample4) >> 1);
  1.5368 +        dst[5] = (Uint8) ((sample5 + last_sample5) >> 1);
  1.5369 +        last_sample0 = sample0;
  1.5370 +        last_sample1 = sample1;
  1.5371 +        last_sample2 = sample2;
  1.5372 +        last_sample3 = sample3;
  1.5373 +        last_sample4 = sample4;
  1.5374 +        last_sample5 = sample5;
  1.5375 +        dst += 6;
  1.5376 +    }
  1.5377 +
  1.5378 +    cvt->len_cvt = dstsize;
  1.5379 +    if (cvt->filters[++cvt->filter_index]) {
  1.5380 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5381 +    }
  1.5382 +}
  1.5383 +
  1.5384 +static void SDLCALL
  1.5385 +SDL_Upsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5386 +{
  1.5387 +#ifdef DEBUG_CONVERT
  1.5388 +    fprintf(stderr, "Upsample (x4) AUDIO_U8, 6 channels.\n");
  1.5389 +#endif
  1.5390 +
  1.5391 +    const int srcsize = cvt->len_cvt;
  1.5392 +    const int dstsize = cvt->len_cvt * 4;
  1.5393 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6;
  1.5394 +    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.5395 +    const Uint8 *target = ((const Uint8 *) cvt->buf) - 6;
  1.5396 +    Sint16 last_sample5 = (Sint16) src[5];
  1.5397 +    Sint16 last_sample4 = (Sint16) src[4];
  1.5398 +    Sint16 last_sample3 = (Sint16) src[3];
  1.5399 +    Sint16 last_sample2 = (Sint16) src[2];
  1.5400 +    Sint16 last_sample1 = (Sint16) src[1];
  1.5401 +    Sint16 last_sample0 = (Sint16) src[0];
  1.5402 +    while (dst != target) {
  1.5403 +        const Sint16 sample5 = (Sint16) src[5];
  1.5404 +        const Sint16 sample4 = (Sint16) src[4];
  1.5405 +        const Sint16 sample3 = (Sint16) src[3];
  1.5406 +        const Sint16 sample2 = (Sint16) src[2];
  1.5407 +        const Sint16 sample1 = (Sint16) src[1];
  1.5408 +        const Sint16 sample0 = (Sint16) src[0];
  1.5409 +        src -= 6;
  1.5410 +        dst[23] = (Uint8) sample5;
  1.5411 +        dst[22] = (Uint8) sample4;
  1.5412 +        dst[21] = (Uint8) sample3;
  1.5413 +        dst[20] = (Uint8) sample2;
  1.5414 +        dst[19] = (Uint8) sample1;
  1.5415 +        dst[18] = (Uint8) sample0;
  1.5416 +        dst[17] = (Uint8) (((3 * sample5) + last_sample5) >> 2);
  1.5417 +        dst[16] = (Uint8) (((3 * sample4) + last_sample4) >> 2);
  1.5418 +        dst[15] = (Uint8) (((3 * sample3) + last_sample3) >> 2);
  1.5419 +        dst[14] = (Uint8) (((3 * sample2) + last_sample2) >> 2);
  1.5420 +        dst[13] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
  1.5421 +        dst[12] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
  1.5422 +        dst[11] = (Uint8) ((sample5 + last_sample5) >> 1);
  1.5423 +        dst[10] = (Uint8) ((sample4 + last_sample4) >> 1);
  1.5424 +        dst[9] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.5425 +        dst[8] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.5426 +        dst[7] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.5427 +        dst[6] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.5428 +        dst[5] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2);
  1.5429 +        dst[4] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2);
  1.5430 +        dst[3] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2);
  1.5431 +        dst[2] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2);
  1.5432 +        dst[1] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
  1.5433 +        dst[0] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
  1.5434 +        last_sample5 = sample5;
  1.5435 +        last_sample4 = sample4;
  1.5436 +        last_sample3 = sample3;
  1.5437 +        last_sample2 = sample2;
  1.5438 +        last_sample1 = sample1;
  1.5439 +        last_sample0 = sample0;
  1.5440 +        dst -= 24;
  1.5441 +    }
  1.5442 +
  1.5443 +    cvt->len_cvt = dstsize;
  1.5444 +    if (cvt->filters[++cvt->filter_index]) {
  1.5445 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5446 +    }
  1.5447 +}
  1.5448 +
  1.5449 +static void SDLCALL
  1.5450 +SDL_Downsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5451 +{
  1.5452 +#ifdef DEBUG_CONVERT
  1.5453 +    fprintf(stderr, "Downsample (x4) AUDIO_U8, 6 channels.\n");
  1.5454 +#endif
  1.5455 +
  1.5456 +    const int srcsize = cvt->len_cvt;
  1.5457 +    const int dstsize = cvt->len_cvt / 4;
  1.5458 +    Uint8 *dst = (Uint8 *) cvt->buf;
  1.5459 +    const Uint8 *src = (Uint8 *) cvt->buf;
  1.5460 +    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.5461 +    Sint16 last_sample0 = (Sint16) src[0];
  1.5462 +    Sint16 last_sample1 = (Sint16) src[1];
  1.5463 +    Sint16 last_sample2 = (Sint16) src[2];
  1.5464 +    Sint16 last_sample3 = (Sint16) src[3];
  1.5465 +    Sint16 last_sample4 = (Sint16) src[4];
  1.5466 +    Sint16 last_sample5 = (Sint16) src[5];
  1.5467 +    while (dst != target) {
  1.5468 +        const Sint16 sample0 = (Sint16) src[0];
  1.5469 +        const Sint16 sample1 = (Sint16) src[1];
  1.5470 +        const Sint16 sample2 = (Sint16) src[2];
  1.5471 +        const Sint16 sample3 = (Sint16) src[3];
  1.5472 +        const Sint16 sample4 = (Sint16) src[4];
  1.5473 +        const Sint16 sample5 = (Sint16) src[5];
  1.5474 +        src += 24;
  1.5475 +        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.5476 +        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.5477 +        dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.5478 +        dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.5479 +        dst[4] = (Uint8) ((sample4 + last_sample4) >> 1);
  1.5480 +        dst[5] = (Uint8) ((sample5 + last_sample5) >> 1);
  1.5481 +        last_sample0 = sample0;
  1.5482 +        last_sample1 = sample1;
  1.5483 +        last_sample2 = sample2;
  1.5484 +        last_sample3 = sample3;
  1.5485 +        last_sample4 = sample4;
  1.5486 +        last_sample5 = sample5;
  1.5487 +        dst += 6;
  1.5488 +    }
  1.5489 +
  1.5490 +    cvt->len_cvt = dstsize;
  1.5491 +    if (cvt->filters[++cvt->filter_index]) {
  1.5492 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5493 +    }
  1.5494 +}
  1.5495 +
  1.5496 +static void SDLCALL
  1.5497 +SDL_Upsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5498 +{
  1.5499 +#ifdef DEBUG_CONVERT
  1.5500 +    fprintf(stderr, "Upsample (x2) AUDIO_U8, 8 channels.\n");
  1.5501 +#endif
  1.5502 +
  1.5503 +    const int srcsize = cvt->len_cvt;
  1.5504 +    const int dstsize = cvt->len_cvt * 2;
  1.5505 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8;
  1.5506 +    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.5507 +    const Uint8 *target = ((const Uint8 *) cvt->buf) - 8;
  1.5508 +    Sint16 last_sample7 = (Sint16) src[7];
  1.5509 +    Sint16 last_sample6 = (Sint16) src[6];
  1.5510 +    Sint16 last_sample5 = (Sint16) src[5];
  1.5511 +    Sint16 last_sample4 = (Sint16) src[4];
  1.5512 +    Sint16 last_sample3 = (Sint16) src[3];
  1.5513 +    Sint16 last_sample2 = (Sint16) src[2];
  1.5514 +    Sint16 last_sample1 = (Sint16) src[1];
  1.5515 +    Sint16 last_sample0 = (Sint16) src[0];
  1.5516 +    while (dst != target) {
  1.5517 +        const Sint16 sample7 = (Sint16) src[7];
  1.5518 +        const Sint16 sample6 = (Sint16) src[6];
  1.5519 +        const Sint16 sample5 = (Sint16) src[5];
  1.5520 +        const Sint16 sample4 = (Sint16) src[4];
  1.5521 +        const Sint16 sample3 = (Sint16) src[3];
  1.5522 +        const Sint16 sample2 = (Sint16) src[2];
  1.5523 +        const Sint16 sample1 = (Sint16) src[1];
  1.5524 +        const Sint16 sample0 = (Sint16) src[0];
  1.5525 +        src -= 8;
  1.5526 +        dst[15] = (Uint8) ((sample7 + last_sample7) >> 1);
  1.5527 +        dst[14] = (Uint8) ((sample6 + last_sample6) >> 1);
  1.5528 +        dst[13] = (Uint8) ((sample5 + last_sample5) >> 1);
  1.5529 +        dst[12] = (Uint8) ((sample4 + last_sample4) >> 1);
  1.5530 +        dst[11] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.5531 +        dst[10] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.5532 +        dst[9] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.5533 +        dst[8] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.5534 +        dst[7] = (Uint8) sample7;
  1.5535 +        dst[6] = (Uint8) sample6;
  1.5536 +        dst[5] = (Uint8) sample5;
  1.5537 +        dst[4] = (Uint8) sample4;
  1.5538 +        dst[3] = (Uint8) sample3;
  1.5539 +        dst[2] = (Uint8) sample2;
  1.5540 +        dst[1] = (Uint8) sample1;
  1.5541 +        dst[0] = (Uint8) sample0;
  1.5542 +        last_sample7 = sample7;
  1.5543 +        last_sample6 = sample6;
  1.5544 +        last_sample5 = sample5;
  1.5545 +        last_sample4 = sample4;
  1.5546 +        last_sample3 = sample3;
  1.5547 +        last_sample2 = sample2;
  1.5548 +        last_sample1 = sample1;
  1.5549 +        last_sample0 = sample0;
  1.5550 +        dst -= 16;
  1.5551 +    }
  1.5552 +
  1.5553 +    cvt->len_cvt = dstsize;
  1.5554 +    if (cvt->filters[++cvt->filter_index]) {
  1.5555 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5556 +    }
  1.5557 +}
  1.5558 +
  1.5559 +static void SDLCALL
  1.5560 +SDL_Downsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5561 +{
  1.5562 +#ifdef DEBUG_CONVERT
  1.5563 +    fprintf(stderr, "Downsample (x2) AUDIO_U8, 8 channels.\n");
  1.5564 +#endif
  1.5565 +
  1.5566 +    const int srcsize = cvt->len_cvt;
  1.5567 +    const int dstsize = cvt->len_cvt / 2;
  1.5568 +    Uint8 *dst = (Uint8 *) cvt->buf;
  1.5569 +    const Uint8 *src = (Uint8 *) cvt->buf;
  1.5570 +    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.5571 +    Sint16 last_sample0 = (Sint16) src[0];
  1.5572 +    Sint16 last_sample1 = (Sint16) src[1];
  1.5573 +    Sint16 last_sample2 = (Sint16) src[2];
  1.5574 +    Sint16 last_sample3 = (Sint16) src[3];
  1.5575 +    Sint16 last_sample4 = (Sint16) src[4];
  1.5576 +    Sint16 last_sample5 = (Sint16) src[5];
  1.5577 +    Sint16 last_sample6 = (Sint16) src[6];
  1.5578 +    Sint16 last_sample7 = (Sint16) src[7];
  1.5579 +    while (dst != target) {
  1.5580 +        const Sint16 sample0 = (Sint16) src[0];
  1.5581 +        const Sint16 sample1 = (Sint16) src[1];
  1.5582 +        const Sint16 sample2 = (Sint16) src[2];
  1.5583 +        const Sint16 sample3 = (Sint16) src[3];
  1.5584 +        const Sint16 sample4 = (Sint16) src[4];
  1.5585 +        const Sint16 sample5 = (Sint16) src[5];
  1.5586 +        const Sint16 sample6 = (Sint16) src[6];
  1.5587 +        const Sint16 sample7 = (Sint16) src[7];
  1.5588 +        src += 16;
  1.5589 +        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.5590 +        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.5591 +        dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.5592 +        dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.5593 +        dst[4] = (Uint8) ((sample4 + last_sample4) >> 1);
  1.5594 +        dst[5] = (Uint8) ((sample5 + last_sample5) >> 1);
  1.5595 +        dst[6] = (Uint8) ((sample6 + last_sample6) >> 1);
  1.5596 +        dst[7] = (Uint8) ((sample7 + last_sample7) >> 1);
  1.5597 +        last_sample0 = sample0;
  1.5598 +        last_sample1 = sample1;
  1.5599 +        last_sample2 = sample2;
  1.5600 +        last_sample3 = sample3;
  1.5601 +        last_sample4 = sample4;
  1.5602 +        last_sample5 = sample5;
  1.5603 +        last_sample6 = sample6;
  1.5604 +        last_sample7 = sample7;
  1.5605 +        dst += 8;
  1.5606 +    }
  1.5607 +
  1.5608 +    cvt->len_cvt = dstsize;
  1.5609 +    if (cvt->filters[++cvt->filter_index]) {
  1.5610 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5611 +    }
  1.5612 +}
  1.5613 +
  1.5614 +static void SDLCALL
  1.5615 +SDL_Upsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5616 +{
  1.5617 +#ifdef DEBUG_CONVERT
  1.5618 +    fprintf(stderr, "Upsample (x4) AUDIO_U8, 8 channels.\n");
  1.5619 +#endif
  1.5620 +
  1.5621 +    const int srcsize = cvt->len_cvt;
  1.5622 +    const int dstsize = cvt->len_cvt * 4;
  1.5623 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8;
  1.5624 +    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.5625 +    const Uint8 *target = ((const Uint8 *) cvt->buf) - 8;
  1.5626 +    Sint16 last_sample7 = (Sint16) src[7];
  1.5627 +    Sint16 last_sample6 = (Sint16) src[6];
  1.5628 +    Sint16 last_sample5 = (Sint16) src[5];
  1.5629 +    Sint16 last_sample4 = (Sint16) src[4];
  1.5630 +    Sint16 last_sample3 = (Sint16) src[3];
  1.5631 +    Sint16 last_sample2 = (Sint16) src[2];
  1.5632 +    Sint16 last_sample1 = (Sint16) src[1];
  1.5633 +    Sint16 last_sample0 = (Sint16) src[0];
  1.5634 +    while (dst != target) {
  1.5635 +        const Sint16 sample7 = (Sint16) src[7];
  1.5636 +        const Sint16 sample6 = (Sint16) src[6];
  1.5637 +        const Sint16 sample5 = (Sint16) src[5];
  1.5638 +        const Sint16 sample4 = (Sint16) src[4];
  1.5639 +        const Sint16 sample3 = (Sint16) src[3];
  1.5640 +        const Sint16 sample2 = (Sint16) src[2];
  1.5641 +        const Sint16 sample1 = (Sint16) src[1];
  1.5642 +        const Sint16 sample0 = (Sint16) src[0];
  1.5643 +        src -= 8;
  1.5644 +        dst[31] = (Uint8) sample7;
  1.5645 +        dst[30] = (Uint8) sample6;
  1.5646 +        dst[29] = (Uint8) sample5;
  1.5647 +        dst[28] = (Uint8) sample4;
  1.5648 +        dst[27] = (Uint8) sample3;
  1.5649 +        dst[26] = (Uint8) sample2;
  1.5650 +        dst[25] = (Uint8) sample1;
  1.5651 +        dst[24] = (Uint8) sample0;
  1.5652 +        dst[23] = (Uint8) (((3 * sample7) + last_sample7) >> 2);
  1.5653 +        dst[22] = (Uint8) (((3 * sample6) + last_sample6) >> 2);
  1.5654 +        dst[21] = (Uint8) (((3 * sample5) + last_sample5) >> 2);
  1.5655 +        dst[20] = (Uint8) (((3 * sample4) + last_sample4) >> 2);
  1.5656 +        dst[19] = (Uint8) (((3 * sample3) + last_sample3) >> 2);
  1.5657 +        dst[18] = (Uint8) (((3 * sample2) + last_sample2) >> 2);
  1.5658 +        dst[17] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
  1.5659 +        dst[16] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
  1.5660 +        dst[15] = (Uint8) ((sample7 + last_sample7) >> 1);
  1.5661 +        dst[14] = (Uint8) ((sample6 + last_sample6) >> 1);
  1.5662 +        dst[13] = (Uint8) ((sample5 + last_sample5) >> 1);
  1.5663 +        dst[12] = (Uint8) ((sample4 + last_sample4) >> 1);
  1.5664 +        dst[11] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.5665 +        dst[10] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.5666 +        dst[9] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.5667 +        dst[8] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.5668 +        dst[7] = (Uint8) ((sample7 + (3 * last_sample7)) >> 2);
  1.5669 +        dst[6] = (Uint8) ((sample6 + (3 * last_sample6)) >> 2);
  1.5670 +        dst[5] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2);
  1.5671 +        dst[4] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2);
  1.5672 +        dst[3] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2);
  1.5673 +        dst[2] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2);
  1.5674 +        dst[1] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
  1.5675 +        dst[0] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
  1.5676 +        last_sample7 = sample7;
  1.5677 +        last_sample6 = sample6;
  1.5678 +        last_sample5 = sample5;
  1.5679 +        last_sample4 = sample4;
  1.5680 +        last_sample3 = sample3;
  1.5681 +        last_sample2 = sample2;
  1.5682 +        last_sample1 = sample1;
  1.5683 +        last_sample0 = sample0;
  1.5684 +        dst -= 32;
  1.5685 +    }
  1.5686 +
  1.5687 +    cvt->len_cvt = dstsize;
  1.5688 +    if (cvt->filters[++cvt->filter_index]) {
  1.5689 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5690 +    }
  1.5691 +}
  1.5692 +
  1.5693 +static void SDLCALL
  1.5694 +SDL_Downsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5695 +{
  1.5696 +#ifdef DEBUG_CONVERT
  1.5697 +    fprintf(stderr, "Downsample (x4) AUDIO_U8, 8 channels.\n");
  1.5698 +#endif
  1.5699 +
  1.5700 +    const int srcsize = cvt->len_cvt;
  1.5701 +    const int dstsize = cvt->len_cvt / 4;
  1.5702 +    Uint8 *dst = (Uint8 *) cvt->buf;
  1.5703 +    const Uint8 *src = (Uint8 *) cvt->buf;
  1.5704 +    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.5705 +    Sint16 last_sample0 = (Sint16) src[0];
  1.5706 +    Sint16 last_sample1 = (Sint16) src[1];
  1.5707 +    Sint16 last_sample2 = (Sint16) src[2];
  1.5708 +    Sint16 last_sample3 = (Sint16) src[3];
  1.5709 +    Sint16 last_sample4 = (Sint16) src[4];
  1.5710 +    Sint16 last_sample5 = (Sint16) src[5];
  1.5711 +    Sint16 last_sample6 = (Sint16) src[6];
  1.5712 +    Sint16 last_sample7 = (Sint16) src[7];
  1.5713 +    while (dst != target) {
  1.5714 +        const Sint16 sample0 = (Sint16) src[0];
  1.5715 +        const Sint16 sample1 = (Sint16) src[1];
  1.5716 +        const Sint16 sample2 = (Sint16) src[2];
  1.5717 +        const Sint16 sample3 = (Sint16) src[3];
  1.5718 +        const Sint16 sample4 = (Sint16) src[4];
  1.5719 +        const Sint16 sample5 = (Sint16) src[5];
  1.5720 +        const Sint16 sample6 = (Sint16) src[6];
  1.5721 +        const Sint16 sample7 = (Sint16) src[7];
  1.5722 +        src += 32;
  1.5723 +        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.5724 +        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.5725 +        dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.5726 +        dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.5727 +        dst[4] = (Uint8) ((sample4 + last_sample4) >> 1);
  1.5728 +        dst[5] = (Uint8) ((sample5 + last_sample5) >> 1);
  1.5729 +        dst[6] = (Uint8) ((sample6 + last_sample6) >> 1);
  1.5730 +        dst[7] = (Uint8) ((sample7 + last_sample7) >> 1);
  1.5731 +        last_sample0 = sample0;
  1.5732 +        last_sample1 = sample1;
  1.5733 +        last_sample2 = sample2;
  1.5734 +        last_sample3 = sample3;
  1.5735 +        last_sample4 = sample4;
  1.5736 +        last_sample5 = sample5;
  1.5737 +        last_sample6 = sample6;
  1.5738 +        last_sample7 = sample7;
  1.5739 +        dst += 8;
  1.5740 +    }
  1.5741 +
  1.5742 +    cvt->len_cvt = dstsize;
  1.5743 +    if (cvt->filters[++cvt->filter_index]) {
  1.5744 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5745 +    }
  1.5746 +}
  1.5747 +
  1.5748 +static void SDLCALL
  1.5749 +SDL_Upsample_S8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5750 +{
  1.5751 +#ifdef DEBUG_CONVERT
  1.5752 +    fprintf(stderr, "Upsample (x2) AUDIO_S8, 1 channels.\n");
  1.5753 +#endif
  1.5754 +
  1.5755 +    const int srcsize = cvt->len_cvt;
  1.5756 +    const int dstsize = cvt->len_cvt * 2;
  1.5757 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1;
  1.5758 +    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.5759 +    const Sint8 *target = ((const Sint8 *) cvt->buf) - 1;
  1.5760 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.5761 +    while (dst != target) {
  1.5762 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.5763 +        src--;
  1.5764 +        dst[1] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.5765 +        dst[0] = (Sint8) sample0;
  1.5766 +        last_sample0 = sample0;
  1.5767 +        dst -= 2;
  1.5768 +    }
  1.5769 +
  1.5770 +    cvt->len_cvt = dstsize;
  1.5771 +    if (cvt->filters[++cvt->filter_index]) {
  1.5772 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5773 +    }
  1.5774 +}
  1.5775 +
  1.5776 +static void SDLCALL
  1.5777 +SDL_Downsample_S8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5778 +{
  1.5779 +#ifdef DEBUG_CONVERT
  1.5780 +    fprintf(stderr, "Downsample (x2) AUDIO_S8, 1 channels.\n");
  1.5781 +#endif
  1.5782 +
  1.5783 +    const int srcsize = cvt->len_cvt;
  1.5784 +    const int dstsize = cvt->len_cvt / 2;
  1.5785 +    Sint8 *dst = (Sint8 *) cvt->buf;
  1.5786 +    const Sint8 *src = (Sint8 *) cvt->buf;
  1.5787 +    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
  1.5788 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.5789 +    while (dst != target) {
  1.5790 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.5791 +        src += 2;
  1.5792 +        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.5793 +        last_sample0 = sample0;
  1.5794 +        dst++;
  1.5795 +    }
  1.5796 +
  1.5797 +    cvt->len_cvt = dstsize;
  1.5798 +    if (cvt->filters[++cvt->filter_index]) {
  1.5799 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5800 +    }
  1.5801 +}
  1.5802 +
  1.5803 +static void SDLCALL
  1.5804 +SDL_Upsample_S8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5805 +{
  1.5806 +#ifdef DEBUG_CONVERT
  1.5807 +    fprintf(stderr, "Upsample (x4) AUDIO_S8, 1 channels.\n");
  1.5808 +#endif
  1.5809 +
  1.5810 +    const int srcsize = cvt->len_cvt;
  1.5811 +    const int dstsize = cvt->len_cvt * 4;
  1.5812 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1;
  1.5813 +    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.5814 +    const Sint8 *target = ((const Sint8 *) cvt->buf) - 1;
  1.5815 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.5816 +    while (dst != target) {
  1.5817 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.5818 +        src--;
  1.5819 +        dst[3] = (Sint8) sample0;
  1.5820 +        dst[2] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
  1.5821 +        dst[1] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.5822 +        dst[0] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
  1.5823 +        last_sample0 = sample0;
  1.5824 +        dst -= 4;
  1.5825 +    }
  1.5826 +
  1.5827 +    cvt->len_cvt = dstsize;
  1.5828 +    if (cvt->filters[++cvt->filter_index]) {
  1.5829 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5830 +    }
  1.5831 +}
  1.5832 +
  1.5833 +static void SDLCALL
  1.5834 +SDL_Downsample_S8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5835 +{
  1.5836 +#ifdef DEBUG_CONVERT
  1.5837 +    fprintf(stderr, "Downsample (x4) AUDIO_S8, 1 channels.\n");
  1.5838 +#endif
  1.5839 +
  1.5840 +    const int srcsize = cvt->len_cvt;
  1.5841 +    const int dstsize = cvt->len_cvt / 4;
  1.5842 +    Sint8 *dst = (Sint8 *) cvt->buf;
  1.5843 +    const Sint8 *src = (Sint8 *) cvt->buf;
  1.5844 +    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
  1.5845 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.5846 +    while (dst != target) {
  1.5847 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.5848 +        src += 4;
  1.5849 +        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.5850 +        last_sample0 = sample0;
  1.5851 +        dst++;
  1.5852 +    }
  1.5853 +
  1.5854 +    cvt->len_cvt = dstsize;
  1.5855 +    if (cvt->filters[++cvt->filter_index]) {
  1.5856 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5857 +    }
  1.5858 +}
  1.5859 +
  1.5860 +static void SDLCALL
  1.5861 +SDL_Upsample_S8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5862 +{
  1.5863 +#ifdef DEBUG_CONVERT
  1.5864 +    fprintf(stderr, "Upsample (x2) AUDIO_S8, 2 channels.\n");
  1.5865 +#endif
  1.5866 +
  1.5867 +    const int srcsize = cvt->len_cvt;
  1.5868 +    const int dstsize = cvt->len_cvt * 2;
  1.5869 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2;
  1.5870 +    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.5871 +    const Sint8 *target = ((const Sint8 *) cvt->buf) - 2;
  1.5872 +    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
  1.5873 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.5874 +    while (dst != target) {
  1.5875 +        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
  1.5876 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.5877 +        src -= 2;
  1.5878 +        dst[3] = (Sint8) ((sample1 + last_sample1) >> 1);
  1.5879 +        dst[2] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.5880 +        dst[1] = (Sint8) sample1;
  1.5881 +        dst[0] = (Sint8) sample0;
  1.5882 +        last_sample1 = sample1;
  1.5883 +        last_sample0 = sample0;
  1.5884 +        dst -= 4;
  1.5885 +    }
  1.5886 +
  1.5887 +    cvt->len_cvt = dstsize;
  1.5888 +    if (cvt->filters[++cvt->filter_index]) {
  1.5889 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5890 +    }
  1.5891 +}
  1.5892 +
  1.5893 +static void SDLCALL
  1.5894 +SDL_Downsample_S8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5895 +{
  1.5896 +#ifdef DEBUG_CONVERT
  1.5897 +    fprintf(stderr, "Downsample (x2) AUDIO_S8, 2 channels.\n");
  1.5898 +#endif
  1.5899 +
  1.5900 +    const int srcsize = cvt->len_cvt;
  1.5901 +    const int dstsize = cvt->len_cvt / 2;
  1.5902 +    Sint8 *dst = (Sint8 *) cvt->buf;
  1.5903 +    const Sint8 *src = (Sint8 *) cvt->buf;
  1.5904 +    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
  1.5905 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.5906 +    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
  1.5907 +    while (dst != target) {
  1.5908 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.5909 +        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
  1.5910 +        src += 4;
  1.5911 +        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.5912 +        dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
  1.5913 +        last_sample0 = sample0;
  1.5914 +        last_sample1 = sample1;
  1.5915 +        dst += 2;
  1.5916 +    }
  1.5917 +
  1.5918 +    cvt->len_cvt = dstsize;
  1.5919 +    if (cvt->filters[++cvt->filter_index]) {
  1.5920 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5921 +    }
  1.5922 +}
  1.5923 +
  1.5924 +static void SDLCALL
  1.5925 +SDL_Upsample_S8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5926 +{
  1.5927 +#ifdef DEBUG_CONVERT
  1.5928 +    fprintf(stderr, "Upsample (x4) AUDIO_S8, 2 channels.\n");
  1.5929 +#endif
  1.5930 +
  1.5931 +    const int srcsize = cvt->len_cvt;
  1.5932 +    const int dstsize = cvt->len_cvt * 4;
  1.5933 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2;
  1.5934 +    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.5935 +    const Sint8 *target = ((const Sint8 *) cvt->buf) - 2;
  1.5936 +    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
  1.5937 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.5938 +    while (dst != target) {
  1.5939 +        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
  1.5940 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.5941 +        src -= 2;
  1.5942 +        dst[7] = (Sint8) sample1;
  1.5943 +        dst[6] = (Sint8) sample0;
  1.5944 +        dst[5] = (Sint8) (((3 * sample1) + last_sample1) >> 2);
  1.5945 +        dst[4] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
  1.5946 +        dst[3] = (Sint8) ((sample1 + last_sample1) >> 1);
  1.5947 +        dst[2] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.5948 +        dst[1] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2);
  1.5949 +        dst[0] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
  1.5950 +        last_sample1 = sample1;
  1.5951 +        last_sample0 = sample0;
  1.5952 +        dst -= 8;
  1.5953 +    }
  1.5954 +
  1.5955 +    cvt->len_cvt = dstsize;
  1.5956 +    if (cvt->filters[++cvt->filter_index]) {
  1.5957 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5958 +    }
  1.5959 +}
  1.5960 +
  1.5961 +static void SDLCALL
  1.5962 +SDL_Downsample_S8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5963 +{
  1.5964 +#ifdef DEBUG_CONVERT
  1.5965 +    fprintf(stderr, "Downsample (x4) AUDIO_S8, 2 channels.\n");
  1.5966 +#endif
  1.5967 +
  1.5968 +    const int srcsize = cvt->len_cvt;
  1.5969 +    const int dstsize = cvt->len_cvt / 4;
  1.5970 +    Sint8 *dst = (Sint8 *) cvt->buf;
  1.5971 +    const Sint8 *src = (Sint8 *) cvt->buf;
  1.5972 +    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
  1.5973 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.5974 +    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
  1.5975 +    while (dst != target) {
  1.5976 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.5977 +        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
  1.5978 +        src += 8;
  1.5979 +        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.5980 +        dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
  1.5981 +        last_sample0 = sample0;
  1.5982 +        last_sample1 = sample1;
  1.5983 +        dst += 2;
  1.5984 +    }
  1.5985 +
  1.5986 +    cvt->len_cvt = dstsize;
  1.5987 +    if (cvt->filters[++cvt->filter_index]) {
  1.5988 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.5989 +    }
  1.5990 +}
  1.5991 +
  1.5992 +static void SDLCALL
  1.5993 +SDL_Upsample_S8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5994 +{
  1.5995 +#ifdef DEBUG_CONVERT
  1.5996 +    fprintf(stderr, "Upsample (x2) AUDIO_S8, 4 channels.\n");
  1.5997 +#endif
  1.5998 +
  1.5999 +    const int srcsize = cvt->len_cvt;
  1.6000 +    const int dstsize = cvt->len_cvt * 2;
  1.6001 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4;
  1.6002 +    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.6003 +    const Sint8 *target = ((const Sint8 *) cvt->buf) - 4;
  1.6004 +    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
  1.6005 +    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
  1.6006 +    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
  1.6007 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.6008 +    while (dst != target) {
  1.6009 +        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
  1.6010 +        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
  1.6011 +        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
  1.6012 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.6013 +        src -= 4;
  1.6014 +        dst[7] = (Sint8) ((sample3 + last_sample3) >> 1);
  1.6015 +        dst[6] = (Sint8) ((sample2 + last_sample2) >> 1);
  1.6016 +        dst[5] = (Sint8) ((sample1 + last_sample1) >> 1);
  1.6017 +        dst[4] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.6018 +        dst[3] = (Sint8) sample3;
  1.6019 +        dst[2] = (Sint8) sample2;
  1.6020 +        dst[1] = (Sint8) sample1;
  1.6021 +        dst[0] = (Sint8) sample0;
  1.6022 +        last_sample3 = sample3;
  1.6023 +        last_sample2 = sample2;
  1.6024 +        last_sample1 = sample1;
  1.6025 +        last_sample0 = sample0;
  1.6026 +        dst -= 8;
  1.6027 +    }
  1.6028 +
  1.6029 +    cvt->len_cvt = dstsize;
  1.6030 +    if (cvt->filters[++cvt->filter_index]) {
  1.6031 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6032 +    }
  1.6033 +}
  1.6034 +
  1.6035 +static void SDLCALL
  1.6036 +SDL_Downsample_S8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6037 +{
  1.6038 +#ifdef DEBUG_CONVERT
  1.6039 +    fprintf(stderr, "Downsample (x2) AUDIO_S8, 4 channels.\n");
  1.6040 +#endif
  1.6041 +
  1.6042 +    const int srcsize = cvt->len_cvt;
  1.6043 +    const int dstsize = cvt->len_cvt / 2;
  1.6044 +    Sint8 *dst = (Sint8 *) cvt->buf;
  1.6045 +    const Sint8 *src = (Sint8 *) cvt->buf;
  1.6046 +    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
  1.6047 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.6048 +    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
  1.6049 +    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
  1.6050 +    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
  1.6051 +    while (dst != target) {
  1.6052 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.6053 +        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
  1.6054 +        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
  1.6055 +        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
  1.6056 +        src += 8;
  1.6057 +        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.6058 +        dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
  1.6059 +        dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
  1.6060 +        dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
  1.6061 +        last_sample0 = sample0;
  1.6062 +        last_sample1 = sample1;
  1.6063 +        last_sample2 = sample2;
  1.6064 +        last_sample3 = sample3;
  1.6065 +        dst += 4;
  1.6066 +    }
  1.6067 +
  1.6068 +    cvt->len_cvt = dstsize;
  1.6069 +    if (cvt->filters[++cvt->filter_index]) {
  1.6070 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6071 +    }
  1.6072 +}
  1.6073 +
  1.6074 +static void SDLCALL
  1.6075 +SDL_Upsample_S8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6076 +{
  1.6077 +#ifdef DEBUG_CONVERT
  1.6078 +    fprintf(stderr, "Upsample (x4) AUDIO_S8, 4 channels.\n");
  1.6079 +#endif
  1.6080 +
  1.6081 +    const int srcsize = cvt->len_cvt;
  1.6082 +    const int dstsize = cvt->len_cvt * 4;
  1.6083 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4;
  1.6084 +    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.6085 +    const Sint8 *target = ((const Sint8 *) cvt->buf) - 4;
  1.6086 +    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
  1.6087 +    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
  1.6088 +    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
  1.6089 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.6090 +    while (dst != target) {
  1.6091 +        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
  1.6092 +        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
  1.6093 +        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
  1.6094 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.6095 +        src -= 4;
  1.6096 +        dst[15] = (Sint8) sample3;
  1.6097 +        dst[14] = (Sint8) sample2;
  1.6098 +        dst[13] = (Sint8) sample1;
  1.6099 +        dst[12] = (Sint8) sample0;
  1.6100 +        dst[11] = (Sint8) (((3 * sample3) + last_sample3) >> 2);
  1.6101 +        dst[10] = (Sint8) (((3 * sample2) + last_sample2) >> 2);
  1.6102 +        dst[9] = (Sint8) (((3 * sample1) + last_sample1) >> 2);
  1.6103 +        dst[8] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
  1.6104 +        dst[7] = (Sint8) ((sample3 + last_sample3) >> 1);
  1.6105 +        dst[6] = (Sint8) ((sample2 + last_sample2) >> 1);
  1.6106 +        dst[5] = (Sint8) ((sample1 + last_sample1) >> 1);
  1.6107 +        dst[4] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.6108 +        dst[3] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2);
  1.6109 +        dst[2] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2);
  1.6110 +        dst[1] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2);
  1.6111 +        dst[0] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
  1.6112 +        last_sample3 = sample3;
  1.6113 +        last_sample2 = sample2;
  1.6114 +        last_sample1 = sample1;
  1.6115 +        last_sample0 = sample0;
  1.6116 +        dst -= 16;
  1.6117 +    }
  1.6118 +
  1.6119 +    cvt->len_cvt = dstsize;
  1.6120 +    if (cvt->filters[++cvt->filter_index]) {
  1.6121 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6122 +    }
  1.6123 +}
  1.6124 +
  1.6125 +static void SDLCALL
  1.6126 +SDL_Downsample_S8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6127 +{
  1.6128 +#ifdef DEBUG_CONVERT
  1.6129 +    fprintf(stderr, "Downsample (x4) AUDIO_S8, 4 channels.\n");
  1.6130 +#endif
  1.6131 +
  1.6132 +    const int srcsize = cvt->len_cvt;
  1.6133 +    const int dstsize = cvt->len_cvt / 4;
  1.6134 +    Sint8 *dst = (Sint8 *) cvt->buf;
  1.6135 +    const Sint8 *src = (Sint8 *) cvt->buf;
  1.6136 +    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
  1.6137 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.6138 +    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
  1.6139 +    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
  1.6140 +    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
  1.6141 +    while (dst != target) {
  1.6142 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.6143 +        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
  1.6144 +        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
  1.6145 +        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
  1.6146 +        src += 16;
  1.6147 +        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.6148 +        dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
  1.6149 +        dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
  1.6150 +        dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
  1.6151 +        last_sample0 = sample0;
  1.6152 +        last_sample1 = sample1;
  1.6153 +        last_sample2 = sample2;
  1.6154 +        last_sample3 = sample3;
  1.6155 +        dst += 4;
  1.6156 +    }
  1.6157 +
  1.6158 +    cvt->len_cvt = dstsize;
  1.6159 +    if (cvt->filters[++cvt->filter_index]) {
  1.6160 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6161 +    }
  1.6162 +}
  1.6163 +
  1.6164 +static void SDLCALL
  1.6165 +SDL_Upsample_S8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6166 +{
  1.6167 +#ifdef DEBUG_CONVERT
  1.6168 +    fprintf(stderr, "Upsample (x2) AUDIO_S8, 6 channels.\n");
  1.6169 +#endif
  1.6170 +
  1.6171 +    const int srcsize = cvt->len_cvt;
  1.6172 +    const int dstsize = cvt->len_cvt * 2;
  1.6173 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6;
  1.6174 +    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.6175 +    const Sint8 *target = ((const Sint8 *) cvt->buf) - 6;
  1.6176 +    Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
  1.6177 +    Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
  1.6178 +    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
  1.6179 +    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
  1.6180 +    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
  1.6181 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.6182 +    while (dst != target) {
  1.6183 +        const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
  1.6184 +        const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
  1.6185 +        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
  1.6186 +        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
  1.6187 +        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
  1.6188 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.6189 +        src -= 6;
  1.6190 +        dst[11] = (Sint8) ((sample5 + last_sample5) >> 1);
  1.6191 +        dst[10] = (Sint8) ((sample4 + last_sample4) >> 1);
  1.6192 +        dst[9] = (Sint8) ((sample3 + last_sample3) >> 1);
  1.6193 +        dst[8] = (Sint8) ((sample2 + last_sample2) >> 1);
  1.6194 +        dst[7] = (Sint8) ((sample1 + last_sample1) >> 1);
  1.6195 +        dst[6] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.6196 +        dst[5] = (Sint8) sample5;
  1.6197 +        dst[4] = (Sint8) sample4;
  1.6198 +        dst[3] = (Sint8) sample3;
  1.6199 +        dst[2] = (Sint8) sample2;
  1.6200 +        dst[1] = (Sint8) sample1;
  1.6201 +        dst[0] = (Sint8) sample0;
  1.6202 +        last_sample5 = sample5;
  1.6203 +        last_sample4 = sample4;
  1.6204 +        last_sample3 = sample3;
  1.6205 +        last_sample2 = sample2;
  1.6206 +        last_sample1 = sample1;
  1.6207 +        last_sample0 = sample0;
  1.6208 +        dst -= 12;
  1.6209 +    }
  1.6210 +
  1.6211 +    cvt->len_cvt = dstsize;
  1.6212 +    if (cvt->filters[++cvt->filter_index]) {
  1.6213 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6214 +    }
  1.6215 +}
  1.6216 +
  1.6217 +static void SDLCALL
  1.6218 +SDL_Downsample_S8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6219 +{
  1.6220 +#ifdef DEBUG_CONVERT
  1.6221 +    fprintf(stderr, "Downsample (x2) AUDIO_S8, 6 channels.\n");
  1.6222 +#endif
  1.6223 +
  1.6224 +    const int srcsize = cvt->len_cvt;
  1.6225 +    const int dstsize = cvt->len_cvt / 2;
  1.6226 +    Sint8 *dst = (Sint8 *) cvt->buf;
  1.6227 +    const Sint8 *src = (Sint8 *) cvt->buf;
  1.6228 +    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
  1.6229 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.6230 +    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
  1.6231 +    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
  1.6232 +    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
  1.6233 +    Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
  1.6234 +    Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
  1.6235 +    while (dst != target) {
  1.6236 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.6237 +        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
  1.6238 +        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
  1.6239 +        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
  1.6240 +        const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
  1.6241 +        const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
  1.6242 +        src += 12;
  1.6243 +        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.6244 +        dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
  1.6245 +        dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
  1.6246 +        dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
  1.6247 +        dst[4] = (Sint8) ((sample4 + last_sample4) >> 1);
  1.6248 +        dst[5] = (Sint8) ((sample5 + last_sample5) >> 1);
  1.6249 +        last_sample0 = sample0;
  1.6250 +        last_sample1 = sample1;
  1.6251 +        last_sample2 = sample2;
  1.6252 +        last_sample3 = sample3;
  1.6253 +        last_sample4 = sample4;
  1.6254 +        last_sample5 = sample5;
  1.6255 +        dst += 6;
  1.6256 +    }
  1.6257 +
  1.6258 +    cvt->len_cvt = dstsize;
  1.6259 +    if (cvt->filters[++cvt->filter_index]) {
  1.6260 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6261 +    }
  1.6262 +}
  1.6263 +
  1.6264 +static void SDLCALL
  1.6265 +SDL_Upsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6266 +{
  1.6267 +#ifdef DEBUG_CONVERT
  1.6268 +    fprintf(stderr, "Upsample (x4) AUDIO_S8, 6 channels.\n");
  1.6269 +#endif
  1.6270 +
  1.6271 +    const int srcsize = cvt->len_cvt;
  1.6272 +    const int dstsize = cvt->len_cvt * 4;
  1.6273 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6;
  1.6274 +    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.6275 +    const Sint8 *target = ((const Sint8 *) cvt->buf) - 6;
  1.6276 +    Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
  1.6277 +    Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
  1.6278 +    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
  1.6279 +    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
  1.6280 +    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
  1.6281 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.6282 +    while (dst != target) {
  1.6283 +        const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
  1.6284 +        const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
  1.6285 +        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
  1.6286 +        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
  1.6287 +        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
  1.6288 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.6289 +        src -= 6;
  1.6290 +        dst[23] = (Sint8) sample5;
  1.6291 +        dst[22] = (Sint8) sample4;
  1.6292 +        dst[21] = (Sint8) sample3;
  1.6293 +        dst[20] = (Sint8) sample2;
  1.6294 +        dst[19] = (Sint8) sample1;
  1.6295 +        dst[18] = (Sint8) sample0;
  1.6296 +        dst[17] = (Sint8) (((3 * sample5) + last_sample5) >> 2);
  1.6297 +        dst[16] = (Sint8) (((3 * sample4) + last_sample4) >> 2);
  1.6298 +        dst[15] = (Sint8) (((3 * sample3) + last_sample3) >> 2);
  1.6299 +        dst[14] = (Sint8) (((3 * sample2) + last_sample2) >> 2);
  1.6300 +        dst[13] = (Sint8) (((3 * sample1) + last_sample1) >> 2);
  1.6301 +        dst[12] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
  1.6302 +        dst[11] = (Sint8) ((sample5 + last_sample5) >> 1);
  1.6303 +        dst[10] = (Sint8) ((sample4 + last_sample4) >> 1);
  1.6304 +        dst[9] = (Sint8) ((sample3 + last_sample3) >> 1);
  1.6305 +        dst[8] = (Sint8) ((sample2 + last_sample2) >> 1);
  1.6306 +        dst[7] = (Sint8) ((sample1 + last_sample1) >> 1);
  1.6307 +        dst[6] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.6308 +        dst[5] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2);
  1.6309 +        dst[4] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2);
  1.6310 +        dst[3] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2);
  1.6311 +        dst[2] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2);
  1.6312 +        dst[1] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2);
  1.6313 +        dst[0] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
  1.6314 +        last_sample5 = sample5;
  1.6315 +        last_sample4 = sample4;
  1.6316 +        last_sample3 = sample3;
  1.6317 +        last_sample2 = sample2;
  1.6318 +        last_sample1 = sample1;
  1.6319 +        last_sample0 = sample0;
  1.6320 +        dst -= 24;
  1.6321 +    }
  1.6322 +
  1.6323 +    cvt->len_cvt = dstsize;
  1.6324 +    if (cvt->filters[++cvt->filter_index]) {
  1.6325 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6326 +    }
  1.6327 +}
  1.6328 +
  1.6329 +static void SDLCALL
  1.6330 +SDL_Downsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6331 +{
  1.6332 +#ifdef DEBUG_CONVERT
  1.6333 +    fprintf(stderr, "Downsample (x4) AUDIO_S8, 6 channels.\n");
  1.6334 +#endif
  1.6335 +
  1.6336 +    const int srcsize = cvt->len_cvt;
  1.6337 +    const int dstsize = cvt->len_cvt / 4;
  1.6338 +    Sint8 *dst = (Sint8 *) cvt->buf;
  1.6339 +    const Sint8 *src = (Sint8 *) cvt->buf;
  1.6340 +    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
  1.6341 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.6342 +    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
  1.6343 +    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
  1.6344 +    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
  1.6345 +    Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
  1.6346 +    Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
  1.6347 +    while (dst != target) {
  1.6348 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.6349 +        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
  1.6350 +        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
  1.6351 +        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
  1.6352 +        const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
  1.6353 +        const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
  1.6354 +        src += 24;
  1.6355 +        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.6356 +        dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
  1.6357 +        dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
  1.6358 +        dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
  1.6359 +        dst[4] = (Sint8) ((sample4 + last_sample4) >> 1);
  1.6360 +        dst[5] = (Sint8) ((sample5 + last_sample5) >> 1);
  1.6361 +        last_sample0 = sample0;
  1.6362 +        last_sample1 = sample1;
  1.6363 +        last_sample2 = sample2;
  1.6364 +        last_sample3 = sample3;
  1.6365 +        last_sample4 = sample4;
  1.6366 +        last_sample5 = sample5;
  1.6367 +        dst += 6;
  1.6368 +    }
  1.6369 +
  1.6370 +    cvt->len_cvt = dstsize;
  1.6371 +    if (cvt->filters[++cvt->filter_index]) {
  1.6372 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6373 +    }
  1.6374 +}
  1.6375 +
  1.6376 +static void SDLCALL
  1.6377 +SDL_Upsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6378 +{
  1.6379 +#ifdef DEBUG_CONVERT
  1.6380 +    fprintf(stderr, "Upsample (x2) AUDIO_S8, 8 channels.\n");
  1.6381 +#endif
  1.6382 +
  1.6383 +    const int srcsize = cvt->len_cvt;
  1.6384 +    const int dstsize = cvt->len_cvt * 2;
  1.6385 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8;
  1.6386 +    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.6387 +    const Sint8 *target = ((const Sint8 *) cvt->buf) - 8;
  1.6388 +    Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
  1.6389 +    Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
  1.6390 +    Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
  1.6391 +    Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
  1.6392 +    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
  1.6393 +    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
  1.6394 +    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
  1.6395 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.6396 +    while (dst != target) {
  1.6397 +        const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
  1.6398 +        const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
  1.6399 +        const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
  1.6400 +        const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
  1.6401 +        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
  1.6402 +        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
  1.6403 +        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
  1.6404 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.6405 +        src -= 8;
  1.6406 +        dst[15] = (Sint8) ((sample7 + last_sample7) >> 1);
  1.6407 +        dst[14] = (Sint8) ((sample6 + last_sample6) >> 1);
  1.6408 +        dst[13] = (Sint8) ((sample5 + last_sample5) >> 1);
  1.6409 +        dst[12] = (Sint8) ((sample4 + last_sample4) >> 1);
  1.6410 +        dst[11] = (Sint8) ((sample3 + last_sample3) >> 1);
  1.6411 +        dst[10] = (Sint8) ((sample2 + last_sample2) >> 1);
  1.6412 +        dst[9] = (Sint8) ((sample1 + last_sample1) >> 1);
  1.6413 +        dst[8] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.6414 +        dst[7] = (Sint8) sample7;
  1.6415 +        dst[6] = (Sint8) sample6;
  1.6416 +        dst[5] = (Sint8) sample5;
  1.6417 +        dst[4] = (Sint8) sample4;
  1.6418 +        dst[3] = (Sint8) sample3;
  1.6419 +        dst[2] = (Sint8) sample2;
  1.6420 +        dst[1] = (Sint8) sample1;
  1.6421 +        dst[0] = (Sint8) sample0;
  1.6422 +        last_sample7 = sample7;
  1.6423 +        last_sample6 = sample6;
  1.6424 +        last_sample5 = sample5;
  1.6425 +        last_sample4 = sample4;
  1.6426 +        last_sample3 = sample3;
  1.6427 +        last_sample2 = sample2;
  1.6428 +        last_sample1 = sample1;
  1.6429 +        last_sample0 = sample0;
  1.6430 +        dst -= 16;
  1.6431 +    }
  1.6432 +
  1.6433 +    cvt->len_cvt = dstsize;
  1.6434 +    if (cvt->filters[++cvt->filter_index]) {
  1.6435 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6436 +    }
  1.6437 +}
  1.6438 +
  1.6439 +static void SDLCALL
  1.6440 +SDL_Downsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6441 +{
  1.6442 +#ifdef DEBUG_CONVERT
  1.6443 +    fprintf(stderr, "Downsample (x2) AUDIO_S8, 8 channels.\n");
  1.6444 +#endif
  1.6445 +
  1.6446 +    const int srcsize = cvt->len_cvt;
  1.6447 +    const int dstsize = cvt->len_cvt / 2;
  1.6448 +    Sint8 *dst = (Sint8 *) cvt->buf;
  1.6449 +    const Sint8 *src = (Sint8 *) cvt->buf;
  1.6450 +    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
  1.6451 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.6452 +    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
  1.6453 +    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
  1.6454 +    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
  1.6455 +    Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
  1.6456 +    Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
  1.6457 +    Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
  1.6458 +    Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
  1.6459 +    while (dst != target) {
  1.6460 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.6461 +        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
  1.6462 +        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
  1.6463 +        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
  1.6464 +        const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
  1.6465 +        const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
  1.6466 +        const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
  1.6467 +        const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
  1.6468 +        src += 16;
  1.6469 +        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.6470 +        dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
  1.6471 +        dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
  1.6472 +        dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
  1.6473 +        dst[4] = (Sint8) ((sample4 + last_sample4) >> 1);
  1.6474 +        dst[5] = (Sint8) ((sample5 + last_sample5) >> 1);
  1.6475 +        dst[6] = (Sint8) ((sample6 + last_sample6) >> 1);
  1.6476 +        dst[7] = (Sint8) ((sample7 + last_sample7) >> 1);
  1.6477 +        last_sample0 = sample0;
  1.6478 +        last_sample1 = sample1;
  1.6479 +        last_sample2 = sample2;
  1.6480 +        last_sample3 = sample3;
  1.6481 +        last_sample4 = sample4;
  1.6482 +        last_sample5 = sample5;
  1.6483 +        last_sample6 = sample6;
  1.6484 +        last_sample7 = sample7;
  1.6485 +        dst += 8;
  1.6486 +    }
  1.6487 +
  1.6488 +    cvt->len_cvt = dstsize;
  1.6489 +    if (cvt->filters[++cvt->filter_index]) {
  1.6490 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6491 +    }
  1.6492 +}
  1.6493 +
  1.6494 +static void SDLCALL
  1.6495 +SDL_Upsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6496 +{
  1.6497 +#ifdef DEBUG_CONVERT
  1.6498 +    fprintf(stderr, "Upsample (x4) AUDIO_S8, 8 channels.\n");
  1.6499 +#endif
  1.6500 +
  1.6501 +    const int srcsize = cvt->len_cvt;
  1.6502 +    const int dstsize = cvt->len_cvt * 4;
  1.6503 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8;
  1.6504 +    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.6505 +    const Sint8 *target = ((const Sint8 *) cvt->buf) - 8;
  1.6506 +    Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
  1.6507 +    Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
  1.6508 +    Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
  1.6509 +    Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
  1.6510 +    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
  1.6511 +    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
  1.6512 +    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
  1.6513 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.6514 +    while (dst != target) {
  1.6515 +        const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
  1.6516 +        const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
  1.6517 +        const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
  1.6518 +        const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
  1.6519 +        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
  1.6520 +        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
  1.6521 +        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
  1.6522 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.6523 +        src -= 8;
  1.6524 +        dst[31] = (Sint8) sample7;
  1.6525 +        dst[30] = (Sint8) sample6;
  1.6526 +        dst[29] = (Sint8) sample5;
  1.6527 +        dst[28] = (Sint8) sample4;
  1.6528 +        dst[27] = (Sint8) sample3;
  1.6529 +        dst[26] = (Sint8) sample2;
  1.6530 +        dst[25] = (Sint8) sample1;
  1.6531 +        dst[24] = (Sint8) sample0;
  1.6532 +        dst[23] = (Sint8) (((3 * sample7) + last_sample7) >> 2);
  1.6533 +        dst[22] = (Sint8) (((3 * sample6) + last_sample6) >> 2);
  1.6534 +        dst[21] = (Sint8) (((3 * sample5) + last_sample5) >> 2);
  1.6535 +        dst[20] = (Sint8) (((3 * sample4) + last_sample4) >> 2);
  1.6536 +        dst[19] = (Sint8) (((3 * sample3) + last_sample3) >> 2);
  1.6537 +        dst[18] = (Sint8) (((3 * sample2) + last_sample2) >> 2);
  1.6538 +        dst[17] = (Sint8) (((3 * sample1) + last_sample1) >> 2);
  1.6539 +        dst[16] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
  1.6540 +        dst[15] = (Sint8) ((sample7 + last_sample7) >> 1);
  1.6541 +        dst[14] = (Sint8) ((sample6 + last_sample6) >> 1);
  1.6542 +        dst[13] = (Sint8) ((sample5 + last_sample5) >> 1);
  1.6543 +        dst[12] = (Sint8) ((sample4 + last_sample4) >> 1);
  1.6544 +        dst[11] = (Sint8) ((sample3 + last_sample3) >> 1);
  1.6545 +        dst[10] = (Sint8) ((sample2 + last_sample2) >> 1);
  1.6546 +        dst[9] = (Sint8) ((sample1 + last_sample1) >> 1);
  1.6547 +        dst[8] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.6548 +        dst[7] = (Sint8) ((sample7 + (3 * last_sample7)) >> 2);
  1.6549 +        dst[6] = (Sint8) ((sample6 + (3 * last_sample6)) >> 2);
  1.6550 +        dst[5] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2);
  1.6551 +        dst[4] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2);
  1.6552 +        dst[3] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2);
  1.6553 +        dst[2] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2);
  1.6554 +        dst[1] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2);
  1.6555 +        dst[0] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
  1.6556 +        last_sample7 = sample7;
  1.6557 +        last_sample6 = sample6;
  1.6558 +        last_sample5 = sample5;
  1.6559 +        last_sample4 = sample4;
  1.6560 +        last_sample3 = sample3;
  1.6561 +        last_sample2 = sample2;
  1.6562 +        last_sample1 = sample1;
  1.6563 +        last_sample0 = sample0;
  1.6564 +        dst -= 32;
  1.6565 +    }
  1.6566 +
  1.6567 +    cvt->len_cvt = dstsize;
  1.6568 +    if (cvt->filters[++cvt->filter_index]) {
  1.6569 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6570 +    }
  1.6571 +}
  1.6572 +
  1.6573 +static void SDLCALL
  1.6574 +SDL_Downsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6575 +{
  1.6576 +#ifdef DEBUG_CONVERT
  1.6577 +    fprintf(stderr, "Downsample (x4) AUDIO_S8, 8 channels.\n");
  1.6578 +#endif
  1.6579 +
  1.6580 +    const int srcsize = cvt->len_cvt;
  1.6581 +    const int dstsize = cvt->len_cvt / 4;
  1.6582 +    Sint8 *dst = (Sint8 *) cvt->buf;
  1.6583 +    const Sint8 *src = (Sint8 *) cvt->buf;
  1.6584 +    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
  1.6585 +    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
  1.6586 +    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
  1.6587 +    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
  1.6588 +    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
  1.6589 +    Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
  1.6590 +    Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
  1.6591 +    Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
  1.6592 +    Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
  1.6593 +    while (dst != target) {
  1.6594 +        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
  1.6595 +        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
  1.6596 +        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
  1.6597 +        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
  1.6598 +        const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
  1.6599 +        const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
  1.6600 +        const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
  1.6601 +        const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
  1.6602 +        src += 32;
  1.6603 +        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
  1.6604 +        dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
  1.6605 +        dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
  1.6606 +        dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
  1.6607 +        dst[4] = (Sint8) ((sample4 + last_sample4) >> 1);
  1.6608 +        dst[5] = (Sint8) ((sample5 + last_sample5) >> 1);
  1.6609 +        dst[6] = (Sint8) ((sample6 + last_sample6) >> 1);
  1.6610 +        dst[7] = (Sint8) ((sample7 + last_sample7) >> 1);
  1.6611 +        last_sample0 = sample0;
  1.6612 +        last_sample1 = sample1;
  1.6613 +        last_sample2 = sample2;
  1.6614 +        last_sample3 = sample3;
  1.6615 +        last_sample4 = sample4;
  1.6616 +        last_sample5 = sample5;
  1.6617 +        last_sample6 = sample6;
  1.6618 +        last_sample7 = sample7;
  1.6619 +        dst += 8;
  1.6620 +    }
  1.6621 +
  1.6622 +    cvt->len_cvt = dstsize;
  1.6623 +    if (cvt->filters[++cvt->filter_index]) {
  1.6624 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6625 +    }
  1.6626 +}
  1.6627 +
  1.6628 +static void SDLCALL
  1.6629 +SDL_Upsample_U16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6630 +{
  1.6631 +#ifdef DEBUG_CONVERT
  1.6632 +    fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 1 channels.\n");
  1.6633 +#endif
  1.6634 +
  1.6635 +    const int srcsize = cvt->len_cvt;
  1.6636 +    const int dstsize = cvt->len_cvt * 2;
  1.6637 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
  1.6638 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.6639 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
  1.6640 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6641 +    while (dst != target) {
  1.6642 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6643 +        src--;
  1.6644 +        dst[1] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.6645 +        dst[0] = (Uint16) sample0;
  1.6646 +        last_sample0 = sample0;
  1.6647 +        dst -= 2;
  1.6648 +    }
  1.6649 +
  1.6650 +    cvt->len_cvt = dstsize;
  1.6651 +    if (cvt->filters[++cvt->filter_index]) {
  1.6652 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6653 +    }
  1.6654 +}
  1.6655 +
  1.6656 +static void SDLCALL
  1.6657 +SDL_Downsample_U16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6658 +{
  1.6659 +#ifdef DEBUG_CONVERT
  1.6660 +    fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 1 channels.\n");
  1.6661 +#endif
  1.6662 +
  1.6663 +    const int srcsize = cvt->len_cvt;
  1.6664 +    const int dstsize = cvt->len_cvt / 2;
  1.6665 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.6666 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.6667 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.6668 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6669 +    while (dst != target) {
  1.6670 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6671 +        src += 2;
  1.6672 +        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.6673 +        last_sample0 = sample0;
  1.6674 +        dst++;
  1.6675 +    }
  1.6676 +
  1.6677 +    cvt->len_cvt = dstsize;
  1.6678 +    if (cvt->filters[++cvt->filter_index]) {
  1.6679 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6680 +    }
  1.6681 +}
  1.6682 +
  1.6683 +static void SDLCALL
  1.6684 +SDL_Upsample_U16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6685 +{
  1.6686 +#ifdef DEBUG_CONVERT
  1.6687 +    fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 1 channels.\n");
  1.6688 +#endif
  1.6689 +
  1.6690 +    const int srcsize = cvt->len_cvt;
  1.6691 +    const int dstsize = cvt->len_cvt * 4;
  1.6692 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
  1.6693 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.6694 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
  1.6695 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6696 +    while (dst != target) {
  1.6697 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6698 +        src--;
  1.6699 +        dst[3] = (Uint16) sample0;
  1.6700 +        dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
  1.6701 +        dst[1] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.6702 +        dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
  1.6703 +        last_sample0 = sample0;
  1.6704 +        dst -= 4;
  1.6705 +    }
  1.6706 +
  1.6707 +    cvt->len_cvt = dstsize;
  1.6708 +    if (cvt->filters[++cvt->filter_index]) {
  1.6709 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6710 +    }
  1.6711 +}
  1.6712 +
  1.6713 +static void SDLCALL
  1.6714 +SDL_Downsample_U16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6715 +{
  1.6716 +#ifdef DEBUG_CONVERT
  1.6717 +    fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 1 channels.\n");
  1.6718 +#endif
  1.6719 +
  1.6720 +    const int srcsize = cvt->len_cvt;
  1.6721 +    const int dstsize = cvt->len_cvt / 4;
  1.6722 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.6723 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.6724 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.6725 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6726 +    while (dst != target) {
  1.6727 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6728 +        src += 4;
  1.6729 +        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.6730 +        last_sample0 = sample0;
  1.6731 +        dst++;
  1.6732 +    }
  1.6733 +
  1.6734 +    cvt->len_cvt = dstsize;
  1.6735 +    if (cvt->filters[++cvt->filter_index]) {
  1.6736 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6737 +    }
  1.6738 +}
  1.6739 +
  1.6740 +static void SDLCALL
  1.6741 +SDL_Upsample_U16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6742 +{
  1.6743 +#ifdef DEBUG_CONVERT
  1.6744 +    fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 2 channels.\n");
  1.6745 +#endif
  1.6746 +
  1.6747 +    const int srcsize = cvt->len_cvt;
  1.6748 +    const int dstsize = cvt->len_cvt * 2;
  1.6749 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
  1.6750 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.6751 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 2;
  1.6752 +    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.6753 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6754 +    while (dst != target) {
  1.6755 +        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.6756 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6757 +        src -= 2;
  1.6758 +        dst[3] = (Uint16) ((sample1 + last_sample1) >> 1);
  1.6759 +        dst[2] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.6760 +        dst[1] = (Uint16) sample1;
  1.6761 +        dst[0] = (Uint16) sample0;
  1.6762 +        last_sample1 = sample1;
  1.6763 +        last_sample0 = sample0;
  1.6764 +        dst -= 4;
  1.6765 +    }
  1.6766 +
  1.6767 +    cvt->len_cvt = dstsize;
  1.6768 +    if (cvt->filters[++cvt->filter_index]) {
  1.6769 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6770 +    }
  1.6771 +}
  1.6772 +
  1.6773 +static void SDLCALL
  1.6774 +SDL_Downsample_U16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6775 +{
  1.6776 +#ifdef DEBUG_CONVERT
  1.6777 +    fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 2 channels.\n");
  1.6778 +#endif
  1.6779 +
  1.6780 +    const int srcsize = cvt->len_cvt;
  1.6781 +    const int dstsize = cvt->len_cvt / 2;
  1.6782 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.6783 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.6784 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.6785 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6786 +    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.6787 +    while (dst != target) {
  1.6788 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6789 +        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.6790 +        src += 4;
  1.6791 +        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.6792 +        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
  1.6793 +        last_sample0 = sample0;
  1.6794 +        last_sample1 = sample1;
  1.6795 +        dst += 2;
  1.6796 +    }
  1.6797 +
  1.6798 +    cvt->len_cvt = dstsize;
  1.6799 +    if (cvt->filters[++cvt->filter_index]) {
  1.6800 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6801 +    }
  1.6802 +}
  1.6803 +
  1.6804 +static void SDLCALL
  1.6805 +SDL_Upsample_U16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6806 +{
  1.6807 +#ifdef DEBUG_CONVERT
  1.6808 +    fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 2 channels.\n");
  1.6809 +#endif
  1.6810 +
  1.6811 +    const int srcsize = cvt->len_cvt;
  1.6812 +    const int dstsize = cvt->len_cvt * 4;
  1.6813 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
  1.6814 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.6815 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 2;
  1.6816 +    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.6817 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6818 +    while (dst != target) {
  1.6819 +        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.6820 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6821 +        src -= 2;
  1.6822 +        dst[7] = (Uint16) sample1;
  1.6823 +        dst[6] = (Uint16) sample0;
  1.6824 +        dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
  1.6825 +        dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
  1.6826 +        dst[3] = (Uint16) ((sample1 + last_sample1) >> 1);
  1.6827 +        dst[2] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.6828 +        dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
  1.6829 +        dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
  1.6830 +        last_sample1 = sample1;
  1.6831 +        last_sample0 = sample0;
  1.6832 +        dst -= 8;
  1.6833 +    }
  1.6834 +
  1.6835 +    cvt->len_cvt = dstsize;
  1.6836 +    if (cvt->filters[++cvt->filter_index]) {
  1.6837 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6838 +    }
  1.6839 +}
  1.6840 +
  1.6841 +static void SDLCALL
  1.6842 +SDL_Downsample_U16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6843 +{
  1.6844 +#ifdef DEBUG_CONVERT
  1.6845 +    fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 2 channels.\n");
  1.6846 +#endif
  1.6847 +
  1.6848 +    const int srcsize = cvt->len_cvt;
  1.6849 +    const int dstsize = cvt->len_cvt / 4;
  1.6850 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.6851 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.6852 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.6853 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6854 +    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.6855 +    while (dst != target) {
  1.6856 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6857 +        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.6858 +        src += 8;
  1.6859 +        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.6860 +        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
  1.6861 +        last_sample0 = sample0;
  1.6862 +        last_sample1 = sample1;
  1.6863 +        dst += 2;
  1.6864 +    }
  1.6865 +
  1.6866 +    cvt->len_cvt = dstsize;
  1.6867 +    if (cvt->filters[++cvt->filter_index]) {
  1.6868 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6869 +    }
  1.6870 +}
  1.6871 +
  1.6872 +static void SDLCALL
  1.6873 +SDL_Upsample_U16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6874 +{
  1.6875 +#ifdef DEBUG_CONVERT
  1.6876 +    fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 4 channels.\n");
  1.6877 +#endif
  1.6878 +
  1.6879 +    const int srcsize = cvt->len_cvt;
  1.6880 +    const int dstsize = cvt->len_cvt * 2;
  1.6881 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
  1.6882 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.6883 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 4;
  1.6884 +    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.6885 +    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.6886 +    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.6887 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6888 +    while (dst != target) {
  1.6889 +        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.6890 +        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.6891 +        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.6892 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6893 +        src -= 4;
  1.6894 +        dst[7] = (Uint16) ((sample3 + last_sample3) >> 1);
  1.6895 +        dst[6] = (Uint16) ((sample2 + last_sample2) >> 1);
  1.6896 +        dst[5] = (Uint16) ((sample1 + last_sample1) >> 1);
  1.6897 +        dst[4] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.6898 +        dst[3] = (Uint16) sample3;
  1.6899 +        dst[2] = (Uint16) sample2;
  1.6900 +        dst[1] = (Uint16) sample1;
  1.6901 +        dst[0] = (Uint16) sample0;
  1.6902 +        last_sample3 = sample3;
  1.6903 +        last_sample2 = sample2;
  1.6904 +        last_sample1 = sample1;
  1.6905 +        last_sample0 = sample0;
  1.6906 +        dst -= 8;
  1.6907 +    }
  1.6908 +
  1.6909 +    cvt->len_cvt = dstsize;
  1.6910 +    if (cvt->filters[++cvt->filter_index]) {
  1.6911 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6912 +    }
  1.6913 +}
  1.6914 +
  1.6915 +static void SDLCALL
  1.6916 +SDL_Downsample_U16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6917 +{
  1.6918 +#ifdef DEBUG_CONVERT
  1.6919 +    fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 4 channels.\n");
  1.6920 +#endif
  1.6921 +
  1.6922 +    const int srcsize = cvt->len_cvt;
  1.6923 +    const int dstsize = cvt->len_cvt / 2;
  1.6924 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.6925 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.6926 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.6927 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6928 +    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.6929 +    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.6930 +    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.6931 +    while (dst != target) {
  1.6932 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6933 +        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.6934 +        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.6935 +        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.6936 +        src += 8;
  1.6937 +        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.6938 +        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
  1.6939 +        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
  1.6940 +        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
  1.6941 +        last_sample0 = sample0;
  1.6942 +        last_sample1 = sample1;
  1.6943 +        last_sample2 = sample2;
  1.6944 +        last_sample3 = sample3;
  1.6945 +        dst += 4;
  1.6946 +    }
  1.6947 +
  1.6948 +    cvt->len_cvt = dstsize;
  1.6949 +    if (cvt->filters[++cvt->filter_index]) {
  1.6950 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.6951 +    }
  1.6952 +}
  1.6953 +
  1.6954 +static void SDLCALL
  1.6955 +SDL_Upsample_U16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6956 +{
  1.6957 +#ifdef DEBUG_CONVERT
  1.6958 +    fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 4 channels.\n");
  1.6959 +#endif
  1.6960 +
  1.6961 +    const int srcsize = cvt->len_cvt;
  1.6962 +    const int dstsize = cvt->len_cvt * 4;
  1.6963 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
  1.6964 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.6965 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 4;
  1.6966 +    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.6967 +    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.6968 +    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.6969 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6970 +    while (dst != target) {
  1.6971 +        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.6972 +        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.6973 +        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.6974 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.6975 +        src -= 4;
  1.6976 +        dst[15] = (Uint16) sample3;
  1.6977 +        dst[14] = (Uint16) sample2;
  1.6978 +        dst[13] = (Uint16) sample1;
  1.6979 +        dst[12] = (Uint16) sample0;
  1.6980 +        dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
  1.6981 +        dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
  1.6982 +        dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
  1.6983 +        dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
  1.6984 +        dst[7] = (Uint16) ((sample3 + last_sample3) >> 1);
  1.6985 +        dst[6] = (Uint16) ((sample2 + last_sample2) >> 1);
  1.6986 +        dst[5] = (Uint16) ((sample1 + last_sample1) >> 1);
  1.6987 +        dst[4] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.6988 +        dst[3] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
  1.6989 +        dst[2] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
  1.6990 +        dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
  1.6991 +        dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
  1.6992 +        last_sample3 = sample3;
  1.6993 +        last_sample2 = sample2;
  1.6994 +        last_sample1 = sample1;
  1.6995 +        last_sample0 = sample0;
  1.6996 +        dst -= 16;
  1.6997 +    }
  1.6998 +
  1.6999 +    cvt->len_cvt = dstsize;
  1.7000 +    if (cvt->filters[++cvt->filter_index]) {
  1.7001 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.7002 +    }
  1.7003 +}
  1.7004 +
  1.7005 +static void SDLCALL
  1.7006 +SDL_Downsample_U16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7007 +{
  1.7008 +#ifdef DEBUG_CONVERT
  1.7009 +    fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 4 channels.\n");
  1.7010 +#endif
  1.7011 +
  1.7012 +    const int srcsize = cvt->len_cvt;
  1.7013 +    const int dstsize = cvt->len_cvt / 4;
  1.7014 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.7015 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.7016 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.7017 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7018 +    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7019 +    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7020 +    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7021 +    while (dst != target) {
  1.7022 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7023 +        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7024 +        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7025 +        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7026 +        src += 16;
  1.7027 +        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.7028 +        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
  1.7029 +        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
  1.7030 +        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
  1.7031 +        last_sample0 = sample0;
  1.7032 +        last_sample1 = sample1;
  1.7033 +        last_sample2 = sample2;
  1.7034 +        last_sample3 = sample3;
  1.7035 +        dst += 4;
  1.7036 +    }
  1.7037 +
  1.7038 +    cvt->len_cvt = dstsize;
  1.7039 +    if (cvt->filters[++cvt->filter_index]) {
  1.7040 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.7041 +    }
  1.7042 +}
  1.7043 +
  1.7044 +static void SDLCALL
  1.7045 +SDL_Upsample_U16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7046 +{
  1.7047 +#ifdef DEBUG_CONVERT
  1.7048 +    fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 6 channels.\n");
  1.7049 +#endif
  1.7050 +
  1.7051 +    const int srcsize = cvt->len_cvt;
  1.7052 +    const int dstsize = cvt->len_cvt * 2;
  1.7053 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
  1.7054 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.7055 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 6;
  1.7056 +    Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
  1.7057 +    Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
  1.7058 +    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7059 +    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7060 +    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7061 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7062 +    while (dst != target) {
  1.7063 +        const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
  1.7064 +        const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
  1.7065 +        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7066 +        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7067 +        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7068 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7069 +        src -= 6;
  1.7070 +        dst[11] = (Uint16) ((sample5 + last_sample5) >> 1);
  1.7071 +        dst[10] = (Uint16) ((sample4 + last_sample4) >> 1);
  1.7072 +        dst[9] = (Uint16) ((sample3 + last_sample3) >> 1);
  1.7073 +        dst[8] = (Uint16) ((sample2 + last_sample2) >> 1);
  1.7074 +        dst[7] = (Uint16) ((sample1 + last_sample1) >> 1);
  1.7075 +        dst[6] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.7076 +        dst[5] = (Uint16) sample5;
  1.7077 +        dst[4] = (Uint16) sample4;
  1.7078 +        dst[3] = (Uint16) sample3;
  1.7079 +        dst[2] = (Uint16) sample2;
  1.7080 +        dst[1] = (Uint16) sample1;
  1.7081 +        dst[0] = (Uint16) sample0;
  1.7082 +        last_sample5 = sample5;
  1.7083 +        last_sample4 = sample4;
  1.7084 +        last_sample3 = sample3;
  1.7085 +        last_sample2 = sample2;
  1.7086 +        last_sample1 = sample1;
  1.7087 +        last_sample0 = sample0;
  1.7088 +        dst -= 12;
  1.7089 +    }
  1.7090 +
  1.7091 +    cvt->len_cvt = dstsize;
  1.7092 +    if (cvt->filters[++cvt->filter_index]) {
  1.7093 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.7094 +    }
  1.7095 +}
  1.7096 +
  1.7097 +static void SDLCALL
  1.7098 +SDL_Downsample_U16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7099 +{
  1.7100 +#ifdef DEBUG_CONVERT
  1.7101 +    fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 6 channels.\n");
  1.7102 +#endif
  1.7103 +
  1.7104 +    const int srcsize = cvt->len_cvt;
  1.7105 +    const int dstsize = cvt->len_cvt / 2;
  1.7106 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.7107 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.7108 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.7109 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7110 +    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7111 +    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7112 +    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7113 +    Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
  1.7114 +    Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
  1.7115 +    while (dst != target) {
  1.7116 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7117 +        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7118 +        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7119 +        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7120 +        const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
  1.7121 +        const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
  1.7122 +        src += 12;
  1.7123 +        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.7124 +        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
  1.7125 +        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
  1.7126 +        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
  1.7127 +        dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
  1.7128 +        dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
  1.7129 +        last_sample0 = sample0;
  1.7130 +        last_sample1 = sample1;
  1.7131 +        last_sample2 = sample2;
  1.7132 +        last_sample3 = sample3;
  1.7133 +        last_sample4 = sample4;
  1.7134 +        last_sample5 = sample5;
  1.7135 +        dst += 6;
  1.7136 +    }
  1.7137 +
  1.7138 +    cvt->len_cvt = dstsize;
  1.7139 +    if (cvt->filters[++cvt->filter_index]) {
  1.7140 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.7141 +    }
  1.7142 +}
  1.7143 +
  1.7144 +static void SDLCALL
  1.7145 +SDL_Upsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7146 +{
  1.7147 +#ifdef DEBUG_CONVERT
  1.7148 +    fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 6 channels.\n");
  1.7149 +#endif
  1.7150 +
  1.7151 +    const int srcsize = cvt->len_cvt;
  1.7152 +    const int dstsize = cvt->len_cvt * 4;
  1.7153 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
  1.7154 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.7155 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 6;
  1.7156 +    Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
  1.7157 +    Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
  1.7158 +    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7159 +    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7160 +    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7161 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7162 +    while (dst != target) {
  1.7163 +        const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
  1.7164 +        const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
  1.7165 +        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7166 +        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7167 +        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7168 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7169 +        src -= 6;
  1.7170 +        dst[23] = (Uint16) sample5;
  1.7171 +        dst[22] = (Uint16) sample4;
  1.7172 +        dst[21] = (Uint16) sample3;
  1.7173 +        dst[20] = (Uint16) sample2;
  1.7174 +        dst[19] = (Uint16) sample1;
  1.7175 +        dst[18] = (Uint16) sample0;
  1.7176 +        dst[17] = (Uint16) (((3 * sample5) + last_sample5) >> 2);
  1.7177 +        dst[16] = (Uint16) (((3 * sample4) + last_sample4) >> 2);
  1.7178 +        dst[15] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
  1.7179 +        dst[14] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
  1.7180 +        dst[13] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
  1.7181 +        dst[12] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
  1.7182 +        dst[11] = (Uint16) ((sample5 + last_sample5) >> 1);
  1.7183 +        dst[10] = (Uint16) ((sample4 + last_sample4) >> 1);
  1.7184 +        dst[9] = (Uint16) ((sample3 + last_sample3) >> 1);
  1.7185 +        dst[8] = (Uint16) ((sample2 + last_sample2) >> 1);
  1.7186 +        dst[7] = (Uint16) ((sample1 + last_sample1) >> 1);
  1.7187 +        dst[6] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.7188 +        dst[5] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2);
  1.7189 +        dst[4] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2);
  1.7190 +        dst[3] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
  1.7191 +        dst[2] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
  1.7192 +        dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
  1.7193 +        dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
  1.7194 +        last_sample5 = sample5;
  1.7195 +        last_sample4 = sample4;
  1.7196 +        last_sample3 = sample3;
  1.7197 +        last_sample2 = sample2;
  1.7198 +        last_sample1 = sample1;
  1.7199 +        last_sample0 = sample0;
  1.7200 +        dst -= 24;
  1.7201 +    }
  1.7202 +
  1.7203 +    cvt->len_cvt = dstsize;
  1.7204 +    if (cvt->filters[++cvt->filter_index]) {
  1.7205 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.7206 +    }
  1.7207 +}
  1.7208 +
  1.7209 +static void SDLCALL
  1.7210 +SDL_Downsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7211 +{
  1.7212 +#ifdef DEBUG_CONVERT
  1.7213 +    fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 6 channels.\n");
  1.7214 +#endif
  1.7215 +
  1.7216 +    const int srcsize = cvt->len_cvt;
  1.7217 +    const int dstsize = cvt->len_cvt / 4;
  1.7218 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.7219 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.7220 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.7221 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7222 +    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7223 +    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7224 +    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7225 +    Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
  1.7226 +    Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
  1.7227 +    while (dst != target) {
  1.7228 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7229 +        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7230 +        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7231 +        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7232 +        const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
  1.7233 +        const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
  1.7234 +        src += 24;
  1.7235 +        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.7236 +        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
  1.7237 +        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
  1.7238 +        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
  1.7239 +        dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
  1.7240 +        dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
  1.7241 +        last_sample0 = sample0;
  1.7242 +        last_sample1 = sample1;
  1.7243 +        last_sample2 = sample2;
  1.7244 +        last_sample3 = sample3;
  1.7245 +        last_sample4 = sample4;
  1.7246 +        last_sample5 = sample5;
  1.7247 +        dst += 6;
  1.7248 +    }
  1.7249 +
  1.7250 +    cvt->len_cvt = dstsize;
  1.7251 +    if (cvt->filters[++cvt->filter_index]) {
  1.7252 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.7253 +    }
  1.7254 +}
  1.7255 +
  1.7256 +static void SDLCALL
  1.7257 +SDL_Upsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7258 +{
  1.7259 +#ifdef DEBUG_CONVERT
  1.7260 +    fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 8 channels.\n");
  1.7261 +#endif
  1.7262 +
  1.7263 +    const int srcsize = cvt->len_cvt;
  1.7264 +    const int dstsize = cvt->len_cvt * 2;
  1.7265 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
  1.7266 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.7267 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 8;
  1.7268 +    Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
  1.7269 +    Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
  1.7270 +    Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
  1.7271 +    Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
  1.7272 +    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7273 +    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7274 +    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7275 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7276 +    while (dst != target) {
  1.7277 +        const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
  1.7278 +        const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
  1.7279 +        const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
  1.7280 +        const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
  1.7281 +        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7282 +        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7283 +        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7284 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7285 +        src -= 8;
  1.7286 +        dst[15] = (Uint16) ((sample7 + last_sample7) >> 1);
  1.7287 +        dst[14] = (Uint16) ((sample6 + last_sample6) >> 1);
  1.7288 +        dst[13] = (Uint16) ((sample5 + last_sample5) >> 1);
  1.7289 +        dst[12] = (Uint16) ((sample4 + last_sample4) >> 1);
  1.7290 +        dst[11] = (Uint16) ((sample3 + last_sample3) >> 1);
  1.7291 +        dst[10] = (Uint16) ((sample2 + last_sample2) >> 1);
  1.7292 +        dst[9] = (Uint16) ((sample1 + last_sample1) >> 1);
  1.7293 +        dst[8] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.7294 +        dst[7] = (Uint16) sample7;
  1.7295 +        dst[6] = (Uint16) sample6;
  1.7296 +        dst[5] = (Uint16) sample5;
  1.7297 +        dst[4] = (Uint16) sample4;
  1.7298 +        dst[3] = (Uint16) sample3;
  1.7299 +        dst[2] = (Uint16) sample2;
  1.7300 +        dst[1] = (Uint16) sample1;
  1.7301 +        dst[0] = (Uint16) sample0;
  1.7302 +        last_sample7 = sample7;
  1.7303 +        last_sample6 = sample6;
  1.7304 +        last_sample5 = sample5;
  1.7305 +        last_sample4 = sample4;
  1.7306 +        last_sample3 = sample3;
  1.7307 +        last_sample2 = sample2;
  1.7308 +        last_sample1 = sample1;
  1.7309 +        last_sample0 = sample0;
  1.7310 +        dst -= 16;
  1.7311 +    }
  1.7312 +
  1.7313 +    cvt->len_cvt = dstsize;
  1.7314 +    if (cvt->filters[++cvt->filter_index]) {
  1.7315 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.7316 +    }
  1.7317 +}
  1.7318 +
  1.7319 +static void SDLCALL
  1.7320 +SDL_Downsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7321 +{
  1.7322 +#ifdef DEBUG_CONVERT
  1.7323 +    fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 8 channels.\n");
  1.7324 +#endif
  1.7325 +
  1.7326 +    const int srcsize = cvt->len_cvt;
  1.7327 +    const int dstsize = cvt->len_cvt / 2;
  1.7328 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.7329 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.7330 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.7331 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7332 +    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7333 +    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7334 +    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7335 +    Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
  1.7336 +    Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
  1.7337 +    Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
  1.7338 +    Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
  1.7339 +    while (dst != target) {
  1.7340 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7341 +        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7342 +        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7343 +        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7344 +        const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
  1.7345 +        const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
  1.7346 +        const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
  1.7347 +        const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
  1.7348 +        src += 16;
  1.7349 +        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.7350 +        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
  1.7351 +        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
  1.7352 +        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
  1.7353 +        dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
  1.7354 +        dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
  1.7355 +        dst[6] = (Uint16) ((sample6 + last_sample6) >> 1);
  1.7356 +        dst[7] = (Uint16) ((sample7 + last_sample7) >> 1);
  1.7357 +        last_sample0 = sample0;
  1.7358 +        last_sample1 = sample1;
  1.7359 +        last_sample2 = sample2;
  1.7360 +        last_sample3 = sample3;
  1.7361 +        last_sample4 = sample4;
  1.7362 +        last_sample5 = sample5;
  1.7363 +        last_sample6 = sample6;
  1.7364 +        last_sample7 = sample7;
  1.7365 +        dst += 8;
  1.7366 +    }
  1.7367 +
  1.7368 +    cvt->len_cvt = dstsize;
  1.7369 +    if (cvt->filters[++cvt->filter_index]) {
  1.7370 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.7371 +    }
  1.7372 +}
  1.7373 +
  1.7374 +static void SDLCALL
  1.7375 +SDL_Upsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7376 +{
  1.7377 +#ifdef DEBUG_CONVERT
  1.7378 +    fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 8 channels.\n");
  1.7379 +#endif
  1.7380 +
  1.7381 +    const int srcsize = cvt->len_cvt;
  1.7382 +    const int dstsize = cvt->len_cvt * 4;
  1.7383 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
  1.7384 +    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.7385 +    const Uint16 *target = ((const Uint16 *) cvt->buf) - 8;
  1.7386 +    Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
  1.7387 +    Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
  1.7388 +    Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
  1.7389 +    Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
  1.7390 +    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7391 +    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7392 +    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7393 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7394 +    while (dst != target) {
  1.7395 +        const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
  1.7396 +        const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
  1.7397 +        const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
  1.7398 +        const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
  1.7399 +        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7400 +        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7401 +        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7402 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7403 +        src -= 8;
  1.7404 +        dst[31] = (Uint16) sample7;
  1.7405 +        dst[30] = (Uint16) sample6;
  1.7406 +        dst[29] = (Uint16) sample5;
  1.7407 +        dst[28] = (Uint16) sample4;
  1.7408 +        dst[27] = (Uint16) sample3;
  1.7409 +        dst[26] = (Uint16) sample2;
  1.7410 +        dst[25] = (Uint16) sample1;
  1.7411 +        dst[24] = (Uint16) sample0;
  1.7412 +        dst[23] = (Uint16) (((3 * sample7) + last_sample7) >> 2);
  1.7413 +        dst[22] = (Uint16) (((3 * sample6) + last_sample6) >> 2);
  1.7414 +        dst[21] = (Uint16) (((3 * sample5) + last_sample5) >> 2);
  1.7415 +        dst[20] = (Uint16) (((3 * sample4) + last_sample4) >> 2);
  1.7416 +        dst[19] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
  1.7417 +        dst[18] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
  1.7418 +        dst[17] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
  1.7419 +        dst[16] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
  1.7420 +        dst[15] = (Uint16) ((sample7 + last_sample7) >> 1);
  1.7421 +        dst[14] = (Uint16) ((sample6 + last_sample6) >> 1);
  1.7422 +        dst[13] = (Uint16) ((sample5 + last_sample5) >> 1);
  1.7423 +        dst[12] = (Uint16) ((sample4 + last_sample4) >> 1);
  1.7424 +        dst[11] = (Uint16) ((sample3 + last_sample3) >> 1);
  1.7425 +        dst[10] = (Uint16) ((sample2 + last_sample2) >> 1);
  1.7426 +        dst[9] = (Uint16) ((sample1 + last_sample1) >> 1);
  1.7427 +        dst[8] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.7428 +        dst[7] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2);
  1.7429 +        dst[6] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2);
  1.7430 +        dst[5] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2);
  1.7431 +        dst[4] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2);
  1.7432 +        dst[3] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
  1.7433 +        dst[2] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
  1.7434 +        dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
  1.7435 +        dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
  1.7436 +        last_sample7 = sample7;
  1.7437 +        last_sample6 = sample6;
  1.7438 +        last_sample5 = sample5;
  1.7439 +        last_sample4 = sample4;
  1.7440 +        last_sample3 = sample3;
  1.7441 +        last_sample2 = sample2;
  1.7442 +        last_sample1 = sample1;
  1.7443 +        last_sample0 = sample0;
  1.7444 +        dst -= 32;
  1.7445 +    }
  1.7446 +
  1.7447 +    cvt->len_cvt = dstsize;
  1.7448 +    if (cvt->filters[++cvt->filter_index]) {
  1.7449 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.7450 +    }
  1.7451 +}
  1.7452 +
  1.7453 +static void SDLCALL
  1.7454 +SDL_Downsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7455 +{
  1.7456 +#ifdef DEBUG_CONVERT
  1.7457 +    fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 8 channels.\n");
  1.7458 +#endif
  1.7459 +
  1.7460 +    const int srcsize = cvt->len_cvt;
  1.7461 +    const int dstsize = cvt->len_cvt / 4;
  1.7462 +    Uint16 *dst = (Uint16 *) cvt->buf;
  1.7463 +    const Uint16 *src = (Uint16 *) cvt->buf;
  1.7464 +    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.7465 +    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7466 +    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7467 +    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7468 +    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7469 +    Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
  1.7470 +    Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
  1.7471 +    Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
  1.7472 +    Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
  1.7473 +    while (dst != target) {
  1.7474 +        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
  1.7475 +        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
  1.7476 +        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
  1.7477 +        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
  1.7478 +        const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
  1.7479 +        const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
  1.7480 +        const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
  1.7481 +        const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
  1.7482 +        src += 32;
  1.7483 +        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
  1.7484 +        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
  1.7485 +        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
  1.7486 +        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
  1.7487 +        dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
  1.7488 +        dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
  1.7489 +        dst[6] = (Uint16) ((sample6 + last_sample6) >> 1);
  1.7490 +        dst[7] = (Uint16) ((sample7 + last_sample7) >> 1);
  1.7491 +        last_sample0 = sample0;
  1.7492 +        last_sample1 = sample1;
  1.7493 +        last_sample2 = sample2;
  1.7494 +        last_sample3 = sample3;
  1.7495 +        last_sample4 = sample4;
  1.7496 +        last_sample5 = sample5;
  1.7497 +        last_sample6 = sample6;
  1.7498 +        last_sample7 = sample7;
  1.7499 +        dst += 8;
  1.7500 +    }
  1.7501 +
  1.7502 +    cvt->len_cvt = dstsize;
  1.7503 +    if (cvt->filters[++cvt->filter_index]) {
  1.7504 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.7505 +    }
  1.7506 +}
  1.7507 +
  1.7508 +static void SDLCALL
  1.7509 +SDL_Upsample_S16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7510 +{
  1.7511 +#ifdef DEBUG_CONVERT
  1.7512 +    fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 1 channels.\n");
  1.7513 +#endif
  1.7514 +
  1.7515 +    const int srcsize = cvt->len_cvt;
  1.7516 +    const int dstsize = cvt->len_cvt * 2;
  1.7517 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
  1.7518 +    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.7519 +    const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
  1.7520 +    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
  1.7521 +    while (dst != target) {
  1.7522 +        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
  1.7523 +        src--;
  1.7524 +        dst[1] = (Sint16) ((sample0 + last_sample0) >> 1);
  1.7525 +        dst[0] = (Sint16) sample0;
  1.7526 +        last_sample0 = sample0;
  1.7527 +        dst -= 2;
  1.7528 +    }
  1.7529 +
  1.7530 +    cvt->len_cvt = dstsize;
  1.7531 +    if (cvt->filters[++cvt->filter_index]) {
  1.7532 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.7533 +    }
  1.7534 +}
  1.7535 +
  1.7536 +static void SDLCALL
  1.7537 +SDL_Downsample_S16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7538 +{
  1.7539 +#ifdef DEBUG_CONVERT
  1.7540 +    fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 1 channels.\n");
  1.7541 +#endif
  1.7542 +
  1.7543 +    const int srcsize = cvt->len_cvt;
  1.7544 +    const int dstsize = cvt->len_cvt / 2;
  1.7545 +    Sint16 *dst = (Sint16 *) cvt->buf;
  1.7546 +    const Sint16 *src = (Sint16 *) cvt->buf;
  1.7547 +    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.7548 +    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
  1.7549 +    while (dst != target) {
  1.7550 +        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
  1.7551 +        src += 2;
  1.7552 +        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
  1.7553 +        last_sample0 = sample0;
  1.7554 +        dst++;
  1.7555 +    }
  1.7556 +
  1.7557 +    cvt->len_cvt = dstsize;
  1.7558 +    if (cvt->filters[++cvt->filter_index]) {
  1.7559 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.7560 +    }
  1.7561 +}
  1.7562 +
  1.7563 +static void SDLCALL
  1.7564 +SDL_Upsample_S16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7565 +{
  1.7566 +#ifdef DEBUG_CONVERT
  1.7567 +    fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 1 channels.\n");
  1.7568 +#endif
  1.7569 +
  1.7570 +    const int srcsize = cvt->len_cvt;
  1.7571 +    const int dstsize = cvt->len_cvt * 4;
  1.7572 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
  1.7573 +    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.7574 +    const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
  1.7575 +    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
  1.7576 +    while (dst != target) {
  1.7577 +        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
  1.7578 +        src--;
  1.7579 +        dst[3] = (Sint16) sample0;
  1.7580 +        dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
  1.7581 +        dst[1] = (Sint16) ((sample0 + last_sample0) >> 1);
  1.7582 +        dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
  1.7583 +        last_sample0 = sample0;
  1.7584 +        dst -= 4;
  1.7585 +    }
  1.7586 +
  1.7587 +    cvt->len_cvt = dstsize;
  1.7588 +    if (cvt->filters[++cvt->filter_index]) {
  1.7589 +        cvt->filters[cvt->filter_index] (cvt, format);
  1.7590 +    }
  1.7591 +}
  1.7592 +
  1.7593 +static void SDLCALL
  1.7594 +SDL_Downsample_S16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7595 +{
  1.7596 +#ifdef DEBUG_CONVERT
  1.7597 +    fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 1 channels.\n");
  1.7598 +#endif
  1.7599 +
  1.7600 +    const int srcsize = cvt->len_cvt;
  1.7601 +    const int dstsize = cvt->len_cvt / 4;
  1.7602 +    Sint16 *dst = (Sint16 *) cvt->buf;
  1.7603 +    const Sint16 *src = (Sint16 *) cvt->buf;
  1.7604 +    const Sint16 *target = (const Sint16 *) (cvt->buf + ds