dec_sse2: harmonize function suffixes

BUG=webp:355

Change-Id: Ic0390a4a24a5d8caff5b8af9fc9d59769ec533b1
This commit is contained in:
James Zern 2017-10-07 15:05:05 -07:00
parent 7038ca8d52
commit bcb7347c2b

View File

@ -30,7 +30,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Transforms (Paragraph 14.4) // Transforms (Paragraph 14.4)
static void Transform(const int16_t* in, uint8_t* dst, int do_two) { static void Transform_SSE2(const int16_t* in, uint8_t* dst, int do_two) {
// This implementation makes use of 16-bit fixed point versions of two // This implementation makes use of 16-bit fixed point versions of two
// multiply constants: // multiply constants:
// K1 = sqrt(2) * cos (pi/8) ~= 85627 / 2^16 // K1 = sqrt(2) * cos (pi/8) ~= 85627 / 2^16
@ -250,7 +250,7 @@ static void TransformAC3(const int16_t* in, uint8_t* dst) {
_mm_subs_epu8((p), (q))) _mm_subs_epu8((p), (q)))
// Shift each byte of "x" by 3 bits while preserving by the sign bit. // Shift each byte of "x" by 3 bits while preserving by the sign bit.
static WEBP_INLINE void SignedShift8b(__m128i* const x) { static WEBP_INLINE void SignedShift8b_SSE2(__m128i* const x) {
const __m128i zero = _mm_setzero_si128(); const __m128i zero = _mm_setzero_si128();
const __m128i lo_0 = _mm_unpacklo_epi8(zero, *x); const __m128i lo_0 = _mm_unpacklo_epi8(zero, *x);
const __m128i hi_0 = _mm_unpackhi_epi8(zero, *x); const __m128i hi_0 = _mm_unpackhi_epi8(zero, *x);
@ -270,7 +270,7 @@ static WEBP_INLINE void SignedShift8b(__m128i* const x) {
} }
// input/output is uint8_t // input/output is uint8_t
static WEBP_INLINE void GetNotHEV(const __m128i* const p1, static WEBP_INLINE void GetNotHEV_SSE2(const __m128i* const p1,
const __m128i* const p0, const __m128i* const p0,
const __m128i* const q0, const __m128i* const q0,
const __m128i* const q1, const __m128i* const q1,
@ -287,7 +287,7 @@ static WEBP_INLINE void GetNotHEV(const __m128i* const p1,
} }
// input pixels are int8_t // input pixels are int8_t
static WEBP_INLINE void GetBaseDelta(const __m128i* const p1, static WEBP_INLINE void GetBaseDelta_SSE2(const __m128i* const p1,
const __m128i* const p0, const __m128i* const p0,
const __m128i* const q0, const __m128i* const q0,
const __m128i* const q1, const __m128i* const q1,
@ -302,15 +302,16 @@ static WEBP_INLINE void GetBaseDelta(const __m128i* const p1,
} }
// input and output are int8_t // input and output are int8_t
static WEBP_INLINE void DoSimpleFilter(__m128i* const p0, __m128i* const q0, static WEBP_INLINE void DoSimpleFilter_SSE2(__m128i* const p0,
__m128i* const q0,
const __m128i* const fl) { const __m128i* const fl) {
const __m128i k3 = _mm_set1_epi8(3); const __m128i k3 = _mm_set1_epi8(3);
const __m128i k4 = _mm_set1_epi8(4); const __m128i k4 = _mm_set1_epi8(4);
__m128i v3 = _mm_adds_epi8(*fl, k3); __m128i v3 = _mm_adds_epi8(*fl, k3);
__m128i v4 = _mm_adds_epi8(*fl, k4); __m128i v4 = _mm_adds_epi8(*fl, k4);
SignedShift8b(&v4); // v4 >> 3 SignedShift8b_SSE2(&v4); // v4 >> 3
SignedShift8b(&v3); // v3 >> 3 SignedShift8b_SSE2(&v3); // v3 >> 3
*q0 = _mm_subs_epi8(*q0, v4); // q0 -= v4 *q0 = _mm_subs_epi8(*q0, v4); // q0 -= v4
*p0 = _mm_adds_epi8(*p0, v3); // p0 += v3 *p0 = _mm_adds_epi8(*p0, v3); // p0 += v3
} }
@ -319,7 +320,7 @@ static WEBP_INLINE void DoSimpleFilter(__m128i* const p0, __m128i* const q0,
// Update operations: // Update operations:
// q = q - delta and p = p + delta; where delta = [(a_hi >> 7), (a_lo >> 7)] // q = q - delta and p = p + delta; where delta = [(a_hi >> 7), (a_lo >> 7)]
// Pixels 'pi' and 'qi' are int8_t on input, uint8_t on output (sign flip). // Pixels 'pi' and 'qi' are int8_t on input, uint8_t on output (sign flip).
static WEBP_INLINE void Update2Pixels(__m128i* const pi, __m128i* const qi, static WEBP_INLINE void Update2Pixels_SSE2(__m128i* const pi, __m128i* const qi,
const __m128i* const a0_lo, const __m128i* const a0_lo,
const __m128i* const a0_hi) { const __m128i* const a0_hi) {
const __m128i a1_lo = _mm_srai_epi16(*a0_lo, 7); const __m128i a1_lo = _mm_srai_epi16(*a0_lo, 7);
@ -332,7 +333,7 @@ static WEBP_INLINE void Update2Pixels(__m128i* const pi, __m128i* const qi,
} }
// input pixels are uint8_t // input pixels are uint8_t
static WEBP_INLINE void NeedsFilter(const __m128i* const p1, static WEBP_INLINE void NeedsFilter_SSE2(const __m128i* const p1,
const __m128i* const p0, const __m128i* const p0,
const __m128i* const q0, const __m128i* const q0,
const __m128i* const q1, const __m128i* const q1,
@ -355,28 +356,29 @@ static WEBP_INLINE void NeedsFilter(const __m128i* const p1,
// Edge filtering functions // Edge filtering functions
// Applies filter on 2 pixels (p0 and q0) // Applies filter on 2 pixels (p0 and q0)
static WEBP_INLINE void DoFilter2(__m128i* const p1, __m128i* const p0, static WEBP_INLINE void DoFilter2_SSE2(__m128i* const p1, __m128i* const p0,
__m128i* const q0, __m128i* const q1, __m128i* const q0, __m128i* const q1,
int thresh) { int thresh) {
__m128i a, mask; __m128i a, mask;
const __m128i sign_bit = _mm_set1_epi8(0x80); const __m128i sign_bit = _mm_set1_epi8(0x80);
// convert p1/q1 to int8_t (for GetBaseDelta) // convert p1/q1 to int8_t (for GetBaseDelta_SSE2)
const __m128i p1s = _mm_xor_si128(*p1, sign_bit); const __m128i p1s = _mm_xor_si128(*p1, sign_bit);
const __m128i q1s = _mm_xor_si128(*q1, sign_bit); const __m128i q1s = _mm_xor_si128(*q1, sign_bit);
NeedsFilter(p1, p0, q0, q1, thresh, &mask); NeedsFilter_SSE2(p1, p0, q0, q1, thresh, &mask);
FLIP_SIGN_BIT2(*p0, *q0); FLIP_SIGN_BIT2(*p0, *q0);
GetBaseDelta(&p1s, p0, q0, &q1s, &a); GetBaseDelta_SSE2(&p1s, p0, q0, &q1s, &a);
a = _mm_and_si128(a, mask); // mask filter values we don't care about a = _mm_and_si128(a, mask); // mask filter values we don't care about
DoSimpleFilter(p0, q0, &a); DoSimpleFilter_SSE2(p0, q0, &a);
FLIP_SIGN_BIT2(*p0, *q0); FLIP_SIGN_BIT2(*p0, *q0);
} }
// Applies filter on 4 pixels (p1, p0, q0 and q1) // Applies filter on 4 pixels (p1, p0, q0 and q1)
static WEBP_INLINE void DoFilter4(__m128i* const p1, __m128i* const p0, static WEBP_INLINE void DoFilter4_SSE2(__m128i* const p1, __m128i* const p0,
__m128i* const q0, __m128i* const q1, __m128i* const q0, __m128i* const q1,
const __m128i* const mask, int hev_thresh) { const __m128i* const mask,
int hev_thresh) {
const __m128i zero = _mm_setzero_si128(); const __m128i zero = _mm_setzero_si128();
const __m128i sign_bit = _mm_set1_epi8(0x80); const __m128i sign_bit = _mm_set1_epi8(0x80);
const __m128i k64 = _mm_set1_epi8(64); const __m128i k64 = _mm_set1_epi8(64);
@ -386,7 +388,7 @@ static WEBP_INLINE void DoFilter4(__m128i* const p1, __m128i* const p0,
__m128i t1, t2, t3; __m128i t1, t2, t3;
// compute hev mask // compute hev mask
GetNotHEV(p1, p0, q0, q1, hev_thresh, &not_hev); GetNotHEV_SSE2(p1, p0, q0, q1, hev_thresh, &not_hev);
// convert to signed values // convert to signed values
FLIP_SIGN_BIT4(*p1, *p0, *q0, *q1); FLIP_SIGN_BIT4(*p1, *p0, *q0, *q1);
@ -401,8 +403,8 @@ static WEBP_INLINE void DoFilter4(__m128i* const p1, __m128i* const p0,
t2 = _mm_adds_epi8(t1, k3); // 3 * (q0 - p0) + hev(p1 - q1) + 3 t2 = _mm_adds_epi8(t1, k3); // 3 * (q0 - p0) + hev(p1 - q1) + 3
t3 = _mm_adds_epi8(t1, k4); // 3 * (q0 - p0) + hev(p1 - q1) + 4 t3 = _mm_adds_epi8(t1, k4); // 3 * (q0 - p0) + hev(p1 - q1) + 4
SignedShift8b(&t2); // (3 * (q0 - p0) + hev(p1 - q1) + 3) >> 3 SignedShift8b_SSE2(&t2); // (3 * (q0 - p0) + hev(p1 - q1) + 3) >> 3
SignedShift8b(&t3); // (3 * (q0 - p0) + hev(p1 - q1) + 4) >> 3 SignedShift8b_SSE2(&t3); // (3 * (q0 - p0) + hev(p1 - q1) + 4) >> 3
*p0 = _mm_adds_epi8(*p0, t2); // p0 += t2 *p0 = _mm_adds_epi8(*p0, t2); // p0 += t2
*q0 = _mm_subs_epi8(*q0, t3); // q0 -= t3 *q0 = _mm_subs_epi8(*q0, t3); // q0 -= t3
FLIP_SIGN_BIT2(*p0, *q0); FLIP_SIGN_BIT2(*p0, *q0);
@ -419,25 +421,26 @@ static WEBP_INLINE void DoFilter4(__m128i* const p1, __m128i* const p0,
} }
// Applies filter on 6 pixels (p2, p1, p0, q0, q1 and q2) // Applies filter on 6 pixels (p2, p1, p0, q0, q1 and q2)
static WEBP_INLINE void DoFilter6(__m128i* const p2, __m128i* const p1, static WEBP_INLINE void DoFilter6_SSE2(__m128i* const p2, __m128i* const p1,
__m128i* const p0, __m128i* const q0, __m128i* const p0, __m128i* const q0,
__m128i* const q1, __m128i* const q2, __m128i* const q1, __m128i* const q2,
const __m128i* const mask, int hev_thresh) { const __m128i* const mask,
int hev_thresh) {
const __m128i zero = _mm_setzero_si128(); const __m128i zero = _mm_setzero_si128();
const __m128i sign_bit = _mm_set1_epi8(0x80); const __m128i sign_bit = _mm_set1_epi8(0x80);
__m128i a, not_hev; __m128i a, not_hev;
// compute hev mask // compute hev mask
GetNotHEV(p1, p0, q0, q1, hev_thresh, &not_hev); GetNotHEV_SSE2(p1, p0, q0, q1, hev_thresh, &not_hev);
FLIP_SIGN_BIT4(*p1, *p0, *q0, *q1); FLIP_SIGN_BIT4(*p1, *p0, *q0, *q1);
FLIP_SIGN_BIT2(*p2, *q2); FLIP_SIGN_BIT2(*p2, *q2);
GetBaseDelta(p1, p0, q0, q1, &a); GetBaseDelta_SSE2(p1, p0, q0, q1, &a);
{ // do simple filter on pixels with hev { // do simple filter on pixels with hev
const __m128i m = _mm_andnot_si128(not_hev, *mask); const __m128i m = _mm_andnot_si128(not_hev, *mask);
const __m128i f = _mm_and_si128(a, m); const __m128i f = _mm_and_si128(a, m);
DoSimpleFilter(p0, q0, &f); DoSimpleFilter_SSE2(p0, q0, &f);
} }
{ // do strong filter on pixels with not hev { // do strong filter on pixels with not hev
@ -462,14 +465,14 @@ static WEBP_INLINE void DoFilter6(__m128i* const p2, __m128i* const p1,
const __m128i a0_lo = _mm_add_epi16(a1_lo, f9_lo); // Filter * 27 + 63 const __m128i a0_lo = _mm_add_epi16(a1_lo, f9_lo); // Filter * 27 + 63
const __m128i a0_hi = _mm_add_epi16(a1_hi, f9_hi); // Filter * 27 + 63 const __m128i a0_hi = _mm_add_epi16(a1_hi, f9_hi); // Filter * 27 + 63
Update2Pixels(p2, q2, &a2_lo, &a2_hi); Update2Pixels_SSE2(p2, q2, &a2_lo, &a2_hi);
Update2Pixels(p1, q1, &a1_lo, &a1_hi); Update2Pixels_SSE2(p1, q1, &a1_lo, &a1_hi);
Update2Pixels(p0, q0, &a0_lo, &a0_hi); Update2Pixels_SSE2(p0, q0, &a0_lo, &a0_hi);
} }
} }
// reads 8 rows across a vertical edge. // reads 8 rows across a vertical edge.
static WEBP_INLINE void Load8x4(const uint8_t* const b, int stride, static WEBP_INLINE void Load8x4_SSE2(const uint8_t* const b, int stride,
__m128i* const p, __m128i* const q) { __m128i* const p, __m128i* const q) {
// A0 = 63 62 61 60 23 22 21 20 43 42 41 40 03 02 01 00 // A0 = 63 62 61 60 23 22 21 20 43 42 41 40 03 02 01 00
// A1 = 73 72 71 70 33 32 31 30 53 52 51 50 13 12 11 10 // A1 = 73 72 71 70 33 32 31 30 53 52 51 50 13 12 11 10
@ -496,7 +499,7 @@ static WEBP_INLINE void Load8x4(const uint8_t* const b, int stride,
*q = _mm_unpackhi_epi32(C0, C1); *q = _mm_unpackhi_epi32(C0, C1);
} }
static WEBP_INLINE void Load16x4(const uint8_t* const r0, static WEBP_INLINE void Load16x4_SSE2(const uint8_t* const r0,
const uint8_t* const r8, const uint8_t* const r8,
int stride, int stride,
__m128i* const p1, __m128i* const p0, __m128i* const p1, __m128i* const p0,
@ -516,8 +519,8 @@ static WEBP_INLINE void Load16x4(const uint8_t* const r0,
// q0 = 73 63 53 43 33 23 13 03 72 62 52 42 32 22 12 02 // q0 = 73 63 53 43 33 23 13 03 72 62 52 42 32 22 12 02
// p0 = f1 e1 d1 c1 b1 a1 91 81 f0 e0 d0 c0 b0 a0 90 80 // p0 = f1 e1 d1 c1 b1 a1 91 81 f0 e0 d0 c0 b0 a0 90 80
// q1 = f3 e3 d3 c3 b3 a3 93 83 f2 e2 d2 c2 b2 a2 92 82 // q1 = f3 e3 d3 c3 b3 a3 93 83 f2 e2 d2 c2 b2 a2 92 82
Load8x4(r0, stride, p1, q0); Load8x4_SSE2(r0, stride, p1, q0);
Load8x4(r8, stride, p0, q1); Load8x4_SSE2(r8, stride, p0, q1);
{ {
// p1 = f0 e0 d0 c0 b0 a0 90 80 70 60 50 40 30 20 10 00 // p1 = f0 e0 d0 c0 b0 a0 90 80 70 60 50 40 30 20 10 00
@ -533,7 +536,8 @@ static WEBP_INLINE void Load16x4(const uint8_t* const r0,
} }
} }
static WEBP_INLINE void Store4x4(__m128i* const x, uint8_t* dst, int stride) { static WEBP_INLINE void Store4x4_SSE2(__m128i* const x,
uint8_t* dst, int stride) {
int i; int i;
for (i = 0; i < 4; ++i, dst += stride) { for (i = 0; i < 4; ++i, dst += stride) {
WebPUint32ToMem(dst, _mm_cvtsi128_si32(*x)); WebPUint32ToMem(dst, _mm_cvtsi128_si32(*x));
@ -542,7 +546,7 @@ static WEBP_INLINE void Store4x4(__m128i* const x, uint8_t* dst, int stride) {
} }
// Transpose back and store // Transpose back and store
static WEBP_INLINE void Store16x4(const __m128i* const p1, static WEBP_INLINE void Store16x4_SSE2(const __m128i* const p1,
const __m128i* const p0, const __m128i* const p0,
const __m128i* const q0, const __m128i* const q0,
const __m128i* const q1, const __m128i* const q1,
@ -574,55 +578,55 @@ static WEBP_INLINE void Store16x4(const __m128i* const p1,
p1_s = _mm_unpacklo_epi16(t1, q1_s); p1_s = _mm_unpacklo_epi16(t1, q1_s);
q1_s = _mm_unpackhi_epi16(t1, q1_s); q1_s = _mm_unpackhi_epi16(t1, q1_s);
Store4x4(&p0_s, r0, stride); Store4x4_SSE2(&p0_s, r0, stride);
r0 += 4 * stride; r0 += 4 * stride;
Store4x4(&q0_s, r0, stride); Store4x4_SSE2(&q0_s, r0, stride);
Store4x4(&p1_s, r8, stride); Store4x4_SSE2(&p1_s, r8, stride);
r8 += 4 * stride; r8 += 4 * stride;
Store4x4(&q1_s, r8, stride); Store4x4_SSE2(&q1_s, r8, stride);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Simple In-loop filtering (Paragraph 15.2) // Simple In-loop filtering (Paragraph 15.2)
static void SimpleVFilter16(uint8_t* p, int stride, int thresh) { static void SimpleVFilter16_SSE2(uint8_t* p, int stride, int thresh) {
// Load // Load
__m128i p1 = _mm_loadu_si128((__m128i*)&p[-2 * stride]); __m128i p1 = _mm_loadu_si128((__m128i*)&p[-2 * stride]);
__m128i p0 = _mm_loadu_si128((__m128i*)&p[-stride]); __m128i p0 = _mm_loadu_si128((__m128i*)&p[-stride]);
__m128i q0 = _mm_loadu_si128((__m128i*)&p[0]); __m128i q0 = _mm_loadu_si128((__m128i*)&p[0]);
__m128i q1 = _mm_loadu_si128((__m128i*)&p[stride]); __m128i q1 = _mm_loadu_si128((__m128i*)&p[stride]);
DoFilter2(&p1, &p0, &q0, &q1, thresh); DoFilter2_SSE2(&p1, &p0, &q0, &q1, thresh);
// Store // Store
_mm_storeu_si128((__m128i*)&p[-stride], p0); _mm_storeu_si128((__m128i*)&p[-stride], p0);
_mm_storeu_si128((__m128i*)&p[0], q0); _mm_storeu_si128((__m128i*)&p[0], q0);
} }
static void SimpleHFilter16(uint8_t* p, int stride, int thresh) { static void SimpleHFilter16_SSE2(uint8_t* p, int stride, int thresh) {
__m128i p1, p0, q0, q1; __m128i p1, p0, q0, q1;
p -= 2; // beginning of p1 p -= 2; // beginning of p1
Load16x4(p, p + 8 * stride, stride, &p1, &p0, &q0, &q1); Load16x4_SSE2(p, p + 8 * stride, stride, &p1, &p0, &q0, &q1);
DoFilter2(&p1, &p0, &q0, &q1, thresh); DoFilter2_SSE2(&p1, &p0, &q0, &q1, thresh);
Store16x4(&p1, &p0, &q0, &q1, p, p + 8 * stride, stride); Store16x4_SSE2(&p1, &p0, &q0, &q1, p, p + 8 * stride, stride);
} }
static void SimpleVFilter16i(uint8_t* p, int stride, int thresh) { static void SimpleVFilter16i_SSE2(uint8_t* p, int stride, int thresh) {
int k; int k;
for (k = 3; k > 0; --k) { for (k = 3; k > 0; --k) {
p += 4 * stride; p += 4 * stride;
SimpleVFilter16(p, stride, thresh); SimpleVFilter16_SSE2(p, stride, thresh);
} }
} }
static void SimpleHFilter16i(uint8_t* p, int stride, int thresh) { static void SimpleHFilter16i_SSE2(uint8_t* p, int stride, int thresh) {
int k; int k;
for (k = 3; k > 0; --k) { for (k = 3; k > 0; --k) {
p += 4; p += 4;
SimpleHFilter16(p, stride, thresh); SimpleHFilter16_SSE2(p, stride, thresh);
} }
} }
@ -667,7 +671,7 @@ static void SimpleHFilter16i(uint8_t* p, int stride, int thresh) {
_mm_storel_epi64((__m128i*)&(v)[(stride)], p); \ _mm_storel_epi64((__m128i*)&(v)[(stride)], p); \
} }
static WEBP_INLINE void ComplexMask(const __m128i* const p1, static WEBP_INLINE void ComplexMask_SSE2(const __m128i* const p1,
const __m128i* const p0, const __m128i* const p0,
const __m128i* const q0, const __m128i* const q0,
const __m128i* const q1, const __m128i* const q1,
@ -677,12 +681,12 @@ static WEBP_INLINE void ComplexMask(const __m128i* const p1,
const __m128i diff = _mm_subs_epu8(*mask, it); const __m128i diff = _mm_subs_epu8(*mask, it);
const __m128i thresh_mask = _mm_cmpeq_epi8(diff, _mm_setzero_si128()); const __m128i thresh_mask = _mm_cmpeq_epi8(diff, _mm_setzero_si128());
__m128i filter_mask; __m128i filter_mask;
NeedsFilter(p1, p0, q0, q1, thresh, &filter_mask); NeedsFilter_SSE2(p1, p0, q0, q1, thresh, &filter_mask);
*mask = _mm_and_si128(thresh_mask, filter_mask); *mask = _mm_and_si128(thresh_mask, filter_mask);
} }
// on macroblock edges // on macroblock edges
static void VFilter16(uint8_t* p, int stride, static void VFilter16_SSE2(uint8_t* p, int stride,
int thresh, int ithresh, int hev_thresh) { int thresh, int ithresh, int hev_thresh) {
__m128i t1; __m128i t1;
__m128i mask; __m128i mask;
@ -696,8 +700,8 @@ static void VFilter16(uint8_t* p, int stride,
LOAD_H_EDGES4(p, stride, q0, q1, q2, t1); LOAD_H_EDGES4(p, stride, q0, q1, q2, t1);
MAX_DIFF2(t1, q2, q1, q0, mask); MAX_DIFF2(t1, q2, q1, q0, mask);
ComplexMask(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); ComplexMask_SSE2(&p1, &p0, &q0, &q1, thresh, ithresh, &mask);
DoFilter6(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh); DoFilter6_SSE2(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh);
// Store // Store
_mm_storeu_si128((__m128i*)&p[-3 * stride], p2); _mm_storeu_si128((__m128i*)&p[-3 * stride], p2);
@ -708,27 +712,27 @@ static void VFilter16(uint8_t* p, int stride,
_mm_storeu_si128((__m128i*)&p[+2 * stride], q2); _mm_storeu_si128((__m128i*)&p[+2 * stride], q2);
} }
static void HFilter16(uint8_t* p, int stride, static void HFilter16_SSE2(uint8_t* p, int stride,
int thresh, int ithresh, int hev_thresh) { int thresh, int ithresh, int hev_thresh) {
__m128i mask; __m128i mask;
__m128i p3, p2, p1, p0, q0, q1, q2, q3; __m128i p3, p2, p1, p0, q0, q1, q2, q3;
uint8_t* const b = p - 4; uint8_t* const b = p - 4;
Load16x4(b, b + 8 * stride, stride, &p3, &p2, &p1, &p0); Load16x4_SSE2(b, b + 8 * stride, stride, &p3, &p2, &p1, &p0);
MAX_DIFF1(p3, p2, p1, p0, mask); MAX_DIFF1(p3, p2, p1, p0, mask);
Load16x4(p, p + 8 * stride, stride, &q0, &q1, &q2, &q3); Load16x4_SSE2(p, p + 8 * stride, stride, &q0, &q1, &q2, &q3);
MAX_DIFF2(q3, q2, q1, q0, mask); MAX_DIFF2(q3, q2, q1, q0, mask);
ComplexMask(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); ComplexMask_SSE2(&p1, &p0, &q0, &q1, thresh, ithresh, &mask);
DoFilter6(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh); DoFilter6_SSE2(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh);
Store16x4(&p3, &p2, &p1, &p0, b, b + 8 * stride, stride); Store16x4_SSE2(&p3, &p2, &p1, &p0, b, b + 8 * stride, stride);
Store16x4(&q0, &q1, &q2, &q3, p, p + 8 * stride, stride); Store16x4_SSE2(&q0, &q1, &q2, &q3, p, p + 8 * stride, stride);
} }
// on three inner edges // on three inner edges
static void VFilter16i(uint8_t* p, int stride, static void VFilter16i_SSE2(uint8_t* p, int stride,
int thresh, int ithresh, int hev_thresh) { int thresh, int ithresh, int hev_thresh) {
int k; int k;
__m128i p3, p2, p1, p0; // loop invariants __m128i p3, p2, p1, p0; // loop invariants
@ -746,8 +750,8 @@ static void VFilter16i(uint8_t* p, int stride,
// p3 and p2 are not just temporary variables here: they will be // p3 and p2 are not just temporary variables here: they will be
// re-used for next span. And q2/q3 will become p1/p0 accordingly. // re-used for next span. And q2/q3 will become p1/p0 accordingly.
ComplexMask(&p1, &p0, &p3, &p2, thresh, ithresh, &mask); ComplexMask_SSE2(&p1, &p0, &p3, &p2, thresh, ithresh, &mask);
DoFilter4(&p1, &p0, &p3, &p2, &mask, hev_thresh); DoFilter4_SSE2(&p1, &p0, &p3, &p2, &mask, hev_thresh);
// Store // Store
_mm_storeu_si128((__m128i*)&b[0 * stride], p1); _mm_storeu_si128((__m128i*)&b[0 * stride], p1);
@ -761,12 +765,12 @@ static void VFilter16i(uint8_t* p, int stride,
} }
} }
static void HFilter16i(uint8_t* p, int stride, static void HFilter16i_SSE2(uint8_t* p, int stride,
int thresh, int ithresh, int hev_thresh) { int thresh, int ithresh, int hev_thresh) {
int k; int k;
__m128i p3, p2, p1, p0; // loop invariants __m128i p3, p2, p1, p0; // loop invariants
Load16x4(p, p + 8 * stride, stride, &p3, &p2, &p1, &p0); // prologue Load16x4_SSE2(p, p + 8 * stride, stride, &p3, &p2, &p1, &p0); // prologue
for (k = 3; k > 0; --k) { for (k = 3; k > 0; --k) {
__m128i mask, tmp1, tmp2; __m128i mask, tmp1, tmp2;
@ -775,13 +779,13 @@ static void HFilter16i(uint8_t* p, int stride,
p += 4; // beginning of q0 (and next span) p += 4; // beginning of q0 (and next span)
MAX_DIFF1(p3, p2, p1, p0, mask); // compute partial mask MAX_DIFF1(p3, p2, p1, p0, mask); // compute partial mask
Load16x4(p, p + 8 * stride, stride, &p3, &p2, &tmp1, &tmp2); Load16x4_SSE2(p, p + 8 * stride, stride, &p3, &p2, &tmp1, &tmp2);
MAX_DIFF2(p3, p2, tmp1, tmp2, mask); MAX_DIFF2(p3, p2, tmp1, tmp2, mask);
ComplexMask(&p1, &p0, &p3, &p2, thresh, ithresh, &mask); ComplexMask_SSE2(&p1, &p0, &p3, &p2, thresh, ithresh, &mask);
DoFilter4(&p1, &p0, &p3, &p2, &mask, hev_thresh); DoFilter4_SSE2(&p1, &p0, &p3, &p2, &mask, hev_thresh);
Store16x4(&p1, &p0, &p3, &p2, b, b + 8 * stride, stride); Store16x4_SSE2(&p1, &p0, &p3, &p2, b, b + 8 * stride, stride);
// rotate samples // rotate samples
p1 = tmp1; p1 = tmp1;
@ -790,7 +794,7 @@ static void HFilter16i(uint8_t* p, int stride,
} }
// 8-pixels wide variant, for chroma filtering // 8-pixels wide variant, for chroma filtering
static void VFilter8(uint8_t* u, uint8_t* v, int stride, static void VFilter8_SSE2(uint8_t* u, uint8_t* v, int stride,
int thresh, int ithresh, int hev_thresh) { int thresh, int ithresh, int hev_thresh) {
__m128i mask; __m128i mask;
__m128i t1, p2, p1, p0, q0, q1, q2; __m128i t1, p2, p1, p0, q0, q1, q2;
@ -803,8 +807,8 @@ static void VFilter8(uint8_t* u, uint8_t* v, int stride,
LOADUV_H_EDGES4(u, v, stride, q0, q1, q2, t1); LOADUV_H_EDGES4(u, v, stride, q0, q1, q2, t1);
MAX_DIFF2(t1, q2, q1, q0, mask); MAX_DIFF2(t1, q2, q1, q0, mask);
ComplexMask(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); ComplexMask_SSE2(&p1, &p0, &q0, &q1, thresh, ithresh, &mask);
DoFilter6(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh); DoFilter6_SSE2(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh);
// Store // Store
STOREUV(p2, u, v, -3 * stride); STOREUV(p2, u, v, -3 * stride);
@ -815,27 +819,27 @@ static void VFilter8(uint8_t* u, uint8_t* v, int stride,
STOREUV(q2, u, v, 2 * stride); STOREUV(q2, u, v, 2 * stride);
} }
static void HFilter8(uint8_t* u, uint8_t* v, int stride, static void HFilter8_SSE2(uint8_t* u, uint8_t* v, int stride,
int thresh, int ithresh, int hev_thresh) { int thresh, int ithresh, int hev_thresh) {
__m128i mask; __m128i mask;
__m128i p3, p2, p1, p0, q0, q1, q2, q3; __m128i p3, p2, p1, p0, q0, q1, q2, q3;
uint8_t* const tu = u - 4; uint8_t* const tu = u - 4;
uint8_t* const tv = v - 4; uint8_t* const tv = v - 4;
Load16x4(tu, tv, stride, &p3, &p2, &p1, &p0); Load16x4_SSE2(tu, tv, stride, &p3, &p2, &p1, &p0);
MAX_DIFF1(p3, p2, p1, p0, mask); MAX_DIFF1(p3, p2, p1, p0, mask);
Load16x4(u, v, stride, &q0, &q1, &q2, &q3); Load16x4_SSE2(u, v, stride, &q0, &q1, &q2, &q3);
MAX_DIFF2(q3, q2, q1, q0, mask); MAX_DIFF2(q3, q2, q1, q0, mask);
ComplexMask(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); ComplexMask_SSE2(&p1, &p0, &q0, &q1, thresh, ithresh, &mask);
DoFilter6(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh); DoFilter6_SSE2(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh);
Store16x4(&p3, &p2, &p1, &p0, tu, tv, stride); Store16x4_SSE2(&p3, &p2, &p1, &p0, tu, tv, stride);
Store16x4(&q0, &q1, &q2, &q3, u, v, stride); Store16x4_SSE2(&q0, &q1, &q2, &q3, u, v, stride);
} }
static void VFilter8i(uint8_t* u, uint8_t* v, int stride, static void VFilter8i_SSE2(uint8_t* u, uint8_t* v, int stride,
int thresh, int ithresh, int hev_thresh) { int thresh, int ithresh, int hev_thresh) {
__m128i mask; __m128i mask;
__m128i t1, t2, p1, p0, q0, q1; __m128i t1, t2, p1, p0, q0, q1;
@ -851,8 +855,8 @@ static void VFilter8i(uint8_t* u, uint8_t* v, int stride,
LOADUV_H_EDGES4(u, v, stride, q0, q1, t1, t2); LOADUV_H_EDGES4(u, v, stride, q0, q1, t1, t2);
MAX_DIFF2(t2, t1, q1, q0, mask); MAX_DIFF2(t2, t1, q1, q0, mask);
ComplexMask(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); ComplexMask_SSE2(&p1, &p0, &q0, &q1, thresh, ithresh, &mask);
DoFilter4(&p1, &p0, &q0, &q1, &mask, hev_thresh); DoFilter4_SSE2(&p1, &p0, &q0, &q1, &mask, hev_thresh);
// Store // Store
STOREUV(p1, u, v, -2 * stride); STOREUV(p1, u, v, -2 * stride);
@ -861,24 +865,24 @@ static void VFilter8i(uint8_t* u, uint8_t* v, int stride,
STOREUV(q1, u, v, 1 * stride); STOREUV(q1, u, v, 1 * stride);
} }
static void HFilter8i(uint8_t* u, uint8_t* v, int stride, static void HFilter8i_SSE2(uint8_t* u, uint8_t* v, int stride,
int thresh, int ithresh, int hev_thresh) { int thresh, int ithresh, int hev_thresh) {
__m128i mask; __m128i mask;
__m128i t1, t2, p1, p0, q0, q1; __m128i t1, t2, p1, p0, q0, q1;
Load16x4(u, v, stride, &t2, &t1, &p1, &p0); // p3, p2, p1, p0 Load16x4_SSE2(u, v, stride, &t2, &t1, &p1, &p0); // p3, p2, p1, p0
MAX_DIFF1(t2, t1, p1, p0, mask); MAX_DIFF1(t2, t1, p1, p0, mask);
u += 4; // beginning of q0 u += 4; // beginning of q0
v += 4; v += 4;
Load16x4(u, v, stride, &q0, &q1, &t1, &t2); // q0, q1, q2, q3 Load16x4_SSE2(u, v, stride, &q0, &q1, &t1, &t2); // q0, q1, q2, q3
MAX_DIFF2(t2, t1, q1, q0, mask); MAX_DIFF2(t2, t1, q1, q0, mask);
ComplexMask(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); ComplexMask_SSE2(&p1, &p0, &q0, &q1, thresh, ithresh, &mask);
DoFilter4(&p1, &p0, &q0, &q1, &mask, hev_thresh); DoFilter4_SSE2(&p1, &p0, &q0, &q1, &mask, hev_thresh);
u -= 2; // beginning of p1 u -= 2; // beginning of p1
v -= 2; v -= 2;
Store16x4(&p1, &p0, &q0, &q1, u, v, stride); Store16x4_SSE2(&p1, &p0, &q0, &q1, u, v, stride);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -895,7 +899,7 @@ static void HFilter8i(uint8_t* u, uint8_t* v, int stride,
// where: AC = (a + b + 1) >> 1, BC = (b + c + 1) >> 1 // where: AC = (a + b + 1) >> 1, BC = (b + c + 1) >> 1
// and ab = a ^ b, bc = b ^ c, lsb = (AC^BC)&1 // and ab = a ^ b, bc = b ^ c, lsb = (AC^BC)&1
static void VE4(uint8_t* dst) { // vertical static void VE4_SSE2(uint8_t* dst) { // vertical
const __m128i one = _mm_set1_epi8(1); const __m128i one = _mm_set1_epi8(1);
const __m128i ABCDEFGH = _mm_loadl_epi64((__m128i*)(dst - BPS - 1)); const __m128i ABCDEFGH = _mm_loadl_epi64((__m128i*)(dst - BPS - 1));
const __m128i BCDEFGH0 = _mm_srli_si128(ABCDEFGH, 1); const __m128i BCDEFGH0 = _mm_srli_si128(ABCDEFGH, 1);
@ -911,7 +915,7 @@ static void VE4(uint8_t* dst) { // vertical
} }
} }
static void LD4(uint8_t* dst) { // Down-Left static void LD4_SSE2(uint8_t* dst) { // Down-Left
const __m128i one = _mm_set1_epi8(1); const __m128i one = _mm_set1_epi8(1);
const __m128i ABCDEFGH = _mm_loadl_epi64((__m128i*)(dst - BPS)); const __m128i ABCDEFGH = _mm_loadl_epi64((__m128i*)(dst - BPS));
const __m128i BCDEFGH0 = _mm_srli_si128(ABCDEFGH, 1); const __m128i BCDEFGH0 = _mm_srli_si128(ABCDEFGH, 1);
@ -927,7 +931,7 @@ static void LD4(uint8_t* dst) { // Down-Left
WebPUint32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 3))); WebPUint32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 3)));
} }
static void VR4(uint8_t* dst) { // Vertical-Right static void VR4_SSE2(uint8_t* dst) { // Vertical-Right
const __m128i one = _mm_set1_epi8(1); const __m128i one = _mm_set1_epi8(1);
const int I = dst[-1 + 0 * BPS]; const int I = dst[-1 + 0 * BPS];
const int J = dst[-1 + 1 * BPS]; const int J = dst[-1 + 1 * BPS];
@ -952,7 +956,7 @@ static void VR4(uint8_t* dst) { // Vertical-Right
DST(0, 3) = AVG3(K, J, I); DST(0, 3) = AVG3(K, J, I);
} }
static void VL4(uint8_t* dst) { // Vertical-Left static void VL4_SSE2(uint8_t* dst) { // Vertical-Left
const __m128i one = _mm_set1_epi8(1); const __m128i one = _mm_set1_epi8(1);
const __m128i ABCDEFGH = _mm_loadl_epi64((__m128i*)(dst - BPS)); const __m128i ABCDEFGH = _mm_loadl_epi64((__m128i*)(dst - BPS));
const __m128i BCDEFGH_ = _mm_srli_si128(ABCDEFGH, 1); const __m128i BCDEFGH_ = _mm_srli_si128(ABCDEFGH, 1);
@ -977,7 +981,7 @@ static void VL4(uint8_t* dst) { // Vertical-Left
DST(3, 3) = (extra_out >> 8) & 0xff; DST(3, 3) = (extra_out >> 8) & 0xff;
} }
static void RD4(uint8_t* dst) { // Down-right static void RD4_SSE2(uint8_t* dst) { // Down-right
const __m128i one = _mm_set1_epi8(1); const __m128i one = _mm_set1_epi8(1);
const __m128i XABCD = _mm_loadl_epi64((__m128i*)(dst - BPS - 1)); const __m128i XABCD = _mm_loadl_epi64((__m128i*)(dst - BPS - 1));
const __m128i ____XABCD = _mm_slli_si128(XABCD, 4); const __m128i ____XABCD = _mm_slli_si128(XABCD, 4);
@ -1006,7 +1010,7 @@ static void RD4(uint8_t* dst) { // Down-right
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Luma 16x16 // Luma 16x16
static WEBP_INLINE void TrueMotion(uint8_t* dst, int size) { static WEBP_INLINE void TrueMotion_SSE2(uint8_t* dst, int size) {
const uint8_t* top = dst - BPS; const uint8_t* top = dst - BPS;
const __m128i zero = _mm_setzero_si128(); const __m128i zero = _mm_setzero_si128();
int y; int y;
@ -1043,11 +1047,11 @@ static WEBP_INLINE void TrueMotion(uint8_t* dst, int size) {
} }
} }
static void TM4(uint8_t* dst) { TrueMotion(dst, 4); } static void TM4_SSE2(uint8_t* dst) { TrueMotion_SSE2(dst, 4); }
static void TM8uv(uint8_t* dst) { TrueMotion(dst, 8); } static void TM8uv_SSE2(uint8_t* dst) { TrueMotion_SSE2(dst, 8); }
static void TM16(uint8_t* dst) { TrueMotion(dst, 16); } static void TM16_SSE2(uint8_t* dst) { TrueMotion_SSE2(dst, 16); }
static void VE16(uint8_t* dst) { static void VE16_SSE2(uint8_t* dst) {
const __m128i top = _mm_loadu_si128((const __m128i*)(dst - BPS)); const __m128i top = _mm_loadu_si128((const __m128i*)(dst - BPS));
int j; int j;
for (j = 0; j < 16; ++j) { for (j = 0; j < 16; ++j) {
@ -1055,7 +1059,7 @@ static void VE16(uint8_t* dst) {
} }
} }
static void HE16(uint8_t* dst) { // horizontal static void HE16_SSE2(uint8_t* dst) { // horizontal
int j; int j;
for (j = 16; j > 0; --j) { for (j = 16; j > 0; --j) {
const __m128i values = _mm_set1_epi8(dst[-1]); const __m128i values = _mm_set1_epi8(dst[-1]);
@ -1064,7 +1068,7 @@ static void HE16(uint8_t* dst) { // horizontal
} }
} }
static WEBP_INLINE void Put16(uint8_t v, uint8_t* dst) { static WEBP_INLINE void Put16_SSE2(uint8_t v, uint8_t* dst) {
int j; int j;
const __m128i values = _mm_set1_epi8(v); const __m128i values = _mm_set1_epi8(v);
for (j = 0; j < 16; ++j) { for (j = 0; j < 16; ++j) {
@ -1072,7 +1076,7 @@ static WEBP_INLINE void Put16(uint8_t v, uint8_t* dst) {
} }
} }
static void DC16(uint8_t* dst) { // DC static void DC16_SSE2(uint8_t* dst) { // DC
const __m128i zero = _mm_setzero_si128(); const __m128i zero = _mm_setzero_si128();
const __m128i top = _mm_loadu_si128((const __m128i*)(dst - BPS)); const __m128i top = _mm_loadu_si128((const __m128i*)(dst - BPS));
const __m128i sad8x2 = _mm_sad_epu8(top, zero); const __m128i sad8x2 = _mm_sad_epu8(top, zero);
@ -1085,37 +1089,37 @@ static void DC16(uint8_t* dst) { // DC
} }
{ {
const int DC = _mm_cvtsi128_si32(sum) + left + 16; const int DC = _mm_cvtsi128_si32(sum) + left + 16;
Put16(DC >> 5, dst); Put16_SSE2(DC >> 5, dst);
} }
} }
static void DC16NoTop(uint8_t* dst) { // DC with top samples not available static void DC16NoTop_SSE2(uint8_t* dst) { // DC with top samples unavailable
int DC = 8; int DC = 8;
int j; int j;
for (j = 0; j < 16; ++j) { for (j = 0; j < 16; ++j) {
DC += dst[-1 + j * BPS]; DC += dst[-1 + j * BPS];
} }
Put16(DC >> 4, dst); Put16_SSE2(DC >> 4, dst);
} }
static void DC16NoLeft(uint8_t* dst) { // DC with left samples not available static void DC16NoLeft_SSE2(uint8_t* dst) { // DC with left samples unavailable
const __m128i zero = _mm_setzero_si128(); const __m128i zero = _mm_setzero_si128();
const __m128i top = _mm_loadu_si128((const __m128i*)(dst - BPS)); const __m128i top = _mm_loadu_si128((const __m128i*)(dst - BPS));
const __m128i sad8x2 = _mm_sad_epu8(top, zero); const __m128i sad8x2 = _mm_sad_epu8(top, zero);
// sum the two sads: sad8x2[0:1] + sad8x2[8:9] // sum the two sads: sad8x2[0:1] + sad8x2[8:9]
const __m128i sum = _mm_add_epi16(sad8x2, _mm_shuffle_epi32(sad8x2, 2)); const __m128i sum = _mm_add_epi16(sad8x2, _mm_shuffle_epi32(sad8x2, 2));
const int DC = _mm_cvtsi128_si32(sum) + 8; const int DC = _mm_cvtsi128_si32(sum) + 8;
Put16(DC >> 4, dst); Put16_SSE2(DC >> 4, dst);
} }
static void DC16NoTopLeft(uint8_t* dst) { // DC with no top and left samples static void DC16NoTopLeft_SSE2(uint8_t* dst) { // DC with no top & left samples
Put16(0x80, dst); Put16_SSE2(0x80, dst);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Chroma // Chroma
static void VE8uv(uint8_t* dst) { // vertical static void VE8uv_SSE2(uint8_t* dst) { // vertical
int j; int j;
const __m128i top = _mm_loadl_epi64((const __m128i*)(dst - BPS)); const __m128i top = _mm_loadl_epi64((const __m128i*)(dst - BPS));
for (j = 0; j < 8; ++j) { for (j = 0; j < 8; ++j) {
@ -1123,7 +1127,7 @@ static void VE8uv(uint8_t* dst) { // vertical
} }
} }
static void HE8uv(uint8_t* dst) { // horizontal static void HE8uv_SSE2(uint8_t* dst) { // horizontal
int j; int j;
for (j = 0; j < 8; ++j) { for (j = 0; j < 8; ++j) {
const __m128i values = _mm_set1_epi8(dst[-1]); const __m128i values = _mm_set1_epi8(dst[-1]);
@ -1133,7 +1137,7 @@ static void HE8uv(uint8_t* dst) { // horizontal
} }
// helper for chroma-DC predictions // helper for chroma-DC predictions
static WEBP_INLINE void Put8x8uv(uint8_t v, uint8_t* dst) { static WEBP_INLINE void Put8x8uv_SSE2(uint8_t v, uint8_t* dst) {
int j; int j;
const __m128i values = _mm_set1_epi8(v); const __m128i values = _mm_set1_epi8(v);
for (j = 0; j < 8; ++j) { for (j = 0; j < 8; ++j) {
@ -1141,7 +1145,7 @@ static WEBP_INLINE void Put8x8uv(uint8_t v, uint8_t* dst) {
} }
} }
static void DC8uv(uint8_t* dst) { // DC static void DC8uv_SSE2(uint8_t* dst) { // DC
const __m128i zero = _mm_setzero_si128(); const __m128i zero = _mm_setzero_si128();
const __m128i top = _mm_loadl_epi64((const __m128i*)(dst - BPS)); const __m128i top = _mm_loadl_epi64((const __m128i*)(dst - BPS));
const __m128i sum = _mm_sad_epu8(top, zero); const __m128i sum = _mm_sad_epu8(top, zero);
@ -1152,29 +1156,29 @@ static void DC8uv(uint8_t* dst) { // DC
} }
{ {
const int DC = _mm_cvtsi128_si32(sum) + left + 8; const int DC = _mm_cvtsi128_si32(sum) + left + 8;
Put8x8uv(DC >> 4, dst); Put8x8uv_SSE2(DC >> 4, dst);
} }
} }
static void DC8uvNoLeft(uint8_t* dst) { // DC with no left samples static void DC8uvNoLeft_SSE2(uint8_t* dst) { // DC with no left samples
const __m128i zero = _mm_setzero_si128(); const __m128i zero = _mm_setzero_si128();
const __m128i top = _mm_loadl_epi64((const __m128i*)(dst - BPS)); const __m128i top = _mm_loadl_epi64((const __m128i*)(dst - BPS));
const __m128i sum = _mm_sad_epu8(top, zero); const __m128i sum = _mm_sad_epu8(top, zero);
const int DC = _mm_cvtsi128_si32(sum) + 4; const int DC = _mm_cvtsi128_si32(sum) + 4;
Put8x8uv(DC >> 3, dst); Put8x8uv_SSE2(DC >> 3, dst);
} }
static void DC8uvNoTop(uint8_t* dst) { // DC with no top samples static void DC8uvNoTop_SSE2(uint8_t* dst) { // DC with no top samples
int dc0 = 4; int dc0 = 4;
int i; int i;
for (i = 0; i < 8; ++i) { for (i = 0; i < 8; ++i) {
dc0 += dst[-1 + i * BPS]; dc0 += dst[-1 + i * BPS];
} }
Put8x8uv(dc0 >> 3, dst); Put8x8uv_SSE2(dc0 >> 3, dst);
} }
static void DC8uvNoTopLeft(uint8_t* dst) { // DC with nothing static void DC8uvNoTopLeft_SSE2(uint8_t* dst) { // DC with nothing
Put8x8uv(0x80, dst); Put8x8uv_SSE2(0x80, dst);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -1183,47 +1187,47 @@ static void DC8uvNoTopLeft(uint8_t* dst) { // DC with nothing
extern void VP8DspInitSSE2(void); extern void VP8DspInitSSE2(void);
WEBP_TSAN_IGNORE_FUNCTION void VP8DspInitSSE2(void) { WEBP_TSAN_IGNORE_FUNCTION void VP8DspInitSSE2(void) {
VP8Transform = Transform; VP8Transform = Transform_SSE2;
#if (USE_TRANSFORM_AC3 == 1) #if (USE_TRANSFORM_AC3 == 1)
VP8TransformAC3 = TransformAC3_SSE2; VP8TransformAC3 = TransformAC3_SSE2;
#endif #endif
VP8VFilter16 = VFilter16; VP8VFilter16 = VFilter16_SSE2;
VP8HFilter16 = HFilter16; VP8HFilter16 = HFilter16_SSE2;
VP8VFilter8 = VFilter8; VP8VFilter8 = VFilter8_SSE2;
VP8HFilter8 = HFilter8; VP8HFilter8 = HFilter8_SSE2;
VP8VFilter16i = VFilter16i; VP8VFilter16i = VFilter16i_SSE2;
VP8HFilter16i = HFilter16i; VP8HFilter16i = HFilter16i_SSE2;
VP8VFilter8i = VFilter8i; VP8VFilter8i = VFilter8i_SSE2;
VP8HFilter8i = HFilter8i; VP8HFilter8i = HFilter8i_SSE2;
VP8SimpleVFilter16 = SimpleVFilter16; VP8SimpleVFilter16 = SimpleVFilter16_SSE2;
VP8SimpleHFilter16 = SimpleHFilter16; VP8SimpleHFilter16 = SimpleHFilter16_SSE2;
VP8SimpleVFilter16i = SimpleVFilter16i; VP8SimpleVFilter16i = SimpleVFilter16i_SSE2;
VP8SimpleHFilter16i = SimpleHFilter16i; VP8SimpleHFilter16i = SimpleHFilter16i_SSE2;
VP8PredLuma4[1] = TM4; VP8PredLuma4[1] = TM4_SSE2;
VP8PredLuma4[2] = VE4; VP8PredLuma4[2] = VE4_SSE2;
VP8PredLuma4[4] = RD4; VP8PredLuma4[4] = RD4_SSE2;
VP8PredLuma4[5] = VR4; VP8PredLuma4[5] = VR4_SSE2;
VP8PredLuma4[6] = LD4; VP8PredLuma4[6] = LD4_SSE2;
VP8PredLuma4[7] = VL4; VP8PredLuma4[7] = VL4_SSE2;
VP8PredLuma16[0] = DC16; VP8PredLuma16[0] = DC16_SSE2;
VP8PredLuma16[1] = TM16; VP8PredLuma16[1] = TM16_SSE2;
VP8PredLuma16[2] = VE16; VP8PredLuma16[2] = VE16_SSE2;
VP8PredLuma16[3] = HE16; VP8PredLuma16[3] = HE16_SSE2;
VP8PredLuma16[4] = DC16NoTop; VP8PredLuma16[4] = DC16NoTop_SSE2;
VP8PredLuma16[5] = DC16NoLeft; VP8PredLuma16[5] = DC16NoLeft_SSE2;
VP8PredLuma16[6] = DC16NoTopLeft; VP8PredLuma16[6] = DC16NoTopLeft_SSE2;
VP8PredChroma8[0] = DC8uv; VP8PredChroma8[0] = DC8uv_SSE2;
VP8PredChroma8[1] = TM8uv; VP8PredChroma8[1] = TM8uv_SSE2;
VP8PredChroma8[2] = VE8uv; VP8PredChroma8[2] = VE8uv_SSE2;
VP8PredChroma8[3] = HE8uv; VP8PredChroma8[3] = HE8uv_SSE2;
VP8PredChroma8[4] = DC8uvNoTop; VP8PredChroma8[4] = DC8uvNoTop_SSE2;
VP8PredChroma8[5] = DC8uvNoLeft; VP8PredChroma8[5] = DC8uvNoLeft_SSE2;
VP8PredChroma8[6] = DC8uvNoTopLeft; VP8PredChroma8[6] = DC8uvNoTopLeft_SSE2;
} }
#else // !WEBP_USE_SSE2 #else // !WEBP_USE_SSE2