Permalink
Browse files

Re-enable float conversion SSE code following 3465127

Now clip S32 between -(1<<31) <= x < ((1<31)-128)
  • Loading branch information...
jyavenard committed Aug 9, 2013
1 parent f35f387 commit 9731684bdce8f701598d61464f987d271db7fe09
@@ -385,9 +385,9 @@ static int fromFloat32(AudioFormat format, int* out, const float* in, int len)
shift = 0;
#if ARCH_X86
if (false && sse_check() && len >= 16 && ISALIGN(in) && ISALIGN(out))
if (sse_check() && len >= 16 && ISALIGN(in) && ISALIGN(out))
{
float o = 1, mo = -1;
float o = 0.99999995, mo = -1;
int loops = len >> 4;
i = loops << 4;
@@ -447,16 +447,15 @@ static int fromFloat32(AudioFormat format, int* out, const float* in, int len)
if (valf >= 1.0f)
{
*out++ = (range - 1) << shift;
*out++ = (range - 128) << shift;
continue;
}
else if (valf <= -1.0f)
if (valf <= -1.0f)
{
*out++ = (-range) << shift;
continue;
}
else
{
*out++ = lrintf(valf * f) << shift;
}
*out++ = lrintf(valf * f) << shift;
}
return len << 2;
}
@@ -462,10 +462,10 @@ class TestAudioConvert: public QObject
arrays2[1] = -2147483648;
arrays2[2] = -2147483648;
arrays2[3] = -2147483648;
arrays2[4] = 2147483647;
arrays2[5] = 2147483647;
arrays2[6] = 2147483647;
arrays2[7] = 2147483647;
arrays2[4] = 2147483520; // (1<<31)-128
arrays2[5] = 2147483520;
arrays2[6] = 2147483520;
arrays2[7] = 2147483520;
AudioConvert::fromFloat(FORMAT_S32, arrays1, arrayf1+offsetfloat1, SIZEARRAY * ISIZEOF(float));
for (int i = 0; i < 8; i++)
{

0 comments on commit 9731684

Please sign in to comment.