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 "libyuv/basic_types.h"
15 
16 #ifdef __cplusplus
17 namespace libyuv {
18 extern "C" {
19 #endif
20 
21 // TODO(fbarchard): Remove kMaxStride
22 #define kMaxStride (2880 * 4)
23 #define IS_ALIGNED(p, a) (!((uintptr_t)(p) & ((a) - 1)))
24 
25 #if defined(__CLR_VER) || defined(COVERAGE_ENABLED) || \
26     defined(TARGET_IPHONE_SIMULATOR)
27 #define YUV_DISABLE_ASM
28 #endif
29 // True if compiling for SSSE3 as a requirement.
30 #if defined(__SSSE3__) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 3))
31 #define LIBYUV_SSSE3_ONLY
32 #endif
33 
34 // The following are available on all x86 platforms:
35 #if !defined(YUV_DISABLE_ASM) && \
36     (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__))
37 // Conversions.
38 #define HAS_ABGRTOARGBROW_SSSE3
39 #define HAS_ABGRTOUVROW_SSSE3
40 #define HAS_ABGRTOYROW_SSSE3
41 #define HAS_ARGB1555TOARGBROW_SSE2
42 #define HAS_ARGB4444TOARGBROW_SSE2
43 #define HAS_ARGBTOARGB1555ROW_SSE2
44 #define HAS_ARGBTOARGB4444ROW_SSE2
45 #define HAS_ARGBTORAWROW_SSSE3
46 #define HAS_ARGBTORGB24ROW_SSSE3
47 #define HAS_ARGBTORGB565ROW_SSE2
48 #define HAS_ARGBTORGBAROW_SSSE3
49 #define HAS_ARGBTOUVROW_SSSE3
50 #define HAS_ARGBTOYROW_SSSE3
51 #define HAS_BGRATOARGBROW_SSSE3
52 #define HAS_BGRATOUVROW_SSSE3
53 #define HAS_BGRATOYROW_SSSE3
54 #define HAS_COPYROW_SSE2
55 #define HAS_COPYROW_X86
56 #define HAS_I400TOARGBROW_SSE2
57 #define HAS_I411TOARGBROW_SSSE3
58 #define HAS_I422TOABGRROW_SSSE3
59 #define HAS_I422TOARGBROW_SSSE3
60 #define HAS_I422TOBGRAROW_SSSE3
61 #define HAS_I444TOARGBROW_SSSE3
62 #define HAS_MIRRORROW_SSSE3
63 #define HAS_MIRRORROWUV_SSSE3
64 #define HAS_NV12TOARGBROW_SSSE3
65 #define HAS_NV21TOARGBROW_SSSE3
66 #define HAS_RAWTOARGBROW_SSSE3
67 #define HAS_RGB24TOARGBROW_SSSE3
68 #define HAS_RGB565TOARGBROW_SSE2
69 #define HAS_SETROW_X86
70 #define HAS_SPLITUV_SSE2
71 #define HAS_UYVYTOUV422ROW_SSE2
72 #define HAS_UYVYTOUVROW_SSE2
73 #define HAS_UYVYTOYROW_SSE2
74 #define HAS_YTOARGBROW_SSE2
75 #define HAS_YUY2TOUV422ROW_SSE2
76 #define HAS_YUY2TOUVROW_SSE2
77 #define HAS_YUY2TOYROW_SSE2
78 
79 // Effects
80 #define HAS_ARGBAFFINEROW_SSE2
81 #define HAS_ARGBATTENUATEROW_SSSE3
82 #define HAS_ARGBBLENDROW_SSSE3
83 #define HAS_ARGBCOLORMATRIXROW_SSSE3
84 #define HAS_ARGBGRAYROW_SSSE3
85 #define HAS_ARGBINTERPOLATEROW_SSSE3
86 #define HAS_ARGBMIRRORROW_SSSE3
87 #define HAS_ARGBQUANTIZEROW_SSE2
88 #define HAS_ARGBSEPIAROW_SSSE3
89 #define HAS_ARGBSHADE_SSE2
90 #define HAS_ARGBUNATTENUATEROW_SSE2
91 #define HAS_COMPUTECUMULATIVESUMROW_SSE2
92 #define HAS_CUMULATIVESUMTOAVERAGE_SSE2
93 #endif
94 
95 // The following are Windows only:
96 #if !defined(YUV_DISABLE_ASM) && defined(_M_IX86)
97 #define HAS_ABGRTOARGBROW_SSSE3
98 #define HAS_ARGBCOLORTABLEROW_X86
99 #define HAS_I422TORGBAROW_SSSE3
100 #define HAS_RGBATOARGBROW_SSSE3
101 #define HAS_RGBATOUVROW_SSSE3
102 #define HAS_RGBATOYROW_SSSE3
103 #endif
104 
105 // The following are disabled when SSSE3 is available:
106 #if !defined(YUV_DISABLE_ASM) && \
107     (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) && \
108     !defined(LIBYUV_SSSE3_ONLY)
109 #define HAS_ARGBATTENUATE_SSE2
110 #define HAS_ARGBBLENDROW_SSE2
111 #define HAS_MIRRORROW_SSE2
112 #endif
113 
114 // The following are available on Neon platforms
115 #if !defined(YUV_DISABLE_ASM) && (defined(__ARM_NEON__) || defined(LIBYUV_NEON))
116 #define HAS_COPYROW_NEON
117 #define HAS_I422TOABGRROW_NEON
118 #define HAS_I422TOARGBROW_NEON
119 #define HAS_I422TOBGRAROW_NEON
120 #define HAS_I422TORAWROW_NEON
121 #define HAS_I422TORGB24ROW_NEON
122 #define HAS_I422TORGBAROW_NEON
123 #define HAS_MIRRORROW_NEON
124 #define HAS_MIRRORROWUV_NEON
125 #define HAS_SETROW_NEON
126 #define HAS_SPLITUV_NEON
127 #define HAS_UYVYTOUV422ROW_NEON
128 #define HAS_UYVYTOUVROW_NEON
129 #define HAS_UYVYTOYROW_NEON
130 #define HAS_YUY2TOUV422ROW_NEON
131 #define HAS_YUY2TOUVROW_NEON
132 #define HAS_YUY2TOYROW_NEON
133 
134 // TODO(fbarchard): Hook these up to calling functions.
135 #define HAS_ABGRTOARGBROW_NEON
136 #define HAS_ARGBTORAWROW_NEON
137 #define HAS_ARGBTORGB24ROW_NEON
138 #define HAS_ARGBTORGBAROW_NEON
139 #define HAS_BGRATOARGBROW_NEON
140 #define HAS_NV12TOARGBROW_NEON
141 #define HAS_NV21TOARGBROW_NEON
142 #define HAS_RAWTOARGBROW_NEON
143 #define HAS_RGB24TOARGBROW_NEON
144 #define HAS_RGBATOARGBROW_NEON
145 #endif
146 
147 #if defined(_MSC_VER) && !defined(__CLR_VER)
148 #define SIMD_ALIGNED(var) __declspec(align(16)) var
149 typedef __declspec(align(16)) int8 vec8[16];
150 typedef __declspec(align(16)) uint8 uvec8[16];
151 typedef __declspec(align(16)) int16 vec16[8];
152 typedef __declspec(align(16)) uint16 uvec16[8];
153 typedef __declspec(align(16)) int32 vec32[4];
154 typedef __declspec(align(16)) uint32 uvec32[4];
155 #elif defined(__GNUC__)
156 #define SIMD_ALIGNED(var) var __attribute__((aligned(16)))
157 typedef int8 __attribute__((vector_size(16))) vec8;
158 typedef uint8 __attribute__((vector_size(16))) uvec8;
159 typedef int16 __attribute__((vector_size(16))) vec16;
160 typedef uint16 __attribute__((vector_size(16))) uvec16;
161 typedef int32 __attribute__((vector_size(16))) vec32;
162 typedef uint32 __attribute__((vector_size(16))) uvec32;
163 #else
164 #define SIMD_ALIGNED(var) var
165 typedef int8 vec8[16];
166 typedef uint8 uvec8[16];
167 typedef int16 vec16[8];
168 typedef uint16 uvec16[8];
169 typedef int32 vec32[4];
170 typedef uint32 uvec32[4];
171 #endif
172 
173 #if defined(__APPLE__) || defined(__x86_64__) || defined(__llvm__)
174 #define OMITFP
175 #else
176 #define OMITFP __attribute__((optimize("omit-frame-pointer")))
177 #endif
178 
179 void I422ToARGBRow_NEON(const uint8* y_buf,
180                         const uint8* u_buf,
181                         const uint8* v_buf,
182                         uint8* rgb_buf,
183                         int width);
184 void I422ToBGRARow_NEON(const uint8* y_buf,
185                         const uint8* u_buf,
186                         const uint8* v_buf,
187                         uint8* rgb_buf,
188                         int width);
189 void I422ToABGRRow_NEON(const uint8* y_buf,
190                         const uint8* u_buf,
191                         const uint8* v_buf,
192                         uint8* rgb_buf,
193                         int width);
194 void I422ToRGBARow_NEON(const uint8* y_buf,
195                         const uint8* u_buf,
196                         const uint8* v_buf,
197                         uint8* rgb_buf,
198                         int width);
199 void I422ToRGB24Row_NEON(const uint8* y_buf,
200                          const uint8* u_buf,
201                          const uint8* v_buf,
202                          uint8* rgb_buf,
203                          int width);
204 void I422ToRAWRow_NEON(const uint8* y_buf,
205                        const uint8* u_buf,
206                        const uint8* v_buf,
207                        uint8* rgb_buf,
208                        int width);
209 void NV12ToARGBRow_NEON(const uint8* y_buf,
210                         const uint8* uv_buf,
211                         uint8* rgb_buf,
212                         int width);
213 void NV21ToARGBRow_NEON(const uint8* y_buf,
214                         const uint8* uv_buf,
215                         uint8* rgb_buf,
216                         int width);
217 
218 void ARGBToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
219 void BGRAToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
220 void ABGRToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
221 void RGBAToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
222 void ARGBToYRow_Unaligned_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
223 void BGRAToYRow_Unaligned_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
224 void ABGRToYRow_Unaligned_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
225 void RGBAToYRow_Unaligned_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
226 
227 void ARGBToUVRow_SSSE3(const uint8* src_argb0, int src_stride_argb,
228                        uint8* dst_u, uint8* dst_v, int width);
229 void BGRAToUVRow_SSSE3(const uint8* src_argb0, int src_stride_argb,
230                        uint8* dst_u, uint8* dst_v, int width);
231 void ABGRToUVRow_SSSE3(const uint8* src_argb0, int src_stride_argb,
232                        uint8* dst_u, uint8* dst_v, int width);
233 void RGBAToUVRow_SSSE3(const uint8* src_argb0, int src_stride_argb,
234                        uint8* dst_u, uint8* dst_v, int width);
235 void ARGBToUVRow_Unaligned_SSSE3(const uint8* src_argb0, int src_stride_argb,
236                                  uint8* dst_u, uint8* dst_v, int width);
237 void BGRAToUVRow_Unaligned_SSSE3(const uint8* src_argb0, int src_stride_argb,
238                                  uint8* dst_u, uint8* dst_v, int width);
239 void ABGRToUVRow_Unaligned_SSSE3(const uint8* src_argb0, int src_stride_argb,
240                                  uint8* dst_u, uint8* dst_v, int width);
241 void RGBAToUVRow_Unaligned_SSSE3(const uint8* src_argb0, int src_stride_argb,
242                                  uint8* dst_u, uint8* dst_v, int width);
243 
244 void MirrorRow_SSSE3(const uint8* src, uint8* dst, int width);
245 void MirrorRow_SSE2(const uint8* src, uint8* dst, int width);
246 void MirrorRow_NEON(const uint8* src, uint8* dst, int width);
247 void MirrorRow_C(const uint8* src, uint8* dst, int width);
248 
249 void MirrorRowUV_SSSE3(const uint8* src, uint8* dst_u, uint8* dst_v, int width);
250 void MirrorRowUV_NEON(const uint8* src, uint8* dst_u, uint8* dst_v, int width);
251 void MirrorRowUV_C(const uint8* src, uint8* dst_u, uint8* dst_v, int width);
252 
253 void ARGBMirrorRow_SSSE3(const uint8* src, uint8* dst, int width);
254 void ARGBMirrorRow_C(const uint8* src, uint8* dst, int width);
255 
256 void SplitUV_SSE2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
257 void SplitUV_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
258 void SplitUV_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
259 
260 void CopyRow_SSE2(const uint8* src, uint8* dst, int count);
261 void CopyRow_X86(const uint8* src, uint8* dst, int count);
262 void CopyRow_NEON(const uint8* src, uint8* dst, int count);
263 void CopyRow_C(const uint8* src, uint8* dst, int count);
264 
265 void SetRow8_X86(uint8* dst, uint32 v32, int count);
266 void SetRows32_X86(uint8* dst, uint32 v32, int width,
267                    int dst_stride, int height);
268 void SetRow8_NEON(uint8* dst, uint32 v32, int count);
269 void SetRows32_NEON(uint8* dst, uint32 v32, int width,
270                     int dst_stride, int height);
271 void SetRow8_C(uint8* dst, uint32 v32, int count);
272 void SetRows32_C(uint8* dst, uint32 v32, int width, int dst_stride, int height);
273 
274 void ARGBToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
275 void BGRAToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
276 void ABGRToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
277 void RGBAToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
278 
279 void ARGBToUVRow_C(const uint8* src_argb0, int src_stride_argb,
280                    uint8* dst_u, uint8* dst_v, int width);
281 void BGRAToUVRow_C(const uint8* src_argb0, int src_stride_argb,
282                    uint8* dst_u, uint8* dst_v, int width);
283 void ABGRToUVRow_C(const uint8* src_argb0, int src_stride_argb,
284                    uint8* dst_u, uint8* dst_v, int width);
285 void RGBAToUVRow_C(const uint8* src_argb0, int src_stride_argb,
286                    uint8* dst_u, uint8* dst_v, int width);
287 
288 void BGRAToARGBRow_SSSE3(const uint8* src_bgra, uint8* dst_argb, int pix);
289 void ABGRToARGBRow_SSSE3(const uint8* src_abgr, uint8* dst_argb, int pix);
290 void RGBAToARGBRow_SSSE3(const uint8* src_rgba, uint8* dst_argb, int pix);
291 void RGB24ToARGBRow_SSSE3(const uint8* src_rgb24, uint8* dst_argb, int pix);
292 void RAWToARGBRow_SSSE3(const uint8* src_rgb24, uint8* dst_argb, int pix);
293 void ARGB1555ToARGBRow_SSE2(const uint8* src_argb, uint8* dst_argb, int pix);
294 void RGB565ToARGBRow_SSE2(const uint8* src_argb, uint8* dst_argb, int pix);
295 void ARGB4444ToARGBRow_SSE2(const uint8* src_argb, uint8* dst_argb, int pix);
296 
297 void BGRAToARGBRow_NEON(const uint8* src_bgra, uint8* dst_argb, int pix);
298 void ABGRToARGBRow_NEON(const uint8* src_abgr, uint8* dst_argb, int pix);
299 void RGBAToARGBRow_NEON(const uint8* src_rgba, uint8* dst_argb, int pix);
300 void RGB24ToARGBRow_NEON(const uint8* src_rgb24, uint8* dst_argb, int pix);
301 void RAWToARGBRow_NEON(const uint8* src_rgb24, uint8* dst_argb, int pix);
302 
303 void BGRAToARGBRow_C(const uint8* src_bgra, uint8* dst_argb, int pix);
304 void ABGRToARGBRow_C(const uint8* src_abgr, uint8* dst_argb, int pix);
305 void RGBAToARGBRow_C(const uint8* src_rgba, uint8* dst_argb, int pix);
306 void RGB24ToARGBRow_C(const uint8* src_rgb24, uint8* dst_argb, int pix);
307 void RAWToARGBRow_C(const uint8* src_rgb24, uint8* dst_argb, int pix);
308 void RGB565ToARGBRow_C(const uint8* src_rgb, uint8* dst_argb, int pix);
309 void ARGB1555ToARGBRow_C(const uint8* src_argb, uint8* dst_argb, int pix);
310 void ARGB4444ToARGBRow_C(const uint8* src_argb, uint8* dst_argb, int pix);
311 
312 void ARGBToRGBARow_SSSE3(const uint8* src_argb, uint8* dst_rgb, int pix);
313 void ARGBToRGB24Row_SSSE3(const uint8* src_argb, uint8* dst_rgb, int pix);
314 void ARGBToRAWRow_SSSE3(const uint8* src_argb, uint8* dst_rgb, int pix);
315 void ARGBToRGB565Row_SSE2(const uint8* src_argb, uint8* dst_rgb, int pix);
316 void ARGBToARGB1555Row_SSE2(const uint8* src_argb, uint8* dst_rgb, int pix);
317 void ARGBToARGB4444Row_SSE2(const uint8* src_argb, uint8* dst_rgb, int pix);
318 
319 void ARGBToRGBARow_NEON(const uint8* src_argb, uint8* dst_rgb, int pix);
320 void ARGBToRGB24Row_NEON(const uint8* src_argb, uint8* dst_rgb, int pix);
321 void ARGBToRAWRow_NEON(const uint8* src_argb, uint8* dst_rgb, int pix);
322 
323 void ARGBToRGBARow_C(const uint8* src_argb, uint8* dst_rgb, int pix);
324 void ARGBToRGB24Row_C(const uint8* src_argb, uint8* dst_rgb, int pix);
325 void ARGBToRAWRow_C(const uint8* src_argb, uint8* dst_rgb, int pix);
326 void ARGBToRGB565Row_C(const uint8* src_argb, uint8* dst_rgb, int pix);
327 void ARGBToARGB1555Row_C(const uint8* src_argb, uint8* dst_rgb, int pix);
328 void ARGBToARGB4444Row_C(const uint8* src_argb, uint8* dst_rgb, int pix);
329 
330 void I400ToARGBRow_SSE2(const uint8* src_y, uint8* dst_argb, int pix);
331 void I400ToARGBRow_C(const uint8* src_y, uint8* dst_argb, int pix);
332 
333 void I444ToARGBRow_C(const uint8* y_buf,
334                      const uint8* u_buf,
335                      const uint8* v_buf,
336                      uint8* argb_buf,
337                      int width);
338 
339 void I422ToARGBRow_C(const uint8* y_buf,
340                      const uint8* u_buf,
341                      const uint8* v_buf,
342                      uint8* argb_buf,
343                      int width);
344 
345 void I411ToARGBRow_C(const uint8* y_buf,
346                      const uint8* u_buf,
347                      const uint8* v_buf,
348                      uint8* rgb_buf,
349                      int width);
350 
351 void NV12ToARGBRow_C(const uint8* y_buf,
352                      const uint8* uv_buf,
353                      uint8* argb_buf,
354                      int width);
355 
356 void NV21ToARGBRow_C(const uint8* y_buf,
357                      const uint8* vu_buf,
358                      uint8* argb_buf,
359                      int width);
360 
361 void I422ToBGRARow_C(const uint8* y_buf,
362                      const uint8* u_buf,
363                      const uint8* v_buf,
364                      uint8* bgra_buf,
365                      int width);
366 
367 void I422ToABGRRow_C(const uint8* y_buf,
368                      const uint8* u_buf,
369                      const uint8* v_buf,
370                      uint8* abgr_buf,
371                      int width);
372 
373 void I422ToRGBARow_C(const uint8* y_buf,
374                      const uint8* u_buf,
375                      const uint8* v_buf,
376                      uint8* rgba_buf,
377                      int width);
378 void I422ToRGB24Row_C(const uint8* y_buf,
379                       const uint8* u_buf,
380                       const uint8* v_buf,
381                       uint8* rgb24_buf,
382                       int width);
383 void I422ToRAWRow_C(const uint8* y_buf,
384                     const uint8* u_buf,
385                     const uint8* v_buf,
386                     uint8* raw_buf,
387                     int width);
388 
389 void YToARGBRow_C(const uint8* y_buf,
390                   uint8* rgb_buf,
391                   int width);
392 
393 void I444ToARGBRow_SSSE3(const uint8* y_buf,
394                          const uint8* u_buf,
395                          const uint8* v_buf,
396                          uint8* argb_buf,
397                          int width);
398 
399 void I422ToARGBRow_SSSE3(const uint8* y_buf,
400                          const uint8* u_buf,
401                          const uint8* v_buf,
402                          uint8* argb_buf,
403                          int width);
404 
405 void I411ToARGBRow_SSSE3(const uint8* y_buf,
406                          const uint8* u_buf,
407                          const uint8* v_buf,
408                          uint8* rgb_buf,
409                          int width);
410 
411 void NV12ToARGBRow_SSSE3(const uint8* y_buf,
412                          const uint8* uv_buf,
413                          uint8* argb_buf,
414                          int width);
415 
416 void NV21ToARGBRow_SSSE3(const uint8* y_buf,
417                          const uint8* vu_buf,
418                          uint8* argb_buf,
419                          int width);
420 
421 void I422ToBGRARow_SSSE3(const uint8* y_buf,
422                          const uint8* u_buf,
423                          const uint8* v_buf,
424                          uint8* bgra_buf,
425                          int width);
426 
427 void I422ToABGRRow_SSSE3(const uint8* y_buf,
428                          const uint8* u_buf,
429                          const uint8* v_buf,
430                          uint8* abgr_buf,
431                          int width);
432 
433 void I422ToRGBARow_SSSE3(const uint8* y_buf,
434                          const uint8* u_buf,
435                          const uint8* v_buf,
436                          uint8* rgba_buf,
437                          int width);
438 
439 void I444ToARGBRow_Unaligned_SSSE3(const uint8* y_buf,
440                                    const uint8* u_buf,
441                                    const uint8* v_buf,
442                                    uint8* argb_buf,
443                                    int width);
444 
445 void I422ToARGBRow_Unaligned_SSSE3(const uint8* y_buf,
446                                    const uint8* u_buf,
447                                    const uint8* v_buf,
448                                    uint8* argb_buf,
449                                    int width);
450 
451 void I411ToARGBRow_Unaligned_SSSE3(const uint8* y_buf,
452                                    const uint8* u_buf,
453                                    const uint8* v_buf,
454                                    uint8* rgb_buf,
455                                    int width);
456 
457 void NV12ToARGBRow_Unaligned_SSSE3(const uint8* y_buf,
458                                    const uint8* uv_buf,
459                                    uint8* argb_buf,
460                                    int width);
461 
462 void NV21ToARGBRow_Unaligned_SSSE3(const uint8* y_buf,
463                                    const uint8* vu_buf,
464                                    uint8* argb_buf,
465                                    int width);
466 
467 void I422ToBGRARow_Unaligned_SSSE3(const uint8* y_buf,
468                                    const uint8* u_buf,
469                                    const uint8* v_buf,
470                                    uint8* bgra_buf,
471                                    int width);
472 
473 void I422ToABGRRow_Unaligned_SSSE3(const uint8* y_buf,
474                                    const uint8* u_buf,
475                                    const uint8* v_buf,
476                                    uint8* abgr_buf,
477                                    int width);
478 
479 void I422ToRGBARow_Unaligned_SSSE3(const uint8* y_buf,
480                                    const uint8* u_buf,
481                                    const uint8* v_buf,
482                                    uint8* rgba_buf,
483                                    int width);
484 
485 void I444ToARGBRow_Any_SSSE3(const uint8* y_buf,
486                              const uint8* u_buf,
487                              const uint8* v_buf,
488                              uint8* argb_buf,
489                              int width);
490 
491 void I422ToARGBRow_Any_SSSE3(const uint8* y_buf,
492                              const uint8* u_buf,
493                              const uint8* v_buf,
494                              uint8* argb_buf,
495                              int width);
496 
497 void I411ToARGBRow_Any_SSSE3(const uint8* y_buf,
498                              const uint8* u_buf,
499                              const uint8* v_buf,
500                              uint8* rgb_buf,
501                              int width);
502 
503 void NV12ToARGBRow_Any_SSSE3(const uint8* y_buf,
504                              const uint8* uv_buf,
505                              uint8* argb_buf,
506                              int width);
507 
508 void NV21ToARGBRow_Any_SSSE3(const uint8* y_buf,
509                              const uint8* vu_buf,
510                              uint8* argb_buf,
511                              int width);
512 
513 void I422ToBGRARow_Any_SSSE3(const uint8* y_buf,
514                              const uint8* u_buf,
515                              const uint8* v_buf,
516                              uint8* bgra_buf,
517                              int width);
518 
519 void I422ToABGRRow_Any_SSSE3(const uint8* y_buf,
520                              const uint8* u_buf,
521                              const uint8* v_buf,
522                              uint8* abgr_buf,
523                              int width);
524 
525 void I422ToRGBARow_Any_SSSE3(const uint8* y_buf,
526                              const uint8* u_buf,
527                              const uint8* v_buf,
528                              uint8* rgba_buf,
529                              int width);
530 
531 void YToARGBRow_SSE2(const uint8* y_buf,
532                      uint8* argb_buf,
533                      int width);
534 
535 // ARGB preattenuated alpha blend.
536 void ARGBBlendRow_SSSE3(const uint8* src_argb0, const uint8* src_argb1,
537                         uint8* dst_argb, int width);
538 void ARGBBlendRow_SSE2(const uint8* src_argb0, const uint8* src_argb1,
539                        uint8* dst_argb, int width);
540 void ARGBBlendRow_C(const uint8* src_argb0, const uint8* src_argb1,
541                     uint8* dst_argb, int width);
542 
543 void ARGBToRGB24Row_Any_SSSE3(const uint8* src_argb, uint8* dst_rgb, int pix);
544 void ARGBToRAWRow_Any_SSSE3(const uint8* src_argb, uint8* dst_rgb, int pix);
545 void ARGBToRGB565Row_Any_SSE2(const uint8* src_argb, uint8* dst_rgb, int pix);
546 void ARGBToARGB1555Row_Any_SSE2(const uint8* src_argb, uint8* dst_rgb, int pix);
547 void ARGBToARGB4444Row_Any_SSE2(const uint8* src_argb, uint8* dst_rgb, int pix);
548 
549 void ARGBToRGB24Row_Any_NEON(const uint8* src_argb, uint8* dst_rgb, int pix);
550 void ARGBToRAWRow_Any_NEON(const uint8* src_argb, uint8* dst_rgb, int pix);
551 
552 void ARGBToYRow_Any_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
553 void BGRAToYRow_Any_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
554 void ABGRToYRow_Any_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
555 void RGBAToYRow_Any_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
556 void ARGBToUVRow_Any_SSSE3(const uint8* src_argb0, int src_stride_argb,
557                            uint8* dst_u, uint8* dst_v, int width);
558 void BGRAToUVRow_Any_SSSE3(const uint8* src_argb0, int src_stride_argb,
559                            uint8* dst_u, uint8* dst_v, int width);
560 void ABGRToUVRow_Any_SSSE3(const uint8* src_argb0, int src_stride_argb,
561                            uint8* dst_u, uint8* dst_v, int width);
562 void RGBAToUVRow_Any_SSSE3(const uint8* src_argb0, int src_stride_argb,
563                            uint8* dst_u, uint8* dst_v, int width);
564 void I422ToARGBRow_Any_NEON(const uint8* y_buf,
565                             const uint8* u_buf,
566                             const uint8* v_buf,
567                             uint8* rgb_buf,
568                             int width);
569 void I422ToBGRARow_Any_NEON(const uint8* y_buf,
570                             const uint8* u_buf,
571                             const uint8* v_buf,
572                             uint8* rgb_buf,
573                             int width);
574 void I422ToABGRRow_Any_NEON(const uint8* y_buf,
575                             const uint8* u_buf,
576                             const uint8* v_buf,
577                             uint8* rgb_buf,
578                             int width);
579 void I422ToRGBARow_Any_NEON(const uint8* y_buf,
580                             const uint8* u_buf,
581                             const uint8* v_buf,
582                             uint8* rgb_buf,
583                             int width);
584 void I422ToRGB24Row_Any_NEON(const uint8* y_buf,
585                              const uint8* u_buf,
586                              const uint8* v_buf,
587                              uint8* rgb_buf,
588                              int width);
589 void I422ToRAWRow_Any_NEON(const uint8* y_buf,
590                            const uint8* u_buf,
591                            const uint8* v_buf,
592                            uint8* rgb_buf,
593                            int width);
594 void NV12ToARGBRow_Any_NEON(const uint8* y_buf,
595                             const uint8* uv_buf,
596                             uint8* argb_buf,
597                             int width);
598 void NV21ToARGBRow_Any_NEON(const uint8* y_buf,
599                             const uint8* uv_buf,
600                             uint8* argb_buf,
601                             int width);
602 
603 void YUY2ToYRow_SSE2(const uint8* src_yuy2, uint8* dst_y, int pix);
604 void YUY2ToUVRow_SSE2(const uint8* src_yuy2, int stride_yuy2,
605                       uint8* dst_u, uint8* dst_v, int pix);
606 void YUY2ToUV422Row_SSE2(const uint8* src_yuy2,
607                          uint8* dst_u, uint8* dst_v, int pix);
608 void YUY2ToYRow_Unaligned_SSE2(const uint8* src_yuy2,
609                                uint8* dst_y, int pix);
610 void YUY2ToUVRow_Unaligned_SSE2(const uint8* src_yuy2, int stride_yuy2,
611                                 uint8* dst_u, uint8* dst_v, int pix);
612 void YUY2ToUV422Row_Unaligned_SSE2(const uint8* src_yuy2,
613                                    uint8* dst_u, uint8* dst_v, int pix);
614 void YUY2ToYRow_NEON(const uint8* src_yuy2, uint8* dst_y, int pix);
615 void YUY2ToUVRow_NEON(const uint8* src_yuy2, int stride_yuy2,
616                       uint8* dst_u, uint8* dst_v, int pix);
617 void YUY2ToUV422Row_NEON(const uint8* src_yuy2,
618                          uint8* dst_u, uint8* dst_v, int pix);
619 void YUY2ToYRow_C(const uint8* src_yuy2, uint8* dst_y, int pix);
620 void YUY2ToUVRow_C(const uint8* src_yuy2, int stride_yuy2,
621                    uint8* dst_u, uint8* dst_v, int pix);
622 void YUY2ToUV422Row_C(const uint8* src_yuy2,
623                       uint8* dst_u, uint8* dst_v, int pix);
624 void YUY2ToYRow_Any_SSE2(const uint8* src_yuy2, uint8* dst_y, int pix);
625 void YUY2ToUVRow_Any_SSE2(const uint8* src_yuy2, int stride_yuy2,
626                           uint8* dst_u, uint8* dst_v, int pix);
627 void YUY2ToUV422Row_Any_SSE2(const uint8* src_yuy2,
628                              uint8* dst_u, uint8* dst_v, int pix);
629 void YUY2ToYRow_Any_NEON(const uint8* src_yuy2, uint8* dst_y, int pix);
630 void YUY2ToUVRow_Any_NEON(const uint8* src_yuy2, int stride_yuy2,
631                           uint8* dst_u, uint8* dst_v, int pix);
632 void YUY2ToUV422Row_Any_NEON(const uint8* src_yuy2,
633                              uint8* dst_u, uint8* dst_v, int pix);
634 
635 void UYVYToYRow_SSE2(const uint8* src_uyvy, uint8* dst_y, int pix);
636 void UYVYToUVRow_SSE2(const uint8* src_uyvy, int stride_uyvy,
637                       uint8* dst_u, uint8* dst_v, int pix);
638 void UYVYToUV422Row_SSE2(const uint8* src_uyvy,
639                          uint8* dst_u, uint8* dst_v, int pix);
640 void UYVYToYRow_Unaligned_SSE2(const uint8* src_uyvy,
641                                uint8* dst_y, int pix);
642 void UYVYToUVRow_Unaligned_SSE2(const uint8* src_uyvy, int stride_uyvy,
643                                 uint8* dst_u, uint8* dst_v, int pix);
644 void UYVYToUV422Row_Unaligned_SSE2(const uint8* src_uyvy,
645                                    uint8* dst_u, uint8* dst_v, int pix);
646 void UYVYToYRow_NEON(const uint8* src_uyvy, uint8* dst_y, int pix);
647 void UYVYToUVRow_NEON(const uint8* src_uyvy, int stride_uyvy,
648                       uint8* dst_u, uint8* dst_v, int pix);
649 void UYVYToUV422Row_NEON(const uint8* src_uyvy,
650                          uint8* dst_u, uint8* dst_v, int pix);
651 
652 void UYVYToYRow_C(const uint8* src_uyvy, uint8* dst_y, int pix);
653 void UYVYToUVRow_C(const uint8* src_uyvy, int stride_uyvy,
654                    uint8* dst_u, uint8* dst_v, int pix);
655 void UYVYToUV422Row_C(const uint8* src_uyvy,
656                       uint8* dst_u, uint8* dst_v, int pix);
657 void UYVYToYRow_Any_SSE2(const uint8* src_uyvy, uint8* dst_y, int pix);
658 void UYVYToUVRow_Any_SSE2(const uint8* src_uyvy, int stride_uyvy,
659                           uint8* dst_u, uint8* dst_v, int pix);
660 void UYVYToUV422Row_Any_SSE2(const uint8* src_uyvy,
661                              uint8* dst_u, uint8* dst_v, int pix);
662 void UYVYToYRow_Any_NEON(const uint8* src_uyvy, uint8* dst_y, int pix);
663 void UYVYToUVRow_Any_NEON(const uint8* src_uyvy, int stride_uyvy,
664                           uint8* dst_u, uint8* dst_v, int pix);
665 void UYVYToUV422Row_Any_NEON(const uint8* src_uyvy,
666                              uint8* dst_u, uint8* dst_v, int pix);
667 
668 void ARGBAttenuateRow_C(const uint8* src_argb, uint8* dst_argb, int width);
669 void ARGBAttenuateRow_SSE2(const uint8* src_argb, uint8* dst_argb, int width);
670 void ARGBAttenuateRow_SSSE3(const uint8* src_argb, uint8* dst_argb, int width);
671 
672 // Inverse table for unattenuate, shared by C and SSE2.
673 extern uint32 fixed_invtbl8[256];
674 void ARGBUnattenuateRow_C(const uint8* src_argb, uint8* dst_argb, int width);
675 void ARGBUnattenuateRow_SSE2(const uint8* src_argb, uint8* dst_argb, int width);
676 
677 void ARGBGrayRow_C(const uint8* src_argb, uint8* dst_argb, int width);
678 void ARGBGrayRow_SSSE3(const uint8* src_argb, uint8* dst_argb, int width);
679 
680 void ARGBSepiaRow_C(uint8* dst_argb, int width);
681 void ARGBSepiaRow_SSSE3(uint8* dst_argb, int width);
682 
683 void ARGBColorMatrixRow_C(uint8* dst_argb, const int8* matrix_argb, int width);
684 void ARGBColorMatrixRow_SSSE3(uint8* dst_argb, const int8* matrix_argb,
685                               int width);
686 
687 void ARGBColorTableRow_C(uint8* dst_argb, const uint8* table_argb, int width);
688 void ARGBColorTableRow_X86(uint8* dst_argb, const uint8* table_argb, int width);
689 
690 void ARGBQuantizeRow_C(uint8* dst_argb, int scale, int interval_size,
691                        int interval_offset, int width);
692 void ARGBQuantizeRow_SSE2(uint8* dst_argb, int scale, int interval_size,
693                           int interval_offset, int width);
694 
695 // Used for blur.
696 void CumulativeSumToAverage_SSE2(const int32* topleft, const int32* botleft,
697                                  int width, int area, uint8* dst, int count);
698 void ComputeCumulativeSumRow_SSE2(const uint8* row, int32* cumsum,
699                                   const int32* previous_cumsum, int width);
700 
701 void CumulativeSumToAverage_C(const int32* topleft, const int32* botleft,
702                               int width, int area, uint8* dst, int count);
703 void ComputeCumulativeSumRow_C(const uint8* row, int32* cumsum,
704                                const int32* previous_cumsum, int width);
705 
706 void ARGBShadeRow_C(const uint8* src_argb, uint8* dst_argb, int width,
707                     uint32 value);
708 void ARGBShadeRow_SSE2(const uint8* src_argb, uint8* dst_argb, int width,
709                        uint32 value);
710 
711 LIBYUV_API
712 void ARGBAffineRow_C(const uint8* src_argb, int src_argb_stride,
713                      uint8* dst_argb, const float* uv_dudv, int width);
714 LIBYUV_API
715 void ARGBAffineRow_SSE2(const uint8* src_argb, int src_argb_stride,
716                         uint8* dst_argb, const float* uv_dudv, int width);
717 
718 void ARGBInterpolateRow_C(uint8* dst_ptr, const uint8* src_ptr,
719                           ptrdiff_t src_stride,
720                           int dst_width, int source_y_fraction);
721 void ARGBInterpolateRow_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
722                               ptrdiff_t src_stride, int dst_width,
723                               int source_y_fraction);
724 
725 #ifdef __cplusplus
726 }  // extern "C"
727 }  // namespace libyuv
728 #endif
729 
730 #endif  // INCLUDE_LIBYUV_ROW_H_  NOLINT
731 
732