1 /* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */
3 Simple DirectMedia Layer
4 Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
6 This software is provided 'as-is', without any express or implied
7 warranty. In no event will the authors be held liable for any damages
8 arising from the use of this software.
10 Permission is granted to anyone to use this software for any purpose,
11 including commercial applications, and to alter it and redistribute it
12 freely, subject to the following restrictions:
14 1. The origin of this software must not be misrepresented; you must not
15 claim that you wrote the original software. If you use this software
16 in a product, an acknowledgment in the product documentation would be
17 appreciated but is not required.
18 2. Altered source versions must be plainly marked as such, and must not be
19 misrepresented as being the original software.
20 3. This notice may not be removed or altered from any source distribution.
23 #include "../SDL_internal.h"
24 #include "SDL_audio.h"
25 #include "SDL_audio_c.h"
28 #define DEBUG_CONVERT 0
32 /* If you can guarantee your data and need space, you can eliminate code... */
34 /* Just build the arbitrary resamplers if you're saving code space. */
35 #ifndef LESS_RESAMPLERS
36 #define LESS_RESAMPLERS 0
39 /* Don't build any resamplers if you're REALLY saving code space. */
41 #define NO_RESAMPLERS 0
44 /* Don't build any type converters if you're saving code space. */
46 #define NO_CONVERTERS 0
52 #define DIVBY127 0.0078740157480315f
53 #define DIVBY32767 3.05185094759972e-05f
54 #define DIVBY2147483647 4.6566128752458e-10f
59 SDL_Convert_U8_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
66 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S8.\n");
69 src = (const Uint8 *) cvt->buf;
70 dst = (Sint8 *) cvt->buf;
71 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) {
72 const Sint8 val = ((*src) ^ 0x80);
76 if (cvt->filters[++cvt->filter_index]) {
77 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
82 SDL_Convert_U8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
89 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16LSB.\n");
92 src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
93 dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
94 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
95 const Uint16 val = (((Uint16) *src) << 8);
96 *dst = SDL_SwapLE16(val);
100 if (cvt->filters[++cvt->filter_index]) {
101 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
106 SDL_Convert_U8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
113 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16LSB.\n");
116 src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
117 dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
118 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
119 const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8);
120 *dst = ((Sint16) SDL_SwapLE16(val));
124 if (cvt->filters[++cvt->filter_index]) {
125 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
130 SDL_Convert_U8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
137 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16MSB.\n");
140 src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
141 dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
142 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
143 const Uint16 val = (((Uint16) *src) << 8);
144 *dst = SDL_SwapBE16(val);
148 if (cvt->filters[++cvt->filter_index]) {
149 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
154 SDL_Convert_U8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
161 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16MSB.\n");
164 src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
165 dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
166 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
167 const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8);
168 *dst = ((Sint16) SDL_SwapBE16(val));
172 if (cvt->filters[++cvt->filter_index]) {
173 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
178 SDL_Convert_U8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
185 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32LSB.\n");
188 src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
189 dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
190 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
191 const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24);
192 *dst = ((Sint32) SDL_SwapLE32(val));
196 if (cvt->filters[++cvt->filter_index]) {
197 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
202 SDL_Convert_U8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
209 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32MSB.\n");
212 src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
213 dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
214 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
215 const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24);
216 *dst = ((Sint32) SDL_SwapBE32(val));
220 if (cvt->filters[++cvt->filter_index]) {
221 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
226 SDL_Convert_U8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
233 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32LSB.\n");
236 src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
237 dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
238 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
239 const float val = ((((float) *src) * DIVBY127) - 1.0f);
240 *dst = SDL_SwapFloatLE(val);
244 if (cvt->filters[++cvt->filter_index]) {
245 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
250 SDL_Convert_U8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
257 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32MSB.\n");
260 src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
261 dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
262 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
263 const float val = ((((float) *src) * DIVBY127) - 1.0f);
264 *dst = SDL_SwapFloatBE(val);
268 if (cvt->filters[++cvt->filter_index]) {
269 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
274 SDL_Convert_S8_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
281 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U8.\n");
284 src = (const Uint8 *) cvt->buf;
285 dst = (Uint8 *) cvt->buf;
286 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) {
287 const Uint8 val = ((((Sint8) *src)) ^ 0x80);
291 if (cvt->filters[++cvt->filter_index]) {
292 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
297 SDL_Convert_S8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
304 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16LSB.\n");
307 src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
308 dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
309 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
310 const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8);
311 *dst = SDL_SwapLE16(val);
315 if (cvt->filters[++cvt->filter_index]) {
316 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
321 SDL_Convert_S8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
328 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16LSB.\n");
331 src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
332 dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
333 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
334 const Sint16 val = (((Sint16) ((Sint8) *src)) << 8);
335 *dst = ((Sint16) SDL_SwapLE16(val));
339 if (cvt->filters[++cvt->filter_index]) {
340 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
345 SDL_Convert_S8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
352 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16MSB.\n");
355 src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
356 dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
357 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
358 const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8);
359 *dst = SDL_SwapBE16(val);
363 if (cvt->filters[++cvt->filter_index]) {
364 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
369 SDL_Convert_S8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
376 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16MSB.\n");
379 src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
380 dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
381 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
382 const Sint16 val = (((Sint16) ((Sint8) *src)) << 8);
383 *dst = ((Sint16) SDL_SwapBE16(val));
387 if (cvt->filters[++cvt->filter_index]) {
388 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
393 SDL_Convert_S8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
400 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32LSB.\n");
403 src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
404 dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
405 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
406 const Sint32 val = (((Sint32) ((Sint8) *src)) << 24);
407 *dst = ((Sint32) SDL_SwapLE32(val));
411 if (cvt->filters[++cvt->filter_index]) {
412 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
417 SDL_Convert_S8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
424 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32MSB.\n");
427 src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
428 dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
429 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
430 const Sint32 val = (((Sint32) ((Sint8) *src)) << 24);
431 *dst = ((Sint32) SDL_SwapBE32(val));
435 if (cvt->filters[++cvt->filter_index]) {
436 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
441 SDL_Convert_S8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
448 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32LSB.\n");
451 src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
452 dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
453 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
454 const float val = (((float) ((Sint8) *src)) * DIVBY127);
455 *dst = SDL_SwapFloatLE(val);
459 if (cvt->filters[++cvt->filter_index]) {
460 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
465 SDL_Convert_S8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
472 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32MSB.\n");
475 src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
476 dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
477 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
478 const float val = (((float) ((Sint8) *src)) * DIVBY127);
479 *dst = SDL_SwapFloatBE(val);
483 if (cvt->filters[++cvt->filter_index]) {
484 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
489 SDL_Convert_U16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
496 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U8.\n");
499 src = (const Uint16 *) cvt->buf;
500 dst = (Uint8 *) cvt->buf;
501 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
502 const Uint8 val = ((Uint8) (SDL_SwapLE16(*src) >> 8));
507 if (cvt->filters[++cvt->filter_index]) {
508 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
513 SDL_Convert_U16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
520 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S8.\n");
523 src = (const Uint16 *) cvt->buf;
524 dst = (Sint8 *) cvt->buf;
525 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
526 const Sint8 val = ((Sint8) (((SDL_SwapLE16(*src)) ^ 0x8000) >> 8));
527 *dst = ((Sint8) val);
531 if (cvt->filters[++cvt->filter_index]) {
532 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
537 SDL_Convert_U16LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
544 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16LSB.\n");
547 src = (const Uint16 *) cvt->buf;
548 dst = (Sint16 *) cvt->buf;
549 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
550 const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000);
551 *dst = ((Sint16) SDL_SwapLE16(val));
554 if (cvt->filters[++cvt->filter_index]) {
555 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
560 SDL_Convert_U16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
567 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U16MSB.\n");
570 src = (const Uint16 *) cvt->buf;
571 dst = (Uint16 *) cvt->buf;
572 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
573 const Uint16 val = SDL_SwapLE16(*src);
574 *dst = SDL_SwapBE16(val);
577 if (cvt->filters[++cvt->filter_index]) {
578 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
583 SDL_Convert_U16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
590 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16MSB.\n");
593 src = (const Uint16 *) cvt->buf;
594 dst = (Sint16 *) cvt->buf;
595 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
596 const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000);
597 *dst = ((Sint16) SDL_SwapBE16(val));
600 if (cvt->filters[++cvt->filter_index]) {
601 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
606 SDL_Convert_U16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
613 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32LSB.\n");
616 src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
617 dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
618 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
619 const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16);
620 *dst = ((Sint32) SDL_SwapLE32(val));
624 if (cvt->filters[++cvt->filter_index]) {
625 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
630 SDL_Convert_U16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
637 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32MSB.\n");
640 src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
641 dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
642 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
643 const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16);
644 *dst = ((Sint32) SDL_SwapBE32(val));
648 if (cvt->filters[++cvt->filter_index]) {
649 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
654 SDL_Convert_U16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
661 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32LSB.\n");
664 src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
665 dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
666 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
667 const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f);
668 *dst = SDL_SwapFloatLE(val);
672 if (cvt->filters[++cvt->filter_index]) {
673 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
678 SDL_Convert_U16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
685 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32MSB.\n");
688 src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
689 dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
690 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
691 const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f);
692 *dst = SDL_SwapFloatBE(val);
696 if (cvt->filters[++cvt->filter_index]) {
697 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
702 SDL_Convert_S16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
709 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U8.\n");
712 src = (const Uint16 *) cvt->buf;
713 dst = (Uint8 *) cvt->buf;
714 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
715 const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000) >> 8));
720 if (cvt->filters[++cvt->filter_index]) {
721 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
726 SDL_Convert_S16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
733 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S8.\n");
736 src = (const Uint16 *) cvt->buf;
737 dst = (Sint8 *) cvt->buf;
738 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
739 const Sint8 val = ((Sint8) (((Sint16) SDL_SwapLE16(*src)) >> 8));
740 *dst = ((Sint8) val);
744 if (cvt->filters[++cvt->filter_index]) {
745 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
750 SDL_Convert_S16LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
757 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16LSB.\n");
760 src = (const Uint16 *) cvt->buf;
761 dst = (Uint16 *) cvt->buf;
762 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
763 const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000);
764 *dst = SDL_SwapLE16(val);
767 if (cvt->filters[++cvt->filter_index]) {
768 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
773 SDL_Convert_S16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
780 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16MSB.\n");
783 src = (const Uint16 *) cvt->buf;
784 dst = (Uint16 *) cvt->buf;
785 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
786 const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000);
787 *dst = SDL_SwapBE16(val);
790 if (cvt->filters[++cvt->filter_index]) {
791 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
796 SDL_Convert_S16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
803 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S16MSB.\n");
806 src = (const Uint16 *) cvt->buf;
807 dst = (Sint16 *) cvt->buf;
808 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
809 const Sint16 val = ((Sint16) SDL_SwapLE16(*src));
810 *dst = ((Sint16) SDL_SwapBE16(val));
813 if (cvt->filters[++cvt->filter_index]) {
814 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
819 SDL_Convert_S16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
826 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32LSB.\n");
829 src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
830 dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
831 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
832 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16);
833 *dst = ((Sint32) SDL_SwapLE32(val));
837 if (cvt->filters[++cvt->filter_index]) {
838 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
843 SDL_Convert_S16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
850 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32MSB.\n");
853 src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
854 dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
855 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
856 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16);
857 *dst = ((Sint32) SDL_SwapBE32(val));
861 if (cvt->filters[++cvt->filter_index]) {
862 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
867 SDL_Convert_S16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
874 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32LSB.\n");
877 src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
878 dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
879 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
880 const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767);
881 *dst = SDL_SwapFloatLE(val);
885 if (cvt->filters[++cvt->filter_index]) {
886 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
891 SDL_Convert_S16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
898 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32MSB.\n");
901 src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
902 dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
903 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
904 const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767);
905 *dst = SDL_SwapFloatBE(val);
909 if (cvt->filters[++cvt->filter_index]) {
910 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
915 SDL_Convert_U16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
922 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U8.\n");
925 src = (const Uint16 *) cvt->buf;
926 dst = (Uint8 *) cvt->buf;
927 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
928 const Uint8 val = ((Uint8) (SDL_SwapBE16(*src) >> 8));
933 if (cvt->filters[++cvt->filter_index]) {
934 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
939 SDL_Convert_U16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
946 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S8.\n");
949 src = (const Uint16 *) cvt->buf;
950 dst = (Sint8 *) cvt->buf;
951 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
952 const Sint8 val = ((Sint8) (((SDL_SwapBE16(*src)) ^ 0x8000) >> 8));
953 *dst = ((Sint8) val);
957 if (cvt->filters[++cvt->filter_index]) {
958 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
963 SDL_Convert_U16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
970 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U16LSB.\n");
973 src = (const Uint16 *) cvt->buf;
974 dst = (Uint16 *) cvt->buf;
975 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
976 const Uint16 val = SDL_SwapBE16(*src);
977 *dst = SDL_SwapLE16(val);
980 if (cvt->filters[++cvt->filter_index]) {
981 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
986 SDL_Convert_U16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
993 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16LSB.\n");
996 src = (const Uint16 *) cvt->buf;
997 dst = (Sint16 *) cvt->buf;
998 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
999 const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000);
1000 *dst = ((Sint16) SDL_SwapLE16(val));
1003 if (cvt->filters[++cvt->filter_index]) {
1004 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
1009 SDL_Convert_U16MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1016 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16MSB.\n");
1019 src = (const Uint16 *) cvt->buf;
1020 dst = (Sint16 *) cvt->buf;
1021 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1022 const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000);
1023 *dst = ((Sint16) SDL_SwapBE16(val));
1026 if (cvt->filters[++cvt->filter_index]) {
1027 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
1032 SDL_Convert_U16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1039 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32LSB.\n");
1042 src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1043 dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1044 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1045 const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16);
1046 *dst = ((Sint32) SDL_SwapLE32(val));
1050 if (cvt->filters[++cvt->filter_index]) {
1051 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
1056 SDL_Convert_U16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1063 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32MSB.\n");
1066 src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1067 dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1068 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1069 const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16);
1070 *dst = ((Sint32) SDL_SwapBE32(val));
1074 if (cvt->filters[++cvt->filter_index]) {
1075 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
1080 SDL_Convert_U16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1087 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32LSB.\n");
1090 src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1091 dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1092 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1093 const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f);
1094 *dst = SDL_SwapFloatLE(val);
1098 if (cvt->filters[++cvt->filter_index]) {
1099 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
1104 SDL_Convert_U16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1111 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32MSB.\n");
1114 src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1115 dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1116 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1117 const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f);
1118 *dst = SDL_SwapFloatBE(val);
1122 if (cvt->filters[++cvt->filter_index]) {
1123 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
1128 SDL_Convert_S16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1135 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U8.\n");
1138 src = (const Uint16 *) cvt->buf;
1139 dst = (Uint8 *) cvt->buf;
1140 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1141 const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000) >> 8));
1146 if (cvt->filters[++cvt->filter_index]) {
1147 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
1152 SDL_Convert_S16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1159 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S8.\n");
1162 src = (const Uint16 *) cvt->buf;
1163 dst = (Sint8 *) cvt->buf;
1164 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1165 const Sint8 val = ((Sint8) (((Sint16) SDL_SwapBE16(*src)) >> 8));
1166 *dst = ((Sint8) val);
1170 if (cvt->filters[++cvt->filter_index]) {
1171 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
1176 SDL_Convert_S16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1183 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16LSB.\n");
1186 src = (const Uint16 *) cvt->buf;
1187 dst = (Uint16 *) cvt->buf;
1188 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1189 const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000);
1190 *dst = SDL_SwapLE16(val);
1193 if (cvt->filters[++cvt->filter_index]) {
1194 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
1199 SDL_Convert_S16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1206 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S16LSB.\n");
1209 src = (const Uint16 *) cvt->buf;
1210 dst = (Sint16 *) cvt->buf;
1211 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1212 const Sint16 val = ((Sint16) SDL_SwapBE16(*src));
1213 *dst = ((Sint16) SDL_SwapLE16(val));
1216 if (cvt->filters[++cvt->filter_index]) {
1217 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
1222 SDL_Convert_S16MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1229 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16MSB.\n");
1232 src = (const Uint16 *) cvt->buf;
1233 dst = (Uint16 *) cvt->buf;
1234 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1235 const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000);
1236 *dst = SDL_SwapBE16(val);
1239 if (cvt->filters[++cvt->filter_index]) {
1240 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
1245 SDL_Convert_S16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1252 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32LSB.\n");
1255 src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1256 dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1257 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1258 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16);
1259 *dst = ((Sint32) SDL_SwapLE32(val));
1263 if (cvt->filters[++cvt->filter_index]) {
1264 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
1269 SDL_Convert_S16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1276 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32MSB.\n");
1279 src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1280 dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1281 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1282 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16);
1283 *dst = ((Sint32) SDL_SwapBE32(val));
1287 if (cvt->filters[++cvt->filter_index]) {
1288 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
1293 SDL_Convert_S16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1300 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32LSB.\n");
1303 src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1304 dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1305 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1306 const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767);
1307 *dst = SDL_SwapFloatLE(val);
1311 if (cvt->filters[++cvt->filter_index]) {
1312 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
1317 SDL_Convert_S16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1324 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32MSB.\n");
1327 src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1328 dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1329 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1330 const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767);
1331 *dst = SDL_SwapFloatBE(val);
1335 if (cvt->filters[++cvt->filter_index]) {
1336 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
1341 SDL_Convert_S32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1348 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U8.\n");
1351 src = (const Uint32 *) cvt->buf;
1352 dst = (Uint8 *) cvt->buf;
1353 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1354 const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 24));
1359 if (cvt->filters[++cvt->filter_index]) {
1360 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
1365 SDL_Convert_S32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1372 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S8.\n");
1375 src = (const Uint32 *) cvt->buf;
1376 dst = (Sint8 *) cvt->buf;
1377 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1378 const Sint8 val = ((Sint8) (((Sint32) SDL_SwapLE32(*src)) >> 24));
1379 *dst = ((Sint8) val);
1383 if (cvt->filters[++cvt->filter_index]) {
1384 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
1389 SDL_Convert_S32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1396 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16LSB.\n");
1399 src = (const Uint32 *) cvt->buf;
1400 dst = (Uint16 *) cvt->buf;
1401 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1402 const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16));
1403 *dst = SDL_SwapLE16(val);
1407 if (cvt->filters[++cvt->filter_index]) {
1408 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
1413 SDL_Convert_S32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1420 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16LSB.\n");
1423 src = (const Uint32 *) cvt->buf;
1424 dst = (Sint16 *) cvt->buf;
1425 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1426 const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16));
1427 *dst = ((Sint16) SDL_SwapLE16(val));
1431 if (cvt->filters[++cvt->filter_index]) {
1432 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
1437 SDL_Convert_S32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1444 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16MSB.\n");
1447 src = (const Uint32 *) cvt->buf;
1448 dst = (Uint16 *) cvt->buf;
1449 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1450 const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16));
1451 *dst = SDL_SwapBE16(val);
1455 if (cvt->filters[++cvt->filter_index]) {
1456 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
1461 SDL_Convert_S32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1468 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16MSB.\n");
1471 src = (const Uint32 *) cvt->buf;
1472 dst = (Sint16 *) cvt->buf;
1473 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1474 const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16));
1475 *dst = ((Sint16) SDL_SwapBE16(val));
1479 if (cvt->filters[++cvt->filter_index]) {
1480 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
1485 SDL_Convert_S32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1492 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S32MSB.\n");
1495 src = (const Uint32 *) cvt->buf;
1496 dst = (Sint32 *) cvt->buf;
1497 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1498 const Sint32 val = ((Sint32) SDL_SwapLE32(*src));
1499 *dst = ((Sint32) SDL_SwapBE32(val));
1502 if (cvt->filters[++cvt->filter_index]) {
1503 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
1508 SDL_Convert_S32LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1515 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32LSB.\n");
1518 src = (const Uint32 *) cvt->buf;
1519 dst = (float *) cvt->buf;
1520 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1521 const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647);
1522 *dst = SDL_SwapFloatLE(val);
1525 if (cvt->filters[++cvt->filter_index]) {
1526 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
1531 SDL_Convert_S32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1538 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32MSB.\n");
1541 src = (const Uint32 *) cvt->buf;
1542 dst = (float *) cvt->buf;
1543 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1544 const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647);
1545 *dst = SDL_SwapFloatBE(val);
1548 if (cvt->filters[++cvt->filter_index]) {
1549 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
1554 SDL_Convert_S32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1561 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U8.\n");
1564 src = (const Uint32 *) cvt->buf;
1565 dst = (Uint8 *) cvt->buf;
1566 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1567 const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 24));
1572 if (cvt->filters[++cvt->filter_index]) {
1573 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
1578 SDL_Convert_S32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1585 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S8.\n");
1588 src = (const Uint32 *) cvt->buf;
1589 dst = (Sint8 *) cvt->buf;
1590 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1591 const Sint8 val = ((Sint8) (((Sint32) SDL_SwapBE32(*src)) >> 24));
1592 *dst = ((Sint8) val);
1596 if (cvt->filters[++cvt->filter_index]) {
1597 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
1602 SDL_Convert_S32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1609 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16LSB.\n");
1612 src = (const Uint32 *) cvt->buf;
1613 dst = (Uint16 *) cvt->buf;
1614 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1615 const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16));
1616 *dst = SDL_SwapLE16(val);
1620 if (cvt->filters[++cvt->filter_index]) {
1621 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
1626 SDL_Convert_S32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1633 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16LSB.\n");
1636 src = (const Uint32 *) cvt->buf;
1637 dst = (Sint16 *) cvt->buf;
1638 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1639 const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16));
1640 *dst = ((Sint16) SDL_SwapLE16(val));
1644 if (cvt->filters[++cvt->filter_index]) {
1645 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
1650 SDL_Convert_S32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1657 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16MSB.\n");
1660 src = (const Uint32 *) cvt->buf;
1661 dst = (Uint16 *) cvt->buf;
1662 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1663 const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16));
1664 *dst = SDL_SwapBE16(val);
1668 if (cvt->filters[++cvt->filter_index]) {
1669 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
1674 SDL_Convert_S32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1681 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16MSB.\n");
1684 src = (const Uint32 *) cvt->buf;
1685 dst = (Sint16 *) cvt->buf;
1686 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1687 const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16));
1688 *dst = ((Sint16) SDL_SwapBE16(val));
1692 if (cvt->filters[++cvt->filter_index]) {
1693 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
1698 SDL_Convert_S32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1705 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S32LSB.\n");
1708 src = (const Uint32 *) cvt->buf;
1709 dst = (Sint32 *) cvt->buf;
1710 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1711 const Sint32 val = ((Sint32) SDL_SwapBE32(*src));
1712 *dst = ((Sint32) SDL_SwapLE32(val));
1715 if (cvt->filters[++cvt->filter_index]) {
1716 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
1721 SDL_Convert_S32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1728 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32LSB.\n");
1731 src = (const Uint32 *) cvt->buf;
1732 dst = (float *) cvt->buf;
1733 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1734 const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647);
1735 *dst = SDL_SwapFloatLE(val);
1738 if (cvt->filters[++cvt->filter_index]) {
1739 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
1744 SDL_Convert_S32MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1751 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32MSB.\n");
1754 src = (const Uint32 *) cvt->buf;
1755 dst = (float *) cvt->buf;
1756 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1757 const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647);
1758 *dst = SDL_SwapFloatBE(val);
1761 if (cvt->filters[++cvt->filter_index]) {
1762 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
1767 SDL_Convert_F32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1774 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U8.\n");
1777 src = (const float *) cvt->buf;
1778 dst = (Uint8 *) cvt->buf;
1779 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1780 const Uint8 val = ((Uint8) ((SDL_SwapFloatLE(*src) + 1.0f) * 127.0f));
1785 if (cvt->filters[++cvt->filter_index]) {
1786 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
1791 SDL_Convert_F32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1798 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S8.\n");
1801 src = (const float *) cvt->buf;
1802 dst = (Sint8 *) cvt->buf;
1803 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1804 const Sint8 val = ((Sint8) (SDL_SwapFloatLE(*src) * 127.0f));
1805 *dst = ((Sint8) val);
1809 if (cvt->filters[++cvt->filter_index]) {
1810 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
1815 SDL_Convert_F32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1822 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16LSB.\n");
1825 src = (const float *) cvt->buf;
1826 dst = (Uint16 *) cvt->buf;
1827 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1828 const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f));
1829 *dst = SDL_SwapLE16(val);
1833 if (cvt->filters[++cvt->filter_index]) {
1834 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
1839 SDL_Convert_F32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1846 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16LSB.\n");
1849 src = (const float *) cvt->buf;
1850 dst = (Sint16 *) cvt->buf;
1851 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1852 const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f));
1853 *dst = ((Sint16) SDL_SwapLE16(val));
1857 if (cvt->filters[++cvt->filter_index]) {
1858 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
1863 SDL_Convert_F32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1870 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16MSB.\n");
1873 src = (const float *) cvt->buf;
1874 dst = (Uint16 *) cvt->buf;
1875 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1876 const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f));
1877 *dst = SDL_SwapBE16(val);
1881 if (cvt->filters[++cvt->filter_index]) {
1882 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
1887 SDL_Convert_F32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1894 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16MSB.\n");
1897 src = (const float *) cvt->buf;
1898 dst = (Sint16 *) cvt->buf;
1899 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1900 const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f));
1901 *dst = ((Sint16) SDL_SwapBE16(val));
1905 if (cvt->filters[++cvt->filter_index]) {
1906 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
1911 SDL_Convert_F32LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1918 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32LSB.\n");
1921 src = (const float *) cvt->buf;
1922 dst = (Sint32 *) cvt->buf;
1923 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1924 const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0));
1925 *dst = ((Sint32) SDL_SwapLE32(val));
1928 if (cvt->filters[++cvt->filter_index]) {
1929 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
1934 SDL_Convert_F32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1941 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32MSB.\n");
1944 src = (const float *) cvt->buf;
1945 dst = (Sint32 *) cvt->buf;
1946 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1947 const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0));
1948 *dst = ((Sint32) SDL_SwapBE32(val));
1951 if (cvt->filters[++cvt->filter_index]) {
1952 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
1957 SDL_Convert_F32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1964 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_F32MSB.\n");
1967 src = (const float *) cvt->buf;
1968 dst = (float *) cvt->buf;
1969 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1970 const float val = SDL_SwapFloatLE(*src);
1971 *dst = SDL_SwapFloatBE(val);
1974 if (cvt->filters[++cvt->filter_index]) {
1975 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
1980 SDL_Convert_F32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1987 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U8.\n");
1990 src = (const float *) cvt->buf;
1991 dst = (Uint8 *) cvt->buf;
1992 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1993 const Uint8 val = ((Uint8) ((SDL_SwapFloatBE(*src) + 1.0f) * 127.0f));
1998 if (cvt->filters[++cvt->filter_index]) {
1999 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
2004 SDL_Convert_F32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2011 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S8.\n");
2014 src = (const float *) cvt->buf;
2015 dst = (Sint8 *) cvt->buf;
2016 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2017 const Sint8 val = ((Sint8) (SDL_SwapFloatBE(*src) * 127.0f));
2018 *dst = ((Sint8) val);
2022 if (cvt->filters[++cvt->filter_index]) {
2023 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
2028 SDL_Convert_F32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2035 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16LSB.\n");
2038 src = (const float *) cvt->buf;
2039 dst = (Uint16 *) cvt->buf;
2040 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2041 const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f));
2042 *dst = SDL_SwapLE16(val);
2046 if (cvt->filters[++cvt->filter_index]) {
2047 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
2052 SDL_Convert_F32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2059 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16LSB.\n");
2062 src = (const float *) cvt->buf;
2063 dst = (Sint16 *) cvt->buf;
2064 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2065 const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f));
2066 *dst = ((Sint16) SDL_SwapLE16(val));
2070 if (cvt->filters[++cvt->filter_index]) {
2071 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
2076 SDL_Convert_F32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2083 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16MSB.\n");
2086 src = (const float *) cvt->buf;
2087 dst = (Uint16 *) cvt->buf;
2088 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2089 const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f));
2090 *dst = SDL_SwapBE16(val);
2094 if (cvt->filters[++cvt->filter_index]) {
2095 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
2100 SDL_Convert_F32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2107 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16MSB.\n");
2110 src = (const float *) cvt->buf;
2111 dst = (Sint16 *) cvt->buf;
2112 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2113 const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f));
2114 *dst = ((Sint16) SDL_SwapBE16(val));
2118 if (cvt->filters[++cvt->filter_index]) {
2119 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
2124 SDL_Convert_F32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2131 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32LSB.\n");
2134 src = (const float *) cvt->buf;
2135 dst = (Sint32 *) cvt->buf;
2136 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2137 const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0));
2138 *dst = ((Sint32) SDL_SwapLE32(val));
2141 if (cvt->filters[++cvt->filter_index]) {
2142 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
2147 SDL_Convert_F32MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2154 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32MSB.\n");
2157 src = (const float *) cvt->buf;
2158 dst = (Sint32 *) cvt->buf;
2159 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2160 const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0));
2161 *dst = ((Sint32) SDL_SwapBE32(val));
2164 if (cvt->filters[++cvt->filter_index]) {
2165 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
2170 SDL_Convert_F32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2177 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_F32LSB.\n");
2180 src = (const float *) cvt->buf;
2181 dst = (float *) cvt->buf;
2182 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2183 const float val = SDL_SwapFloatBE(*src);
2184 *dst = SDL_SwapFloatLE(val);
2187 if (cvt->filters[++cvt->filter_index]) {
2188 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
2192 #endif /* !NO_CONVERTERS */
2195 const SDL_AudioTypeFilters sdl_audio_type_filters[] =
2198 { AUDIO_U8, AUDIO_S8, SDL_Convert_U8_to_S8 },
2199 { AUDIO_U8, AUDIO_U16LSB, SDL_Convert_U8_to_U16LSB },
2200 { AUDIO_U8, AUDIO_S16LSB, SDL_Convert_U8_to_S16LSB },
2201 { AUDIO_U8, AUDIO_U16MSB, SDL_Convert_U8_to_U16MSB },
2202 { AUDIO_U8, AUDIO_S16MSB, SDL_Convert_U8_to_S16MSB },
2203 { AUDIO_U8, AUDIO_S32LSB, SDL_Convert_U8_to_S32LSB },
2204 { AUDIO_U8, AUDIO_S32MSB, SDL_Convert_U8_to_S32MSB },
2205 { AUDIO_U8, AUDIO_F32LSB, SDL_Convert_U8_to_F32LSB },
2206 { AUDIO_U8, AUDIO_F32MSB, SDL_Convert_U8_to_F32MSB },
2207 { AUDIO_S8, AUDIO_U8, SDL_Convert_S8_to_U8 },
2208 { AUDIO_S8, AUDIO_U16LSB, SDL_Convert_S8_to_U16LSB },
2209 { AUDIO_S8, AUDIO_S16LSB, SDL_Convert_S8_to_S16LSB },
2210 { AUDIO_S8, AUDIO_U16MSB, SDL_Convert_S8_to_U16MSB },
2211 { AUDIO_S8, AUDIO_S16MSB, SDL_Convert_S8_to_S16MSB },
2212 { AUDIO_S8, AUDIO_S32LSB, SDL_Convert_S8_to_S32LSB },
2213 { AUDIO_S8, AUDIO_S32MSB, SDL_Convert_S8_to_S32MSB },
2214 { AUDIO_S8, AUDIO_F32LSB, SDL_Convert_S8_to_F32LSB },
2215 { AUDIO_S8, AUDIO_F32MSB, SDL_Convert_S8_to_F32MSB },
2216 { AUDIO_U16LSB, AUDIO_U8, SDL_Convert_U16LSB_to_U8 },
2217 { AUDIO_U16LSB, AUDIO_S8, SDL_Convert_U16LSB_to_S8 },
2218 { AUDIO_U16LSB, AUDIO_S16LSB, SDL_Convert_U16LSB_to_S16LSB },
2219 { AUDIO_U16LSB, AUDIO_U16MSB, SDL_Convert_U16LSB_to_U16MSB },
2220 { AUDIO_U16LSB, AUDIO_S16MSB, SDL_Convert_U16LSB_to_S16MSB },
2221 { AUDIO_U16LSB, AUDIO_S32LSB, SDL_Convert_U16LSB_to_S32LSB },
2222 { AUDIO_U16LSB, AUDIO_S32MSB, SDL_Convert_U16LSB_to_S32MSB },
2223 { AUDIO_U16LSB, AUDIO_F32LSB, SDL_Convert_U16LSB_to_F32LSB },
2224 { AUDIO_U16LSB, AUDIO_F32MSB, SDL_Convert_U16LSB_to_F32MSB },
2225 { AUDIO_S16LSB, AUDIO_U8, SDL_Convert_S16LSB_to_U8 },
2226 { AUDIO_S16LSB, AUDIO_S8, SDL_Convert_S16LSB_to_S8 },
2227 { AUDIO_S16LSB, AUDIO_U16LSB, SDL_Convert_S16LSB_to_U16LSB },
2228 { AUDIO_S16LSB, AUDIO_U16MSB, SDL_Convert_S16LSB_to_U16MSB },
2229 { AUDIO_S16LSB, AUDIO_S16MSB, SDL_Convert_S16LSB_to_S16MSB },
2230 { AUDIO_S16LSB, AUDIO_S32LSB, SDL_Convert_S16LSB_to_S32LSB },
2231 { AUDIO_S16LSB, AUDIO_S32MSB, SDL_Convert_S16LSB_to_S32MSB },
2232 { AUDIO_S16LSB, AUDIO_F32LSB, SDL_Convert_S16LSB_to_F32LSB },
2233 { AUDIO_S16LSB, AUDIO_F32MSB, SDL_Convert_S16LSB_to_F32MSB },
2234 { AUDIO_U16MSB, AUDIO_U8, SDL_Convert_U16MSB_to_U8 },
2235 { AUDIO_U16MSB, AUDIO_S8, SDL_Convert_U16MSB_to_S8 },
2236 { AUDIO_U16MSB, AUDIO_U16LSB, SDL_Convert_U16MSB_to_U16LSB },
2237 { AUDIO_U16MSB, AUDIO_S16LSB, SDL_Convert_U16MSB_to_S16LSB },
2238 { AUDIO_U16MSB, AUDIO_S16MSB, SDL_Convert_U16MSB_to_S16MSB },
2239 { AUDIO_U16MSB, AUDIO_S32LSB, SDL_Convert_U16MSB_to_S32LSB },
2240 { AUDIO_U16MSB, AUDIO_S32MSB, SDL_Convert_U16MSB_to_S32MSB },
2241 { AUDIO_U16MSB, AUDIO_F32LSB, SDL_Convert_U16MSB_to_F32LSB },
2242 { AUDIO_U16MSB, AUDIO_F32MSB, SDL_Convert_U16MSB_to_F32MSB },
2243 { AUDIO_S16MSB, AUDIO_U8, SDL_Convert_S16MSB_to_U8 },
2244 { AUDIO_S16MSB, AUDIO_S8, SDL_Convert_S16MSB_to_S8 },
2245 { AUDIO_S16MSB, AUDIO_U16LSB, SDL_Convert_S16MSB_to_U16LSB },
2246 { AUDIO_S16MSB, AUDIO_S16LSB, SDL_Convert_S16MSB_to_S16LSB },
2247 { AUDIO_S16MSB, AUDIO_U16MSB, SDL_Convert_S16MSB_to_U16MSB },
2248 { AUDIO_S16MSB, AUDIO_S32LSB, SDL_Convert_S16MSB_to_S32LSB },
2249 { AUDIO_S16MSB, AUDIO_S32MSB, SDL_Convert_S16MSB_to_S32MSB },
2250 { AUDIO_S16MSB, AUDIO_F32LSB, SDL_Convert_S16MSB_to_F32LSB },
2251 { AUDIO_S16MSB, AUDIO_F32MSB, SDL_Convert_S16MSB_to_F32MSB },
2252 { AUDIO_S32LSB, AUDIO_U8, SDL_Convert_S32LSB_to_U8 },
2253 { AUDIO_S32LSB, AUDIO_S8, SDL_Convert_S32LSB_to_S8 },
2254 { AUDIO_S32LSB, AUDIO_U16LSB, SDL_Convert_S32LSB_to_U16LSB },
2255 { AUDIO_S32LSB, AUDIO_S16LSB, SDL_Convert_S32LSB_to_S16LSB },
2256 { AUDIO_S32LSB, AUDIO_U16MSB, SDL_Convert_S32LSB_to_U16MSB },
2257 { AUDIO_S32LSB, AUDIO_S16MSB, SDL_Convert_S32LSB_to_S16MSB },
2258 { AUDIO_S32LSB, AUDIO_S32MSB, SDL_Convert_S32LSB_to_S32MSB },
2259 { AUDIO_S32LSB, AUDIO_F32LSB, SDL_Convert_S32LSB_to_F32LSB },
2260 { AUDIO_S32LSB, AUDIO_F32MSB, SDL_Convert_S32LSB_to_F32MSB },
2261 { AUDIO_S32MSB, AUDIO_U8, SDL_Convert_S32MSB_to_U8 },
2262 { AUDIO_S32MSB, AUDIO_S8, SDL_Convert_S32MSB_to_S8 },
2263 { AUDIO_S32MSB, AUDIO_U16LSB, SDL_Convert_S32MSB_to_U16LSB },
2264 { AUDIO_S32MSB, AUDIO_S16LSB, SDL_Convert_S32MSB_to_S16LSB },
2265 { AUDIO_S32MSB, AUDIO_U16MSB, SDL_Convert_S32MSB_to_U16MSB },
2266 { AUDIO_S32MSB, AUDIO_S16MSB, SDL_Convert_S32MSB_to_S16MSB },
2267 { AUDIO_S32MSB, AUDIO_S32LSB, SDL_Convert_S32MSB_to_S32LSB },
2268 { AUDIO_S32MSB, AUDIO_F32LSB, SDL_Convert_S32MSB_to_F32LSB },
2269 { AUDIO_S32MSB, AUDIO_F32MSB, SDL_Convert_S32MSB_to_F32MSB },
2270 { AUDIO_F32LSB, AUDIO_U8, SDL_Convert_F32LSB_to_U8 },
2271 { AUDIO_F32LSB, AUDIO_S8, SDL_Convert_F32LSB_to_S8 },
2272 { AUDIO_F32LSB, AUDIO_U16LSB, SDL_Convert_F32LSB_to_U16LSB },
2273 { AUDIO_F32LSB, AUDIO_S16LSB, SDL_Convert_F32LSB_to_S16LSB },
2274 { AUDIO_F32LSB, AUDIO_U16MSB, SDL_Convert_F32LSB_to_U16MSB },
2275 { AUDIO_F32LSB, AUDIO_S16MSB, SDL_Convert_F32LSB_to_S16MSB },
2276 { AUDIO_F32LSB, AUDIO_S32LSB, SDL_Convert_F32LSB_to_S32LSB },
2277 { AUDIO_F32LSB, AUDIO_S32MSB, SDL_Convert_F32LSB_to_S32MSB },
2278 { AUDIO_F32LSB, AUDIO_F32MSB, SDL_Convert_F32LSB_to_F32MSB },
2279 { AUDIO_F32MSB, AUDIO_U8, SDL_Convert_F32MSB_to_U8 },
2280 { AUDIO_F32MSB, AUDIO_S8, SDL_Convert_F32MSB_to_S8 },
2281 { AUDIO_F32MSB, AUDIO_U16LSB, SDL_Convert_F32MSB_to_U16LSB },
2282 { AUDIO_F32MSB, AUDIO_S16LSB, SDL_Convert_F32MSB_to_S16LSB },
2283 { AUDIO_F32MSB, AUDIO_U16MSB, SDL_Convert_F32MSB_to_U16MSB },
2284 { AUDIO_F32MSB, AUDIO_S16MSB, SDL_Convert_F32MSB_to_S16MSB },
2285 { AUDIO_F32MSB, AUDIO_S32LSB, SDL_Convert_F32MSB_to_S32LSB },
2286 { AUDIO_F32MSB, AUDIO_S32MSB, SDL_Convert_F32MSB_to_S32MSB },
2287 { AUDIO_F32MSB, AUDIO_F32LSB, SDL_Convert_F32MSB_to_F32LSB },
2288 #endif /* !NO_CONVERTERS */
2296 SDL_Upsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2299 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr);
2302 const int srcsize = cvt->len_cvt - 16;
2303 const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1;
2304 register int eps = 0;
2305 Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1;
2306 const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
2307 const Uint8 *target = ((const Uint8 *) cvt->buf);
2308 Uint8 sample0 = src[0];
2309 Uint8 last_sample0 = sample0;
2310 while (dst >= target) {
2314 if ((eps << 1) >= dstsize) {
2316 sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
2317 last_sample0 = sample0;
2321 cvt->len_cvt = dstsize;
2322 if (cvt->filters[++cvt->filter_index]) {
2323 cvt->filters[cvt->filter_index] (cvt, format);
2328 SDL_Downsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2331 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr);
2334 const int srcsize = cvt->len_cvt - 16;
2335 const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1;
2336 register int eps = 0;
2337 Uint8 *dst = (Uint8 *) cvt->buf;
2338 const Uint8 *src = (Uint8 *) cvt->buf;
2339 const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
2340 Uint8 sample0 = src[0];
2341 Uint8 last_sample0 = sample0;
2342 while (dst < target) {
2345 if ((eps << 1) >= srcsize) {
2348 sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
2349 last_sample0 = sample0;
2353 cvt->len_cvt = dstsize;
2354 if (cvt->filters[++cvt->filter_index]) {
2355 cvt->filters[cvt->filter_index] (cvt, format);
2360 SDL_Upsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2363 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr);
2366 const int srcsize = cvt->len_cvt - 32;
2367 const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
2368 register int eps = 0;
2369 Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2;
2370 const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
2371 const Uint8 *target = ((const Uint8 *) cvt->buf);
2372 Uint8 sample1 = src[1];
2373 Uint8 sample0 = src[0];
2374 Uint8 last_sample1 = sample1;
2375 Uint8 last_sample0 = sample0;
2376 while (dst >= target) {
2381 if ((eps << 1) >= dstsize) {
2383 sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
2384 sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
2385 last_sample1 = sample1;
2386 last_sample0 = sample0;
2390 cvt->len_cvt = dstsize;
2391 if (cvt->filters[++cvt->filter_index]) {
2392 cvt->filters[cvt->filter_index] (cvt, format);
2397 SDL_Downsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2400 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr);
2403 const int srcsize = cvt->len_cvt - 32;
2404 const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
2405 register int eps = 0;
2406 Uint8 *dst = (Uint8 *) cvt->buf;
2407 const Uint8 *src = (Uint8 *) cvt->buf;
2408 const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
2409 Uint8 sample0 = src[0];
2410 Uint8 sample1 = src[1];
2411 Uint8 last_sample0 = sample0;
2412 Uint8 last_sample1 = sample1;
2413 while (dst < target) {
2416 if ((eps << 1) >= srcsize) {
2420 sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
2421 sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
2422 last_sample0 = sample0;
2423 last_sample1 = sample1;
2427 cvt->len_cvt = dstsize;
2428 if (cvt->filters[++cvt->filter_index]) {
2429 cvt->filters[cvt->filter_index] (cvt, format);
2434 SDL_Upsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2437 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr);
2440 const int srcsize = cvt->len_cvt - 64;
2441 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
2442 register int eps = 0;
2443 Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4;
2444 const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
2445 const Uint8 *target = ((const Uint8 *) cvt->buf);
2446 Uint8 sample3 = src[3];
2447 Uint8 sample2 = src[2];
2448 Uint8 sample1 = src[1];
2449 Uint8 sample0 = src[0];
2450 Uint8 last_sample3 = sample3;
2451 Uint8 last_sample2 = sample2;
2452 Uint8 last_sample1 = sample1;
2453 Uint8 last_sample0 = sample0;
2454 while (dst >= target) {
2461 if ((eps << 1) >= dstsize) {
2463 sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
2464 sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
2465 sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
2466 sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
2467 last_sample3 = sample3;
2468 last_sample2 = sample2;
2469 last_sample1 = sample1;
2470 last_sample0 = sample0;
2474 cvt->len_cvt = dstsize;
2475 if (cvt->filters[++cvt->filter_index]) {
2476 cvt->filters[cvt->filter_index] (cvt, format);
2481 SDL_Downsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2484 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr);
2487 const int srcsize = cvt->len_cvt - 64;
2488 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
2489 register int eps = 0;
2490 Uint8 *dst = (Uint8 *) cvt->buf;
2491 const Uint8 *src = (Uint8 *) cvt->buf;
2492 const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
2493 Uint8 sample0 = src[0];
2494 Uint8 sample1 = src[1];
2495 Uint8 sample2 = src[2];
2496 Uint8 sample3 = src[3];
2497 Uint8 last_sample0 = sample0;
2498 Uint8 last_sample1 = sample1;
2499 Uint8 last_sample2 = sample2;
2500 Uint8 last_sample3 = sample3;
2501 while (dst < target) {
2504 if ((eps << 1) >= srcsize) {
2510 sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
2511 sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
2512 sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
2513 sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
2514 last_sample0 = sample0;
2515 last_sample1 = sample1;
2516 last_sample2 = sample2;
2517 last_sample3 = sample3;
2521 cvt->len_cvt = dstsize;
2522 if (cvt->filters[++cvt->filter_index]) {
2523 cvt->filters[cvt->filter_index] (cvt, format);
2528 SDL_Upsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2531 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr);
2534 const int srcsize = cvt->len_cvt - 96;
2535 const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6;
2536 register int eps = 0;
2537 Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6;
2538 const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
2539 const Uint8 *target = ((const Uint8 *) cvt->buf);
2540 Uint8 sample5 = src[5];
2541 Uint8 sample4 = src[4];
2542 Uint8 sample3 = src[3];
2543 Uint8 sample2 = src[2];
2544 Uint8 sample1 = src[1];
2545 Uint8 sample0 = src[0];
2546 Uint8 last_sample5 = sample5;
2547 Uint8 last_sample4 = sample4;
2548 Uint8 last_sample3 = sample3;
2549 Uint8 last_sample2 = sample2;
2550 Uint8 last_sample1 = sample1;
2551 Uint8 last_sample0 = sample0;
2552 while (dst >= target) {
2561 if ((eps << 1) >= dstsize) {
2563 sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
2564 sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
2565 sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
2566 sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
2567 sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
2568 sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
2569 last_sample5 = sample5;
2570 last_sample4 = sample4;
2571 last_sample3 = sample3;
2572 last_sample2 = sample2;
2573 last_sample1 = sample1;
2574 last_sample0 = sample0;
2578 cvt->len_cvt = dstsize;
2579 if (cvt->filters[++cvt->filter_index]) {
2580 cvt->filters[cvt->filter_index] (cvt, format);
2585 SDL_Downsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2588 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr);
2591 const int srcsize = cvt->len_cvt - 96;
2592 const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6;
2593 register int eps = 0;
2594 Uint8 *dst = (Uint8 *) cvt->buf;
2595 const Uint8 *src = (Uint8 *) cvt->buf;
2596 const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
2597 Uint8 sample0 = src[0];
2598 Uint8 sample1 = src[1];
2599 Uint8 sample2 = src[2];
2600 Uint8 sample3 = src[3];
2601 Uint8 sample4 = src[4];
2602 Uint8 sample5 = src[5];
2603 Uint8 last_sample0 = sample0;
2604 Uint8 last_sample1 = sample1;
2605 Uint8 last_sample2 = sample2;
2606 Uint8 last_sample3 = sample3;
2607 Uint8 last_sample4 = sample4;
2608 Uint8 last_sample5 = sample5;
2609 while (dst < target) {
2612 if ((eps << 1) >= srcsize) {
2620 sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
2621 sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
2622 sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
2623 sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
2624 sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
2625 sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
2626 last_sample0 = sample0;
2627 last_sample1 = sample1;
2628 last_sample2 = sample2;
2629 last_sample3 = sample3;
2630 last_sample4 = sample4;
2631 last_sample5 = sample5;
2635 cvt->len_cvt = dstsize;
2636 if (cvt->filters[++cvt->filter_index]) {
2637 cvt->filters[cvt->filter_index] (cvt, format);
2642 SDL_Upsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2645 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr);
2648 const int srcsize = cvt->len_cvt - 128;
2649 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
2650 register int eps = 0;
2651 Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8;
2652 const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
2653 const Uint8 *target = ((const Uint8 *) cvt->buf);
2654 Uint8 sample7 = src[7];
2655 Uint8 sample6 = src[6];
2656 Uint8 sample5 = src[5];
2657 Uint8 sample4 = src[4];
2658 Uint8 sample3 = src[3];
2659 Uint8 sample2 = src[2];
2660 Uint8 sample1 = src[1];
2661 Uint8 sample0 = src[0];
2662 Uint8 last_sample7 = sample7;
2663 Uint8 last_sample6 = sample6;
2664 Uint8 last_sample5 = sample5;
2665 Uint8 last_sample4 = sample4;
2666 Uint8 last_sample3 = sample3;
2667 Uint8 last_sample2 = sample2;
2668 Uint8 last_sample1 = sample1;
2669 Uint8 last_sample0 = sample0;
2670 while (dst >= target) {
2681 if ((eps << 1) >= dstsize) {
2683 sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1);
2684 sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1);
2685 sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
2686 sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
2687 sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
2688 sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
2689 sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
2690 sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
2691 last_sample7 = sample7;
2692 last_sample6 = sample6;
2693 last_sample5 = sample5;
2694 last_sample4 = sample4;
2695 last_sample3 = sample3;
2696 last_sample2 = sample2;
2697 last_sample1 = sample1;
2698 last_sample0 = sample0;
2702 cvt->len_cvt = dstsize;
2703 if (cvt->filters[++cvt->filter_index]) {
2704 cvt->filters[cvt->filter_index] (cvt, format);
2709 SDL_Downsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2712 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr);
2715 const int srcsize = cvt->len_cvt - 128;
2716 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
2717 register int eps = 0;
2718 Uint8 *dst = (Uint8 *) cvt->buf;
2719 const Uint8 *src = (Uint8 *) cvt->buf;
2720 const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
2721 Uint8 sample0 = src[0];
2722 Uint8 sample1 = src[1];
2723 Uint8 sample2 = src[2];
2724 Uint8 sample3 = src[3];
2725 Uint8 sample4 = src[4];
2726 Uint8 sample5 = src[5];
2727 Uint8 sample6 = src[6];
2728 Uint8 sample7 = src[7];
2729 Uint8 last_sample0 = sample0;
2730 Uint8 last_sample1 = sample1;
2731 Uint8 last_sample2 = sample2;
2732 Uint8 last_sample3 = sample3;
2733 Uint8 last_sample4 = sample4;
2734 Uint8 last_sample5 = sample5;
2735 Uint8 last_sample6 = sample6;
2736 Uint8 last_sample7 = sample7;
2737 while (dst < target) {
2740 if ((eps << 1) >= srcsize) {
2750 sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
2751 sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
2752 sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
2753 sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
2754 sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
2755 sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
2756 sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1);
2757 sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1);
2758 last_sample0 = sample0;
2759 last_sample1 = sample1;
2760 last_sample2 = sample2;
2761 last_sample3 = sample3;
2762 last_sample4 = sample4;
2763 last_sample5 = sample5;
2764 last_sample6 = sample6;
2765 last_sample7 = sample7;
2769 cvt->len_cvt = dstsize;
2770 if (cvt->filters[++cvt->filter_index]) {
2771 cvt->filters[cvt->filter_index] (cvt, format);
2776 SDL_Upsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2779 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr);
2782 const int srcsize = cvt->len_cvt - 16;
2783 const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1;
2784 register int eps = 0;
2785 Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1;
2786 const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
2787 const Sint8 *target = ((const Sint8 *) cvt->buf);
2788 Sint8 sample0 = ((Sint8) src[0]);
2789 Sint8 last_sample0 = sample0;
2790 while (dst >= target) {
2791 dst[0] = ((Sint8) sample0);
2794 if ((eps << 1) >= dstsize) {
2796 sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
2797 last_sample0 = sample0;
2801 cvt->len_cvt = dstsize;
2802 if (cvt->filters[++cvt->filter_index]) {
2803 cvt->filters[cvt->filter_index] (cvt, format);
2808 SDL_Downsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2811 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr);
2814 const int srcsize = cvt->len_cvt - 16;
2815 const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1;
2816 register int eps = 0;
2817 Sint8 *dst = (Sint8 *) cvt->buf;
2818 const Sint8 *src = (Sint8 *) cvt->buf;
2819 const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
2820 Sint8 sample0 = ((Sint8) src[0]);
2821 Sint8 last_sample0 = sample0;
2822 while (dst < target) {
2825 if ((eps << 1) >= srcsize) {
2826 dst[0] = ((Sint8) sample0);
2828 sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
2829 last_sample0 = sample0;
2833 cvt->len_cvt = dstsize;
2834 if (cvt->filters[++cvt->filter_index]) {
2835 cvt->filters[cvt->filter_index] (cvt, format);
2840 SDL_Upsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2843 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr);
2846 const int srcsize = cvt->len_cvt - 32;
2847 const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
2848 register int eps = 0;
2849 Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2;
2850 const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
2851 const Sint8 *target = ((const Sint8 *) cvt->buf);
2852 Sint8 sample1 = ((Sint8) src[1]);
2853 Sint8 sample0 = ((Sint8) src[0]);
2854 Sint8 last_sample1 = sample1;
2855 Sint8 last_sample0 = sample0;
2856 while (dst >= target) {
2857 dst[1] = ((Sint8) sample1);
2858 dst[0] = ((Sint8) sample0);
2861 if ((eps << 1) >= dstsize) {
2863 sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
2864 sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
2865 last_sample1 = sample1;
2866 last_sample0 = sample0;
2870 cvt->len_cvt = dstsize;
2871 if (cvt->filters[++cvt->filter_index]) {
2872 cvt->filters[cvt->filter_index] (cvt, format);
2877 SDL_Downsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2880 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr);
2883 const int srcsize = cvt->len_cvt - 32;
2884 const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
2885 register int eps = 0;
2886 Sint8 *dst = (Sint8 *) cvt->buf;
2887 const Sint8 *src = (Sint8 *) cvt->buf;
2888 const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
2889 Sint8 sample0 = ((Sint8) src[0]);
2890 Sint8 sample1 = ((Sint8) src[1]);
2891 Sint8 last_sample0 = sample0;
2892 Sint8 last_sample1 = sample1;
2893 while (dst < target) {
2896 if ((eps << 1) >= srcsize) {
2897 dst[0] = ((Sint8) sample0);
2898 dst[1] = ((Sint8) sample1);
2900 sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
2901 sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
2902 last_sample0 = sample0;
2903 last_sample1 = sample1;
2907 cvt->len_cvt = dstsize;
2908 if (cvt->filters[++cvt->filter_index]) {
2909 cvt->filters[cvt->filter_index] (cvt, format);
2914 SDL_Upsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2917 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr);
2920 const int srcsize = cvt->len_cvt - 64;
2921 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
2922 register int eps = 0;
2923 Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4;
2924 const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
2925 const Sint8 *target = ((const Sint8 *) cvt->buf);
2926 Sint8 sample3 = ((Sint8) src[3]);
2927 Sint8 sample2 = ((Sint8) src[2]);
2928 Sint8 sample1 = ((Sint8) src[1]);
2929 Sint8 sample0 = ((Sint8) src[0]);
2930 Sint8 last_sample3 = sample3;
2931 Sint8 last_sample2 = sample2;
2932 Sint8 last_sample1 = sample1;
2933 Sint8 last_sample0 = sample0;
2934 while (dst >= target) {
2935 dst[3] = ((Sint8) sample3);
2936 dst[2] = ((Sint8) sample2);
2937 dst[1] = ((Sint8) sample1);
2938 dst[0] = ((Sint8) sample0);
2941 if ((eps << 1) >= dstsize) {
2943 sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
2944 sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
2945 sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
2946 sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
2947 last_sample3 = sample3;
2948 last_sample2 = sample2;
2949 last_sample1 = sample1;
2950 last_sample0 = sample0;
2954 cvt->len_cvt = dstsize;
2955 if (cvt->filters[++cvt->filter_index]) {
2956 cvt->filters[cvt->filter_index] (cvt, format);
2961 SDL_Downsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2964 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr);
2967 const int srcsize = cvt->len_cvt - 64;
2968 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
2969 register int eps = 0;
2970 Sint8 *dst = (Sint8 *) cvt->buf;
2971 const Sint8 *src = (Sint8 *) cvt->buf;
2972 const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
2973 Sint8 sample0 = ((Sint8) src[0]);
2974 Sint8 sample1 = ((Sint8) src[1]);
2975 Sint8 sample2 = ((Sint8) src[2]);
2976 Sint8 sample3 = ((Sint8) src[3]);
2977 Sint8 last_sample0 = sample0;
2978 Sint8 last_sample1 = sample1;
2979 Sint8 last_sample2 = sample2;
2980 Sint8 last_sample3 = sample3;
2981 while (dst < target) {
2984 if ((eps << 1) >= srcsize) {
2985 dst[0] = ((Sint8) sample0);
2986 dst[1] = ((Sint8) sample1);
2987 dst[2] = ((Sint8) sample2);
2988 dst[3] = ((Sint8) sample3);
2990 sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
2991 sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
2992 sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
2993 sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
2994 last_sample0 = sample0;
2995 last_sample1 = sample1;
2996 last_sample2 = sample2;
2997 last_sample3 = sample3;
3001 cvt->len_cvt = dstsize;
3002 if (cvt->filters[++cvt->filter_index]) {
3003 cvt->filters[cvt->filter_index] (cvt, format);
3008 SDL_Upsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3011 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr);
3014 const int srcsize = cvt->len_cvt - 96;
3015 const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6;
3016 register int eps = 0;
3017 Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6;
3018 const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
3019 const Sint8 *target = ((const Sint8 *) cvt->buf);
3020 Sint8 sample5 = ((Sint8) src[5]);
3021 Sint8 sample4 = ((Sint8) src[4]);
3022 Sint8 sample3 = ((Sint8) src[3]);
3023 Sint8 sample2 = ((Sint8) src[2]);
3024 Sint8 sample1 = ((Sint8) src[1]);
3025 Sint8 sample0 = ((Sint8) src[0]);
3026 Sint8 last_sample5 = sample5;
3027 Sint8 last_sample4 = sample4;
3028 Sint8 last_sample3 = sample3;
3029 Sint8 last_sample2 = sample2;
3030 Sint8 last_sample1 = sample1;
3031 Sint8 last_sample0 = sample0;
3032 while (dst >= target) {
3033 dst[5] = ((Sint8) sample5);
3034 dst[4] = ((Sint8) sample4);
3035 dst[3] = ((Sint8) sample3);
3036 dst[2] = ((Sint8) sample2);
3037 dst[1] = ((Sint8) sample1);
3038 dst[0] = ((Sint8) sample0);
3041 if ((eps << 1) >= dstsize) {
3043 sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
3044 sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
3045 sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
3046 sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
3047 sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
3048 sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
3049 last_sample5 = sample5;
3050 last_sample4 = sample4;
3051 last_sample3 = sample3;
3052 last_sample2 = sample2;
3053 last_sample1 = sample1;
3054 last_sample0 = sample0;
3058 cvt->len_cvt = dstsize;
3059 if (cvt->filters[++cvt->filter_index]) {
3060 cvt->filters[cvt->filter_index] (cvt, format);
3065 SDL_Downsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3068 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr);
3071 const int srcsize = cvt->len_cvt - 96;
3072 const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6;
3073 register int eps = 0;
3074 Sint8 *dst = (Sint8 *) cvt->buf;
3075 const Sint8 *src = (Sint8 *) cvt->buf;
3076 const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
3077 Sint8 sample0 = ((Sint8) src[0]);
3078 Sint8 sample1 = ((Sint8) src[1]);
3079 Sint8 sample2 = ((Sint8) src[2]);
3080 Sint8 sample3 = ((Sint8) src[3]);
3081 Sint8 sample4 = ((Sint8) src[4]);
3082 Sint8 sample5 = ((Sint8) src[5]);
3083 Sint8 last_sample0 = sample0;
3084 Sint8 last_sample1 = sample1;
3085 Sint8 last_sample2 = sample2;
3086 Sint8 last_sample3 = sample3;
3087 Sint8 last_sample4 = sample4;
3088 Sint8 last_sample5 = sample5;
3089 while (dst < target) {
3092 if ((eps << 1) >= srcsize) {
3093 dst[0] = ((Sint8) sample0);
3094 dst[1] = ((Sint8) sample1);
3095 dst[2] = ((Sint8) sample2);
3096 dst[3] = ((Sint8) sample3);
3097 dst[4] = ((Sint8) sample4);
3098 dst[5] = ((Sint8) sample5);
3100 sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
3101 sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
3102 sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
3103 sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
3104 sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
3105 sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
3106 last_sample0 = sample0;
3107 last_sample1 = sample1;
3108 last_sample2 = sample2;
3109 last_sample3 = sample3;
3110 last_sample4 = sample4;
3111 last_sample5 = sample5;
3115 cvt->len_cvt = dstsize;
3116 if (cvt->filters[++cvt->filter_index]) {
3117 cvt->filters[cvt->filter_index] (cvt, format);
3122 SDL_Upsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3125 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr);
3128 const int srcsize = cvt->len_cvt - 128;
3129 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
3130 register int eps = 0;
3131 Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8;
3132 const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
3133 const Sint8 *target = ((const Sint8 *) cvt->buf);
3134 Sint8 sample7 = ((Sint8) src[7]);
3135 Sint8 sample6 = ((Sint8) src[6]);
3136 Sint8 sample5 = ((Sint8) src[5]);
3137 Sint8 sample4 = ((Sint8) src[4]);
3138 Sint8 sample3 = ((Sint8) src[3]);
3139 Sint8 sample2 = ((Sint8) src[2]);
3140 Sint8 sample1 = ((Sint8) src[1]);
3141 Sint8 sample0 = ((Sint8) src[0]);
3142 Sint8 last_sample7 = sample7;
3143 Sint8 last_sample6 = sample6;
3144 Sint8 last_sample5 = sample5;
3145 Sint8 last_sample4 = sample4;
3146 Sint8 last_sample3 = sample3;
3147 Sint8 last_sample2 = sample2;
3148 Sint8 last_sample1 = sample1;
3149 Sint8 last_sample0 = sample0;
3150 while (dst >= target) {
3151 dst[7] = ((Sint8) sample7);
3152 dst[6] = ((Sint8) sample6);
3153 dst[5] = ((Sint8) sample5);
3154 dst[4] = ((Sint8) sample4);
3155 dst[3] = ((Sint8) sample3);
3156 dst[2] = ((Sint8) sample2);
3157 dst[1] = ((Sint8) sample1);
3158 dst[0] = ((Sint8) sample0);
3161 if ((eps << 1) >= dstsize) {
3163 sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1);
3164 sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1);
3165 sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
3166 sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
3167 sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
3168 sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
3169 sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
3170 sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
3171 last_sample7 = sample7;
3172 last_sample6 = sample6;
3173 last_sample5 = sample5;
3174 last_sample4 = sample4;
3175 last_sample3 = sample3;
3176 last_sample2 = sample2;
3177 last_sample1 = sample1;
3178 last_sample0 = sample0;
3182 cvt->len_cvt = dstsize;
3183 if (cvt->filters[++cvt->filter_index]) {
3184 cvt->filters[cvt->filter_index] (cvt, format);
3189 SDL_Downsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3192 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr);
3195 const int srcsize = cvt->len_cvt - 128;
3196 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
3197 register int eps = 0;
3198 Sint8 *dst = (Sint8 *) cvt->buf;
3199 const Sint8 *src = (Sint8 *) cvt->buf;
3200 const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
3201 Sint8 sample0 = ((Sint8) src[0]);
3202 Sint8 sample1 = ((Sint8) src[1]);
3203 Sint8 sample2 = ((Sint8) src[2]);
3204 Sint8 sample3 = ((Sint8) src[3]);
3205 Sint8 sample4 = ((Sint8) src[4]);
3206 Sint8 sample5 = ((Sint8) src[5]);
3207 Sint8 sample6 = ((Sint8) src[6]);
3208 Sint8 sample7 = ((Sint8) src[7]);
3209 Sint8 last_sample0 = sample0;
3210 Sint8 last_sample1 = sample1;
3211 Sint8 last_sample2 = sample2;
3212 Sint8 last_sample3 = sample3;
3213 Sint8 last_sample4 = sample4;
3214 Sint8 last_sample5 = sample5;
3215 Sint8 last_sample6 = sample6;
3216 Sint8 last_sample7 = sample7;
3217 while (dst < target) {
3220 if ((eps << 1) >= srcsize) {
3221 dst[0] = ((Sint8) sample0);
3222 dst[1] = ((Sint8) sample1);
3223 dst[2] = ((Sint8) sample2);
3224 dst[3] = ((Sint8) sample3);
3225 dst[4] = ((Sint8) sample4);
3226 dst[5] = ((Sint8) sample5);
3227 dst[6] = ((Sint8) sample6);
3228 dst[7] = ((Sint8) sample7);
3230 sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
3231 sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
3232 sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
3233 sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
3234 sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
3235 sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
3236 sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1);
3237 sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1);
3238 last_sample0 = sample0;
3239 last_sample1 = sample1;
3240 last_sample2 = sample2;
3241 last_sample3 = sample3;
3242 last_sample4 = sample4;
3243 last_sample5 = sample5;
3244 last_sample6 = sample6;
3245 last_sample7 = sample7;
3249 cvt->len_cvt = dstsize;
3250 if (cvt->filters[++cvt->filter_index]) {
3251 cvt->filters[cvt->filter_index] (cvt, format);
3256 SDL_Upsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3259 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr);
3262 const int srcsize = cvt->len_cvt - 32;
3263 const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
3264 register int eps = 0;
3265 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
3266 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
3267 const Uint16 *target = ((const Uint16 *) cvt->buf);
3268 Uint16 sample0 = SDL_SwapLE16(src[0]);
3269 Uint16 last_sample0 = sample0;
3270 while (dst >= target) {
3271 dst[0] = SDL_SwapLE16(sample0);
3274 if ((eps << 1) >= dstsize) {
3276 sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
3277 last_sample0 = sample0;
3281 cvt->len_cvt = dstsize;
3282 if (cvt->filters[++cvt->filter_index]) {
3283 cvt->filters[cvt->filter_index] (cvt, format);
3288 SDL_Downsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3291 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr);
3294 const int srcsize = cvt->len_cvt - 32;
3295 const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
3296 register int eps = 0;
3297 Uint16 *dst = (Uint16 *) cvt->buf;
3298 const Uint16 *src = (Uint16 *) cvt->buf;
3299 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
3300 Uint16 sample0 = SDL_SwapLE16(src[0]);
3301 Uint16 last_sample0 = sample0;
3302 while (dst < target) {
3305 if ((eps << 1) >= srcsize) {
3306 dst[0] = SDL_SwapLE16(sample0);
3308 sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
3309 last_sample0 = sample0;
3313 cvt->len_cvt = dstsize;
3314 if (cvt->filters[++cvt->filter_index]) {
3315 cvt->filters[cvt->filter_index] (cvt, format);
3320 SDL_Upsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3323 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr);
3326 const int srcsize = cvt->len_cvt - 64;
3327 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
3328 register int eps = 0;
3329 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
3330 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
3331 const Uint16 *target = ((const Uint16 *) cvt->buf);
3332 Uint16 sample1 = SDL_SwapLE16(src[1]);
3333 Uint16 sample0 = SDL_SwapLE16(src[0]);
3334 Uint16 last_sample1 = sample1;
3335 Uint16 last_sample0 = sample0;
3336 while (dst >= target) {
3337 dst[1] = SDL_SwapLE16(sample1);
3338 dst[0] = SDL_SwapLE16(sample0);
3341 if ((eps << 1) >= dstsize) {
3343 sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
3344 sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
3345 last_sample1 = sample1;
3346 last_sample0 = sample0;
3350 cvt->len_cvt = dstsize;
3351 if (cvt->filters[++cvt->filter_index]) {
3352 cvt->filters[cvt->filter_index] (cvt, format);
3357 SDL_Downsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3360 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr);
3363 const int srcsize = cvt->len_cvt - 64;
3364 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
3365 register int eps = 0;
3366 Uint16 *dst = (Uint16 *) cvt->buf;
3367 const Uint16 *src = (Uint16 *) cvt->buf;
3368 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
3369 Uint16 sample0 = SDL_SwapLE16(src[0]);
3370 Uint16 sample1 = SDL_SwapLE16(src[1]);
3371 Uint16 last_sample0 = sample0;
3372 Uint16 last_sample1 = sample1;
3373 while (dst < target) {
3376 if ((eps << 1) >= srcsize) {
3377 dst[0] = SDL_SwapLE16(sample0);
3378 dst[1] = SDL_SwapLE16(sample1);
3380 sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
3381 sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
3382 last_sample0 = sample0;
3383 last_sample1 = sample1;
3387 cvt->len_cvt = dstsize;
3388 if (cvt->filters[++cvt->filter_index]) {
3389 cvt->filters[cvt->filter_index] (cvt, format);
3394 SDL_Upsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3397 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr);
3400 const int srcsize = cvt->len_cvt - 128;
3401 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
3402 register int eps = 0;
3403 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
3404 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
3405 const Uint16 *target = ((const Uint16 *) cvt->buf);
3406 Uint16 sample3 = SDL_SwapLE16(src[3]);
3407 Uint16 sample2 = SDL_SwapLE16(src[2]);
3408 Uint16 sample1 = SDL_SwapLE16(src[1]);
3409 Uint16 sample0 = SDL_SwapLE16(src[0]);
3410 Uint16 last_sample3 = sample3;
3411 Uint16 last_sample2 = sample2;
3412 Uint16 last_sample1 = sample1;
3413 Uint16 last_sample0 = sample0;
3414 while (dst >= target) {
3415 dst[3] = SDL_SwapLE16(sample3);
3416 dst[2] = SDL_SwapLE16(sample2);
3417 dst[1] = SDL_SwapLE16(sample1);
3418 dst[0] = SDL_SwapLE16(sample0);
3421 if ((eps << 1) >= dstsize) {
3423 sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
3424 sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
3425 sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
3426 sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
3427 last_sample3 = sample3;
3428 last_sample2 = sample2;
3429 last_sample1 = sample1;
3430 last_sample0 = sample0;
3434 cvt->len_cvt = dstsize;
3435 if (cvt->filters[++cvt->filter_index]) {
3436 cvt->filters[cvt->filter_index] (cvt, format);
3441 SDL_Downsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3444 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr);
3447 const int srcsize = cvt->len_cvt - 128;
3448 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
3449 register int eps = 0;
3450 Uint16 *dst = (Uint16 *) cvt->buf;
3451 const Uint16 *src = (Uint16 *) cvt->buf;
3452 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
3453 Uint16 sample0 = SDL_SwapLE16(src[0]);
3454 Uint16 sample1 = SDL_SwapLE16(src[1]);
3455 Uint16 sample2 = SDL_SwapLE16(src[2]);
3456 Uint16 sample3 = SDL_SwapLE16(src[3]);
3457 Uint16 last_sample0 = sample0;
3458 Uint16 last_sample1 = sample1;
3459 Uint16 last_sample2 = sample2;
3460 Uint16 last_sample3 = sample3;
3461 while (dst < target) {
3464 if ((eps << 1) >= srcsize) {
3465 dst[0] = SDL_SwapLE16(sample0);
3466 dst[1] = SDL_SwapLE16(sample1);
3467 dst[2] = SDL_SwapLE16(sample2);
3468 dst[3] = SDL_SwapLE16(sample3);
3470 sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
3471 sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
3472 sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
3473 sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
3474 last_sample0 = sample0;
3475 last_sample1 = sample1;
3476 last_sample2 = sample2;
3477 last_sample3 = sample3;
3481 cvt->len_cvt = dstsize;
3482 if (cvt->filters[++cvt->filter_index]) {
3483 cvt->filters[cvt->filter_index] (cvt, format);
3488 SDL_Upsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3491 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr);
3494 const int srcsize = cvt->len_cvt - 192;
3495 const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
3496 register int eps = 0;
3497 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
3498 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
3499 const Uint16 *target = ((const Uint16 *) cvt->buf);
3500 Uint16 sample5 = SDL_SwapLE16(src[5]);
3501 Uint16 sample4 = SDL_SwapLE16(src[4]);
3502 Uint16 sample3 = SDL_SwapLE16(src[3]);
3503 Uint16 sample2 = SDL_SwapLE16(src[2]);
3504 Uint16 sample1 = SDL_SwapLE16(src[1]);
3505 Uint16 sample0 = SDL_SwapLE16(src[0]);
3506 Uint16 last_sample5 = sample5;
3507 Uint16 last_sample4 = sample4;
3508 Uint16 last_sample3 = sample3;
3509 Uint16 last_sample2 = sample2;
3510 Uint16 last_sample1 = sample1;
3511 Uint16 last_sample0 = sample0;
3512 while (dst >= target) {
3513 dst[5] = SDL_SwapLE16(sample5);
3514 dst[4] = SDL_SwapLE16(sample4);
3515 dst[3] = SDL_SwapLE16(sample3);
3516 dst[2] = SDL_SwapLE16(sample2);
3517 dst[1] = SDL_SwapLE16(sample1);
3518 dst[0] = SDL_SwapLE16(sample0);
3521 if ((eps << 1) >= dstsize) {
3523 sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
3524 sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
3525 sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
3526 sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
3527 sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
3528 sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
3529 last_sample5 = sample5;
3530 last_sample4 = sample4;
3531 last_sample3 = sample3;
3532 last_sample2 = sample2;
3533 last_sample1 = sample1;
3534 last_sample0 = sample0;
3538 cvt->len_cvt = dstsize;
3539 if (cvt->filters[++cvt->filter_index]) {
3540 cvt->filters[cvt->filter_index] (cvt, format);
3545 SDL_Downsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3548 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr);
3551 const int srcsize = cvt->len_cvt - 192;
3552 const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
3553 register int eps = 0;
3554 Uint16 *dst = (Uint16 *) cvt->buf;
3555 const Uint16 *src = (Uint16 *) cvt->buf;
3556 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
3557 Uint16 sample0 = SDL_SwapLE16(src[0]);
3558 Uint16 sample1 = SDL_SwapLE16(src[1]);
3559 Uint16 sample2 = SDL_SwapLE16(src[2]);
3560 Uint16 sample3 = SDL_SwapLE16(src[3]);
3561 Uint16 sample4 = SDL_SwapLE16(src[4]);
3562 Uint16 sample5 = SDL_SwapLE16(src[5]);
3563 Uint16 last_sample0 = sample0;
3564 Uint16 last_sample1 = sample1;
3565 Uint16 last_sample2 = sample2;
3566 Uint16 last_sample3 = sample3;
3567 Uint16 last_sample4 = sample4;
3568 Uint16 last_sample5 = sample5;
3569 while (dst < target) {
3572 if ((eps << 1) >= srcsize) {
3573 dst[0] = SDL_SwapLE16(sample0);
3574 dst[1] = SDL_SwapLE16(sample1);
3575 dst[2] = SDL_SwapLE16(sample2);
3576 dst[3] = SDL_SwapLE16(sample3);
3577 dst[4] = SDL_SwapLE16(sample4);
3578 dst[5] = SDL_SwapLE16(sample5);
3580 sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
3581 sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
3582 sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
3583 sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
3584 sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
3585 sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
3586 last_sample0 = sample0;
3587 last_sample1 = sample1;
3588 last_sample2 = sample2;
3589 last_sample3 = sample3;
3590 last_sample4 = sample4;
3591 last_sample5 = sample5;
3595 cvt->len_cvt = dstsize;
3596 if (cvt->filters[++cvt->filter_index]) {
3597 cvt->filters[cvt->filter_index] (cvt, format);
3602 SDL_Upsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3605 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr);
3608 const int srcsize = cvt->len_cvt - 256;
3609 const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
3610 register int eps = 0;
3611 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
3612 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
3613 const Uint16 *target = ((const Uint16 *) cvt->buf);
3614 Uint16 sample7 = SDL_SwapLE16(src[7]);
3615 Uint16 sample6 = SDL_SwapLE16(src[6]);
3616 Uint16 sample5 = SDL_SwapLE16(src[5]);
3617 Uint16 sample4 = SDL_SwapLE16(src[4]);
3618 Uint16 sample3 = SDL_SwapLE16(src[3]);
3619 Uint16 sample2 = SDL_SwapLE16(src[2]);
3620 Uint16 sample1 = SDL_SwapLE16(src[1]);
3621 Uint16 sample0 = SDL_SwapLE16(src[0]);
3622 Uint16 last_sample7 = sample7;
3623 Uint16 last_sample6 = sample6;
3624 Uint16 last_sample5 = sample5;
3625 Uint16 last_sample4 = sample4;
3626 Uint16 last_sample3 = sample3;
3627 Uint16 last_sample2 = sample2;
3628 Uint16 last_sample1 = sample1;
3629 Uint16 last_sample0 = sample0;
3630 while (dst >= target) {
3631 dst[7] = SDL_SwapLE16(sample7);
3632 dst[6] = SDL_SwapLE16(sample6);
3633 dst[5] = SDL_SwapLE16(sample5);
3634 dst[4] = SDL_SwapLE16(sample4);
3635 dst[3] = SDL_SwapLE16(sample3);
3636 dst[2] = SDL_SwapLE16(sample2);
3637 dst[1] = SDL_SwapLE16(sample1);
3638 dst[0] = SDL_SwapLE16(sample0);
3641 if ((eps << 1) >= dstsize) {
3643 sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1);
3644 sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1);
3645 sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
3646 sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
3647 sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
3648 sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
3649 sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
3650 sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
3651 last_sample7 = sample7;
3652 last_sample6 = sample6;
3653 last_sample5 = sample5;
3654 last_sample4 = sample4;
3655 last_sample3 = sample3;
3656 last_sample2 = sample2;
3657 last_sample1 = sample1;
3658 last_sample0 = sample0;
3662 cvt->len_cvt = dstsize;
3663 if (cvt->filters[++cvt->filter_index]) {
3664 cvt->filters[cvt->filter_index] (cvt, format);
3669 SDL_Downsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3672 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr);
3675 const int srcsize = cvt->len_cvt - 256;
3676 const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
3677 register int eps = 0;
3678 Uint16 *dst = (Uint16 *) cvt->buf;
3679 const Uint16 *src = (Uint16 *) cvt->buf;
3680 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
3681 Uint16 sample0 = SDL_SwapLE16(src[0]);
3682 Uint16 sample1 = SDL_SwapLE16(src[1]);
3683 Uint16 sample2 = SDL_SwapLE16(src[2]);
3684 Uint16 sample3 = SDL_SwapLE16(src[3]);
3685 Uint16 sample4 = SDL_SwapLE16(src[4]);
3686 Uint16 sample5 = SDL_SwapLE16(src[5]);
3687 Uint16 sample6 = SDL_SwapLE16(src[6]);
3688 Uint16 sample7 = SDL_SwapLE16(src[7]);
3689 Uint16 last_sample0 = sample0;
3690 Uint16 last_sample1 = sample1;
3691 Uint16 last_sample2 = sample2;
3692 Uint16 last_sample3 = sample3;
3693 Uint16 last_sample4 = sample4;
3694 Uint16 last_sample5 = sample5;
3695 Uint16 last_sample6 = sample6;
3696 Uint16 last_sample7 = sample7;
3697 while (dst < target) {
3700 if ((eps << 1) >= srcsize) {
3701 dst[0] = SDL_SwapLE16(sample0);
3702 dst[1] = SDL_SwapLE16(sample1);
3703 dst[2] = SDL_SwapLE16(sample2);
3704 dst[3] = SDL_SwapLE16(sample3);
3705 dst[4] = SDL_SwapLE16(sample4);
3706 dst[5] = SDL_SwapLE16(sample5);
3707 dst[6] = SDL_SwapLE16(sample6);
3708 dst[7] = SDL_SwapLE16(sample7);
3710 sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
3711 sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
3712 sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
3713 sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
3714 sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
3715 sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
3716 sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1);
3717 sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1);
3718 last_sample0 = sample0;
3719 last_sample1 = sample1;
3720 last_sample2 = sample2;
3721 last_sample3 = sample3;
3722 last_sample4 = sample4;
3723 last_sample5 = sample5;
3724 last_sample6 = sample6;
3725 last_sample7 = sample7;
3729 cvt->len_cvt = dstsize;
3730 if (cvt->filters[++cvt->filter_index]) {
3731 cvt->filters[cvt->filter_index] (cvt, format);
3736 SDL_Upsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3739 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr);
3742 const int srcsize = cvt->len_cvt - 32;
3743 const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
3744 register int eps = 0;
3745 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
3746 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
3747 const Sint16 *target = ((const Sint16 *) cvt->buf);
3748 Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
3749 Sint16 last_sample0 = sample0;
3750 while (dst >= target) {
3751 dst[0] = ((Sint16) SDL_SwapLE16(sample0));
3754 if ((eps << 1) >= dstsize) {
3756 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
3757 last_sample0 = sample0;
3761 cvt->len_cvt = dstsize;
3762 if (cvt->filters[++cvt->filter_index]) {
3763 cvt->filters[cvt->filter_index] (cvt, format);
3768 SDL_Downsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3771 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr);
3774 const int srcsize = cvt->len_cvt - 32;
3775 const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
3776 register int eps = 0;
3777 Sint16 *dst = (Sint16 *) cvt->buf;
3778 const Sint16 *src = (Sint16 *) cvt->buf;
3779 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
3780 Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
3781 Sint16 last_sample0 = sample0;
3782 while (dst < target) {
3785 if ((eps << 1) >= srcsize) {
3786 dst[0] = ((Sint16) SDL_SwapLE16(sample0));
3788 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
3789 last_sample0 = sample0;
3793 cvt->len_cvt = dstsize;
3794 if (cvt->filters[++cvt->filter_index]) {
3795 cvt->filters[cvt->filter_index] (cvt, format);
3800 SDL_Upsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3803 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr);
3806 const int srcsize = cvt->len_cvt - 64;
3807 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
3808 register int eps = 0;
3809 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
3810 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
3811 const Sint16 *target = ((const Sint16 *) cvt->buf);
3812 Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
3813 Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
3814 Sint16 last_sample1 = sample1;
3815 Sint16 last_sample0 = sample0;
3816 while (dst >= target) {
3817 dst[1] = ((Sint16) SDL_SwapLE16(sample1));
3818 dst[0] = ((Sint16) SDL_SwapLE16(sample0));
3821 if ((eps << 1) >= dstsize) {
3823 sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
3824 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
3825 last_sample1 = sample1;
3826 last_sample0 = sample0;
3830 cvt->len_cvt = dstsize;
3831 if (cvt->filters[++cvt->filter_index]) {
3832 cvt->filters[cvt->filter_index] (cvt, format);
3837 SDL_Downsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3840 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr);
3843 const int srcsize = cvt->len_cvt - 64;
3844 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
3845 register int eps = 0;
3846 Sint16 *dst = (Sint16 *) cvt->buf;
3847 const Sint16 *src = (Sint16 *) cvt->buf;
3848 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
3849 Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
3850 Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
3851 Sint16 last_sample0 = sample0;
3852 Sint16 last_sample1 = sample1;
3853 while (dst < target) {
3856 if ((eps << 1) >= srcsize) {
3857 dst[0] = ((Sint16) SDL_SwapLE16(sample0));
3858 dst[1] = ((Sint16) SDL_SwapLE16(sample1));
3860 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
3861 sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
3862 last_sample0 = sample0;
3863 last_sample1 = sample1;
3867 cvt->len_cvt = dstsize;
3868 if (cvt->filters[++cvt->filter_index]) {
3869 cvt->filters[cvt->filter_index] (cvt, format);
3874 SDL_Upsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3877 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr);
3880 const int srcsize = cvt->len_cvt - 128;
3881 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
3882 register int eps = 0;
3883 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
3884 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
3885 const Sint16 *target = ((const Sint16 *) cvt->buf);
3886 Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
3887 Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
3888 Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
3889 Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
3890 Sint16 last_sample3 = sample3;
3891 Sint16 last_sample2 = sample2;
3892 Sint16 last_sample1 = sample1;
3893 Sint16 last_sample0 = sample0;
3894 while (dst >= target) {
3895 dst[3] = ((Sint16) SDL_SwapLE16(sample3));
3896 dst[2] = ((Sint16) SDL_SwapLE16(sample2));
3897 dst[1] = ((Sint16) SDL_SwapLE16(sample1));
3898 dst[0] = ((Sint16) SDL_SwapLE16(sample0));
3901 if ((eps << 1) >= dstsize) {
3903 sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
3904 sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
3905 sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
3906 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
3907 last_sample3 = sample3;
3908 last_sample2 = sample2;
3909 last_sample1 = sample1;
3910 last_sample0 = sample0;
3914 cvt->len_cvt = dstsize;
3915 if (cvt->filters[++cvt->filter_index]) {
3916 cvt->filters[cvt->filter_index] (cvt, format);
3921 SDL_Downsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3924 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr);
3927 const int srcsize = cvt->len_cvt - 128;
3928 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
3929 register int eps = 0;
3930 Sint16 *dst = (Sint16 *) cvt->buf;
3931 const Sint16 *src = (Sint16 *) cvt->buf;
3932 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
3933 Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
3934 Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
3935 Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
3936 Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
3937 Sint16 last_sample0 = sample0;
3938 Sint16 last_sample1 = sample1;
3939 Sint16 last_sample2 = sample2;
3940 Sint16 last_sample3 = sample3;
3941 while (dst < target) {
3944 if ((eps << 1) >= srcsize) {
3945 dst[0] = ((Sint16) SDL_SwapLE16(sample0));
3946 dst[1] = ((Sint16) SDL_SwapLE16(sample1));
3947 dst[2] = ((Sint16) SDL_SwapLE16(sample2));
3948 dst[3] = ((Sint16) SDL_SwapLE16(sample3));
3950 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
3951 sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
3952 sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
3953 sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
3954 last_sample0 = sample0;
3955 last_sample1 = sample1;
3956 last_sample2 = sample2;
3957 last_sample3 = sample3;
3961 cvt->len_cvt = dstsize;
3962 if (cvt->filters[++cvt->filter_index]) {
3963 cvt->filters[cvt->filter_index] (cvt, format);
3968 SDL_Upsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
3971 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr);
3974 const int srcsize = cvt->len_cvt - 192;
3975 const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
3976 register int eps = 0;
3977 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
3978 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
3979 const Sint16 *target = ((const Sint16 *) cvt->buf);
3980 Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
3981 Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
3982 Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
3983 Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
3984 Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
3985 Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
3986 Sint16 last_sample5 = sample5;
3987 Sint16 last_sample4 = sample4;
3988 Sint16 last_sample3 = sample3;
3989 Sint16 last_sample2 = sample2;
3990 Sint16 last_sample1 = sample1;
3991 Sint16 last_sample0 = sample0;
3992 while (dst >= target) {
3993 dst[5] = ((Sint16) SDL_SwapLE16(sample5));
3994 dst[4] = ((Sint16) SDL_SwapLE16(sample4));
3995 dst[3] = ((Sint16) SDL_SwapLE16(sample3));
3996 dst[2] = ((Sint16) SDL_SwapLE16(sample2));
3997 dst[1] = ((Sint16) SDL_SwapLE16(sample1));
3998 dst[0] = ((Sint16) SDL_SwapLE16(sample0));
4001 if ((eps << 1) >= dstsize) {
4003 sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
4004 sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
4005 sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
4006 sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
4007 sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
4008 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
4009 last_sample5 = sample5;
4010 last_sample4 = sample4;
4011 last_sample3 = sample3;
4012 last_sample2 = sample2;
4013 last_sample1 = sample1;
4014 last_sample0 = sample0;
4018 cvt->len_cvt = dstsize;
4019 if (cvt->filters[++cvt->filter_index]) {
4020 cvt->filters[cvt->filter_index] (cvt, format);
4025 SDL_Downsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4028 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr);
4031 const int srcsize = cvt->len_cvt - 192;
4032 const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
4033 register int eps = 0;
4034 Sint16 *dst = (Sint16 *) cvt->buf;
4035 const Sint16 *src = (Sint16 *) cvt->buf;
4036 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
4037 Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
4038 Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
4039 Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
4040 Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
4041 Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
4042 Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
4043 Sint16 last_sample0 = sample0;
4044 Sint16 last_sample1 = sample1;
4045 Sint16 last_sample2 = sample2;
4046 Sint16 last_sample3 = sample3;
4047 Sint16 last_sample4 = sample4;
4048 Sint16 last_sample5 = sample5;
4049 while (dst < target) {
4052 if ((eps << 1) >= srcsize) {
4053 dst[0] = ((Sint16) SDL_SwapLE16(sample0));
4054 dst[1] = ((Sint16) SDL_SwapLE16(sample1));
4055 dst[2] = ((Sint16) SDL_SwapLE16(sample2));
4056 dst[3] = ((Sint16) SDL_SwapLE16(sample3));
4057 dst[4] = ((Sint16) SDL_SwapLE16(sample4));
4058 dst[5] = ((Sint16) SDL_SwapLE16(sample5));
4060 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
4061 sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
4062 sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
4063 sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
4064 sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
4065 sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
4066 last_sample0 = sample0;
4067 last_sample1 = sample1;
4068 last_sample2 = sample2;
4069 last_sample3 = sample3;
4070 last_sample4 = sample4;
4071 last_sample5 = sample5;
4075 cvt->len_cvt = dstsize;
4076 if (cvt->filters[++cvt->filter_index]) {
4077 cvt->filters[cvt->filter_index] (cvt, format);
4082 SDL_Upsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4085 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr);
4088 const int srcsize = cvt->len_cvt - 256;
4089 const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
4090 register int eps = 0;
4091 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
4092 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
4093 const Sint16 *target = ((const Sint16 *) cvt->buf);
4094 Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7]));
4095 Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6]));
4096 Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
4097 Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
4098 Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
4099 Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
4100 Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
4101 Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
4102 Sint16 last_sample7 = sample7;
4103 Sint16 last_sample6 = sample6;
4104 Sint16 last_sample5 = sample5;
4105 Sint16 last_sample4 = sample4;
4106 Sint16 last_sample3 = sample3;
4107 Sint16 last_sample2 = sample2;
4108 Sint16 last_sample1 = sample1;
4109 Sint16 last_sample0 = sample0;
4110 while (dst >= target) {
4111 dst[7] = ((Sint16) SDL_SwapLE16(sample7));
4112 dst[6] = ((Sint16) SDL_SwapLE16(sample6));
4113 dst[5] = ((Sint16) SDL_SwapLE16(sample5));
4114 dst[4] = ((Sint16) SDL_SwapLE16(sample4));
4115 dst[3] = ((Sint16) SDL_SwapLE16(sample3));
4116 dst[2] = ((Sint16) SDL_SwapLE16(sample2));
4117 dst[1] = ((Sint16) SDL_SwapLE16(sample1));
4118 dst[0] = ((Sint16) SDL_SwapLE16(sample0));
4121 if ((eps << 1) >= dstsize) {
4123 sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
4124 sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
4125 sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
4126 sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
4127 sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
4128 sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
4129 sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
4130 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
4131 last_sample7 = sample7;
4132 last_sample6 = sample6;
4133 last_sample5 = sample5;
4134 last_sample4 = sample4;
4135 last_sample3 = sample3;
4136 last_sample2 = sample2;
4137 last_sample1 = sample1;
4138 last_sample0 = sample0;
4142 cvt->len_cvt = dstsize;
4143 if (cvt->filters[++cvt->filter_index]) {
4144 cvt->filters[cvt->filter_index] (cvt, format);
4149 SDL_Downsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4152 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr);
4155 const int srcsize = cvt->len_cvt - 256;
4156 const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
4157 register int eps = 0;
4158 Sint16 *dst = (Sint16 *) cvt->buf;
4159 const Sint16 *src = (Sint16 *) cvt->buf;
4160 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
4161 Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
4162 Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
4163 Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
4164 Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
4165 Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
4166 Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
4167 Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6]));
4168 Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7]));
4169 Sint16 last_sample0 = sample0;
4170 Sint16 last_sample1 = sample1;
4171 Sint16 last_sample2 = sample2;
4172 Sint16 last_sample3 = sample3;
4173 Sint16 last_sample4 = sample4;
4174 Sint16 last_sample5 = sample5;
4175 Sint16 last_sample6 = sample6;
4176 Sint16 last_sample7 = sample7;
4177 while (dst < target) {
4180 if ((eps << 1) >= srcsize) {
4181 dst[0] = ((Sint16) SDL_SwapLE16(sample0));
4182 dst[1] = ((Sint16) SDL_SwapLE16(sample1));
4183 dst[2] = ((Sint16) SDL_SwapLE16(sample2));
4184 dst[3] = ((Sint16) SDL_SwapLE16(sample3));
4185 dst[4] = ((Sint16) SDL_SwapLE16(sample4));
4186 dst[5] = ((Sint16) SDL_SwapLE16(sample5));
4187 dst[6] = ((Sint16) SDL_SwapLE16(sample6));
4188 dst[7] = ((Sint16) SDL_SwapLE16(sample7));
4190 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
4191 sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
4192 sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
4193 sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
4194 sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
4195 sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
4196 sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
4197 sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
4198 last_sample0 = sample0;
4199 last_sample1 = sample1;
4200 last_sample2 = sample2;
4201 last_sample3 = sample3;
4202 last_sample4 = sample4;
4203 last_sample5 = sample5;
4204 last_sample6 = sample6;
4205 last_sample7 = sample7;
4209 cvt->len_cvt = dstsize;
4210 if (cvt->filters[++cvt->filter_index]) {
4211 cvt->filters[cvt->filter_index] (cvt, format);
4216 SDL_Upsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4219 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr);
4222 const int srcsize = cvt->len_cvt - 32;
4223 const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
4224 register int eps = 0;
4225 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
4226 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
4227 const Uint16 *target = ((const Uint16 *) cvt->buf);
4228 Uint16 sample0 = SDL_SwapBE16(src[0]);
4229 Uint16 last_sample0 = sample0;
4230 while (dst >= target) {
4231 dst[0] = SDL_SwapBE16(sample0);
4234 if ((eps << 1) >= dstsize) {
4236 sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
4237 last_sample0 = sample0;
4241 cvt->len_cvt = dstsize;
4242 if (cvt->filters[++cvt->filter_index]) {
4243 cvt->filters[cvt->filter_index] (cvt, format);
4248 SDL_Downsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4251 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr);
4254 const int srcsize = cvt->len_cvt - 32;
4255 const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
4256 register int eps = 0;
4257 Uint16 *dst = (Uint16 *) cvt->buf;
4258 const Uint16 *src = (Uint16 *) cvt->buf;
4259 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
4260 Uint16 sample0 = SDL_SwapBE16(src[0]);
4261 Uint16 last_sample0 = sample0;
4262 while (dst < target) {
4265 if ((eps << 1) >= srcsize) {
4266 dst[0] = SDL_SwapBE16(sample0);
4268 sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
4269 last_sample0 = sample0;
4273 cvt->len_cvt = dstsize;
4274 if (cvt->filters[++cvt->filter_index]) {
4275 cvt->filters[cvt->filter_index] (cvt, format);
4280 SDL_Upsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4283 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr);
4286 const int srcsize = cvt->len_cvt - 64;
4287 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
4288 register int eps = 0;
4289 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
4290 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
4291 const Uint16 *target = ((const Uint16 *) cvt->buf);
4292 Uint16 sample1 = SDL_SwapBE16(src[1]);
4293 Uint16 sample0 = SDL_SwapBE16(src[0]);
4294 Uint16 last_sample1 = sample1;
4295 Uint16 last_sample0 = sample0;
4296 while (dst >= target) {
4297 dst[1] = SDL_SwapBE16(sample1);
4298 dst[0] = SDL_SwapBE16(sample0);
4301 if ((eps << 1) >= dstsize) {
4303 sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
4304 sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
4305 last_sample1 = sample1;
4306 last_sample0 = sample0;
4310 cvt->len_cvt = dstsize;
4311 if (cvt->filters[++cvt->filter_index]) {
4312 cvt->filters[cvt->filter_index] (cvt, format);
4317 SDL_Downsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4320 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr);
4323 const int srcsize = cvt->len_cvt - 64;
4324 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
4325 register int eps = 0;
4326 Uint16 *dst = (Uint16 *) cvt->buf;
4327 const Uint16 *src = (Uint16 *) cvt->buf;
4328 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
4329 Uint16 sample0 = SDL_SwapBE16(src[0]);
4330 Uint16 sample1 = SDL_SwapBE16(src[1]);
4331 Uint16 last_sample0 = sample0;
4332 Uint16 last_sample1 = sample1;
4333 while (dst < target) {
4336 if ((eps << 1) >= srcsize) {
4337 dst[0] = SDL_SwapBE16(sample0);
4338 dst[1] = SDL_SwapBE16(sample1);
4340 sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
4341 sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
4342 last_sample0 = sample0;
4343 last_sample1 = sample1;
4347 cvt->len_cvt = dstsize;
4348 if (cvt->filters[++cvt->filter_index]) {
4349 cvt->filters[cvt->filter_index] (cvt, format);
4354 SDL_Upsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4357 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr);
4360 const int srcsize = cvt->len_cvt - 128;
4361 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
4362 register int eps = 0;
4363 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
4364 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
4365 const Uint16 *target = ((const Uint16 *) cvt->buf);
4366 Uint16 sample3 = SDL_SwapBE16(src[3]);
4367 Uint16 sample2 = SDL_SwapBE16(src[2]);
4368 Uint16 sample1 = SDL_SwapBE16(src[1]);
4369 Uint16 sample0 = SDL_SwapBE16(src[0]);
4370 Uint16 last_sample3 = sample3;
4371 Uint16 last_sample2 = sample2;
4372 Uint16 last_sample1 = sample1;
4373 Uint16 last_sample0 = sample0;
4374 while (dst >= target) {
4375 dst[3] = SDL_SwapBE16(sample3);
4376 dst[2] = SDL_SwapBE16(sample2);
4377 dst[1] = SDL_SwapBE16(sample1);
4378 dst[0] = SDL_SwapBE16(sample0);
4381 if ((eps << 1) >= dstsize) {
4383 sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
4384 sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
4385 sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
4386 sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
4387 last_sample3 = sample3;
4388 last_sample2 = sample2;
4389 last_sample1 = sample1;
4390 last_sample0 = sample0;
4394 cvt->len_cvt = dstsize;
4395 if (cvt->filters[++cvt->filter_index]) {
4396 cvt->filters[cvt->filter_index] (cvt, format);
4401 SDL_Downsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4404 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr);
4407 const int srcsize = cvt->len_cvt - 128;
4408 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
4409 register int eps = 0;
4410 Uint16 *dst = (Uint16 *) cvt->buf;
4411 const Uint16 *src = (Uint16 *) cvt->buf;
4412 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
4413 Uint16 sample0 = SDL_SwapBE16(src[0]);
4414 Uint16 sample1 = SDL_SwapBE16(src[1]);
4415 Uint16 sample2 = SDL_SwapBE16(src[2]);
4416 Uint16 sample3 = SDL_SwapBE16(src[3]);
4417 Uint16 last_sample0 = sample0;
4418 Uint16 last_sample1 = sample1;
4419 Uint16 last_sample2 = sample2;
4420 Uint16 last_sample3 = sample3;
4421 while (dst < target) {
4424 if ((eps << 1) >= srcsize) {
4425 dst[0] = SDL_SwapBE16(sample0);
4426 dst[1] = SDL_SwapBE16(sample1);
4427 dst[2] = SDL_SwapBE16(sample2);
4428 dst[3] = SDL_SwapBE16(sample3);
4430 sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
4431 sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
4432 sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
4433 sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
4434 last_sample0 = sample0;
4435 last_sample1 = sample1;
4436 last_sample2 = sample2;
4437 last_sample3 = sample3;
4441 cvt->len_cvt = dstsize;
4442 if (cvt->filters[++cvt->filter_index]) {
4443 cvt->filters[cvt->filter_index] (cvt, format);
4448 SDL_Upsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4451 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr);
4454 const int srcsize = cvt->len_cvt - 192;
4455 const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
4456 register int eps = 0;
4457 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
4458 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
4459 const Uint16 *target = ((const Uint16 *) cvt->buf);
4460 Uint16 sample5 = SDL_SwapBE16(src[5]);
4461 Uint16 sample4 = SDL_SwapBE16(src[4]);
4462 Uint16 sample3 = SDL_SwapBE16(src[3]);
4463 Uint16 sample2 = SDL_SwapBE16(src[2]);
4464 Uint16 sample1 = SDL_SwapBE16(src[1]);
4465 Uint16 sample0 = SDL_SwapBE16(src[0]);
4466 Uint16 last_sample5 = sample5;
4467 Uint16 last_sample4 = sample4;
4468 Uint16 last_sample3 = sample3;
4469 Uint16 last_sample2 = sample2;
4470 Uint16 last_sample1 = sample1;
4471 Uint16 last_sample0 = sample0;
4472 while (dst >= target) {
4473 dst[5] = SDL_SwapBE16(sample5);
4474 dst[4] = SDL_SwapBE16(sample4);
4475 dst[3] = SDL_SwapBE16(sample3);
4476 dst[2] = SDL_SwapBE16(sample2);
4477 dst[1] = SDL_SwapBE16(sample1);
4478 dst[0] = SDL_SwapBE16(sample0);
4481 if ((eps << 1) >= dstsize) {
4483 sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
4484 sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
4485 sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
4486 sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
4487 sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
4488 sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
4489 last_sample5 = sample5;
4490 last_sample4 = sample4;
4491 last_sample3 = sample3;
4492 last_sample2 = sample2;
4493 last_sample1 = sample1;
4494 last_sample0 = sample0;
4498 cvt->len_cvt = dstsize;
4499 if (cvt->filters[++cvt->filter_index]) {
4500 cvt->filters[cvt->filter_index] (cvt, format);
4505 SDL_Downsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4508 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr);
4511 const int srcsize = cvt->len_cvt - 192;
4512 const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
4513 register int eps = 0;
4514 Uint16 *dst = (Uint16 *) cvt->buf;
4515 const Uint16 *src = (Uint16 *) cvt->buf;
4516 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
4517 Uint16 sample0 = SDL_SwapBE16(src[0]);
4518 Uint16 sample1 = SDL_SwapBE16(src[1]);
4519 Uint16 sample2 = SDL_SwapBE16(src[2]);
4520 Uint16 sample3 = SDL_SwapBE16(src[3]);
4521 Uint16 sample4 = SDL_SwapBE16(src[4]);
4522 Uint16 sample5 = SDL_SwapBE16(src[5]);
4523 Uint16 last_sample0 = sample0;
4524 Uint16 last_sample1 = sample1;
4525 Uint16 last_sample2 = sample2;
4526 Uint16 last_sample3 = sample3;
4527 Uint16 last_sample4 = sample4;
4528 Uint16 last_sample5 = sample5;
4529 while (dst < target) {
4532 if ((eps << 1) >= srcsize) {
4533 dst[0] = SDL_SwapBE16(sample0);
4534 dst[1] = SDL_SwapBE16(sample1);
4535 dst[2] = SDL_SwapBE16(sample2);
4536 dst[3] = SDL_SwapBE16(sample3);
4537 dst[4] = SDL_SwapBE16(sample4);
4538 dst[5] = SDL_SwapBE16(sample5);
4540 sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
4541 sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
4542 sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
4543 sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
4544 sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
4545 sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
4546 last_sample0 = sample0;
4547 last_sample1 = sample1;
4548 last_sample2 = sample2;
4549 last_sample3 = sample3;
4550 last_sample4 = sample4;
4551 last_sample5 = sample5;
4555 cvt->len_cvt = dstsize;
4556 if (cvt->filters[++cvt->filter_index]) {
4557 cvt->filters[cvt->filter_index] (cvt, format);
4562 SDL_Upsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4565 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr);
4568 const int srcsize = cvt->len_cvt - 256;
4569 const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
4570 register int eps = 0;
4571 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
4572 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
4573 const Uint16 *target = ((const Uint16 *) cvt->buf);
4574 Uint16 sample7 = SDL_SwapBE16(src[7]);
4575 Uint16 sample6 = SDL_SwapBE16(src[6]);
4576 Uint16 sample5 = SDL_SwapBE16(src[5]);
4577 Uint16 sample4 = SDL_SwapBE16(src[4]);
4578 Uint16 sample3 = SDL_SwapBE16(src[3]);
4579 Uint16 sample2 = SDL_SwapBE16(src[2]);
4580 Uint16 sample1 = SDL_SwapBE16(src[1]);
4581 Uint16 sample0 = SDL_SwapBE16(src[0]);
4582 Uint16 last_sample7 = sample7;
4583 Uint16 last_sample6 = sample6;
4584 Uint16 last_sample5 = sample5;
4585 Uint16 last_sample4 = sample4;
4586 Uint16 last_sample3 = sample3;
4587 Uint16 last_sample2 = sample2;
4588 Uint16 last_sample1 = sample1;
4589 Uint16 last_sample0 = sample0;
4590 while (dst >= target) {
4591 dst[7] = SDL_SwapBE16(sample7);
4592 dst[6] = SDL_SwapBE16(sample6);
4593 dst[5] = SDL_SwapBE16(sample5);
4594 dst[4] = SDL_SwapBE16(sample4);
4595 dst[3] = SDL_SwapBE16(sample3);
4596 dst[2] = SDL_SwapBE16(sample2);
4597 dst[1] = SDL_SwapBE16(sample1);
4598 dst[0] = SDL_SwapBE16(sample0);
4601 if ((eps << 1) >= dstsize) {
4603 sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1);
4604 sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1);
4605 sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
4606 sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
4607 sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
4608 sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
4609 sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
4610 sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
4611 last_sample7 = sample7;
4612 last_sample6 = sample6;
4613 last_sample5 = sample5;
4614 last_sample4 = sample4;
4615 last_sample3 = sample3;
4616 last_sample2 = sample2;
4617 last_sample1 = sample1;
4618 last_sample0 = sample0;
4622 cvt->len_cvt = dstsize;
4623 if (cvt->filters[++cvt->filter_index]) {
4624 cvt->filters[cvt->filter_index] (cvt, format);
4629 SDL_Downsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4632 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr);
4635 const int srcsize = cvt->len_cvt - 256;
4636 const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
4637 register int eps = 0;
4638 Uint16 *dst = (Uint16 *) cvt->buf;
4639 const Uint16 *src = (Uint16 *) cvt->buf;
4640 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
4641 Uint16 sample0 = SDL_SwapBE16(src[0]);
4642 Uint16 sample1 = SDL_SwapBE16(src[1]);
4643 Uint16 sample2 = SDL_SwapBE16(src[2]);
4644 Uint16 sample3 = SDL_SwapBE16(src[3]);
4645 Uint16 sample4 = SDL_SwapBE16(src[4]);
4646 Uint16 sample5 = SDL_SwapBE16(src[5]);
4647 Uint16 sample6 = SDL_SwapBE16(src[6]);
4648 Uint16 sample7 = SDL_SwapBE16(src[7]);
4649 Uint16 last_sample0 = sample0;
4650 Uint16 last_sample1 = sample1;
4651 Uint16 last_sample2 = sample2;
4652 Uint16 last_sample3 = sample3;
4653 Uint16 last_sample4 = sample4;
4654 Uint16 last_sample5 = sample5;
4655 Uint16 last_sample6 = sample6;
4656 Uint16 last_sample7 = sample7;
4657 while (dst < target) {
4660 if ((eps << 1) >= srcsize) {
4661 dst[0] = SDL_SwapBE16(sample0);
4662 dst[1] = SDL_SwapBE16(sample1);
4663 dst[2] = SDL_SwapBE16(sample2);
4664 dst[3] = SDL_SwapBE16(sample3);
4665 dst[4] = SDL_SwapBE16(sample4);
4666 dst[5] = SDL_SwapBE16(sample5);
4667 dst[6] = SDL_SwapBE16(sample6);
4668 dst[7] = SDL_SwapBE16(sample7);
4670 sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
4671 sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
4672 sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
4673 sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
4674 sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
4675 sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
4676 sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1);
4677 sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1);
4678 last_sample0 = sample0;
4679 last_sample1 = sample1;
4680 last_sample2 = sample2;
4681 last_sample3 = sample3;
4682 last_sample4 = sample4;
4683 last_sample5 = sample5;
4684 last_sample6 = sample6;
4685 last_sample7 = sample7;
4689 cvt->len_cvt = dstsize;
4690 if (cvt->filters[++cvt->filter_index]) {
4691 cvt->filters[cvt->filter_index] (cvt, format);
4696 SDL_Upsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4699 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr);
4702 const int srcsize = cvt->len_cvt - 32;
4703 const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
4704 register int eps = 0;
4705 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
4706 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
4707 const Sint16 *target = ((const Sint16 *) cvt->buf);
4708 Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
4709 Sint16 last_sample0 = sample0;
4710 while (dst >= target) {
4711 dst[0] = ((Sint16) SDL_SwapBE16(sample0));
4714 if ((eps << 1) >= dstsize) {
4716 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
4717 last_sample0 = sample0;
4721 cvt->len_cvt = dstsize;
4722 if (cvt->filters[++cvt->filter_index]) {
4723 cvt->filters[cvt->filter_index] (cvt, format);
4728 SDL_Downsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4731 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr);
4734 const int srcsize = cvt->len_cvt - 32;
4735 const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
4736 register int eps = 0;
4737 Sint16 *dst = (Sint16 *) cvt->buf;
4738 const Sint16 *src = (Sint16 *) cvt->buf;
4739 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
4740 Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
4741 Sint16 last_sample0 = sample0;
4742 while (dst < target) {
4745 if ((eps << 1) >= srcsize) {
4746 dst[0] = ((Sint16) SDL_SwapBE16(sample0));
4748 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
4749 last_sample0 = sample0;
4753 cvt->len_cvt = dstsize;
4754 if (cvt->filters[++cvt->filter_index]) {
4755 cvt->filters[cvt->filter_index] (cvt, format);
4760 SDL_Upsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4763 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr);
4766 const int srcsize = cvt->len_cvt - 64;
4767 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
4768 register int eps = 0;
4769 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
4770 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
4771 const Sint16 *target = ((const Sint16 *) cvt->buf);
4772 Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
4773 Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
4774 Sint16 last_sample1 = sample1;
4775 Sint16 last_sample0 = sample0;
4776 while (dst >= target) {
4777 dst[1] = ((Sint16) SDL_SwapBE16(sample1));
4778 dst[0] = ((Sint16) SDL_SwapBE16(sample0));
4781 if ((eps << 1) >= dstsize) {
4783 sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
4784 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
4785 last_sample1 = sample1;
4786 last_sample0 = sample0;
4790 cvt->len_cvt = dstsize;
4791 if (cvt->filters[++cvt->filter_index]) {
4792 cvt->filters[cvt->filter_index] (cvt, format);
4797 SDL_Downsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4800 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr);
4803 const int srcsize = cvt->len_cvt - 64;
4804 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
4805 register int eps = 0;
4806 Sint16 *dst = (Sint16 *) cvt->buf;
4807 const Sint16 *src = (Sint16 *) cvt->buf;
4808 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
4809 Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
4810 Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
4811 Sint16 last_sample0 = sample0;
4812 Sint16 last_sample1 = sample1;
4813 while (dst < target) {
4816 if ((eps << 1) >= srcsize) {
4817 dst[0] = ((Sint16) SDL_SwapBE16(sample0));
4818 dst[1] = ((Sint16) SDL_SwapBE16(sample1));
4820 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
4821 sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
4822 last_sample0 = sample0;
4823 last_sample1 = sample1;
4827 cvt->len_cvt = dstsize;
4828 if (cvt->filters[++cvt->filter_index]) {
4829 cvt->filters[cvt->filter_index] (cvt, format);
4834 SDL_Upsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4837 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr);
4840 const int srcsize = cvt->len_cvt - 128;
4841 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
4842 register int eps = 0;
4843 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
4844 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
4845 const Sint16 *target = ((const Sint16 *) cvt->buf);
4846 Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
4847 Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
4848 Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
4849 Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
4850 Sint16 last_sample3 = sample3;
4851 Sint16 last_sample2 = sample2;
4852 Sint16 last_sample1 = sample1;
4853 Sint16 last_sample0 = sample0;
4854 while (dst >= target) {
4855 dst[3] = ((Sint16) SDL_SwapBE16(sample3));
4856 dst[2] = ((Sint16) SDL_SwapBE16(sample2));
4857 dst[1] = ((Sint16) SDL_SwapBE16(sample1));
4858 dst[0] = ((Sint16) SDL_SwapBE16(sample0));
4861 if ((eps << 1) >= dstsize) {
4863 sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
4864 sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
4865 sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
4866 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
4867 last_sample3 = sample3;
4868 last_sample2 = sample2;
4869 last_sample1 = sample1;
4870 last_sample0 = sample0;
4874 cvt->len_cvt = dstsize;
4875 if (cvt->filters[++cvt->filter_index]) {
4876 cvt->filters[cvt->filter_index] (cvt, format);
4881 SDL_Downsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4884 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr);
4887 const int srcsize = cvt->len_cvt - 128;
4888 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
4889 register int eps = 0;
4890 Sint16 *dst = (Sint16 *) cvt->buf;
4891 const Sint16 *src = (Sint16 *) cvt->buf;
4892 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
4893 Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
4894 Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
4895 Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
4896 Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
4897 Sint16 last_sample0 = sample0;
4898 Sint16 last_sample1 = sample1;
4899 Sint16 last_sample2 = sample2;
4900 Sint16 last_sample3 = sample3;
4901 while (dst < target) {
4904 if ((eps << 1) >= srcsize) {
4905 dst[0] = ((Sint16) SDL_SwapBE16(sample0));
4906 dst[1] = ((Sint16) SDL_SwapBE16(sample1));
4907 dst[2] = ((Sint16) SDL_SwapBE16(sample2));
4908 dst[3] = ((Sint16) SDL_SwapBE16(sample3));
4910 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
4911 sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
4912 sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
4913 sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
4914 last_sample0 = sample0;
4915 last_sample1 = sample1;
4916 last_sample2 = sample2;
4917 last_sample3 = sample3;
4921 cvt->len_cvt = dstsize;
4922 if (cvt->filters[++cvt->filter_index]) {
4923 cvt->filters[cvt->filter_index] (cvt, format);
4928 SDL_Upsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4931 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr);
4934 const int srcsize = cvt->len_cvt - 192;
4935 const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
4936 register int eps = 0;
4937 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
4938 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
4939 const Sint16 *target = ((const Sint16 *) cvt->buf);
4940 Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
4941 Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
4942 Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
4943 Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
4944 Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
4945 Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
4946 Sint16 last_sample5 = sample5;
4947 Sint16 last_sample4 = sample4;
4948 Sint16 last_sample3 = sample3;
4949 Sint16 last_sample2 = sample2;
4950 Sint16 last_sample1 = sample1;
4951 Sint16 last_sample0 = sample0;
4952 while (dst >= target) {
4953 dst[5] = ((Sint16) SDL_SwapBE16(sample5));
4954 dst[4] = ((Sint16) SDL_SwapBE16(sample4));
4955 dst[3] = ((Sint16) SDL_SwapBE16(sample3));
4956 dst[2] = ((Sint16) SDL_SwapBE16(sample2));
4957 dst[1] = ((Sint16) SDL_SwapBE16(sample1));
4958 dst[0] = ((Sint16) SDL_SwapBE16(sample0));
4961 if ((eps << 1) >= dstsize) {
4963 sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
4964 sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
4965 sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
4966 sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
4967 sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
4968 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
4969 last_sample5 = sample5;
4970 last_sample4 = sample4;
4971 last_sample3 = sample3;
4972 last_sample2 = sample2;
4973 last_sample1 = sample1;
4974 last_sample0 = sample0;
4978 cvt->len_cvt = dstsize;
4979 if (cvt->filters[++cvt->filter_index]) {
4980 cvt->filters[cvt->filter_index] (cvt, format);
4985 SDL_Downsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
4988 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr);
4991 const int srcsize = cvt->len_cvt - 192;
4992 const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
4993 register int eps = 0;
4994 Sint16 *dst = (Sint16 *) cvt->buf;
4995 const Sint16 *src = (Sint16 *) cvt->buf;
4996 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
4997 Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
4998 Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
4999 Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
5000 Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
5001 Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
5002 Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
5003 Sint16 last_sample0 = sample0;
5004 Sint16 last_sample1 = sample1;
5005 Sint16 last_sample2 = sample2;
5006 Sint16 last_sample3 = sample3;
5007 Sint16 last_sample4 = sample4;
5008 Sint16 last_sample5 = sample5;
5009 while (dst < target) {
5012 if ((eps << 1) >= srcsize) {
5013 dst[0] = ((Sint16) SDL_SwapBE16(sample0));
5014 dst[1] = ((Sint16) SDL_SwapBE16(sample1));
5015 dst[2] = ((Sint16) SDL_SwapBE16(sample2));
5016 dst[3] = ((Sint16) SDL_SwapBE16(sample3));
5017 dst[4] = ((Sint16) SDL_SwapBE16(sample4));
5018 dst[5] = ((Sint16) SDL_SwapBE16(sample5));
5020 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
5021 sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
5022 sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
5023 sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
5024 sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
5025 sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
5026 last_sample0 = sample0;
5027 last_sample1 = sample1;
5028 last_sample2 = sample2;
5029 last_sample3 = sample3;
5030 last_sample4 = sample4;
5031 last_sample5 = sample5;
5035 cvt->len_cvt = dstsize;
5036 if (cvt->filters[++cvt->filter_index]) {
5037 cvt->filters[cvt->filter_index] (cvt, format);
5042 SDL_Upsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5045 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr);
5048 const int srcsize = cvt->len_cvt - 256;
5049 const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
5050 register int eps = 0;
5051 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
5052 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
5053 const Sint16 *target = ((const Sint16 *) cvt->buf);
5054 Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7]));
5055 Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6]));
5056 Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
5057 Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
5058 Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
5059 Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
5060 Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
5061 Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
5062 Sint16 last_sample7 = sample7;
5063 Sint16 last_sample6 = sample6;
5064 Sint16 last_sample5 = sample5;
5065 Sint16 last_sample4 = sample4;
5066 Sint16 last_sample3 = sample3;
5067 Sint16 last_sample2 = sample2;
5068 Sint16 last_sample1 = sample1;
5069 Sint16 last_sample0 = sample0;
5070 while (dst >= target) {
5071 dst[7] = ((Sint16) SDL_SwapBE16(sample7));
5072 dst[6] = ((Sint16) SDL_SwapBE16(sample6));
5073 dst[5] = ((Sint16) SDL_SwapBE16(sample5));
5074 dst[4] = ((Sint16) SDL_SwapBE16(sample4));
5075 dst[3] = ((Sint16) SDL_SwapBE16(sample3));
5076 dst[2] = ((Sint16) SDL_SwapBE16(sample2));
5077 dst[1] = ((Sint16) SDL_SwapBE16(sample1));
5078 dst[0] = ((Sint16) SDL_SwapBE16(sample0));
5081 if ((eps << 1) >= dstsize) {
5083 sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
5084 sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
5085 sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
5086 sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
5087 sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
5088 sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
5089 sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
5090 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
5091 last_sample7 = sample7;
5092 last_sample6 = sample6;
5093 last_sample5 = sample5;
5094 last_sample4 = sample4;
5095 last_sample3 = sample3;
5096 last_sample2 = sample2;
5097 last_sample1 = sample1;
5098 last_sample0 = sample0;
5102 cvt->len_cvt = dstsize;
5103 if (cvt->filters[++cvt->filter_index]) {
5104 cvt->filters[cvt->filter_index] (cvt, format);
5109 SDL_Downsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5112 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr);
5115 const int srcsize = cvt->len_cvt - 256;
5116 const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
5117 register int eps = 0;
5118 Sint16 *dst = (Sint16 *) cvt->buf;
5119 const Sint16 *src = (Sint16 *) cvt->buf;
5120 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
5121 Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
5122 Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
5123 Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
5124 Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
5125 Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
5126 Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
5127 Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6]));
5128 Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7]));
5129 Sint16 last_sample0 = sample0;
5130 Sint16 last_sample1 = sample1;
5131 Sint16 last_sample2 = sample2;
5132 Sint16 last_sample3 = sample3;
5133 Sint16 last_sample4 = sample4;
5134 Sint16 last_sample5 = sample5;
5135 Sint16 last_sample6 = sample6;
5136 Sint16 last_sample7 = sample7;
5137 while (dst < target) {
5140 if ((eps << 1) >= srcsize) {
5141 dst[0] = ((Sint16) SDL_SwapBE16(sample0));
5142 dst[1] = ((Sint16) SDL_SwapBE16(sample1));
5143 dst[2] = ((Sint16) SDL_SwapBE16(sample2));
5144 dst[3] = ((Sint16) SDL_SwapBE16(sample3));
5145 dst[4] = ((Sint16) SDL_SwapBE16(sample4));
5146 dst[5] = ((Sint16) SDL_SwapBE16(sample5));
5147 dst[6] = ((Sint16) SDL_SwapBE16(sample6));
5148 dst[7] = ((Sint16) SDL_SwapBE16(sample7));
5150 sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
5151 sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
5152 sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
5153 sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
5154 sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
5155 sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
5156 sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
5157 sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
5158 last_sample0 = sample0;
5159 last_sample1 = sample1;
5160 last_sample2 = sample2;
5161 last_sample3 = sample3;
5162 last_sample4 = sample4;
5163 last_sample5 = sample5;
5164 last_sample6 = sample6;
5165 last_sample7 = sample7;
5169 cvt->len_cvt = dstsize;
5170 if (cvt->filters[++cvt->filter_index]) {
5171 cvt->filters[cvt->filter_index] (cvt, format);
5176 SDL_Upsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5179 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr);
5182 const int srcsize = cvt->len_cvt - 64;
5183 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
5184 register int eps = 0;
5185 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
5186 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
5187 const Sint32 *target = ((const Sint32 *) cvt->buf);
5188 Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
5189 Sint32 last_sample0 = sample0;
5190 while (dst >= target) {
5191 dst[0] = ((Sint32) SDL_SwapLE32(sample0));
5194 if ((eps << 1) >= dstsize) {
5196 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5197 last_sample0 = sample0;
5201 cvt->len_cvt = dstsize;
5202 if (cvt->filters[++cvt->filter_index]) {
5203 cvt->filters[cvt->filter_index] (cvt, format);
5208 SDL_Downsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5211 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr);
5214 const int srcsize = cvt->len_cvt - 64;
5215 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
5216 register int eps = 0;
5217 Sint32 *dst = (Sint32 *) cvt->buf;
5218 const Sint32 *src = (Sint32 *) cvt->buf;
5219 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
5220 Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
5221 Sint32 last_sample0 = sample0;
5222 while (dst < target) {
5225 if ((eps << 1) >= srcsize) {
5226 dst[0] = ((Sint32) SDL_SwapLE32(sample0));
5228 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5229 last_sample0 = sample0;
5233 cvt->len_cvt = dstsize;
5234 if (cvt->filters[++cvt->filter_index]) {
5235 cvt->filters[cvt->filter_index] (cvt, format);
5240 SDL_Upsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5243 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr);
5246 const int srcsize = cvt->len_cvt - 128;
5247 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
5248 register int eps = 0;
5249 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
5250 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
5251 const Sint32 *target = ((const Sint32 *) cvt->buf);
5252 Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
5253 Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
5254 Sint32 last_sample1 = sample1;
5255 Sint32 last_sample0 = sample0;
5256 while (dst >= target) {
5257 dst[1] = ((Sint32) SDL_SwapLE32(sample1));
5258 dst[0] = ((Sint32) SDL_SwapLE32(sample0));
5261 if ((eps << 1) >= dstsize) {
5263 sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
5264 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5265 last_sample1 = sample1;
5266 last_sample0 = sample0;
5270 cvt->len_cvt = dstsize;
5271 if (cvt->filters[++cvt->filter_index]) {
5272 cvt->filters[cvt->filter_index] (cvt, format);
5277 SDL_Downsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5280 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr);
5283 const int srcsize = cvt->len_cvt - 128;
5284 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
5285 register int eps = 0;
5286 Sint32 *dst = (Sint32 *) cvt->buf;
5287 const Sint32 *src = (Sint32 *) cvt->buf;
5288 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
5289 Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
5290 Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
5291 Sint32 last_sample0 = sample0;
5292 Sint32 last_sample1 = sample1;
5293 while (dst < target) {
5296 if ((eps << 1) >= srcsize) {
5297 dst[0] = ((Sint32) SDL_SwapLE32(sample0));
5298 dst[1] = ((Sint32) SDL_SwapLE32(sample1));
5300 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5301 sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
5302 last_sample0 = sample0;
5303 last_sample1 = sample1;
5307 cvt->len_cvt = dstsize;
5308 if (cvt->filters[++cvt->filter_index]) {
5309 cvt->filters[cvt->filter_index] (cvt, format);
5314 SDL_Upsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5317 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr);
5320 const int srcsize = cvt->len_cvt - 256;
5321 const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
5322 register int eps = 0;
5323 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
5324 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
5325 const Sint32 *target = ((const Sint32 *) cvt->buf);
5326 Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
5327 Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
5328 Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
5329 Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
5330 Sint32 last_sample3 = sample3;
5331 Sint32 last_sample2 = sample2;
5332 Sint32 last_sample1 = sample1;
5333 Sint32 last_sample0 = sample0;
5334 while (dst >= target) {
5335 dst[3] = ((Sint32) SDL_SwapLE32(sample3));
5336 dst[2] = ((Sint32) SDL_SwapLE32(sample2));
5337 dst[1] = ((Sint32) SDL_SwapLE32(sample1));
5338 dst[0] = ((Sint32) SDL_SwapLE32(sample0));
5341 if ((eps << 1) >= dstsize) {
5343 sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
5344 sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
5345 sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
5346 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5347 last_sample3 = sample3;
5348 last_sample2 = sample2;
5349 last_sample1 = sample1;
5350 last_sample0 = sample0;
5354 cvt->len_cvt = dstsize;
5355 if (cvt->filters[++cvt->filter_index]) {
5356 cvt->filters[cvt->filter_index] (cvt, format);
5361 SDL_Downsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5364 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr);
5367 const int srcsize = cvt->len_cvt - 256;
5368 const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
5369 register int eps = 0;
5370 Sint32 *dst = (Sint32 *) cvt->buf;
5371 const Sint32 *src = (Sint32 *) cvt->buf;
5372 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
5373 Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
5374 Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
5375 Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
5376 Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
5377 Sint32 last_sample0 = sample0;
5378 Sint32 last_sample1 = sample1;
5379 Sint32 last_sample2 = sample2;
5380 Sint32 last_sample3 = sample3;
5381 while (dst < target) {
5384 if ((eps << 1) >= srcsize) {
5385 dst[0] = ((Sint32) SDL_SwapLE32(sample0));
5386 dst[1] = ((Sint32) SDL_SwapLE32(sample1));
5387 dst[2] = ((Sint32) SDL_SwapLE32(sample2));
5388 dst[3] = ((Sint32) SDL_SwapLE32(sample3));
5390 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5391 sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
5392 sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
5393 sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
5394 last_sample0 = sample0;
5395 last_sample1 = sample1;
5396 last_sample2 = sample2;
5397 last_sample3 = sample3;
5401 cvt->len_cvt = dstsize;
5402 if (cvt->filters[++cvt->filter_index]) {
5403 cvt->filters[cvt->filter_index] (cvt, format);
5408 SDL_Upsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5411 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr);
5414 const int srcsize = cvt->len_cvt - 384;
5415 const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
5416 register int eps = 0;
5417 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
5418 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
5419 const Sint32 *target = ((const Sint32 *) cvt->buf);
5420 Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
5421 Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
5422 Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
5423 Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
5424 Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
5425 Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
5426 Sint32 last_sample5 = sample5;
5427 Sint32 last_sample4 = sample4;
5428 Sint32 last_sample3 = sample3;
5429 Sint32 last_sample2 = sample2;
5430 Sint32 last_sample1 = sample1;
5431 Sint32 last_sample0 = sample0;
5432 while (dst >= target) {
5433 dst[5] = ((Sint32) SDL_SwapLE32(sample5));
5434 dst[4] = ((Sint32) SDL_SwapLE32(sample4));
5435 dst[3] = ((Sint32) SDL_SwapLE32(sample3));
5436 dst[2] = ((Sint32) SDL_SwapLE32(sample2));
5437 dst[1] = ((Sint32) SDL_SwapLE32(sample1));
5438 dst[0] = ((Sint32) SDL_SwapLE32(sample0));
5441 if ((eps << 1) >= dstsize) {
5443 sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
5444 sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
5445 sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
5446 sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
5447 sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
5448 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5449 last_sample5 = sample5;
5450 last_sample4 = sample4;
5451 last_sample3 = sample3;
5452 last_sample2 = sample2;
5453 last_sample1 = sample1;
5454 last_sample0 = sample0;
5458 cvt->len_cvt = dstsize;
5459 if (cvt->filters[++cvt->filter_index]) {
5460 cvt->filters[cvt->filter_index] (cvt, format);
5465 SDL_Downsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5468 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr);
5471 const int srcsize = cvt->len_cvt - 384;
5472 const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
5473 register int eps = 0;
5474 Sint32 *dst = (Sint32 *) cvt->buf;
5475 const Sint32 *src = (Sint32 *) cvt->buf;
5476 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
5477 Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
5478 Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
5479 Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
5480 Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
5481 Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
5482 Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
5483 Sint32 last_sample0 = sample0;
5484 Sint32 last_sample1 = sample1;
5485 Sint32 last_sample2 = sample2;
5486 Sint32 last_sample3 = sample3;
5487 Sint32 last_sample4 = sample4;
5488 Sint32 last_sample5 = sample5;
5489 while (dst < target) {
5492 if ((eps << 1) >= srcsize) {
5493 dst[0] = ((Sint32) SDL_SwapLE32(sample0));
5494 dst[1] = ((Sint32) SDL_SwapLE32(sample1));
5495 dst[2] = ((Sint32) SDL_SwapLE32(sample2));
5496 dst[3] = ((Sint32) SDL_SwapLE32(sample3));
5497 dst[4] = ((Sint32) SDL_SwapLE32(sample4));
5498 dst[5] = ((Sint32) SDL_SwapLE32(sample5));
5500 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5501 sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
5502 sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
5503 sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
5504 sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
5505 sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
5506 last_sample0 = sample0;
5507 last_sample1 = sample1;
5508 last_sample2 = sample2;
5509 last_sample3 = sample3;
5510 last_sample4 = sample4;
5511 last_sample5 = sample5;
5515 cvt->len_cvt = dstsize;
5516 if (cvt->filters[++cvt->filter_index]) {
5517 cvt->filters[cvt->filter_index] (cvt, format);
5522 SDL_Upsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5525 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr);
5528 const int srcsize = cvt->len_cvt - 512;
5529 const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
5530 register int eps = 0;
5531 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
5532 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
5533 const Sint32 *target = ((const Sint32 *) cvt->buf);
5534 Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7]));
5535 Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6]));
5536 Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
5537 Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
5538 Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
5539 Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
5540 Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
5541 Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
5542 Sint32 last_sample7 = sample7;
5543 Sint32 last_sample6 = sample6;
5544 Sint32 last_sample5 = sample5;
5545 Sint32 last_sample4 = sample4;
5546 Sint32 last_sample3 = sample3;
5547 Sint32 last_sample2 = sample2;
5548 Sint32 last_sample1 = sample1;
5549 Sint32 last_sample0 = sample0;
5550 while (dst >= target) {
5551 dst[7] = ((Sint32) SDL_SwapLE32(sample7));
5552 dst[6] = ((Sint32) SDL_SwapLE32(sample6));
5553 dst[5] = ((Sint32) SDL_SwapLE32(sample5));
5554 dst[4] = ((Sint32) SDL_SwapLE32(sample4));
5555 dst[3] = ((Sint32) SDL_SwapLE32(sample3));
5556 dst[2] = ((Sint32) SDL_SwapLE32(sample2));
5557 dst[1] = ((Sint32) SDL_SwapLE32(sample1));
5558 dst[0] = ((Sint32) SDL_SwapLE32(sample0));
5561 if ((eps << 1) >= dstsize) {
5563 sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
5564 sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
5565 sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
5566 sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
5567 sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
5568 sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
5569 sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
5570 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5571 last_sample7 = sample7;
5572 last_sample6 = sample6;
5573 last_sample5 = sample5;
5574 last_sample4 = sample4;
5575 last_sample3 = sample3;
5576 last_sample2 = sample2;
5577 last_sample1 = sample1;
5578 last_sample0 = sample0;
5582 cvt->len_cvt = dstsize;
5583 if (cvt->filters[++cvt->filter_index]) {
5584 cvt->filters[cvt->filter_index] (cvt, format);
5589 SDL_Downsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5592 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr);
5595 const int srcsize = cvt->len_cvt - 512;
5596 const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
5597 register int eps = 0;
5598 Sint32 *dst = (Sint32 *) cvt->buf;
5599 const Sint32 *src = (Sint32 *) cvt->buf;
5600 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
5601 Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
5602 Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
5603 Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
5604 Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
5605 Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
5606 Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
5607 Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6]));
5608 Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7]));
5609 Sint32 last_sample0 = sample0;
5610 Sint32 last_sample1 = sample1;
5611 Sint32 last_sample2 = sample2;
5612 Sint32 last_sample3 = sample3;
5613 Sint32 last_sample4 = sample4;
5614 Sint32 last_sample5 = sample5;
5615 Sint32 last_sample6 = sample6;
5616 Sint32 last_sample7 = sample7;
5617 while (dst < target) {
5620 if ((eps << 1) >= srcsize) {
5621 dst[0] = ((Sint32) SDL_SwapLE32(sample0));
5622 dst[1] = ((Sint32) SDL_SwapLE32(sample1));
5623 dst[2] = ((Sint32) SDL_SwapLE32(sample2));
5624 dst[3] = ((Sint32) SDL_SwapLE32(sample3));
5625 dst[4] = ((Sint32) SDL_SwapLE32(sample4));
5626 dst[5] = ((Sint32) SDL_SwapLE32(sample5));
5627 dst[6] = ((Sint32) SDL_SwapLE32(sample6));
5628 dst[7] = ((Sint32) SDL_SwapLE32(sample7));
5630 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5631 sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
5632 sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
5633 sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
5634 sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
5635 sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
5636 sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
5637 sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
5638 last_sample0 = sample0;
5639 last_sample1 = sample1;
5640 last_sample2 = sample2;
5641 last_sample3 = sample3;
5642 last_sample4 = sample4;
5643 last_sample5 = sample5;
5644 last_sample6 = sample6;
5645 last_sample7 = sample7;
5649 cvt->len_cvt = dstsize;
5650 if (cvt->filters[++cvt->filter_index]) {
5651 cvt->filters[cvt->filter_index] (cvt, format);
5656 SDL_Upsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5659 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr);
5662 const int srcsize = cvt->len_cvt - 64;
5663 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
5664 register int eps = 0;
5665 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
5666 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
5667 const Sint32 *target = ((const Sint32 *) cvt->buf);
5668 Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
5669 Sint32 last_sample0 = sample0;
5670 while (dst >= target) {
5671 dst[0] = ((Sint32) SDL_SwapBE32(sample0));
5674 if ((eps << 1) >= dstsize) {
5676 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5677 last_sample0 = sample0;
5681 cvt->len_cvt = dstsize;
5682 if (cvt->filters[++cvt->filter_index]) {
5683 cvt->filters[cvt->filter_index] (cvt, format);
5688 SDL_Downsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5691 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr);
5694 const int srcsize = cvt->len_cvt - 64;
5695 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
5696 register int eps = 0;
5697 Sint32 *dst = (Sint32 *) cvt->buf;
5698 const Sint32 *src = (Sint32 *) cvt->buf;
5699 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
5700 Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
5701 Sint32 last_sample0 = sample0;
5702 while (dst < target) {
5705 if ((eps << 1) >= srcsize) {
5706 dst[0] = ((Sint32) SDL_SwapBE32(sample0));
5708 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5709 last_sample0 = sample0;
5713 cvt->len_cvt = dstsize;
5714 if (cvt->filters[++cvt->filter_index]) {
5715 cvt->filters[cvt->filter_index] (cvt, format);
5720 SDL_Upsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5723 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr);
5726 const int srcsize = cvt->len_cvt - 128;
5727 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
5728 register int eps = 0;
5729 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
5730 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
5731 const Sint32 *target = ((const Sint32 *) cvt->buf);
5732 Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
5733 Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
5734 Sint32 last_sample1 = sample1;
5735 Sint32 last_sample0 = sample0;
5736 while (dst >= target) {
5737 dst[1] = ((Sint32) SDL_SwapBE32(sample1));
5738 dst[0] = ((Sint32) SDL_SwapBE32(sample0));
5741 if ((eps << 1) >= dstsize) {
5743 sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
5744 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5745 last_sample1 = sample1;
5746 last_sample0 = sample0;
5750 cvt->len_cvt = dstsize;
5751 if (cvt->filters[++cvt->filter_index]) {
5752 cvt->filters[cvt->filter_index] (cvt, format);
5757 SDL_Downsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5760 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr);
5763 const int srcsize = cvt->len_cvt - 128;
5764 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
5765 register int eps = 0;
5766 Sint32 *dst = (Sint32 *) cvt->buf;
5767 const Sint32 *src = (Sint32 *) cvt->buf;
5768 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
5769 Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
5770 Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
5771 Sint32 last_sample0 = sample0;
5772 Sint32 last_sample1 = sample1;
5773 while (dst < target) {
5776 if ((eps << 1) >= srcsize) {
5777 dst[0] = ((Sint32) SDL_SwapBE32(sample0));
5778 dst[1] = ((Sint32) SDL_SwapBE32(sample1));
5780 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5781 sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
5782 last_sample0 = sample0;
5783 last_sample1 = sample1;
5787 cvt->len_cvt = dstsize;
5788 if (cvt->filters[++cvt->filter_index]) {
5789 cvt->filters[cvt->filter_index] (cvt, format);
5794 SDL_Upsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5797 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr);
5800 const int srcsize = cvt->len_cvt - 256;
5801 const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
5802 register int eps = 0;
5803 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
5804 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
5805 const Sint32 *target = ((const Sint32 *) cvt->buf);
5806 Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
5807 Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
5808 Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
5809 Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
5810 Sint32 last_sample3 = sample3;
5811 Sint32 last_sample2 = sample2;
5812 Sint32 last_sample1 = sample1;
5813 Sint32 last_sample0 = sample0;
5814 while (dst >= target) {
5815 dst[3] = ((Sint32) SDL_SwapBE32(sample3));
5816 dst[2] = ((Sint32) SDL_SwapBE32(sample2));
5817 dst[1] = ((Sint32) SDL_SwapBE32(sample1));
5818 dst[0] = ((Sint32) SDL_SwapBE32(sample0));
5821 if ((eps << 1) >= dstsize) {
5823 sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
5824 sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
5825 sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
5826 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5827 last_sample3 = sample3;
5828 last_sample2 = sample2;
5829 last_sample1 = sample1;
5830 last_sample0 = sample0;
5834 cvt->len_cvt = dstsize;
5835 if (cvt->filters[++cvt->filter_index]) {
5836 cvt->filters[cvt->filter_index] (cvt, format);
5841 SDL_Downsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5844 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr);
5847 const int srcsize = cvt->len_cvt - 256;
5848 const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
5849 register int eps = 0;
5850 Sint32 *dst = (Sint32 *) cvt->buf;
5851 const Sint32 *src = (Sint32 *) cvt->buf;
5852 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
5853 Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
5854 Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
5855 Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
5856 Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
5857 Sint32 last_sample0 = sample0;
5858 Sint32 last_sample1 = sample1;
5859 Sint32 last_sample2 = sample2;
5860 Sint32 last_sample3 = sample3;
5861 while (dst < target) {
5864 if ((eps << 1) >= srcsize) {
5865 dst[0] = ((Sint32) SDL_SwapBE32(sample0));
5866 dst[1] = ((Sint32) SDL_SwapBE32(sample1));
5867 dst[2] = ((Sint32) SDL_SwapBE32(sample2));
5868 dst[3] = ((Sint32) SDL_SwapBE32(sample3));
5870 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5871 sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
5872 sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
5873 sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
5874 last_sample0 = sample0;
5875 last_sample1 = sample1;
5876 last_sample2 = sample2;
5877 last_sample3 = sample3;
5881 cvt->len_cvt = dstsize;
5882 if (cvt->filters[++cvt->filter_index]) {
5883 cvt->filters[cvt->filter_index] (cvt, format);
5888 SDL_Upsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5891 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr);
5894 const int srcsize = cvt->len_cvt - 384;
5895 const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
5896 register int eps = 0;
5897 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
5898 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
5899 const Sint32 *target = ((const Sint32 *) cvt->buf);
5900 Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
5901 Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
5902 Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
5903 Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
5904 Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
5905 Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
5906 Sint32 last_sample5 = sample5;
5907 Sint32 last_sample4 = sample4;
5908 Sint32 last_sample3 = sample3;
5909 Sint32 last_sample2 = sample2;
5910 Sint32 last_sample1 = sample1;
5911 Sint32 last_sample0 = sample0;
5912 while (dst >= target) {
5913 dst[5] = ((Sint32) SDL_SwapBE32(sample5));
5914 dst[4] = ((Sint32) SDL_SwapBE32(sample4));
5915 dst[3] = ((Sint32) SDL_SwapBE32(sample3));
5916 dst[2] = ((Sint32) SDL_SwapBE32(sample2));
5917 dst[1] = ((Sint32) SDL_SwapBE32(sample1));
5918 dst[0] = ((Sint32) SDL_SwapBE32(sample0));
5921 if ((eps << 1) >= dstsize) {
5923 sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
5924 sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
5925 sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
5926 sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
5927 sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
5928 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5929 last_sample5 = sample5;
5930 last_sample4 = sample4;
5931 last_sample3 = sample3;
5932 last_sample2 = sample2;
5933 last_sample1 = sample1;
5934 last_sample0 = sample0;
5938 cvt->len_cvt = dstsize;
5939 if (cvt->filters[++cvt->filter_index]) {
5940 cvt->filters[cvt->filter_index] (cvt, format);
5945 SDL_Downsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
5948 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr);
5951 const int srcsize = cvt->len_cvt - 384;
5952 const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
5953 register int eps = 0;
5954 Sint32 *dst = (Sint32 *) cvt->buf;
5955 const Sint32 *src = (Sint32 *) cvt->buf;
5956 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
5957 Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
5958 Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
5959 Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
5960 Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
5961 Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
5962 Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
5963 Sint32 last_sample0 = sample0;
5964 Sint32 last_sample1 = sample1;
5965 Sint32 last_sample2 = sample2;
5966 Sint32 last_sample3 = sample3;
5967 Sint32 last_sample4 = sample4;
5968 Sint32 last_sample5 = sample5;
5969 while (dst < target) {
5972 if ((eps << 1) >= srcsize) {
5973 dst[0] = ((Sint32) SDL_SwapBE32(sample0));
5974 dst[1] = ((Sint32) SDL_SwapBE32(sample1));
5975 dst[2] = ((Sint32) SDL_SwapBE32(sample2));
5976 dst[3] = ((Sint32) SDL_SwapBE32(sample3));
5977 dst[4] = ((Sint32) SDL_SwapBE32(sample4));
5978 dst[5] = ((Sint32) SDL_SwapBE32(sample5));
5980 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
5981 sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
5982 sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
5983 sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
5984 sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
5985 sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
5986 last_sample0 = sample0;
5987 last_sample1 = sample1;
5988 last_sample2 = sample2;
5989 last_sample3 = sample3;
5990 last_sample4 = sample4;
5991 last_sample5 = sample5;
5995 cvt->len_cvt = dstsize;
5996 if (cvt->filters[++cvt->filter_index]) {
5997 cvt->filters[cvt->filter_index] (cvt, format);
6002 SDL_Upsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6005 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr);
6008 const int srcsize = cvt->len_cvt - 512;
6009 const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
6010 register int eps = 0;
6011 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
6012 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
6013 const Sint32 *target = ((const Sint32 *) cvt->buf);
6014 Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7]));
6015 Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6]));
6016 Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
6017 Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
6018 Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
6019 Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
6020 Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
6021 Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
6022 Sint32 last_sample7 = sample7;
6023 Sint32 last_sample6 = sample6;
6024 Sint32 last_sample5 = sample5;
6025 Sint32 last_sample4 = sample4;
6026 Sint32 last_sample3 = sample3;
6027 Sint32 last_sample2 = sample2;
6028 Sint32 last_sample1 = sample1;
6029 Sint32 last_sample0 = sample0;
6030 while (dst >= target) {
6031 dst[7] = ((Sint32) SDL_SwapBE32(sample7));
6032 dst[6] = ((Sint32) SDL_SwapBE32(sample6));
6033 dst[5] = ((Sint32) SDL_SwapBE32(sample5));
6034 dst[4] = ((Sint32) SDL_SwapBE32(sample4));
6035 dst[3] = ((Sint32) SDL_SwapBE32(sample3));
6036 dst[2] = ((Sint32) SDL_SwapBE32(sample2));
6037 dst[1] = ((Sint32) SDL_SwapBE32(sample1));
6038 dst[0] = ((Sint32) SDL_SwapBE32(sample0));
6041 if ((eps << 1) >= dstsize) {
6043 sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
6044 sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
6045 sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
6046 sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
6047 sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
6048 sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
6049 sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
6050 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
6051 last_sample7 = sample7;
6052 last_sample6 = sample6;
6053 last_sample5 = sample5;
6054 last_sample4 = sample4;
6055 last_sample3 = sample3;
6056 last_sample2 = sample2;
6057 last_sample1 = sample1;
6058 last_sample0 = sample0;
6062 cvt->len_cvt = dstsize;
6063 if (cvt->filters[++cvt->filter_index]) {
6064 cvt->filters[cvt->filter_index] (cvt, format);
6069 SDL_Downsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6072 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr);
6075 const int srcsize = cvt->len_cvt - 512;
6076 const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
6077 register int eps = 0;
6078 Sint32 *dst = (Sint32 *) cvt->buf;
6079 const Sint32 *src = (Sint32 *) cvt->buf;
6080 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
6081 Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
6082 Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
6083 Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
6084 Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
6085 Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
6086 Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
6087 Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6]));
6088 Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7]));
6089 Sint32 last_sample0 = sample0;
6090 Sint32 last_sample1 = sample1;
6091 Sint32 last_sample2 = sample2;
6092 Sint32 last_sample3 = sample3;
6093 Sint32 last_sample4 = sample4;
6094 Sint32 last_sample5 = sample5;
6095 Sint32 last_sample6 = sample6;
6096 Sint32 last_sample7 = sample7;
6097 while (dst < target) {
6100 if ((eps << 1) >= srcsize) {
6101 dst[0] = ((Sint32) SDL_SwapBE32(sample0));
6102 dst[1] = ((Sint32) SDL_SwapBE32(sample1));
6103 dst[2] = ((Sint32) SDL_SwapBE32(sample2));
6104 dst[3] = ((Sint32) SDL_SwapBE32(sample3));
6105 dst[4] = ((Sint32) SDL_SwapBE32(sample4));
6106 dst[5] = ((Sint32) SDL_SwapBE32(sample5));
6107 dst[6] = ((Sint32) SDL_SwapBE32(sample6));
6108 dst[7] = ((Sint32) SDL_SwapBE32(sample7));
6110 sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
6111 sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
6112 sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
6113 sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
6114 sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
6115 sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
6116 sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
6117 sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
6118 last_sample0 = sample0;
6119 last_sample1 = sample1;
6120 last_sample2 = sample2;
6121 last_sample3 = sample3;
6122 last_sample4 = sample4;
6123 last_sample5 = sample5;
6124 last_sample6 = sample6;
6125 last_sample7 = sample7;
6129 cvt->len_cvt = dstsize;
6130 if (cvt->filters[++cvt->filter_index]) {
6131 cvt->filters[cvt->filter_index] (cvt, format);
6136 SDL_Upsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6139 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr);
6142 const int srcsize = cvt->len_cvt - 64;
6143 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
6144 register int eps = 0;
6145 float *dst = ((float *) (cvt->buf + dstsize)) - 1;
6146 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
6147 const float *target = ((const float *) cvt->buf);
6148 float sample0 = SDL_SwapFloatLE(src[0]);
6149 float last_sample0 = sample0;
6150 while (dst >= target) {
6151 dst[0] = SDL_SwapFloatLE(sample0);
6154 if ((eps << 1) >= dstsize) {
6156 sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
6157 last_sample0 = sample0;
6161 cvt->len_cvt = dstsize;
6162 if (cvt->filters[++cvt->filter_index]) {
6163 cvt->filters[cvt->filter_index] (cvt, format);
6168 SDL_Downsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6171 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr);
6174 const int srcsize = cvt->len_cvt - 64;
6175 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
6176 register int eps = 0;
6177 float *dst = (float *) cvt->buf;
6178 const float *src = (float *) cvt->buf;
6179 const float *target = (const float *) (cvt->buf + dstsize);
6180 float sample0 = SDL_SwapFloatLE(src[0]);
6181 float last_sample0 = sample0;
6182 while (dst < target) {
6185 if ((eps << 1) >= srcsize) {
6186 dst[0] = SDL_SwapFloatLE(sample0);
6188 sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
6189 last_sample0 = sample0;
6193 cvt->len_cvt = dstsize;
6194 if (cvt->filters[++cvt->filter_index]) {
6195 cvt->filters[cvt->filter_index] (cvt, format);
6200 SDL_Upsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6203 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr);
6206 const int srcsize = cvt->len_cvt - 128;
6207 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
6208 register int eps = 0;
6209 float *dst = ((float *) (cvt->buf + dstsize)) - 2;
6210 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
6211 const float *target = ((const float *) cvt->buf);
6212 float sample1 = SDL_SwapFloatLE(src[1]);
6213 float sample0 = SDL_SwapFloatLE(src[0]);
6214 float last_sample1 = sample1;
6215 float last_sample0 = sample0;
6216 while (dst >= target) {
6217 dst[1] = SDL_SwapFloatLE(sample1);
6218 dst[0] = SDL_SwapFloatLE(sample0);
6221 if ((eps << 1) >= dstsize) {
6223 sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
6224 sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
6225 last_sample1 = sample1;
6226 last_sample0 = sample0;
6230 cvt->len_cvt = dstsize;
6231 if (cvt->filters[++cvt->filter_index]) {
6232 cvt->filters[cvt->filter_index] (cvt, format);
6237 SDL_Downsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6240 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr);
6243 const int srcsize = cvt->len_cvt - 128;
6244 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
6245 register int eps = 0;
6246 float *dst = (float *) cvt->buf;
6247 const float *src = (float *) cvt->buf;
6248 const float *target = (const float *) (cvt->buf + dstsize);
6249 float sample0 = SDL_SwapFloatLE(src[0]);
6250 float sample1 = SDL_SwapFloatLE(src[1]);
6251 float last_sample0 = sample0;
6252 float last_sample1 = sample1;
6253 while (dst < target) {
6256 if ((eps << 1) >= srcsize) {
6257 dst[0] = SDL_SwapFloatLE(sample0);
6258 dst[1] = SDL_SwapFloatLE(sample1);
6260 sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
6261 sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
6262 last_sample0 = sample0;
6263 last_sample1 = sample1;
6267 cvt->len_cvt = dstsize;
6268 if (cvt->filters[++cvt->filter_index]) {
6269 cvt->filters[cvt->filter_index] (cvt, format);
6274 SDL_Upsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6277 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr);
6280 const int srcsize = cvt->len_cvt - 256;
6281 const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
6282 register int eps = 0;
6283 float *dst = ((float *) (cvt->buf + dstsize)) - 4;
6284 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
6285 const float *target = ((const float *) cvt->buf);
6286 float sample3 = SDL_SwapFloatLE(src[3]);
6287 float sample2 = SDL_SwapFloatLE(src[2]);
6288 float sample1 = SDL_SwapFloatLE(src[1]);
6289 float sample0 = SDL_SwapFloatLE(src[0]);
6290 float last_sample3 = sample3;
6291 float last_sample2 = sample2;
6292 float last_sample1 = sample1;
6293 float last_sample0 = sample0;
6294 while (dst >= target) {
6295 dst[3] = SDL_SwapFloatLE(sample3);
6296 dst[2] = SDL_SwapFloatLE(sample2);
6297 dst[1] = SDL_SwapFloatLE(sample1);
6298 dst[0] = SDL_SwapFloatLE(sample0);
6301 if ((eps << 1) >= dstsize) {
6303 sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
6304 sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
6305 sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
6306 sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
6307 last_sample3 = sample3;
6308 last_sample2 = sample2;
6309 last_sample1 = sample1;
6310 last_sample0 = sample0;
6314 cvt->len_cvt = dstsize;
6315 if (cvt->filters[++cvt->filter_index]) {
6316 cvt->filters[cvt->filter_index] (cvt, format);
6321 SDL_Downsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6324 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr);
6327 const int srcsize = cvt->len_cvt - 256;
6328 const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
6329 register int eps = 0;
6330 float *dst = (float *) cvt->buf;
6331 const float *src = (float *) cvt->buf;
6332 const float *target = (const float *) (cvt->buf + dstsize);
6333 float sample0 = SDL_SwapFloatLE(src[0]);
6334 float sample1 = SDL_SwapFloatLE(src[1]);
6335 float sample2 = SDL_SwapFloatLE(src[2]);
6336 float sample3 = SDL_SwapFloatLE(src[3]);
6337 float last_sample0 = sample0;
6338 float last_sample1 = sample1;
6339 float last_sample2 = sample2;
6340 float last_sample3 = sample3;
6341 while (dst < target) {
6344 if ((eps << 1) >= srcsize) {
6345 dst[0] = SDL_SwapFloatLE(sample0);
6346 dst[1] = SDL_SwapFloatLE(sample1);
6347 dst[2] = SDL_SwapFloatLE(sample2);
6348 dst[3] = SDL_SwapFloatLE(sample3);
6350 sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
6351 sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
6352 sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
6353 sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
6354 last_sample0 = sample0;
6355 last_sample1 = sample1;
6356 last_sample2 = sample2;
6357 last_sample3 = sample3;
6361 cvt->len_cvt = dstsize;
6362 if (cvt->filters[++cvt->filter_index]) {
6363 cvt->filters[cvt->filter_index] (cvt, format);
6368 SDL_Upsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6371 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr);
6374 const int srcsize = cvt->len_cvt - 384;
6375 const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
6376 register int eps = 0;
6377 float *dst = ((float *) (cvt->buf + dstsize)) - 6;
6378 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
6379 const float *target = ((const float *) cvt->buf);
6380 float sample5 = SDL_SwapFloatLE(src[5]);
6381 float sample4 = SDL_SwapFloatLE(src[4]);
6382 float sample3 = SDL_SwapFloatLE(src[3]);
6383 float sample2 = SDL_SwapFloatLE(src[2]);
6384 float sample1 = SDL_SwapFloatLE(src[1]);
6385 float sample0 = SDL_SwapFloatLE(src[0]);
6386 float last_sample5 = sample5;
6387 float last_sample4 = sample4;
6388 float last_sample3 = sample3;
6389 float last_sample2 = sample2;
6390 float last_sample1 = sample1;
6391 float last_sample0 = sample0;
6392 while (dst >= target) {
6393 dst[5] = SDL_SwapFloatLE(sample5);
6394 dst[4] = SDL_SwapFloatLE(sample4);
6395 dst[3] = SDL_SwapFloatLE(sample3);
6396 dst[2] = SDL_SwapFloatLE(sample2);
6397 dst[1] = SDL_SwapFloatLE(sample1);
6398 dst[0] = SDL_SwapFloatLE(sample0);
6401 if ((eps << 1) >= dstsize) {
6403 sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
6404 sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
6405 sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
6406 sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
6407 sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
6408 sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
6409 last_sample5 = sample5;
6410 last_sample4 = sample4;
6411 last_sample3 = sample3;
6412 last_sample2 = sample2;
6413 last_sample1 = sample1;
6414 last_sample0 = sample0;
6418 cvt->len_cvt = dstsize;
6419 if (cvt->filters[++cvt->filter_index]) {
6420 cvt->filters[cvt->filter_index] (cvt, format);
6425 SDL_Downsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6428 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr);
6431 const int srcsize = cvt->len_cvt - 384;
6432 const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
6433 register int eps = 0;
6434 float *dst = (float *) cvt->buf;
6435 const float *src = (float *) cvt->buf;
6436 const float *target = (const float *) (cvt->buf + dstsize);
6437 float sample0 = SDL_SwapFloatLE(src[0]);
6438 float sample1 = SDL_SwapFloatLE(src[1]);
6439 float sample2 = SDL_SwapFloatLE(src[2]);
6440 float sample3 = SDL_SwapFloatLE(src[3]);
6441 float sample4 = SDL_SwapFloatLE(src[4]);
6442 float sample5 = SDL_SwapFloatLE(src[5]);
6443 float last_sample0 = sample0;
6444 float last_sample1 = sample1;
6445 float last_sample2 = sample2;
6446 float last_sample3 = sample3;
6447 float last_sample4 = sample4;
6448 float last_sample5 = sample5;
6449 while (dst < target) {
6452 if ((eps << 1) >= srcsize) {
6453 dst[0] = SDL_SwapFloatLE(sample0);
6454 dst[1] = SDL_SwapFloatLE(sample1);
6455 dst[2] = SDL_SwapFloatLE(sample2);
6456 dst[3] = SDL_SwapFloatLE(sample3);
6457 dst[4] = SDL_SwapFloatLE(sample4);
6458 dst[5] = SDL_SwapFloatLE(sample5);
6460 sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
6461 sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
6462 sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
6463 sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
6464 sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
6465 sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
6466 last_sample0 = sample0;
6467 last_sample1 = sample1;
6468 last_sample2 = sample2;
6469 last_sample3 = sample3;
6470 last_sample4 = sample4;
6471 last_sample5 = sample5;
6475 cvt->len_cvt = dstsize;
6476 if (cvt->filters[++cvt->filter_index]) {
6477 cvt->filters[cvt->filter_index] (cvt, format);
6482 SDL_Upsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6485 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr);
6488 const int srcsize = cvt->len_cvt - 512;
6489 const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
6490 register int eps = 0;
6491 float *dst = ((float *) (cvt->buf + dstsize)) - 8;
6492 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
6493 const float *target = ((const float *) cvt->buf);
6494 float sample7 = SDL_SwapFloatLE(src[7]);
6495 float sample6 = SDL_SwapFloatLE(src[6]);
6496 float sample5 = SDL_SwapFloatLE(src[5]);
6497 float sample4 = SDL_SwapFloatLE(src[4]);
6498 float sample3 = SDL_SwapFloatLE(src[3]);
6499 float sample2 = SDL_SwapFloatLE(src[2]);
6500 float sample1 = SDL_SwapFloatLE(src[1]);
6501 float sample0 = SDL_SwapFloatLE(src[0]);
6502 float last_sample7 = sample7;
6503 float last_sample6 = sample6;
6504 float last_sample5 = sample5;
6505 float last_sample4 = sample4;
6506 float last_sample3 = sample3;
6507 float last_sample2 = sample2;
6508 float last_sample1 = sample1;
6509 float last_sample0 = sample0;
6510 while (dst >= target) {
6511 dst[7] = SDL_SwapFloatLE(sample7);
6512 dst[6] = SDL_SwapFloatLE(sample6);
6513 dst[5] = SDL_SwapFloatLE(sample5);
6514 dst[4] = SDL_SwapFloatLE(sample4);
6515 dst[3] = SDL_SwapFloatLE(sample3);
6516 dst[2] = SDL_SwapFloatLE(sample2);
6517 dst[1] = SDL_SwapFloatLE(sample1);
6518 dst[0] = SDL_SwapFloatLE(sample0);
6521 if ((eps << 1) >= dstsize) {
6523 sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5);
6524 sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5);
6525 sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
6526 sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
6527 sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
6528 sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
6529 sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
6530 sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
6531 last_sample7 = sample7;
6532 last_sample6 = sample6;
6533 last_sample5 = sample5;
6534 last_sample4 = sample4;
6535 last_sample3 = sample3;
6536 last_sample2 = sample2;
6537 last_sample1 = sample1;
6538 last_sample0 = sample0;
6542 cvt->len_cvt = dstsize;
6543 if (cvt->filters[++cvt->filter_index]) {
6544 cvt->filters[cvt->filter_index] (cvt, format);
6549 SDL_Downsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6552 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr);
6555 const int srcsize = cvt->len_cvt - 512;
6556 const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
6557 register int eps = 0;
6558 float *dst = (float *) cvt->buf;
6559 const float *src = (float *) cvt->buf;
6560 const float *target = (const float *) (cvt->buf + dstsize);
6561 float sample0 = SDL_SwapFloatLE(src[0]);
6562 float sample1 = SDL_SwapFloatLE(src[1]);
6563 float sample2 = SDL_SwapFloatLE(src[2]);
6564 float sample3 = SDL_SwapFloatLE(src[3]);
6565 float sample4 = SDL_SwapFloatLE(src[4]);
6566 float sample5 = SDL_SwapFloatLE(src[5]);
6567 float sample6 = SDL_SwapFloatLE(src[6]);
6568 float sample7 = SDL_SwapFloatLE(src[7]);
6569 float last_sample0 = sample0;
6570 float last_sample1 = sample1;
6571 float last_sample2 = sample2;
6572 float last_sample3 = sample3;
6573 float last_sample4 = sample4;
6574 float last_sample5 = sample5;
6575 float last_sample6 = sample6;
6576 float last_sample7 = sample7;
6577 while (dst < target) {
6580 if ((eps << 1) >= srcsize) {
6581 dst[0] = SDL_SwapFloatLE(sample0);
6582 dst[1] = SDL_SwapFloatLE(sample1);
6583 dst[2] = SDL_SwapFloatLE(sample2);
6584 dst[3] = SDL_SwapFloatLE(sample3);
6585 dst[4] = SDL_SwapFloatLE(sample4);
6586 dst[5] = SDL_SwapFloatLE(sample5);
6587 dst[6] = SDL_SwapFloatLE(sample6);
6588 dst[7] = SDL_SwapFloatLE(sample7);
6590 sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
6591 sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
6592 sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
6593 sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
6594 sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
6595 sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
6596 sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5);
6597 sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5);
6598 last_sample0 = sample0;
6599 last_sample1 = sample1;
6600 last_sample2 = sample2;
6601 last_sample3 = sample3;
6602 last_sample4 = sample4;
6603 last_sample5 = sample5;
6604 last_sample6 = sample6;
6605 last_sample7 = sample7;
6609 cvt->len_cvt = dstsize;
6610 if (cvt->filters[++cvt->filter_index]) {
6611 cvt->filters[cvt->filter_index] (cvt, format);
6616 SDL_Upsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6619 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr);
6622 const int srcsize = cvt->len_cvt - 64;
6623 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
6624 register int eps = 0;
6625 float *dst = ((float *) (cvt->buf + dstsize)) - 1;
6626 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
6627 const float *target = ((const float *) cvt->buf);
6628 float sample0 = SDL_SwapFloatBE(src[0]);
6629 float last_sample0 = sample0;
6630 while (dst >= target) {
6631 dst[0] = SDL_SwapFloatBE(sample0);
6634 if ((eps << 1) >= dstsize) {
6636 sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
6637 last_sample0 = sample0;
6641 cvt->len_cvt = dstsize;
6642 if (cvt->filters[++cvt->filter_index]) {
6643 cvt->filters[cvt->filter_index] (cvt, format);
6648 SDL_Downsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6651 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr);
6654 const int srcsize = cvt->len_cvt - 64;
6655 const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
6656 register int eps = 0;
6657 float *dst = (float *) cvt->buf;
6658 const float *src = (float *) cvt->buf;
6659 const float *target = (const float *) (cvt->buf + dstsize);
6660 float sample0 = SDL_SwapFloatBE(src[0]);
6661 float last_sample0 = sample0;
6662 while (dst < target) {
6665 if ((eps << 1) >= srcsize) {
6666 dst[0] = SDL_SwapFloatBE(sample0);
6668 sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
6669 last_sample0 = sample0;
6673 cvt->len_cvt = dstsize;
6674 if (cvt->filters[++cvt->filter_index]) {
6675 cvt->filters[cvt->filter_index] (cvt, format);
6680 SDL_Upsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6683 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr);
6686 const int srcsize = cvt->len_cvt - 128;
6687 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
6688 register int eps = 0;
6689 float *dst = ((float *) (cvt->buf + dstsize)) - 2;
6690 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
6691 const float *target = ((const float *) cvt->buf);
6692 float sample1 = SDL_SwapFloatBE(src[1]);
6693 float sample0 = SDL_SwapFloatBE(src[0]);
6694 float last_sample1 = sample1;
6695 float last_sample0 = sample0;
6696 while (dst >= target) {
6697 dst[1] = SDL_SwapFloatBE(sample1);
6698 dst[0] = SDL_SwapFloatBE(sample0);
6701 if ((eps << 1) >= dstsize) {
6703 sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
6704 sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
6705 last_sample1 = sample1;
6706 last_sample0 = sample0;
6710 cvt->len_cvt = dstsize;
6711 if (cvt->filters[++cvt->filter_index]) {
6712 cvt->filters[cvt->filter_index] (cvt, format);
6717 SDL_Downsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6720 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr);
6723 const int srcsize = cvt->len_cvt - 128;
6724 const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
6725 register int eps = 0;
6726 float *dst = (float *) cvt->buf;
6727 const float *src = (float *) cvt->buf;
6728 const float *target = (const float *) (cvt->buf + dstsize);
6729 float sample0 = SDL_SwapFloatBE(src[0]);
6730 float sample1 = SDL_SwapFloatBE(src[1]);
6731 float last_sample0 = sample0;
6732 float last_sample1 = sample1;
6733 while (dst < target) {
6736 if ((eps << 1) >= srcsize) {
6737 dst[0] = SDL_SwapFloatBE(sample0);
6738 dst[1] = SDL_SwapFloatBE(sample1);
6740 sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
6741 sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
6742 last_sample0 = sample0;
6743 last_sample1 = sample1;
6747 cvt->len_cvt = dstsize;
6748 if (cvt->filters[++cvt->filter_index]) {
6749 cvt->filters[cvt->filter_index] (cvt, format);
6754 SDL_Upsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6757 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr);
6760 const int srcsize = cvt->len_cvt - 256;
6761 const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
6762 register int eps = 0;
6763 float *dst = ((float *) (cvt->buf + dstsize)) - 4;
6764 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
6765 const float *target = ((const float *) cvt->buf);
6766 float sample3 = SDL_SwapFloatBE(src[3]);
6767 float sample2 = SDL_SwapFloatBE(src[2]);
6768 float sample1 = SDL_SwapFloatBE(src[1]);
6769 float sample0 = SDL_SwapFloatBE(src[0]);
6770 float last_sample3 = sample3;
6771 float last_sample2 = sample2;
6772 float last_sample1 = sample1;
6773 float last_sample0 = sample0;
6774 while (dst >= target) {
6775 dst[3] = SDL_SwapFloatBE(sample3);
6776 dst[2] = SDL_SwapFloatBE(sample2);
6777 dst[1] = SDL_SwapFloatBE(sample1);
6778 dst[0] = SDL_SwapFloatBE(sample0);
6781 if ((eps << 1) >= dstsize) {
6783 sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
6784 sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
6785 sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
6786 sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
6787 last_sample3 = sample3;
6788 last_sample2 = sample2;
6789 last_sample1 = sample1;
6790 last_sample0 = sample0;
6794 cvt->len_cvt = dstsize;
6795 if (cvt->filters[++cvt->filter_index]) {
6796 cvt->filters[cvt->filter_index] (cvt, format);
6801 SDL_Downsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6804 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr);
6807 const int srcsize = cvt->len_cvt - 256;
6808 const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
6809 register int eps = 0;
6810 float *dst = (float *) cvt->buf;
6811 const float *src = (float *) cvt->buf;
6812 const float *target = (const float *) (cvt->buf + dstsize);
6813 float sample0 = SDL_SwapFloatBE(src[0]);
6814 float sample1 = SDL_SwapFloatBE(src[1]);
6815 float sample2 = SDL_SwapFloatBE(src[2]);
6816 float sample3 = SDL_SwapFloatBE(src[3]);
6817 float last_sample0 = sample0;
6818 float last_sample1 = sample1;
6819 float last_sample2 = sample2;
6820 float last_sample3 = sample3;
6821 while (dst < target) {
6824 if ((eps << 1) >= srcsize) {
6825 dst[0] = SDL_SwapFloatBE(sample0);
6826 dst[1] = SDL_SwapFloatBE(sample1);
6827 dst[2] = SDL_SwapFloatBE(sample2);
6828 dst[3] = SDL_SwapFloatBE(sample3);
6830 sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
6831 sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
6832 sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
6833 sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
6834 last_sample0 = sample0;
6835 last_sample1 = sample1;
6836 last_sample2 = sample2;
6837 last_sample3 = sample3;
6841 cvt->len_cvt = dstsize;
6842 if (cvt->filters[++cvt->filter_index]) {
6843 cvt->filters[cvt->filter_index] (cvt, format);
6848 SDL_Upsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6851 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr);
6854 const int srcsize = cvt->len_cvt - 384;
6855 const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
6856 register int eps = 0;
6857 float *dst = ((float *) (cvt->buf + dstsize)) - 6;
6858 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
6859 const float *target = ((const float *) cvt->buf);
6860 float sample5 = SDL_SwapFloatBE(src[5]);
6861 float sample4 = SDL_SwapFloatBE(src[4]);
6862 float sample3 = SDL_SwapFloatBE(src[3]);
6863 float sample2 = SDL_SwapFloatBE(src[2]);
6864 float sample1 = SDL_SwapFloatBE(src[1]);
6865 float sample0 = SDL_SwapFloatBE(src[0]);
6866 float last_sample5 = sample5;
6867 float last_sample4 = sample4;
6868 float last_sample3 = sample3;
6869 float last_sample2 = sample2;
6870 float last_sample1 = sample1;
6871 float last_sample0 = sample0;
6872 while (dst >= target) {
6873 dst[5] = SDL_SwapFloatBE(sample5);
6874 dst[4] = SDL_SwapFloatBE(sample4);
6875 dst[3] = SDL_SwapFloatBE(sample3);
6876 dst[2] = SDL_SwapFloatBE(sample2);
6877 dst[1] = SDL_SwapFloatBE(sample1);
6878 dst[0] = SDL_SwapFloatBE(sample0);
6881 if ((eps << 1) >= dstsize) {
6883 sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
6884 sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
6885 sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
6886 sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
6887 sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
6888 sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
6889 last_sample5 = sample5;
6890 last_sample4 = sample4;
6891 last_sample3 = sample3;
6892 last_sample2 = sample2;
6893 last_sample1 = sample1;
6894 last_sample0 = sample0;
6898 cvt->len_cvt = dstsize;
6899 if (cvt->filters[++cvt->filter_index]) {
6900 cvt->filters[cvt->filter_index] (cvt, format);
6905 SDL_Downsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6908 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr);
6911 const int srcsize = cvt->len_cvt - 384;
6912 const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
6913 register int eps = 0;
6914 float *dst = (float *) cvt->buf;
6915 const float *src = (float *) cvt->buf;
6916 const float *target = (const float *) (cvt->buf + dstsize);
6917 float sample0 = SDL_SwapFloatBE(src[0]);
6918 float sample1 = SDL_SwapFloatBE(src[1]);
6919 float sample2 = SDL_SwapFloatBE(src[2]);
6920 float sample3 = SDL_SwapFloatBE(src[3]);
6921 float sample4 = SDL_SwapFloatBE(src[4]);
6922 float sample5 = SDL_SwapFloatBE(src[5]);
6923 float last_sample0 = sample0;
6924 float last_sample1 = sample1;
6925 float last_sample2 = sample2;
6926 float last_sample3 = sample3;
6927 float last_sample4 = sample4;
6928 float last_sample5 = sample5;
6929 while (dst < target) {
6932 if ((eps << 1) >= srcsize) {
6933 dst[0] = SDL_SwapFloatBE(sample0);
6934 dst[1] = SDL_SwapFloatBE(sample1);
6935 dst[2] = SDL_SwapFloatBE(sample2);
6936 dst[3] = SDL_SwapFloatBE(sample3);
6937 dst[4] = SDL_SwapFloatBE(sample4);
6938 dst[5] = SDL_SwapFloatBE(sample5);
6940 sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
6941 sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
6942 sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
6943 sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
6944 sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
6945 sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
6946 last_sample0 = sample0;
6947 last_sample1 = sample1;
6948 last_sample2 = sample2;
6949 last_sample3 = sample3;
6950 last_sample4 = sample4;
6951 last_sample5 = sample5;
6955 cvt->len_cvt = dstsize;
6956 if (cvt->filters[++cvt->filter_index]) {
6957 cvt->filters[cvt->filter_index] (cvt, format);
6962 SDL_Upsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
6965 fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr);
6968 const int srcsize = cvt->len_cvt - 512;
6969 const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
6970 register int eps = 0;
6971 float *dst = ((float *) (cvt->buf + dstsize)) - 8;
6972 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
6973 const float *target = ((const float *) cvt->buf);
6974 float sample7 = SDL_SwapFloatBE(src[7]);
6975 float sample6 = SDL_SwapFloatBE(src[6]);
6976 float sample5 = SDL_SwapFloatBE(src[5]);
6977 float sample4 = SDL_SwapFloatBE(src[4]);
6978 float sample3 = SDL_SwapFloatBE(src[3]);
6979 float sample2 = SDL_SwapFloatBE(src[2]);
6980 float sample1 = SDL_SwapFloatBE(src[1]);
6981 float sample0 = SDL_SwapFloatBE(src[0]);
6982 float last_sample7 = sample7;
6983 float last_sample6 = sample6;
6984 float last_sample5 = sample5;
6985 float last_sample4 = sample4;
6986 float last_sample3 = sample3;
6987 float last_sample2 = sample2;
6988 float last_sample1 = sample1;
6989 float last_sample0 = sample0;
6990 while (dst >= target) {
6991 dst[7] = SDL_SwapFloatBE(sample7);
6992 dst[6] = SDL_SwapFloatBE(sample6);
6993 dst[5] = SDL_SwapFloatBE(sample5);
6994 dst[4] = SDL_SwapFloatBE(sample4);
6995 dst[3] = SDL_SwapFloatBE(sample3);
6996 dst[2] = SDL_SwapFloatBE(sample2);
6997 dst[1] = SDL_SwapFloatBE(sample1);
6998 dst[0] = SDL_SwapFloatBE(sample0);
7001 if ((eps << 1) >= dstsize) {
7003 sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5);
7004 sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5);
7005 sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
7006 sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
7007 sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
7008 sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
7009 sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
7010 sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
7011 last_sample7 = sample7;
7012 last_sample6 = sample6;
7013 last_sample5 = sample5;
7014 last_sample4 = sample4;
7015 last_sample3 = sample3;
7016 last_sample2 = sample2;
7017 last_sample1 = sample1;
7018 last_sample0 = sample0;
7022 cvt->len_cvt = dstsize;
7023 if (cvt->filters[++cvt->filter_index]) {
7024 cvt->filters[cvt->filter_index] (cvt, format);
7029 SDL_Downsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7032 fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr);
7035 const int srcsize = cvt->len_cvt - 512;
7036 const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
7037 register int eps = 0;
7038 float *dst = (float *) cvt->buf;
7039 const float *src = (float *) cvt->buf;
7040 const float *target = (const float *) (cvt->buf + dstsize);
7041 float sample0 = SDL_SwapFloatBE(src[0]);
7042 float sample1 = SDL_SwapFloatBE(src[1]);
7043 float sample2 = SDL_SwapFloatBE(src[2]);
7044 float sample3 = SDL_SwapFloatBE(src[3]);
7045 float sample4 = SDL_SwapFloatBE(src[4]);
7046 float sample5 = SDL_SwapFloatBE(src[5]);
7047 float sample6 = SDL_SwapFloatBE(src[6]);
7048 float sample7 = SDL_SwapFloatBE(src[7]);
7049 float last_sample0 = sample0;
7050 float last_sample1 = sample1;
7051 float last_sample2 = sample2;
7052 float last_sample3 = sample3;
7053 float last_sample4 = sample4;
7054 float last_sample5 = sample5;
7055 float last_sample6 = sample6;
7056 float last_sample7 = sample7;
7057 while (dst < target) {
7060 if ((eps << 1) >= srcsize) {
7061 dst[0] = SDL_SwapFloatBE(sample0);
7062 dst[1] = SDL_SwapFloatBE(sample1);
7063 dst[2] = SDL_SwapFloatBE(sample2);
7064 dst[3] = SDL_SwapFloatBE(sample3);
7065 dst[4] = SDL_SwapFloatBE(sample4);
7066 dst[5] = SDL_SwapFloatBE(sample5);
7067 dst[6] = SDL_SwapFloatBE(sample6);
7068 dst[7] = SDL_SwapFloatBE(sample7);
7070 sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
7071 sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
7072 sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
7073 sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
7074 sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
7075 sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
7076 sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5);
7077 sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5);
7078 last_sample0 = sample0;
7079 last_sample1 = sample1;
7080 last_sample2 = sample2;
7081 last_sample3 = sample3;
7082 last_sample4 = sample4;
7083 last_sample5 = sample5;
7084 last_sample6 = sample6;
7085 last_sample7 = sample7;
7089 cvt->len_cvt = dstsize;
7090 if (cvt->filters[++cvt->filter_index]) {
7091 cvt->filters[cvt->filter_index] (cvt, format);
7096 #if !LESS_RESAMPLERS
7099 SDL_Upsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7102 fprintf(stderr, "Upsample (x2) AUDIO_U8, 1 channels.\n");
7105 const int dstsize = cvt->len_cvt * 2;
7106 Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 2;
7107 const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
7108 const Uint8 *target = ((const Uint8 *) cvt->buf);
7109 Sint16 last_sample0 = (Sint16) src[0];
7110 while (dst >= target) {
7111 const Sint16 sample0 = (Sint16) src[0];
7113 dst[1] = (Uint8) ((sample0 + last_sample0) >> 1);
7114 dst[0] = (Uint8) sample0;
7115 last_sample0 = sample0;
7119 cvt->len_cvt = dstsize;
7120 if (cvt->filters[++cvt->filter_index]) {
7121 cvt->filters[cvt->filter_index] (cvt, format);
7126 SDL_Downsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7129 fprintf(stderr, "Downsample (x2) AUDIO_U8, 1 channels.\n");
7132 const int dstsize = cvt->len_cvt / 2;
7133 Uint8 *dst = (Uint8 *) cvt->buf;
7134 const Uint8 *src = (Uint8 *) cvt->buf;
7135 const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
7136 Sint16 last_sample0 = (Sint16) src[0];
7137 while (dst < target) {
7138 const Sint16 sample0 = (Sint16) src[0];
7140 dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
7141 last_sample0 = sample0;
7145 cvt->len_cvt = dstsize;
7146 if (cvt->filters[++cvt->filter_index]) {
7147 cvt->filters[cvt->filter_index] (cvt, format);
7152 SDL_Upsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7155 fprintf(stderr, "Upsample (x4) AUDIO_U8, 1 channels.\n");
7158 const int dstsize = cvt->len_cvt * 4;
7159 Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 4;
7160 const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
7161 const Uint8 *target = ((const Uint8 *) cvt->buf);
7162 Sint16 last_sample0 = (Sint16) src[0];
7163 while (dst >= target) {
7164 const Sint16 sample0 = (Sint16) src[0];
7166 dst[3] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
7167 dst[2] = (Uint8) ((sample0 + last_sample0) >> 1);
7168 dst[1] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
7169 dst[0] = (Uint8) sample0;
7170 last_sample0 = sample0;
7174 cvt->len_cvt = dstsize;
7175 if (cvt->filters[++cvt->filter_index]) {
7176 cvt->filters[cvt->filter_index] (cvt, format);
7181 SDL_Downsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7184 fprintf(stderr, "Downsample (x4) AUDIO_U8, 1 channels.\n");
7187 const int dstsize = cvt->len_cvt / 4;
7188 Uint8 *dst = (Uint8 *) cvt->buf;
7189 const Uint8 *src = (Uint8 *) cvt->buf;
7190 const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
7191 Sint16 last_sample0 = (Sint16) src[0];
7192 while (dst < target) {
7193 const Sint16 sample0 = (Sint16) src[0];
7195 dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
7196 last_sample0 = sample0;
7200 cvt->len_cvt = dstsize;
7201 if (cvt->filters[++cvt->filter_index]) {
7202 cvt->filters[cvt->filter_index] (cvt, format);
7207 SDL_Upsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7210 fprintf(stderr, "Upsample (x2) AUDIO_U8, 2 channels.\n");
7213 const int dstsize = cvt->len_cvt * 2;
7214 Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 2;
7215 const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
7216 const Uint8 *target = ((const Uint8 *) cvt->buf);
7217 Sint16 last_sample1 = (Sint16) src[1];
7218 Sint16 last_sample0 = (Sint16) src[0];
7219 while (dst >= target) {
7220 const Sint16 sample1 = (Sint16) src[1];
7221 const Sint16 sample0 = (Sint16) src[0];
7223 dst[3] = (Uint8) ((sample1 + last_sample1) >> 1);
7224 dst[2] = (Uint8) ((sample0 + last_sample0) >> 1);
7225 dst[1] = (Uint8) sample1;
7226 dst[0] = (Uint8) sample0;
7227 last_sample1 = sample1;
7228 last_sample0 = sample0;
7232 cvt->len_cvt = dstsize;
7233 if (cvt->filters[++cvt->filter_index]) {
7234 cvt->filters[cvt->filter_index] (cvt, format);
7239 SDL_Downsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7242 fprintf(stderr, "Downsample (x2) AUDIO_U8, 2 channels.\n");
7245 const int dstsize = cvt->len_cvt / 2;
7246 Uint8 *dst = (Uint8 *) cvt->buf;
7247 const Uint8 *src = (Uint8 *) cvt->buf;
7248 const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
7249 Sint16 last_sample0 = (Sint16) src[0];
7250 Sint16 last_sample1 = (Sint16) src[1];
7251 while (dst < target) {
7252 const Sint16 sample0 = (Sint16) src[0];
7253 const Sint16 sample1 = (Sint16) src[1];
7255 dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
7256 dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
7257 last_sample0 = sample0;
7258 last_sample1 = sample1;
7262 cvt->len_cvt = dstsize;
7263 if (cvt->filters[++cvt->filter_index]) {
7264 cvt->filters[cvt->filter_index] (cvt, format);
7269 SDL_Upsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7272 fprintf(stderr, "Upsample (x4) AUDIO_U8, 2 channels.\n");
7275 const int dstsize = cvt->len_cvt * 4;
7276 Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 4;
7277 const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
7278 const Uint8 *target = ((const Uint8 *) cvt->buf);
7279 Sint16 last_sample1 = (Sint16) src[1];
7280 Sint16 last_sample0 = (Sint16) src[0];
7281 while (dst >= target) {
7282 const Sint16 sample1 = (Sint16) src[1];
7283 const Sint16 sample0 = (Sint16) src[0];
7285 dst[7] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
7286 dst[6] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
7287 dst[5] = (Uint8) ((sample1 + last_sample1) >> 1);
7288 dst[4] = (Uint8) ((sample0 + last_sample0) >> 1);
7289 dst[3] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
7290 dst[2] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
7291 dst[1] = (Uint8) sample1;
7292 dst[0] = (Uint8) sample0;
7293 last_sample1 = sample1;
7294 last_sample0 = sample0;
7298 cvt->len_cvt = dstsize;
7299 if (cvt->filters[++cvt->filter_index]) {
7300 cvt->filters[cvt->filter_index] (cvt, format);
7305 SDL_Downsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7308 fprintf(stderr, "Downsample (x4) AUDIO_U8, 2 channels.\n");
7311 const int dstsize = cvt->len_cvt / 4;
7312 Uint8 *dst = (Uint8 *) cvt->buf;
7313 const Uint8 *src = (Uint8 *) cvt->buf;
7314 const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
7315 Sint16 last_sample0 = (Sint16) src[0];
7316 Sint16 last_sample1 = (Sint16) src[1];
7317 while (dst < target) {
7318 const Sint16 sample0 = (Sint16) src[0];
7319 const Sint16 sample1 = (Sint16) src[1];
7321 dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
7322 dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
7323 last_sample0 = sample0;
7324 last_sample1 = sample1;
7328 cvt->len_cvt = dstsize;
7329 if (cvt->filters[++cvt->filter_index]) {
7330 cvt->filters[cvt->filter_index] (cvt, format);
7335 SDL_Upsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7338 fprintf(stderr, "Upsample (x2) AUDIO_U8, 4 channels.\n");
7341 const int dstsize = cvt->len_cvt * 2;
7342 Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 2;
7343 const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
7344 const Uint8 *target = ((const Uint8 *) cvt->buf);
7345 Sint16 last_sample3 = (Sint16) src[3];
7346 Sint16 last_sample2 = (Sint16) src[2];
7347 Sint16 last_sample1 = (Sint16) src[1];
7348 Sint16 last_sample0 = (Sint16) src[0];
7349 while (dst >= target) {
7350 const Sint16 sample3 = (Sint16) src[3];
7351 const Sint16 sample2 = (Sint16) src[2];
7352 const Sint16 sample1 = (Sint16) src[1];
7353 const Sint16 sample0 = (Sint16) src[0];
7355 dst[7] = (Uint8) ((sample3 + last_sample3) >> 1);
7356 dst[6] = (Uint8) ((sample2 + last_sample2) >> 1);
7357 dst[5] = (Uint8) ((sample1 + last_sample1) >> 1);
7358 dst[4] = (Uint8) ((sample0 + last_sample0) >> 1);
7359 dst[3] = (Uint8) sample3;
7360 dst[2] = (Uint8) sample2;
7361 dst[1] = (Uint8) sample1;
7362 dst[0] = (Uint8) sample0;
7363 last_sample3 = sample3;
7364 last_sample2 = sample2;
7365 last_sample1 = sample1;
7366 last_sample0 = sample0;
7370 cvt->len_cvt = dstsize;
7371 if (cvt->filters[++cvt->filter_index]) {
7372 cvt->filters[cvt->filter_index] (cvt, format);
7377 SDL_Downsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7380 fprintf(stderr, "Downsample (x2) AUDIO_U8, 4 channels.\n");
7383 const int dstsize = cvt->len_cvt / 2;
7384 Uint8 *dst = (Uint8 *) cvt->buf;
7385 const Uint8 *src = (Uint8 *) cvt->buf;
7386 const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
7387 Sint16 last_sample0 = (Sint16) src[0];
7388 Sint16 last_sample1 = (Sint16) src[1];
7389 Sint16 last_sample2 = (Sint16) src[2];
7390 Sint16 last_sample3 = (Sint16) src[3];
7391 while (dst < target) {
7392 const Sint16 sample0 = (Sint16) src[0];
7393 const Sint16 sample1 = (Sint16) src[1];
7394 const Sint16 sample2 = (Sint16) src[2];
7395 const Sint16 sample3 = (Sint16) src[3];
7397 dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
7398 dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
7399 dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
7400 dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
7401 last_sample0 = sample0;
7402 last_sample1 = sample1;
7403 last_sample2 = sample2;
7404 last_sample3 = sample3;
7408 cvt->len_cvt = dstsize;
7409 if (cvt->filters[++cvt->filter_index]) {
7410 cvt->filters[cvt->filter_index] (cvt, format);
7415 SDL_Upsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7418 fprintf(stderr, "Upsample (x4) AUDIO_U8, 4 channels.\n");
7421 const int dstsize = cvt->len_cvt * 4;
7422 Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 4;
7423 const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
7424 const Uint8 *target = ((const Uint8 *) cvt->buf);
7425 Sint16 last_sample3 = (Sint16) src[3];
7426 Sint16 last_sample2 = (Sint16) src[2];
7427 Sint16 last_sample1 = (Sint16) src[1];
7428 Sint16 last_sample0 = (Sint16) src[0];
7429 while (dst >= target) {
7430 const Sint16 sample3 = (Sint16) src[3];
7431 const Sint16 sample2 = (Sint16) src[2];
7432 const Sint16 sample1 = (Sint16) src[1];
7433 const Sint16 sample0 = (Sint16) src[0];
7435 dst[15] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2);
7436 dst[14] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2);
7437 dst[13] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
7438 dst[12] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
7439 dst[11] = (Uint8) ((sample3 + last_sample3) >> 1);
7440 dst[10] = (Uint8) ((sample2 + last_sample2) >> 1);
7441 dst[9] = (Uint8) ((sample1 + last_sample1) >> 1);
7442 dst[8] = (Uint8) ((sample0 + last_sample0) >> 1);
7443 dst[7] = (Uint8) (((3 * sample3) + last_sample3) >> 2);
7444 dst[6] = (Uint8) (((3 * sample2) + last_sample2) >> 2);
7445 dst[5] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
7446 dst[4] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
7447 dst[3] = (Uint8) sample3;
7448 dst[2] = (Uint8) sample2;
7449 dst[1] = (Uint8) sample1;
7450 dst[0] = (Uint8) sample0;
7451 last_sample3 = sample3;
7452 last_sample2 = sample2;
7453 last_sample1 = sample1;
7454 last_sample0 = sample0;
7458 cvt->len_cvt = dstsize;
7459 if (cvt->filters[++cvt->filter_index]) {
7460 cvt->filters[cvt->filter_index] (cvt, format);
7465 SDL_Downsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7468 fprintf(stderr, "Downsample (x4) AUDIO_U8, 4 channels.\n");
7471 const int dstsize = cvt->len_cvt / 4;
7472 Uint8 *dst = (Uint8 *) cvt->buf;
7473 const Uint8 *src = (Uint8 *) cvt->buf;
7474 const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
7475 Sint16 last_sample0 = (Sint16) src[0];
7476 Sint16 last_sample1 = (Sint16) src[1];
7477 Sint16 last_sample2 = (Sint16) src[2];
7478 Sint16 last_sample3 = (Sint16) src[3];
7479 while (dst < target) {
7480 const Sint16 sample0 = (Sint16) src[0];
7481 const Sint16 sample1 = (Sint16) src[1];
7482 const Sint16 sample2 = (Sint16) src[2];
7483 const Sint16 sample3 = (Sint16) src[3];
7485 dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
7486 dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
7487 dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
7488 dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
7489 last_sample0 = sample0;
7490 last_sample1 = sample1;
7491 last_sample2 = sample2;
7492 last_sample3 = sample3;
7496 cvt->len_cvt = dstsize;
7497 if (cvt->filters[++cvt->filter_index]) {
7498 cvt->filters[cvt->filter_index] (cvt, format);
7503 SDL_Upsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7506 fprintf(stderr, "Upsample (x2) AUDIO_U8, 6 channels.\n");
7509 const int dstsize = cvt->len_cvt * 2;
7510 Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6 * 2;
7511 const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
7512 const Uint8 *target = ((const Uint8 *) cvt->buf);
7513 Sint16 last_sample5 = (Sint16) src[5];
7514 Sint16 last_sample4 = (Sint16) src[4];
7515 Sint16 last_sample3 = (Sint16) src[3];
7516 Sint16 last_sample2 = (Sint16) src[2];
7517 Sint16 last_sample1 = (Sint16) src[1];
7518 Sint16 last_sample0 = (Sint16) src[0];
7519 while (dst >= target) {
7520 const Sint16 sample5 = (Sint16) src[5];
7521 const Sint16 sample4 = (Sint16) src[4];
7522 const Sint16 sample3 = (Sint16) src[3];
7523 const Sint16 sample2 = (Sint16) src[2];
7524 const Sint16 sample1 = (Sint16) src[1];
7525 const Sint16 sample0 = (Sint16) src[0];
7527 dst[11] = (Uint8) ((sample5 + last_sample5) >> 1);
7528 dst[10] = (Uint8) ((sample4 + last_sample4) >> 1);
7529 dst[9] = (Uint8) ((sample3 + last_sample3) >> 1);
7530 dst[8] = (Uint8) ((sample2 + last_sample2) >> 1);
7531 dst[7] = (Uint8) ((sample1 + last_sample1) >> 1);
7532 dst[6] = (Uint8) ((sample0 + last_sample0) >> 1);
7533 dst[5] = (Uint8) sample5;
7534 dst[4] = (Uint8) sample4;
7535 dst[3] = (Uint8) sample3;
7536 dst[2] = (Uint8) sample2;
7537 dst[1] = (Uint8) sample1;
7538 dst[0] = (Uint8) sample0;
7539 last_sample5 = sample5;
7540 last_sample4 = sample4;
7541 last_sample3 = sample3;
7542 last_sample2 = sample2;
7543 last_sample1 = sample1;
7544 last_sample0 = sample0;
7548 cvt->len_cvt = dstsize;
7549 if (cvt->filters[++cvt->filter_index]) {
7550 cvt->filters[cvt->filter_index] (cvt, format);
7555 SDL_Downsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7558 fprintf(stderr, "Downsample (x2) AUDIO_U8, 6 channels.\n");
7561 const int dstsize = cvt->len_cvt / 2;
7562 Uint8 *dst = (Uint8 *) cvt->buf;
7563 const Uint8 *src = (Uint8 *) cvt->buf;
7564 const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
7565 Sint16 last_sample0 = (Sint16) src[0];
7566 Sint16 last_sample1 = (Sint16) src[1];
7567 Sint16 last_sample2 = (Sint16) src[2];
7568 Sint16 last_sample3 = (Sint16) src[3];
7569 Sint16 last_sample4 = (Sint16) src[4];
7570 Sint16 last_sample5 = (Sint16) src[5];
7571 while (dst < target) {
7572 const Sint16 sample0 = (Sint16) src[0];
7573 const Sint16 sample1 = (Sint16) src[1];
7574 const Sint16 sample2 = (Sint16) src[2];
7575 const Sint16 sample3 = (Sint16) src[3];
7576 const Sint16 sample4 = (Sint16) src[4];
7577 const Sint16 sample5 = (Sint16) src[5];
7579 dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
7580 dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
7581 dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
7582 dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
7583 dst[4] = (Uint8) ((sample4 + last_sample4) >> 1);
7584 dst[5] = (Uint8) ((sample5 + last_sample5) >> 1);
7585 last_sample0 = sample0;
7586 last_sample1 = sample1;
7587 last_sample2 = sample2;
7588 last_sample3 = sample3;
7589 last_sample4 = sample4;
7590 last_sample5 = sample5;
7594 cvt->len_cvt = dstsize;
7595 if (cvt->filters[++cvt->filter_index]) {
7596 cvt->filters[cvt->filter_index] (cvt, format);
7601 SDL_Upsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7604 fprintf(stderr, "Upsample (x4) AUDIO_U8, 6 channels.\n");
7607 const int dstsize = cvt->len_cvt * 4;
7608 Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6 * 4;
7609 const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
7610 const Uint8 *target = ((const Uint8 *) cvt->buf);
7611 Sint16 last_sample5 = (Sint16) src[5];
7612 Sint16 last_sample4 = (Sint16) src[4];
7613 Sint16 last_sample3 = (Sint16) src[3];
7614 Sint16 last_sample2 = (Sint16) src[2];
7615 Sint16 last_sample1 = (Sint16) src[1];
7616 Sint16 last_sample0 = (Sint16) src[0];
7617 while (dst >= target) {
7618 const Sint16 sample5 = (Sint16) src[5];
7619 const Sint16 sample4 = (Sint16) src[4];
7620 const Sint16 sample3 = (Sint16) src[3];
7621 const Sint16 sample2 = (Sint16) src[2];
7622 const Sint16 sample1 = (Sint16) src[1];
7623 const Sint16 sample0 = (Sint16) src[0];
7625 dst[23] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2);
7626 dst[22] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2);
7627 dst[21] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2);
7628 dst[20] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2);
7629 dst[19] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
7630 dst[18] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
7631 dst[17] = (Uint8) ((sample5 + last_sample5) >> 1);
7632 dst[16] = (Uint8) ((sample4 + last_sample4) >> 1);
7633 dst[15] = (Uint8) ((sample3 + last_sample3) >> 1);
7634 dst[14] = (Uint8) ((sample2 + last_sample2) >> 1);
7635 dst[13] = (Uint8) ((sample1 + last_sample1) >> 1);
7636 dst[12] = (Uint8) ((sample0 + last_sample0) >> 1);
7637 dst[11] = (Uint8) (((3 * sample5) + last_sample5) >> 2);
7638 dst[10] = (Uint8) (((3 * sample4) + last_sample4) >> 2);
7639 dst[9] = (Uint8) (((3 * sample3) + last_sample3) >> 2);
7640 dst[8] = (Uint8) (((3 * sample2) + last_sample2) >> 2);
7641 dst[7] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
7642 dst[6] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
7643 dst[5] = (Uint8) sample5;
7644 dst[4] = (Uint8) sample4;
7645 dst[3] = (Uint8) sample3;
7646 dst[2] = (Uint8) sample2;
7647 dst[1] = (Uint8) sample1;
7648 dst[0] = (Uint8) sample0;
7649 last_sample5 = sample5;
7650 last_sample4 = sample4;
7651 last_sample3 = sample3;
7652 last_sample2 = sample2;
7653 last_sample1 = sample1;
7654 last_sample0 = sample0;
7658 cvt->len_cvt = dstsize;
7659 if (cvt->filters[++cvt->filter_index]) {
7660 cvt->filters[cvt->filter_index] (cvt, format);
7665 SDL_Downsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7668 fprintf(stderr, "Downsample (x4) AUDIO_U8, 6 channels.\n");
7671 const int dstsize = cvt->len_cvt / 4;
7672 Uint8 *dst = (Uint8 *) cvt->buf;
7673 const Uint8 *src = (Uint8 *) cvt->buf;
7674 const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
7675 Sint16 last_sample0 = (Sint16) src[0];
7676 Sint16 last_sample1 = (Sint16) src[1];
7677 Sint16 last_sample2 = (Sint16) src[2];
7678 Sint16 last_sample3 = (Sint16) src[3];
7679 Sint16 last_sample4 = (Sint16) src[4];
7680 Sint16 last_sample5 = (Sint16) src[5];
7681 while (dst < target) {
7682 const Sint16 sample0 = (Sint16) src[0];
7683 const Sint16 sample1 = (Sint16) src[1];
7684 const Sint16 sample2 = (Sint16) src[2];
7685 const Sint16 sample3 = (Sint16) src[3];
7686 const Sint16 sample4 = (Sint16) src[4];
7687 const Sint16 sample5 = (Sint16) src[5];
7689 dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
7690 dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
7691 dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
7692 dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
7693 dst[4] = (Uint8) ((sample4 + last_sample4) >> 1);
7694 dst[5] = (Uint8) ((sample5 + last_sample5) >> 1);
7695 last_sample0 = sample0;
7696 last_sample1 = sample1;
7697 last_sample2 = sample2;
7698 last_sample3 = sample3;
7699 last_sample4 = sample4;
7700 last_sample5 = sample5;
7704 cvt->len_cvt = dstsize;
7705 if (cvt->filters[++cvt->filter_index]) {
7706 cvt->filters[cvt->filter_index] (cvt, format);
7711 SDL_Upsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7714 fprintf(stderr, "Upsample (x2) AUDIO_U8, 8 channels.\n");
7717 const int dstsize = cvt->len_cvt * 2;
7718 Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8 * 2;
7719 const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
7720 const Uint8 *target = ((const Uint8 *) cvt->buf);
7721 Sint16 last_sample7 = (Sint16) src[7];
7722 Sint16 last_sample6 = (Sint16) src[6];
7723 Sint16 last_sample5 = (Sint16) src[5];
7724 Sint16 last_sample4 = (Sint16) src[4];
7725 Sint16 last_sample3 = (Sint16) src[3];
7726 Sint16 last_sample2 = (Sint16) src[2];
7727 Sint16 last_sample1 = (Sint16) src[1];
7728 Sint16 last_sample0 = (Sint16) src[0];
7729 while (dst >= target) {
7730 const Sint16 sample7 = (Sint16) src[7];
7731 const Sint16 sample6 = (Sint16) src[6];
7732 const Sint16 sample5 = (Sint16) src[5];
7733 const Sint16 sample4 = (Sint16) src[4];
7734 const Sint16 sample3 = (Sint16) src[3];
7735 const Sint16 sample2 = (Sint16) src[2];
7736 const Sint16 sample1 = (Sint16) src[1];
7737 const Sint16 sample0 = (Sint16) src[0];
7739 dst[15] = (Uint8) ((sample7 + last_sample7) >> 1);
7740 dst[14] = (Uint8) ((sample6 + last_sample6) >> 1);
7741 dst[13] = (Uint8) ((sample5 + last_sample5) >> 1);
7742 dst[12] = (Uint8) ((sample4 + last_sample4) >> 1);
7743 dst[11] = (Uint8) ((sample3 + last_sample3) >> 1);
7744 dst[10] = (Uint8) ((sample2 + last_sample2) >> 1);
7745 dst[9] = (Uint8) ((sample1 + last_sample1) >> 1);
7746 dst[8] = (Uint8) ((sample0 + last_sample0) >> 1);
7747 dst[7] = (Uint8) sample7;
7748 dst[6] = (Uint8) sample6;
7749 dst[5] = (Uint8) sample5;
7750 dst[4] = (Uint8) sample4;
7751 dst[3] = (Uint8) sample3;
7752 dst[2] = (Uint8) sample2;
7753 dst[1] = (Uint8) sample1;
7754 dst[0] = (Uint8) sample0;
7755 last_sample7 = sample7;
7756 last_sample6 = sample6;
7757 last_sample5 = sample5;
7758 last_sample4 = sample4;
7759 last_sample3 = sample3;
7760 last_sample2 = sample2;
7761 last_sample1 = sample1;
7762 last_sample0 = sample0;
7766 cvt->len_cvt = dstsize;
7767 if (cvt->filters[++cvt->filter_index]) {
7768 cvt->filters[cvt->filter_index] (cvt, format);
7773 SDL_Downsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7776 fprintf(stderr, "Downsample (x2) AUDIO_U8, 8 channels.\n");
7779 const int dstsize = cvt->len_cvt / 2;
7780 Uint8 *dst = (Uint8 *) cvt->buf;
7781 const Uint8 *src = (Uint8 *) cvt->buf;
7782 const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
7783 Sint16 last_sample0 = (Sint16) src[0];
7784 Sint16 last_sample1 = (Sint16) src[1];
7785 Sint16 last_sample2 = (Sint16) src[2];
7786 Sint16 last_sample3 = (Sint16) src[3];
7787 Sint16 last_sample4 = (Sint16) src[4];
7788 Sint16 last_sample5 = (Sint16) src[5];
7789 Sint16 last_sample6 = (Sint16) src[6];
7790 Sint16 last_sample7 = (Sint16) src[7];
7791 while (dst < target) {
7792 const Sint16 sample0 = (Sint16) src[0];
7793 const Sint16 sample1 = (Sint16) src[1];
7794 const Sint16 sample2 = (Sint16) src[2];
7795 const Sint16 sample3 = (Sint16) src[3];
7796 const Sint16 sample4 = (Sint16) src[4];
7797 const Sint16 sample5 = (Sint16) src[5];
7798 const Sint16 sample6 = (Sint16) src[6];
7799 const Sint16 sample7 = (Sint16) src[7];
7801 dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
7802 dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
7803 dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
7804 dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
7805 dst[4] = (Uint8) ((sample4 + last_sample4) >> 1);
7806 dst[5] = (Uint8) ((sample5 + last_sample5) >> 1);
7807 dst[6] = (Uint8) ((sample6 + last_sample6) >> 1);
7808 dst[7] = (Uint8) ((sample7 + last_sample7) >> 1);
7809 last_sample0 = sample0;
7810 last_sample1 = sample1;
7811 last_sample2 = sample2;
7812 last_sample3 = sample3;
7813 last_sample4 = sample4;
7814 last_sample5 = sample5;
7815 last_sample6 = sample6;
7816 last_sample7 = sample7;
7820 cvt->len_cvt = dstsize;
7821 if (cvt->filters[++cvt->filter_index]) {
7822 cvt->filters[cvt->filter_index] (cvt, format);
7827 SDL_Upsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7830 fprintf(stderr, "Upsample (x4) AUDIO_U8, 8 channels.\n");
7833 const int dstsize = cvt->len_cvt * 4;
7834 Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8 * 4;
7835 const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
7836 const Uint8 *target = ((const Uint8 *) cvt->buf);
7837 Sint16 last_sample7 = (Sint16) src[7];
7838 Sint16 last_sample6 = (Sint16) src[6];
7839 Sint16 last_sample5 = (Sint16) src[5];
7840 Sint16 last_sample4 = (Sint16) src[4];
7841 Sint16 last_sample3 = (Sint16) src[3];
7842 Sint16 last_sample2 = (Sint16) src[2];
7843 Sint16 last_sample1 = (Sint16) src[1];
7844 Sint16 last_sample0 = (Sint16) src[0];
7845 while (dst >= target) {
7846 const Sint16 sample7 = (Sint16) src[7];
7847 const Sint16 sample6 = (Sint16) src[6];
7848 const Sint16 sample5 = (Sint16) src[5];
7849 const Sint16 sample4 = (Sint16) src[4];
7850 const Sint16 sample3 = (Sint16) src[3];
7851 const Sint16 sample2 = (Sint16) src[2];
7852 const Sint16 sample1 = (Sint16) src[1];
7853 const Sint16 sample0 = (Sint16) src[0];
7855 dst[31] = (Uint8) ((sample7 + (3 * last_sample7)) >> 2);
7856 dst[30] = (Uint8) ((sample6 + (3 * last_sample6)) >> 2);
7857 dst[29] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2);
7858 dst[28] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2);
7859 dst[27] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2);
7860 dst[26] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2);
7861 dst[25] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
7862 dst[24] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
7863 dst[23] = (Uint8) ((sample7 + last_sample7) >> 1);
7864 dst[22] = (Uint8) ((sample6 + last_sample6) >> 1);
7865 dst[21] = (Uint8) ((sample5 + last_sample5) >> 1);
7866 dst[20] = (Uint8) ((sample4 + last_sample4) >> 1);
7867 dst[19] = (Uint8) ((sample3 + last_sample3) >> 1);
7868 dst[18] = (Uint8) ((sample2 + last_sample2) >> 1);
7869 dst[17] = (Uint8) ((sample1 + last_sample1) >> 1);
7870 dst[16] = (Uint8) ((sample0 + last_sample0) >> 1);
7871 dst[15] = (Uint8) (((3 * sample7) + last_sample7) >> 2);
7872 dst[14] = (Uint8) (((3 * sample6) + last_sample6) >> 2);
7873 dst[13] = (Uint8) (((3 * sample5) + last_sample5) >> 2);
7874 dst[12] = (Uint8) (((3 * sample4) + last_sample4) >> 2);
7875 dst[11] = (Uint8) (((3 * sample3) + last_sample3) >> 2);
7876 dst[10] = (Uint8) (((3 * sample2) + last_sample2) >> 2);
7877 dst[9] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
7878 dst[8] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
7879 dst[7] = (Uint8) sample7;
7880 dst[6] = (Uint8) sample6;
7881 dst[5] = (Uint8) sample5;
7882 dst[4] = (Uint8) sample4;
7883 dst[3] = (Uint8) sample3;
7884 dst[2] = (Uint8) sample2;
7885 dst[1] = (Uint8) sample1;
7886 dst[0] = (Uint8) sample0;
7887 last_sample7 = sample7;
7888 last_sample6 = sample6;
7889 last_sample5 = sample5;
7890 last_sample4 = sample4;
7891 last_sample3 = sample3;
7892 last_sample2 = sample2;
7893 last_sample1 = sample1;
7894 last_sample0 = sample0;
7898 cvt->len_cvt = dstsize;
7899 if (cvt->filters[++cvt->filter_index]) {
7900 cvt->filters[cvt->filter_index] (cvt, format);
7905 SDL_Downsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7908 fprintf(stderr, "Downsample (x4) AUDIO_U8, 8 channels.\n");
7911 const int dstsize = cvt->len_cvt / 4;
7912 Uint8 *dst = (Uint8 *) cvt->buf;
7913 const Uint8 *src = (Uint8 *) cvt->buf;
7914 const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
7915 Sint16 last_sample0 = (Sint16) src[0];
7916 Sint16 last_sample1 = (Sint16) src[1];
7917 Sint16 last_sample2 = (Sint16) src[2];
7918 Sint16 last_sample3 = (Sint16) src[3];
7919 Sint16 last_sample4 = (Sint16) src[4];
7920 Sint16 last_sample5 = (Sint16) src[5];
7921 Sint16 last_sample6 = (Sint16) src[6];
7922 Sint16 last_sample7 = (Sint16) src[7];
7923 while (dst < target) {
7924 const Sint16 sample0 = (Sint16) src[0];
7925 const Sint16 sample1 = (Sint16) src[1];
7926 const Sint16 sample2 = (Sint16) src[2];
7927 const Sint16 sample3 = (Sint16) src[3];
7928 const Sint16 sample4 = (Sint16) src[4];
7929 const Sint16 sample5 = (Sint16) src[5];
7930 const Sint16 sample6 = (Sint16) src[6];
7931 const Sint16 sample7 = (Sint16) src[7];
7933 dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
7934 dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
7935 dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
7936 dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
7937 dst[4] = (Uint8) ((sample4 + last_sample4) >> 1);
7938 dst[5] = (Uint8) ((sample5 + last_sample5) >> 1);
7939 dst[6] = (Uint8) ((sample6 + last_sample6) >> 1);
7940 dst[7] = (Uint8) ((sample7 + last_sample7) >> 1);
7941 last_sample0 = sample0;
7942 last_sample1 = sample1;
7943 last_sample2 = sample2;
7944 last_sample3 = sample3;
7945 last_sample4 = sample4;
7946 last_sample5 = sample5;
7947 last_sample6 = sample6;
7948 last_sample7 = sample7;
7952 cvt->len_cvt = dstsize;
7953 if (cvt->filters[++cvt->filter_index]) {
7954 cvt->filters[cvt->filter_index] (cvt, format);
7959 SDL_Upsample_S8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7962 fprintf(stderr, "Upsample (x2) AUDIO_S8, 1 channels.\n");
7965 const int dstsize = cvt->len_cvt * 2;
7966 Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1 * 2;
7967 const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
7968 const Sint8 *target = ((const Sint8 *) cvt->buf);
7969 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
7970 while (dst >= target) {
7971 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
7973 dst[1] = (Sint8) ((sample0 + last_sample0) >> 1);
7974 dst[0] = (Sint8) sample0;
7975 last_sample0 = sample0;
7979 cvt->len_cvt = dstsize;
7980 if (cvt->filters[++cvt->filter_index]) {
7981 cvt->filters[cvt->filter_index] (cvt, format);
7986 SDL_Downsample_S8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
7989 fprintf(stderr, "Downsample (x2) AUDIO_S8, 1 channels.\n");
7992 const int dstsize = cvt->len_cvt / 2;
7993 Sint8 *dst = (Sint8 *) cvt->buf;
7994 const Sint8 *src = (Sint8 *) cvt->buf;
7995 const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
7996 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
7997 while (dst < target) {
7998 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8000 dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
8001 last_sample0 = sample0;
8005 cvt->len_cvt = dstsize;
8006 if (cvt->filters[++cvt->filter_index]) {
8007 cvt->filters[cvt->filter_index] (cvt, format);
8012 SDL_Upsample_S8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8015 fprintf(stderr, "Upsample (x4) AUDIO_S8, 1 channels.\n");
8018 const int dstsize = cvt->len_cvt * 4;
8019 Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1 * 4;
8020 const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
8021 const Sint8 *target = ((const Sint8 *) cvt->buf);
8022 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8023 while (dst >= target) {
8024 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8026 dst[3] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
8027 dst[2] = (Sint8) ((sample0 + last_sample0) >> 1);
8028 dst[1] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
8029 dst[0] = (Sint8) sample0;
8030 last_sample0 = sample0;
8034 cvt->len_cvt = dstsize;
8035 if (cvt->filters[++cvt->filter_index]) {
8036 cvt->filters[cvt->filter_index] (cvt, format);
8041 SDL_Downsample_S8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8044 fprintf(stderr, "Downsample (x4) AUDIO_S8, 1 channels.\n");
8047 const int dstsize = cvt->len_cvt / 4;
8048 Sint8 *dst = (Sint8 *) cvt->buf;
8049 const Sint8 *src = (Sint8 *) cvt->buf;
8050 const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
8051 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8052 while (dst < target) {
8053 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8055 dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
8056 last_sample0 = sample0;
8060 cvt->len_cvt = dstsize;
8061 if (cvt->filters[++cvt->filter_index]) {
8062 cvt->filters[cvt->filter_index] (cvt, format);
8067 SDL_Upsample_S8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8070 fprintf(stderr, "Upsample (x2) AUDIO_S8, 2 channels.\n");
8073 const int dstsize = cvt->len_cvt * 2;
8074 Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2 * 2;
8075 const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
8076 const Sint8 *target = ((const Sint8 *) cvt->buf);
8077 Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
8078 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8079 while (dst >= target) {
8080 const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
8081 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8083 dst[3] = (Sint8) ((sample1 + last_sample1) >> 1);
8084 dst[2] = (Sint8) ((sample0 + last_sample0) >> 1);
8085 dst[1] = (Sint8) sample1;
8086 dst[0] = (Sint8) sample0;
8087 last_sample1 = sample1;
8088 last_sample0 = sample0;
8092 cvt->len_cvt = dstsize;
8093 if (cvt->filters[++cvt->filter_index]) {
8094 cvt->filters[cvt->filter_index] (cvt, format);
8099 SDL_Downsample_S8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8102 fprintf(stderr, "Downsample (x2) AUDIO_S8, 2 channels.\n");
8105 const int dstsize = cvt->len_cvt / 2;
8106 Sint8 *dst = (Sint8 *) cvt->buf;
8107 const Sint8 *src = (Sint8 *) cvt->buf;
8108 const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
8109 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8110 Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
8111 while (dst < target) {
8112 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8113 const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
8115 dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
8116 dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
8117 last_sample0 = sample0;
8118 last_sample1 = sample1;
8122 cvt->len_cvt = dstsize;
8123 if (cvt->filters[++cvt->filter_index]) {
8124 cvt->filters[cvt->filter_index] (cvt, format);
8129 SDL_Upsample_S8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8132 fprintf(stderr, "Upsample (x4) AUDIO_S8, 2 channels.\n");
8135 const int dstsize = cvt->len_cvt * 4;
8136 Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2 * 4;
8137 const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
8138 const Sint8 *target = ((const Sint8 *) cvt->buf);
8139 Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
8140 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8141 while (dst >= target) {
8142 const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
8143 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8145 dst[7] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2);
8146 dst[6] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
8147 dst[5] = (Sint8) ((sample1 + last_sample1) >> 1);
8148 dst[4] = (Sint8) ((sample0 + last_sample0) >> 1);
8149 dst[3] = (Sint8) (((3 * sample1) + last_sample1) >> 2);
8150 dst[2] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
8151 dst[1] = (Sint8) sample1;
8152 dst[0] = (Sint8) sample0;
8153 last_sample1 = sample1;
8154 last_sample0 = sample0;
8158 cvt->len_cvt = dstsize;
8159 if (cvt->filters[++cvt->filter_index]) {
8160 cvt->filters[cvt->filter_index] (cvt, format);
8165 SDL_Downsample_S8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8168 fprintf(stderr, "Downsample (x4) AUDIO_S8, 2 channels.\n");
8171 const int dstsize = cvt->len_cvt / 4;
8172 Sint8 *dst = (Sint8 *) cvt->buf;
8173 const Sint8 *src = (Sint8 *) cvt->buf;
8174 const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
8175 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8176 Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
8177 while (dst < target) {
8178 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8179 const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
8181 dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
8182 dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
8183 last_sample0 = sample0;
8184 last_sample1 = sample1;
8188 cvt->len_cvt = dstsize;
8189 if (cvt->filters[++cvt->filter_index]) {
8190 cvt->filters[cvt->filter_index] (cvt, format);
8195 SDL_Upsample_S8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8198 fprintf(stderr, "Upsample (x2) AUDIO_S8, 4 channels.\n");
8201 const int dstsize = cvt->len_cvt * 2;
8202 Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4 * 2;
8203 const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
8204 const Sint8 *target = ((const Sint8 *) cvt->buf);
8205 Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
8206 Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
8207 Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
8208 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8209 while (dst >= target) {
8210 const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
8211 const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
8212 const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
8213 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8215 dst[7] = (Sint8) ((sample3 + last_sample3) >> 1);
8216 dst[6] = (Sint8) ((sample2 + last_sample2) >> 1);
8217 dst[5] = (Sint8) ((sample1 + last_sample1) >> 1);
8218 dst[4] = (Sint8) ((sample0 + last_sample0) >> 1);
8219 dst[3] = (Sint8) sample3;
8220 dst[2] = (Sint8) sample2;
8221 dst[1] = (Sint8) sample1;
8222 dst[0] = (Sint8) sample0;
8223 last_sample3 = sample3;
8224 last_sample2 = sample2;
8225 last_sample1 = sample1;
8226 last_sample0 = sample0;
8230 cvt->len_cvt = dstsize;
8231 if (cvt->filters[++cvt->filter_index]) {
8232 cvt->filters[cvt->filter_index] (cvt, format);
8237 SDL_Downsample_S8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8240 fprintf(stderr, "Downsample (x2) AUDIO_S8, 4 channels.\n");
8243 const int dstsize = cvt->len_cvt / 2;
8244 Sint8 *dst = (Sint8 *) cvt->buf;
8245 const Sint8 *src = (Sint8 *) cvt->buf;
8246 const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
8247 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8248 Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
8249 Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
8250 Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
8251 while (dst < target) {
8252 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8253 const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
8254 const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
8255 const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
8257 dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
8258 dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
8259 dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
8260 dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
8261 last_sample0 = sample0;
8262 last_sample1 = sample1;
8263 last_sample2 = sample2;
8264 last_sample3 = sample3;
8268 cvt->len_cvt = dstsize;
8269 if (cvt->filters[++cvt->filter_index]) {
8270 cvt->filters[cvt->filter_index] (cvt, format);
8275 SDL_Upsample_S8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8278 fprintf(stderr, "Upsample (x4) AUDIO_S8, 4 channels.\n");
8281 const int dstsize = cvt->len_cvt * 4;
8282 Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4 * 4;
8283 const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
8284 const Sint8 *target = ((const Sint8 *) cvt->buf);
8285 Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
8286 Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
8287 Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
8288 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8289 while (dst >= target) {
8290 const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
8291 const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
8292 const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
8293 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8295 dst[15] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2);
8296 dst[14] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2);
8297 dst[13] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2);
8298 dst[12] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
8299 dst[11] = (Sint8) ((sample3 + last_sample3) >> 1);
8300 dst[10] = (Sint8) ((sample2 + last_sample2) >> 1);
8301 dst[9] = (Sint8) ((sample1 + last_sample1) >> 1);
8302 dst[8] = (Sint8) ((sample0 + last_sample0) >> 1);
8303 dst[7] = (Sint8) (((3 * sample3) + last_sample3) >> 2);
8304 dst[6] = (Sint8) (((3 * sample2) + last_sample2) >> 2);
8305 dst[5] = (Sint8) (((3 * sample1) + last_sample1) >> 2);
8306 dst[4] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
8307 dst[3] = (Sint8) sample3;
8308 dst[2] = (Sint8) sample2;
8309 dst[1] = (Sint8) sample1;
8310 dst[0] = (Sint8) sample0;
8311 last_sample3 = sample3;
8312 last_sample2 = sample2;
8313 last_sample1 = sample1;
8314 last_sample0 = sample0;
8318 cvt->len_cvt = dstsize;
8319 if (cvt->filters[++cvt->filter_index]) {
8320 cvt->filters[cvt->filter_index] (cvt, format);
8325 SDL_Downsample_S8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8328 fprintf(stderr, "Downsample (x4) AUDIO_S8, 4 channels.\n");
8331 const int dstsize = cvt->len_cvt / 4;
8332 Sint8 *dst = (Sint8 *) cvt->buf;
8333 const Sint8 *src = (Sint8 *) cvt->buf;
8334 const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
8335 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8336 Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
8337 Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
8338 Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
8339 while (dst < target) {
8340 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8341 const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
8342 const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
8343 const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
8345 dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
8346 dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
8347 dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
8348 dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
8349 last_sample0 = sample0;
8350 last_sample1 = sample1;
8351 last_sample2 = sample2;
8352 last_sample3 = sample3;
8356 cvt->len_cvt = dstsize;
8357 if (cvt->filters[++cvt->filter_index]) {
8358 cvt->filters[cvt->filter_index] (cvt, format);
8363 SDL_Upsample_S8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8366 fprintf(stderr, "Upsample (x2) AUDIO_S8, 6 channels.\n");
8369 const int dstsize = cvt->len_cvt * 2;
8370 Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6 * 2;
8371 const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
8372 const Sint8 *target = ((const Sint8 *) cvt->buf);
8373 Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
8374 Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
8375 Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
8376 Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
8377 Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
8378 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8379 while (dst >= target) {
8380 const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
8381 const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
8382 const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
8383 const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
8384 const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
8385 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8387 dst[11] = (Sint8) ((sample5 + last_sample5) >> 1);
8388 dst[10] = (Sint8) ((sample4 + last_sample4) >> 1);
8389 dst[9] = (Sint8) ((sample3 + last_sample3) >> 1);
8390 dst[8] = (Sint8) ((sample2 + last_sample2) >> 1);
8391 dst[7] = (Sint8) ((sample1 + last_sample1) >> 1);
8392 dst[6] = (Sint8) ((sample0 + last_sample0) >> 1);
8393 dst[5] = (Sint8) sample5;
8394 dst[4] = (Sint8) sample4;
8395 dst[3] = (Sint8) sample3;
8396 dst[2] = (Sint8) sample2;
8397 dst[1] = (Sint8) sample1;
8398 dst[0] = (Sint8) sample0;
8399 last_sample5 = sample5;
8400 last_sample4 = sample4;
8401 last_sample3 = sample3;
8402 last_sample2 = sample2;
8403 last_sample1 = sample1;
8404 last_sample0 = sample0;
8408 cvt->len_cvt = dstsize;
8409 if (cvt->filters[++cvt->filter_index]) {
8410 cvt->filters[cvt->filter_index] (cvt, format);
8415 SDL_Downsample_S8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8418 fprintf(stderr, "Downsample (x2) AUDIO_S8, 6 channels.\n");
8421 const int dstsize = cvt->len_cvt / 2;
8422 Sint8 *dst = (Sint8 *) cvt->buf;
8423 const Sint8 *src = (Sint8 *) cvt->buf;
8424 const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
8425 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8426 Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
8427 Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
8428 Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
8429 Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
8430 Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
8431 while (dst < target) {
8432 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8433 const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
8434 const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
8435 const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
8436 const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
8437 const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
8439 dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
8440 dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
8441 dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
8442 dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
8443 dst[4] = (Sint8) ((sample4 + last_sample4) >> 1);
8444 dst[5] = (Sint8) ((sample5 + last_sample5) >> 1);
8445 last_sample0 = sample0;
8446 last_sample1 = sample1;
8447 last_sample2 = sample2;
8448 last_sample3 = sample3;
8449 last_sample4 = sample4;
8450 last_sample5 = sample5;
8454 cvt->len_cvt = dstsize;
8455 if (cvt->filters[++cvt->filter_index]) {
8456 cvt->filters[cvt->filter_index] (cvt, format);
8461 SDL_Upsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8464 fprintf(stderr, "Upsample (x4) AUDIO_S8, 6 channels.\n");
8467 const int dstsize = cvt->len_cvt * 4;
8468 Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6 * 4;
8469 const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
8470 const Sint8 *target = ((const Sint8 *) cvt->buf);
8471 Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
8472 Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
8473 Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
8474 Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
8475 Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
8476 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8477 while (dst >= target) {
8478 const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
8479 const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
8480 const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
8481 const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
8482 const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
8483 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8485 dst[23] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2);
8486 dst[22] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2);
8487 dst[21] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2);
8488 dst[20] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2);
8489 dst[19] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2);
8490 dst[18] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
8491 dst[17] = (Sint8) ((sample5 + last_sample5) >> 1);
8492 dst[16] = (Sint8) ((sample4 + last_sample4) >> 1);
8493 dst[15] = (Sint8) ((sample3 + last_sample3) >> 1);
8494 dst[14] = (Sint8) ((sample2 + last_sample2) >> 1);
8495 dst[13] = (Sint8) ((sample1 + last_sample1) >> 1);
8496 dst[12] = (Sint8) ((sample0 + last_sample0) >> 1);
8497 dst[11] = (Sint8) (((3 * sample5) + last_sample5) >> 2);
8498 dst[10] = (Sint8) (((3 * sample4) + last_sample4) >> 2);
8499 dst[9] = (Sint8) (((3 * sample3) + last_sample3) >> 2);
8500 dst[8] = (Sint8) (((3 * sample2) + last_sample2) >> 2);
8501 dst[7] = (Sint8) (((3 * sample1) + last_sample1) >> 2);
8502 dst[6] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
8503 dst[5] = (Sint8) sample5;
8504 dst[4] = (Sint8) sample4;
8505 dst[3] = (Sint8) sample3;
8506 dst[2] = (Sint8) sample2;
8507 dst[1] = (Sint8) sample1;
8508 dst[0] = (Sint8) sample0;
8509 last_sample5 = sample5;
8510 last_sample4 = sample4;
8511 last_sample3 = sample3;
8512 last_sample2 = sample2;
8513 last_sample1 = sample1;
8514 last_sample0 = sample0;
8518 cvt->len_cvt = dstsize;
8519 if (cvt->filters[++cvt->filter_index]) {
8520 cvt->filters[cvt->filter_index] (cvt, format);
8525 SDL_Downsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8528 fprintf(stderr, "Downsample (x4) AUDIO_S8, 6 channels.\n");
8531 const int dstsize = cvt->len_cvt / 4;
8532 Sint8 *dst = (Sint8 *) cvt->buf;
8533 const Sint8 *src = (Sint8 *) cvt->buf;
8534 const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
8535 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8536 Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
8537 Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
8538 Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
8539 Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
8540 Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
8541 while (dst < target) {
8542 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8543 const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
8544 const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
8545 const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
8546 const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
8547 const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
8549 dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
8550 dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
8551 dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
8552 dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
8553 dst[4] = (Sint8) ((sample4 + last_sample4) >> 1);
8554 dst[5] = (Sint8) ((sample5 + last_sample5) >> 1);
8555 last_sample0 = sample0;
8556 last_sample1 = sample1;
8557 last_sample2 = sample2;
8558 last_sample3 = sample3;
8559 last_sample4 = sample4;
8560 last_sample5 = sample5;
8564 cvt->len_cvt = dstsize;
8565 if (cvt->filters[++cvt->filter_index]) {
8566 cvt->filters[cvt->filter_index] (cvt, format);
8571 SDL_Upsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8574 fprintf(stderr, "Upsample (x2) AUDIO_S8, 8 channels.\n");
8577 const int dstsize = cvt->len_cvt * 2;
8578 Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8 * 2;
8579 const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
8580 const Sint8 *target = ((const Sint8 *) cvt->buf);
8581 Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
8582 Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
8583 Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
8584 Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
8585 Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
8586 Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
8587 Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
8588 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8589 while (dst >= target) {
8590 const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
8591 const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
8592 const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
8593 const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
8594 const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
8595 const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
8596 const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
8597 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8599 dst[15] = (Sint8) ((sample7 + last_sample7) >> 1);
8600 dst[14] = (Sint8) ((sample6 + last_sample6) >> 1);
8601 dst[13] = (Sint8) ((sample5 + last_sample5) >> 1);
8602 dst[12] = (Sint8) ((sample4 + last_sample4) >> 1);
8603 dst[11] = (Sint8) ((sample3 + last_sample3) >> 1);
8604 dst[10] = (Sint8) ((sample2 + last_sample2) >> 1);
8605 dst[9] = (Sint8) ((sample1 + last_sample1) >> 1);
8606 dst[8] = (Sint8) ((sample0 + last_sample0) >> 1);
8607 dst[7] = (Sint8) sample7;
8608 dst[6] = (Sint8) sample6;
8609 dst[5] = (Sint8) sample5;
8610 dst[4] = (Sint8) sample4;
8611 dst[3] = (Sint8) sample3;
8612 dst[2] = (Sint8) sample2;
8613 dst[1] = (Sint8) sample1;
8614 dst[0] = (Sint8) sample0;
8615 last_sample7 = sample7;
8616 last_sample6 = sample6;
8617 last_sample5 = sample5;
8618 last_sample4 = sample4;
8619 last_sample3 = sample3;
8620 last_sample2 = sample2;
8621 last_sample1 = sample1;
8622 last_sample0 = sample0;
8626 cvt->len_cvt = dstsize;
8627 if (cvt->filters[++cvt->filter_index]) {
8628 cvt->filters[cvt->filter_index] (cvt, format);
8633 SDL_Downsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8636 fprintf(stderr, "Downsample (x2) AUDIO_S8, 8 channels.\n");
8639 const int dstsize = cvt->len_cvt / 2;
8640 Sint8 *dst = (Sint8 *) cvt->buf;
8641 const Sint8 *src = (Sint8 *) cvt->buf;
8642 const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
8643 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8644 Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
8645 Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
8646 Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
8647 Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
8648 Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
8649 Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
8650 Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
8651 while (dst < target) {
8652 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8653 const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
8654 const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
8655 const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
8656 const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
8657 const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
8658 const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
8659 const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
8661 dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
8662 dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
8663 dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
8664 dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
8665 dst[4] = (Sint8) ((sample4 + last_sample4) >> 1);
8666 dst[5] = (Sint8) ((sample5 + last_sample5) >> 1);
8667 dst[6] = (Sint8) ((sample6 + last_sample6) >> 1);
8668 dst[7] = (Sint8) ((sample7 + last_sample7) >> 1);
8669 last_sample0 = sample0;
8670 last_sample1 = sample1;
8671 last_sample2 = sample2;
8672 last_sample3 = sample3;
8673 last_sample4 = sample4;
8674 last_sample5 = sample5;
8675 last_sample6 = sample6;
8676 last_sample7 = sample7;
8680 cvt->len_cvt = dstsize;
8681 if (cvt->filters[++cvt->filter_index]) {
8682 cvt->filters[cvt->filter_index] (cvt, format);
8687 SDL_Upsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8690 fprintf(stderr, "Upsample (x4) AUDIO_S8, 8 channels.\n");
8693 const int dstsize = cvt->len_cvt * 4;
8694 Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8 * 4;
8695 const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
8696 const Sint8 *target = ((const Sint8 *) cvt->buf);
8697 Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
8698 Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
8699 Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
8700 Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
8701 Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
8702 Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
8703 Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
8704 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8705 while (dst >= target) {
8706 const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
8707 const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
8708 const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
8709 const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
8710 const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
8711 const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
8712 const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
8713 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8715 dst[31] = (Sint8) ((sample7 + (3 * last_sample7)) >> 2);
8716 dst[30] = (Sint8) ((sample6 + (3 * last_sample6)) >> 2);
8717 dst[29] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2);
8718 dst[28] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2);
8719 dst[27] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2);
8720 dst[26] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2);
8721 dst[25] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2);
8722 dst[24] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
8723 dst[23] = (Sint8) ((sample7 + last_sample7) >> 1);
8724 dst[22] = (Sint8) ((sample6 + last_sample6) >> 1);
8725 dst[21] = (Sint8) ((sample5 + last_sample5) >> 1);
8726 dst[20] = (Sint8) ((sample4 + last_sample4) >> 1);
8727 dst[19] = (Sint8) ((sample3 + last_sample3) >> 1);
8728 dst[18] = (Sint8) ((sample2 + last_sample2) >> 1);
8729 dst[17] = (Sint8) ((sample1 + last_sample1) >> 1);
8730 dst[16] = (Sint8) ((sample0 + last_sample0) >> 1);
8731 dst[15] = (Sint8) (((3 * sample7) + last_sample7) >> 2);
8732 dst[14] = (Sint8) (((3 * sample6) + last_sample6) >> 2);
8733 dst[13] = (Sint8) (((3 * sample5) + last_sample5) >> 2);
8734 dst[12] = (Sint8) (((3 * sample4) + last_sample4) >> 2);
8735 dst[11] = (Sint8) (((3 * sample3) + last_sample3) >> 2);
8736 dst[10] = (Sint8) (((3 * sample2) + last_sample2) >> 2);
8737 dst[9] = (Sint8) (((3 * sample1) + last_sample1) >> 2);
8738 dst[8] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
8739 dst[7] = (Sint8) sample7;
8740 dst[6] = (Sint8) sample6;
8741 dst[5] = (Sint8) sample5;
8742 dst[4] = (Sint8) sample4;
8743 dst[3] = (Sint8) sample3;
8744 dst[2] = (Sint8) sample2;
8745 dst[1] = (Sint8) sample1;
8746 dst[0] = (Sint8) sample0;
8747 last_sample7 = sample7;
8748 last_sample6 = sample6;
8749 last_sample5 = sample5;
8750 last_sample4 = sample4;
8751 last_sample3 = sample3;
8752 last_sample2 = sample2;
8753 last_sample1 = sample1;
8754 last_sample0 = sample0;
8758 cvt->len_cvt = dstsize;
8759 if (cvt->filters[++cvt->filter_index]) {
8760 cvt->filters[cvt->filter_index] (cvt, format);
8765 SDL_Downsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8768 fprintf(stderr, "Downsample (x4) AUDIO_S8, 8 channels.\n");
8771 const int dstsize = cvt->len_cvt / 4;
8772 Sint8 *dst = (Sint8 *) cvt->buf;
8773 const Sint8 *src = (Sint8 *) cvt->buf;
8774 const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
8775 Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
8776 Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
8777 Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
8778 Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
8779 Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
8780 Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
8781 Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
8782 Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
8783 while (dst < target) {
8784 const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
8785 const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
8786 const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
8787 const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
8788 const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
8789 const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
8790 const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
8791 const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
8793 dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
8794 dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
8795 dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
8796 dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
8797 dst[4] = (Sint8) ((sample4 + last_sample4) >> 1);
8798 dst[5] = (Sint8) ((sample5 + last_sample5) >> 1);
8799 dst[6] = (Sint8) ((sample6 + last_sample6) >> 1);
8800 dst[7] = (Sint8) ((sample7 + last_sample7) >> 1);
8801 last_sample0 = sample0;
8802 last_sample1 = sample1;
8803 last_sample2 = sample2;
8804 last_sample3 = sample3;
8805 last_sample4 = sample4;
8806 last_sample5 = sample5;
8807 last_sample6 = sample6;
8808 last_sample7 = sample7;
8812 cvt->len_cvt = dstsize;
8813 if (cvt->filters[++cvt->filter_index]) {
8814 cvt->filters[cvt->filter_index] (cvt, format);
8819 SDL_Upsample_U16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8822 fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 1 channels.\n");
8825 const int dstsize = cvt->len_cvt * 2;
8826 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 2;
8827 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
8828 const Uint16 *target = ((const Uint16 *) cvt->buf);
8829 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
8830 while (dst >= target) {
8831 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
8833 dst[1] = (Uint16) ((sample0 + last_sample0) >> 1);
8834 dst[0] = (Uint16) sample0;
8835 last_sample0 = sample0;
8839 cvt->len_cvt = dstsize;
8840 if (cvt->filters[++cvt->filter_index]) {
8841 cvt->filters[cvt->filter_index] (cvt, format);
8846 SDL_Downsample_U16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8849 fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 1 channels.\n");
8852 const int dstsize = cvt->len_cvt / 2;
8853 Uint16 *dst = (Uint16 *) cvt->buf;
8854 const Uint16 *src = (Uint16 *) cvt->buf;
8855 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
8856 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
8857 while (dst < target) {
8858 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
8860 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
8861 last_sample0 = sample0;
8865 cvt->len_cvt = dstsize;
8866 if (cvt->filters[++cvt->filter_index]) {
8867 cvt->filters[cvt->filter_index] (cvt, format);
8872 SDL_Upsample_U16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8875 fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 1 channels.\n");
8878 const int dstsize = cvt->len_cvt * 4;
8879 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 4;
8880 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
8881 const Uint16 *target = ((const Uint16 *) cvt->buf);
8882 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
8883 while (dst >= target) {
8884 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
8886 dst[3] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
8887 dst[2] = (Uint16) ((sample0 + last_sample0) >> 1);
8888 dst[1] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
8889 dst[0] = (Uint16) sample0;
8890 last_sample0 = sample0;
8894 cvt->len_cvt = dstsize;
8895 if (cvt->filters[++cvt->filter_index]) {
8896 cvt->filters[cvt->filter_index] (cvt, format);
8901 SDL_Downsample_U16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8904 fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 1 channels.\n");
8907 const int dstsize = cvt->len_cvt / 4;
8908 Uint16 *dst = (Uint16 *) cvt->buf;
8909 const Uint16 *src = (Uint16 *) cvt->buf;
8910 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
8911 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
8912 while (dst < target) {
8913 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
8915 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
8916 last_sample0 = sample0;
8920 cvt->len_cvt = dstsize;
8921 if (cvt->filters[++cvt->filter_index]) {
8922 cvt->filters[cvt->filter_index] (cvt, format);
8927 SDL_Upsample_U16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8930 fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 2 channels.\n");
8933 const int dstsize = cvt->len_cvt * 2;
8934 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 2;
8935 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
8936 const Uint16 *target = ((const Uint16 *) cvt->buf);
8937 Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
8938 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
8939 while (dst >= target) {
8940 const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
8941 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
8943 dst[3] = (Uint16) ((sample1 + last_sample1) >> 1);
8944 dst[2] = (Uint16) ((sample0 + last_sample0) >> 1);
8945 dst[1] = (Uint16) sample1;
8946 dst[0] = (Uint16) sample0;
8947 last_sample1 = sample1;
8948 last_sample0 = sample0;
8952 cvt->len_cvt = dstsize;
8953 if (cvt->filters[++cvt->filter_index]) {
8954 cvt->filters[cvt->filter_index] (cvt, format);
8959 SDL_Downsample_U16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8962 fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 2 channels.\n");
8965 const int dstsize = cvt->len_cvt / 2;
8966 Uint16 *dst = (Uint16 *) cvt->buf;
8967 const Uint16 *src = (Uint16 *) cvt->buf;
8968 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
8969 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
8970 Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
8971 while (dst < target) {
8972 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
8973 const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
8975 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
8976 dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
8977 last_sample0 = sample0;
8978 last_sample1 = sample1;
8982 cvt->len_cvt = dstsize;
8983 if (cvt->filters[++cvt->filter_index]) {
8984 cvt->filters[cvt->filter_index] (cvt, format);
8989 SDL_Upsample_U16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
8992 fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 2 channels.\n");
8995 const int dstsize = cvt->len_cvt * 4;
8996 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 4;
8997 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
8998 const Uint16 *target = ((const Uint16 *) cvt->buf);
8999 Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
9000 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
9001 while (dst >= target) {
9002 const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
9003 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
9005 dst[7] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
9006 dst[6] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
9007 dst[5] = (Uint16) ((sample1 + last_sample1) >> 1);
9008 dst[4] = (Uint16) ((sample0 + last_sample0) >> 1);
9009 dst[3] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
9010 dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
9011 dst[1] = (Uint16) sample1;
9012 dst[0] = (Uint16) sample0;
9013 last_sample1 = sample1;
9014 last_sample0 = sample0;
9018 cvt->len_cvt = dstsize;
9019 if (cvt->filters[++cvt->filter_index]) {
9020 cvt->filters[cvt->filter_index] (cvt, format);
9025 SDL_Downsample_U16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9028 fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 2 channels.\n");
9031 const int dstsize = cvt->len_cvt / 4;
9032 Uint16 *dst = (Uint16 *) cvt->buf;
9033 const Uint16 *src = (Uint16 *) cvt->buf;
9034 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
9035 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
9036 Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
9037 while (dst < target) {
9038 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
9039 const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
9041 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
9042 dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
9043 last_sample0 = sample0;
9044 last_sample1 = sample1;
9048 cvt->len_cvt = dstsize;
9049 if (cvt->filters[++cvt->filter_index]) {
9050 cvt->filters[cvt->filter_index] (cvt, format);
9055 SDL_Upsample_U16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9058 fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 4 channels.\n");
9061 const int dstsize = cvt->len_cvt * 2;
9062 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 2;
9063 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
9064 const Uint16 *target = ((const Uint16 *) cvt->buf);
9065 Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
9066 Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
9067 Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
9068 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
9069 while (dst >= target) {
9070 const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
9071 const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
9072 const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
9073 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
9075 dst[7] = (Uint16) ((sample3 + last_sample3) >> 1);
9076 dst[6] = (Uint16) ((sample2 + last_sample2) >> 1);
9077 dst[5] = (Uint16) ((sample1 + last_sample1) >> 1);
9078 dst[4] = (Uint16) ((sample0 + last_sample0) >> 1);
9079 dst[3] = (Uint16) sample3;
9080 dst[2] = (Uint16) sample2;
9081 dst[1] = (Uint16) sample1;
9082 dst[0] = (Uint16) sample0;
9083 last_sample3 = sample3;
9084 last_sample2 = sample2;
9085 last_sample1 = sample1;
9086 last_sample0 = sample0;
9090 cvt->len_cvt = dstsize;
9091 if (cvt->filters[++cvt->filter_index]) {
9092 cvt->filters[cvt->filter_index] (cvt, format);
9097 SDL_Downsample_U16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9100 fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 4 channels.\n");
9103 const int dstsize = cvt->len_cvt / 2;
9104 Uint16 *dst = (Uint16 *) cvt->buf;
9105 const Uint16 *src = (Uint16 *) cvt->buf;
9106 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
9107 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
9108 Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
9109 Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
9110 Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
9111 while (dst < target) {
9112 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
9113 const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
9114 const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
9115 const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
9117 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
9118 dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
9119 dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
9120 dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
9121 last_sample0 = sample0;
9122 last_sample1 = sample1;
9123 last_sample2 = sample2;
9124 last_sample3 = sample3;
9128 cvt->len_cvt = dstsize;
9129 if (cvt->filters[++cvt->filter_index]) {
9130 cvt->filters[cvt->filter_index] (cvt, format);
9135 SDL_Upsample_U16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9138 fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 4 channels.\n");
9141 const int dstsize = cvt->len_cvt * 4;
9142 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 4;
9143 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
9144 const Uint16 *target = ((const Uint16 *) cvt->buf);
9145 Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
9146 Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
9147 Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
9148 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
9149 while (dst >= target) {
9150 const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
9151 const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
9152 const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
9153 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
9155 dst[15] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
9156 dst[14] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
9157 dst[13] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
9158 dst[12] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
9159 dst[11] = (Uint16) ((sample3 + last_sample3) >> 1);
9160 dst[10] = (Uint16) ((sample2 + last_sample2) >> 1);
9161 dst[9] = (Uint16) ((sample1 + last_sample1) >> 1);
9162 dst[8] = (Uint16) ((sample0 + last_sample0) >> 1);
9163 dst[7] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
9164 dst[6] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
9165 dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
9166 dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
9167 dst[3] = (Uint16) sample3;
9168 dst[2] = (Uint16) sample2;
9169 dst[1] = (Uint16) sample1;
9170 dst[0] = (Uint16) sample0;
9171 last_sample3 = sample3;
9172 last_sample2 = sample2;
9173 last_sample1 = sample1;
9174 last_sample0 = sample0;
9178 cvt->len_cvt = dstsize;
9179 if (cvt->filters[++cvt->filter_index]) {
9180 cvt->filters[cvt->filter_index] (cvt, format);
9185 SDL_Downsample_U16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9188 fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 4 channels.\n");
9191 const int dstsize = cvt->len_cvt / 4;
9192 Uint16 *dst = (Uint16 *) cvt->buf;
9193 const Uint16 *src = (Uint16 *) cvt->buf;
9194 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
9195 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
9196 Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
9197 Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
9198 Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
9199 while (dst < target) {
9200 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
9201 const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
9202 const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
9203 const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
9205 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
9206 dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
9207 dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
9208 dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
9209 last_sample0 = sample0;
9210 last_sample1 = sample1;
9211 last_sample2 = sample2;
9212 last_sample3 = sample3;
9216 cvt->len_cvt = dstsize;
9217 if (cvt->filters[++cvt->filter_index]) {
9218 cvt->filters[cvt->filter_index] (cvt, format);
9223 SDL_Upsample_U16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9226 fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 6 channels.\n");
9229 const int dstsize = cvt->len_cvt * 2;
9230 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 2;
9231 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
9232 const Uint16 *target = ((const Uint16 *) cvt->buf);
9233 Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
9234 Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
9235 Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
9236 Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
9237 Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
9238 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
9239 while (dst >= target) {
9240 const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
9241 const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
9242 const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
9243 const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
9244 const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
9245 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
9247 dst[11] = (Uint16) ((sample5 + last_sample5) >> 1);
9248 dst[10] = (Uint16) ((sample4 + last_sample4) >> 1);
9249 dst[9] = (Uint16) ((sample3 + last_sample3) >> 1);
9250 dst[8] = (Uint16) ((sample2 + last_sample2) >> 1);
9251 dst[7] = (Uint16) ((sample1 + last_sample1) >> 1);
9252 dst[6] = (Uint16) ((sample0 + last_sample0) >> 1);
9253 dst[5] = (Uint16) sample5;
9254 dst[4] = (Uint16) sample4;
9255 dst[3] = (Uint16) sample3;
9256 dst[2] = (Uint16) sample2;
9257 dst[1] = (Uint16) sample1;
9258 dst[0] = (Uint16) sample0;
9259 last_sample5 = sample5;
9260 last_sample4 = sample4;
9261 last_sample3 = sample3;
9262 last_sample2 = sample2;
9263 last_sample1 = sample1;
9264 last_sample0 = sample0;
9268 cvt->len_cvt = dstsize;
9269 if (cvt->filters[++cvt->filter_index]) {
9270 cvt->filters[cvt->filter_index] (cvt, format);
9275 SDL_Downsample_U16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9278 fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 6 channels.\n");
9281 const int dstsize = cvt->len_cvt / 2;
9282 Uint16 *dst = (Uint16 *) cvt->buf;
9283 const Uint16 *src = (Uint16 *) cvt->buf;
9284 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
9285 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
9286 Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
9287 Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
9288 Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
9289 Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
9290 Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
9291 while (dst < target) {
9292 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
9293 const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
9294 const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
9295 const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
9296 const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
9297 const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
9299 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
9300 dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
9301 dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
9302 dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
9303 dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
9304 dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
9305 last_sample0 = sample0;
9306 last_sample1 = sample1;
9307 last_sample2 = sample2;
9308 last_sample3 = sample3;
9309 last_sample4 = sample4;
9310 last_sample5 = sample5;
9314 cvt->len_cvt = dstsize;
9315 if (cvt->filters[++cvt->filter_index]) {
9316 cvt->filters[cvt->filter_index] (cvt, format);
9321 SDL_Upsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9324 fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 6 channels.\n");
9327 const int dstsize = cvt->len_cvt * 4;
9328 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 4;
9329 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
9330 const Uint16 *target = ((const Uint16 *) cvt->buf);
9331 Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
9332 Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
9333 Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
9334 Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
9335 Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
9336 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
9337 while (dst >= target) {
9338 const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
9339 const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
9340 const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
9341 const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
9342 const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
9343 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
9345 dst[23] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2);
9346 dst[22] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2);
9347 dst[21] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
9348 dst[20] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
9349 dst[19] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
9350 dst[18] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
9351 dst[17] = (Uint16) ((sample5 + last_sample5) >> 1);
9352 dst[16] = (Uint16) ((sample4 + last_sample4) >> 1);
9353 dst[15] = (Uint16) ((sample3 + last_sample3) >> 1);
9354 dst[14] = (Uint16) ((sample2 + last_sample2) >> 1);
9355 dst[13] = (Uint16) ((sample1 + last_sample1) >> 1);
9356 dst[12] = (Uint16) ((sample0 + last_sample0) >> 1);
9357 dst[11] = (Uint16) (((3 * sample5) + last_sample5) >> 2);
9358 dst[10] = (Uint16) (((3 * sample4) + last_sample4) >> 2);
9359 dst[9] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
9360 dst[8] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
9361 dst[7] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
9362 dst[6] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
9363 dst[5] = (Uint16) sample5;
9364 dst[4] = (Uint16) sample4;
9365 dst[3] = (Uint16) sample3;
9366 dst[2] = (Uint16) sample2;
9367 dst[1] = (Uint16) sample1;
9368 dst[0] = (Uint16) sample0;
9369 last_sample5 = sample5;
9370 last_sample4 = sample4;
9371 last_sample3 = sample3;
9372 last_sample2 = sample2;
9373 last_sample1 = sample1;
9374 last_sample0 = sample0;
9378 cvt->len_cvt = dstsize;
9379 if (cvt->filters[++cvt->filter_index]) {
9380 cvt->filters[cvt->filter_index] (cvt, format);
9385 SDL_Downsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9388 fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 6 channels.\n");
9391 const int dstsize = cvt->len_cvt / 4;
9392 Uint16 *dst = (Uint16 *) cvt->buf;
9393 const Uint16 *src = (Uint16 *) cvt->buf;
9394 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
9395 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
9396 Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
9397 Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
9398 Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
9399 Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
9400 Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
9401 while (dst < target) {
9402 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
9403 const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
9404 const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
9405 const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
9406 const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
9407 const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
9409 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
9410 dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
9411 dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
9412 dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
9413 dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
9414 dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
9415 last_sample0 = sample0;
9416 last_sample1 = sample1;
9417 last_sample2 = sample2;
9418 last_sample3 = sample3;
9419 last_sample4 = sample4;
9420 last_sample5 = sample5;
9424 cvt->len_cvt = dstsize;
9425 if (cvt->filters[++cvt->filter_index]) {
9426 cvt->filters[cvt->filter_index] (cvt, format);
9431 SDL_Upsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9434 fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 8 channels.\n");
9437 const int dstsize = cvt->len_cvt * 2;
9438 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 2;
9439 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
9440 const Uint16 *target = ((const Uint16 *) cvt->buf);
9441 Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
9442 Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
9443 Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
9444 Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
9445 Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
9446 Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
9447 Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
9448 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
9449 while (dst >= target) {
9450 const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
9451 const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
9452 const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
9453 const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
9454 const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
9455 const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
9456 const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
9457 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
9459 dst[15] = (Uint16) ((sample7 + last_sample7) >> 1);
9460 dst[14] = (Uint16) ((sample6 + last_sample6) >> 1);
9461 dst[13] = (Uint16) ((sample5 + last_sample5) >> 1);
9462 dst[12] = (Uint16) ((sample4 + last_sample4) >> 1);
9463 dst[11] = (Uint16) ((sample3 + last_sample3) >> 1);
9464 dst[10] = (Uint16) ((sample2 + last_sample2) >> 1);
9465 dst[9] = (Uint16) ((sample1 + last_sample1) >> 1);
9466 dst[8] = (Uint16) ((sample0 + last_sample0) >> 1);
9467 dst[7] = (Uint16) sample7;
9468 dst[6] = (Uint16) sample6;
9469 dst[5] = (Uint16) sample5;
9470 dst[4] = (Uint16) sample4;
9471 dst[3] = (Uint16) sample3;
9472 dst[2] = (Uint16) sample2;
9473 dst[1] = (Uint16) sample1;
9474 dst[0] = (Uint16) sample0;
9475 last_sample7 = sample7;
9476 last_sample6 = sample6;
9477 last_sample5 = sample5;
9478 last_sample4 = sample4;
9479 last_sample3 = sample3;
9480 last_sample2 = sample2;
9481 last_sample1 = sample1;
9482 last_sample0 = sample0;
9486 cvt->len_cvt = dstsize;
9487 if (cvt->filters[++cvt->filter_index]) {
9488 cvt->filters[cvt->filter_index] (cvt, format);
9493 SDL_Downsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9496 fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 8 channels.\n");
9499 const int dstsize = cvt->len_cvt / 2;
9500 Uint16 *dst = (Uint16 *) cvt->buf;
9501 const Uint16 *src = (Uint16 *) cvt->buf;
9502 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
9503 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
9504 Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
9505 Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
9506 Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
9507 Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
9508 Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
9509 Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
9510 Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
9511 while (dst < target) {
9512 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
9513 const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
9514 const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
9515 const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
9516 const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
9517 const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
9518 const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
9519 const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
9521 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
9522 dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
9523 dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
9524 dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
9525 dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
9526 dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
9527 dst[6] = (Uint16) ((sample6 + last_sample6) >> 1);
9528 dst[7] = (Uint16) ((sample7 + last_sample7) >> 1);
9529 last_sample0 = sample0;
9530 last_sample1 = sample1;
9531 last_sample2 = sample2;
9532 last_sample3 = sample3;
9533 last_sample4 = sample4;
9534 last_sample5 = sample5;
9535 last_sample6 = sample6;
9536 last_sample7 = sample7;
9540 cvt->len_cvt = dstsize;
9541 if (cvt->filters[++cvt->filter_index]) {
9542 cvt->filters[cvt->filter_index] (cvt, format);
9547 SDL_Upsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9550 fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 8 channels.\n");
9553 const int dstsize = cvt->len_cvt * 4;
9554 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 4;
9555 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
9556 const Uint16 *target = ((const Uint16 *) cvt->buf);
9557 Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
9558 Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
9559 Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
9560 Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
9561 Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
9562 Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
9563 Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
9564 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
9565 while (dst >= target) {
9566 const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
9567 const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
9568 const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
9569 const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
9570 const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
9571 const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
9572 const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
9573 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
9575 dst[31] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2);
9576 dst[30] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2);
9577 dst[29] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2);
9578 dst[28] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2);
9579 dst[27] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
9580 dst[26] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
9581 dst[25] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
9582 dst[24] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
9583 dst[23] = (Uint16) ((sample7 + last_sample7) >> 1);
9584 dst[22] = (Uint16) ((sample6 + last_sample6) >> 1);
9585 dst[21] = (Uint16) ((sample5 + last_sample5) >> 1);
9586 dst[20] = (Uint16) ((sample4 + last_sample4) >> 1);
9587 dst[19] = (Uint16) ((sample3 + last_sample3) >> 1);
9588 dst[18] = (Uint16) ((sample2 + last_sample2) >> 1);
9589 dst[17] = (Uint16) ((sample1 + last_sample1) >> 1);
9590 dst[16] = (Uint16) ((sample0 + last_sample0) >> 1);
9591 dst[15] = (Uint16) (((3 * sample7) + last_sample7) >> 2);
9592 dst[14] = (Uint16) (((3 * sample6) + last_sample6) >> 2);
9593 dst[13] = (Uint16) (((3 * sample5) + last_sample5) >> 2);
9594 dst[12] = (Uint16) (((3 * sample4) + last_sample4) >> 2);
9595 dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
9596 dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
9597 dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
9598 dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
9599 dst[7] = (Uint16) sample7;
9600 dst[6] = (Uint16) sample6;
9601 dst[5] = (Uint16) sample5;
9602 dst[4] = (Uint16) sample4;
9603 dst[3] = (Uint16) sample3;
9604 dst[2] = (Uint16) sample2;
9605 dst[1] = (Uint16) sample1;
9606 dst[0] = (Uint16) sample0;
9607 last_sample7 = sample7;
9608 last_sample6 = sample6;
9609 last_sample5 = sample5;
9610 last_sample4 = sample4;
9611 last_sample3 = sample3;
9612 last_sample2 = sample2;
9613 last_sample1 = sample1;
9614 last_sample0 = sample0;
9618 cvt->len_cvt = dstsize;
9619 if (cvt->filters[++cvt->filter_index]) {
9620 cvt->filters[cvt->filter_index] (cvt, format);
9625 SDL_Downsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9628 fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 8 channels.\n");
9631 const int dstsize = cvt->len_cvt / 4;
9632 Uint16 *dst = (Uint16 *) cvt->buf;
9633 const Uint16 *src = (Uint16 *) cvt->buf;
9634 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
9635 Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
9636 Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
9637 Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
9638 Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
9639 Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
9640 Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
9641 Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
9642 Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
9643 while (dst < target) {
9644 const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
9645 const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
9646 const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
9647 const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
9648 const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
9649 const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
9650 const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
9651 const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
9653 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
9654 dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
9655 dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
9656 dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
9657 dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
9658 dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
9659 dst[6] = (Uint16) ((sample6 + last_sample6) >> 1);
9660 dst[7] = (Uint16) ((sample7 + last_sample7) >> 1);
9661 last_sample0 = sample0;
9662 last_sample1 = sample1;
9663 last_sample2 = sample2;
9664 last_sample3 = sample3;
9665 last_sample4 = sample4;
9666 last_sample5 = sample5;
9667 last_sample6 = sample6;
9668 last_sample7 = sample7;
9672 cvt->len_cvt = dstsize;
9673 if (cvt->filters[++cvt->filter_index]) {
9674 cvt->filters[cvt->filter_index] (cvt, format);
9679 SDL_Upsample_S16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9682 fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 1 channels.\n");
9685 const int dstsize = cvt->len_cvt * 2;
9686 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 2;
9687 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
9688 const Sint16 *target = ((const Sint16 *) cvt->buf);
9689 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9690 while (dst >= target) {
9691 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9693 dst[1] = (Sint16) ((sample0 + last_sample0) >> 1);
9694 dst[0] = (Sint16) sample0;
9695 last_sample0 = sample0;
9699 cvt->len_cvt = dstsize;
9700 if (cvt->filters[++cvt->filter_index]) {
9701 cvt->filters[cvt->filter_index] (cvt, format);
9706 SDL_Downsample_S16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9709 fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 1 channels.\n");
9712 const int dstsize = cvt->len_cvt / 2;
9713 Sint16 *dst = (Sint16 *) cvt->buf;
9714 const Sint16 *src = (Sint16 *) cvt->buf;
9715 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
9716 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9717 while (dst < target) {
9718 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9720 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
9721 last_sample0 = sample0;
9725 cvt->len_cvt = dstsize;
9726 if (cvt->filters[++cvt->filter_index]) {
9727 cvt->filters[cvt->filter_index] (cvt, format);
9732 SDL_Upsample_S16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9735 fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 1 channels.\n");
9738 const int dstsize = cvt->len_cvt * 4;
9739 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 4;
9740 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
9741 const Sint16 *target = ((const Sint16 *) cvt->buf);
9742 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9743 while (dst >= target) {
9744 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9746 dst[3] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
9747 dst[2] = (Sint16) ((sample0 + last_sample0) >> 1);
9748 dst[1] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
9749 dst[0] = (Sint16) sample0;
9750 last_sample0 = sample0;
9754 cvt->len_cvt = dstsize;
9755 if (cvt->filters[++cvt->filter_index]) {
9756 cvt->filters[cvt->filter_index] (cvt, format);
9761 SDL_Downsample_S16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9764 fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 1 channels.\n");
9767 const int dstsize = cvt->len_cvt / 4;
9768 Sint16 *dst = (Sint16 *) cvt->buf;
9769 const Sint16 *src = (Sint16 *) cvt->buf;
9770 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
9771 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9772 while (dst < target) {
9773 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9775 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
9776 last_sample0 = sample0;
9780 cvt->len_cvt = dstsize;
9781 if (cvt->filters[++cvt->filter_index]) {
9782 cvt->filters[cvt->filter_index] (cvt, format);
9787 SDL_Upsample_S16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9790 fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 2 channels.\n");
9793 const int dstsize = cvt->len_cvt * 2;
9794 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 2;
9795 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
9796 const Sint16 *target = ((const Sint16 *) cvt->buf);
9797 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
9798 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9799 while (dst >= target) {
9800 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
9801 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9803 dst[3] = (Sint16) ((sample1 + last_sample1) >> 1);
9804 dst[2] = (Sint16) ((sample0 + last_sample0) >> 1);
9805 dst[1] = (Sint16) sample1;
9806 dst[0] = (Sint16) sample0;
9807 last_sample1 = sample1;
9808 last_sample0 = sample0;
9812 cvt->len_cvt = dstsize;
9813 if (cvt->filters[++cvt->filter_index]) {
9814 cvt->filters[cvt->filter_index] (cvt, format);
9819 SDL_Downsample_S16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9822 fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 2 channels.\n");
9825 const int dstsize = cvt->len_cvt / 2;
9826 Sint16 *dst = (Sint16 *) cvt->buf;
9827 const Sint16 *src = (Sint16 *) cvt->buf;
9828 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
9829 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9830 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
9831 while (dst < target) {
9832 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9833 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
9835 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
9836 dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
9837 last_sample0 = sample0;
9838 last_sample1 = sample1;
9842 cvt->len_cvt = dstsize;
9843 if (cvt->filters[++cvt->filter_index]) {
9844 cvt->filters[cvt->filter_index] (cvt, format);
9849 SDL_Upsample_S16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9852 fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 2 channels.\n");
9855 const int dstsize = cvt->len_cvt * 4;
9856 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 4;
9857 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
9858 const Sint16 *target = ((const Sint16 *) cvt->buf);
9859 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
9860 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9861 while (dst >= target) {
9862 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
9863 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9865 dst[7] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
9866 dst[6] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
9867 dst[5] = (Sint16) ((sample1 + last_sample1) >> 1);
9868 dst[4] = (Sint16) ((sample0 + last_sample0) >> 1);
9869 dst[3] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
9870 dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
9871 dst[1] = (Sint16) sample1;
9872 dst[0] = (Sint16) sample0;
9873 last_sample1 = sample1;
9874 last_sample0 = sample0;
9878 cvt->len_cvt = dstsize;
9879 if (cvt->filters[++cvt->filter_index]) {
9880 cvt->filters[cvt->filter_index] (cvt, format);
9885 SDL_Downsample_S16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9888 fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 2 channels.\n");
9891 const int dstsize = cvt->len_cvt / 4;
9892 Sint16 *dst = (Sint16 *) cvt->buf;
9893 const Sint16 *src = (Sint16 *) cvt->buf;
9894 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
9895 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9896 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
9897 while (dst < target) {
9898 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9899 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
9901 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
9902 dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
9903 last_sample0 = sample0;
9904 last_sample1 = sample1;
9908 cvt->len_cvt = dstsize;
9909 if (cvt->filters[++cvt->filter_index]) {
9910 cvt->filters[cvt->filter_index] (cvt, format);
9915 SDL_Upsample_S16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9918 fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 4 channels.\n");
9921 const int dstsize = cvt->len_cvt * 2;
9922 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 2;
9923 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
9924 const Sint16 *target = ((const Sint16 *) cvt->buf);
9925 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
9926 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
9927 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
9928 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9929 while (dst >= target) {
9930 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
9931 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
9932 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
9933 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9935 dst[7] = (Sint16) ((sample3 + last_sample3) >> 1);
9936 dst[6] = (Sint16) ((sample2 + last_sample2) >> 1);
9937 dst[5] = (Sint16) ((sample1 + last_sample1) >> 1);
9938 dst[4] = (Sint16) ((sample0 + last_sample0) >> 1);
9939 dst[3] = (Sint16) sample3;
9940 dst[2] = (Sint16) sample2;
9941 dst[1] = (Sint16) sample1;
9942 dst[0] = (Sint16) sample0;
9943 last_sample3 = sample3;
9944 last_sample2 = sample2;
9945 last_sample1 = sample1;
9946 last_sample0 = sample0;
9950 cvt->len_cvt = dstsize;
9951 if (cvt->filters[++cvt->filter_index]) {
9952 cvt->filters[cvt->filter_index] (cvt, format);
9957 SDL_Downsample_S16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9960 fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 4 channels.\n");
9963 const int dstsize = cvt->len_cvt / 2;
9964 Sint16 *dst = (Sint16 *) cvt->buf;
9965 const Sint16 *src = (Sint16 *) cvt->buf;
9966 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
9967 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9968 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
9969 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
9970 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
9971 while (dst < target) {
9972 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
9973 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
9974 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
9975 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
9977 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
9978 dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
9979 dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
9980 dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
9981 last_sample0 = sample0;
9982 last_sample1 = sample1;
9983 last_sample2 = sample2;
9984 last_sample3 = sample3;
9988 cvt->len_cvt = dstsize;
9989 if (cvt->filters[++cvt->filter_index]) {
9990 cvt->filters[cvt->filter_index] (cvt, format);
9995 SDL_Upsample_S16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
9998 fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 4 channels.\n");
10001 const int dstsize = cvt->len_cvt * 4;
10002 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 4;
10003 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
10004 const Sint16 *target = ((const Sint16 *) cvt->buf);
10005 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10006 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10007 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10008 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10009 while (dst >= target) {
10010 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10011 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10012 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10013 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10015 dst[15] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
10016 dst[14] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
10017 dst[13] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
10018 dst[12] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
10019 dst[11] = (Sint16) ((sample3 + last_sample3) >> 1);
10020 dst[10] = (Sint16) ((sample2 + last_sample2) >> 1);
10021 dst[9] = (Sint16) ((sample1 + last_sample1) >> 1);
10022 dst[8] = (Sint16) ((sample0 + last_sample0) >> 1);
10023 dst[7] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
10024 dst[6] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
10025 dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
10026 dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
10027 dst[3] = (Sint16) sample3;
10028 dst[2] = (Sint16) sample2;
10029 dst[1] = (Sint16) sample1;
10030 dst[0] = (Sint16) sample0;
10031 last_sample3 = sample3;
10032 last_sample2 = sample2;
10033 last_sample1 = sample1;
10034 last_sample0 = sample0;
10038 cvt->len_cvt = dstsize;
10039 if (cvt->filters[++cvt->filter_index]) {
10040 cvt->filters[cvt->filter_index] (cvt, format);
10044 static void SDLCALL
10045 SDL_Downsample_S16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10048 fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 4 channels.\n");
10051 const int dstsize = cvt->len_cvt / 4;
10052 Sint16 *dst = (Sint16 *) cvt->buf;
10053 const Sint16 *src = (Sint16 *) cvt->buf;
10054 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
10055 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10056 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10057 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10058 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10059 while (dst < target) {
10060 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10061 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10062 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10063 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10065 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
10066 dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
10067 dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
10068 dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
10069 last_sample0 = sample0;
10070 last_sample1 = sample1;
10071 last_sample2 = sample2;
10072 last_sample3 = sample3;
10076 cvt->len_cvt = dstsize;
10077 if (cvt->filters[++cvt->filter_index]) {
10078 cvt->filters[cvt->filter_index] (cvt, format);
10082 static void SDLCALL
10083 SDL_Upsample_S16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10086 fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 6 channels.\n");
10089 const int dstsize = cvt->len_cvt * 2;
10090 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 2;
10091 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
10092 const Sint16 *target = ((const Sint16 *) cvt->buf);
10093 Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
10094 Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
10095 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10096 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10097 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10098 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10099 while (dst >= target) {
10100 const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
10101 const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
10102 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10103 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10104 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10105 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10107 dst[11] = (Sint16) ((sample5 + last_sample5) >> 1);
10108 dst[10] = (Sint16) ((sample4 + last_sample4) >> 1);
10109 dst[9] = (Sint16) ((sample3 + last_sample3) >> 1);
10110 dst[8] = (Sint16) ((sample2 + last_sample2) >> 1);
10111 dst[7] = (Sint16) ((sample1 + last_sample1) >> 1);
10112 dst[6] = (Sint16) ((sample0 + last_sample0) >> 1);
10113 dst[5] = (Sint16) sample5;
10114 dst[4] = (Sint16) sample4;
10115 dst[3] = (Sint16) sample3;
10116 dst[2] = (Sint16) sample2;
10117 dst[1] = (Sint16) sample1;
10118 dst[0] = (Sint16) sample0;
10119 last_sample5 = sample5;
10120 last_sample4 = sample4;
10121 last_sample3 = sample3;
10122 last_sample2 = sample2;
10123 last_sample1 = sample1;
10124 last_sample0 = sample0;
10128 cvt->len_cvt = dstsize;
10129 if (cvt->filters[++cvt->filter_index]) {
10130 cvt->filters[cvt->filter_index] (cvt, format);
10134 static void SDLCALL
10135 SDL_Downsample_S16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10138 fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 6 channels.\n");
10141 const int dstsize = cvt->len_cvt / 2;
10142 Sint16 *dst = (Sint16 *) cvt->buf;
10143 const Sint16 *src = (Sint16 *) cvt->buf;
10144 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
10145 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10146 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10147 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10148 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10149 Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
10150 Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
10151 while (dst < target) {
10152 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10153 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10154 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10155 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10156 const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
10157 const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
10159 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
10160 dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
10161 dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
10162 dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
10163 dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
10164 dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
10165 last_sample0 = sample0;
10166 last_sample1 = sample1;
10167 last_sample2 = sample2;
10168 last_sample3 = sample3;
10169 last_sample4 = sample4;
10170 last_sample5 = sample5;
10174 cvt->len_cvt = dstsize;
10175 if (cvt->filters[++cvt->filter_index]) {
10176 cvt->filters[cvt->filter_index] (cvt, format);
10180 static void SDLCALL
10181 SDL_Upsample_S16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10184 fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 6 channels.\n");
10187 const int dstsize = cvt->len_cvt * 4;
10188 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 4;
10189 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
10190 const Sint16 *target = ((const Sint16 *) cvt->buf);
10191 Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
10192 Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
10193 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10194 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10195 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10196 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10197 while (dst >= target) {
10198 const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
10199 const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
10200 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10201 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10202 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10203 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10205 dst[23] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2);
10206 dst[22] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2);
10207 dst[21] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
10208 dst[20] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
10209 dst[19] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
10210 dst[18] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
10211 dst[17] = (Sint16) ((sample5 + last_sample5) >> 1);
10212 dst[16] = (Sint16) ((sample4 + last_sample4) >> 1);
10213 dst[15] = (Sint16) ((sample3 + last_sample3) >> 1);
10214 dst[14] = (Sint16) ((sample2 + last_sample2) >> 1);
10215 dst[13] = (Sint16) ((sample1 + last_sample1) >> 1);
10216 dst[12] = (Sint16) ((sample0 + last_sample0) >> 1);
10217 dst[11] = (Sint16) (((3 * sample5) + last_sample5) >> 2);
10218 dst[10] = (Sint16) (((3 * sample4) + last_sample4) >> 2);
10219 dst[9] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
10220 dst[8] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
10221 dst[7] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
10222 dst[6] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
10223 dst[5] = (Sint16) sample5;
10224 dst[4] = (Sint16) sample4;
10225 dst[3] = (Sint16) sample3;
10226 dst[2] = (Sint16) sample2;
10227 dst[1] = (Sint16) sample1;
10228 dst[0] = (Sint16) sample0;
10229 last_sample5 = sample5;
10230 last_sample4 = sample4;
10231 last_sample3 = sample3;
10232 last_sample2 = sample2;
10233 last_sample1 = sample1;
10234 last_sample0 = sample0;
10238 cvt->len_cvt = dstsize;
10239 if (cvt->filters[++cvt->filter_index]) {
10240 cvt->filters[cvt->filter_index] (cvt, format);
10244 static void SDLCALL
10245 SDL_Downsample_S16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10248 fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 6 channels.\n");
10251 const int dstsize = cvt->len_cvt / 4;
10252 Sint16 *dst = (Sint16 *) cvt->buf;
10253 const Sint16 *src = (Sint16 *) cvt->buf;
10254 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
10255 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10256 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10257 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10258 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10259 Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
10260 Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
10261 while (dst < target) {
10262 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10263 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10264 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10265 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10266 const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
10267 const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
10269 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
10270 dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
10271 dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
10272 dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
10273 dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
10274 dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
10275 last_sample0 = sample0;
10276 last_sample1 = sample1;
10277 last_sample2 = sample2;
10278 last_sample3 = sample3;
10279 last_sample4 = sample4;
10280 last_sample5 = sample5;
10284 cvt->len_cvt = dstsize;
10285 if (cvt->filters[++cvt->filter_index]) {
10286 cvt->filters[cvt->filter_index] (cvt, format);
10290 static void SDLCALL
10291 SDL_Upsample_S16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10294 fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 8 channels.\n");
10297 const int dstsize = cvt->len_cvt * 2;
10298 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 2;
10299 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
10300 const Sint16 *target = ((const Sint16 *) cvt->buf);
10301 Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
10302 Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
10303 Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
10304 Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
10305 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10306 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10307 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10308 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10309 while (dst >= target) {
10310 const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
10311 const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
10312 const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
10313 const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
10314 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10315 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10316 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10317 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10319 dst[15] = (Sint16) ((sample7 + last_sample7) >> 1);
10320 dst[14] = (Sint16) ((sample6 + last_sample6) >> 1);
10321 dst[13] = (Sint16) ((sample5 + last_sample5) >> 1);
10322 dst[12] = (Sint16) ((sample4 + last_sample4) >> 1);
10323 dst[11] = (Sint16) ((sample3 + last_sample3) >> 1);
10324 dst[10] = (Sint16) ((sample2 + last_sample2) >> 1);
10325 dst[9] = (Sint16) ((sample1 + last_sample1) >> 1);
10326 dst[8] = (Sint16) ((sample0 + last_sample0) >> 1);
10327 dst[7] = (Sint16) sample7;
10328 dst[6] = (Sint16) sample6;
10329 dst[5] = (Sint16) sample5;
10330 dst[4] = (Sint16) sample4;
10331 dst[3] = (Sint16) sample3;
10332 dst[2] = (Sint16) sample2;
10333 dst[1] = (Sint16) sample1;
10334 dst[0] = (Sint16) sample0;
10335 last_sample7 = sample7;
10336 last_sample6 = sample6;
10337 last_sample5 = sample5;
10338 last_sample4 = sample4;
10339 last_sample3 = sample3;
10340 last_sample2 = sample2;
10341 last_sample1 = sample1;
10342 last_sample0 = sample0;
10346 cvt->len_cvt = dstsize;
10347 if (cvt->filters[++cvt->filter_index]) {
10348 cvt->filters[cvt->filter_index] (cvt, format);
10352 static void SDLCALL
10353 SDL_Downsample_S16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10356 fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 8 channels.\n");
10359 const int dstsize = cvt->len_cvt / 2;
10360 Sint16 *dst = (Sint16 *) cvt->buf;
10361 const Sint16 *src = (Sint16 *) cvt->buf;
10362 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
10363 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10364 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10365 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10366 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10367 Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
10368 Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
10369 Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
10370 Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
10371 while (dst < target) {
10372 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10373 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10374 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10375 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10376 const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
10377 const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
10378 const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
10379 const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
10381 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
10382 dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
10383 dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
10384 dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
10385 dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
10386 dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
10387 dst[6] = (Sint16) ((sample6 + last_sample6) >> 1);
10388 dst[7] = (Sint16) ((sample7 + last_sample7) >> 1);
10389 last_sample0 = sample0;
10390 last_sample1 = sample1;
10391 last_sample2 = sample2;
10392 last_sample3 = sample3;
10393 last_sample4 = sample4;
10394 last_sample5 = sample5;
10395 last_sample6 = sample6;
10396 last_sample7 = sample7;
10400 cvt->len_cvt = dstsize;
10401 if (cvt->filters[++cvt->filter_index]) {
10402 cvt->filters[cvt->filter_index] (cvt, format);
10406 static void SDLCALL
10407 SDL_Upsample_S16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10410 fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 8 channels.\n");
10413 const int dstsize = cvt->len_cvt * 4;
10414 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 4;
10415 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
10416 const Sint16 *target = ((const Sint16 *) cvt->buf);
10417 Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
10418 Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
10419 Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
10420 Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
10421 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10422 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10423 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10424 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10425 while (dst >= target) {
10426 const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
10427 const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
10428 const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
10429 const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
10430 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10431 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10432 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10433 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10435 dst[31] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2);
10436 dst[30] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2);
10437 dst[29] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2);
10438 dst[28] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2);
10439 dst[27] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
10440 dst[26] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
10441 dst[25] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
10442 dst[24] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
10443 dst[23] = (Sint16) ((sample7 + last_sample7) >> 1);
10444 dst[22] = (Sint16) ((sample6 + last_sample6) >> 1);
10445 dst[21] = (Sint16) ((sample5 + last_sample5) >> 1);
10446 dst[20] = (Sint16) ((sample4 + last_sample4) >> 1);
10447 dst[19] = (Sint16) ((sample3 + last_sample3) >> 1);
10448 dst[18] = (Sint16) ((sample2 + last_sample2) >> 1);
10449 dst[17] = (Sint16) ((sample1 + last_sample1) >> 1);
10450 dst[16] = (Sint16) ((sample0 + last_sample0) >> 1);
10451 dst[15] = (Sint16) (((3 * sample7) + last_sample7) >> 2);
10452 dst[14] = (Sint16) (((3 * sample6) + last_sample6) >> 2);
10453 dst[13] = (Sint16) (((3 * sample5) + last_sample5) >> 2);
10454 dst[12] = (Sint16) (((3 * sample4) + last_sample4) >> 2);
10455 dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
10456 dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
10457 dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
10458 dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
10459 dst[7] = (Sint16) sample7;
10460 dst[6] = (Sint16) sample6;
10461 dst[5] = (Sint16) sample5;
10462 dst[4] = (Sint16) sample4;
10463 dst[3] = (Sint16) sample3;
10464 dst[2] = (Sint16) sample2;
10465 dst[1] = (Sint16) sample1;
10466 dst[0] = (Sint16) sample0;
10467 last_sample7 = sample7;
10468 last_sample6 = sample6;
10469 last_sample5 = sample5;
10470 last_sample4 = sample4;
10471 last_sample3 = sample3;
10472 last_sample2 = sample2;
10473 last_sample1 = sample1;
10474 last_sample0 = sample0;
10478 cvt->len_cvt = dstsize;
10479 if (cvt->filters[++cvt->filter_index]) {
10480 cvt->filters[cvt->filter_index] (cvt, format);
10484 static void SDLCALL
10485 SDL_Downsample_S16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10488 fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 8 channels.\n");
10491 const int dstsize = cvt->len_cvt / 4;
10492 Sint16 *dst = (Sint16 *) cvt->buf;
10493 const Sint16 *src = (Sint16 *) cvt->buf;
10494 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
10495 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10496 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10497 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10498 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10499 Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
10500 Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
10501 Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
10502 Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
10503 while (dst < target) {
10504 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
10505 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
10506 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
10507 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
10508 const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
10509 const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
10510 const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
10511 const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
10513 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
10514 dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
10515 dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
10516 dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
10517 dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
10518 dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
10519 dst[6] = (Sint16) ((sample6 + last_sample6) >> 1);
10520 dst[7] = (Sint16) ((sample7 + last_sample7) >> 1);
10521 last_sample0 = sample0;
10522 last_sample1 = sample1;
10523 last_sample2 = sample2;
10524 last_sample3 = sample3;
10525 last_sample4 = sample4;
10526 last_sample5 = sample5;
10527 last_sample6 = sample6;
10528 last_sample7 = sample7;
10532 cvt->len_cvt = dstsize;
10533 if (cvt->filters[++cvt->filter_index]) {
10534 cvt->filters[cvt->filter_index] (cvt, format);
10538 static void SDLCALL
10539 SDL_Upsample_U16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10542 fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 1 channels.\n");
10545 const int dstsize = cvt->len_cvt * 2;
10546 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 2;
10547 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
10548 const Uint16 *target = ((const Uint16 *) cvt->buf);
10549 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
10550 while (dst >= target) {
10551 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
10553 dst[1] = (Uint16) ((sample0 + last_sample0) >> 1);
10554 dst[0] = (Uint16) sample0;
10555 last_sample0 = sample0;
10559 cvt->len_cvt = dstsize;
10560 if (cvt->filters[++cvt->filter_index]) {
10561 cvt->filters[cvt->filter_index] (cvt, format);
10565 static void SDLCALL
10566 SDL_Downsample_U16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10569 fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 1 channels.\n");
10572 const int dstsize = cvt->len_cvt / 2;
10573 Uint16 *dst = (Uint16 *) cvt->buf;
10574 const Uint16 *src = (Uint16 *) cvt->buf;
10575 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
10576 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
10577 while (dst < target) {
10578 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
10580 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
10581 last_sample0 = sample0;
10585 cvt->len_cvt = dstsize;
10586 if (cvt->filters[++cvt->filter_index]) {
10587 cvt->filters[cvt->filter_index] (cvt, format);
10591 static void SDLCALL
10592 SDL_Upsample_U16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10595 fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 1 channels.\n");
10598 const int dstsize = cvt->len_cvt * 4;
10599 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 4;
10600 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
10601 const Uint16 *target = ((const Uint16 *) cvt->buf);
10602 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
10603 while (dst >= target) {
10604 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
10606 dst[3] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
10607 dst[2] = (Uint16) ((sample0 + last_sample0) >> 1);
10608 dst[1] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
10609 dst[0] = (Uint16) sample0;
10610 last_sample0 = sample0;
10614 cvt->len_cvt = dstsize;
10615 if (cvt->filters[++cvt->filter_index]) {
10616 cvt->filters[cvt->filter_index] (cvt, format);
10620 static void SDLCALL
10621 SDL_Downsample_U16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10624 fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 1 channels.\n");
10627 const int dstsize = cvt->len_cvt / 4;
10628 Uint16 *dst = (Uint16 *) cvt->buf;
10629 const Uint16 *src = (Uint16 *) cvt->buf;
10630 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
10631 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
10632 while (dst < target) {
10633 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
10635 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
10636 last_sample0 = sample0;
10640 cvt->len_cvt = dstsize;
10641 if (cvt->filters[++cvt->filter_index]) {
10642 cvt->filters[cvt->filter_index] (cvt, format);
10646 static void SDLCALL
10647 SDL_Upsample_U16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10650 fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 2 channels.\n");
10653 const int dstsize = cvt->len_cvt * 2;
10654 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 2;
10655 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
10656 const Uint16 *target = ((const Uint16 *) cvt->buf);
10657 Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
10658 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
10659 while (dst >= target) {
10660 const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
10661 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
10663 dst[3] = (Uint16) ((sample1 + last_sample1) >> 1);
10664 dst[2] = (Uint16) ((sample0 + last_sample0) >> 1);
10665 dst[1] = (Uint16) sample1;
10666 dst[0] = (Uint16) sample0;
10667 last_sample1 = sample1;
10668 last_sample0 = sample0;
10672 cvt->len_cvt = dstsize;
10673 if (cvt->filters[++cvt->filter_index]) {
10674 cvt->filters[cvt->filter_index] (cvt, format);
10678 static void SDLCALL
10679 SDL_Downsample_U16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10682 fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 2 channels.\n");
10685 const int dstsize = cvt->len_cvt / 2;
10686 Uint16 *dst = (Uint16 *) cvt->buf;
10687 const Uint16 *src = (Uint16 *) cvt->buf;
10688 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
10689 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
10690 Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
10691 while (dst < target) {
10692 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
10693 const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
10695 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
10696 dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
10697 last_sample0 = sample0;
10698 last_sample1 = sample1;
10702 cvt->len_cvt = dstsize;
10703 if (cvt->filters[++cvt->filter_index]) {
10704 cvt->filters[cvt->filter_index] (cvt, format);
10708 static void SDLCALL
10709 SDL_Upsample_U16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10712 fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 2 channels.\n");
10715 const int dstsize = cvt->len_cvt * 4;
10716 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 4;
10717 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
10718 const Uint16 *target = ((const Uint16 *) cvt->buf);
10719 Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
10720 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
10721 while (dst >= target) {
10722 const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
10723 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
10725 dst[7] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
10726 dst[6] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
10727 dst[5] = (Uint16) ((sample1 + last_sample1) >> 1);
10728 dst[4] = (Uint16) ((sample0 + last_sample0) >> 1);
10729 dst[3] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
10730 dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
10731 dst[1] = (Uint16) sample1;
10732 dst[0] = (Uint16) sample0;
10733 last_sample1 = sample1;
10734 last_sample0 = sample0;
10738 cvt->len_cvt = dstsize;
10739 if (cvt->filters[++cvt->filter_index]) {
10740 cvt->filters[cvt->filter_index] (cvt, format);
10744 static void SDLCALL
10745 SDL_Downsample_U16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10748 fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 2 channels.\n");
10751 const int dstsize = cvt->len_cvt / 4;
10752 Uint16 *dst = (Uint16 *) cvt->buf;
10753 const Uint16 *src = (Uint16 *) cvt->buf;
10754 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
10755 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
10756 Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
10757 while (dst < target) {
10758 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
10759 const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
10761 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
10762 dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
10763 last_sample0 = sample0;
10764 last_sample1 = sample1;
10768 cvt->len_cvt = dstsize;
10769 if (cvt->filters[++cvt->filter_index]) {
10770 cvt->filters[cvt->filter_index] (cvt, format);
10774 static void SDLCALL
10775 SDL_Upsample_U16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10778 fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 4 channels.\n");
10781 const int dstsize = cvt->len_cvt * 2;
10782 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 2;
10783 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
10784 const Uint16 *target = ((const Uint16 *) cvt->buf);
10785 Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
10786 Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
10787 Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
10788 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
10789 while (dst >= target) {
10790 const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
10791 const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
10792 const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
10793 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
10795 dst[7] = (Uint16) ((sample3 + last_sample3) >> 1);
10796 dst[6] = (Uint16) ((sample2 + last_sample2) >> 1);
10797 dst[5] = (Uint16) ((sample1 + last_sample1) >> 1);
10798 dst[4] = (Uint16) ((sample0 + last_sample0) >> 1);
10799 dst[3] = (Uint16) sample3;
10800 dst[2] = (Uint16) sample2;
10801 dst[1] = (Uint16) sample1;
10802 dst[0] = (Uint16) sample0;
10803 last_sample3 = sample3;
10804 last_sample2 = sample2;
10805 last_sample1 = sample1;
10806 last_sample0 = sample0;
10810 cvt->len_cvt = dstsize;
10811 if (cvt->filters[++cvt->filter_index]) {
10812 cvt->filters[cvt->filter_index] (cvt, format);
10816 static void SDLCALL
10817 SDL_Downsample_U16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10820 fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 4 channels.\n");
10823 const int dstsize = cvt->len_cvt / 2;
10824 Uint16 *dst = (Uint16 *) cvt->buf;
10825 const Uint16 *src = (Uint16 *) cvt->buf;
10826 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
10827 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
10828 Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
10829 Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
10830 Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
10831 while (dst < target) {
10832 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
10833 const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
10834 const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
10835 const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
10837 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
10838 dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
10839 dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
10840 dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
10841 last_sample0 = sample0;
10842 last_sample1 = sample1;
10843 last_sample2 = sample2;
10844 last_sample3 = sample3;
10848 cvt->len_cvt = dstsize;
10849 if (cvt->filters[++cvt->filter_index]) {
10850 cvt->filters[cvt->filter_index] (cvt, format);
10854 static void SDLCALL
10855 SDL_Upsample_U16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10858 fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 4 channels.\n");
10861 const int dstsize = cvt->len_cvt * 4;
10862 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 4;
10863 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
10864 const Uint16 *target = ((const Uint16 *) cvt->buf);
10865 Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
10866 Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
10867 Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
10868 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
10869 while (dst >= target) {
10870 const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
10871 const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
10872 const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
10873 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
10875 dst[15] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
10876 dst[14] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
10877 dst[13] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
10878 dst[12] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
10879 dst[11] = (Uint16) ((sample3 + last_sample3) >> 1);
10880 dst[10] = (Uint16) ((sample2 + last_sample2) >> 1);
10881 dst[9] = (Uint16) ((sample1 + last_sample1) >> 1);
10882 dst[8] = (Uint16) ((sample0 + last_sample0) >> 1);
10883 dst[7] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
10884 dst[6] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
10885 dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
10886 dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
10887 dst[3] = (Uint16) sample3;
10888 dst[2] = (Uint16) sample2;
10889 dst[1] = (Uint16) sample1;
10890 dst[0] = (Uint16) sample0;
10891 last_sample3 = sample3;
10892 last_sample2 = sample2;
10893 last_sample1 = sample1;
10894 last_sample0 = sample0;
10898 cvt->len_cvt = dstsize;
10899 if (cvt->filters[++cvt->filter_index]) {
10900 cvt->filters[cvt->filter_index] (cvt, format);
10904 static void SDLCALL
10905 SDL_Downsample_U16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10908 fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 4 channels.\n");
10911 const int dstsize = cvt->len_cvt / 4;
10912 Uint16 *dst = (Uint16 *) cvt->buf;
10913 const Uint16 *src = (Uint16 *) cvt->buf;
10914 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
10915 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
10916 Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
10917 Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
10918 Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
10919 while (dst < target) {
10920 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
10921 const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
10922 const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
10923 const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
10925 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
10926 dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
10927 dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
10928 dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
10929 last_sample0 = sample0;
10930 last_sample1 = sample1;
10931 last_sample2 = sample2;
10932 last_sample3 = sample3;
10936 cvt->len_cvt = dstsize;
10937 if (cvt->filters[++cvt->filter_index]) {
10938 cvt->filters[cvt->filter_index] (cvt, format);
10942 static void SDLCALL
10943 SDL_Upsample_U16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10946 fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 6 channels.\n");
10949 const int dstsize = cvt->len_cvt * 2;
10950 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 2;
10951 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
10952 const Uint16 *target = ((const Uint16 *) cvt->buf);
10953 Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
10954 Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
10955 Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
10956 Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
10957 Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
10958 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
10959 while (dst >= target) {
10960 const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
10961 const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
10962 const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
10963 const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
10964 const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
10965 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
10967 dst[11] = (Uint16) ((sample5 + last_sample5) >> 1);
10968 dst[10] = (Uint16) ((sample4 + last_sample4) >> 1);
10969 dst[9] = (Uint16) ((sample3 + last_sample3) >> 1);
10970 dst[8] = (Uint16) ((sample2 + last_sample2) >> 1);
10971 dst[7] = (Uint16) ((sample1 + last_sample1) >> 1);
10972 dst[6] = (Uint16) ((sample0 + last_sample0) >> 1);
10973 dst[5] = (Uint16) sample5;
10974 dst[4] = (Uint16) sample4;
10975 dst[3] = (Uint16) sample3;
10976 dst[2] = (Uint16) sample2;
10977 dst[1] = (Uint16) sample1;
10978 dst[0] = (Uint16) sample0;
10979 last_sample5 = sample5;
10980 last_sample4 = sample4;
10981 last_sample3 = sample3;
10982 last_sample2 = sample2;
10983 last_sample1 = sample1;
10984 last_sample0 = sample0;
10988 cvt->len_cvt = dstsize;
10989 if (cvt->filters[++cvt->filter_index]) {
10990 cvt->filters[cvt->filter_index] (cvt, format);
10994 static void SDLCALL
10995 SDL_Downsample_U16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
10998 fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 6 channels.\n");
11001 const int dstsize = cvt->len_cvt / 2;
11002 Uint16 *dst = (Uint16 *) cvt->buf;
11003 const Uint16 *src = (Uint16 *) cvt->buf;
11004 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
11005 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
11006 Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
11007 Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
11008 Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
11009 Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
11010 Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
11011 while (dst < target) {
11012 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
11013 const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
11014 const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
11015 const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
11016 const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
11017 const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
11019 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
11020 dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
11021 dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
11022 dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
11023 dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
11024 dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
11025 last_sample0 = sample0;
11026 last_sample1 = sample1;
11027 last_sample2 = sample2;
11028 last_sample3 = sample3;
11029 last_sample4 = sample4;
11030 last_sample5 = sample5;
11034 cvt->len_cvt = dstsize;
11035 if (cvt->filters[++cvt->filter_index]) {
11036 cvt->filters[cvt->filter_index] (cvt, format);
11040 static void SDLCALL
11041 SDL_Upsample_U16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11044 fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 6 channels.\n");
11047 const int dstsize = cvt->len_cvt * 4;
11048 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 4;
11049 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
11050 const Uint16 *target = ((const Uint16 *) cvt->buf);
11051 Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
11052 Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
11053 Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
11054 Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
11055 Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
11056 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
11057 while (dst >= target) {
11058 const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
11059 const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
11060 const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
11061 const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
11062 const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
11063 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
11065 dst[23] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2);
11066 dst[22] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2);
11067 dst[21] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
11068 dst[20] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
11069 dst[19] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
11070 dst[18] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
11071 dst[17] = (Uint16) ((sample5 + last_sample5) >> 1);
11072 dst[16] = (Uint16) ((sample4 + last_sample4) >> 1);
11073 dst[15] = (Uint16) ((sample3 + last_sample3) >> 1);
11074 dst[14] = (Uint16) ((sample2 + last_sample2) >> 1);
11075 dst[13] = (Uint16) ((sample1 + last_sample1) >> 1);
11076 dst[12] = (Uint16) ((sample0 + last_sample0) >> 1);
11077 dst[11] = (Uint16) (((3 * sample5) + last_sample5) >> 2);
11078 dst[10] = (Uint16) (((3 * sample4) + last_sample4) >> 2);
11079 dst[9] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
11080 dst[8] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
11081 dst[7] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
11082 dst[6] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
11083 dst[5] = (Uint16) sample5;
11084 dst[4] = (Uint16) sample4;
11085 dst[3] = (Uint16) sample3;
11086 dst[2] = (Uint16) sample2;
11087 dst[1] = (Uint16) sample1;
11088 dst[0] = (Uint16) sample0;
11089 last_sample5 = sample5;
11090 last_sample4 = sample4;
11091 last_sample3 = sample3;
11092 last_sample2 = sample2;
11093 last_sample1 = sample1;
11094 last_sample0 = sample0;
11098 cvt->len_cvt = dstsize;
11099 if (cvt->filters[++cvt->filter_index]) {
11100 cvt->filters[cvt->filter_index] (cvt, format);
11104 static void SDLCALL
11105 SDL_Downsample_U16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11108 fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 6 channels.\n");
11111 const int dstsize = cvt->len_cvt / 4;
11112 Uint16 *dst = (Uint16 *) cvt->buf;
11113 const Uint16 *src = (Uint16 *) cvt->buf;
11114 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
11115 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
11116 Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
11117 Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
11118 Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
11119 Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
11120 Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
11121 while (dst < target) {
11122 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
11123 const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
11124 const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
11125 const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
11126 const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
11127 const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
11129 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
11130 dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
11131 dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
11132 dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
11133 dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
11134 dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
11135 last_sample0 = sample0;
11136 last_sample1 = sample1;
11137 last_sample2 = sample2;
11138 last_sample3 = sample3;
11139 last_sample4 = sample4;
11140 last_sample5 = sample5;
11144 cvt->len_cvt = dstsize;
11145 if (cvt->filters[++cvt->filter_index]) {
11146 cvt->filters[cvt->filter_index] (cvt, format);
11150 static void SDLCALL
11151 SDL_Upsample_U16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11154 fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 8 channels.\n");
11157 const int dstsize = cvt->len_cvt * 2;
11158 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 2;
11159 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
11160 const Uint16 *target = ((const Uint16 *) cvt->buf);
11161 Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]);
11162 Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]);
11163 Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
11164 Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
11165 Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
11166 Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
11167 Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
11168 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
11169 while (dst >= target) {
11170 const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]);
11171 const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]);
11172 const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
11173 const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
11174 const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
11175 const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
11176 const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
11177 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
11179 dst[15] = (Uint16) ((sample7 + last_sample7) >> 1);
11180 dst[14] = (Uint16) ((sample6 + last_sample6) >> 1);
11181 dst[13] = (Uint16) ((sample5 + last_sample5) >> 1);
11182 dst[12] = (Uint16) ((sample4 + last_sample4) >> 1);
11183 dst[11] = (Uint16) ((sample3 + last_sample3) >> 1);
11184 dst[10] = (Uint16) ((sample2 + last_sample2) >> 1);
11185 dst[9] = (Uint16) ((sample1 + last_sample1) >> 1);
11186 dst[8] = (Uint16) ((sample0 + last_sample0) >> 1);
11187 dst[7] = (Uint16) sample7;
11188 dst[6] = (Uint16) sample6;
11189 dst[5] = (Uint16) sample5;
11190 dst[4] = (Uint16) sample4;
11191 dst[3] = (Uint16) sample3;
11192 dst[2] = (Uint16) sample2;
11193 dst[1] = (Uint16) sample1;
11194 dst[0] = (Uint16) sample0;
11195 last_sample7 = sample7;
11196 last_sample6 = sample6;
11197 last_sample5 = sample5;
11198 last_sample4 = sample4;
11199 last_sample3 = sample3;
11200 last_sample2 = sample2;
11201 last_sample1 = sample1;
11202 last_sample0 = sample0;
11206 cvt->len_cvt = dstsize;
11207 if (cvt->filters[++cvt->filter_index]) {
11208 cvt->filters[cvt->filter_index] (cvt, format);
11212 static void SDLCALL
11213 SDL_Downsample_U16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11216 fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 8 channels.\n");
11219 const int dstsize = cvt->len_cvt / 2;
11220 Uint16 *dst = (Uint16 *) cvt->buf;
11221 const Uint16 *src = (Uint16 *) cvt->buf;
11222 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
11223 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
11224 Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
11225 Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
11226 Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
11227 Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
11228 Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
11229 Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]);
11230 Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]);
11231 while (dst < target) {
11232 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
11233 const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
11234 const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
11235 const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
11236 const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
11237 const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
11238 const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]);
11239 const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]);
11241 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
11242 dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
11243 dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
11244 dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
11245 dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
11246 dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
11247 dst[6] = (Uint16) ((sample6 + last_sample6) >> 1);
11248 dst[7] = (Uint16) ((sample7 + last_sample7) >> 1);
11249 last_sample0 = sample0;
11250 last_sample1 = sample1;
11251 last_sample2 = sample2;
11252 last_sample3 = sample3;
11253 last_sample4 = sample4;
11254 last_sample5 = sample5;
11255 last_sample6 = sample6;
11256 last_sample7 = sample7;
11260 cvt->len_cvt = dstsize;
11261 if (cvt->filters[++cvt->filter_index]) {
11262 cvt->filters[cvt->filter_index] (cvt, format);
11266 static void SDLCALL
11267 SDL_Upsample_U16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11270 fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 8 channels.\n");
11273 const int dstsize = cvt->len_cvt * 4;
11274 Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 4;
11275 const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
11276 const Uint16 *target = ((const Uint16 *) cvt->buf);
11277 Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]);
11278 Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]);
11279 Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
11280 Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
11281 Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
11282 Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
11283 Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
11284 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
11285 while (dst >= target) {
11286 const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]);
11287 const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]);
11288 const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
11289 const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
11290 const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
11291 const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
11292 const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
11293 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
11295 dst[31] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2);
11296 dst[30] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2);
11297 dst[29] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2);
11298 dst[28] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2);
11299 dst[27] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
11300 dst[26] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
11301 dst[25] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
11302 dst[24] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
11303 dst[23] = (Uint16) ((sample7 + last_sample7) >> 1);
11304 dst[22] = (Uint16) ((sample6 + last_sample6) >> 1);
11305 dst[21] = (Uint16) ((sample5 + last_sample5) >> 1);
11306 dst[20] = (Uint16) ((sample4 + last_sample4) >> 1);
11307 dst[19] = (Uint16) ((sample3 + last_sample3) >> 1);
11308 dst[18] = (Uint16) ((sample2 + last_sample2) >> 1);
11309 dst[17] = (Uint16) ((sample1 + last_sample1) >> 1);
11310 dst[16] = (Uint16) ((sample0 + last_sample0) >> 1);
11311 dst[15] = (Uint16) (((3 * sample7) + last_sample7) >> 2);
11312 dst[14] = (Uint16) (((3 * sample6) + last_sample6) >> 2);
11313 dst[13] = (Uint16) (((3 * sample5) + last_sample5) >> 2);
11314 dst[12] = (Uint16) (((3 * sample4) + last_sample4) >> 2);
11315 dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
11316 dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
11317 dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
11318 dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
11319 dst[7] = (Uint16) sample7;
11320 dst[6] = (Uint16) sample6;
11321 dst[5] = (Uint16) sample5;
11322 dst[4] = (Uint16) sample4;
11323 dst[3] = (Uint16) sample3;
11324 dst[2] = (Uint16) sample2;
11325 dst[1] = (Uint16) sample1;
11326 dst[0] = (Uint16) sample0;
11327 last_sample7 = sample7;
11328 last_sample6 = sample6;
11329 last_sample5 = sample5;
11330 last_sample4 = sample4;
11331 last_sample3 = sample3;
11332 last_sample2 = sample2;
11333 last_sample1 = sample1;
11334 last_sample0 = sample0;
11338 cvt->len_cvt = dstsize;
11339 if (cvt->filters[++cvt->filter_index]) {
11340 cvt->filters[cvt->filter_index] (cvt, format);
11344 static void SDLCALL
11345 SDL_Downsample_U16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11348 fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 8 channels.\n");
11351 const int dstsize = cvt->len_cvt / 4;
11352 Uint16 *dst = (Uint16 *) cvt->buf;
11353 const Uint16 *src = (Uint16 *) cvt->buf;
11354 const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
11355 Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
11356 Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
11357 Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
11358 Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
11359 Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
11360 Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
11361 Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]);
11362 Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]);
11363 while (dst < target) {
11364 const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
11365 const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
11366 const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
11367 const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
11368 const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
11369 const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
11370 const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]);
11371 const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]);
11373 dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
11374 dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
11375 dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
11376 dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
11377 dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
11378 dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
11379 dst[6] = (Uint16) ((sample6 + last_sample6) >> 1);
11380 dst[7] = (Uint16) ((sample7 + last_sample7) >> 1);
11381 last_sample0 = sample0;
11382 last_sample1 = sample1;
11383 last_sample2 = sample2;
11384 last_sample3 = sample3;
11385 last_sample4 = sample4;
11386 last_sample5 = sample5;
11387 last_sample6 = sample6;
11388 last_sample7 = sample7;
11392 cvt->len_cvt = dstsize;
11393 if (cvt->filters[++cvt->filter_index]) {
11394 cvt->filters[cvt->filter_index] (cvt, format);
11398 static void SDLCALL
11399 SDL_Upsample_S16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11402 fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 1 channels.\n");
11405 const int dstsize = cvt->len_cvt * 2;
11406 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 2;
11407 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
11408 const Sint16 *target = ((const Sint16 *) cvt->buf);
11409 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11410 while (dst >= target) {
11411 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11413 dst[1] = (Sint16) ((sample0 + last_sample0) >> 1);
11414 dst[0] = (Sint16) sample0;
11415 last_sample0 = sample0;
11419 cvt->len_cvt = dstsize;
11420 if (cvt->filters[++cvt->filter_index]) {
11421 cvt->filters[cvt->filter_index] (cvt, format);
11425 static void SDLCALL
11426 SDL_Downsample_S16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11429 fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 1 channels.\n");
11432 const int dstsize = cvt->len_cvt / 2;
11433 Sint16 *dst = (Sint16 *) cvt->buf;
11434 const Sint16 *src = (Sint16 *) cvt->buf;
11435 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
11436 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11437 while (dst < target) {
11438 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11440 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
11441 last_sample0 = sample0;
11445 cvt->len_cvt = dstsize;
11446 if (cvt->filters[++cvt->filter_index]) {
11447 cvt->filters[cvt->filter_index] (cvt, format);
11451 static void SDLCALL
11452 SDL_Upsample_S16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11455 fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 1 channels.\n");
11458 const int dstsize = cvt->len_cvt * 4;
11459 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 4;
11460 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
11461 const Sint16 *target = ((const Sint16 *) cvt->buf);
11462 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11463 while (dst >= target) {
11464 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11466 dst[3] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
11467 dst[2] = (Sint16) ((sample0 + last_sample0) >> 1);
11468 dst[1] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
11469 dst[0] = (Sint16) sample0;
11470 last_sample0 = sample0;
11474 cvt->len_cvt = dstsize;
11475 if (cvt->filters[++cvt->filter_index]) {
11476 cvt->filters[cvt->filter_index] (cvt, format);
11480 static void SDLCALL
11481 SDL_Downsample_S16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11484 fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 1 channels.\n");
11487 const int dstsize = cvt->len_cvt / 4;
11488 Sint16 *dst = (Sint16 *) cvt->buf;
11489 const Sint16 *src = (Sint16 *) cvt->buf;
11490 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
11491 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11492 while (dst < target) {
11493 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11495 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
11496 last_sample0 = sample0;
11500 cvt->len_cvt = dstsize;
11501 if (cvt->filters[++cvt->filter_index]) {
11502 cvt->filters[cvt->filter_index] (cvt, format);
11506 static void SDLCALL
11507 SDL_Upsample_S16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11510 fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 2 channels.\n");
11513 const int dstsize = cvt->len_cvt * 2;
11514 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 2;
11515 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
11516 const Sint16 *target = ((const Sint16 *) cvt->buf);
11517 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11518 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11519 while (dst >= target) {
11520 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11521 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11523 dst[3] = (Sint16) ((sample1 + last_sample1) >> 1);
11524 dst[2] = (Sint16) ((sample0 + last_sample0) >> 1);
11525 dst[1] = (Sint16) sample1;
11526 dst[0] = (Sint16) sample0;
11527 last_sample1 = sample1;
11528 last_sample0 = sample0;
11532 cvt->len_cvt = dstsize;
11533 if (cvt->filters[++cvt->filter_index]) {
11534 cvt->filters[cvt->filter_index] (cvt, format);
11538 static void SDLCALL
11539 SDL_Downsample_S16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11542 fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 2 channels.\n");
11545 const int dstsize = cvt->len_cvt / 2;
11546 Sint16 *dst = (Sint16 *) cvt->buf;
11547 const Sint16 *src = (Sint16 *) cvt->buf;
11548 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
11549 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11550 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11551 while (dst < target) {
11552 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11553 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11555 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
11556 dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
11557 last_sample0 = sample0;
11558 last_sample1 = sample1;
11562 cvt->len_cvt = dstsize;
11563 if (cvt->filters[++cvt->filter_index]) {
11564 cvt->filters[cvt->filter_index] (cvt, format);
11568 static void SDLCALL
11569 SDL_Upsample_S16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11572 fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 2 channels.\n");
11575 const int dstsize = cvt->len_cvt * 4;
11576 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 4;
11577 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
11578 const Sint16 *target = ((const Sint16 *) cvt->buf);
11579 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11580 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11581 while (dst >= target) {
11582 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11583 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11585 dst[7] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
11586 dst[6] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
11587 dst[5] = (Sint16) ((sample1 + last_sample1) >> 1);
11588 dst[4] = (Sint16) ((sample0 + last_sample0) >> 1);
11589 dst[3] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
11590 dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
11591 dst[1] = (Sint16) sample1;
11592 dst[0] = (Sint16) sample0;
11593 last_sample1 = sample1;
11594 last_sample0 = sample0;
11598 cvt->len_cvt = dstsize;
11599 if (cvt->filters[++cvt->filter_index]) {
11600 cvt->filters[cvt->filter_index] (cvt, format);
11604 static void SDLCALL
11605 SDL_Downsample_S16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11608 fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 2 channels.\n");
11611 const int dstsize = cvt->len_cvt / 4;
11612 Sint16 *dst = (Sint16 *) cvt->buf;
11613 const Sint16 *src = (Sint16 *) cvt->buf;
11614 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
11615 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11616 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11617 while (dst < target) {
11618 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11619 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11621 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
11622 dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
11623 last_sample0 = sample0;
11624 last_sample1 = sample1;
11628 cvt->len_cvt = dstsize;
11629 if (cvt->filters[++cvt->filter_index]) {
11630 cvt->filters[cvt->filter_index] (cvt, format);
11634 static void SDLCALL
11635 SDL_Upsample_S16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11638 fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 4 channels.\n");
11641 const int dstsize = cvt->len_cvt * 2;
11642 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 2;
11643 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
11644 const Sint16 *target = ((const Sint16 *) cvt->buf);
11645 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
11646 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
11647 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11648 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11649 while (dst >= target) {
11650 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
11651 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
11652 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11653 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11655 dst[7] = (Sint16) ((sample3 + last_sample3) >> 1);
11656 dst[6] = (Sint16) ((sample2 + last_sample2) >> 1);
11657 dst[5] = (Sint16) ((sample1 + last_sample1) >> 1);
11658 dst[4] = (Sint16) ((sample0 + last_sample0) >> 1);
11659 dst[3] = (Sint16) sample3;
11660 dst[2] = (Sint16) sample2;
11661 dst[1] = (Sint16) sample1;
11662 dst[0] = (Sint16) sample0;
11663 last_sample3 = sample3;
11664 last_sample2 = sample2;
11665 last_sample1 = sample1;
11666 last_sample0 = sample0;
11670 cvt->len_cvt = dstsize;
11671 if (cvt->filters[++cvt->filter_index]) {
11672 cvt->filters[cvt->filter_index] (cvt, format);
11676 static void SDLCALL
11677 SDL_Downsample_S16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11680 fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 4 channels.\n");
11683 const int dstsize = cvt->len_cvt / 2;
11684 Sint16 *dst = (Sint16 *) cvt->buf;
11685 const Sint16 *src = (Sint16 *) cvt->buf;
11686 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
11687 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11688 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11689 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
11690 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
11691 while (dst < target) {
11692 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11693 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11694 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
11695 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
11697 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
11698 dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
11699 dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
11700 dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
11701 last_sample0 = sample0;
11702 last_sample1 = sample1;
11703 last_sample2 = sample2;
11704 last_sample3 = sample3;
11708 cvt->len_cvt = dstsize;
11709 if (cvt->filters[++cvt->filter_index]) {
11710 cvt->filters[cvt->filter_index] (cvt, format);
11714 static void SDLCALL
11715 SDL_Upsample_S16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11718 fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 4 channels.\n");
11721 const int dstsize = cvt->len_cvt * 4;
11722 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 4;
11723 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
11724 const Sint16 *target = ((const Sint16 *) cvt->buf);
11725 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
11726 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
11727 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11728 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11729 while (dst >= target) {
11730 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
11731 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
11732 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11733 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11735 dst[15] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
11736 dst[14] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
11737 dst[13] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
11738 dst[12] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
11739 dst[11] = (Sint16) ((sample3 + last_sample3) >> 1);
11740 dst[10] = (Sint16) ((sample2 + last_sample2) >> 1);
11741 dst[9] = (Sint16) ((sample1 + last_sample1) >> 1);
11742 dst[8] = (Sint16) ((sample0 + last_sample0) >> 1);
11743 dst[7] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
11744 dst[6] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
11745 dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
11746 dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
11747 dst[3] = (Sint16) sample3;
11748 dst[2] = (Sint16) sample2;
11749 dst[1] = (Sint16) sample1;
11750 dst[0] = (Sint16) sample0;
11751 last_sample3 = sample3;
11752 last_sample2 = sample2;
11753 last_sample1 = sample1;
11754 last_sample0 = sample0;
11758 cvt->len_cvt = dstsize;
11759 if (cvt->filters[++cvt->filter_index]) {
11760 cvt->filters[cvt->filter_index] (cvt, format);
11764 static void SDLCALL
11765 SDL_Downsample_S16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11768 fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 4 channels.\n");
11771 const int dstsize = cvt->len_cvt / 4;
11772 Sint16 *dst = (Sint16 *) cvt->buf;
11773 const Sint16 *src = (Sint16 *) cvt->buf;
11774 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
11775 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11776 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11777 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
11778 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
11779 while (dst < target) {
11780 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11781 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11782 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
11783 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
11785 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
11786 dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
11787 dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
11788 dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
11789 last_sample0 = sample0;
11790 last_sample1 = sample1;
11791 last_sample2 = sample2;
11792 last_sample3 = sample3;
11796 cvt->len_cvt = dstsize;
11797 if (cvt->filters[++cvt->filter_index]) {
11798 cvt->filters[cvt->filter_index] (cvt, format);
11802 static void SDLCALL
11803 SDL_Upsample_S16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11806 fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 6 channels.\n");
11809 const int dstsize = cvt->len_cvt * 2;
11810 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 2;
11811 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
11812 const Sint16 *target = ((const Sint16 *) cvt->buf);
11813 Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
11814 Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
11815 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
11816 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
11817 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11818 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11819 while (dst >= target) {
11820 const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
11821 const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
11822 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
11823 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
11824 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11825 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11827 dst[11] = (Sint16) ((sample5 + last_sample5) >> 1);
11828 dst[10] = (Sint16) ((sample4 + last_sample4) >> 1);
11829 dst[9] = (Sint16) ((sample3 + last_sample3) >> 1);
11830 dst[8] = (Sint16) ((sample2 + last_sample2) >> 1);
11831 dst[7] = (Sint16) ((sample1 + last_sample1) >> 1);
11832 dst[6] = (Sint16) ((sample0 + last_sample0) >> 1);
11833 dst[5] = (Sint16) sample5;
11834 dst[4] = (Sint16) sample4;
11835 dst[3] = (Sint16) sample3;
11836 dst[2] = (Sint16) sample2;
11837 dst[1] = (Sint16) sample1;
11838 dst[0] = (Sint16) sample0;
11839 last_sample5 = sample5;
11840 last_sample4 = sample4;
11841 last_sample3 = sample3;
11842 last_sample2 = sample2;
11843 last_sample1 = sample1;
11844 last_sample0 = sample0;
11848 cvt->len_cvt = dstsize;
11849 if (cvt->filters[++cvt->filter_index]) {
11850 cvt->filters[cvt->filter_index] (cvt, format);
11854 static void SDLCALL
11855 SDL_Downsample_S16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11858 fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 6 channels.\n");
11861 const int dstsize = cvt->len_cvt / 2;
11862 Sint16 *dst = (Sint16 *) cvt->buf;
11863 const Sint16 *src = (Sint16 *) cvt->buf;
11864 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
11865 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11866 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11867 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
11868 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
11869 Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
11870 Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
11871 while (dst < target) {
11872 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11873 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11874 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
11875 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
11876 const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
11877 const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
11879 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
11880 dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
11881 dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
11882 dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
11883 dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
11884 dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
11885 last_sample0 = sample0;
11886 last_sample1 = sample1;
11887 last_sample2 = sample2;
11888 last_sample3 = sample3;
11889 last_sample4 = sample4;
11890 last_sample5 = sample5;
11894 cvt->len_cvt = dstsize;
11895 if (cvt->filters[++cvt->filter_index]) {
11896 cvt->filters[cvt->filter_index] (cvt, format);
11900 static void SDLCALL
11901 SDL_Upsample_S16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11904 fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 6 channels.\n");
11907 const int dstsize = cvt->len_cvt * 4;
11908 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 4;
11909 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
11910 const Sint16 *target = ((const Sint16 *) cvt->buf);
11911 Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
11912 Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
11913 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
11914 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
11915 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11916 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11917 while (dst >= target) {
11918 const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
11919 const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
11920 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
11921 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
11922 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11923 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11925 dst[23] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2);
11926 dst[22] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2);
11927 dst[21] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
11928 dst[20] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
11929 dst[19] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
11930 dst[18] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
11931 dst[17] = (Sint16) ((sample5 + last_sample5) >> 1);
11932 dst[16] = (Sint16) ((sample4 + last_sample4) >> 1);
11933 dst[15] = (Sint16) ((sample3 + last_sample3) >> 1);
11934 dst[14] = (Sint16) ((sample2 + last_sample2) >> 1);
11935 dst[13] = (Sint16) ((sample1 + last_sample1) >> 1);
11936 dst[12] = (Sint16) ((sample0 + last_sample0) >> 1);
11937 dst[11] = (Sint16) (((3 * sample5) + last_sample5) >> 2);
11938 dst[10] = (Sint16) (((3 * sample4) + last_sample4) >> 2);
11939 dst[9] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
11940 dst[8] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
11941 dst[7] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
11942 dst[6] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
11943 dst[5] = (Sint16) sample5;
11944 dst[4] = (Sint16) sample4;
11945 dst[3] = (Sint16) sample3;
11946 dst[2] = (Sint16) sample2;
11947 dst[1] = (Sint16) sample1;
11948 dst[0] = (Sint16) sample0;
11949 last_sample5 = sample5;
11950 last_sample4 = sample4;
11951 last_sample3 = sample3;
11952 last_sample2 = sample2;
11953 last_sample1 = sample1;
11954 last_sample0 = sample0;
11958 cvt->len_cvt = dstsize;
11959 if (cvt->filters[++cvt->filter_index]) {
11960 cvt->filters[cvt->filter_index] (cvt, format);
11964 static void SDLCALL
11965 SDL_Downsample_S16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
11968 fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 6 channels.\n");
11971 const int dstsize = cvt->len_cvt / 4;
11972 Sint16 *dst = (Sint16 *) cvt->buf;
11973 const Sint16 *src = (Sint16 *) cvt->buf;
11974 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
11975 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11976 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11977 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
11978 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
11979 Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
11980 Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
11981 while (dst < target) {
11982 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
11983 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
11984 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
11985 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
11986 const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
11987 const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
11989 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
11990 dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
11991 dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
11992 dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
11993 dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
11994 dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
11995 last_sample0 = sample0;
11996 last_sample1 = sample1;
11997 last_sample2 = sample2;
11998 last_sample3 = sample3;
11999 last_sample4 = sample4;
12000 last_sample5 = sample5;
12004 cvt->len_cvt = dstsize;
12005 if (cvt->filters[++cvt->filter_index]) {
12006 cvt->filters[cvt->filter_index] (cvt, format);
12010 static void SDLCALL
12011 SDL_Upsample_S16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12014 fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 8 channels.\n");
12017 const int dstsize = cvt->len_cvt * 2;
12018 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 2;
12019 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
12020 const Sint16 *target = ((const Sint16 *) cvt->buf);
12021 Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
12022 Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
12023 Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
12024 Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
12025 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
12026 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
12027 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
12028 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
12029 while (dst >= target) {
12030 const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
12031 const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
12032 const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
12033 const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
12034 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
12035 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
12036 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
12037 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
12039 dst[15] = (Sint16) ((sample7 + last_sample7) >> 1);
12040 dst[14] = (Sint16) ((sample6 + last_sample6) >> 1);
12041 dst[13] = (Sint16) ((sample5 + last_sample5) >> 1);
12042 dst[12] = (Sint16) ((sample4 + last_sample4) >> 1);
12043 dst[11] = (Sint16) ((sample3 + last_sample3) >> 1);
12044 dst[10] = (Sint16) ((sample2 + last_sample2) >> 1);
12045 dst[9] = (Sint16) ((sample1 + last_sample1) >> 1);
12046 dst[8] = (Sint16) ((sample0 + last_sample0) >> 1);
12047 dst[7] = (Sint16) sample7;
12048 dst[6] = (Sint16) sample6;
12049 dst[5] = (Sint16) sample5;
12050 dst[4] = (Sint16) sample4;
12051 dst[3] = (Sint16) sample3;
12052 dst[2] = (Sint16) sample2;
12053 dst[1] = (Sint16) sample1;
12054 dst[0] = (Sint16) sample0;
12055 last_sample7 = sample7;
12056 last_sample6 = sample6;
12057 last_sample5 = sample5;
12058 last_sample4 = sample4;
12059 last_sample3 = sample3;
12060 last_sample2 = sample2;
12061 last_sample1 = sample1;
12062 last_sample0 = sample0;
12066 cvt->len_cvt = dstsize;
12067 if (cvt->filters[++cvt->filter_index]) {
12068 cvt->filters[cvt->filter_index] (cvt, format);
12072 static void SDLCALL
12073 SDL_Downsample_S16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12076 fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 8 channels.\n");
12079 const int dstsize = cvt->len_cvt / 2;
12080 Sint16 *dst = (Sint16 *) cvt->buf;
12081 const Sint16 *src = (Sint16 *) cvt->buf;
12082 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
12083 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
12084 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
12085 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
12086 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
12087 Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
12088 Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
12089 Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
12090 Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
12091 while (dst < target) {
12092 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
12093 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
12094 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
12095 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
12096 const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
12097 const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
12098 const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
12099 const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
12101 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
12102 dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
12103 dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
12104 dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
12105 dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
12106 dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
12107 dst[6] = (Sint16) ((sample6 + last_sample6) >> 1);
12108 dst[7] = (Sint16) ((sample7 + last_sample7) >> 1);
12109 last_sample0 = sample0;
12110 last_sample1 = sample1;
12111 last_sample2 = sample2;
12112 last_sample3 = sample3;
12113 last_sample4 = sample4;
12114 last_sample5 = sample5;
12115 last_sample6 = sample6;
12116 last_sample7 = sample7;
12120 cvt->len_cvt = dstsize;
12121 if (cvt->filters[++cvt->filter_index]) {
12122 cvt->filters[cvt->filter_index] (cvt, format);
12126 static void SDLCALL
12127 SDL_Upsample_S16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12130 fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 8 channels.\n");
12133 const int dstsize = cvt->len_cvt * 4;
12134 Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 4;
12135 const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
12136 const Sint16 *target = ((const Sint16 *) cvt->buf);
12137 Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
12138 Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
12139 Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
12140 Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
12141 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
12142 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
12143 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
12144 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
12145 while (dst >= target) {
12146 const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
12147 const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
12148 const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
12149 const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
12150 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
12151 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
12152 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
12153 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
12155 dst[31] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2);
12156 dst[30] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2);
12157 dst[29] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2);
12158 dst[28] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2);
12159 dst[27] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
12160 dst[26] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
12161 dst[25] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
12162 dst[24] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
12163 dst[23] = (Sint16) ((sample7 + last_sample7) >> 1);
12164 dst[22] = (Sint16) ((sample6 + last_sample6) >> 1);
12165 dst[21] = (Sint16) ((sample5 + last_sample5) >> 1);
12166 dst[20] = (Sint16) ((sample4 + last_sample4) >> 1);
12167 dst[19] = (Sint16) ((sample3 + last_sample3) >> 1);
12168 dst[18] = (Sint16) ((sample2 + last_sample2) >> 1);
12169 dst[17] = (Sint16) ((sample1 + last_sample1) >> 1);
12170 dst[16] = (Sint16) ((sample0 + last_sample0) >> 1);
12171 dst[15] = (Sint16) (((3 * sample7) + last_sample7) >> 2);
12172 dst[14] = (Sint16) (((3 * sample6) + last_sample6) >> 2);
12173 dst[13] = (Sint16) (((3 * sample5) + last_sample5) >> 2);
12174 dst[12] = (Sint16) (((3 * sample4) + last_sample4) >> 2);
12175 dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
12176 dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
12177 dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
12178 dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
12179 dst[7] = (Sint16) sample7;
12180 dst[6] = (Sint16) sample6;
12181 dst[5] = (Sint16) sample5;
12182 dst[4] = (Sint16) sample4;
12183 dst[3] = (Sint16) sample3;
12184 dst[2] = (Sint16) sample2;
12185 dst[1] = (Sint16) sample1;
12186 dst[0] = (Sint16) sample0;
12187 last_sample7 = sample7;
12188 last_sample6 = sample6;
12189 last_sample5 = sample5;
12190 last_sample4 = sample4;
12191 last_sample3 = sample3;
12192 last_sample2 = sample2;
12193 last_sample1 = sample1;
12194 last_sample0 = sample0;
12198 cvt->len_cvt = dstsize;
12199 if (cvt->filters[++cvt->filter_index]) {
12200 cvt->filters[cvt->filter_index] (cvt, format);
12204 static void SDLCALL
12205 SDL_Downsample_S16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12208 fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 8 channels.\n");
12211 const int dstsize = cvt->len_cvt / 4;
12212 Sint16 *dst = (Sint16 *) cvt->buf;
12213 const Sint16 *src = (Sint16 *) cvt->buf;
12214 const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
12215 Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
12216 Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
12217 Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
12218 Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
12219 Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
12220 Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
12221 Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
12222 Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
12223 while (dst < target) {
12224 const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
12225 const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
12226 const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
12227 const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
12228 const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
12229 const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
12230 const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
12231 const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
12233 dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
12234 dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
12235 dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
12236 dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
12237 dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
12238 dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
12239 dst[6] = (Sint16) ((sample6 + last_sample6) >> 1);
12240 dst[7] = (Sint16) ((sample7 + last_sample7) >> 1);
12241 last_sample0 = sample0;
12242 last_sample1 = sample1;
12243 last_sample2 = sample2;
12244 last_sample3 = sample3;
12245 last_sample4 = sample4;
12246 last_sample5 = sample5;
12247 last_sample6 = sample6;
12248 last_sample7 = sample7;
12252 cvt->len_cvt = dstsize;
12253 if (cvt->filters[++cvt->filter_index]) {
12254 cvt->filters[cvt->filter_index] (cvt, format);
12258 static void SDLCALL
12259 SDL_Upsample_S32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12262 fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 1 channels.\n");
12265 const int dstsize = cvt->len_cvt * 2;
12266 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 2;
12267 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
12268 const Sint32 *target = ((const Sint32 *) cvt->buf);
12269 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12270 while (dst >= target) {
12271 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12273 dst[1] = (Sint32) ((sample0 + last_sample0) >> 1);
12274 dst[0] = (Sint32) sample0;
12275 last_sample0 = sample0;
12279 cvt->len_cvt = dstsize;
12280 if (cvt->filters[++cvt->filter_index]) {
12281 cvt->filters[cvt->filter_index] (cvt, format);
12285 static void SDLCALL
12286 SDL_Downsample_S32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12289 fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 1 channels.\n");
12292 const int dstsize = cvt->len_cvt / 2;
12293 Sint32 *dst = (Sint32 *) cvt->buf;
12294 const Sint32 *src = (Sint32 *) cvt->buf;
12295 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
12296 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12297 while (dst < target) {
12298 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12300 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
12301 last_sample0 = sample0;
12305 cvt->len_cvt = dstsize;
12306 if (cvt->filters[++cvt->filter_index]) {
12307 cvt->filters[cvt->filter_index] (cvt, format);
12311 static void SDLCALL
12312 SDL_Upsample_S32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12315 fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 1 channels.\n");
12318 const int dstsize = cvt->len_cvt * 4;
12319 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 4;
12320 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
12321 const Sint32 *target = ((const Sint32 *) cvt->buf);
12322 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12323 while (dst >= target) {
12324 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12326 dst[3] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
12327 dst[2] = (Sint32) ((sample0 + last_sample0) >> 1);
12328 dst[1] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
12329 dst[0] = (Sint32) sample0;
12330 last_sample0 = sample0;
12334 cvt->len_cvt = dstsize;
12335 if (cvt->filters[++cvt->filter_index]) {
12336 cvt->filters[cvt->filter_index] (cvt, format);
12340 static void SDLCALL
12341 SDL_Downsample_S32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12344 fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 1 channels.\n");
12347 const int dstsize = cvt->len_cvt / 4;
12348 Sint32 *dst = (Sint32 *) cvt->buf;
12349 const Sint32 *src = (Sint32 *) cvt->buf;
12350 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
12351 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12352 while (dst < target) {
12353 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12355 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
12356 last_sample0 = sample0;
12360 cvt->len_cvt = dstsize;
12361 if (cvt->filters[++cvt->filter_index]) {
12362 cvt->filters[cvt->filter_index] (cvt, format);
12366 static void SDLCALL
12367 SDL_Upsample_S32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12370 fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 2 channels.\n");
12373 const int dstsize = cvt->len_cvt * 2;
12374 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 2;
12375 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
12376 const Sint32 *target = ((const Sint32 *) cvt->buf);
12377 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12378 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12379 while (dst >= target) {
12380 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12381 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12383 dst[3] = (Sint32) ((sample1 + last_sample1) >> 1);
12384 dst[2] = (Sint32) ((sample0 + last_sample0) >> 1);
12385 dst[1] = (Sint32) sample1;
12386 dst[0] = (Sint32) sample0;
12387 last_sample1 = sample1;
12388 last_sample0 = sample0;
12392 cvt->len_cvt = dstsize;
12393 if (cvt->filters[++cvt->filter_index]) {
12394 cvt->filters[cvt->filter_index] (cvt, format);
12398 static void SDLCALL
12399 SDL_Downsample_S32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12402 fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 2 channels.\n");
12405 const int dstsize = cvt->len_cvt / 2;
12406 Sint32 *dst = (Sint32 *) cvt->buf;
12407 const Sint32 *src = (Sint32 *) cvt->buf;
12408 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
12409 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12410 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12411 while (dst < target) {
12412 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12413 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12415 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
12416 dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
12417 last_sample0 = sample0;
12418 last_sample1 = sample1;
12422 cvt->len_cvt = dstsize;
12423 if (cvt->filters[++cvt->filter_index]) {
12424 cvt->filters[cvt->filter_index] (cvt, format);
12428 static void SDLCALL
12429 SDL_Upsample_S32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12432 fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 2 channels.\n");
12435 const int dstsize = cvt->len_cvt * 4;
12436 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 4;
12437 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
12438 const Sint32 *target = ((const Sint32 *) cvt->buf);
12439 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12440 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12441 while (dst >= target) {
12442 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12443 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12445 dst[7] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
12446 dst[6] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
12447 dst[5] = (Sint32) ((sample1 + last_sample1) >> 1);
12448 dst[4] = (Sint32) ((sample0 + last_sample0) >> 1);
12449 dst[3] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
12450 dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
12451 dst[1] = (Sint32) sample1;
12452 dst[0] = (Sint32) sample0;
12453 last_sample1 = sample1;
12454 last_sample0 = sample0;
12458 cvt->len_cvt = dstsize;
12459 if (cvt->filters[++cvt->filter_index]) {
12460 cvt->filters[cvt->filter_index] (cvt, format);
12464 static void SDLCALL
12465 SDL_Downsample_S32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12468 fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 2 channels.\n");
12471 const int dstsize = cvt->len_cvt / 4;
12472 Sint32 *dst = (Sint32 *) cvt->buf;
12473 const Sint32 *src = (Sint32 *) cvt->buf;
12474 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
12475 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12476 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12477 while (dst < target) {
12478 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12479 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12481 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
12482 dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
12483 last_sample0 = sample0;
12484 last_sample1 = sample1;
12488 cvt->len_cvt = dstsize;
12489 if (cvt->filters[++cvt->filter_index]) {
12490 cvt->filters[cvt->filter_index] (cvt, format);
12494 static void SDLCALL
12495 SDL_Upsample_S32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12498 fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 4 channels.\n");
12501 const int dstsize = cvt->len_cvt * 2;
12502 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 2;
12503 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
12504 const Sint32 *target = ((const Sint32 *) cvt->buf);
12505 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12506 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12507 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12508 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12509 while (dst >= target) {
12510 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12511 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12512 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12513 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12515 dst[7] = (Sint32) ((sample3 + last_sample3) >> 1);
12516 dst[6] = (Sint32) ((sample2 + last_sample2) >> 1);
12517 dst[5] = (Sint32) ((sample1 + last_sample1) >> 1);
12518 dst[4] = (Sint32) ((sample0 + last_sample0) >> 1);
12519 dst[3] = (Sint32) sample3;
12520 dst[2] = (Sint32) sample2;
12521 dst[1] = (Sint32) sample1;
12522 dst[0] = (Sint32) sample0;
12523 last_sample3 = sample3;
12524 last_sample2 = sample2;
12525 last_sample1 = sample1;
12526 last_sample0 = sample0;
12530 cvt->len_cvt = dstsize;
12531 if (cvt->filters[++cvt->filter_index]) {
12532 cvt->filters[cvt->filter_index] (cvt, format);
12536 static void SDLCALL
12537 SDL_Downsample_S32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12540 fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 4 channels.\n");
12543 const int dstsize = cvt->len_cvt / 2;
12544 Sint32 *dst = (Sint32 *) cvt->buf;
12545 const Sint32 *src = (Sint32 *) cvt->buf;
12546 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
12547 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12548 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12549 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12550 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12551 while (dst < target) {
12552 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12553 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12554 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12555 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12557 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
12558 dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
12559 dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
12560 dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
12561 last_sample0 = sample0;
12562 last_sample1 = sample1;
12563 last_sample2 = sample2;
12564 last_sample3 = sample3;
12568 cvt->len_cvt = dstsize;
12569 if (cvt->filters[++cvt->filter_index]) {
12570 cvt->filters[cvt->filter_index] (cvt, format);
12574 static void SDLCALL
12575 SDL_Upsample_S32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12578 fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 4 channels.\n");
12581 const int dstsize = cvt->len_cvt * 4;
12582 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 4;
12583 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
12584 const Sint32 *target = ((const Sint32 *) cvt->buf);
12585 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12586 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12587 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12588 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12589 while (dst >= target) {
12590 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12591 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12592 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12593 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12595 dst[15] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
12596 dst[14] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
12597 dst[13] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
12598 dst[12] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
12599 dst[11] = (Sint32) ((sample3 + last_sample3) >> 1);
12600 dst[10] = (Sint32) ((sample2 + last_sample2) >> 1);
12601 dst[9] = (Sint32) ((sample1 + last_sample1) >> 1);
12602 dst[8] = (Sint32) ((sample0 + last_sample0) >> 1);
12603 dst[7] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
12604 dst[6] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
12605 dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
12606 dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
12607 dst[3] = (Sint32) sample3;
12608 dst[2] = (Sint32) sample2;
12609 dst[1] = (Sint32) sample1;
12610 dst[0] = (Sint32) sample0;
12611 last_sample3 = sample3;
12612 last_sample2 = sample2;
12613 last_sample1 = sample1;
12614 last_sample0 = sample0;
12618 cvt->len_cvt = dstsize;
12619 if (cvt->filters[++cvt->filter_index]) {
12620 cvt->filters[cvt->filter_index] (cvt, format);
12624 static void SDLCALL
12625 SDL_Downsample_S32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12628 fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 4 channels.\n");
12631 const int dstsize = cvt->len_cvt / 4;
12632 Sint32 *dst = (Sint32 *) cvt->buf;
12633 const Sint32 *src = (Sint32 *) cvt->buf;
12634 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
12635 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12636 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12637 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12638 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12639 while (dst < target) {
12640 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12641 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12642 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12643 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12645 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
12646 dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
12647 dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
12648 dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
12649 last_sample0 = sample0;
12650 last_sample1 = sample1;
12651 last_sample2 = sample2;
12652 last_sample3 = sample3;
12656 cvt->len_cvt = dstsize;
12657 if (cvt->filters[++cvt->filter_index]) {
12658 cvt->filters[cvt->filter_index] (cvt, format);
12662 static void SDLCALL
12663 SDL_Upsample_S32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12666 fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 6 channels.\n");
12669 const int dstsize = cvt->len_cvt * 2;
12670 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 2;
12671 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
12672 const Sint32 *target = ((const Sint32 *) cvt->buf);
12673 Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
12674 Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
12675 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12676 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12677 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12678 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12679 while (dst >= target) {
12680 const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
12681 const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
12682 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12683 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12684 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12685 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12687 dst[11] = (Sint32) ((sample5 + last_sample5) >> 1);
12688 dst[10] = (Sint32) ((sample4 + last_sample4) >> 1);
12689 dst[9] = (Sint32) ((sample3 + last_sample3) >> 1);
12690 dst[8] = (Sint32) ((sample2 + last_sample2) >> 1);
12691 dst[7] = (Sint32) ((sample1 + last_sample1) >> 1);
12692 dst[6] = (Sint32) ((sample0 + last_sample0) >> 1);
12693 dst[5] = (Sint32) sample5;
12694 dst[4] = (Sint32) sample4;
12695 dst[3] = (Sint32) sample3;
12696 dst[2] = (Sint32) sample2;
12697 dst[1] = (Sint32) sample1;
12698 dst[0] = (Sint32) sample0;
12699 last_sample5 = sample5;
12700 last_sample4 = sample4;
12701 last_sample3 = sample3;
12702 last_sample2 = sample2;
12703 last_sample1 = sample1;
12704 last_sample0 = sample0;
12708 cvt->len_cvt = dstsize;
12709 if (cvt->filters[++cvt->filter_index]) {
12710 cvt->filters[cvt->filter_index] (cvt, format);
12714 static void SDLCALL
12715 SDL_Downsample_S32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12718 fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 6 channels.\n");
12721 const int dstsize = cvt->len_cvt / 2;
12722 Sint32 *dst = (Sint32 *) cvt->buf;
12723 const Sint32 *src = (Sint32 *) cvt->buf;
12724 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
12725 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12726 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12727 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12728 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12729 Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
12730 Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
12731 while (dst < target) {
12732 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12733 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12734 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12735 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12736 const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
12737 const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
12739 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
12740 dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
12741 dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
12742 dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
12743 dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
12744 dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
12745 last_sample0 = sample0;
12746 last_sample1 = sample1;
12747 last_sample2 = sample2;
12748 last_sample3 = sample3;
12749 last_sample4 = sample4;
12750 last_sample5 = sample5;
12754 cvt->len_cvt = dstsize;
12755 if (cvt->filters[++cvt->filter_index]) {
12756 cvt->filters[cvt->filter_index] (cvt, format);
12760 static void SDLCALL
12761 SDL_Upsample_S32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12764 fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 6 channels.\n");
12767 const int dstsize = cvt->len_cvt * 4;
12768 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 4;
12769 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
12770 const Sint32 *target = ((const Sint32 *) cvt->buf);
12771 Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
12772 Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
12773 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12774 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12775 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12776 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12777 while (dst >= target) {
12778 const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
12779 const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
12780 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12781 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12782 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12783 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12785 dst[23] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2);
12786 dst[22] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2);
12787 dst[21] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
12788 dst[20] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
12789 dst[19] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
12790 dst[18] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
12791 dst[17] = (Sint32) ((sample5 + last_sample5) >> 1);
12792 dst[16] = (Sint32) ((sample4 + last_sample4) >> 1);
12793 dst[15] = (Sint32) ((sample3 + last_sample3) >> 1);
12794 dst[14] = (Sint32) ((sample2 + last_sample2) >> 1);
12795 dst[13] = (Sint32) ((sample1 + last_sample1) >> 1);
12796 dst[12] = (Sint32) ((sample0 + last_sample0) >> 1);
12797 dst[11] = (Sint32) (((3 * sample5) + last_sample5) >> 2);
12798 dst[10] = (Sint32) (((3 * sample4) + last_sample4) >> 2);
12799 dst[9] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
12800 dst[8] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
12801 dst[7] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
12802 dst[6] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
12803 dst[5] = (Sint32) sample5;
12804 dst[4] = (Sint32) sample4;
12805 dst[3] = (Sint32) sample3;
12806 dst[2] = (Sint32) sample2;
12807 dst[1] = (Sint32) sample1;
12808 dst[0] = (Sint32) sample0;
12809 last_sample5 = sample5;
12810 last_sample4 = sample4;
12811 last_sample3 = sample3;
12812 last_sample2 = sample2;
12813 last_sample1 = sample1;
12814 last_sample0 = sample0;
12818 cvt->len_cvt = dstsize;
12819 if (cvt->filters[++cvt->filter_index]) {
12820 cvt->filters[cvt->filter_index] (cvt, format);
12824 static void SDLCALL
12825 SDL_Downsample_S32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12828 fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 6 channels.\n");
12831 const int dstsize = cvt->len_cvt / 4;
12832 Sint32 *dst = (Sint32 *) cvt->buf;
12833 const Sint32 *src = (Sint32 *) cvt->buf;
12834 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
12835 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12836 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12837 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12838 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12839 Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
12840 Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
12841 while (dst < target) {
12842 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12843 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12844 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12845 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12846 const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
12847 const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
12849 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
12850 dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
12851 dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
12852 dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
12853 dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
12854 dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
12855 last_sample0 = sample0;
12856 last_sample1 = sample1;
12857 last_sample2 = sample2;
12858 last_sample3 = sample3;
12859 last_sample4 = sample4;
12860 last_sample5 = sample5;
12864 cvt->len_cvt = dstsize;
12865 if (cvt->filters[++cvt->filter_index]) {
12866 cvt->filters[cvt->filter_index] (cvt, format);
12870 static void SDLCALL
12871 SDL_Upsample_S32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12874 fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 8 channels.\n");
12877 const int dstsize = cvt->len_cvt * 2;
12878 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 2;
12879 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
12880 const Sint32 *target = ((const Sint32 *) cvt->buf);
12881 Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
12882 Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
12883 Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
12884 Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
12885 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12886 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12887 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12888 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12889 while (dst >= target) {
12890 const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
12891 const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
12892 const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
12893 const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
12894 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12895 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12896 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12897 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12899 dst[15] = (Sint32) ((sample7 + last_sample7) >> 1);
12900 dst[14] = (Sint32) ((sample6 + last_sample6) >> 1);
12901 dst[13] = (Sint32) ((sample5 + last_sample5) >> 1);
12902 dst[12] = (Sint32) ((sample4 + last_sample4) >> 1);
12903 dst[11] = (Sint32) ((sample3 + last_sample3) >> 1);
12904 dst[10] = (Sint32) ((sample2 + last_sample2) >> 1);
12905 dst[9] = (Sint32) ((sample1 + last_sample1) >> 1);
12906 dst[8] = (Sint32) ((sample0 + last_sample0) >> 1);
12907 dst[7] = (Sint32) sample7;
12908 dst[6] = (Sint32) sample6;
12909 dst[5] = (Sint32) sample5;
12910 dst[4] = (Sint32) sample4;
12911 dst[3] = (Sint32) sample3;
12912 dst[2] = (Sint32) sample2;
12913 dst[1] = (Sint32) sample1;
12914 dst[0] = (Sint32) sample0;
12915 last_sample7 = sample7;
12916 last_sample6 = sample6;
12917 last_sample5 = sample5;
12918 last_sample4 = sample4;
12919 last_sample3 = sample3;
12920 last_sample2 = sample2;
12921 last_sample1 = sample1;
12922 last_sample0 = sample0;
12926 cvt->len_cvt = dstsize;
12927 if (cvt->filters[++cvt->filter_index]) {
12928 cvt->filters[cvt->filter_index] (cvt, format);
12932 static void SDLCALL
12933 SDL_Downsample_S32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12936 fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 8 channels.\n");
12939 const int dstsize = cvt->len_cvt / 2;
12940 Sint32 *dst = (Sint32 *) cvt->buf;
12941 const Sint32 *src = (Sint32 *) cvt->buf;
12942 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
12943 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12944 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12945 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12946 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12947 Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
12948 Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
12949 Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
12950 Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
12951 while (dst < target) {
12952 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
12953 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
12954 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
12955 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
12956 const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
12957 const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
12958 const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
12959 const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
12961 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
12962 dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
12963 dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
12964 dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
12965 dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
12966 dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
12967 dst[6] = (Sint32) ((sample6 + last_sample6) >> 1);
12968 dst[7] = (Sint32) ((sample7 + last_sample7) >> 1);
12969 last_sample0 = sample0;
12970 last_sample1 = sample1;
12971 last_sample2 = sample2;
12972 last_sample3 = sample3;
12973 last_sample4 = sample4;
12974 last_sample5 = sample5;
12975 last_sample6 = sample6;
12976 last_sample7 = sample7;
12980 cvt->len_cvt = dstsize;
12981 if (cvt->filters[++cvt->filter_index]) {
12982 cvt->filters[cvt->filter_index] (cvt, format);
12986 static void SDLCALL
12987 SDL_Upsample_S32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
12990 fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 8 channels.\n");
12993 const int dstsize = cvt->len_cvt * 4;
12994 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 4;
12995 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
12996 const Sint32 *target = ((const Sint32 *) cvt->buf);
12997 Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
12998 Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
12999 Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
13000 Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
13001 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
13002 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
13003 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
13004 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
13005 while (dst >= target) {
13006 const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
13007 const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
13008 const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
13009 const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
13010 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
13011 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
13012 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
13013 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
13015 dst[31] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2);
13016 dst[30] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2);
13017 dst[29] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2);
13018 dst[28] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2);
13019 dst[27] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
13020 dst[26] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
13021 dst[25] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
13022 dst[24] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
13023 dst[23] = (Sint32) ((sample7 + last_sample7) >> 1);
13024 dst[22] = (Sint32) ((sample6 + last_sample6) >> 1);
13025 dst[21] = (Sint32) ((sample5 + last_sample5) >> 1);
13026 dst[20] = (Sint32) ((sample4 + last_sample4) >> 1);
13027 dst[19] = (Sint32) ((sample3 + last_sample3) >> 1);
13028 dst[18] = (Sint32) ((sample2 + last_sample2) >> 1);
13029 dst[17] = (Sint32) ((sample1 + last_sample1) >> 1);
13030 dst[16] = (Sint32) ((sample0 + last_sample0) >> 1);
13031 dst[15] = (Sint32) (((3 * sample7) + last_sample7) >> 2);
13032 dst[14] = (Sint32) (((3 * sample6) + last_sample6) >> 2);
13033 dst[13] = (Sint32) (((3 * sample5) + last_sample5) >> 2);
13034 dst[12] = (Sint32) (((3 * sample4) + last_sample4) >> 2);
13035 dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
13036 dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
13037 dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
13038 dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
13039 dst[7] = (Sint32) sample7;
13040 dst[6] = (Sint32) sample6;
13041 dst[5] = (Sint32) sample5;
13042 dst[4] = (Sint32) sample4;
13043 dst[3] = (Sint32) sample3;
13044 dst[2] = (Sint32) sample2;
13045 dst[1] = (Sint32) sample1;
13046 dst[0] = (Sint32) sample0;
13047 last_sample7 = sample7;
13048 last_sample6 = sample6;
13049 last_sample5 = sample5;
13050 last_sample4 = sample4;
13051 last_sample3 = sample3;
13052 last_sample2 = sample2;
13053 last_sample1 = sample1;
13054 last_sample0 = sample0;
13058 cvt->len_cvt = dstsize;
13059 if (cvt->filters[++cvt->filter_index]) {
13060 cvt->filters[cvt->filter_index] (cvt, format);
13064 static void SDLCALL
13065 SDL_Downsample_S32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13068 fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 8 channels.\n");
13071 const int dstsize = cvt->len_cvt / 4;
13072 Sint32 *dst = (Sint32 *) cvt->buf;
13073 const Sint32 *src = (Sint32 *) cvt->buf;
13074 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
13075 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
13076 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
13077 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
13078 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
13079 Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
13080 Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
13081 Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
13082 Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
13083 while (dst < target) {
13084 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
13085 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
13086 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
13087 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
13088 const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
13089 const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
13090 const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
13091 const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
13093 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
13094 dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
13095 dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
13096 dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
13097 dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
13098 dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
13099 dst[6] = (Sint32) ((sample6 + last_sample6) >> 1);
13100 dst[7] = (Sint32) ((sample7 + last_sample7) >> 1);
13101 last_sample0 = sample0;
13102 last_sample1 = sample1;
13103 last_sample2 = sample2;
13104 last_sample3 = sample3;
13105 last_sample4 = sample4;
13106 last_sample5 = sample5;
13107 last_sample6 = sample6;
13108 last_sample7 = sample7;
13112 cvt->len_cvt = dstsize;
13113 if (cvt->filters[++cvt->filter_index]) {
13114 cvt->filters[cvt->filter_index] (cvt, format);
13118 static void SDLCALL
13119 SDL_Upsample_S32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13122 fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 1 channels.\n");
13125 const int dstsize = cvt->len_cvt * 2;
13126 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 2;
13127 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
13128 const Sint32 *target = ((const Sint32 *) cvt->buf);
13129 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13130 while (dst >= target) {
13131 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13133 dst[1] = (Sint32) ((sample0 + last_sample0) >> 1);
13134 dst[0] = (Sint32) sample0;
13135 last_sample0 = sample0;
13139 cvt->len_cvt = dstsize;
13140 if (cvt->filters[++cvt->filter_index]) {
13141 cvt->filters[cvt->filter_index] (cvt, format);
13145 static void SDLCALL
13146 SDL_Downsample_S32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13149 fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 1 channels.\n");
13152 const int dstsize = cvt->len_cvt / 2;
13153 Sint32 *dst = (Sint32 *) cvt->buf;
13154 const Sint32 *src = (Sint32 *) cvt->buf;
13155 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
13156 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13157 while (dst < target) {
13158 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13160 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
13161 last_sample0 = sample0;
13165 cvt->len_cvt = dstsize;
13166 if (cvt->filters[++cvt->filter_index]) {
13167 cvt->filters[cvt->filter_index] (cvt, format);
13171 static void SDLCALL
13172 SDL_Upsample_S32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13175 fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 1 channels.\n");
13178 const int dstsize = cvt->len_cvt * 4;
13179 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 4;
13180 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
13181 const Sint32 *target = ((const Sint32 *) cvt->buf);
13182 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13183 while (dst >= target) {
13184 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13186 dst[3] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
13187 dst[2] = (Sint32) ((sample0 + last_sample0) >> 1);
13188 dst[1] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
13189 dst[0] = (Sint32) sample0;
13190 last_sample0 = sample0;
13194 cvt->len_cvt = dstsize;
13195 if (cvt->filters[++cvt->filter_index]) {
13196 cvt->filters[cvt->filter_index] (cvt, format);
13200 static void SDLCALL
13201 SDL_Downsample_S32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13204 fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 1 channels.\n");
13207 const int dstsize = cvt->len_cvt / 4;
13208 Sint32 *dst = (Sint32 *) cvt->buf;
13209 const Sint32 *src = (Sint32 *) cvt->buf;
13210 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
13211 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13212 while (dst < target) {
13213 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13215 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
13216 last_sample0 = sample0;
13220 cvt->len_cvt = dstsize;
13221 if (cvt->filters[++cvt->filter_index]) {
13222 cvt->filters[cvt->filter_index] (cvt, format);
13226 static void SDLCALL
13227 SDL_Upsample_S32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13230 fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 2 channels.\n");
13233 const int dstsize = cvt->len_cvt * 2;
13234 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 2;
13235 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
13236 const Sint32 *target = ((const Sint32 *) cvt->buf);
13237 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13238 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13239 while (dst >= target) {
13240 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13241 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13243 dst[3] = (Sint32) ((sample1 + last_sample1) >> 1);
13244 dst[2] = (Sint32) ((sample0 + last_sample0) >> 1);
13245 dst[1] = (Sint32) sample1;
13246 dst[0] = (Sint32) sample0;
13247 last_sample1 = sample1;
13248 last_sample0 = sample0;
13252 cvt->len_cvt = dstsize;
13253 if (cvt->filters[++cvt->filter_index]) {
13254 cvt->filters[cvt->filter_index] (cvt, format);
13258 static void SDLCALL
13259 SDL_Downsample_S32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13262 fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 2 channels.\n");
13265 const int dstsize = cvt->len_cvt / 2;
13266 Sint32 *dst = (Sint32 *) cvt->buf;
13267 const Sint32 *src = (Sint32 *) cvt->buf;
13268 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
13269 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13270 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13271 while (dst < target) {
13272 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13273 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13275 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
13276 dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
13277 last_sample0 = sample0;
13278 last_sample1 = sample1;
13282 cvt->len_cvt = dstsize;
13283 if (cvt->filters[++cvt->filter_index]) {
13284 cvt->filters[cvt->filter_index] (cvt, format);
13288 static void SDLCALL
13289 SDL_Upsample_S32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13292 fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 2 channels.\n");
13295 const int dstsize = cvt->len_cvt * 4;
13296 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 4;
13297 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
13298 const Sint32 *target = ((const Sint32 *) cvt->buf);
13299 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13300 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13301 while (dst >= target) {
13302 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13303 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13305 dst[7] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
13306 dst[6] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
13307 dst[5] = (Sint32) ((sample1 + last_sample1) >> 1);
13308 dst[4] = (Sint32) ((sample0 + last_sample0) >> 1);
13309 dst[3] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
13310 dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
13311 dst[1] = (Sint32) sample1;
13312 dst[0] = (Sint32) sample0;
13313 last_sample1 = sample1;
13314 last_sample0 = sample0;
13318 cvt->len_cvt = dstsize;
13319 if (cvt->filters[++cvt->filter_index]) {
13320 cvt->filters[cvt->filter_index] (cvt, format);
13324 static void SDLCALL
13325 SDL_Downsample_S32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13328 fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 2 channels.\n");
13331 const int dstsize = cvt->len_cvt / 4;
13332 Sint32 *dst = (Sint32 *) cvt->buf;
13333 const Sint32 *src = (Sint32 *) cvt->buf;
13334 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
13335 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13336 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13337 while (dst < target) {
13338 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13339 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13341 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
13342 dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
13343 last_sample0 = sample0;
13344 last_sample1 = sample1;
13348 cvt->len_cvt = dstsize;
13349 if (cvt->filters[++cvt->filter_index]) {
13350 cvt->filters[cvt->filter_index] (cvt, format);
13354 static void SDLCALL
13355 SDL_Upsample_S32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13358 fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 4 channels.\n");
13361 const int dstsize = cvt->len_cvt * 2;
13362 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 2;
13363 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
13364 const Sint32 *target = ((const Sint32 *) cvt->buf);
13365 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13366 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13367 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13368 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13369 while (dst >= target) {
13370 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13371 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13372 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13373 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13375 dst[7] = (Sint32) ((sample3 + last_sample3) >> 1);
13376 dst[6] = (Sint32) ((sample2 + last_sample2) >> 1);
13377 dst[5] = (Sint32) ((sample1 + last_sample1) >> 1);
13378 dst[4] = (Sint32) ((sample0 + last_sample0) >> 1);
13379 dst[3] = (Sint32) sample3;
13380 dst[2] = (Sint32) sample2;
13381 dst[1] = (Sint32) sample1;
13382 dst[0] = (Sint32) sample0;
13383 last_sample3 = sample3;
13384 last_sample2 = sample2;
13385 last_sample1 = sample1;
13386 last_sample0 = sample0;
13390 cvt->len_cvt = dstsize;
13391 if (cvt->filters[++cvt->filter_index]) {
13392 cvt->filters[cvt->filter_index] (cvt, format);
13396 static void SDLCALL
13397 SDL_Downsample_S32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13400 fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 4 channels.\n");
13403 const int dstsize = cvt->len_cvt / 2;
13404 Sint32 *dst = (Sint32 *) cvt->buf;
13405 const Sint32 *src = (Sint32 *) cvt->buf;
13406 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
13407 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13408 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13409 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13410 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13411 while (dst < target) {
13412 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13413 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13414 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13415 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13417 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
13418 dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
13419 dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
13420 dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
13421 last_sample0 = sample0;
13422 last_sample1 = sample1;
13423 last_sample2 = sample2;
13424 last_sample3 = sample3;
13428 cvt->len_cvt = dstsize;
13429 if (cvt->filters[++cvt->filter_index]) {
13430 cvt->filters[cvt->filter_index] (cvt, format);
13434 static void SDLCALL
13435 SDL_Upsample_S32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13438 fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 4 channels.\n");
13441 const int dstsize = cvt->len_cvt * 4;
13442 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 4;
13443 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
13444 const Sint32 *target = ((const Sint32 *) cvt->buf);
13445 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13446 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13447 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13448 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13449 while (dst >= target) {
13450 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13451 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13452 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13453 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13455 dst[15] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
13456 dst[14] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
13457 dst[13] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
13458 dst[12] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
13459 dst[11] = (Sint32) ((sample3 + last_sample3) >> 1);
13460 dst[10] = (Sint32) ((sample2 + last_sample2) >> 1);
13461 dst[9] = (Sint32) ((sample1 + last_sample1) >> 1);
13462 dst[8] = (Sint32) ((sample0 + last_sample0) >> 1);
13463 dst[7] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
13464 dst[6] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
13465 dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
13466 dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
13467 dst[3] = (Sint32) sample3;
13468 dst[2] = (Sint32) sample2;
13469 dst[1] = (Sint32) sample1;
13470 dst[0] = (Sint32) sample0;
13471 last_sample3 = sample3;
13472 last_sample2 = sample2;
13473 last_sample1 = sample1;
13474 last_sample0 = sample0;
13478 cvt->len_cvt = dstsize;
13479 if (cvt->filters[++cvt->filter_index]) {
13480 cvt->filters[cvt->filter_index] (cvt, format);
13484 static void SDLCALL
13485 SDL_Downsample_S32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13488 fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 4 channels.\n");
13491 const int dstsize = cvt->len_cvt / 4;
13492 Sint32 *dst = (Sint32 *) cvt->buf;
13493 const Sint32 *src = (Sint32 *) cvt->buf;
13494 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
13495 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13496 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13497 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13498 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13499 while (dst < target) {
13500 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13501 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13502 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13503 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13505 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
13506 dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
13507 dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
13508 dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
13509 last_sample0 = sample0;
13510 last_sample1 = sample1;
13511 last_sample2 = sample2;
13512 last_sample3 = sample3;
13516 cvt->len_cvt = dstsize;
13517 if (cvt->filters[++cvt->filter_index]) {
13518 cvt->filters[cvt->filter_index] (cvt, format);
13522 static void SDLCALL
13523 SDL_Upsample_S32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13526 fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 6 channels.\n");
13529 const int dstsize = cvt->len_cvt * 2;
13530 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 2;
13531 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
13532 const Sint32 *target = ((const Sint32 *) cvt->buf);
13533 Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
13534 Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
13535 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13536 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13537 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13538 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13539 while (dst >= target) {
13540 const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
13541 const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
13542 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13543 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13544 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13545 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13547 dst[11] = (Sint32) ((sample5 + last_sample5) >> 1);
13548 dst[10] = (Sint32) ((sample4 + last_sample4) >> 1);
13549 dst[9] = (Sint32) ((sample3 + last_sample3) >> 1);
13550 dst[8] = (Sint32) ((sample2 + last_sample2) >> 1);
13551 dst[7] = (Sint32) ((sample1 + last_sample1) >> 1);
13552 dst[6] = (Sint32) ((sample0 + last_sample0) >> 1);
13553 dst[5] = (Sint32) sample5;
13554 dst[4] = (Sint32) sample4;
13555 dst[3] = (Sint32) sample3;
13556 dst[2] = (Sint32) sample2;
13557 dst[1] = (Sint32) sample1;
13558 dst[0] = (Sint32) sample0;
13559 last_sample5 = sample5;
13560 last_sample4 = sample4;
13561 last_sample3 = sample3;
13562 last_sample2 = sample2;
13563 last_sample1 = sample1;
13564 last_sample0 = sample0;
13568 cvt->len_cvt = dstsize;
13569 if (cvt->filters[++cvt->filter_index]) {
13570 cvt->filters[cvt->filter_index] (cvt, format);
13574 static void SDLCALL
13575 SDL_Downsample_S32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13578 fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 6 channels.\n");
13581 const int dstsize = cvt->len_cvt / 2;
13582 Sint32 *dst = (Sint32 *) cvt->buf;
13583 const Sint32 *src = (Sint32 *) cvt->buf;
13584 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
13585 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13586 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13587 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13588 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13589 Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
13590 Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
13591 while (dst < target) {
13592 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13593 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13594 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13595 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13596 const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
13597 const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
13599 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
13600 dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
13601 dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
13602 dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
13603 dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
13604 dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
13605 last_sample0 = sample0;
13606 last_sample1 = sample1;
13607 last_sample2 = sample2;
13608 last_sample3 = sample3;
13609 last_sample4 = sample4;
13610 last_sample5 = sample5;
13614 cvt->len_cvt = dstsize;
13615 if (cvt->filters[++cvt->filter_index]) {
13616 cvt->filters[cvt->filter_index] (cvt, format);
13620 static void SDLCALL
13621 SDL_Upsample_S32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13624 fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 6 channels.\n");
13627 const int dstsize = cvt->len_cvt * 4;
13628 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 4;
13629 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
13630 const Sint32 *target = ((const Sint32 *) cvt->buf);
13631 Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
13632 Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
13633 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13634 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13635 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13636 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13637 while (dst >= target) {
13638 const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
13639 const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
13640 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13641 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13642 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13643 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13645 dst[23] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2);
13646 dst[22] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2);
13647 dst[21] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
13648 dst[20] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
13649 dst[19] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
13650 dst[18] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
13651 dst[17] = (Sint32) ((sample5 + last_sample5) >> 1);
13652 dst[16] = (Sint32) ((sample4 + last_sample4) >> 1);
13653 dst[15] = (Sint32) ((sample3 + last_sample3) >> 1);
13654 dst[14] = (Sint32) ((sample2 + last_sample2) >> 1);
13655 dst[13] = (Sint32) ((sample1 + last_sample1) >> 1);
13656 dst[12] = (Sint32) ((sample0 + last_sample0) >> 1);
13657 dst[11] = (Sint32) (((3 * sample5) + last_sample5) >> 2);
13658 dst[10] = (Sint32) (((3 * sample4) + last_sample4) >> 2);
13659 dst[9] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
13660 dst[8] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
13661 dst[7] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
13662 dst[6] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
13663 dst[5] = (Sint32) sample5;
13664 dst[4] = (Sint32) sample4;
13665 dst[3] = (Sint32) sample3;
13666 dst[2] = (Sint32) sample2;
13667 dst[1] = (Sint32) sample1;
13668 dst[0] = (Sint32) sample0;
13669 last_sample5 = sample5;
13670 last_sample4 = sample4;
13671 last_sample3 = sample3;
13672 last_sample2 = sample2;
13673 last_sample1 = sample1;
13674 last_sample0 = sample0;
13678 cvt->len_cvt = dstsize;
13679 if (cvt->filters[++cvt->filter_index]) {
13680 cvt->filters[cvt->filter_index] (cvt, format);
13684 static void SDLCALL
13685 SDL_Downsample_S32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13688 fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 6 channels.\n");
13691 const int dstsize = cvt->len_cvt / 4;
13692 Sint32 *dst = (Sint32 *) cvt->buf;
13693 const Sint32 *src = (Sint32 *) cvt->buf;
13694 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
13695 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13696 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13697 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13698 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13699 Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
13700 Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
13701 while (dst < target) {
13702 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13703 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13704 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13705 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13706 const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
13707 const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
13709 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
13710 dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
13711 dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
13712 dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
13713 dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
13714 dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
13715 last_sample0 = sample0;
13716 last_sample1 = sample1;
13717 last_sample2 = sample2;
13718 last_sample3 = sample3;
13719 last_sample4 = sample4;
13720 last_sample5 = sample5;
13724 cvt->len_cvt = dstsize;
13725 if (cvt->filters[++cvt->filter_index]) {
13726 cvt->filters[cvt->filter_index] (cvt, format);
13730 static void SDLCALL
13731 SDL_Upsample_S32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13734 fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 8 channels.\n");
13737 const int dstsize = cvt->len_cvt * 2;
13738 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 2;
13739 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
13740 const Sint32 *target = ((const Sint32 *) cvt->buf);
13741 Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
13742 Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
13743 Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
13744 Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
13745 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13746 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13747 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13748 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13749 while (dst >= target) {
13750 const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
13751 const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
13752 const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
13753 const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
13754 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13755 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13756 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13757 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13759 dst[15] = (Sint32) ((sample7 + last_sample7) >> 1);
13760 dst[14] = (Sint32) ((sample6 + last_sample6) >> 1);
13761 dst[13] = (Sint32) ((sample5 + last_sample5) >> 1);
13762 dst[12] = (Sint32) ((sample4 + last_sample4) >> 1);
13763 dst[11] = (Sint32) ((sample3 + last_sample3) >> 1);
13764 dst[10] = (Sint32) ((sample2 + last_sample2) >> 1);
13765 dst[9] = (Sint32) ((sample1 + last_sample1) >> 1);
13766 dst[8] = (Sint32) ((sample0 + last_sample0) >> 1);
13767 dst[7] = (Sint32) sample7;
13768 dst[6] = (Sint32) sample6;
13769 dst[5] = (Sint32) sample5;
13770 dst[4] = (Sint32) sample4;
13771 dst[3] = (Sint32) sample3;
13772 dst[2] = (Sint32) sample2;
13773 dst[1] = (Sint32) sample1;
13774 dst[0] = (Sint32) sample0;
13775 last_sample7 = sample7;
13776 last_sample6 = sample6;
13777 last_sample5 = sample5;
13778 last_sample4 = sample4;
13779 last_sample3 = sample3;
13780 last_sample2 = sample2;
13781 last_sample1 = sample1;
13782 last_sample0 = sample0;
13786 cvt->len_cvt = dstsize;
13787 if (cvt->filters[++cvt->filter_index]) {
13788 cvt->filters[cvt->filter_index] (cvt, format);
13792 static void SDLCALL
13793 SDL_Downsample_S32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13796 fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 8 channels.\n");
13799 const int dstsize = cvt->len_cvt / 2;
13800 Sint32 *dst = (Sint32 *) cvt->buf;
13801 const Sint32 *src = (Sint32 *) cvt->buf;
13802 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
13803 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13804 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13805 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13806 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13807 Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
13808 Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
13809 Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
13810 Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
13811 while (dst < target) {
13812 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13813 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13814 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13815 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13816 const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
13817 const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
13818 const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
13819 const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
13821 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
13822 dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
13823 dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
13824 dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
13825 dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
13826 dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
13827 dst[6] = (Sint32) ((sample6 + last_sample6) >> 1);
13828 dst[7] = (Sint32) ((sample7 + last_sample7) >> 1);
13829 last_sample0 = sample0;
13830 last_sample1 = sample1;
13831 last_sample2 = sample2;
13832 last_sample3 = sample3;
13833 last_sample4 = sample4;
13834 last_sample5 = sample5;
13835 last_sample6 = sample6;
13836 last_sample7 = sample7;
13840 cvt->len_cvt = dstsize;
13841 if (cvt->filters[++cvt->filter_index]) {
13842 cvt->filters[cvt->filter_index] (cvt, format);
13846 static void SDLCALL
13847 SDL_Upsample_S32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13850 fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 8 channels.\n");
13853 const int dstsize = cvt->len_cvt * 4;
13854 Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 4;
13855 const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
13856 const Sint32 *target = ((const Sint32 *) cvt->buf);
13857 Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
13858 Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
13859 Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
13860 Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
13861 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13862 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13863 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13864 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13865 while (dst >= target) {
13866 const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
13867 const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
13868 const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
13869 const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
13870 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13871 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13872 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13873 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13875 dst[31] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2);
13876 dst[30] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2);
13877 dst[29] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2);
13878 dst[28] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2);
13879 dst[27] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
13880 dst[26] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
13881 dst[25] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
13882 dst[24] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
13883 dst[23] = (Sint32) ((sample7 + last_sample7) >> 1);
13884 dst[22] = (Sint32) ((sample6 + last_sample6) >> 1);
13885 dst[21] = (Sint32) ((sample5 + last_sample5) >> 1);
13886 dst[20] = (Sint32) ((sample4 + last_sample4) >> 1);
13887 dst[19] = (Sint32) ((sample3 + last_sample3) >> 1);
13888 dst[18] = (Sint32) ((sample2 + last_sample2) >> 1);
13889 dst[17] = (Sint32) ((sample1 + last_sample1) >> 1);
13890 dst[16] = (Sint32) ((sample0 + last_sample0) >> 1);
13891 dst[15] = (Sint32) (((3 * sample7) + last_sample7) >> 2);
13892 dst[14] = (Sint32) (((3 * sample6) + last_sample6) >> 2);
13893 dst[13] = (Sint32) (((3 * sample5) + last_sample5) >> 2);
13894 dst[12] = (Sint32) (((3 * sample4) + last_sample4) >> 2);
13895 dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
13896 dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
13897 dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
13898 dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
13899 dst[7] = (Sint32) sample7;
13900 dst[6] = (Sint32) sample6;
13901 dst[5] = (Sint32) sample5;
13902 dst[4] = (Sint32) sample4;
13903 dst[3] = (Sint32) sample3;
13904 dst[2] = (Sint32) sample2;
13905 dst[1] = (Sint32) sample1;
13906 dst[0] = (Sint32) sample0;
13907 last_sample7 = sample7;
13908 last_sample6 = sample6;
13909 last_sample5 = sample5;
13910 last_sample4 = sample4;
13911 last_sample3 = sample3;
13912 last_sample2 = sample2;
13913 last_sample1 = sample1;
13914 last_sample0 = sample0;
13918 cvt->len_cvt = dstsize;
13919 if (cvt->filters[++cvt->filter_index]) {
13920 cvt->filters[cvt->filter_index] (cvt, format);
13924 static void SDLCALL
13925 SDL_Downsample_S32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13928 fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 8 channels.\n");
13931 const int dstsize = cvt->len_cvt / 4;
13932 Sint32 *dst = (Sint32 *) cvt->buf;
13933 const Sint32 *src = (Sint32 *) cvt->buf;
13934 const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
13935 Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13936 Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13937 Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13938 Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13939 Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
13940 Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
13941 Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
13942 Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
13943 while (dst < target) {
13944 const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
13945 const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
13946 const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
13947 const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
13948 const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
13949 const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
13950 const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
13951 const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
13953 dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
13954 dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
13955 dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
13956 dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
13957 dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
13958 dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
13959 dst[6] = (Sint32) ((sample6 + last_sample6) >> 1);
13960 dst[7] = (Sint32) ((sample7 + last_sample7) >> 1);
13961 last_sample0 = sample0;
13962 last_sample1 = sample1;
13963 last_sample2 = sample2;
13964 last_sample3 = sample3;
13965 last_sample4 = sample4;
13966 last_sample5 = sample5;
13967 last_sample6 = sample6;
13968 last_sample7 = sample7;
13972 cvt->len_cvt = dstsize;
13973 if (cvt->filters[++cvt->filter_index]) {
13974 cvt->filters[cvt->filter_index] (cvt, format);
13978 static void SDLCALL
13979 SDL_Upsample_F32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
13982 fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 1 channels.\n");
13985 const int dstsize = cvt->len_cvt * 2;
13986 float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 2;
13987 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
13988 const float *target = ((const float *) cvt->buf);
13989 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
13990 while (dst >= target) {
13991 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
13993 dst[1] = (float) ((sample0 + last_sample0) * 0.5);
13994 dst[0] = (float) sample0;
13995 last_sample0 = sample0;
13999 cvt->len_cvt = dstsize;
14000 if (cvt->filters[++cvt->filter_index]) {
14001 cvt->filters[cvt->filter_index] (cvt, format);
14005 static void SDLCALL
14006 SDL_Downsample_F32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14009 fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 1 channels.\n");
14012 const int dstsize = cvt->len_cvt / 2;
14013 float *dst = (float *) cvt->buf;
14014 const float *src = (float *) cvt->buf;
14015 const float *target = (const float *) (cvt->buf + dstsize);
14016 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14017 while (dst < target) {
14018 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14020 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
14021 last_sample0 = sample0;
14025 cvt->len_cvt = dstsize;
14026 if (cvt->filters[++cvt->filter_index]) {
14027 cvt->filters[cvt->filter_index] (cvt, format);
14031 static void SDLCALL
14032 SDL_Upsample_F32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14035 fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 1 channels.\n");
14038 const int dstsize = cvt->len_cvt * 4;
14039 float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 4;
14040 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
14041 const float *target = ((const float *) cvt->buf);
14042 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14043 while (dst >= target) {
14044 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14046 dst[3] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
14047 dst[2] = (float) ((sample0 + last_sample0) * 0.5);
14048 dst[1] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
14049 dst[0] = (float) sample0;
14050 last_sample0 = sample0;
14054 cvt->len_cvt = dstsize;
14055 if (cvt->filters[++cvt->filter_index]) {
14056 cvt->filters[cvt->filter_index] (cvt, format);
14060 static void SDLCALL
14061 SDL_Downsample_F32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14064 fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 1 channels.\n");
14067 const int dstsize = cvt->len_cvt / 4;
14068 float *dst = (float *) cvt->buf;
14069 const float *src = (float *) cvt->buf;
14070 const float *target = (const float *) (cvt->buf + dstsize);
14071 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14072 while (dst < target) {
14073 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14075 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
14076 last_sample0 = sample0;
14080 cvt->len_cvt = dstsize;
14081 if (cvt->filters[++cvt->filter_index]) {
14082 cvt->filters[cvt->filter_index] (cvt, format);
14086 static void SDLCALL
14087 SDL_Upsample_F32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14090 fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 2 channels.\n");
14093 const int dstsize = cvt->len_cvt * 2;
14094 float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 2;
14095 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
14096 const float *target = ((const float *) cvt->buf);
14097 double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
14098 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14099 while (dst >= target) {
14100 const double sample1 = (double) SDL_SwapFloatLE(src[1]);
14101 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14103 dst[3] = (float) ((sample1 + last_sample1) * 0.5);
14104 dst[2] = (float) ((sample0 + last_sample0) * 0.5);
14105 dst[1] = (float) sample1;
14106 dst[0] = (float) sample0;
14107 last_sample1 = sample1;
14108 last_sample0 = sample0;
14112 cvt->len_cvt = dstsize;
14113 if (cvt->filters[++cvt->filter_index]) {
14114 cvt->filters[cvt->filter_index] (cvt, format);
14118 static void SDLCALL
14119 SDL_Downsample_F32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14122 fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 2 channels.\n");
14125 const int dstsize = cvt->len_cvt / 2;
14126 float *dst = (float *) cvt->buf;
14127 const float *src = (float *) cvt->buf;
14128 const float *target = (const float *) (cvt->buf + dstsize);
14129 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14130 double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
14131 while (dst < target) {
14132 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14133 const double sample1 = (double) SDL_SwapFloatLE(src[1]);
14135 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
14136 dst[1] = (float) ((sample1 + last_sample1) * 0.5);
14137 last_sample0 = sample0;
14138 last_sample1 = sample1;
14142 cvt->len_cvt = dstsize;
14143 if (cvt->filters[++cvt->filter_index]) {
14144 cvt->filters[cvt->filter_index] (cvt, format);
14148 static void SDLCALL
14149 SDL_Upsample_F32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14152 fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 2 channels.\n");
14155 const int dstsize = cvt->len_cvt * 4;
14156 float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 4;
14157 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
14158 const float *target = ((const float *) cvt->buf);
14159 double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
14160 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14161 while (dst >= target) {
14162 const double sample1 = (double) SDL_SwapFloatLE(src[1]);
14163 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14165 dst[7] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
14166 dst[6] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
14167 dst[5] = (float) ((sample1 + last_sample1) * 0.5);
14168 dst[4] = (float) ((sample0 + last_sample0) * 0.5);
14169 dst[3] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
14170 dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
14171 dst[1] = (float) sample1;
14172 dst[0] = (float) sample0;
14173 last_sample1 = sample1;
14174 last_sample0 = sample0;
14178 cvt->len_cvt = dstsize;
14179 if (cvt->filters[++cvt->filter_index]) {
14180 cvt->filters[cvt->filter_index] (cvt, format);
14184 static void SDLCALL
14185 SDL_Downsample_F32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14188 fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 2 channels.\n");
14191 const int dstsize = cvt->len_cvt / 4;
14192 float *dst = (float *) cvt->buf;
14193 const float *src = (float *) cvt->buf;
14194 const float *target = (const float *) (cvt->buf + dstsize);
14195 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14196 double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
14197 while (dst < target) {
14198 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14199 const double sample1 = (double) SDL_SwapFloatLE(src[1]);
14201 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
14202 dst[1] = (float) ((sample1 + last_sample1) * 0.5);
14203 last_sample0 = sample0;
14204 last_sample1 = sample1;
14208 cvt->len_cvt = dstsize;
14209 if (cvt->filters[++cvt->filter_index]) {
14210 cvt->filters[cvt->filter_index] (cvt, format);
14214 static void SDLCALL
14215 SDL_Upsample_F32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14218 fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 4 channels.\n");
14221 const int dstsize = cvt->len_cvt * 2;
14222 float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 2;
14223 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
14224 const float *target = ((const float *) cvt->buf);
14225 double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
14226 double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
14227 double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
14228 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14229 while (dst >= target) {
14230 const double sample3 = (double) SDL_SwapFloatLE(src[3]);
14231 const double sample2 = (double) SDL_SwapFloatLE(src[2]);
14232 const double sample1 = (double) SDL_SwapFloatLE(src[1]);
14233 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14235 dst[7] = (float) ((sample3 + last_sample3) * 0.5);
14236 dst[6] = (float) ((sample2 + last_sample2) * 0.5);
14237 dst[5] = (float) ((sample1 + last_sample1) * 0.5);
14238 dst[4] = (float) ((sample0 + last_sample0) * 0.5);
14239 dst[3] = (float) sample3;
14240 dst[2] = (float) sample2;
14241 dst[1] = (float) sample1;
14242 dst[0] = (float) sample0;
14243 last_sample3 = sample3;
14244 last_sample2 = sample2;
14245 last_sample1 = sample1;
14246 last_sample0 = sample0;
14250 cvt->len_cvt = dstsize;
14251 if (cvt->filters[++cvt->filter_index]) {
14252 cvt->filters[cvt->filter_index] (cvt, format);
14256 static void SDLCALL
14257 SDL_Downsample_F32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14260 fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 4 channels.\n");
14263 const int dstsize = cvt->len_cvt / 2;
14264 float *dst = (float *) cvt->buf;
14265 const float *src = (float *) cvt->buf;
14266 const float *target = (const float *) (cvt->buf + dstsize);
14267 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14268 double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
14269 double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
14270 double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
14271 while (dst < target) {
14272 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14273 const double sample1 = (double) SDL_SwapFloatLE(src[1]);
14274 const double sample2 = (double) SDL_SwapFloatLE(src[2]);
14275 const double sample3 = (double) SDL_SwapFloatLE(src[3]);
14277 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
14278 dst[1] = (float) ((sample1 + last_sample1) * 0.5);
14279 dst[2] = (float) ((sample2 + last_sample2) * 0.5);
14280 dst[3] = (float) ((sample3 + last_sample3) * 0.5);
14281 last_sample0 = sample0;
14282 last_sample1 = sample1;
14283 last_sample2 = sample2;
14284 last_sample3 = sample3;
14288 cvt->len_cvt = dstsize;
14289 if (cvt->filters[++cvt->filter_index]) {
14290 cvt->filters[cvt->filter_index] (cvt, format);
14294 static void SDLCALL
14295 SDL_Upsample_F32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14298 fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 4 channels.\n");
14301 const int dstsize = cvt->len_cvt * 4;
14302 float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 4;
14303 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
14304 const float *target = ((const float *) cvt->buf);
14305 double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
14306 double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
14307 double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
14308 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14309 while (dst >= target) {
14310 const double sample3 = (double) SDL_SwapFloatLE(src[3]);
14311 const double sample2 = (double) SDL_SwapFloatLE(src[2]);
14312 const double sample1 = (double) SDL_SwapFloatLE(src[1]);
14313 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14315 dst[15] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
14316 dst[14] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
14317 dst[13] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
14318 dst[12] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
14319 dst[11] = (float) ((sample3 + last_sample3) * 0.5);
14320 dst[10] = (float) ((sample2 + last_sample2) * 0.5);
14321 dst[9] = (float) ((sample1 + last_sample1) * 0.5);
14322 dst[8] = (float) ((sample0 + last_sample0) * 0.5);
14323 dst[7] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
14324 dst[6] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
14325 dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
14326 dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
14327 dst[3] = (float) sample3;
14328 dst[2] = (float) sample2;
14329 dst[1] = (float) sample1;
14330 dst[0] = (float) sample0;
14331 last_sample3 = sample3;
14332 last_sample2 = sample2;
14333 last_sample1 = sample1;
14334 last_sample0 = sample0;
14338 cvt->len_cvt = dstsize;
14339 if (cvt->filters[++cvt->filter_index]) {
14340 cvt->filters[cvt->filter_index] (cvt, format);
14344 static void SDLCALL
14345 SDL_Downsample_F32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14348 fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 4 channels.\n");
14351 const int dstsize = cvt->len_cvt / 4;
14352 float *dst = (float *) cvt->buf;
14353 const float *src = (float *) cvt->buf;
14354 const float *target = (const float *) (cvt->buf + dstsize);
14355 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14356 double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
14357 double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
14358 double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
14359 while (dst < target) {
14360 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14361 const double sample1 = (double) SDL_SwapFloatLE(src[1]);
14362 const double sample2 = (double) SDL_SwapFloatLE(src[2]);
14363 const double sample3 = (double) SDL_SwapFloatLE(src[3]);
14365 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
14366 dst[1] = (float) ((sample1 + last_sample1) * 0.5);
14367 dst[2] = (float) ((sample2 + last_sample2) * 0.5);
14368 dst[3] = (float) ((sample3 + last_sample3) * 0.5);
14369 last_sample0 = sample0;
14370 last_sample1 = sample1;
14371 last_sample2 = sample2;
14372 last_sample3 = sample3;
14376 cvt->len_cvt = dstsize;
14377 if (cvt->filters[++cvt->filter_index]) {
14378 cvt->filters[cvt->filter_index] (cvt, format);
14382 static void SDLCALL
14383 SDL_Upsample_F32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14386 fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 6 channels.\n");
14389 const int dstsize = cvt->len_cvt * 2;
14390 float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 2;
14391 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
14392 const float *target = ((const float *) cvt->buf);
14393 double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
14394 double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
14395 double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
14396 double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
14397 double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
14398 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14399 while (dst >= target) {
14400 const double sample5 = (double) SDL_SwapFloatLE(src[5]);
14401 const double sample4 = (double) SDL_SwapFloatLE(src[4]);
14402 const double sample3 = (double) SDL_SwapFloatLE(src[3]);
14403 const double sample2 = (double) SDL_SwapFloatLE(src[2]);
14404 const double sample1 = (double) SDL_SwapFloatLE(src[1]);
14405 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14407 dst[11] = (float) ((sample5 + last_sample5) * 0.5);
14408 dst[10] = (float) ((sample4 + last_sample4) * 0.5);
14409 dst[9] = (float) ((sample3 + last_sample3) * 0.5);
14410 dst[8] = (float) ((sample2 + last_sample2) * 0.5);
14411 dst[7] = (float) ((sample1 + last_sample1) * 0.5);
14412 dst[6] = (float) ((sample0 + last_sample0) * 0.5);
14413 dst[5] = (float) sample5;
14414 dst[4] = (float) sample4;
14415 dst[3] = (float) sample3;
14416 dst[2] = (float) sample2;
14417 dst[1] = (float) sample1;
14418 dst[0] = (float) sample0;
14419 last_sample5 = sample5;
14420 last_sample4 = sample4;
14421 last_sample3 = sample3;
14422 last_sample2 = sample2;
14423 last_sample1 = sample1;
14424 last_sample0 = sample0;
14428 cvt->len_cvt = dstsize;
14429 if (cvt->filters[++cvt->filter_index]) {
14430 cvt->filters[cvt->filter_index] (cvt, format);
14434 static void SDLCALL
14435 SDL_Downsample_F32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14438 fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 6 channels.\n");
14441 const int dstsize = cvt->len_cvt / 2;
14442 float *dst = (float *) cvt->buf;
14443 const float *src = (float *) cvt->buf;
14444 const float *target = (const float *) (cvt->buf + dstsize);
14445 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14446 double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
14447 double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
14448 double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
14449 double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
14450 double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
14451 while (dst < target) {
14452 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14453 const double sample1 = (double) SDL_SwapFloatLE(src[1]);
14454 const double sample2 = (double) SDL_SwapFloatLE(src[2]);
14455 const double sample3 = (double) SDL_SwapFloatLE(src[3]);
14456 const double sample4 = (double) SDL_SwapFloatLE(src[4]);
14457 const double sample5 = (double) SDL_SwapFloatLE(src[5]);
14459 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
14460 dst[1] = (float) ((sample1 + last_sample1) * 0.5);
14461 dst[2] = (float) ((sample2 + last_sample2) * 0.5);
14462 dst[3] = (float) ((sample3 + last_sample3) * 0.5);
14463 dst[4] = (float) ((sample4 + last_sample4) * 0.5);
14464 dst[5] = (float) ((sample5 + last_sample5) * 0.5);
14465 last_sample0 = sample0;
14466 last_sample1 = sample1;
14467 last_sample2 = sample2;
14468 last_sample3 = sample3;
14469 last_sample4 = sample4;
14470 last_sample5 = sample5;
14474 cvt->len_cvt = dstsize;
14475 if (cvt->filters[++cvt->filter_index]) {
14476 cvt->filters[cvt->filter_index] (cvt, format);
14480 static void SDLCALL
14481 SDL_Upsample_F32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14484 fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 6 channels.\n");
14487 const int dstsize = cvt->len_cvt * 4;
14488 float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 4;
14489 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
14490 const float *target = ((const float *) cvt->buf);
14491 double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
14492 double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
14493 double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
14494 double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
14495 double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
14496 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14497 while (dst >= target) {
14498 const double sample5 = (double) SDL_SwapFloatLE(src[5]);
14499 const double sample4 = (double) SDL_SwapFloatLE(src[4]);
14500 const double sample3 = (double) SDL_SwapFloatLE(src[3]);
14501 const double sample2 = (double) SDL_SwapFloatLE(src[2]);
14502 const double sample1 = (double) SDL_SwapFloatLE(src[1]);
14503 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14505 dst[23] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25);
14506 dst[22] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25);
14507 dst[21] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
14508 dst[20] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
14509 dst[19] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
14510 dst[18] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
14511 dst[17] = (float) ((sample5 + last_sample5) * 0.5);
14512 dst[16] = (float) ((sample4 + last_sample4) * 0.5);
14513 dst[15] = (float) ((sample3 + last_sample3) * 0.5);
14514 dst[14] = (float) ((sample2 + last_sample2) * 0.5);
14515 dst[13] = (float) ((sample1 + last_sample1) * 0.5);
14516 dst[12] = (float) ((sample0 + last_sample0) * 0.5);
14517 dst[11] = (float) (((3.0 * sample5) + last_sample5) * 0.25);
14518 dst[10] = (float) (((3.0 * sample4) + last_sample4) * 0.25);
14519 dst[9] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
14520 dst[8] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
14521 dst[7] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
14522 dst[6] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
14523 dst[5] = (float) sample5;
14524 dst[4] = (float) sample4;
14525 dst[3] = (float) sample3;
14526 dst[2] = (float) sample2;
14527 dst[1] = (float) sample1;
14528 dst[0] = (float) sample0;
14529 last_sample5 = sample5;
14530 last_sample4 = sample4;
14531 last_sample3 = sample3;
14532 last_sample2 = sample2;
14533 last_sample1 = sample1;
14534 last_sample0 = sample0;
14538 cvt->len_cvt = dstsize;
14539 if (cvt->filters[++cvt->filter_index]) {
14540 cvt->filters[cvt->filter_index] (cvt, format);
14544 static void SDLCALL
14545 SDL_Downsample_F32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14548 fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 6 channels.\n");
14551 const int dstsize = cvt->len_cvt / 4;
14552 float *dst = (float *) cvt->buf;
14553 const float *src = (float *) cvt->buf;
14554 const float *target = (const float *) (cvt->buf + dstsize);
14555 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14556 double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
14557 double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
14558 double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
14559 double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
14560 double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
14561 while (dst < target) {
14562 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14563 const double sample1 = (double) SDL_SwapFloatLE(src[1]);
14564 const double sample2 = (double) SDL_SwapFloatLE(src[2]);
14565 const double sample3 = (double) SDL_SwapFloatLE(src[3]);
14566 const double sample4 = (double) SDL_SwapFloatLE(src[4]);
14567 const double sample5 = (double) SDL_SwapFloatLE(src[5]);
14569 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
14570 dst[1] = (float) ((sample1 + last_sample1) * 0.5);
14571 dst[2] = (float) ((sample2 + last_sample2) * 0.5);
14572 dst[3] = (float) ((sample3 + last_sample3) * 0.5);
14573 dst[4] = (float) ((sample4 + last_sample4) * 0.5);
14574 dst[5] = (float) ((sample5 + last_sample5) * 0.5);
14575 last_sample0 = sample0;
14576 last_sample1 = sample1;
14577 last_sample2 = sample2;
14578 last_sample3 = sample3;
14579 last_sample4 = sample4;
14580 last_sample5 = sample5;
14584 cvt->len_cvt = dstsize;
14585 if (cvt->filters[++cvt->filter_index]) {
14586 cvt->filters[cvt->filter_index] (cvt, format);
14590 static void SDLCALL
14591 SDL_Upsample_F32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14594 fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 8 channels.\n");
14597 const int dstsize = cvt->len_cvt * 2;
14598 float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 2;
14599 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
14600 const float *target = ((const float *) cvt->buf);
14601 double last_sample7 = (double) SDL_SwapFloatLE(src[7]);
14602 double last_sample6 = (double) SDL_SwapFloatLE(src[6]);
14603 double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
14604 double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
14605 double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
14606 double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
14607 double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
14608 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14609 while (dst >= target) {
14610 const double sample7 = (double) SDL_SwapFloatLE(src[7]);
14611 const double sample6 = (double) SDL_SwapFloatLE(src[6]);
14612 const double sample5 = (double) SDL_SwapFloatLE(src[5]);
14613 const double sample4 = (double) SDL_SwapFloatLE(src[4]);
14614 const double sample3 = (double) SDL_SwapFloatLE(src[3]);
14615 const double sample2 = (double) SDL_SwapFloatLE(src[2]);
14616 const double sample1 = (double) SDL_SwapFloatLE(src[1]);
14617 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14619 dst[15] = (float) ((sample7 + last_sample7) * 0.5);
14620 dst[14] = (float) ((sample6 + last_sample6) * 0.5);
14621 dst[13] = (float) ((sample5 + last_sample5) * 0.5);
14622 dst[12] = (float) ((sample4 + last_sample4) * 0.5);
14623 dst[11] = (float) ((sample3 + last_sample3) * 0.5);
14624 dst[10] = (float) ((sample2 + last_sample2) * 0.5);
14625 dst[9] = (float) ((sample1 + last_sample1) * 0.5);
14626 dst[8] = (float) ((sample0 + last_sample0) * 0.5);
14627 dst[7] = (float) sample7;
14628 dst[6] = (float) sample6;
14629 dst[5] = (float) sample5;
14630 dst[4] = (float) sample4;
14631 dst[3] = (float) sample3;
14632 dst[2] = (float) sample2;
14633 dst[1] = (float) sample1;
14634 dst[0] = (float) sample0;
14635 last_sample7 = sample7;
14636 last_sample6 = sample6;
14637 last_sample5 = sample5;
14638 last_sample4 = sample4;
14639 last_sample3 = sample3;
14640 last_sample2 = sample2;
14641 last_sample1 = sample1;
14642 last_sample0 = sample0;
14646 cvt->len_cvt = dstsize;
14647 if (cvt->filters[++cvt->filter_index]) {
14648 cvt->filters[cvt->filter_index] (cvt, format);
14652 static void SDLCALL
14653 SDL_Downsample_F32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14656 fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 8 channels.\n");
14659 const int dstsize = cvt->len_cvt / 2;
14660 float *dst = (float *) cvt->buf;
14661 const float *src = (float *) cvt->buf;
14662 const float *target = (const float *) (cvt->buf + dstsize);
14663 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14664 double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
14665 double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
14666 double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
14667 double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
14668 double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
14669 double last_sample6 = (double) SDL_SwapFloatLE(src[6]);
14670 double last_sample7 = (double) SDL_SwapFloatLE(src[7]);
14671 while (dst < target) {
14672 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14673 const double sample1 = (double) SDL_SwapFloatLE(src[1]);
14674 const double sample2 = (double) SDL_SwapFloatLE(src[2]);
14675 const double sample3 = (double) SDL_SwapFloatLE(src[3]);
14676 const double sample4 = (double) SDL_SwapFloatLE(src[4]);
14677 const double sample5 = (double) SDL_SwapFloatLE(src[5]);
14678 const double sample6 = (double) SDL_SwapFloatLE(src[6]);
14679 const double sample7 = (double) SDL_SwapFloatLE(src[7]);
14681 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
14682 dst[1] = (float) ((sample1 + last_sample1) * 0.5);
14683 dst[2] = (float) ((sample2 + last_sample2) * 0.5);
14684 dst[3] = (float) ((sample3 + last_sample3) * 0.5);
14685 dst[4] = (float) ((sample4 + last_sample4) * 0.5);
14686 dst[5] = (float) ((sample5 + last_sample5) * 0.5);
14687 dst[6] = (float) ((sample6 + last_sample6) * 0.5);
14688 dst[7] = (float) ((sample7 + last_sample7) * 0.5);
14689 last_sample0 = sample0;
14690 last_sample1 = sample1;
14691 last_sample2 = sample2;
14692 last_sample3 = sample3;
14693 last_sample4 = sample4;
14694 last_sample5 = sample5;
14695 last_sample6 = sample6;
14696 last_sample7 = sample7;
14700 cvt->len_cvt = dstsize;
14701 if (cvt->filters[++cvt->filter_index]) {
14702 cvt->filters[cvt->filter_index] (cvt, format);
14706 static void SDLCALL
14707 SDL_Upsample_F32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14710 fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 8 channels.\n");
14713 const int dstsize = cvt->len_cvt * 4;
14714 float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 4;
14715 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
14716 const float *target = ((const float *) cvt->buf);
14717 double last_sample7 = (double) SDL_SwapFloatLE(src[7]);
14718 double last_sample6 = (double) SDL_SwapFloatLE(src[6]);
14719 double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
14720 double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
14721 double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
14722 double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
14723 double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
14724 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14725 while (dst >= target) {
14726 const double sample7 = (double) SDL_SwapFloatLE(src[7]);
14727 const double sample6 = (double) SDL_SwapFloatLE(src[6]);
14728 const double sample5 = (double) SDL_SwapFloatLE(src[5]);
14729 const double sample4 = (double) SDL_SwapFloatLE(src[4]);
14730 const double sample3 = (double) SDL_SwapFloatLE(src[3]);
14731 const double sample2 = (double) SDL_SwapFloatLE(src[2]);
14732 const double sample1 = (double) SDL_SwapFloatLE(src[1]);
14733 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14735 dst[31] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25);
14736 dst[30] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25);
14737 dst[29] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25);
14738 dst[28] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25);
14739 dst[27] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
14740 dst[26] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
14741 dst[25] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
14742 dst[24] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
14743 dst[23] = (float) ((sample7 + last_sample7) * 0.5);
14744 dst[22] = (float) ((sample6 + last_sample6) * 0.5);
14745 dst[21] = (float) ((sample5 + last_sample5) * 0.5);
14746 dst[20] = (float) ((sample4 + last_sample4) * 0.5);
14747 dst[19] = (float) ((sample3 + last_sample3) * 0.5);
14748 dst[18] = (float) ((sample2 + last_sample2) * 0.5);
14749 dst[17] = (float) ((sample1 + last_sample1) * 0.5);
14750 dst[16] = (float) ((sample0 + last_sample0) * 0.5);
14751 dst[15] = (float) (((3.0 * sample7) + last_sample7) * 0.25);
14752 dst[14] = (float) (((3.0 * sample6) + last_sample6) * 0.25);
14753 dst[13] = (float) (((3.0 * sample5) + last_sample5) * 0.25);
14754 dst[12] = (float) (((3.0 * sample4) + last_sample4) * 0.25);
14755 dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
14756 dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
14757 dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
14758 dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
14759 dst[7] = (float) sample7;
14760 dst[6] = (float) sample6;
14761 dst[5] = (float) sample5;
14762 dst[4] = (float) sample4;
14763 dst[3] = (float) sample3;
14764 dst[2] = (float) sample2;
14765 dst[1] = (float) sample1;
14766 dst[0] = (float) sample0;
14767 last_sample7 = sample7;
14768 last_sample6 = sample6;
14769 last_sample5 = sample5;
14770 last_sample4 = sample4;
14771 last_sample3 = sample3;
14772 last_sample2 = sample2;
14773 last_sample1 = sample1;
14774 last_sample0 = sample0;
14778 cvt->len_cvt = dstsize;
14779 if (cvt->filters[++cvt->filter_index]) {
14780 cvt->filters[cvt->filter_index] (cvt, format);
14784 static void SDLCALL
14785 SDL_Downsample_F32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14788 fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 8 channels.\n");
14791 const int dstsize = cvt->len_cvt / 4;
14792 float *dst = (float *) cvt->buf;
14793 const float *src = (float *) cvt->buf;
14794 const float *target = (const float *) (cvt->buf + dstsize);
14795 double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
14796 double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
14797 double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
14798 double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
14799 double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
14800 double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
14801 double last_sample6 = (double) SDL_SwapFloatLE(src[6]);
14802 double last_sample7 = (double) SDL_SwapFloatLE(src[7]);
14803 while (dst < target) {
14804 const double sample0 = (double) SDL_SwapFloatLE(src[0]);
14805 const double sample1 = (double) SDL_SwapFloatLE(src[1]);
14806 const double sample2 = (double) SDL_SwapFloatLE(src[2]);
14807 const double sample3 = (double) SDL_SwapFloatLE(src[3]);
14808 const double sample4 = (double) SDL_SwapFloatLE(src[4]);
14809 const double sample5 = (double) SDL_SwapFloatLE(src[5]);
14810 const double sample6 = (double) SDL_SwapFloatLE(src[6]);
14811 const double sample7 = (double) SDL_SwapFloatLE(src[7]);
14813 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
14814 dst[1] = (float) ((sample1 + last_sample1) * 0.5);
14815 dst[2] = (float) ((sample2 + last_sample2) * 0.5);
14816 dst[3] = (float) ((sample3 + last_sample3) * 0.5);
14817 dst[4] = (float) ((sample4 + last_sample4) * 0.5);
14818 dst[5] = (float) ((sample5 + last_sample5) * 0.5);
14819 dst[6] = (float) ((sample6 + last_sample6) * 0.5);
14820 dst[7] = (float) ((sample7 + last_sample7) * 0.5);
14821 last_sample0 = sample0;
14822 last_sample1 = sample1;
14823 last_sample2 = sample2;
14824 last_sample3 = sample3;
14825 last_sample4 = sample4;
14826 last_sample5 = sample5;
14827 last_sample6 = sample6;
14828 last_sample7 = sample7;
14832 cvt->len_cvt = dstsize;
14833 if (cvt->filters[++cvt->filter_index]) {
14834 cvt->filters[cvt->filter_index] (cvt, format);
14838 static void SDLCALL
14839 SDL_Upsample_F32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14842 fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 1 channels.\n");
14845 const int dstsize = cvt->len_cvt * 2;
14846 float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 2;
14847 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
14848 const float *target = ((const float *) cvt->buf);
14849 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
14850 while (dst >= target) {
14851 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
14853 dst[1] = (float) ((sample0 + last_sample0) * 0.5);
14854 dst[0] = (float) sample0;
14855 last_sample0 = sample0;
14859 cvt->len_cvt = dstsize;
14860 if (cvt->filters[++cvt->filter_index]) {
14861 cvt->filters[cvt->filter_index] (cvt, format);
14865 static void SDLCALL
14866 SDL_Downsample_F32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14869 fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 1 channels.\n");
14872 const int dstsize = cvt->len_cvt / 2;
14873 float *dst = (float *) cvt->buf;
14874 const float *src = (float *) cvt->buf;
14875 const float *target = (const float *) (cvt->buf + dstsize);
14876 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
14877 while (dst < target) {
14878 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
14880 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
14881 last_sample0 = sample0;
14885 cvt->len_cvt = dstsize;
14886 if (cvt->filters[++cvt->filter_index]) {
14887 cvt->filters[cvt->filter_index] (cvt, format);
14891 static void SDLCALL
14892 SDL_Upsample_F32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14895 fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 1 channels.\n");
14898 const int dstsize = cvt->len_cvt * 4;
14899 float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 4;
14900 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
14901 const float *target = ((const float *) cvt->buf);
14902 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
14903 while (dst >= target) {
14904 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
14906 dst[3] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
14907 dst[2] = (float) ((sample0 + last_sample0) * 0.5);
14908 dst[1] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
14909 dst[0] = (float) sample0;
14910 last_sample0 = sample0;
14914 cvt->len_cvt = dstsize;
14915 if (cvt->filters[++cvt->filter_index]) {
14916 cvt->filters[cvt->filter_index] (cvt, format);
14920 static void SDLCALL
14921 SDL_Downsample_F32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14924 fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 1 channels.\n");
14927 const int dstsize = cvt->len_cvt / 4;
14928 float *dst = (float *) cvt->buf;
14929 const float *src = (float *) cvt->buf;
14930 const float *target = (const float *) (cvt->buf + dstsize);
14931 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
14932 while (dst < target) {
14933 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
14935 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
14936 last_sample0 = sample0;
14940 cvt->len_cvt = dstsize;
14941 if (cvt->filters[++cvt->filter_index]) {
14942 cvt->filters[cvt->filter_index] (cvt, format);
14946 static void SDLCALL
14947 SDL_Upsample_F32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14950 fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 2 channels.\n");
14953 const int dstsize = cvt->len_cvt * 2;
14954 float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 2;
14955 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
14956 const float *target = ((const float *) cvt->buf);
14957 double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
14958 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
14959 while (dst >= target) {
14960 const double sample1 = (double) SDL_SwapFloatBE(src[1]);
14961 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
14963 dst[3] = (float) ((sample1 + last_sample1) * 0.5);
14964 dst[2] = (float) ((sample0 + last_sample0) * 0.5);
14965 dst[1] = (float) sample1;
14966 dst[0] = (float) sample0;
14967 last_sample1 = sample1;
14968 last_sample0 = sample0;
14972 cvt->len_cvt = dstsize;
14973 if (cvt->filters[++cvt->filter_index]) {
14974 cvt->filters[cvt->filter_index] (cvt, format);
14978 static void SDLCALL
14979 SDL_Downsample_F32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
14982 fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 2 channels.\n");
14985 const int dstsize = cvt->len_cvt / 2;
14986 float *dst = (float *) cvt->buf;
14987 const float *src = (float *) cvt->buf;
14988 const float *target = (const float *) (cvt->buf + dstsize);
14989 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
14990 double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
14991 while (dst < target) {
14992 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
14993 const double sample1 = (double) SDL_SwapFloatBE(src[1]);
14995 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
14996 dst[1] = (float) ((sample1 + last_sample1) * 0.5);
14997 last_sample0 = sample0;
14998 last_sample1 = sample1;
15002 cvt->len_cvt = dstsize;
15003 if (cvt->filters[++cvt->filter_index]) {
15004 cvt->filters[cvt->filter_index] (cvt, format);
15008 static void SDLCALL
15009 SDL_Upsample_F32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
15012 fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 2 channels.\n");
15015 const int dstsize = cvt->len_cvt * 4;
15016 float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 4;
15017 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
15018 const float *target = ((const float *) cvt->buf);
15019 double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
15020 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
15021 while (dst >= target) {
15022 const double sample1 = (double) SDL_SwapFloatBE(src[1]);
15023 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
15025 dst[7] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
15026 dst[6] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
15027 dst[5] = (float) ((sample1 + last_sample1) * 0.5);
15028 dst[4] = (float) ((sample0 + last_sample0) * 0.5);
15029 dst[3] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
15030 dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
15031 dst[1] = (float) sample1;
15032 dst[0] = (float) sample0;
15033 last_sample1 = sample1;
15034 last_sample0 = sample0;
15038 cvt->len_cvt = dstsize;
15039 if (cvt->filters[++cvt->filter_index]) {
15040 cvt->filters[cvt->filter_index] (cvt, format);
15044 static void SDLCALL
15045 SDL_Downsample_F32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
15048 fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 2 channels.\n");
15051 const int dstsize = cvt->len_cvt / 4;
15052 float *dst = (float *) cvt->buf;
15053 const float *src = (float *) cvt->buf;
15054 const float *target = (const float *) (cvt->buf + dstsize);
15055 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
15056 double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
15057 while (dst < target) {
15058 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
15059 const double sample1 = (double) SDL_SwapFloatBE(src[1]);
15061 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
15062 dst[1] = (float) ((sample1 + last_sample1) * 0.5);
15063 last_sample0 = sample0;
15064 last_sample1 = sample1;
15068 cvt->len_cvt = dstsize;
15069 if (cvt->filters[++cvt->filter_index]) {
15070 cvt->filters[cvt->filter_index] (cvt, format);
15074 static void SDLCALL
15075 SDL_Upsample_F32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
15078 fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 4 channels.\n");
15081 const int dstsize = cvt->len_cvt * 2;
15082 float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 2;
15083 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
15084 const float *target = ((const float *) cvt->buf);
15085 double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
15086 double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
15087 double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
15088 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
15089 while (dst >= target) {
15090 const double sample3 = (double) SDL_SwapFloatBE(src[3]);
15091 const double sample2 = (double) SDL_SwapFloatBE(src[2]);
15092 const double sample1 = (double) SDL_SwapFloatBE(src[1]);
15093 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
15095 dst[7] = (float) ((sample3 + last_sample3) * 0.5);
15096 dst[6] = (float) ((sample2 + last_sample2) * 0.5);
15097 dst[5] = (float) ((sample1 + last_sample1) * 0.5);
15098 dst[4] = (float) ((sample0 + last_sample0) * 0.5);
15099 dst[3] = (float) sample3;
15100 dst[2] = (float) sample2;
15101 dst[1] = (float) sample1;
15102 dst[0] = (float) sample0;
15103 last_sample3 = sample3;
15104 last_sample2 = sample2;
15105 last_sample1 = sample1;
15106 last_sample0 = sample0;
15110 cvt->len_cvt = dstsize;
15111 if (cvt->filters[++cvt->filter_index]) {
15112 cvt->filters[cvt->filter_index] (cvt, format);
15116 static void SDLCALL
15117 SDL_Downsample_F32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
15120 fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 4 channels.\n");
15123 const int dstsize = cvt->len_cvt / 2;
15124 float *dst = (float *) cvt->buf;
15125 const float *src = (float *) cvt->buf;
15126 const float *target = (const float *) (cvt->buf + dstsize);
15127 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
15128 double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
15129 double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
15130 double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
15131 while (dst < target) {
15132 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
15133 const double sample1 = (double) SDL_SwapFloatBE(src[1]);
15134 const double sample2 = (double) SDL_SwapFloatBE(src[2]);
15135 const double sample3 = (double) SDL_SwapFloatBE(src[3]);
15137 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
15138 dst[1] = (float) ((sample1 + last_sample1) * 0.5);
15139 dst[2] = (float) ((sample2 + last_sample2) * 0.5);
15140 dst[3] = (float) ((sample3 + last_sample3) * 0.5);
15141 last_sample0 = sample0;
15142 last_sample1 = sample1;
15143 last_sample2 = sample2;
15144 last_sample3 = sample3;
15148 cvt->len_cvt = dstsize;
15149 if (cvt->filters[++cvt->filter_index]) {
15150 cvt->filters[cvt->filter_index] (cvt, format);
15154 static void SDLCALL
15155 SDL_Upsample_F32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
15158 fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 4 channels.\n");
15161 const int dstsize = cvt->len_cvt * 4;
15162 float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 4;
15163 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
15164 const float *target = ((const float *) cvt->buf);
15165 double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
15166 double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
15167 double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
15168 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
15169 while (dst >= target) {
15170 const double sample3 = (double) SDL_SwapFloatBE(src[3]);
15171 const double sample2 = (double) SDL_SwapFloatBE(src[2]);
15172 const double sample1 = (double) SDL_SwapFloatBE(src[1]);
15173 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
15175 dst[15] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
15176 dst[14] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
15177 dst[13] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
15178 dst[12] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
15179 dst[11] = (float) ((sample3 + last_sample3) * 0.5);
15180 dst[10] = (float) ((sample2 + last_sample2) * 0.5);
15181 dst[9] = (float) ((sample1 + last_sample1) * 0.5);
15182 dst[8] = (float) ((sample0 + last_sample0) * 0.5);
15183 dst[7] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
15184 dst[6] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
15185 dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
15186 dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
15187 dst[3] = (float) sample3;
15188 dst[2] = (float) sample2;
15189 dst[1] = (float) sample1;
15190 dst[0] = (float) sample0;
15191 last_sample3 = sample3;
15192 last_sample2 = sample2;
15193 last_sample1 = sample1;
15194 last_sample0 = sample0;
15198 cvt->len_cvt = dstsize;
15199 if (cvt->filters[++cvt->filter_index]) {
15200 cvt->filters[cvt->filter_index] (cvt, format);
15204 static void SDLCALL
15205 SDL_Downsample_F32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
15208 fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 4 channels.\n");
15211 const int dstsize = cvt->len_cvt / 4;
15212 float *dst = (float *) cvt->buf;
15213 const float *src = (float *) cvt->buf;
15214 const float *target = (const float *) (cvt->buf + dstsize);
15215 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
15216 double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
15217 double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
15218 double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
15219 while (dst < target) {
15220 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
15221 const double sample1 = (double) SDL_SwapFloatBE(src[1]);
15222 const double sample2 = (double) SDL_SwapFloatBE(src[2]);
15223 const double sample3 = (double) SDL_SwapFloatBE(src[3]);
15225 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
15226 dst[1] = (float) ((sample1 + last_sample1) * 0.5);
15227 dst[2] = (float) ((sample2 + last_sample2) * 0.5);
15228 dst[3] = (float) ((sample3 + last_sample3) * 0.5);
15229 last_sample0 = sample0;
15230 last_sample1 = sample1;
15231 last_sample2 = sample2;
15232 last_sample3 = sample3;
15236 cvt->len_cvt = dstsize;
15237 if (cvt->filters[++cvt->filter_index]) {
15238 cvt->filters[cvt->filter_index] (cvt, format);
15242 static void SDLCALL
15243 SDL_Upsample_F32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
15246 fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 6 channels.\n");
15249 const int dstsize = cvt->len_cvt * 2;
15250 float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 2;
15251 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
15252 const float *target = ((const float *) cvt->buf);
15253 double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
15254 double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
15255 double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
15256 double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
15257 double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
15258 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
15259 while (dst >= target) {
15260 const double sample5 = (double) SDL_SwapFloatBE(src[5]);
15261 const double sample4 = (double) SDL_SwapFloatBE(src[4]);
15262 const double sample3 = (double) SDL_SwapFloatBE(src[3]);
15263 const double sample2 = (double) SDL_SwapFloatBE(src[2]);
15264 const double sample1 = (double) SDL_SwapFloatBE(src[1]);
15265 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
15267 dst[11] = (float) ((sample5 + last_sample5) * 0.5);
15268 dst[10] = (float) ((sample4 + last_sample4) * 0.5);
15269 dst[9] = (float) ((sample3 + last_sample3) * 0.5);
15270 dst[8] = (float) ((sample2 + last_sample2) * 0.5);
15271 dst[7] = (float) ((sample1 + last_sample1) * 0.5);
15272 dst[6] = (float) ((sample0 + last_sample0) * 0.5);
15273 dst[5] = (float) sample5;
15274 dst[4] = (float) sample4;
15275 dst[3] = (float) sample3;
15276 dst[2] = (float) sample2;
15277 dst[1] = (float) sample1;
15278 dst[0] = (float) sample0;
15279 last_sample5 = sample5;
15280 last_sample4 = sample4;
15281 last_sample3 = sample3;
15282 last_sample2 = sample2;
15283 last_sample1 = sample1;
15284 last_sample0 = sample0;
15288 cvt->len_cvt = dstsize;
15289 if (cvt->filters[++cvt->filter_index]) {
15290 cvt->filters[cvt->filter_index] (cvt, format);
15294 static void SDLCALL
15295 SDL_Downsample_F32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
15298 fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 6 channels.\n");
15301 const int dstsize = cvt->len_cvt / 2;
15302 float *dst = (float *) cvt->buf;
15303 const float *src = (float *) cvt->buf;
15304 const float *target = (const float *) (cvt->buf + dstsize);
15305 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
15306 double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
15307 double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
15308 double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
15309 double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
15310 double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
15311 while (dst < target) {
15312 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
15313 const double sample1 = (double) SDL_SwapFloatBE(src[1]);
15314 const double sample2 = (double) SDL_SwapFloatBE(src[2]);
15315 const double sample3 = (double) SDL_SwapFloatBE(src[3]);
15316 const double sample4 = (double) SDL_SwapFloatBE(src[4]);
15317 const double sample5 = (double) SDL_SwapFloatBE(src[5]);
15319 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
15320 dst[1] = (float) ((sample1 + last_sample1) * 0.5);
15321 dst[2] = (float) ((sample2 + last_sample2) * 0.5);
15322 dst[3] = (float) ((sample3 + last_sample3) * 0.5);
15323 dst[4] = (float) ((sample4 + last_sample4) * 0.5);
15324 dst[5] = (float) ((sample5 + last_sample5) * 0.5);
15325 last_sample0 = sample0;
15326 last_sample1 = sample1;
15327 last_sample2 = sample2;
15328 last_sample3 = sample3;
15329 last_sample4 = sample4;
15330 last_sample5 = sample5;
15334 cvt->len_cvt = dstsize;
15335 if (cvt->filters[++cvt->filter_index]) {
15336 cvt->filters[cvt->filter_index] (cvt, format);
15340 static void SDLCALL
15341 SDL_Upsample_F32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
15344 fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 6 channels.\n");
15347 const int dstsize = cvt->len_cvt * 4;
15348 float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 4;
15349 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
15350 const float *target = ((const float *) cvt->buf);
15351 double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
15352 double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
15353 double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
15354 double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
15355 double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
15356 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
15357 while (dst >= target) {
15358 const double sample5 = (double) SDL_SwapFloatBE(src[5]);
15359 const double sample4 = (double) SDL_SwapFloatBE(src[4]);
15360 const double sample3 = (double) SDL_SwapFloatBE(src[3]);
15361 const double sample2 = (double) SDL_SwapFloatBE(src[2]);
15362 const double sample1 = (double) SDL_SwapFloatBE(src[1]);
15363 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
15365 dst[23] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25);
15366 dst[22] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25);
15367 dst[21] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
15368 dst[20] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
15369 dst[19] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
15370 dst[18] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
15371 dst[17] = (float) ((sample5 + last_sample5) * 0.5);
15372 dst[16] = (float) ((sample4 + last_sample4) * 0.5);
15373 dst[15] = (float) ((sample3 + last_sample3) * 0.5);
15374 dst[14] = (float) ((sample2 + last_sample2) * 0.5);
15375 dst[13] = (float) ((sample1 + last_sample1) * 0.5);
15376 dst[12] = (float) ((sample0 + last_sample0) * 0.5);
15377 dst[11] = (float) (((3.0 * sample5) + last_sample5) * 0.25);
15378 dst[10] = (float) (((3.0 * sample4) + last_sample4) * 0.25);
15379 dst[9] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
15380 dst[8] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
15381 dst[7] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
15382 dst[6] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
15383 dst[5] = (float) sample5;
15384 dst[4] = (float) sample4;
15385 dst[3] = (float) sample3;
15386 dst[2] = (float) sample2;
15387 dst[1] = (float) sample1;
15388 dst[0] = (float) sample0;
15389 last_sample5 = sample5;
15390 last_sample4 = sample4;
15391 last_sample3 = sample3;
15392 last_sample2 = sample2;
15393 last_sample1 = sample1;
15394 last_sample0 = sample0;
15398 cvt->len_cvt = dstsize;
15399 if (cvt->filters[++cvt->filter_index]) {
15400 cvt->filters[cvt->filter_index] (cvt, format);
15404 static void SDLCALL
15405 SDL_Downsample_F32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
15408 fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 6 channels.\n");
15411 const int dstsize = cvt->len_cvt / 4;
15412 float *dst = (float *) cvt->buf;
15413 const float *src = (float *) cvt->buf;
15414 const float *target = (const float *) (cvt->buf + dstsize);
15415 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
15416 double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
15417 double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
15418 double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
15419 double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
15420 double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
15421 while (dst < target) {
15422 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
15423 const double sample1 = (double) SDL_SwapFloatBE(src[1]);
15424 const double sample2 = (double) SDL_SwapFloatBE(src[2]);
15425 const double sample3 = (double) SDL_SwapFloatBE(src[3]);
15426 const double sample4 = (double) SDL_SwapFloatBE(src[4]);
15427 const double sample5 = (double) SDL_SwapFloatBE(src[5]);
15429 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
15430 dst[1] = (float) ((sample1 + last_sample1) * 0.5);
15431 dst[2] = (float) ((sample2 + last_sample2) * 0.5);
15432 dst[3] = (float) ((sample3 + last_sample3) * 0.5);
15433 dst[4] = (float) ((sample4 + last_sample4) * 0.5);
15434 dst[5] = (float) ((sample5 + last_sample5) * 0.5);
15435 last_sample0 = sample0;
15436 last_sample1 = sample1;
15437 last_sample2 = sample2;
15438 last_sample3 = sample3;
15439 last_sample4 = sample4;
15440 last_sample5 = sample5;
15444 cvt->len_cvt = dstsize;
15445 if (cvt->filters[++cvt->filter_index]) {
15446 cvt->filters[cvt->filter_index] (cvt, format);
15450 static void SDLCALL
15451 SDL_Upsample_F32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
15454 fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 8 channels.\n");
15457 const int dstsize = cvt->len_cvt * 2;
15458 float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 2;
15459 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
15460 const float *target = ((const float *) cvt->buf);
15461 double last_sample7 = (double) SDL_SwapFloatBE(src[7]);
15462 double last_sample6 = (double) SDL_SwapFloatBE(src[6]);
15463 double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
15464 double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
15465 double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
15466 double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
15467 double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
15468 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
15469 while (dst >= target) {
15470 const double sample7 = (double) SDL_SwapFloatBE(src[7]);
15471 const double sample6 = (double) SDL_SwapFloatBE(src[6]);
15472 const double sample5 = (double) SDL_SwapFloatBE(src[5]);
15473 const double sample4 = (double) SDL_SwapFloatBE(src[4]);
15474 const double sample3 = (double) SDL_SwapFloatBE(src[3]);
15475 const double sample2 = (double) SDL_SwapFloatBE(src[2]);
15476 const double sample1 = (double) SDL_SwapFloatBE(src[1]);
15477 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
15479 dst[15] = (float) ((sample7 + last_sample7) * 0.5);
15480 dst[14] = (float) ((sample6 + last_sample6) * 0.5);
15481 dst[13] = (float) ((sample5 + last_sample5) * 0.5);
15482 dst[12] = (float) ((sample4 + last_sample4) * 0.5);
15483 dst[11] = (float) ((sample3 + last_sample3) * 0.5);
15484 dst[10] = (float) ((sample2 + last_sample2) * 0.5);
15485 dst[9] = (float) ((sample1 + last_sample1) * 0.5);
15486 dst[8] = (float) ((sample0 + last_sample0) * 0.5);
15487 dst[7] = (float) sample7;
15488 dst[6] = (float) sample6;
15489 dst[5] = (float) sample5;
15490 dst[4] = (float) sample4;
15491 dst[3] = (float) sample3;
15492 dst[2] = (float) sample2;
15493 dst[1] = (float) sample1;
15494 dst[0] = (float) sample0;
15495 last_sample7 = sample7;
15496 last_sample6 = sample6;
15497 last_sample5 = sample5;
15498 last_sample4 = sample4;
15499 last_sample3 = sample3;
15500 last_sample2 = sample2;
15501 last_sample1 = sample1;
15502 last_sample0 = sample0;
15506 cvt->len_cvt = dstsize;
15507 if (cvt->filters[++cvt->filter_index]) {
15508 cvt->filters[cvt->filter_index] (cvt, format);
15512 static void SDLCALL
15513 SDL_Downsample_F32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
15516 fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 8 channels.\n");
15519 const int dstsize = cvt->len_cvt / 2;
15520 float *dst = (float *) cvt->buf;
15521 const float *src = (float *) cvt->buf;
15522 const float *target = (const float *) (cvt->buf + dstsize);
15523 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
15524 double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
15525 double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
15526 double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
15527 double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
15528 double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
15529 double last_sample6 = (double) SDL_SwapFloatBE(src[6]);
15530 double last_sample7 = (double) SDL_SwapFloatBE(src[7]);
15531 while (dst < target) {
15532 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
15533 const double sample1 = (double) SDL_SwapFloatBE(src[1]);
15534 const double sample2 = (double) SDL_SwapFloatBE(src[2]);
15535 const double sample3 = (double) SDL_SwapFloatBE(src[3]);
15536 const double sample4 = (double) SDL_SwapFloatBE(src[4]);
15537 const double sample5 = (double) SDL_SwapFloatBE(src[5]);
15538 const double sample6 = (double) SDL_SwapFloatBE(src[6]);
15539 const double sample7 = (double) SDL_SwapFloatBE(src[7]);
15541 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
15542 dst[1] = (float) ((sample1 + last_sample1) * 0.5);
15543 dst[2] = (float) ((sample2 + last_sample2) * 0.5);
15544 dst[3] = (float) ((sample3 + last_sample3) * 0.5);
15545 dst[4] = (float) ((sample4 + last_sample4) * 0.5);
15546 dst[5] = (float) ((sample5 + last_sample5) * 0.5);
15547 dst[6] = (float) ((sample6 + last_sample6) * 0.5);
15548 dst[7] = (float) ((sample7 + last_sample7) * 0.5);
15549 last_sample0 = sample0;
15550 last_sample1 = sample1;
15551 last_sample2 = sample2;
15552 last_sample3 = sample3;
15553 last_sample4 = sample4;
15554 last_sample5 = sample5;
15555 last_sample6 = sample6;
15556 last_sample7 = sample7;
15560 cvt->len_cvt = dstsize;
15561 if (cvt->filters[++cvt->filter_index]) {
15562 cvt->filters[cvt->filter_index] (cvt, format);
15566 static void SDLCALL
15567 SDL_Upsample_F32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
15570 fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 8 channels.\n");
15573 const int dstsize = cvt->len_cvt * 4;
15574 float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 4;
15575 const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
15576 const float *target = ((const float *) cvt->buf);
15577 double last_sample7 = (double) SDL_SwapFloatBE(src[7]);
15578 double last_sample6 = (double) SDL_SwapFloatBE(src[6]);
15579 double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
15580 double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
15581 double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
15582 double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
15583 double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
15584 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
15585 while (dst >= target) {
15586 const double sample7 = (double) SDL_SwapFloatBE(src[7]);
15587 const double sample6 = (double) SDL_SwapFloatBE(src[6]);
15588 const double sample5 = (double) SDL_SwapFloatBE(src[5]);
15589 const double sample4 = (double) SDL_SwapFloatBE(src[4]);
15590 const double sample3 = (double) SDL_SwapFloatBE(src[3]);
15591 const double sample2 = (double) SDL_SwapFloatBE(src[2]);
15592 const double sample1 = (double) SDL_SwapFloatBE(src[1]);
15593 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
15595 dst[31] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25);
15596 dst[30] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25);
15597 dst[29] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25);
15598 dst[28] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25);
15599 dst[27] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
15600 dst[26] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
15601 dst[25] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
15602 dst[24] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
15603 dst[23] = (float) ((sample7 + last_sample7) * 0.5);
15604 dst[22] = (float) ((sample6 + last_sample6) * 0.5);
15605 dst[21] = (float) ((sample5 + last_sample5) * 0.5);
15606 dst[20] = (float) ((sample4 + last_sample4) * 0.5);
15607 dst[19] = (float) ((sample3 + last_sample3) * 0.5);
15608 dst[18] = (float) ((sample2 + last_sample2) * 0.5);
15609 dst[17] = (float) ((sample1 + last_sample1) * 0.5);
15610 dst[16] = (float) ((sample0 + last_sample0) * 0.5);
15611 dst[15] = (float) (((3.0 * sample7) + last_sample7) * 0.25);
15612 dst[14] = (float) (((3.0 * sample6) + last_sample6) * 0.25);
15613 dst[13] = (float) (((3.0 * sample5) + last_sample5) * 0.25);
15614 dst[12] = (float) (((3.0 * sample4) + last_sample4) * 0.25);
15615 dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
15616 dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
15617 dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
15618 dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
15619 dst[7] = (float) sample7;
15620 dst[6] = (float) sample6;
15621 dst[5] = (float) sample5;
15622 dst[4] = (float) sample4;
15623 dst[3] = (float) sample3;
15624 dst[2] = (float) sample2;
15625 dst[1] = (float) sample1;
15626 dst[0] = (float) sample0;
15627 last_sample7 = sample7;
15628 last_sample6 = sample6;
15629 last_sample5 = sample5;
15630 last_sample4 = sample4;
15631 last_sample3 = sample3;
15632 last_sample2 = sample2;
15633 last_sample1 = sample1;
15634 last_sample0 = sample0;
15638 cvt->len_cvt = dstsize;
15639 if (cvt->filters[++cvt->filter_index]) {
15640 cvt->filters[cvt->filter_index] (cvt, format);
15644 static void SDLCALL
15645 SDL_Downsample_F32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
15648 fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 8 channels.\n");
15651 const int dstsize = cvt->len_cvt / 4;
15652 float *dst = (float *) cvt->buf;
15653 const float *src = (float *) cvt->buf;
15654 const float *target = (const float *) (cvt->buf + dstsize);
15655 double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
15656 double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
15657 double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
15658 double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
15659 double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
15660 double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
15661 double last_sample6 = (double) SDL_SwapFloatBE(src[6]);
15662 double last_sample7 = (double) SDL_SwapFloatBE(src[7]);
15663 while (dst < target) {
15664 const double sample0 = (double) SDL_SwapFloatBE(src[0]);
15665 const double sample1 = (double) SDL_SwapFloatBE(src[1]);
15666 const double sample2 = (double) SDL_SwapFloatBE(src[2]);
15667 const double sample3 = (double) SDL_SwapFloatBE(src[3]);
15668 const double sample4 = (double) SDL_SwapFloatBE(src[4]);
15669 const double sample5 = (double) SDL_SwapFloatBE(src[5]);
15670 const double sample6 = (double) SDL_SwapFloatBE(src[6]);
15671 const double sample7 = (double) SDL_SwapFloatBE(src[7]);
15673 dst[0] = (float) ((sample0 + last_sample0) * 0.5);
15674 dst[1] = (float) ((sample1 + last_sample1) * 0.5);
15675 dst[2] = (float) ((sample2 + last_sample2) * 0.5);
15676 dst[3] = (float) ((sample3 + last_sample3) * 0.5);
15677 dst[4] = (float) ((sample4 + last_sample4) * 0.5);
15678 dst[5] = (float) ((sample5 + last_sample5) * 0.5);
15679 dst[6] = (float) ((sample6 + last_sample6) * 0.5);
15680 dst[7] = (float) ((sample7 + last_sample7) * 0.5);
15681 last_sample0 = sample0;
15682 last_sample1 = sample1;
15683 last_sample2 = sample2;
15684 last_sample3 = sample3;
15685 last_sample4 = sample4;
15686 last_sample5 = sample5;
15687 last_sample6 = sample6;
15688 last_sample7 = sample7;
15692 cvt->len_cvt = dstsize;
15693 if (cvt->filters[++cvt->filter_index]) {
15694 cvt->filters[cvt->filter_index] (cvt, format);
15698 #endif /* !LESS_RESAMPLERS */
15699 #endif /* !NO_RESAMPLERS */
15702 const SDL_AudioRateFilters sdl_audio_rate_filters[] =
15705 { AUDIO_U8, 1, 0, 0, SDL_Downsample_U8_1c },
15706 { AUDIO_U8, 1, 1, 0, SDL_Upsample_U8_1c },
15707 { AUDIO_U8, 2, 0, 0, SDL_Downsample_U8_2c },
15708 { AUDIO_U8, 2, 1, 0, SDL_Upsample_U8_2c },
15709 { AUDIO_U8, 4, 0, 0, SDL_Downsample_U8_4c },
15710 { AUDIO_U8, 4, 1, 0, SDL_Upsample_U8_4c },
15711 { AUDIO_U8, 6, 0, 0, SDL_Downsample_U8_6c },
15712 { AUDIO_U8, 6, 1, 0, SDL_Upsample_U8_6c },
15713 { AUDIO_U8, 8, 0, 0, SDL_Downsample_U8_8c },
15714 { AUDIO_U8, 8, 1, 0, SDL_Upsample_U8_8c },
15715 { AUDIO_S8, 1, 0, 0, SDL_Downsample_S8_1c },
15716 { AUDIO_S8, 1, 1, 0, SDL_Upsample_S8_1c },
15717 { AUDIO_S8, 2, 0, 0, SDL_Downsample_S8_2c },
15718 { AUDIO_S8, 2, 1, 0, SDL_Upsample_S8_2c },
15719 { AUDIO_S8, 4, 0, 0, SDL_Downsample_S8_4c },
15720 { AUDIO_S8, 4, 1, 0, SDL_Upsample_S8_4c },
15721 { AUDIO_S8, 6, 0, 0, SDL_Downsample_S8_6c },
15722 { AUDIO_S8, 6, 1, 0, SDL_Upsample_S8_6c },
15723 { AUDIO_S8, 8, 0, 0, SDL_Downsample_S8_8c },
15724 { AUDIO_S8, 8, 1, 0, SDL_Upsample_S8_8c },
15725 { AUDIO_U16LSB, 1, 0, 0, SDL_Downsample_U16LSB_1c },
15726 { AUDIO_U16LSB, 1, 1, 0, SDL_Upsample_U16LSB_1c },
15727 { AUDIO_U16LSB, 2, 0, 0, SDL_Downsample_U16LSB_2c },
15728 { AUDIO_U16LSB, 2, 1, 0, SDL_Upsample_U16LSB_2c },
15729 { AUDIO_U16LSB, 4, 0, 0, SDL_Downsample_U16LSB_4c },
15730 { AUDIO_U16LSB, 4, 1, 0, SDL_Upsample_U16LSB_4c },
15731 { AUDIO_U16LSB, 6, 0, 0, SDL_Downsample_U16LSB_6c },
15732 { AUDIO_U16LSB, 6, 1, 0, SDL_Upsample_U16LSB_6c },
15733 { AUDIO_U16LSB, 8, 0, 0, SDL_Downsample_U16LSB_8c },
15734 { AUDIO_U16LSB, 8, 1, 0, SDL_Upsample_U16LSB_8c },
15735 { AUDIO_S16LSB, 1, 0, 0, SDL_Downsample_S16LSB_1c },
15736 { AUDIO_S16LSB, 1, 1, 0, SDL_Upsample_S16LSB_1c },
15737 { AUDIO_S16LSB, 2, 0, 0, SDL_Downsample_S16LSB_2c },
15738 { AUDIO_S16LSB, 2, 1, 0, SDL_Upsample_S16LSB_2c },
15739 { AUDIO_S16LSB, 4, 0, 0, SDL_Downsample_S16LSB_4c },
15740 { AUDIO_S16LSB, 4, 1, 0, SDL_Upsample_S16LSB_4c },
15741 { AUDIO_S16LSB, 6, 0, 0, SDL_Downsample_S16LSB_6c },
15742 { AUDIO_S16LSB, 6, 1, 0, SDL_Upsample_S16LSB_6c },
15743 { AUDIO_S16LSB, 8, 0, 0, SDL_Downsample_S16LSB_8c },
15744 { AUDIO_S16LSB, 8, 1, 0, SDL_Upsample_S16LSB_8c },
15745 { AUDIO_U16MSB, 1, 0, 0, SDL_Downsample_U16MSB_1c },
15746 { AUDIO_U16MSB, 1, 1, 0, SDL_Upsample_U16MSB_1c },
15747 { AUDIO_U16MSB, 2, 0, 0, SDL_Downsample_U16MSB_2c },
15748 { AUDIO_U16MSB, 2, 1, 0, SDL_Upsample_U16MSB_2c },
15749 { AUDIO_U16MSB, 4, 0, 0, SDL_Downsample_U16MSB_4c },
15750 { AUDIO_U16MSB, 4, 1, 0, SDL_Upsample_U16MSB_4c },
15751 { AUDIO_U16MSB, 6, 0, 0, SDL_Downsample_U16MSB_6c },
15752 { AUDIO_U16MSB, 6, 1, 0, SDL_Upsample_U16MSB_6c },
15753 { AUDIO_U16MSB, 8, 0, 0, SDL_Downsample_U16MSB_8c },
15754 { AUDIO_U16MSB, 8, 1, 0, SDL_Upsample_U16MSB_8c },
15755 { AUDIO_S16MSB, 1, 0, 0, SDL_Downsample_S16MSB_1c },
15756 { AUDIO_S16MSB, 1, 1, 0, SDL_Upsample_S16MSB_1c },
15757 { AUDIO_S16MSB, 2, 0, 0, SDL_Downsample_S16MSB_2c },
15758 { AUDIO_S16MSB, 2, 1, 0, SDL_Upsample_S16MSB_2c },
15759 { AUDIO_S16MSB, 4, 0, 0, SDL_Downsample_S16MSB_4c },
15760 { AUDIO_S16MSB, 4, 1, 0, SDL_Upsample_S16MSB_4c },
15761 { AUDIO_S16MSB, 6, 0, 0, SDL_Downsample_S16MSB_6c },
15762 { AUDIO_S16MSB, 6, 1, 0, SDL_Upsample_S16MSB_6c },
15763 { AUDIO_S16MSB, 8, 0, 0, SDL_Downsample_S16MSB_8c },
15764 { AUDIO_S16MSB, 8, 1, 0, SDL_Upsample_S16MSB_8c },
15765 { AUDIO_S32LSB, 1, 0, 0, SDL_Downsample_S32LSB_1c },
15766 { AUDIO_S32LSB, 1, 1, 0, SDL_Upsample_S32LSB_1c },
15767 { AUDIO_S32LSB, 2, 0, 0, SDL_Downsample_S32LSB_2c },
15768 { AUDIO_S32LSB, 2, 1, 0, SDL_Upsample_S32LSB_2c },
15769 { AUDIO_S32LSB, 4, 0, 0, SDL_Downsample_S32LSB_4c },
15770 { AUDIO_S32LSB, 4, 1, 0, SDL_Upsample_S32LSB_4c },
15771 { AUDIO_S32LSB, 6, 0, 0, SDL_Downsample_S32LSB_6c },
15772 { AUDIO_S32LSB, 6, 1, 0, SDL_Upsample_S32LSB_6c },
15773 { AUDIO_S32LSB, 8, 0, 0, SDL_Downsample_S32LSB_8c },
15774 { AUDIO_S32LSB, 8, 1, 0, SDL_Upsample_S32LSB_8c },
15775 { AUDIO_S32MSB, 1, 0, 0, SDL_Downsample_S32MSB_1c },
15776 { AUDIO_S32MSB, 1, 1, 0, SDL_Upsample_S32MSB_1c },
15777 { AUDIO_S32MSB, 2, 0, 0, SDL_Downsample_S32MSB_2c },
15778 { AUDIO_S32MSB, 2, 1, 0, SDL_Upsample_S32MSB_2c },
15779 { AUDIO_S32MSB, 4, 0, 0, SDL_Downsample_S32MSB_4c },
15780 { AUDIO_S32MSB, 4, 1, 0, SDL_Upsample_S32MSB_4c },
15781 { AUDIO_S32MSB, 6, 0, 0, SDL_Downsample_S32MSB_6c },
15782 { AUDIO_S32MSB, 6, 1, 0, SDL_Upsample_S32MSB_6c },
15783 { AUDIO_S32MSB, 8, 0, 0, SDL_Downsample_S32MSB_8c },
15784 { AUDIO_S32MSB, 8, 1, 0, SDL_Upsample_S32MSB_8c },
15785 { AUDIO_F32LSB, 1, 0, 0, SDL_Downsample_F32LSB_1c },
15786 { AUDIO_F32LSB, 1, 1, 0, SDL_Upsample_F32LSB_1c },
15787 { AUDIO_F32LSB, 2, 0, 0, SDL_Downsample_F32LSB_2c },
15788 { AUDIO_F32LSB, 2, 1, 0, SDL_Upsample_F32LSB_2c },
15789 { AUDIO_F32LSB, 4, 0, 0, SDL_Downsample_F32LSB_4c },
15790 { AUDIO_F32LSB, 4, 1, 0, SDL_Upsample_F32LSB_4c },
15791 { AUDIO_F32LSB, 6, 0, 0, SDL_Downsample_F32LSB_6c },
15792 { AUDIO_F32LSB, 6, 1, 0, SDL_Upsample_F32LSB_6c },
15793 { AUDIO_F32LSB, 8, 0, 0, SDL_Downsample_F32LSB_8c },
15794 { AUDIO_F32LSB, 8, 1, 0, SDL_Upsample_F32LSB_8c },
15795 { AUDIO_F32MSB, 1, 0, 0, SDL_Downsample_F32MSB_1c },
15796 { AUDIO_F32MSB, 1, 1, 0, SDL_Upsample_F32MSB_1c },
15797 { AUDIO_F32MSB, 2, 0, 0, SDL_Downsample_F32MSB_2c },
15798 { AUDIO_F32MSB, 2, 1, 0, SDL_Upsample_F32MSB_2c },
15799 { AUDIO_F32MSB, 4, 0, 0, SDL_Downsample_F32MSB_4c },
15800 { AUDIO_F32MSB, 4, 1, 0, SDL_Upsample_F32MSB_4c },
15801 { AUDIO_F32MSB, 6, 0, 0, SDL_Downsample_F32MSB_6c },
15802 { AUDIO_F32MSB, 6, 1, 0, SDL_Upsample_F32MSB_6c },
15803 { AUDIO_F32MSB, 8, 0, 0, SDL_Downsample_F32MSB_8c },
15804 { AUDIO_F32MSB, 8, 1, 0, SDL_Upsample_F32MSB_8c },
15805 #if !LESS_RESAMPLERS
15806 { AUDIO_U8, 1, 0, 2, SDL_Downsample_U8_1c_x2 },
15807 { AUDIO_U8, 1, 1, 2, SDL_Upsample_U8_1c_x2 },
15808 { AUDIO_U8, 1, 0, 4, SDL_Downsample_U8_1c_x4 },
15809 { AUDIO_U8, 1, 1, 4, SDL_Upsample_U8_1c_x4 },
15810 { AUDIO_U8, 2, 0, 2, SDL_Downsample_U8_2c_x2 },
15811 { AUDIO_U8, 2, 1, 2, SDL_Upsample_U8_2c_x2 },
15812 { AUDIO_U8, 2, 0, 4, SDL_Downsample_U8_2c_x4 },
15813 { AUDIO_U8, 2, 1, 4, SDL_Upsample_U8_2c_x4 },
15814 { AUDIO_U8, 4, 0, 2, SDL_Downsample_U8_4c_x2 },
15815 { AUDIO_U8, 4, 1, 2, SDL_Upsample_U8_4c_x2 },
15816 { AUDIO_U8, 4, 0, 4, SDL_Downsample_U8_4c_x4 },
15817 { AUDIO_U8, 4, 1, 4, SDL_Upsample_U8_4c_x4 },
15818 { AUDIO_U8, 6, 0, 2, SDL_Downsample_U8_6c_x2 },
15819 { AUDIO_U8, 6, 1, 2, SDL_Upsample_U8_6c_x2 },
15820 { AUDIO_U8, 6, 0, 4, SDL_Downsample_U8_6c_x4 },
15821 { AUDIO_U8, 6, 1, 4, SDL_Upsample_U8_6c_x4 },
15822 { AUDIO_U8, 8, 0, 2, SDL_Downsample_U8_8c_x2 },
15823 { AUDIO_U8, 8, 1, 2, SDL_Upsample_U8_8c_x2 },
15824 { AUDIO_U8, 8, 0, 4, SDL_Downsample_U8_8c_x4 },
15825 { AUDIO_U8, 8, 1, 4, SDL_Upsample_U8_8c_x4 },
15826 { AUDIO_S8, 1, 0, 2, SDL_Downsample_S8_1c_x2 },
15827 { AUDIO_S8, 1, 1, 2, SDL_Upsample_S8_1c_x2 },
15828 { AUDIO_S8, 1, 0, 4, SDL_Downsample_S8_1c_x4 },
15829 { AUDIO_S8, 1, 1, 4, SDL_Upsample_S8_1c_x4 },
15830 { AUDIO_S8, 2, 0, 2, SDL_Downsample_S8_2c_x2 },
15831 { AUDIO_S8, 2, 1, 2, SDL_Upsample_S8_2c_x2 },
15832 { AUDIO_S8, 2, 0, 4, SDL_Downsample_S8_2c_x4 },
15833 { AUDIO_S8, 2, 1, 4, SDL_Upsample_S8_2c_x4 },
15834 { AUDIO_S8, 4, 0, 2, SDL_Downsample_S8_4c_x2 },
15835 { AUDIO_S8, 4, 1, 2, SDL_Upsample_S8_4c_x2 },
15836 { AUDIO_S8, 4, 0, 4, SDL_Downsample_S8_4c_x4 },
15837 { AUDIO_S8, 4, 1, 4, SDL_Upsample_S8_4c_x4 },
15838 { AUDIO_S8, 6, 0, 2, SDL_Downsample_S8_6c_x2 },
15839 { AUDIO_S8, 6, 1, 2, SDL_Upsample_S8_6c_x2 },
15840 { AUDIO_S8, 6, 0, 4, SDL_Downsample_S8_6c_x4 },
15841 { AUDIO_S8, 6, 1, 4, SDL_Upsample_S8_6c_x4 },
15842 { AUDIO_S8, 8, 0, 2, SDL_Downsample_S8_8c_x2 },
15843 { AUDIO_S8, 8, 1, 2, SDL_Upsample_S8_8c_x2 },
15844 { AUDIO_S8, 8, 0, 4, SDL_Downsample_S8_8c_x4 },
15845 { AUDIO_S8, 8, 1, 4, SDL_Upsample_S8_8c_x4 },
15846 { AUDIO_U16LSB, 1, 0, 2, SDL_Downsample_U16LSB_1c_x2 },
15847 { AUDIO_U16LSB, 1, 1, 2, SDL_Upsample_U16LSB_1c_x2 },
15848 { AUDIO_U16LSB, 1, 0, 4, SDL_Downsample_U16LSB_1c_x4 },
15849 { AUDIO_U16LSB, 1, 1, 4, SDL_Upsample_U16LSB_1c_x4 },
15850 { AUDIO_U16LSB, 2, 0, 2, SDL_Downsample_U16LSB_2c_x2 },
15851 { AUDIO_U16LSB, 2, 1, 2, SDL_Upsample_U16LSB_2c_x2 },
15852 { AUDIO_U16LSB, 2, 0, 4, SDL_Downsample_U16LSB_2c_x4 },
15853 { AUDIO_U16LSB, 2, 1, 4, SDL_Upsample_U16LSB_2c_x4 },
15854 { AUDIO_U16LSB, 4, 0, 2, SDL_Downsample_U16LSB_4c_x2 },
15855 { AUDIO_U16LSB, 4, 1, 2, SDL_Upsample_U16LSB_4c_x2 },
15856 { AUDIO_U16LSB, 4, 0, 4, SDL_Downsample_U16LSB_4c_x4 },
15857 { AUDIO_U16LSB, 4, 1, 4, SDL_Upsample_U16LSB_4c_x4 },
15858 { AUDIO_U16LSB, 6, 0, 2, SDL_Downsample_U16LSB_6c_x2 },
15859 { AUDIO_U16LSB, 6, 1, 2, SDL_Upsample_U16LSB_6c_x2 },
15860 { AUDIO_U16LSB, 6, 0, 4, SDL_Downsample_U16LSB_6c_x4 },
15861 { AUDIO_U16LSB, 6, 1, 4, SDL_Upsample_U16LSB_6c_x4 },
15862 { AUDIO_U16LSB, 8, 0, 2, SDL_Downsample_U16LSB_8c_x2 },
15863 { AUDIO_U16LSB, 8, 1, 2, SDL_Upsample_U16LSB_8c_x2 },
15864 { AUDIO_U16LSB, 8, 0, 4, SDL_Downsample_U16LSB_8c_x4 },
15865 { AUDIO_U16LSB, 8, 1, 4, SDL_Upsample_U16LSB_8c_x4 },
15866 { AUDIO_S16LSB, 1, 0, 2, SDL_Downsample_S16LSB_1c_x2 },
15867 { AUDIO_S16LSB, 1, 1, 2, SDL_Upsample_S16LSB_1c_x2 },
15868 { AUDIO_S16LSB, 1, 0, 4, SDL_Downsample_S16LSB_1c_x4 },
15869 { AUDIO_S16LSB, 1, 1, 4, SDL_Upsample_S16LSB_1c_x4 },
15870 { AUDIO_S16LSB, 2, 0, 2, SDL_Downsample_S16LSB_2c_x2 },
15871 { AUDIO_S16LSB, 2, 1, 2, SDL_Upsample_S16LSB_2c_x2 },
15872 { AUDIO_S16LSB, 2, 0, 4, SDL_Downsample_S16LSB_2c_x4 },
15873 { AUDIO_S16LSB, 2, 1, 4, SDL_Upsample_S16LSB_2c_x4 },
15874 { AUDIO_S16LSB, 4, 0, 2, SDL_Downsample_S16LSB_4c_x2 },
15875 { AUDIO_S16LSB, 4, 1, 2, SDL_Upsample_S16LSB_4c_x2 },
15876 { AUDIO_S16LSB, 4, 0, 4, SDL_Downsample_S16LSB_4c_x4 },
15877 { AUDIO_S16LSB, 4, 1, 4, SDL_Upsample_S16LSB_4c_x4 },
15878 { AUDIO_S16LSB, 6, 0, 2, SDL_Downsample_S16LSB_6c_x2 },
15879 { AUDIO_S16LSB, 6, 1, 2, SDL_Upsample_S16LSB_6c_x2 },
15880 { AUDIO_S16LSB, 6, 0, 4, SDL_Downsample_S16LSB_6c_x4 },
15881 { AUDIO_S16LSB, 6, 1, 4, SDL_Upsample_S16LSB_6c_x4 },
15882 { AUDIO_S16LSB, 8, 0, 2, SDL_Downsample_S16LSB_8c_x2 },
15883 { AUDIO_S16LSB, 8, 1, 2, SDL_Upsample_S16LSB_8c_x2 },
15884 { AUDIO_S16LSB, 8, 0, 4, SDL_Downsample_S16LSB_8c_x4 },
15885 { AUDIO_S16LSB, 8, 1, 4, SDL_Upsample_S16LSB_8c_x4 },
15886 { AUDIO_U16MSB, 1, 0, 2, SDL_Downsample_U16MSB_1c_x2 },
15887 { AUDIO_U16MSB, 1, 1, 2, SDL_Upsample_U16MSB_1c_x2 },
15888 { AUDIO_U16MSB, 1, 0, 4, SDL_Downsample_U16MSB_1c_x4 },
15889 { AUDIO_U16MSB, 1, 1, 4, SDL_Upsample_U16MSB_1c_x4 },
15890 { AUDIO_U16MSB, 2, 0, 2, SDL_Downsample_U16MSB_2c_x2 },
15891 { AUDIO_U16MSB, 2, 1, 2, SDL_Upsample_U16MSB_2c_x2 },
15892 { AUDIO_U16MSB, 2, 0, 4, SDL_Downsample_U16MSB_2c_x4 },
15893 { AUDIO_U16MSB, 2, 1, 4, SDL_Upsample_U16MSB_2c_x4 },
15894 { AUDIO_U16MSB, 4, 0, 2, SDL_Downsample_U16MSB_4c_x2 },
15895 { AUDIO_U16MSB, 4, 1, 2, SDL_Upsample_U16MSB_4c_x2 },
15896 { AUDIO_U16MSB, 4, 0, 4, SDL_Downsample_U16MSB_4c_x4 },
15897 { AUDIO_U16MSB, 4, 1, 4, SDL_Upsample_U16MSB_4c_x4 },
15898 { AUDIO_U16MSB, 6, 0, 2, SDL_Downsample_U16MSB_6c_x2 },
15899 { AUDIO_U16MSB, 6, 1, 2, SDL_Upsample_U16MSB_6c_x2 },
15900 { AUDIO_U16MSB, 6, 0, 4, SDL_Downsample_U16MSB_6c_x4 },
15901 { AUDIO_U16MSB, 6, 1, 4, SDL_Upsample_U16MSB_6c_x4 },
15902 { AUDIO_U16MSB, 8, 0, 2, SDL_Downsample_U16MSB_8c_x2 },
15903 { AUDIO_U16MSB, 8, 1, 2, SDL_Upsample_U16MSB_8c_x2 },
15904 { AUDIO_U16MSB, 8, 0, 4, SDL_Downsample_U16MSB_8c_x4 },
15905 { AUDIO_U16MSB, 8, 1, 4, SDL_Upsample_U16MSB_8c_x4 },
15906 { AUDIO_S16MSB, 1, 0, 2, SDL_Downsample_S16MSB_1c_x2 },
15907 { AUDIO_S16MSB, 1, 1, 2, SDL_Upsample_S16MSB_1c_x2 },
15908 { AUDIO_S16MSB, 1, 0, 4, SDL_Downsample_S16MSB_1c_x4 },
15909 { AUDIO_S16MSB, 1, 1, 4, SDL_Upsample_S16MSB_1c_x4 },
15910 { AUDIO_S16MSB, 2, 0, 2, SDL_Downsample_S16MSB_2c_x2 },
15911 { AUDIO_S16MSB, 2, 1, 2, SDL_Upsample_S16MSB_2c_x2 },
15912 { AUDIO_S16MSB, 2, 0, 4, SDL_Downsample_S16MSB_2c_x4 },
15913 { AUDIO_S16MSB, 2, 1, 4, SDL_Upsample_S16MSB_2c_x4 },
15914 { AUDIO_S16MSB, 4, 0, 2, SDL_Downsample_S16MSB_4c_x2 },
15915 { AUDIO_S16MSB, 4, 1, 2, SDL_Upsample_S16MSB_4c_x2 },
15916 { AUDIO_S16MSB, 4, 0, 4, SDL_Downsample_S16MSB_4c_x4 },
15917 { AUDIO_S16MSB, 4, 1, 4, SDL_Upsample_S16MSB_4c_x4 },
15918 { AUDIO_S16MSB, 6, 0, 2, SDL_Downsample_S16MSB_6c_x2 },
15919 { AUDIO_S16MSB, 6, 1, 2, SDL_Upsample_S16MSB_6c_x2 },
15920 { AUDIO_S16MSB, 6, 0, 4, SDL_Downsample_S16MSB_6c_x4 },
15921 { AUDIO_S16MSB, 6, 1, 4, SDL_Upsample_S16MSB_6c_x4 },
15922 { AUDIO_S16MSB, 8, 0, 2, SDL_Downsample_S16MSB_8c_x2 },
15923 { AUDIO_S16MSB, 8, 1, 2, SDL_Upsample_S16MSB_8c_x2 },
15924 { AUDIO_S16MSB, 8, 0, 4, SDL_Downsample_S16MSB_8c_x4 },
15925 { AUDIO_S16MSB, 8, 1, 4, SDL_Upsample_S16MSB_8c_x4 },
15926 { AUDIO_S32LSB, 1, 0, 2, SDL_Downsample_S32LSB_1c_x2 },
15927 { AUDIO_S32LSB, 1, 1, 2, SDL_Upsample_S32LSB_1c_x2 },
15928 { AUDIO_S32LSB, 1, 0, 4, SDL_Downsample_S32LSB_1c_x4 },
15929 { AUDIO_S32LSB, 1, 1, 4, SDL_Upsample_S32LSB_1c_x4 },
15930 { AUDIO_S32LSB, 2, 0, 2, SDL_Downsample_S32LSB_2c_x2 },
15931 { AUDIO_S32LSB, 2, 1, 2, SDL_Upsample_S32LSB_2c_x2 },
15932 { AUDIO_S32LSB, 2, 0, 4, SDL_Downsample_S32LSB_2c_x4 },
15933 { AUDIO_S32LSB, 2, 1, 4, SDL_Upsample_S32LSB_2c_x4 },
15934 { AUDIO_S32LSB, 4, 0, 2, SDL_Downsample_S32LSB_4c_x2 },
15935 { AUDIO_S32LSB, 4, 1, 2, SDL_Upsample_S32LSB_4c_x2 },
15936 { AUDIO_S32LSB, 4, 0, 4, SDL_Downsample_S32LSB_4c_x4 },
15937 { AUDIO_S32LSB, 4, 1, 4, SDL_Upsample_S32LSB_4c_x4 },
15938 { AUDIO_S32LSB, 6, 0, 2, SDL_Downsample_S32LSB_6c_x2 },
15939 { AUDIO_S32LSB, 6, 1, 2, SDL_Upsample_S32LSB_6c_x2 },
15940 { AUDIO_S32LSB, 6, 0, 4, SDL_Downsample_S32LSB_6c_x4 },
15941 { AUDIO_S32LSB, 6, 1, 4, SDL_Upsample_S32LSB_6c_x4 },
15942 { AUDIO_S32LSB, 8, 0, 2, SDL_Downsample_S32LSB_8c_x2 },
15943 { AUDIO_S32LSB, 8, 1, 2, SDL_Upsample_S32LSB_8c_x2 },
15944 { AUDIO_S32LSB, 8, 0, 4, SDL_Downsample_S32LSB_8c_x4 },
15945 { AUDIO_S32LSB, 8, 1, 4, SDL_Upsample_S32LSB_8c_x4 },
15946 { AUDIO_S32MSB, 1, 0, 2, SDL_Downsample_S32MSB_1c_x2 },
15947 { AUDIO_S32MSB, 1, 1, 2, SDL_Upsample_S32MSB_1c_x2 },
15948 { AUDIO_S32MSB, 1, 0, 4, SDL_Downsample_S32MSB_1c_x4 },
15949 { AUDIO_S32MSB, 1, 1, 4, SDL_Upsample_S32MSB_1c_x4 },
15950 { AUDIO_S32MSB, 2, 0, 2, SDL_Downsample_S32MSB_2c_x2 },
15951 { AUDIO_S32MSB, 2, 1, 2, SDL_Upsample_S32MSB_2c_x2 },
15952 { AUDIO_S32MSB, 2, 0, 4, SDL_Downsample_S32MSB_2c_x4 },
15953 { AUDIO_S32MSB, 2, 1, 4, SDL_Upsample_S32MSB_2c_x4 },
15954 { AUDIO_S32MSB, 4, 0, 2, SDL_Downsample_S32MSB_4c_x2 },
15955 { AUDIO_S32MSB, 4, 1, 2, SDL_Upsample_S32MSB_4c_x2 },
15956 { AUDIO_S32MSB, 4, 0, 4, SDL_Downsample_S32MSB_4c_x4 },
15957 { AUDIO_S32MSB, 4, 1, 4, SDL_Upsample_S32MSB_4c_x4 },
15958 { AUDIO_S32MSB, 6, 0, 2, SDL_Downsample_S32MSB_6c_x2 },
15959 { AUDIO_S32MSB, 6, 1, 2, SDL_Upsample_S32MSB_6c_x2 },
15960 { AUDIO_S32MSB, 6, 0, 4, SDL_Downsample_S32MSB_6c_x4 },
15961 { AUDIO_S32MSB, 6, 1, 4, SDL_Upsample_S32MSB_6c_x4 },
15962 { AUDIO_S32MSB, 8, 0, 2, SDL_Downsample_S32MSB_8c_x2 },
15963 { AUDIO_S32MSB, 8, 1, 2, SDL_Upsample_S32MSB_8c_x2 },
15964 { AUDIO_S32MSB, 8, 0, 4, SDL_Downsample_S32MSB_8c_x4 },
15965 { AUDIO_S32MSB, 8, 1, 4, SDL_Upsample_S32MSB_8c_x4 },
15966 { AUDIO_F32LSB, 1, 0, 2, SDL_Downsample_F32LSB_1c_x2 },
15967 { AUDIO_F32LSB, 1, 1, 2, SDL_Upsample_F32LSB_1c_x2 },
15968 { AUDIO_F32LSB, 1, 0, 4, SDL_Downsample_F32LSB_1c_x4 },
15969 { AUDIO_F32LSB, 1, 1, 4, SDL_Upsample_F32LSB_1c_x4 },
15970 { AUDIO_F32LSB, 2, 0, 2, SDL_Downsample_F32LSB_2c_x2 },
15971 { AUDIO_F32LSB, 2, 1, 2, SDL_Upsample_F32LSB_2c_x2 },
15972 { AUDIO_F32LSB, 2, 0, 4, SDL_Downsample_F32LSB_2c_x4 },
15973 { AUDIO_F32LSB, 2, 1, 4, SDL_Upsample_F32LSB_2c_x4 },
15974 { AUDIO_F32LSB, 4, 0, 2, SDL_Downsample_F32LSB_4c_x2 },
15975 { AUDIO_F32LSB, 4, 1, 2, SDL_Upsample_F32LSB_4c_x2 },
15976 { AUDIO_F32LSB, 4, 0, 4, SDL_Downsample_F32LSB_4c_x4 },
15977 { AUDIO_F32LSB, 4, 1, 4, SDL_Upsample_F32LSB_4c_x4 },
15978 { AUDIO_F32LSB, 6, 0, 2, SDL_Downsample_F32LSB_6c_x2 },
15979 { AUDIO_F32LSB, 6, 1, 2, SDL_Upsample_F32LSB_6c_x2 },
15980 { AUDIO_F32LSB, 6, 0, 4, SDL_Downsample_F32LSB_6c_x4 },
15981 { AUDIO_F32LSB, 6, 1, 4, SDL_Upsample_F32LSB_6c_x4 },
15982 { AUDIO_F32LSB, 8, 0, 2, SDL_Downsample_F32LSB_8c_x2 },
15983 { AUDIO_F32LSB, 8, 1, 2, SDL_Upsample_F32LSB_8c_x2 },
15984 { AUDIO_F32LSB, 8, 0, 4, SDL_Downsample_F32LSB_8c_x4 },
15985 { AUDIO_F32LSB, 8, 1, 4, SDL_Upsample_F32LSB_8c_x4 },
15986 { AUDIO_F32MSB, 1, 0, 2, SDL_Downsample_F32MSB_1c_x2 },
15987 { AUDIO_F32MSB, 1, 1, 2, SDL_Upsample_F32MSB_1c_x2 },
15988 { AUDIO_F32MSB, 1, 0, 4, SDL_Downsample_F32MSB_1c_x4 },
15989 { AUDIO_F32MSB, 1, 1, 4, SDL_Upsample_F32MSB_1c_x4 },
15990 { AUDIO_F32MSB, 2, 0, 2, SDL_Downsample_F32MSB_2c_x2 },
15991 { AUDIO_F32MSB, 2, 1, 2, SDL_Upsample_F32MSB_2c_x2 },
15992 { AUDIO_F32MSB, 2, 0, 4, SDL_Downsample_F32MSB_2c_x4 },
15993 { AUDIO_F32MSB, 2, 1, 4, SDL_Upsample_F32MSB_2c_x4 },
15994 { AUDIO_F32MSB, 4, 0, 2, SDL_Downsample_F32MSB_4c_x2 },
15995 { AUDIO_F32MSB, 4, 1, 2, SDL_Upsample_F32MSB_4c_x2 },
15996 { AUDIO_F32MSB, 4, 0, 4, SDL_Downsample_F32MSB_4c_x4 },
15997 { AUDIO_F32MSB, 4, 1, 4, SDL_Upsample_F32MSB_4c_x4 },
15998 { AUDIO_F32MSB, 6, 0, 2, SDL_Downsample_F32MSB_6c_x2 },
15999 { AUDIO_F32MSB, 6, 1, 2, SDL_Upsample_F32MSB_6c_x2 },
16000 { AUDIO_F32MSB, 6, 0, 4, SDL_Downsample_F32MSB_6c_x4 },
16001 { AUDIO_F32MSB, 6, 1, 4, SDL_Upsample_F32MSB_6c_x4 },
16002 { AUDIO_F32MSB, 8, 0, 2, SDL_Downsample_F32MSB_8c_x2 },
16003 { AUDIO_F32MSB, 8, 1, 2, SDL_Upsample_F32MSB_8c_x2 },
16004 { AUDIO_F32MSB, 8, 0, 4, SDL_Downsample_F32MSB_8c_x4 },
16005 { AUDIO_F32MSB, 8, 1, 4, SDL_Upsample_F32MSB_8c_x4 },
16006 #endif /* !LESS_RESAMPLERS */
16007 #endif /* !NO_RESAMPLERS */
16008 { 0, 0, 0, 0, NULL }
16011 /* 390 converters generated. */
16015 /* vi: set ts=4 sw=4 expandtab: */