From e79974cd6a3dc9c2c1a330e79c20a5548e8a3403 Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Thu, 18 Feb 2021 16:56:22 +0100 Subject: [PATCH] Fix undefined signed shift. Using the fix from SSE2. Change-Id: Ie53d0163d97322da5a722c3e49f9d5f057ee1d91 --- src/dsp/lossless_sse41.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dsp/lossless_sse41.c b/src/dsp/lossless_sse41.c index 739c3c74..48d9bf1f 100644 --- a/src/dsp/lossless_sse41.c +++ b/src/dsp/lossless_sse41.c @@ -25,8 +25,9 @@ static void TransformColorInverse_SSE41(const VP8LMultipliers* const m, const uint32_t* const src, int num_pixels, uint32_t* dst) { -#define CST(X) ((int32_t)((int8_t)m->X) << 3) - const __m128i mults_rb = _mm_set1_epi32(CST(green_to_red_) << 16 | +// sign-extended multiplying constants, pre-shifted by 5. +#define CST(X) (((int16_t)(m->X << 8)) >> 5) // sign-extend + const __m128i mults_rb = _mm_set1_epi32((uint32_t)CST(green_to_red_) << 16 | (CST(green_to_blue_) & 0xffff)); const __m128i mults_b2 = _mm_set1_epi32(CST(red_to_blue_)); #undef CST