Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / libyuv / include / libyuv / row.h
1 /*
2  *  Copyright 2011 The LibYuv Project Authors. All rights reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS. All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10
11 #ifndef INCLUDE_LIBYUV_ROW_H_  // NOLINT
12 #define INCLUDE_LIBYUV_ROW_H_
13
14 #include <stdlib.h>  // For malloc.
15
16 #include "libyuv/basic_types.h"
17
18 #ifdef __cplusplus
19 namespace libyuv {
20 extern "C" {
21 #endif
22
23 #define IS_ALIGNED(p, a) (!((uintptr_t)(p) & ((a) - 1)))
24
25 #ifdef __cplusplus
26 #define align_buffer_64(var, size)                                             \
27   uint8* var##_mem = reinterpret_cast<uint8*>(malloc((size) + 63));            \
28   uint8* var = reinterpret_cast<uint8*>                                        \
29       ((reinterpret_cast<intptr_t>(var##_mem) + 63) & ~63)
30 #else
31 #define align_buffer_64(var, size)                                             \
32   uint8* var##_mem = (uint8*)(malloc((size) + 63));               /* NOLINT */ \
33   uint8* var = (uint8*)(((intptr_t)(var##_mem) + 63) & ~63)       /* NOLINT */
34 #endif
35
36 #define free_aligned_buffer_64(var) \
37   free(var##_mem);  \
38   var = 0
39
40 #if defined(__pnacl__) || defined(__CLR_VER) || defined(COVERAGE_ENABLED) || \
41     defined(TARGET_IPHONE_SIMULATOR) || \
42     (defined(_MSC_VER) && defined(__clang__))
43 #define LIBYUV_DISABLE_X86
44 #endif
45 // True if compiling for SSSE3 as a requirement.
46 #if defined(__SSSE3__) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 3))
47 #define LIBYUV_SSSE3_ONLY
48 #endif
49
50 // clang >= 3.5.0 required for Arm64.
51 #if defined(__clang__) && defined(__aarch64__) && !defined(LIBYUV_DISABLE_NEON)
52 #if (__clang_major__ < 3) || (__clang_major__ == 3 && (__clang_minor__ < 5))
53 #define LIBYUV_DISABLE_NEON
54 #endif  // clang >= 3.5
55 #endif  // __clang__
56
57 // The following are available on all x86 platforms:
58 #if !defined(LIBYUV_DISABLE_X86) && \
59     (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__))
60 // Effects:
61 #define HAS_ARGBADDROW_SSE2
62 #define HAS_ARGBAFFINEROW_SSE2
63 #define HAS_ARGBATTENUATEROW_SSSE3
64 #define HAS_ARGBBLENDROW_SSSE3
65 #define HAS_ARGBCOLORMATRIXROW_SSSE3
66 #define HAS_ARGBCOLORTABLEROW_X86
67 #define HAS_ARGBCOPYALPHAROW_SSE2
68 #define HAS_ARGBCOPYYTOALPHAROW_SSE2
69 #define HAS_ARGBGRAYROW_SSSE3
70 #define HAS_ARGBLUMACOLORTABLEROW_SSSE3
71 #define HAS_ARGBMIRRORROW_SSSE3
72 #define HAS_ARGBMULTIPLYROW_SSE2
73 #define HAS_ARGBPOLYNOMIALROW_SSE2
74 #define HAS_ARGBQUANTIZEROW_SSE2
75 #define HAS_ARGBSEPIAROW_SSSE3
76 #define HAS_ARGBSHADEROW_SSE2
77 #define HAS_ARGBSUBTRACTROW_SSE2
78 #define HAS_ARGBUNATTENUATEROW_SSE2
79 #define HAS_COMPUTECUMULATIVESUMROW_SSE2
80 #define HAS_CUMULATIVESUMTOAVERAGEROW_SSE2
81 #define HAS_INTERPOLATEROW_SSE2
82 #define HAS_INTERPOLATEROW_SSSE3
83 #define HAS_RGBCOLORTABLEROW_X86
84 #define HAS_SOBELROW_SSE2
85 #define HAS_SOBELTOPLANEROW_SSE2
86 #define HAS_SOBELXROW_SSE2
87 #define HAS_SOBELXYROW_SSE2
88 #define HAS_SOBELYROW_SSE2
89
90 // Conversions:
91 #define HAS_ARGBTOUVROW_SSSE3
92 #define HAS_ABGRTOUVROW_SSSE3
93 #define HAS_ABGRTOYROW_SSSE3
94 #define HAS_ARGB1555TOARGBROW_SSE2
95 #define HAS_ARGB4444TOARGBROW_SSE2
96 #define HAS_ARGBSHUFFLEROW_SSE2
97 #define HAS_ARGBSHUFFLEROW_SSSE3
98 #define HAS_ARGBTOARGB1555ROW_SSE2
99 #define HAS_ARGBTOARGB4444ROW_SSE2
100 #define HAS_ARGBTOBAYERGGROW_SSE2
101 #define HAS_ARGBTOBAYERROW_SSSE3
102 #define HAS_ARGBTORAWROW_SSSE3
103 #define HAS_ARGBTORGB24ROW_SSSE3
104 #define HAS_ARGBTORGB565ROW_SSE2
105 #define HAS_ARGBTOUV422ROW_SSSE3
106 #define HAS_ARGBTOUV444ROW_SSSE3
107 #define HAS_ARGBTOUVJROW_SSSE3
108 #define HAS_ARGBTOYJROW_SSSE3
109 #define HAS_ARGBTOYROW_SSSE3
110 #define HAS_BGRATOUVROW_SSSE3
111 #define HAS_BGRATOYROW_SSSE3
112 #define HAS_COPYROW_ERMS
113 #define HAS_COPYROW_SSE2
114 #define HAS_COPYROW_X86
115 #define HAS_I400TOARGBROW_SSE2
116 #define HAS_I411TOARGBROW_SSSE3
117 #define HAS_I422TOARGB1555ROW_SSSE3
118 #define HAS_I422TOABGRROW_SSSE3
119 #define HAS_I422TOARGB1555ROW_SSSE3
120 #define HAS_I422TOARGB4444ROW_SSSE3
121 #define HAS_I422TOARGBROW_SSSE3
122 #define HAS_I422TOBGRAROW_SSSE3
123 #define HAS_I422TORAWROW_SSSE3
124 #define HAS_I422TORGB24ROW_SSSE3
125 #define HAS_I422TORGB565ROW_SSSE3
126 #define HAS_I422TORGBAROW_SSSE3
127 #define HAS_I422TOUYVYROW_SSE2
128 #define HAS_I422TOYUY2ROW_SSE2
129 #define HAS_I444TOARGBROW_SSSE3
130 #define HAS_MERGEUVROW_SSE2
131 #define HAS_MIRRORROW_SSE2
132 #define HAS_MIRRORROW_SSSE3
133 #define HAS_MIRRORROW_UV_SSSE3
134 #define HAS_MIRRORUVROW_SSSE3
135 #define HAS_NV12TOARGBROW_SSSE3
136 #define HAS_NV12TORGB565ROW_SSSE3
137 #define HAS_NV21TOARGBROW_SSSE3
138 #define HAS_NV21TORGB565ROW_SSSE3
139 #define HAS_RAWTOARGBROW_SSSE3
140 #define HAS_RAWTOYROW_SSSE3
141 #define HAS_RGB24TOARGBROW_SSSE3
142 #define HAS_RGB24TOYROW_SSSE3
143 #define HAS_RGB565TOARGBROW_SSE2
144 #define HAS_RGBATOUVROW_SSSE3
145 #define HAS_RGBATOYROW_SSSE3
146 #define HAS_SETROW_X86
147 #define HAS_SPLITUVROW_SSE2
148 #define HAS_UYVYTOARGBROW_SSSE3
149 #define HAS_UYVYTOUV422ROW_SSE2
150 #define HAS_UYVYTOUVROW_SSE2
151 #define HAS_UYVYTOYROW_SSE2
152 #define HAS_YTOARGBROW_SSE2
153 #define HAS_YUY2TOARGBROW_SSSE3
154 #define HAS_YUY2TOUV422ROW_SSE2
155 #define HAS_YUY2TOUVROW_SSE2
156 #define HAS_YUY2TOYROW_SSE2
157 #endif
158
159 // The following are available on x64 Visual C:
160 #if !defined(LIBYUV_DISABLE_X86) && defined (_M_X64)
161 #define HAS_I422TOARGBROW_SSSE3
162 #endif
163
164 // GCC >= 4.7.0 required for AVX2.
165 #if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
166 #if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 7))
167 #define GCC_HAS_AVX2 1
168 #endif  // GNUC >= 4.7
169 #endif  // __GNUC__
170
171 // clang >= 3.4.0 required for AVX2.
172 #if defined(__clang__) && (defined(__x86_64__) || defined(__i386__))
173 #if (__clang_major__ > 3) || (__clang_major__ == 3 && (__clang_minor__ >= 4))
174 #define CLANG_HAS_AVX2 1
175 #endif  // clang >= 3.4
176 #endif  // __clang__
177
178 // Visual C 2012 required for AVX2.
179 #if defined(_M_IX86) && defined(_MSC_VER) && _MSC_VER >= 1700
180 #define VISUALC_HAS_AVX2 1
181 #endif  // VisualStudio >= 2012
182
183 // The following are available on all x86 platforms, but
184 // require VS2012, clang 3.4 or gcc 4.7.
185 // The code supports NaCL but requires a new compiler and validator.
186 #if !defined(LIBYUV_DISABLE_X86) && (defined(VISUALC_HAS_AVX2) || \
187     defined(CLANG_HAS_AVX2) || defined(GCC_HAS_AVX2))
188 // Effects:
189 #define HAS_COPYROW_AVX
190 #define HAS_ARGBPOLYNOMIALROW_AVX2
191 #define HAS_ARGBSHUFFLEROW_AVX2
192 #define HAS_ARGBCOPYALPHAROW_AVX2
193 #define HAS_ARGBCOPYYTOALPHAROW_AVX2
194 #endif
195
196 // The following are require VS2012.
197 // TODO(fbarchard): Port to gcc.
198 #if !defined(LIBYUV_DISABLE_X86) && defined(VISUALC_HAS_AVX2)
199 #define HAS_ARGBTOUVROW_AVX2
200 #define HAS_ARGBTOYJROW_AVX2
201 #define HAS_ARGBTOYROW_AVX2
202 #define HAS_I422TOARGBROW_AVX2
203 #define HAS_I422TOBGRAROW_AVX2
204 #define HAS_INTERPOLATEROW_AVX2
205 #define HAS_MERGEUVROW_AVX2
206 #define HAS_MIRRORROW_AVX2
207 #define HAS_SPLITUVROW_AVX2
208 #define HAS_UYVYTOUV422ROW_AVX2
209 #define HAS_UYVYTOUVROW_AVX2
210 #define HAS_UYVYTOYROW_AVX2
211 #define HAS_YUY2TOUV422ROW_AVX2
212 #define HAS_YUY2TOUVROW_AVX2
213 #define HAS_YUY2TOYROW_AVX2
214
215 // Effects:
216 #define HAS_ARGBADDROW_AVX2
217 #define HAS_ARGBATTENUATEROW_AVX2
218 #define HAS_ARGBMIRRORROW_AVX2
219 #define HAS_ARGBMULTIPLYROW_AVX2
220 #define HAS_ARGBSUBTRACTROW_AVX2
221 #define HAS_ARGBUNATTENUATEROW_AVX2
222 #endif  // defined(VISUALC_HAS_AVX2)
223
224 // The following are Yasm x86 only:
225 // TODO(fbarchard): Port AVX2 to inline.
226 #if !defined(LIBYUV_DISABLE_X86) && defined(HAVE_YASM)
227     (defined(_M_IX86) || defined(_M_X64) || \
228     defined(__x86_64__) || defined(__i386__))
229 #define HAS_MERGEUVROW_AVX2
230 #define HAS_MERGEUVROW_MMX
231 #define HAS_SPLITUVROW_AVX2
232 #define HAS_SPLITUVROW_MMX
233 #define HAS_UYVYTOYROW_AVX2
234 #define HAS_UYVYTOYROW_MMX
235 #define HAS_YUY2TOYROW_AVX2
236 #define HAS_YUY2TOYROW_MMX
237 #endif
238
239 // The following are disabled when SSSE3 is available:
240 #if !defined(LIBYUV_DISABLE_X86) && \
241     (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) && \
242     !defined(LIBYUV_SSSE3_ONLY)
243 #define HAS_ARGBBLENDROW_SSE2
244 #define HAS_ARGBATTENUATEROW_SSE2
245 #define HAS_MIRRORROW_SSE2
246 #endif
247
248 // The following are available on arm64 platforms:
249 #if !defined(LIBYUV_DISABLE_NEON) && defined(__aarch64__)
250 #define HAS_I444TOARGBROW_NEON
251 #define HAS_I422TOARGBROW_NEON
252 #define HAS_I411TOARGBROW_NEON
253 #define HAS_I422TOBGRAROW_NEON
254 #define HAS_I422TOABGRROW_NEON
255 #define HAS_I422TORGBAROW_NEON
256 #define HAS_I422TORGB24ROW_NEON
257 #define HAS_I422TORAWROW_NEON
258 #define HAS_I422TORGB565ROW_NEON
259 #define HAS_I422TOARGB1555ROW_NEON
260 #define HAS_I422TOARGB4444ROW_NEON
261 #define HAS_YTOARGBROW_NEON
262 #define HAS_I400TOARGBROW_NEON
263 #define HAS_NV12TOARGBROW_NEON
264 #define HAS_NV21TOARGBROW_NEON
265 #define HAS_NV12TORGB565ROW_NEON
266 #define HAS_NV21TORGB565ROW_NEON
267 #define HAS_YUY2TOARGBROW_NEON
268 #define HAS_UYVYTOARGBROW_NEON
269 #define HAS_SPLITUVROW_NEON
270 #define HAS_MERGEUVROW_NEON
271 #define HAS_COPYROW_NEON
272 #define HAS_SETROW_NEON
273 #define HAS_ARGBSETROWS_NEON
274 #define HAS_MIRRORROW_NEON
275 #define HAS_MIRRORUVROW_NEON
276 #define HAS_ARGBMIRRORROW_NEON
277 #define HAS_RGB24TOARGBROW_NEON
278 #define HAS_RAWTOARGBROW_NEON
279 #define HAS_RGB565TOARGBROW_NEON
280 #define HAS_ARGB1555TOARGBROW_NEON
281 #define HAS_ARGB4444TOARGBROW_NEON
282 #define HAS_ARGBTORGB24ROW_NEON
283 #define HAS_ARGBTORAWROW_NEON
284 #define HAS_YUY2TOYROW_NEON
285 #define HAS_UYVYTOYROW_NEON
286 #define HAS_YUY2TOUV422ROW_NEON
287 #define HAS_UYVYTOUV422ROW_NEON
288 #define HAS_YUY2TOUVROW_NEON
289 #define HAS_UYVYTOUVROW_NEON
290 #define HAS_ARGBTOBAYERROW_NEON
291 #define HAS_ARGBTOBAYERGGROW_NEON
292 #define HAS_ARGBSHUFFLEROW_NEON
293 #define HAS_I422TOYUY2ROW_NEON
294 #define HAS_I422TOUYVYROW_NEON
295 #define HAS_ARGBTORGB565ROW_NEON
296 #define HAS_ARGBTOARGB1555ROW_NEON
297 #define HAS_ARGBTOARGB4444ROW_NEON
298 #define HAS_ARGBTOYROW_NEON
299 #define HAS_ARGBTOYJROW_NEON
300 #define HAS_ARGBTOUV444ROW_NEON
301 #define HAS_ARGBTOUV422ROW_NEON
302 #define HAS_ARGBTOUV411ROW_NEON
303 #define HAS_ARGBTOUVROW_NEON
304 #define HAS_ARGBTOUVJROW_NEON
305 #define HAS_BGRATOUVROW_NEON
306 #define HAS_ABGRTOUVROW_NEON
307 #define HAS_RGBATOUVROW_NEON
308 #define HAS_RGB24TOUVROW_NEON
309 #define HAS_RAWTOUVROW_NEON
310 #define HAS_RGB565TOUVROW_NEON
311 #define HAS_ARGB1555TOUVROW_NEON
312 #define HAS_ARGB4444TOUVROW_NEON
313 #define HAS_RGB565TOYROW_NEON
314 #define HAS_ARGB1555TOYROW_NEON
315 #define HAS_ARGB4444TOYROW_NEON
316 #define HAS_BGRATOYROW_NEON
317 #define HAS_ABGRTOYROW_NEON
318 #define HAS_RGBATOYROW_NEON
319 #define HAS_RGB24TOYROW_NEON
320 #define HAS_RAWTOYROW_NEON
321 #define HAS_INTERPOLATEROW_NEON
322 #define HAS_ARGBBLENDROW_NEON
323 #define HAS_ARGBATTENUATEROW_NEON
324 #define HAS_ARGBQUANTIZEROW_NEON
325 #define HAS_ARGBSHADEROW_NEON
326 #define HAS_ARGBGRAYROW_NEON
327 #define HAS_ARGBSEPIAROW_NEON
328 #define HAS_ARGBCOLORMATRIXROW_NEON
329 #define HAS_ARGBMULTIPLYROW_NEON
330 #define HAS_ARGBADDROW_NEON
331 #define HAS_ARGBSUBTRACTROW_NEON
332 #define HAS_SOBELROW_NEON
333 #define HAS_SOBELTOPLANEROW_NEON
334 #define HAS_SOBELXYROW_NEON
335 #define HAS_SOBELXROW_NEON
336 #define HAS_SOBELYROW_NEON
337 #endif
338
339 // The following are available on Neon platforms:
340 #if !defined(LIBYUV_DISABLE_NEON) && !defined(__aarch64__) && \
341     (defined(__ARM_NEON__) || defined(LIBYUV_NEON))
342 #define HAS_ABGRTOUVROW_NEON
343 #define HAS_ABGRTOYROW_NEON
344 #define HAS_ARGB1555TOARGBROW_NEON
345 #define HAS_ARGB1555TOUVROW_NEON
346 #define HAS_ARGB1555TOYROW_NEON
347 #define HAS_ARGB4444TOARGBROW_NEON
348 #define HAS_ARGB4444TOUVROW_NEON
349 #define HAS_ARGB4444TOYROW_NEON
350 #define HAS_ARGBTOARGB1555ROW_NEON
351 #define HAS_ARGBTOARGB4444ROW_NEON
352 #define HAS_ARGBTOBAYERROW_NEON
353 #define HAS_ARGBTOBAYERGGROW_NEON
354 #define HAS_ARGBTORAWROW_NEON
355 #define HAS_ARGBTORGB24ROW_NEON
356 #define HAS_ARGBTORGB565ROW_NEON
357 #define HAS_ARGBTOUV411ROW_NEON
358 #define HAS_ARGBTOUV422ROW_NEON
359 #define HAS_ARGBTOUV444ROW_NEON
360 #define HAS_ARGBTOUVROW_NEON
361 #define HAS_ARGBTOUVJROW_NEON
362 #define HAS_ARGBTOYROW_NEON
363 #define HAS_ARGBTOYJROW_NEON
364 #define HAS_BGRATOUVROW_NEON
365 #define HAS_BGRATOYROW_NEON
366 #define HAS_COPYROW_NEON
367 #define HAS_I400TOARGBROW_NEON
368 #define HAS_I411TOARGBROW_NEON
369 #define HAS_I422TOABGRROW_NEON
370 #define HAS_I422TOARGB1555ROW_NEON
371 #define HAS_I422TOARGB4444ROW_NEON
372 #define HAS_I422TOARGBROW_NEON
373 #define HAS_I422TOBGRAROW_NEON
374 #define HAS_I422TORAWROW_NEON
375 #define HAS_I422TORGB24ROW_NEON
376 #define HAS_I422TORGB565ROW_NEON
377 #define HAS_I422TORGBAROW_NEON
378 #define HAS_I422TOUYVYROW_NEON
379 #define HAS_I422TOYUY2ROW_NEON
380 #define HAS_I444TOARGBROW_NEON
381 #define HAS_MERGEUVROW_NEON
382 #define HAS_MIRRORROW_NEON
383 #define HAS_MIRRORUVROW_NEON
384 #define HAS_NV12TOARGBROW_NEON
385 #define HAS_NV12TORGB565ROW_NEON
386 #define HAS_NV21TOARGBROW_NEON
387 #define HAS_NV21TORGB565ROW_NEON
388 #define HAS_RAWTOARGBROW_NEON
389 #define HAS_RAWTOUVROW_NEON
390 #define HAS_RAWTOYROW_NEON
391 #define HAS_RGB24TOARGBROW_NEON
392 #define HAS_RGB24TOUVROW_NEON
393 #define HAS_RGB24TOYROW_NEON
394 #define HAS_RGB565TOARGBROW_NEON
395 #define HAS_RGB565TOUVROW_NEON
396 #define HAS_RGB565TOYROW_NEON
397 #define HAS_RGBATOUVROW_NEON
398 #define HAS_RGBATOYROW_NEON
399 #define HAS_SETROW_NEON
400 #define HAS_SPLITUVROW_NEON
401 #define HAS_UYVYTOARGBROW_NEON
402 #define HAS_UYVYTOUV422ROW_NEON
403 #define HAS_UYVYTOUVROW_NEON
404 #define HAS_UYVYTOYROW_NEON
405 #define HAS_YTOARGBROW_NEON
406 #define HAS_YUY2TOARGBROW_NEON
407 #define HAS_YUY2TOUV422ROW_NEON
408 #define HAS_YUY2TOUVROW_NEON
409 #define HAS_YUY2TOYROW_NEON
410
411 // Effects:
412 #define HAS_ARGBADDROW_NEON
413 #define HAS_ARGBATTENUATEROW_NEON
414 #define HAS_ARGBBLENDROW_NEON
415 #define HAS_ARGBGRAYROW_NEON
416 #define HAS_ARGBMIRRORROW_NEON
417 #define HAS_ARGBMULTIPLYROW_NEON
418 #define HAS_ARGBQUANTIZEROW_NEON
419 #define HAS_ARGBSEPIAROW_NEON
420 #define HAS_ARGBSHADEROW_NEON
421 #define HAS_ARGBSUBTRACTROW_NEON
422 #define HAS_SOBELROW_NEON
423 #define HAS_SOBELTOPLANEROW_NEON
424 #define HAS_SOBELXYROW_NEON
425 #define HAS_SOBELXROW_NEON
426 #define HAS_SOBELYROW_NEON
427 #define HAS_INTERPOLATEROW_NEON
428 // TODO(fbarchard): Investigate neon unittest failure.
429 // #define HAS_ARGBCOLORMATRIXROW_NEON
430 #endif
431
432 // The following are available on Mips platforms:
433 #if !defined(LIBYUV_DISABLE_MIPS) && defined(__mips__) && \
434     (_MIPS_SIM == _MIPS_SIM_ABI32) && (__mips_isa_rev < 6)
435 #define HAS_COPYROW_MIPS
436 #if defined(__mips_dsp) && (__mips_dsp_rev >= 2)
437 #define HAS_I422TOABGRROW_MIPS_DSPR2
438 #define HAS_I422TOARGBROW_MIPS_DSPR2
439 #define HAS_I422TOBGRAROW_MIPS_DSPR2
440 #define HAS_INTERPOLATEROWS_MIPS_DSPR2
441 #define HAS_MIRRORROW_MIPS_DSPR2
442 #define HAS_MIRRORUVROW_MIPS_DSPR2
443 #define HAS_SPLITUVROW_MIPS_DSPR2
444 #endif
445 #endif
446
447 #if defined(_MSC_VER) && !defined(__CLR_VER)
448 #define SIMD_ALIGNED(var) __declspec(align(16)) var
449 typedef __declspec(align(16)) int16 vec16[8];
450 typedef __declspec(align(16)) int32 vec32[4];
451 typedef __declspec(align(16)) int8 vec8[16];
452 typedef __declspec(align(16)) uint16 uvec16[8];
453 typedef __declspec(align(16)) uint32 uvec32[4];
454 typedef __declspec(align(16)) uint8 uvec8[16];
455 typedef __declspec(align(32)) int16 lvec16[16];
456 typedef __declspec(align(32)) int32 lvec32[8];
457 typedef __declspec(align(32)) int8 lvec8[32];
458 typedef __declspec(align(32)) uint16 ulvec16[16];
459 typedef __declspec(align(32)) uint32 ulvec32[8];
460 typedef __declspec(align(32)) uint8 ulvec8[32];
461
462 #elif defined(__GNUC__)
463 // Caveat GCC 4.2 to 4.7 have a known issue using vectors with const.
464 #define SIMD_ALIGNED(var) var __attribute__((aligned(16)))
465 typedef int16 __attribute__((vector_size(16))) vec16;
466 typedef int32 __attribute__((vector_size(16))) vec32;
467 typedef int8 __attribute__((vector_size(16))) vec8;
468 typedef uint16 __attribute__((vector_size(16))) uvec16;
469 typedef uint32 __attribute__((vector_size(16))) uvec32;
470 typedef uint8 __attribute__((vector_size(16))) uvec8;
471 #else
472 #define SIMD_ALIGNED(var) var
473 typedef int16 vec16[8];
474 typedef int32 vec32[4];
475 typedef int8 vec8[16];
476 typedef uint16 uvec16[8];
477 typedef uint32 uvec32[4];
478 typedef uint8 uvec8[16];
479 #endif
480
481 #if defined(__APPLE__) || defined(__x86_64__) || defined(__llvm__)
482 #define OMITFP
483 #else
484 #define OMITFP __attribute__((optimize("omit-frame-pointer")))
485 #endif
486
487 // NaCL macros for GCC x86 and x64.
488 #if defined(__native_client__)
489 #define LABELALIGN ".p2align 5\n"
490 #else
491 #define LABELALIGN ".p2align 2\n"
492 #endif
493 #if defined(__native_client__) && defined(__x86_64__)
494 #define BUNDLELOCK ".bundle_lock\n"
495 #define BUNDLEUNLOCK ".bundle_unlock\n"
496 #define BUNDLEALIGN "\n"
497 #define MEMACCESS(base) "%%nacl:(%%r15,%q" #base ")"
498 #define MEMACCESS2(offset, base) "%%nacl:" #offset "(%%r15,%q" #base ")"
499 #define MEMLEA(offset, base) #offset "(%q" #base ")"
500 #define MEMLEA3(offset, index, scale) \
501     #offset "(,%q" #index "," #scale ")"
502 #define MEMLEA4(offset, base, index, scale) \
503     #offset "(%q" #base ",%q" #index "," #scale ")"
504 #define MEMMOVESTRING(s, d) "%%nacl:(%q" #s "),%%nacl:(%q" #d "), %%r15"
505 #define MEMSTORESTRING(reg, d) "%%" #reg ",%%nacl:(%q" #d "), %%r15"
506 #define MEMOPREG(opcode, offset, base, index, scale, reg) \
507     BUNDLELOCK \
508     "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" \
509     #opcode " (%%r15,%%r14),%%" #reg "\n" \
510     BUNDLEUNLOCK
511 #define MEMOPMEM(opcode, reg, offset, base, index, scale) \
512     BUNDLELOCK \
513     "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" \
514     #opcode " %%" #reg ",(%%r15,%%r14)\n" \
515     BUNDLEUNLOCK
516 #define MEMOPARG(opcode, offset, base, index, scale, arg) \
517     BUNDLELOCK \
518     "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" \
519     #opcode " (%%r15,%%r14),%" #arg "\n" \
520     BUNDLEUNLOCK
521 #else  // defined(__native_client__) && defined(__x86_64__)
522 #define BUNDLEALIGN "\n"
523 #define MEMACCESS(base) "(%" #base ")"
524 #define MEMACCESS2(offset, base) #offset "(%" #base ")"
525 #define MEMLEA(offset, base) #offset "(%" #base ")"
526 #define MEMLEA3(offset, index, scale) \
527     #offset "(,%" #index "," #scale ")"
528 #define MEMLEA4(offset, base, index, scale) \
529     #offset "(%" #base ",%" #index "," #scale ")"
530 #define MEMMOVESTRING(s, d)
531 #define MEMSTORESTRING(reg, d)
532 #define MEMOPREG(opcode, offset, base, index, scale, reg) \
533     #opcode " " #offset "(%" #base ",%" #index "," #scale "),%%" #reg "\n"
534 #define MEMOPMEM(opcode, reg, offset, base, index, scale) \
535     #opcode " %%" #reg ","#offset "(%" #base ",%" #index "," #scale ")\n"
536 #define MEMOPARG(opcode, offset, base, index, scale, arg) \
537     #opcode " " #offset "(%" #base ",%" #index "," #scale "),%" #arg "\n"
538 #endif  // defined(__native_client__) && defined(__x86_64__)
539
540 #if defined(__arm__) || defined(__aarch64__)
541 #undef MEMACCESS
542 #if defined(__native_client__)
543 #define MEMACCESS(base) ".p2align   3\nbic %" #base ", #0xc0000000\n"
544 #else
545 #define MEMACCESS(base) "\n"
546 #endif
547 #endif
548
549 void I444ToARGBRow_NEON(const uint8* src_y,
550                         const uint8* src_u,
551                         const uint8* src_v,
552                         uint8* dst_argb,
553                         int width);
554 void I422ToARGBRow_NEON(const uint8* src_y,
555                         const uint8* src_u,
556                         const uint8* src_v,
557                         uint8* dst_argb,
558                         int width);
559 void I411ToARGBRow_NEON(const uint8* src_y,
560                         const uint8* src_u,
561                         const uint8* src_v,
562                         uint8* dst_argb,
563                         int width);
564 void I422ToBGRARow_NEON(const uint8* src_y,
565                         const uint8* src_u,
566                         const uint8* src_v,
567                         uint8* dst_bgra,
568                         int width);
569 void I422ToABGRRow_NEON(const uint8* src_y,
570                         const uint8* src_u,
571                         const uint8* src_v,
572                         uint8* dst_abgr,
573                         int width);
574 void I422ToRGBARow_NEON(const uint8* src_y,
575                         const uint8* src_u,
576                         const uint8* src_v,
577                         uint8* dst_rgba,
578                         int width);
579 void I422ToRGB24Row_NEON(const uint8* src_y,
580                          const uint8* src_u,
581                          const uint8* src_v,
582                          uint8* dst_rgb24,
583                          int width);
584 void I422ToRAWRow_NEON(const uint8* src_y,
585                        const uint8* src_u,
586                        const uint8* src_v,
587                        uint8* dst_raw,
588                        int width);
589 void I422ToRGB565Row_NEON(const uint8* src_y,
590                           const uint8* src_u,
591                           const uint8* src_v,
592                           uint8* dst_rgb565,
593                           int width);
594 void I422ToARGB1555Row_NEON(const uint8* src_y,
595                             const uint8* src_u,
596                             const uint8* src_v,
597                             uint8* dst_argb1555,
598                             int width);
599 void I422ToARGB4444Row_NEON(const uint8* src_y,
600                             const uint8* src_u,
601                             const uint8* src_v,
602                             uint8* dst_argb4444,
603                             int width);
604 void NV12ToARGBRow_NEON(const uint8* src_y,
605                         const uint8* src_uv,
606                         uint8* dst_argb,
607                         int width);
608 void NV21ToARGBRow_NEON(const uint8* src_y,
609                         const uint8* src_vu,
610                         uint8* dst_argb,
611                         int width);
612 void NV12ToRGB565Row_NEON(const uint8* src_y,
613                           const uint8* src_uv,
614                           uint8* dst_rgb565,
615                           int width);
616 void NV21ToRGB565Row_NEON(const uint8* src_y,
617                           const uint8* src_vu,
618                           uint8* dst_rgb565,
619                           int width);
620 void YUY2ToARGBRow_NEON(const uint8* src_yuy2,
621                         uint8* dst_argb,
622                         int width);
623 void UYVYToARGBRow_NEON(const uint8* src_uyvy,
624                         uint8* dst_argb,
625                         int width);
626
627 void ARGBToYRow_AVX2(const uint8* src_argb, uint8* dst_y, int pix);
628 void ARGBToYRow_Any_AVX2(const uint8* src_argb, uint8* dst_y, int pix);
629 void ARGBToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
630 void ARGBToYJRow_AVX2(const uint8* src_argb, uint8* dst_y, int pix);
631 void ARGBToYJRow_Any_AVX2(const uint8* src_argb, uint8* dst_y, int pix);
632 void ARGBToYJRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
633 void BGRAToYRow_SSSE3(const uint8* src_bgra, uint8* dst_y, int pix);
634 void ABGRToYRow_SSSE3(const uint8* src_abgr, uint8* dst_y, int pix);
635 void RGBAToYRow_SSSE3(const uint8* src_rgba, uint8* dst_y, int pix);
636 void RGB24ToYRow_SSSE3(const uint8* src_rgb24, uint8* dst_y, int pix);
637 void RAWToYRow_SSSE3(const uint8* src_raw, uint8* dst_y, int pix);
638 void ARGBToYRow_NEON(const uint8* src_argb, uint8* dst_y, int pix);
639 void ARGBToYJRow_NEON(const uint8* src_argb, uint8* dst_y, int pix);
640 void ARGBToUV444Row_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
641                          int pix);
642 void ARGBToUV422Row_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
643                          int pix);
644 void ARGBToUV411Row_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
645                          int pix);
646 void ARGBToUVRow_NEON(const uint8* src_argb, int src_stride_argb,
647                       uint8* dst_u, uint8* dst_v, int pix);
648 void ARGBToUVJRow_NEON(const uint8* src_argb, int src_stride_argb,
649                        uint8* dst_u, uint8* dst_v, int pix);
650 void BGRAToUVRow_NEON(const uint8* src_bgra, int src_stride_bgra,
651                       uint8* dst_u, uint8* dst_v, int pix);
652 void ABGRToUVRow_NEON(const uint8* src_abgr, int src_stride_abgr,
653                       uint8* dst_u, uint8* dst_v, int pix);
654 void RGBAToUVRow_NEON(const uint8* src_rgba, int src_stride_rgba,
655                       uint8* dst_u, uint8* dst_v, int pix);
656 void RGB24ToUVRow_NEON(const uint8* src_rgb24, int src_stride_rgb24,
657                        uint8* dst_u, uint8* dst_v, int pix);
658 void RAWToUVRow_NEON(const uint8* src_raw, int src_stride_raw,
659                      uint8* dst_u, uint8* dst_v, int pix);
660 void RGB565ToUVRow_NEON(const uint8* src_rgb565, int src_stride_rgb565,
661                         uint8* dst_u, uint8* dst_v, int pix);
662 void ARGB1555ToUVRow_NEON(const uint8* src_argb1555, int src_stride_argb1555,
663                           uint8* dst_u, uint8* dst_v, int pix);
664 void ARGB4444ToUVRow_NEON(const uint8* src_argb4444, int src_stride_argb4444,
665                           uint8* dst_u, uint8* dst_v, int pix);
666 void BGRAToYRow_NEON(const uint8* src_bgra, uint8* dst_y, int pix);
667 void ABGRToYRow_NEON(const uint8* src_abgr, uint8* dst_y, int pix);
668 void RGBAToYRow_NEON(const uint8* src_rgba, uint8* dst_y, int pix);
669 void RGB24ToYRow_NEON(const uint8* src_rgb24, uint8* dst_y, int pix);
670 void RAWToYRow_NEON(const uint8* src_raw, uint8* dst_y, int pix);
671 void RGB565ToYRow_NEON(const uint8* src_rgb565, uint8* dst_y, int pix);
672 void ARGB1555ToYRow_NEON(const uint8* src_argb1555, uint8* dst_y, int pix);
673 void ARGB4444ToYRow_NEON(const uint8* src_argb4444, uint8* dst_y, int pix);
674 void ARGBToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
675 void ARGBToYJRow_C(const uint8* src_argb, uint8* dst_y, int pix);
676 void BGRAToYRow_C(const uint8* src_bgra, uint8* dst_y, int pix);
677 void ABGRToYRow_C(const uint8* src_abgr, uint8* dst_y, int pix);
678 void RGBAToYRow_C(const uint8* src_rgba, uint8* dst_y, int pix);
679 void RGB24ToYRow_C(const uint8* src_rgb24, uint8* dst_y, int pix);
680 void RAWToYRow_C(const uint8* src_raw, uint8* dst_y, int pix);
681 void RGB565ToYRow_C(const uint8* src_rgb565, uint8* dst_y, int pix);
682 void ARGB1555ToYRow_C(const uint8* src_argb1555, uint8* dst_y, int pix);
683 void ARGB4444ToYRow_C(const uint8* src_argb4444, uint8* dst_y, int pix);
684 void ARGBToYRow_Any_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
685 void ARGBToYJRow_Any_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
686 void BGRAToYRow_Any_SSSE3(const uint8* src_bgra, uint8* dst_y, int pix);
687 void ABGRToYRow_Any_SSSE3(const uint8* src_abgr, uint8* dst_y, int pix);
688 void RGBAToYRow_Any_SSSE3(const uint8* src_rgba, uint8* dst_y, int pix);
689 void RGB24ToYRow_Any_SSSE3(const uint8* src_rgb24, uint8* dst_y, int pix);
690 void RAWToYRow_Any_SSSE3(const uint8* src_raw, uint8* dst_y, int pix);
691 void ARGBToYRow_Any_NEON(const uint8* src_argb, uint8* dst_y, int pix);
692 void ARGBToYJRow_Any_NEON(const uint8* src_argb, uint8* dst_y, int pix);
693 void BGRAToYRow_Any_NEON(const uint8* src_bgra, uint8* dst_y, int pix);
694 void ABGRToYRow_Any_NEON(const uint8* src_abgr, uint8* dst_y, int pix);
695 void RGBAToYRow_Any_NEON(const uint8* src_rgba, uint8* dst_y, int pix);
696 void RGB24ToYRow_Any_NEON(const uint8* src_rgb24, uint8* dst_y, int pix);
697 void RAWToYRow_Any_NEON(const uint8* src_raw, uint8* dst_y, int pix);
698 void RGB565ToYRow_Any_NEON(const uint8* src_rgb565, uint8* dst_y, int pix);
699 void ARGB1555ToYRow_Any_NEON(const uint8* src_argb1555, uint8* dst_y, int pix);
700 void ARGB4444ToYRow_Any_NEON(const uint8* src_argb4444, uint8* dst_y, int pix);
701
702 void ARGBToUVRow_AVX2(const uint8* src_argb, int src_stride_argb,
703                       uint8* dst_u, uint8* dst_v, int width);
704 void ARGBToUVRow_Any_AVX2(const uint8* src_argb, int src_stride_argb,
705                           uint8* dst_u, uint8* dst_v, int width);
706 void ARGBToUVRow_SSSE3(const uint8* src_argb, int src_stride_argb,
707                        uint8* dst_u, uint8* dst_v, int width);
708 void ARGBToUVJRow_SSSE3(const uint8* src_argb, int src_stride_argb,
709                         uint8* dst_u, uint8* dst_v, int width);
710 void BGRAToUVRow_SSSE3(const uint8* src_bgra, int src_stride_bgra,
711                        uint8* dst_u, uint8* dst_v, int width);
712 void ABGRToUVRow_SSSE3(const uint8* src_abgr, int src_stride_abgr,
713                        uint8* dst_u, uint8* dst_v, int width);
714 void RGBAToUVRow_SSSE3(const uint8* src_rgba, int src_stride_rgba,
715                        uint8* dst_u, uint8* dst_v, int width);
716 void ARGBToUVRow_Any_SSSE3(const uint8* src_argb, int src_stride_argb,
717                            uint8* dst_u, uint8* dst_v, int width);
718 void ARGBToUVJRow_Any_SSSE3(const uint8* src_argb, int src_stride_argb,
719                             uint8* dst_u, uint8* dst_v, int width);
720 void BGRAToUVRow_Any_SSSE3(const uint8* src_bgra, int src_stride_bgra,
721                            uint8* dst_u, uint8* dst_v, int width);
722 void ABGRToUVRow_Any_SSSE3(const uint8* src_abgr, int src_stride_abgr,
723                            uint8* dst_u, uint8* dst_v, int width);
724 void RGBAToUVRow_Any_SSSE3(const uint8* src_rgba, int src_stride_rgba,
725                            uint8* dst_u, uint8* dst_v, int width);
726 void ARGBToUV444Row_Any_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
727                              int pix);
728 void ARGBToUV422Row_Any_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
729                              int pix);
730 void ARGBToUV411Row_Any_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
731                              int pix);
732 void ARGBToUVRow_Any_NEON(const uint8* src_argb, int src_stride_argb,
733                           uint8* dst_u, uint8* dst_v, int pix);
734 void ARGBToUVJRow_Any_NEON(const uint8* src_argb, int src_stride_argb,
735                            uint8* dst_u, uint8* dst_v, int pix);
736 void BGRAToUVRow_Any_NEON(const uint8* src_bgra, int src_stride_bgra,
737                           uint8* dst_u, uint8* dst_v, int pix);
738 void ABGRToUVRow_Any_NEON(const uint8* src_abgr, int src_stride_abgr,
739                           uint8* dst_u, uint8* dst_v, int pix);
740 void RGBAToUVRow_Any_NEON(const uint8* src_rgba, int src_stride_rgba,
741                           uint8* dst_u, uint8* dst_v, int pix);
742 void RGB24ToUVRow_Any_NEON(const uint8* src_rgb24, int src_stride_rgb24,
743                            uint8* dst_u, uint8* dst_v, int pix);
744 void RAWToUVRow_Any_NEON(const uint8* src_raw, int src_stride_raw,
745                          uint8* dst_u, uint8* dst_v, int pix);
746 void RGB565ToUVRow_Any_NEON(const uint8* src_rgb565, int src_stride_rgb565,
747                             uint8* dst_u, uint8* dst_v, int pix);
748 void ARGB1555ToUVRow_Any_NEON(const uint8* src_argb1555,
749                               int src_stride_argb1555,
750                               uint8* dst_u, uint8* dst_v, int pix);
751 void ARGB4444ToUVRow_Any_NEON(const uint8* src_argb4444,
752                               int src_stride_argb4444,
753                               uint8* dst_u, uint8* dst_v, int pix);
754 void ARGBToUVRow_C(const uint8* src_argb, int src_stride_argb,
755                    uint8* dst_u, uint8* dst_v, int width);
756 void ARGBToUVJRow_C(const uint8* src_argb, int src_stride_argb,
757                     uint8* dst_u, uint8* dst_v, int width);
758 void BGRAToUVRow_C(const uint8* src_bgra, int src_stride_bgra,
759                    uint8* dst_u, uint8* dst_v, int width);
760 void ABGRToUVRow_C(const uint8* src_abgr, int src_stride_abgr,
761                    uint8* dst_u, uint8* dst_v, int width);
762 void RGBAToUVRow_C(const uint8* src_rgba, int src_stride_rgba,
763                    uint8* dst_u, uint8* dst_v, int width);
764 void RGB24ToUVRow_C(const uint8* src_rgb24, int src_stride_rgb24,
765                     uint8* dst_u, uint8* dst_v, int width);
766 void RAWToUVRow_C(const uint8* src_raw, int src_stride_raw,
767                   uint8* dst_u, uint8* dst_v, int width);
768 void RGB565ToUVRow_C(const uint8* src_rgb565, int src_stride_rgb565,
769                      uint8* dst_u, uint8* dst_v, int width);
770 void ARGB1555ToUVRow_C(const uint8* src_argb1555, int src_stride_argb1555,
771                        uint8* dst_u, uint8* dst_v, int width);
772 void ARGB4444ToUVRow_C(const uint8* src_argb4444, int src_stride_argb4444,
773                        uint8* dst_u, uint8* dst_v, int width);
774
775 void ARGBToUV444Row_SSSE3(const uint8* src_argb,
776                           uint8* dst_u, uint8* dst_v, int width);
777 void ARGBToUV444Row_Any_SSSE3(const uint8* src_argb,
778                               uint8* dst_u, uint8* dst_v, int width);
779
780 void ARGBToUV422Row_SSSE3(const uint8* src_argb,
781                           uint8* dst_u, uint8* dst_v, int width);
782 void ARGBToUV422Row_Any_SSSE3(const uint8* src_argb,
783                               uint8* dst_u, uint8* dst_v, int width);
784
785 void ARGBToUV444Row_C(const uint8* src_argb,
786                       uint8* dst_u, uint8* dst_v, int width);
787 void ARGBToUV422Row_C(const uint8* src_argb,
788                       uint8* dst_u, uint8* dst_v, int width);
789 void ARGBToUV411Row_C(const uint8* src_argb,
790                       uint8* dst_u, uint8* dst_v, int width);
791
792 void MirrorRow_AVX2(const uint8* src, uint8* dst, int width);
793 void MirrorRow_SSSE3(const uint8* src, uint8* dst, int width);
794 void MirrorRow_SSE2(const uint8* src, uint8* dst, int width);
795 void MirrorRow_NEON(const uint8* src, uint8* dst, int width);
796 void MirrorRow_MIPS_DSPR2(const uint8* src, uint8* dst, int width);
797 void MirrorRow_C(const uint8* src, uint8* dst, int width);
798
799 void MirrorUVRow_SSSE3(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
800                        int width);
801 void MirrorUVRow_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
802                       int width);
803 void MirrorUVRow_MIPS_DSPR2(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
804                             int width);
805 void MirrorUVRow_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
806                    int width);
807
808 void ARGBMirrorRow_AVX2(const uint8* src, uint8* dst, int width);
809 void ARGBMirrorRow_SSSE3(const uint8* src, uint8* dst, int width);
810 void ARGBMirrorRow_NEON(const uint8* src, uint8* dst, int width);
811 void ARGBMirrorRow_C(const uint8* src, uint8* dst, int width);
812
813 void SplitUVRow_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
814 void SplitUVRow_SSE2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
815 void SplitUVRow_AVX2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
816 void SplitUVRow_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
817 void SplitUVRow_MIPS_DSPR2(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
818                            int pix);
819 void SplitUVRow_Any_SSE2(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
820                          int pix);
821 void SplitUVRow_Any_AVX2(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
822                          int pix);
823 void SplitUVRow_Any_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
824                          int pix);
825 void SplitUVRow_Any_MIPS_DSPR2(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
826                                int pix);
827
828 void MergeUVRow_C(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
829                   int width);
830 void MergeUVRow_SSE2(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
831                      int width);
832 void MergeUVRow_AVX2(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
833                      int width);
834 void MergeUVRow_NEON(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
835                      int width);
836 void MergeUVRow_Any_SSE2(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
837                          int width);
838 void MergeUVRow_Any_AVX2(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
839                          int width);
840 void MergeUVRow_Any_NEON(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
841                          int width);
842
843 void CopyRow_SSE2(const uint8* src, uint8* dst, int count);
844 void CopyRow_AVX(const uint8* src, uint8* dst, int count);
845 void CopyRow_ERMS(const uint8* src, uint8* dst, int count);
846 void CopyRow_X86(const uint8* src, uint8* dst, int count);
847 void CopyRow_NEON(const uint8* src, uint8* dst, int count);
848 void CopyRow_MIPS(const uint8* src, uint8* dst, int count);
849 void CopyRow_C(const uint8* src, uint8* dst, int count);
850
851 void CopyRow_16_C(const uint16* src, uint16* dst, int count);
852
853 void ARGBCopyAlphaRow_C(const uint8* src_argb, uint8* dst_argb, int width);
854 void ARGBCopyAlphaRow_SSE2(const uint8* src_argb, uint8* dst_argb, int width);
855 void ARGBCopyAlphaRow_AVX2(const uint8* src_argb, uint8* dst_argb, int width);
856
857 void ARGBCopyYToAlphaRow_C(const uint8* src_y, uint8* dst_argb, int width);
858 void ARGBCopyYToAlphaRow_SSE2(const uint8* src_y, uint8* dst_argb, int width);
859 void ARGBCopyYToAlphaRow_AVX2(const uint8* src_y, uint8* dst_argb, int width);
860
861 void SetRow_X86(uint8* dst, uint32 v32, int count);
862 void ARGBSetRows_X86(uint8* dst, uint32 v32, int width,
863                      int dst_stride, int height);
864 void SetRow_NEON(uint8* dst, uint32 v32, int count);
865 void ARGBSetRows_NEON(uint8* dst, uint32 v32, int width,
866                       int dst_stride, int height);
867 void SetRow_C(uint8* dst, uint32 v32, int count);
868 void ARGBSetRows_C(uint8* dst, uint32 v32, int width, int dst_stride,
869                    int height);
870
871 // ARGBShufflers for BGRAToARGB etc.
872 void ARGBShuffleRow_C(const uint8* src_argb, uint8* dst_argb,
873                       const uint8* shuffler, int pix);
874 void ARGBShuffleRow_SSE2(const uint8* src_argb, uint8* dst_argb,
875                          const uint8* shuffler, int pix);
876 void ARGBShuffleRow_SSSE3(const uint8* src_argb, uint8* dst_argb,
877                           const uint8* shuffler, int pix);
878 void ARGBShuffleRow_AVX2(const uint8* src_argb, uint8* dst_argb,
879                          const uint8* shuffler, int pix);
880 void ARGBShuffleRow_NEON(const uint8* src_argb, uint8* dst_argb,
881                          const uint8* shuffler, int pix);
882 void ARGBShuffleRow_Any_SSE2(const uint8* src_argb, uint8* dst_argb,
883                              const uint8* shuffler, int pix);
884 void ARGBShuffleRow_Any_SSSE3(const uint8* src_argb, uint8* dst_argb,
885                               const uint8* shuffler, int pix);
886 void ARGBShuffleRow_Any_AVX2(const uint8* src_argb, uint8* dst_argb,
887                              const uint8* shuffler, int pix);
888 void ARGBShuffleRow_Any_NEON(const uint8* src_argb, uint8* dst_argb,
889                              const uint8* shuffler, int pix);
890
891 void RGB24ToARGBRow_SSSE3(const uint8* src_rgb24, uint8* dst_argb, int pix);
892 void RAWToARGBRow_SSSE3(const uint8* src_raw, uint8* dst_argb, int pix);
893 void RGB565ToARGBRow_SSE2(const uint8* src_rgb565, uint8* dst_argb, int pix);
894 void ARGB1555ToARGBRow_SSE2(const uint8* src_argb1555, uint8* dst_argb,
895                             int pix);
896 void ARGB4444ToARGBRow_SSE2(const uint8* src_argb4444, uint8* dst_argb,
897                             int pix);
898
899 void RGB24ToARGBRow_NEON(const uint8* src_rgb24, uint8* dst_argb, int pix);
900 void RAWToARGBRow_NEON(const uint8* src_raw, uint8* dst_argb, int pix);
901 void RGB565ToARGBRow_NEON(const uint8* src_rgb565, uint8* dst_argb, int pix);
902 void ARGB1555ToARGBRow_NEON(const uint8* src_argb1555, uint8* dst_argb,
903                             int pix);
904 void ARGB4444ToARGBRow_NEON(const uint8* src_argb4444, uint8* dst_argb,
905                             int pix);
906 void RGB24ToARGBRow_C(const uint8* src_rgb24, uint8* dst_argb, int pix);
907 void RAWToARGBRow_C(const uint8* src_raw, uint8* dst_argb, int pix);
908 void RGB565ToARGBRow_C(const uint8* src_rgb, uint8* dst_argb, int pix);
909 void ARGB1555ToARGBRow_C(const uint8* src_argb, uint8* dst_argb, int pix);
910 void ARGB4444ToARGBRow_C(const uint8* src_argb, uint8* dst_argb, int pix);
911 void RGB24ToARGBRow_Any_SSSE3(const uint8* src_rgb24, uint8* dst_argb, int pix);
912 void RAWToARGBRow_Any_SSSE3(const uint8* src_raw, uint8* dst_argb, int pix);
913 void RGB565ToARGBRow_Any_SSE2(const uint8* src_rgb565, uint8* dst_argb,
914                               int pix);
915 void ARGB1555ToARGBRow_Any_SSE2(const uint8* src_argb1555, uint8* dst_argb,
916                                 int pix);
917 void ARGB4444ToARGBRow_Any_SSE2(const uint8* src_argb4444, uint8* dst_argb,
918                                 int pix);
919 void RGB24ToARGBRow_Any_NEON(const uint8* src_rgb24, uint8* dst_argb, int pix);
920 void RAWToARGBRow_Any_NEON(const uint8* src_raw, uint8* dst_argb, int pix);
921 void RGB565ToARGBRow_Any_NEON(const uint8* src_rgb565, uint8* dst_argb,
922                               int pix);
923 void ARGB1555ToARGBRow_Any_NEON(const uint8* src_argb1555, uint8* dst_argb,
924                                 int pix);
925 void ARGB4444ToARGBRow_Any_NEON(const uint8* src_argb4444, uint8* dst_argb,
926                                 int pix);
927
928 void ARGBToRGB24Row_SSSE3(const uint8* src_argb, uint8* dst_rgb, int pix);
929 void ARGBToRAWRow_SSSE3(const uint8* src_argb, uint8* dst_rgb, int pix);
930 void ARGBToRGB565Row_SSE2(const uint8* src_argb, uint8* dst_rgb, int pix);
931 void ARGBToARGB1555Row_SSE2(const uint8* src_argb, uint8* dst_rgb, int pix);
932 void ARGBToARGB4444Row_SSE2(const uint8* src_argb, uint8* dst_rgb, int pix);
933
934 void ARGBToRGB24Row_NEON(const uint8* src_argb, uint8* dst_rgb, int pix);
935 void ARGBToRAWRow_NEON(const uint8* src_argb, uint8* dst_rgb, int pix);
936 void ARGBToRGB565Row_NEON(const uint8* src_argb, uint8* dst_rgb, int pix);
937 void ARGBToARGB1555Row_NEON(const uint8* src_argb, uint8* dst_rgb, int pix);
938 void ARGBToARGB4444Row_NEON(const uint8* src_argb, uint8* dst_rgb, int pix);
939
940 void ARGBToRGBARow_C(const uint8* src_argb, uint8* dst_rgb, int pix);
941 void ARGBToRGB24Row_C(const uint8* src_argb, uint8* dst_rgb, int pix);
942 void ARGBToRAWRow_C(const uint8* src_argb, uint8* dst_rgb, int pix);
943 void ARGBToRGB565Row_C(const uint8* src_argb, uint8* dst_rgb, int pix);
944 void ARGBToARGB1555Row_C(const uint8* src_argb, uint8* dst_rgb, int pix);
945 void ARGBToARGB4444Row_C(const uint8* src_argb, uint8* dst_rgb, int pix);
946
947 void I400ToARGBRow_SSE2(const uint8* src_y, uint8* dst_argb, int pix);
948 void I400ToARGBRow_NEON(const uint8* src_y, uint8* dst_argb, int pix);
949 void I400ToARGBRow_C(const uint8* src_y, uint8* dst_argb, int pix);
950 void I400ToARGBRow_Any_SSE2(const uint8* src_y, uint8* dst_argb, int pix);
951 void I400ToARGBRow_Any_NEON(const uint8* src_y, uint8* dst_argb, int pix);
952
953 void I444ToARGBRow_C(const uint8* src_y,
954                      const uint8* src_u,
955                      const uint8* src_v,
956                      uint8* dst_argb,
957                      int width);
958 void I422ToARGBRow_C(const uint8* src_y,
959                      const uint8* src_u,
960                      const uint8* src_v,
961                      uint8* dst_argb,
962                      int width);
963 void I411ToARGBRow_C(const uint8* src_y,
964                      const uint8* src_u,
965                      const uint8* src_v,
966                      uint8* dst_argb,
967                      int width);
968 void NV12ToARGBRow_C(const uint8* src_y,
969                      const uint8* src_uv,
970                      uint8* dst_argb,
971                      int width);
972 void NV21ToRGB565Row_C(const uint8* src_y,
973                        const uint8* src_vu,
974                        uint8* dst_argb,
975                        int width);
976 void NV12ToRGB565Row_C(const uint8* src_y,
977                        const uint8* src_uv,
978                        uint8* dst_argb,
979                        int width);
980 void NV21ToARGBRow_C(const uint8* src_y,
981                      const uint8* src_vu,
982                      uint8* dst_argb,
983                      int width);
984 void YUY2ToARGBRow_C(const uint8* src_yuy2,
985                      uint8* dst_argb,
986                      int width);
987 void UYVYToARGBRow_C(const uint8* src_uyvy,
988                      uint8* dst_argb,
989                      int width);
990 void I422ToBGRARow_C(const uint8* src_y,
991                      const uint8* src_u,
992                      const uint8* src_v,
993                      uint8* dst_bgra,
994                      int width);
995 void I422ToABGRRow_C(const uint8* src_y,
996                      const uint8* src_u,
997                      const uint8* src_v,
998                      uint8* dst_abgr,
999                      int width);
1000 void I422ToRGBARow_C(const uint8* src_y,
1001                      const uint8* src_u,
1002                      const uint8* src_v,
1003                      uint8* dst_rgba,
1004                      int width);
1005 void I422ToRGB24Row_C(const uint8* src_y,
1006                       const uint8* src_u,
1007                       const uint8* src_v,
1008                       uint8* dst_rgb24,
1009                       int width);
1010 void I422ToRAWRow_C(const uint8* src_y,
1011                     const uint8* src_u,
1012                     const uint8* src_v,
1013                     uint8* dst_raw,
1014                     int width);
1015 void I422ToARGB4444Row_C(const uint8* src_y,
1016                          const uint8* src_u,
1017                          const uint8* src_v,
1018                          uint8* dst_argb4444,
1019                          int width);
1020 void I422ToARGB1555Row_C(const uint8* src_y,
1021                          const uint8* src_u,
1022                          const uint8* src_v,
1023                          uint8* dst_argb4444,
1024                          int width);
1025 void I422ToRGB565Row_C(const uint8* src_y,
1026                        const uint8* src_u,
1027                        const uint8* src_v,
1028                        uint8* dst_rgb565,
1029                        int width);
1030 void YToARGBRow_C(const uint8* src_y,
1031                   uint8* dst_argb,
1032                   int width);
1033 void I422ToARGBRow_AVX2(const uint8* src_y,
1034                         const uint8* src_u,
1035                         const uint8* src_v,
1036                         uint8* dst_argb,
1037                         int width);
1038 void I422ToBGRARow_AVX2(const uint8* src_y,
1039                         const uint8* src_u,
1040                         const uint8* src_v,
1041                         uint8* dst_argb,
1042                         int width);
1043 void I444ToARGBRow_SSSE3(const uint8* src_y,
1044                          const uint8* src_u,
1045                          const uint8* src_v,
1046                          uint8* dst_argb,
1047                          int width);
1048 void I422ToARGBRow_SSSE3(const uint8* src_y,
1049                          const uint8* src_u,
1050                          const uint8* src_v,
1051                          uint8* dst_argb,
1052                          int width);
1053 void I411ToARGBRow_SSSE3(const uint8* src_y,
1054                          const uint8* src_u,
1055                          const uint8* src_v,
1056                          uint8* dst_argb,
1057                          int width);
1058 void NV12ToARGBRow_SSSE3(const uint8* src_y,
1059                          const uint8* src_uv,
1060                          uint8* dst_argb,
1061                          int width);
1062 void NV21ToARGBRow_SSSE3(const uint8* src_y,
1063                          const uint8* src_vu,
1064                          uint8* dst_argb,
1065                          int width);
1066 void NV12ToRGB565Row_SSSE3(const uint8* src_y,
1067                            const uint8* src_uv,
1068                            uint8* dst_argb,
1069                            int width);
1070 void NV21ToRGB565Row_SSSE3(const uint8* src_y,
1071                            const uint8* src_vu,
1072                            uint8* dst_argb,
1073                            int width);
1074 void YUY2ToARGBRow_SSSE3(const uint8* src_yuy2,
1075                          uint8* dst_argb,
1076                          int width);
1077 void UYVYToARGBRow_SSSE3(const uint8* src_uyvy,
1078                          uint8* dst_argb,
1079                          int width);
1080 void I422ToBGRARow_SSSE3(const uint8* src_y,
1081                          const uint8* src_u,
1082                          const uint8* src_v,
1083                          uint8* dst_bgra,
1084                          int width);
1085 void I422ToABGRRow_SSSE3(const uint8* src_y,
1086                          const uint8* src_u,
1087                          const uint8* src_v,
1088                          uint8* dst_abgr,
1089                          int width);
1090 void I422ToRGBARow_SSSE3(const uint8* src_y,
1091                          const uint8* src_u,
1092                          const uint8* src_v,
1093                          uint8* dst_rgba,
1094                          int width);
1095 void I422ToARGB4444Row_SSSE3(const uint8* src_y,
1096                              const uint8* src_u,
1097                              const uint8* src_v,
1098                              uint8* dst_argb,
1099                              int width);
1100 void I422ToARGB1555Row_SSSE3(const uint8* src_y,
1101                              const uint8* src_u,
1102                              const uint8* src_v,
1103                              uint8* dst_argb,
1104                              int width);
1105 void I422ToRGB565Row_SSSE3(const uint8* src_y,
1106                            const uint8* src_u,
1107                            const uint8* src_v,
1108                            uint8* dst_argb,
1109                            int width);
1110 void I422ToRGB24Row_SSSE3(const uint8* src_y,
1111                           const uint8* src_u,
1112                           const uint8* src_v,
1113                           uint8* dst_rgb24,
1114                           int width);
1115 void I422ToRAWRow_SSSE3(const uint8* src_y,
1116                         const uint8* src_u,
1117                         const uint8* src_v,
1118                         uint8* dst_raw,
1119                         int width);
1120 void I422ToARGBRow_Any_AVX2(const uint8* src_y,
1121                             const uint8* src_u,
1122                             const uint8* src_v,
1123                             uint8* dst_argb,
1124                             int width);
1125 void I422ToBGRARow_Any_AVX2(const uint8* src_y,
1126                             const uint8* src_u,
1127                             const uint8* src_v,
1128                             uint8* dst_argb,
1129                             int width);
1130 void I444ToARGBRow_Any_SSSE3(const uint8* src_y,
1131                              const uint8* src_u,
1132                              const uint8* src_v,
1133                              uint8* dst_argb,
1134                              int width);
1135 void I422ToARGBRow_Any_SSSE3(const uint8* src_y,
1136                              const uint8* src_u,
1137                              const uint8* src_v,
1138                              uint8* dst_argb,
1139                              int width);
1140 void I411ToARGBRow_Any_SSSE3(const uint8* src_y,
1141                              const uint8* src_u,
1142                              const uint8* src_v,
1143                              uint8* dst_argb,
1144                              int width);
1145 void NV12ToARGBRow_Any_SSSE3(const uint8* src_y,
1146                              const uint8* src_uv,
1147                              uint8* dst_argb,
1148                              int width);
1149 void NV21ToARGBRow_Any_SSSE3(const uint8* src_y,
1150                              const uint8* src_vu,
1151                              uint8* dst_argb,
1152                              int width);
1153 void NV12ToRGB565Row_Any_SSSE3(const uint8* src_y,
1154                                const uint8* src_uv,
1155                                uint8* dst_argb,
1156                                int width);
1157 void NV21ToRGB565Row_Any_SSSE3(const uint8* src_y,
1158                                const uint8* src_vu,
1159                                uint8* dst_argb,
1160                                int width);
1161 void YUY2ToARGBRow_Any_SSSE3(const uint8* src_yuy2,
1162                              uint8* dst_argb,
1163                              int width);
1164 void UYVYToARGBRow_Any_SSSE3(const uint8* src_uyvy,
1165                              uint8* dst_argb,
1166                              int width);
1167 void I422ToBGRARow_Any_SSSE3(const uint8* src_y,
1168                              const uint8* src_u,
1169                              const uint8* src_v,
1170                              uint8* dst_bgra,
1171                              int width);
1172 void I422ToABGRRow_Any_SSSE3(const uint8* src_y,
1173                              const uint8* src_u,
1174                              const uint8* src_v,
1175                              uint8* dst_abgr,
1176                              int width);
1177 void I422ToRGBARow_Any_SSSE3(const uint8* src_y,
1178                              const uint8* src_u,
1179                              const uint8* src_v,
1180                              uint8* dst_rgba,
1181                              int width);
1182 void I422ToARGB4444Row_Any_SSSE3(const uint8* src_y,
1183                                  const uint8* src_u,
1184                                  const uint8* src_v,
1185                                  uint8* dst_rgba,
1186                                  int width);
1187 void I422ToARGB1555Row_Any_SSSE3(const uint8* src_y,
1188                                  const uint8* src_u,
1189                                  const uint8* src_v,
1190                                  uint8* dst_rgba,
1191                                  int width);
1192 void I422ToRGB565Row_Any_SSSE3(const uint8* src_y,
1193                                const uint8* src_u,
1194                                const uint8* src_v,
1195                                uint8* dst_rgba,
1196                                int width);
1197 void I422ToRGB24Row_Any_SSSE3(const uint8* src_y,
1198                               const uint8* src_u,
1199                               const uint8* src_v,
1200                               uint8* dst_argb,
1201                               int width);
1202 void I422ToRAWRow_Any_SSSE3(const uint8* src_y,
1203                             const uint8* src_u,
1204                             const uint8* src_v,
1205                             uint8* dst_argb,
1206                             int width);
1207 void YToARGBRow_SSE2(const uint8* src_y,
1208                      uint8* dst_argb,
1209                      int width);
1210 void YToARGBRow_NEON(const uint8* src_y,
1211                      uint8* dst_argb,
1212                      int width);
1213 void YToARGBRow_Any_SSE2(const uint8* src_y,
1214                          uint8* dst_argb,
1215                          int width);
1216 void YToARGBRow_Any_NEON(const uint8* src_y,
1217                          uint8* dst_argb,
1218                          int width);
1219
1220 // ARGB preattenuated alpha blend.
1221 void ARGBBlendRow_SSSE3(const uint8* src_argb, const uint8* src_argb1,
1222                         uint8* dst_argb, int width);
1223 void ARGBBlendRow_SSE2(const uint8* src_argb, const uint8* src_argb1,
1224                        uint8* dst_argb, int width);
1225 void ARGBBlendRow_NEON(const uint8* src_argb, const uint8* src_argb1,
1226                        uint8* dst_argb, int width);
1227 void ARGBBlendRow_C(const uint8* src_argb, const uint8* src_argb1,
1228                     uint8* dst_argb, int width);
1229
1230 // ARGB multiply images. Same API as Blend, but these require
1231 // pointer and width alignment for SSE2.
1232 void ARGBMultiplyRow_C(const uint8* src_argb, const uint8* src_argb1,
1233                        uint8* dst_argb, int width);
1234 void ARGBMultiplyRow_SSE2(const uint8* src_argb, const uint8* src_argb1,
1235                           uint8* dst_argb, int width);
1236 void ARGBMultiplyRow_Any_SSE2(const uint8* src_argb, const uint8* src_argb1,
1237                               uint8* dst_argb, int width);
1238 void ARGBMultiplyRow_AVX2(const uint8* src_argb, const uint8* src_argb1,
1239                           uint8* dst_argb, int width);
1240 void ARGBMultiplyRow_Any_AVX2(const uint8* src_argb, const uint8* src_argb1,
1241                               uint8* dst_argb, int width);
1242 void ARGBMultiplyRow_NEON(const uint8* src_argb, const uint8* src_argb1,
1243                           uint8* dst_argb, int width);
1244 void ARGBMultiplyRow_Any_NEON(const uint8* src_argb, const uint8* src_argb1,
1245                               uint8* dst_argb, int width);
1246
1247 // ARGB add images.
1248 void ARGBAddRow_C(const uint8* src_argb, const uint8* src_argb1,
1249                   uint8* dst_argb, int width);
1250 void ARGBAddRow_SSE2(const uint8* src_argb, const uint8* src_argb1,
1251                      uint8* dst_argb, int width);
1252 void ARGBAddRow_Any_SSE2(const uint8* src_argb, const uint8* src_argb1,
1253                          uint8* dst_argb, int width);
1254 void ARGBAddRow_AVX2(const uint8* src_argb, const uint8* src_argb1,
1255                      uint8* dst_argb, int width);
1256 void ARGBAddRow_Any_AVX2(const uint8* src_argb, const uint8* src_argb1,
1257                          uint8* dst_argb, int width);
1258 void ARGBAddRow_NEON(const uint8* src_argb, const uint8* src_argb1,
1259                      uint8* dst_argb, int width);
1260 void ARGBAddRow_Any_NEON(const uint8* src_argb, const uint8* src_argb1,
1261                          uint8* dst_argb, int width);
1262
1263 // ARGB subtract images. Same API as Blend, but these require
1264 // pointer and width alignment for SSE2.
1265 void ARGBSubtractRow_C(const uint8* src_argb, const uint8* src_argb1,
1266                        uint8* dst_argb, int width);
1267 void ARGBSubtractRow_SSE2(const uint8* src_argb, const uint8* src_argb1,
1268                           uint8* dst_argb, int width);
1269 void ARGBSubtractRow_Any_SSE2(const uint8* src_argb, const uint8* src_argb1,
1270                               uint8* dst_argb, int width);
1271 void ARGBSubtractRow_AVX2(const uint8* src_argb, const uint8* src_argb1,
1272                           uint8* dst_argb, int width);
1273 void ARGBSubtractRow_Any_AVX2(const uint8* src_argb, const uint8* src_argb1,
1274                               uint8* dst_argb, int width);
1275 void ARGBSubtractRow_NEON(const uint8* src_argb, const uint8* src_argb1,
1276                           uint8* dst_argb, int width);
1277 void ARGBSubtractRow_Any_NEON(const uint8* src_argb, const uint8* src_argb1,
1278                               uint8* dst_argb, int width);
1279
1280 void ARGBToRGB24Row_Any_SSSE3(const uint8* src_argb, uint8* dst_rgb, int pix);
1281 void ARGBToRAWRow_Any_SSSE3(const uint8* src_argb, uint8* dst_rgb, int pix);
1282 void ARGBToRGB565Row_Any_SSE2(const uint8* src_argb, uint8* dst_rgb, int pix);
1283 void ARGBToARGB1555Row_Any_SSE2(const uint8* src_argb, uint8* dst_rgb, int pix);
1284 void ARGBToARGB4444Row_Any_SSE2(const uint8* src_argb, uint8* dst_rgb, int pix);
1285
1286 void ARGBToRGB24Row_Any_NEON(const uint8* src_argb, uint8* dst_rgb, int pix);
1287 void ARGBToRAWRow_Any_NEON(const uint8* src_argb, uint8* dst_rgb, int pix);
1288 void ARGBToRGB565Row_Any_NEON(const uint8* src_argb, uint8* dst_rgb, int pix);
1289 void ARGBToARGB1555Row_Any_NEON(const uint8* src_argb, uint8* dst_rgb, int pix);
1290 void ARGBToARGB4444Row_Any_NEON(const uint8* src_argb, uint8* dst_rgb, int pix);
1291
1292 void I444ToARGBRow_Any_NEON(const uint8* src_y,
1293                             const uint8* src_u,
1294                             const uint8* src_v,
1295                             uint8* dst_argb,
1296                             int width);
1297 void I422ToARGBRow_Any_NEON(const uint8* src_y,
1298                             const uint8* src_u,
1299                             const uint8* src_v,
1300                             uint8* dst_argb,
1301                             int width);
1302 void I411ToARGBRow_Any_NEON(const uint8* src_y,
1303                             const uint8* src_u,
1304                             const uint8* src_v,
1305                             uint8* dst_argb,
1306                             int width);
1307 void I422ToBGRARow_Any_NEON(const uint8* src_y,
1308                             const uint8* src_u,
1309                             const uint8* src_v,
1310                             uint8* dst_argb,
1311                             int width);
1312 void I422ToABGRRow_Any_NEON(const uint8* src_y,
1313                             const uint8* src_u,
1314                             const uint8* src_v,
1315                             uint8* dst_argb,
1316                             int width);
1317 void I422ToRGBARow_Any_NEON(const uint8* src_y,
1318                             const uint8* src_u,
1319                             const uint8* src_v,
1320                             uint8* dst_argb,
1321                             int width);
1322 void I422ToRGB24Row_Any_NEON(const uint8* src_y,
1323                              const uint8* src_u,
1324                              const uint8* src_v,
1325                              uint8* dst_argb,
1326                              int width);
1327 void I422ToRAWRow_Any_NEON(const uint8* src_y,
1328                            const uint8* src_u,
1329                            const uint8* src_v,
1330                            uint8* dst_argb,
1331                            int width);
1332 void I422ToARGB4444Row_Any_NEON(const uint8* src_y,
1333                                 const uint8* src_u,
1334                                 const uint8* src_v,
1335                                 uint8* dst_argb,
1336                                 int width);
1337 void I422ToARGB1555Row_Any_NEON(const uint8* src_y,
1338                                 const uint8* src_u,
1339                                 const uint8* src_v,
1340                                 uint8* dst_argb,
1341                                 int width);
1342 void I422ToRGB565Row_Any_NEON(const uint8* src_y,
1343                               const uint8* src_u,
1344                               const uint8* src_v,
1345                               uint8* dst_argb,
1346                               int width);
1347 void NV12ToARGBRow_Any_NEON(const uint8* src_y,
1348                             const uint8* src_uv,
1349                             uint8* dst_argb,
1350                             int width);
1351 void NV21ToARGBRow_Any_NEON(const uint8* src_y,
1352                             const uint8* src_uv,
1353                             uint8* dst_argb,
1354                             int width);
1355 void NV12ToRGB565Row_Any_NEON(const uint8* src_y,
1356                               const uint8* src_uv,
1357                               uint8* dst_argb,
1358                               int width);
1359 void NV21ToRGB565Row_Any_NEON(const uint8* src_y,
1360                               const uint8* src_uv,
1361                               uint8* dst_argb,
1362                               int width);
1363 void YUY2ToARGBRow_Any_NEON(const uint8* src_yuy2,
1364                             uint8* dst_argb,
1365                             int width);
1366 void UYVYToARGBRow_Any_NEON(const uint8* src_uyvy,
1367                             uint8* dst_argb,
1368                             int width);
1369 void I422ToARGBRow_MIPS_DSPR2(const uint8* src_y,
1370                               const uint8* src_u,
1371                               const uint8* src_v,
1372                               uint8* dst_argb,
1373                               int width);
1374 void I422ToBGRARow_MIPS_DSPR2(const uint8* src_y,
1375                               const uint8* src_u,
1376                               const uint8* src_v,
1377                               uint8* dst_argb,
1378                               int width);
1379 void I422ToABGRRow_MIPS_DSPR2(const uint8* src_y,
1380                               const uint8* src_u,
1381                               const uint8* src_v,
1382                               uint8* dst_argb,
1383                               int width);
1384 void I422ToARGBRow_MIPS_DSPR2(const uint8* src_y,
1385                               const uint8* src_u,
1386                               const uint8* src_v,
1387                               uint8* dst_argb,
1388                               int width);
1389 void I422ToBGRARow_MIPS_DSPR2(const uint8* src_y,
1390                               const uint8* src_u,
1391                               const uint8* src_v,
1392                               uint8* dst_argb,
1393                               int width);
1394 void I422ToABGRRow_MIPS_DSPR2(const uint8* src_y,
1395                               const uint8* src_u,
1396                               const uint8* src_v,
1397                               uint8* dst_argb,
1398                               int width);
1399
1400 void YUY2ToYRow_AVX2(const uint8* src_yuy2, uint8* dst_y, int pix);
1401 void YUY2ToUVRow_AVX2(const uint8* src_yuy2, int stride_yuy2,
1402                       uint8* dst_u, uint8* dst_v, int pix);
1403 void YUY2ToUV422Row_AVX2(const uint8* src_yuy2,
1404                          uint8* dst_u, uint8* dst_v, int pix);
1405 void YUY2ToYRow_SSE2(const uint8* src_yuy2, uint8* dst_y, int pix);
1406 void YUY2ToUVRow_SSE2(const uint8* src_yuy2, int stride_yuy2,
1407                       uint8* dst_u, uint8* dst_v, int pix);
1408 void YUY2ToUV422Row_SSE2(const uint8* src_yuy2,
1409                          uint8* dst_u, uint8* dst_v, int pix);
1410 void YUY2ToYRow_NEON(const uint8* src_yuy2, uint8* dst_y, int pix);
1411 void YUY2ToUVRow_NEON(const uint8* src_yuy2, int stride_yuy2,
1412                       uint8* dst_u, uint8* dst_v, int pix);
1413 void YUY2ToUV422Row_NEON(const uint8* src_yuy2,
1414                          uint8* dst_u, uint8* dst_v, int pix);
1415 void YUY2ToYRow_C(const uint8* src_yuy2, uint8* dst_y, int pix);
1416 void YUY2ToUVRow_C(const uint8* src_yuy2, int stride_yuy2,
1417                    uint8* dst_u, uint8* dst_v, int pix);
1418 void YUY2ToUV422Row_C(const uint8* src_yuy2,
1419                       uint8* dst_u, uint8* dst_v, int pix);
1420 void YUY2ToYRow_Any_AVX2(const uint8* src_yuy2, uint8* dst_y, int pix);
1421 void YUY2ToUVRow_Any_AVX2(const uint8* src_yuy2, int stride_yuy2,
1422                           uint8* dst_u, uint8* dst_v, int pix);
1423 void YUY2ToUV422Row_Any_AVX2(const uint8* src_yuy2,
1424                              uint8* dst_u, uint8* dst_v, int pix);
1425 void YUY2ToYRow_Any_SSE2(const uint8* src_yuy2, uint8* dst_y, int pix);
1426 void YUY2ToUVRow_Any_SSE2(const uint8* src_yuy2, int stride_yuy2,
1427                           uint8* dst_u, uint8* dst_v, int pix);
1428 void YUY2ToUV422Row_Any_SSE2(const uint8* src_yuy2,
1429                              uint8* dst_u, uint8* dst_v, int pix);
1430 void YUY2ToYRow_Any_NEON(const uint8* src_yuy2, uint8* dst_y, int pix);
1431 void YUY2ToUVRow_Any_NEON(const uint8* src_yuy2, int stride_yuy2,
1432                           uint8* dst_u, uint8* dst_v, int pix);
1433 void YUY2ToUV422Row_Any_NEON(const uint8* src_yuy2,
1434                              uint8* dst_u, uint8* dst_v, int pix);
1435 void UYVYToYRow_AVX2(const uint8* src_uyvy, uint8* dst_y, int pix);
1436 void UYVYToUVRow_AVX2(const uint8* src_uyvy, int stride_uyvy,
1437                       uint8* dst_u, uint8* dst_v, int pix);
1438 void UYVYToUV422Row_AVX2(const uint8* src_uyvy,
1439                          uint8* dst_u, uint8* dst_v, int pix);
1440 void UYVYToYRow_SSE2(const uint8* src_uyvy, uint8* dst_y, int pix);
1441 void UYVYToUVRow_SSE2(const uint8* src_uyvy, int stride_uyvy,
1442                       uint8* dst_u, uint8* dst_v, int pix);
1443 void UYVYToUV422Row_SSE2(const uint8* src_uyvy,
1444                          uint8* dst_u, uint8* dst_v, int pix);
1445 void UYVYToYRow_AVX2(const uint8* src_uyvy, uint8* dst_y, int pix);
1446 void UYVYToUVRow_AVX2(const uint8* src_uyvy, int stride_uyvy,
1447                       uint8* dst_u, uint8* dst_v, int pix);
1448 void UYVYToUV422Row_AVX2(const uint8* src_uyvy,
1449                          uint8* dst_u, uint8* dst_v, int pix);
1450 void UYVYToYRow_NEON(const uint8* src_uyvy, uint8* dst_y, int pix);
1451 void UYVYToUVRow_NEON(const uint8* src_uyvy, int stride_uyvy,
1452                       uint8* dst_u, uint8* dst_v, int pix);
1453 void UYVYToUV422Row_NEON(const uint8* src_uyvy,
1454                          uint8* dst_u, uint8* dst_v, int pix);
1455
1456 void UYVYToYRow_C(const uint8* src_uyvy, uint8* dst_y, int pix);
1457 void UYVYToUVRow_C(const uint8* src_uyvy, int stride_uyvy,
1458                    uint8* dst_u, uint8* dst_v, int pix);
1459 void UYVYToUV422Row_C(const uint8* src_uyvy,
1460                       uint8* dst_u, uint8* dst_v, int pix);
1461 void UYVYToYRow_Any_AVX2(const uint8* src_uyvy, uint8* dst_y, int pix);
1462 void UYVYToUVRow_Any_AVX2(const uint8* src_uyvy, int stride_uyvy,
1463                           uint8* dst_u, uint8* dst_v, int pix);
1464 void UYVYToUV422Row_Any_AVX2(const uint8* src_uyvy,
1465                              uint8* dst_u, uint8* dst_v, int pix);
1466 void UYVYToYRow_Any_SSE2(const uint8* src_uyvy, uint8* dst_y, int pix);
1467 void UYVYToUVRow_Any_SSE2(const uint8* src_uyvy, int stride_uyvy,
1468                           uint8* dst_u, uint8* dst_v, int pix);
1469 void UYVYToUV422Row_Any_SSE2(const uint8* src_uyvy,
1470                              uint8* dst_u, uint8* dst_v, int pix);
1471 void UYVYToYRow_Any_NEON(const uint8* src_uyvy, uint8* dst_y, int pix);
1472 void UYVYToUVRow_Any_NEON(const uint8* src_uyvy, int stride_uyvy,
1473                           uint8* dst_u, uint8* dst_v, int pix);
1474 void UYVYToUV422Row_Any_NEON(const uint8* src_uyvy,
1475                              uint8* dst_u, uint8* dst_v, int pix);
1476
1477 void ARGBToBayerRow_C(const uint8* src_argb, uint8* dst_bayer,
1478                       uint32 selector, int pix);
1479 void ARGBToBayerRow_SSSE3(const uint8* src_argb, uint8* dst_bayer,
1480                           uint32 selector, int pix);
1481 void ARGBToBayerRow_NEON(const uint8* src_argb, uint8* dst_bayer,
1482                          uint32 selector, int pix);
1483 void ARGBToBayerRow_Any_SSSE3(const uint8* src_argb, uint8* dst_bayer,
1484                               uint32 selector, int pix);
1485 void ARGBToBayerRow_Any_NEON(const uint8* src_argb, uint8* dst_bayer,
1486                              uint32 selector, int pix);
1487 void ARGBToBayerGGRow_C(const uint8* src_argb, uint8* dst_bayer,
1488                         uint32 /* selector */, int pix);
1489 void ARGBToBayerGGRow_SSE2(const uint8* src_argb, uint8* dst_bayer,
1490                            uint32 /* selector */, int pix);
1491 void ARGBToBayerGGRow_NEON(const uint8* src_argb, uint8* dst_bayer,
1492                            uint32 /* selector */, int pix);
1493 void ARGBToBayerGGRow_Any_SSE2(const uint8* src_argb, uint8* dst_bayer,
1494                                uint32 /* selector */, int pix);
1495 void ARGBToBayerGGRow_Any_NEON(const uint8* src_argb, uint8* dst_bayer,
1496                                uint32 /* selector */, int pix);
1497
1498 void I422ToYUY2Row_C(const uint8* src_y,
1499                      const uint8* src_u,
1500                      const uint8* src_v,
1501                      uint8* dst_yuy2, int width);
1502 void I422ToUYVYRow_C(const uint8* src_y,
1503                      const uint8* src_u,
1504                      const uint8* src_v,
1505                      uint8* dst_uyvy, int width);
1506 void I422ToYUY2Row_SSE2(const uint8* src_y,
1507                         const uint8* src_u,
1508                         const uint8* src_v,
1509                         uint8* dst_yuy2, int width);
1510 void I422ToUYVYRow_SSE2(const uint8* src_y,
1511                         const uint8* src_u,
1512                         const uint8* src_v,
1513                         uint8* dst_uyvy, int width);
1514 void I422ToYUY2Row_Any_SSE2(const uint8* src_y,
1515                             const uint8* src_u,
1516                             const uint8* src_v,
1517                             uint8* dst_yuy2, int width);
1518 void I422ToUYVYRow_Any_SSE2(const uint8* src_y,
1519                             const uint8* src_u,
1520                             const uint8* src_v,
1521                             uint8* dst_uyvy, int width);
1522 void I422ToYUY2Row_NEON(const uint8* src_y,
1523                         const uint8* src_u,
1524                         const uint8* src_v,
1525                         uint8* dst_yuy2, int width);
1526 void I422ToUYVYRow_NEON(const uint8* src_y,
1527                         const uint8* src_u,
1528                         const uint8* src_v,
1529                         uint8* dst_uyvy, int width);
1530 void I422ToYUY2Row_Any_NEON(const uint8* src_y,
1531                             const uint8* src_u,
1532                             const uint8* src_v,
1533                             uint8* dst_yuy2, int width);
1534 void I422ToUYVYRow_Any_NEON(const uint8* src_y,
1535                             const uint8* src_u,
1536                             const uint8* src_v,
1537                             uint8* dst_uyvy, int width);
1538
1539 // Effects related row functions.
1540 void ARGBAttenuateRow_C(const uint8* src_argb, uint8* dst_argb, int width);
1541 void ARGBAttenuateRow_SSE2(const uint8* src_argb, uint8* dst_argb, int width);
1542 void ARGBAttenuateRow_SSSE3(const uint8* src_argb, uint8* dst_argb, int width);
1543 void ARGBAttenuateRow_AVX2(const uint8* src_argb, uint8* dst_argb, int width);
1544 void ARGBAttenuateRow_NEON(const uint8* src_argb, uint8* dst_argb, int width);
1545 void ARGBAttenuateRow_Any_SSE2(const uint8* src_argb, uint8* dst_argb,
1546                                int width);
1547 void ARGBAttenuateRow_Any_SSSE3(const uint8* src_argb, uint8* dst_argb,
1548                                 int width);
1549 void ARGBAttenuateRow_Any_AVX2(const uint8* src_argb, uint8* dst_argb,
1550                                int width);
1551 void ARGBAttenuateRow_Any_NEON(const uint8* src_argb, uint8* dst_argb,
1552                                int width);
1553
1554 // Inverse table for unattenuate, shared by C and SSE2.
1555 extern const uint32 fixed_invtbl8[256];
1556 void ARGBUnattenuateRow_C(const uint8* src_argb, uint8* dst_argb, int width);
1557 void ARGBUnattenuateRow_SSE2(const uint8* src_argb, uint8* dst_argb, int width);
1558 void ARGBUnattenuateRow_AVX2(const uint8* src_argb, uint8* dst_argb, int width);
1559 void ARGBUnattenuateRow_Any_SSE2(const uint8* src_argb, uint8* dst_argb,
1560                                  int width);
1561 void ARGBUnattenuateRow_Any_AVX2(const uint8* src_argb, uint8* dst_argb,
1562                                  int width);
1563
1564 void ARGBGrayRow_C(const uint8* src_argb, uint8* dst_argb, int width);
1565 void ARGBGrayRow_SSSE3(const uint8* src_argb, uint8* dst_argb, int width);
1566 void ARGBGrayRow_NEON(const uint8* src_argb, uint8* dst_argb, int width);
1567
1568 void ARGBSepiaRow_C(uint8* dst_argb, int width);
1569 void ARGBSepiaRow_SSSE3(uint8* dst_argb, int width);
1570 void ARGBSepiaRow_NEON(uint8* dst_argb, int width);
1571
1572 void ARGBColorMatrixRow_C(const uint8* src_argb, uint8* dst_argb,
1573                           const int8* matrix_argb, int width);
1574 void ARGBColorMatrixRow_SSSE3(const uint8* src_argb, uint8* dst_argb,
1575                               const int8* matrix_argb, int width);
1576 void ARGBColorMatrixRow_NEON(const uint8* src_argb, uint8* dst_argb,
1577                              const int8* matrix_argb, int width);
1578
1579 void ARGBColorTableRow_C(uint8* dst_argb, const uint8* table_argb, int width);
1580 void ARGBColorTableRow_X86(uint8* dst_argb, const uint8* table_argb, int width);
1581
1582 void RGBColorTableRow_C(uint8* dst_argb, const uint8* table_argb, int width);
1583 void RGBColorTableRow_X86(uint8* dst_argb, const uint8* table_argb, int width);
1584
1585 void ARGBQuantizeRow_C(uint8* dst_argb, int scale, int interval_size,
1586                        int interval_offset, int width);
1587 void ARGBQuantizeRow_SSE2(uint8* dst_argb, int scale, int interval_size,
1588                           int interval_offset, int width);
1589 void ARGBQuantizeRow_NEON(uint8* dst_argb, int scale, int interval_size,
1590                           int interval_offset, int width);
1591
1592 void ARGBShadeRow_C(const uint8* src_argb, uint8* dst_argb, int width,
1593                     uint32 value);
1594 void ARGBShadeRow_SSE2(const uint8* src_argb, uint8* dst_argb, int width,
1595                        uint32 value);
1596 void ARGBShadeRow_NEON(const uint8* src_argb, uint8* dst_argb, int width,
1597                        uint32 value);
1598
1599 // Used for blur.
1600 void CumulativeSumToAverageRow_SSE2(const int32* topleft, const int32* botleft,
1601                                     int width, int area, uint8* dst, int count);
1602 void ComputeCumulativeSumRow_SSE2(const uint8* row, int32* cumsum,
1603                                   const int32* previous_cumsum, int width);
1604
1605 void CumulativeSumToAverageRow_C(const int32* topleft, const int32* botleft,
1606                                  int width, int area, uint8* dst, int count);
1607 void ComputeCumulativeSumRow_C(const uint8* row, int32* cumsum,
1608                                const int32* previous_cumsum, int width);
1609
1610 LIBYUV_API
1611 void ARGBAffineRow_C(const uint8* src_argb, int src_argb_stride,
1612                      uint8* dst_argb, const float* uv_dudv, int width);
1613 LIBYUV_API
1614 void ARGBAffineRow_SSE2(const uint8* src_argb, int src_argb_stride,
1615                         uint8* dst_argb, const float* uv_dudv, int width);
1616
1617 // Used for I420Scale, ARGBScale, and ARGBInterpolate.
1618 void InterpolateRow_C(uint8* dst_ptr, const uint8* src_ptr,
1619                       ptrdiff_t src_stride_ptr,
1620                       int width, int source_y_fraction);
1621 void InterpolateRow_SSE2(uint8* dst_ptr, const uint8* src_ptr,
1622                          ptrdiff_t src_stride_ptr, int width,
1623                          int source_y_fraction);
1624 void InterpolateRow_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
1625                           ptrdiff_t src_stride_ptr, int width,
1626                           int source_y_fraction);
1627 void InterpolateRow_AVX2(uint8* dst_ptr, const uint8* src_ptr,
1628                          ptrdiff_t src_stride_ptr, int width,
1629                          int source_y_fraction);
1630 void InterpolateRow_NEON(uint8* dst_ptr, const uint8* src_ptr,
1631                          ptrdiff_t src_stride_ptr, int width,
1632                          int source_y_fraction);
1633 void InterpolateRows_MIPS_DSPR2(uint8* dst_ptr, const uint8* src_ptr,
1634                                 ptrdiff_t src_stride_ptr, int width,
1635                                 int source_y_fraction);
1636 void InterpolateRow_Any_NEON(uint8* dst_ptr, const uint8* src_ptr,
1637                              ptrdiff_t src_stride_ptr, int width,
1638                              int source_y_fraction);
1639 void InterpolateRow_Any_SSE2(uint8* dst_ptr, const uint8* src_ptr,
1640                              ptrdiff_t src_stride_ptr, int width,
1641                              int source_y_fraction);
1642 void InterpolateRow_Any_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
1643                               ptrdiff_t src_stride_ptr, int width,
1644                               int source_y_fraction);
1645 void InterpolateRow_Any_AVX2(uint8* dst_ptr, const uint8* src_ptr,
1646                              ptrdiff_t src_stride_ptr, int width,
1647                              int source_y_fraction);
1648 void InterpolateRows_Any_MIPS_DSPR2(uint8* dst_ptr, const uint8* src_ptr,
1649                                     ptrdiff_t src_stride_ptr, int width,
1650                                     int source_y_fraction);
1651
1652 void InterpolateRow_16_C(uint16* dst_ptr, const uint16* src_ptr,
1653                          ptrdiff_t src_stride_ptr,
1654                          int width, int source_y_fraction);
1655
1656 // Sobel images.
1657 void SobelXRow_C(const uint8* src_y0, const uint8* src_y1, const uint8* src_y2,
1658                  uint8* dst_sobelx, int width);
1659 void SobelXRow_SSE2(const uint8* src_y0, const uint8* src_y1,
1660                     const uint8* src_y2, uint8* dst_sobelx, int width);
1661 void SobelXRow_NEON(const uint8* src_y0, const uint8* src_y1,
1662                     const uint8* src_y2, uint8* dst_sobelx, int width);
1663 void SobelYRow_C(const uint8* src_y0, const uint8* src_y1,
1664                  uint8* dst_sobely, int width);
1665 void SobelYRow_SSE2(const uint8* src_y0, const uint8* src_y1,
1666                     uint8* dst_sobely, int width);
1667 void SobelYRow_NEON(const uint8* src_y0, const uint8* src_y1,
1668                     uint8* dst_sobely, int width);
1669 void SobelRow_C(const uint8* src_sobelx, const uint8* src_sobely,
1670                 uint8* dst_argb, int width);
1671 void SobelRow_SSE2(const uint8* src_sobelx, const uint8* src_sobely,
1672                    uint8* dst_argb, int width);
1673 void SobelRow_NEON(const uint8* src_sobelx, const uint8* src_sobely,
1674                    uint8* dst_argb, int width);
1675 void SobelToPlaneRow_C(const uint8* src_sobelx, const uint8* src_sobely,
1676                        uint8* dst_y, int width);
1677 void SobelToPlaneRow_SSE2(const uint8* src_sobelx, const uint8* src_sobely,
1678                           uint8* dst_y, int width);
1679 void SobelToPlaneRow_NEON(const uint8* src_sobelx, const uint8* src_sobely,
1680                           uint8* dst_y, int width);
1681 void SobelXYRow_C(const uint8* src_sobelx, const uint8* src_sobely,
1682                   uint8* dst_argb, int width);
1683 void SobelXYRow_SSE2(const uint8* src_sobelx, const uint8* src_sobely,
1684                      uint8* dst_argb, int width);
1685 void SobelXYRow_NEON(const uint8* src_sobelx, const uint8* src_sobely,
1686                      uint8* dst_argb, int width);
1687
1688 void ARGBPolynomialRow_C(const uint8* src_argb,
1689                          uint8* dst_argb, const float* poly,
1690                          int width);
1691 void ARGBPolynomialRow_SSE2(const uint8* src_argb,
1692                             uint8* dst_argb, const float* poly,
1693                             int width);
1694 void ARGBPolynomialRow_AVX2(const uint8* src_argb,
1695                             uint8* dst_argb, const float* poly,
1696                             int width);
1697
1698 void ARGBLumaColorTableRow_C(const uint8* src_argb, uint8* dst_argb, int width,
1699                              const uint8* luma, uint32 lumacoeff);
1700 void ARGBLumaColorTableRow_SSSE3(const uint8* src_argb, uint8* dst_argb,
1701                                  int width,
1702                                  const uint8* luma, uint32 lumacoeff);
1703
1704 #ifdef __cplusplus
1705 }  // extern "C"
1706 }  // namespace libyuv
1707 #endif
1708
1709 #endif  // INCLUDE_LIBYUV_ROW_H_  NOLINT