Coverage Report

Created: 2026-06-07 06:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libwebp/src/dsp/alpha_processing_sse2.c
Line
Count
Source
1
// Copyright 2014 Google Inc. All Rights Reserved.
2
//
3
// Use of this source code is governed by a BSD-style license
4
// that can be found in the COPYING file in the root of the source
5
// tree. An additional intellectual property rights grant can be found
6
// in the file PATENTS. All contributing project authors may
7
// be found in the AUTHORS file in the root of the source tree.
8
// -----------------------------------------------------------------------------
9
//
10
// Utilities for processing transparent channel.
11
//
12
// Author: Skal (pascal.massimino@gmail.com)
13
14
#include "src/dsp/dsp.h"
15
16
#if defined(WEBP_USE_SSE2)
17
#include <emmintrin.h>
18
19
#include "src/dsp/cpu.h"
20
#include "src/webp/types.h"
21
22
//------------------------------------------------------------------------------
23
24
static int DispatchAlpha_SSE2(const uint8_t* WEBP_RESTRICT alpha,
25
                              int alpha_stride, int width, int height,
26
0
                              uint8_t* WEBP_RESTRICT dst, int dst_stride) {
27
  // alpha_and stores an 'and' operation of all the alpha[] values. The final
28
  // value is not 0xff if any of the alpha[] is not equal to 0xff.
29
0
  uint32_t alpha_and = 0xff;
30
0
  int i, j;
31
0
  const __m128i zero = _mm_setzero_si128();
32
0
  const __m128i alpha_mask = _mm_set1_epi32((int)0xff);  // to preserve A
33
0
  const __m128i all_0xff = _mm_set1_epi8((char)0xff);
34
0
  __m128i all_alphas16 = all_0xff;
35
0
  __m128i all_alphas8 = all_0xff;
36
37
  // We must be able to access 3 extra bytes after the last written byte
38
  // 'dst[4 * width - 4]', because we don't know if alpha is the first or the
39
  // last byte of the quadruplet.
40
0
  for (j = 0; j < height; ++j) {
41
0
    char* ptr = (char*)dst;
42
0
    for (i = 0; i + 16 <= width - 1; i += 16) {
43
      // load 16 alpha bytes
44
0
      const __m128i a0 = _mm_loadu_si128((const __m128i*)&alpha[i]);
45
0
      const __m128i a1_lo = _mm_unpacklo_epi8(a0, zero);
46
0
      const __m128i a1_hi = _mm_unpackhi_epi8(a0, zero);
47
0
      const __m128i a2_lo_lo = _mm_unpacklo_epi16(a1_lo, zero);
48
0
      const __m128i a2_lo_hi = _mm_unpackhi_epi16(a1_lo, zero);
49
0
      const __m128i a2_hi_lo = _mm_unpacklo_epi16(a1_hi, zero);
50
0
      const __m128i a2_hi_hi = _mm_unpackhi_epi16(a1_hi, zero);
51
0
      _mm_maskmoveu_si128(a2_lo_lo, alpha_mask, ptr + 0);
52
0
      _mm_maskmoveu_si128(a2_lo_hi, alpha_mask, ptr + 16);
53
0
      _mm_maskmoveu_si128(a2_hi_lo, alpha_mask, ptr + 32);
54
0
      _mm_maskmoveu_si128(a2_hi_hi, alpha_mask, ptr + 48);
55
      // accumulate 16 alpha 'and' in parallel
56
0
      all_alphas16 = _mm_and_si128(all_alphas16, a0);
57
0
      ptr += 64;
58
0
    }
59
0
    if (i + 8 <= width - 1) {
60
      // load 8 alpha bytes
61
0
      const __m128i a0 = _mm_loadl_epi64((const __m128i*)&alpha[i]);
62
0
      const __m128i a1 = _mm_unpacklo_epi8(a0, zero);
63
0
      const __m128i a2_lo = _mm_unpacklo_epi16(a1, zero);
64
0
      const __m128i a2_hi = _mm_unpackhi_epi16(a1, zero);
65
0
      _mm_maskmoveu_si128(a2_lo, alpha_mask, ptr);
66
0
      _mm_maskmoveu_si128(a2_hi, alpha_mask, ptr + 16);
67
      // accumulate 8 alpha 'and' in parallel
68
0
      all_alphas8 = _mm_and_si128(all_alphas8, a0);
69
0
      i += 8;
70
0
    }
71
0
    for (; i < width; ++i) {
72
0
      const uint32_t alpha_value = alpha[i];
73
0
      dst[4 * i] = alpha_value;
74
0
      alpha_and &= alpha_value;
75
0
    }
76
0
    alpha += alpha_stride;
77
0
    dst += dst_stride;
78
0
  }
79
  // Combine the eight alpha 'and' into a 8-bit mask.
80
0
  alpha_and &= _mm_movemask_epi8(_mm_cmpeq_epi8(all_alphas8, all_0xff)) & 0xff;
81
0
  return (alpha_and != 0xff ||
82
0
          _mm_movemask_epi8(_mm_cmpeq_epi8(all_alphas16, all_0xff)) != 0xffff);
83
0
}
84
85
static void DispatchAlphaToGreen_SSE2(const uint8_t* WEBP_RESTRICT alpha,
86
                                      int alpha_stride, int width, int height,
87
                                      uint32_t* WEBP_RESTRICT dst,
88
0
                                      int dst_stride) {
89
0
  int i, j;
90
0
  const __m128i zero = _mm_setzero_si128();
91
0
  const int limit = width & ~15;
92
0
  for (j = 0; j < height; ++j) {
93
0
    for (i = 0; i < limit; i += 16) {  // process 16 alpha bytes
94
0
      const __m128i a0 = _mm_loadu_si128((const __m128i*)&alpha[i]);
95
0
      const __m128i a1 = _mm_unpacklo_epi8(zero, a0);  // note the 'zero' first!
96
0
      const __m128i b1 = _mm_unpackhi_epi8(zero, a0);
97
0
      const __m128i a2_lo = _mm_unpacklo_epi16(a1, zero);
98
0
      const __m128i b2_lo = _mm_unpacklo_epi16(b1, zero);
99
0
      const __m128i a2_hi = _mm_unpackhi_epi16(a1, zero);
100
0
      const __m128i b2_hi = _mm_unpackhi_epi16(b1, zero);
101
0
      _mm_storeu_si128((__m128i*)&dst[i + 0], a2_lo);
102
0
      _mm_storeu_si128((__m128i*)&dst[i + 4], a2_hi);
103
0
      _mm_storeu_si128((__m128i*)&dst[i + 8], b2_lo);
104
0
      _mm_storeu_si128((__m128i*)&dst[i + 12], b2_hi);
105
0
    }
106
0
    for (; i < width; ++i) dst[i] = alpha[i] << 8;
107
0
    alpha += alpha_stride;
108
0
    dst += dst_stride;
109
0
  }
110
0
}
111
112
static int ExtractAlpha_SSE2(const uint8_t* WEBP_RESTRICT argb, int argb_stride,
113
                             int width, int height,
114
0
                             uint8_t* WEBP_RESTRICT alpha, int alpha_stride) {
115
  // alpha_and stores an 'and' operation of all the alpha[] values. The final
116
  // value is not 0xff if any of the alpha[] is not equal to 0xff.
117
0
  uint32_t alpha_and = 0xff;
118
0
  int i, j;
119
0
  const __m128i a_mask = _mm_set1_epi32(0xff);  // to preserve alpha
120
0
  const __m128i all_0xff = _mm_set_epi32(0, 0, ~0, ~0);
121
0
  __m128i all_alphas = all_0xff;
122
123
  // We must be able to access 3 extra bytes after the last written byte
124
  // 'src[4 * width - 4]', because we don't know if alpha is the first or the
125
  // last byte of the quadruplet.
126
0
  const int limit = (width - 1) & ~7;
127
128
0
  for (j = 0; j < height; ++j) {
129
0
    const __m128i* src = (const __m128i*)argb;
130
0
    for (i = 0; i < limit; i += 8) {
131
      // load 32 argb bytes
132
0
      const __m128i a0 = _mm_loadu_si128(src + 0);
133
0
      const __m128i a1 = _mm_loadu_si128(src + 1);
134
0
      const __m128i b0 = _mm_and_si128(a0, a_mask);
135
0
      const __m128i b1 = _mm_and_si128(a1, a_mask);
136
0
      const __m128i c0 = _mm_packs_epi32(b0, b1);
137
0
      const __m128i d0 = _mm_packus_epi16(c0, c0);
138
      // store
139
0
      _mm_storel_epi64((__m128i*)&alpha[i], d0);
140
      // accumulate eight alpha 'and' in parallel
141
0
      all_alphas = _mm_and_si128(all_alphas, d0);
142
0
      src += 2;
143
0
    }
144
0
    for (; i < width; ++i) {
145
0
      const uint32_t alpha_value = argb[4 * i];
146
0
      alpha[i] = alpha_value;
147
0
      alpha_and &= alpha_value;
148
0
    }
149
0
    argb += argb_stride;
150
0
    alpha += alpha_stride;
151
0
  }
152
  // Combine the eight alpha 'and' into a 8-bit mask.
153
0
  alpha_and &= _mm_movemask_epi8(_mm_cmpeq_epi8(all_alphas, all_0xff));
154
0
  return (alpha_and == 0xff);
155
0
}
156
157
static void ExtractGreen_SSE2(const uint32_t* WEBP_RESTRICT argb,
158
0
                              uint8_t* WEBP_RESTRICT alpha, int size) {
159
0
  int i;
160
0
  const __m128i mask = _mm_set1_epi32(0xff);
161
0
  const __m128i* src = (const __m128i*)argb;
162
163
0
  for (i = 0; i + 16 <= size; i += 16, src += 4) {
164
0
    const __m128i a0 = _mm_loadu_si128(src + 0);
165
0
    const __m128i a1 = _mm_loadu_si128(src + 1);
166
0
    const __m128i a2 = _mm_loadu_si128(src + 2);
167
0
    const __m128i a3 = _mm_loadu_si128(src + 3);
168
0
    const __m128i b0 = _mm_srli_epi32(a0, 8);
169
0
    const __m128i b1 = _mm_srli_epi32(a1, 8);
170
0
    const __m128i b2 = _mm_srli_epi32(a2, 8);
171
0
    const __m128i b3 = _mm_srli_epi32(a3, 8);
172
0
    const __m128i c0 = _mm_and_si128(b0, mask);
173
0
    const __m128i c1 = _mm_and_si128(b1, mask);
174
0
    const __m128i c2 = _mm_and_si128(b2, mask);
175
0
    const __m128i c3 = _mm_and_si128(b3, mask);
176
0
    const __m128i d0 = _mm_packs_epi32(c0, c1);
177
0
    const __m128i d1 = _mm_packs_epi32(c2, c3);
178
0
    const __m128i e = _mm_packus_epi16(d0, d1);
179
    // store
180
0
    _mm_storeu_si128((__m128i*)&alpha[i], e);
181
0
  }
182
0
  if (i + 8 <= size) {
183
0
    const __m128i a0 = _mm_loadu_si128(src + 0);
184
0
    const __m128i a1 = _mm_loadu_si128(src + 1);
185
0
    const __m128i b0 = _mm_srli_epi32(a0, 8);
186
0
    const __m128i b1 = _mm_srli_epi32(a1, 8);
187
0
    const __m128i c0 = _mm_and_si128(b0, mask);
188
0
    const __m128i c1 = _mm_and_si128(b1, mask);
189
0
    const __m128i d = _mm_packs_epi32(c0, c1);
190
0
    const __m128i e = _mm_packus_epi16(d, d);
191
0
    _mm_storel_epi64((__m128i*)&alpha[i], e);
192
0
    i += 8;
193
0
  }
194
0
  for (; i < size; ++i) alpha[i] = argb[i] >> 8;
195
0
}
196
197
//------------------------------------------------------------------------------
198
// Non-dither premultiplied modes
199
200
0
#define MULTIPLIER(a) ((a) * 0x8081)
201
0
#define PREMULTIPLY(x, m) (((x) * (m)) >> 23)
202
203
// We can't use a 'const int' for the SHUFFLE value, because it has to be an
204
// immediate in the _mm_shufflexx_epi16() instruction. We really need a macro.
205
// We use: v / 255 = (v * 0x8081) >> 23, where v = alpha * {r,g,b} is a 16bit
206
// value.
207
#define APPLY_ALPHA(RGBX, SHUFFLE)                                     \
208
0
  do {                                                                 \
209
0
    const __m128i argb0 = _mm_loadu_si128((const __m128i*)&(RGBX));    \
210
0
    const __m128i argb1_lo = _mm_unpacklo_epi8(argb0, zero);           \
211
0
    const __m128i argb1_hi = _mm_unpackhi_epi8(argb0, zero);           \
212
0
    const __m128i alpha0_lo = _mm_or_si128(argb1_lo, kMask);           \
213
0
    const __m128i alpha0_hi = _mm_or_si128(argb1_hi, kMask);           \
214
0
    const __m128i alpha1_lo = _mm_shufflelo_epi16(alpha0_lo, SHUFFLE); \
215
0
    const __m128i alpha1_hi = _mm_shufflelo_epi16(alpha0_hi, SHUFFLE); \
216
0
    const __m128i alpha2_lo = _mm_shufflehi_epi16(alpha1_lo, SHUFFLE); \
217
0
    const __m128i alpha2_hi = _mm_shufflehi_epi16(alpha1_hi, SHUFFLE); \
218
0
    /* alpha2 = [ff a0 a0 a0][ff a1 a1 a1] */                          \
219
0
    const __m128i A0_lo = _mm_mullo_epi16(alpha2_lo, argb1_lo);        \
220
0
    const __m128i A0_hi = _mm_mullo_epi16(alpha2_hi, argb1_hi);        \
221
0
    const __m128i A1_lo = _mm_mulhi_epu16(A0_lo, kMult);               \
222
0
    const __m128i A1_hi = _mm_mulhi_epu16(A0_hi, kMult);               \
223
0
    const __m128i A2_lo = _mm_srli_epi16(A1_lo, 7);                    \
224
0
    const __m128i A2_hi = _mm_srli_epi16(A1_hi, 7);                    \
225
0
    const __m128i A3 = _mm_packus_epi16(A2_lo, A2_hi);                 \
226
0
    _mm_storeu_si128((__m128i*)&(RGBX), A3);                           \
227
0
  } while (0)
228
229
static void ApplyAlphaMultiply_SSE2(uint8_t* rgba, int alpha_first, int w,
230
0
                                    int h, int stride) {
231
0
  const __m128i zero = _mm_setzero_si128();
232
0
  const __m128i kMult = _mm_set1_epi16((short)0x8081);
233
0
  const __m128i kMask = _mm_set_epi16(0, 0xff, 0xff, 0, 0, 0xff, 0xff, 0);
234
0
  const int kSpan = 4;
235
0
  while (h-- > 0) {
236
0
    uint32_t* const rgbx = (uint32_t*)rgba;
237
0
    int i;
238
0
    if (!alpha_first) {
239
0
      for (i = 0; i + kSpan <= w; i += kSpan) {
240
0
        APPLY_ALPHA(rgbx[i], _MM_SHUFFLE(2, 3, 3, 3));
241
0
      }
242
0
    } else {
243
0
      for (i = 0; i + kSpan <= w; i += kSpan) {
244
0
        APPLY_ALPHA(rgbx[i], _MM_SHUFFLE(0, 0, 0, 1));
245
0
      }
246
0
    }
247
    // Finish with left-overs.
248
0
    for (; i < w; ++i) {
249
0
      uint8_t* const rgb = rgba + (alpha_first ? 1 : 0);
250
0
      const uint8_t* const alpha = rgba + (alpha_first ? 0 : 3);
251
0
      const uint32_t a = alpha[4 * i];
252
0
      if (a != 0xff) {
253
0
        const uint32_t mult = MULTIPLIER(a);
254
0
        rgb[4 * i + 0] = PREMULTIPLY(rgb[4 * i + 0], mult);
255
0
        rgb[4 * i + 1] = PREMULTIPLY(rgb[4 * i + 1], mult);
256
0
        rgb[4 * i + 2] = PREMULTIPLY(rgb[4 * i + 2], mult);
257
0
      }
258
0
    }
259
0
    rgba += stride;
260
0
  }
261
0
}
262
#undef MULTIPLIER
263
#undef PREMULTIPLY
264
265
//------------------------------------------------------------------------------
266
// Alpha detection
267
268
0
static int HasAlpha8b_SSE2(const uint8_t* src, int length) {
269
0
  const __m128i all_0xff = _mm_set1_epi8((char)0xff);
270
0
  int i = 0;
271
0
  for (; i + 16 <= length; i += 16) {
272
0
    const __m128i v = _mm_loadu_si128((const __m128i*)(src + i));
273
0
    const __m128i bits = _mm_cmpeq_epi8(v, all_0xff);
274
0
    const int mask = _mm_movemask_epi8(bits);
275
0
    if (mask != 0xffff) return 1;
276
0
  }
277
0
  for (; i < length; ++i) {
278
0
    if (src[i] != 0xff) return 1;
279
0
  }
280
0
  return 0;
281
0
}
282
283
0
static int HasAlpha32b_SSE2(const uint8_t* src, int length) {
284
0
  const __m128i alpha_mask = _mm_set1_epi32(0xff);
285
0
  const __m128i all_0xff = _mm_set1_epi8((char)0xff);
286
0
  int i = 0;
287
  // We don't know if we can access the last 3 bytes after the last alpha
288
  // value 'src[4 * length - 4]' (because we don't know if alpha is the first
289
  // or the last byte of the quadruplet). Hence the '-3' protection below.
290
0
  length = length * 4 - 3;  // size in bytes
291
0
  for (; i + 64 <= length; i += 64) {
292
0
    const __m128i a0 = _mm_loadu_si128((const __m128i*)(src + i + 0));
293
0
    const __m128i a1 = _mm_loadu_si128((const __m128i*)(src + i + 16));
294
0
    const __m128i a2 = _mm_loadu_si128((const __m128i*)(src + i + 32));
295
0
    const __m128i a3 = _mm_loadu_si128((const __m128i*)(src + i + 48));
296
0
    const __m128i b0 = _mm_and_si128(a0, alpha_mask);
297
0
    const __m128i b1 = _mm_and_si128(a1, alpha_mask);
298
0
    const __m128i b2 = _mm_and_si128(a2, alpha_mask);
299
0
    const __m128i b3 = _mm_and_si128(a3, alpha_mask);
300
0
    const __m128i c0 = _mm_packs_epi32(b0, b1);
301
0
    const __m128i c1 = _mm_packs_epi32(b2, b3);
302
0
    const __m128i d = _mm_packus_epi16(c0, c1);
303
0
    const __m128i bits = _mm_cmpeq_epi8(d, all_0xff);
304
0
    const int mask = _mm_movemask_epi8(bits);
305
0
    if (mask != 0xffff) return 1;
306
0
  }
307
0
  for (; i + 32 <= length; i += 32) {
308
0
    const __m128i a0 = _mm_loadu_si128((const __m128i*)(src + i + 0));
309
0
    const __m128i a1 = _mm_loadu_si128((const __m128i*)(src + i + 16));
310
0
    const __m128i b0 = _mm_and_si128(a0, alpha_mask);
311
0
    const __m128i b1 = _mm_and_si128(a1, alpha_mask);
312
0
    const __m128i c = _mm_packs_epi32(b0, b1);
313
0
    const __m128i d = _mm_packus_epi16(c, c);
314
0
    const __m128i bits = _mm_cmpeq_epi8(d, all_0xff);
315
0
    const int mask = _mm_movemask_epi8(bits);
316
0
    if (mask != 0xffff) return 1;
317
0
  }
318
0
  for (; i <= length; i += 4) {
319
0
    if (src[i] != 0xff) return 1;
320
0
  }
321
0
  return 0;
322
0
}
323
324
0
static void AlphaReplace_SSE2(uint32_t* src, int length, uint32_t color) {
325
0
  const __m128i m_color = _mm_set1_epi32((int)color);
326
0
  const __m128i zero = _mm_setzero_si128();
327
0
  int i = 0;
328
0
  for (; i + 8 <= length; i += 8) {
329
0
    const __m128i a0 = _mm_loadu_si128((const __m128i*)(src + i + 0));
330
0
    const __m128i a1 = _mm_loadu_si128((const __m128i*)(src + i + 4));
331
0
    const __m128i b0 = _mm_srai_epi32(a0, 24);
332
0
    const __m128i b1 = _mm_srai_epi32(a1, 24);
333
0
    const __m128i c0 = _mm_cmpeq_epi32(b0, zero);
334
0
    const __m128i c1 = _mm_cmpeq_epi32(b1, zero);
335
0
    const __m128i d0 = _mm_and_si128(c0, m_color);
336
0
    const __m128i d1 = _mm_and_si128(c1, m_color);
337
0
    const __m128i e0 = _mm_andnot_si128(c0, a0);
338
0
    const __m128i e1 = _mm_andnot_si128(c1, a1);
339
0
    _mm_storeu_si128((__m128i*)(src + i + 0), _mm_or_si128(d0, e0));
340
0
    _mm_storeu_si128((__m128i*)(src + i + 4), _mm_or_si128(d1, e1));
341
0
  }
342
0
  for (; i < length; ++i) {
343
0
    if ((src[i] >> 24) == 0) src[i] = color;
344
0
  }
345
0
}
346
347
// -----------------------------------------------------------------------------
348
// Apply alpha value to rows
349
350
0
static void MultARGBRow_SSE2(uint32_t* const ptr, int width, int inverse) {
351
0
  int x = 0;
352
0
  if (!inverse) {
353
0
    const int kSpan = 2;
354
0
    const __m128i zero = _mm_setzero_si128();
355
0
    const __m128i k128 = _mm_set1_epi16(128);
356
0
    const __m128i kMult = _mm_set1_epi16(0x0101);
357
0
    const __m128i kMask = _mm_set_epi16(0, 0xff, 0, 0, 0, 0xff, 0, 0);
358
0
    for (x = 0; x + kSpan <= width; x += kSpan) {
359
      // To compute 'result = (int)(a * x / 255. + .5)', we use:
360
      //   tmp = a * v + 128, result = (tmp * 0x0101u) >> 16
361
0
      const __m128i A0 = _mm_loadl_epi64((const __m128i*)&ptr[x]);
362
0
      const __m128i A1 = _mm_unpacklo_epi8(A0, zero);
363
0
      const __m128i A2 = _mm_or_si128(A1, kMask);
364
0
      const __m128i A3 = _mm_shufflelo_epi16(A2, _MM_SHUFFLE(2, 3, 3, 3));
365
0
      const __m128i A4 = _mm_shufflehi_epi16(A3, _MM_SHUFFLE(2, 3, 3, 3));
366
      // here, A4 = [ff a0 a0 a0][ff a1 a1 a1]
367
0
      const __m128i A5 = _mm_mullo_epi16(A4, A1);
368
0
      const __m128i A6 = _mm_add_epi16(A5, k128);
369
0
      const __m128i A7 = _mm_mulhi_epu16(A6, kMult);
370
0
      const __m128i A10 = _mm_packus_epi16(A7, zero);
371
0
      _mm_storel_epi64((__m128i*)&ptr[x], A10);
372
0
    }
373
0
  }
374
0
  width -= x;
375
0
  if (width > 0) WebPMultARGBRow_C(ptr + x, width, inverse);
376
0
}
377
378
static void MultRow_SSE2(uint8_t* WEBP_RESTRICT const ptr,
379
                         const uint8_t* WEBP_RESTRICT const alpha, int width,
380
0
                         int inverse) {
381
0
  int x = 0;
382
0
  if (!inverse) {
383
0
    const __m128i zero = _mm_setzero_si128();
384
0
    const __m128i k128 = _mm_set1_epi16(128);
385
0
    const __m128i kMult = _mm_set1_epi16(0x0101);
386
0
    for (x = 0; x + 8 <= width; x += 8) {
387
0
      const __m128i v0 = _mm_loadl_epi64((__m128i*)&ptr[x]);
388
0
      const __m128i a0 = _mm_loadl_epi64((const __m128i*)&alpha[x]);
389
0
      const __m128i v1 = _mm_unpacklo_epi8(v0, zero);
390
0
      const __m128i a1 = _mm_unpacklo_epi8(a0, zero);
391
0
      const __m128i v2 = _mm_mullo_epi16(v1, a1);
392
0
      const __m128i v3 = _mm_add_epi16(v2, k128);
393
0
      const __m128i v4 = _mm_mulhi_epu16(v3, kMult);
394
0
      const __m128i v5 = _mm_packus_epi16(v4, zero);
395
0
      _mm_storel_epi64((__m128i*)&ptr[x], v5);
396
0
    }
397
0
  }
398
0
  width -= x;
399
0
  if (width > 0) WebPMultRow_C(ptr + x, alpha + x, width, inverse);
400
0
}
401
402
//------------------------------------------------------------------------------
403
// Entry point
404
405
extern void WebPInitAlphaProcessingSSE2(void);
406
407
1
WEBP_TSAN_IGNORE_FUNCTION void WebPInitAlphaProcessingSSE2(void) {
408
1
  WebPMultARGBRow = MultARGBRow_SSE2;
409
1
  WebPMultRow = MultRow_SSE2;
410
1
  WebPApplyAlphaMultiply = ApplyAlphaMultiply_SSE2;
411
1
  WebPDispatchAlpha = DispatchAlpha_SSE2;
412
1
  WebPDispatchAlphaToGreen = DispatchAlphaToGreen_SSE2;
413
1
  WebPExtractAlpha = ExtractAlpha_SSE2;
414
1
  WebPExtractGreen = ExtractGreen_SSE2;
415
416
1
  WebPHasAlpha8b = HasAlpha8b_SSE2;
417
1
  WebPHasAlpha32b = HasAlpha32b_SSE2;
418
1
  WebPAlphaReplace = AlphaReplace_SSE2;
419
1
}
420
421
#else  // !WEBP_USE_SSE2
422
423
WEBP_DSP_INIT_STUB(WebPInitAlphaProcessingSSE2)
424
425
#endif  // WEBP_USE_SSE2