From ef314a5d6c37149efdeff8851ea5a6061bbbb9c4 Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 27 Mar 2015 20:29:37 -0700 Subject: [PATCH] dec_sse2/GetNotHEV: micro optimization trade 2 subtractions + logical or for 1 max + 1 subtraction Change-Id: I7d1f25f7cda2a89bc8247f3d3d5417f6b0e3d96c --- src/dsp/dec_sse2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/dsp/dec_sse2.c b/src/dsp/dec_sse2.c index f4424542..797f742a 100644 --- a/src/dsp/dec_sse2.c +++ b/src/dsp/dec_sse2.c @@ -330,10 +330,9 @@ static WEBP_INLINE void GetNotHEV(const __m128i* const p1, const __m128i t_2 = MM_ABS(*q1, *q0); const __m128i h = _mm_set1_epi8(hev_thresh); - const __m128i t_3 = _mm_subs_epu8(t_1, h); // abs(p1 - p0) - hev_tresh - const __m128i t_4 = _mm_subs_epu8(t_2, h); // abs(q1 - q0) - hev_tresh + const __m128i t_max = _mm_max_epu8(t_1, t_2); - *not_hev = _mm_or_si128(t_3, t_4); + *not_hev = _mm_subs_epu8(t_max, h); *not_hev = _mm_cmpeq_epi8(*not_hev, zero); // not_hev <= t1 && not_hev <= t2 }