ref: 25d8da725925e03cc0a65f82645a0c47d27067c8
parent: f7d376ae84e3063ccb963482731d391bb9bcff7a
author: Fabian Greffrath <fabian@greffrath.com>
date: Mon Sep 30 09:11:58 EDT 2019
quantize.h: revert back to some more generic SSE2 code This hopefully closes #29.
--- a/libfaac/quantize.c
+++ b/libfaac/quantize.c
@@ -246,11 +246,11 @@
{
__m128 x = {xr[cnt], xr[cnt + 1], xr[cnt + 2], xr[cnt + 3]};
- x = _mm_max_ps(x, -x);
- x *= (__m128){sfacfix, sfacfix, sfacfix, sfacfix};
- x *= _mm_sqrt_ps(x);
+ x = _mm_max_ps(x, _mm_sub_ps((__m128){0, 0, 0, 0}, x));
+ x = _mm_mul_ps(x, (__m128){sfacfix, sfacfix, sfacfix, sfacfix});
+ x = _mm_mul_ps(x, _mm_sqrt_ps(x));
x = _mm_sqrt_ps(x);
- x += (__m128){MAGIC_NUMBER, MAGIC_NUMBER, MAGIC_NUMBER, MAGIC_NUMBER};
+ x = _mm_add_ps(x, (__m128){MAGIC_NUMBER, MAGIC_NUMBER, MAGIC_NUMBER, MAGIC_NUMBER});
*(__m128i*)(xi + cnt) = _mm_cvttps_epi32(x);
}