Fixed bug 4210 - SSE2-based converter makes junk result of S32 -> Float
authorWohlstand <admin@wohlnet.ru>
Mon, 02 Jul 2018 03:53:57 +0300
changeset 12056523e803a0192
parent 12055 bf70bfa02215
child 12058 1a1133e9c7d4
Fixed bug 4210 - SSE2-based converter makes junk result of S32 -> Float

At the HG state e604fe493d45, 64-bit assemblies are using SSE2-based resampler, produces junk sound when converting the S32 -> Float32 -> S16 chain. The `NEED_SCALAR_CONVERTER_FALLBACKS` thing works perfectly.

If I will find a reason that caused this mistake, I'll send a patch by myself.
src/audio/SDL_audiotypecvt.c
     1.1 --- a/src/audio/SDL_audiotypecvt.c	Sun Jul 01 19:50:00 2018 +0300
     1.2 +++ b/src/audio/SDL_audiotypecvt.c	Mon Jul 02 03:53:57 2018 +0300
     1.3 @@ -533,7 +533,7 @@
     1.4          const __m128i *mmsrc = (const __m128i *) src;
     1.5          while (i >= 4) {   /* 4 * sint32 */
     1.6              /* shift out lowest bits so int fits in a float32. Small precision loss, but much faster. */
     1.7 -            _mm_store_ps(dst, _mm_mul_ps(_mm_cvtepi32_ps(_mm_srli_epi32(_mm_load_si128(mmsrc), 8)), divby8388607));
     1.8 +            _mm_store_ps(dst, _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_load_si128(mmsrc), 8)), divby8388607));
     1.9              i -= 4; mmsrc++; dst += 4;
    1.10          }
    1.11          src = (const Sint32 *) mmsrc;