OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 width * 4, height); | 43 width * 4, height); |
44 return 0; | 44 return 0; |
45 } | 45 } |
46 | 46 |
47 // Convert I444 to ARGB. | 47 // Convert I444 to ARGB. |
48 LIBYUV_API | 48 LIBYUV_API |
49 static int I444ToARGBMatrix(const uint8* src_y, int src_stride_y, | 49 static int I444ToARGBMatrix(const uint8* src_y, int src_stride_y, |
50 const uint8* src_u, int src_stride_u, | 50 const uint8* src_u, int src_stride_u, |
51 const uint8* src_v, int src_stride_v, | 51 const uint8* src_v, int src_stride_v, |
52 uint8* dst_argb, int dst_stride_argb, | 52 uint8* dst_argb, int dst_stride_argb, |
53 struct YuvConstants* yuvconstants, | 53 const struct YuvConstants* yuvconstants, |
54 int width, int height) { | 54 int width, int height) { |
55 int y; | 55 int y; |
56 void (*I444ToARGBRow)(const uint8* y_buf, | 56 void (*I444ToARGBRow)(const uint8* y_buf, |
57 const uint8* u_buf, | 57 const uint8* u_buf, |
58 const uint8* v_buf, | 58 const uint8* v_buf, |
59 uint8* rgb_buf, | 59 uint8* rgb_buf, |
60 struct YuvConstants* yuvconstants, | 60 const struct YuvConstants* yuvconstants, |
61 int width) = I444ToARGBRow_C; | 61 int width) = I444ToARGBRow_C; |
62 if (!src_y || !src_u || !src_v || | 62 if (!src_y || !src_u || !src_v || |
63 !dst_argb || | 63 !dst_argb || |
64 width <= 0 || height == 0) { | 64 width <= 0 || height == 0) { |
65 return -1; | 65 return -1; |
66 } | 66 } |
67 // Negative height means invert the image. | 67 // Negative height means invert the image. |
68 if (height < 0) { | 68 if (height < 0) { |
69 height = -height; | 69 height = -height; |
70 dst_argb = dst_argb + (height - 1) * dst_stride_argb; | 70 dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 LIBYUV_API | 118 LIBYUV_API |
119 int I444ToARGB(const uint8* src_y, int src_stride_y, | 119 int I444ToARGB(const uint8* src_y, int src_stride_y, |
120 const uint8* src_u, int src_stride_u, | 120 const uint8* src_u, int src_stride_u, |
121 const uint8* src_v, int src_stride_v, | 121 const uint8* src_v, int src_stride_v, |
122 uint8* dst_argb, int dst_stride_argb, | 122 uint8* dst_argb, int dst_stride_argb, |
123 int width, int height) { | 123 int width, int height) { |
124 return I444ToARGBMatrix(src_y, src_stride_y, | 124 return I444ToARGBMatrix(src_y, src_stride_y, |
125 src_u, src_stride_u, | 125 src_u, src_stride_u, |
126 src_v, src_stride_v, | 126 src_v, src_stride_v, |
127 dst_argb, dst_stride_argb, | 127 dst_argb, dst_stride_argb, |
128 &kYuvConstants, | 128 &kYuvIConstants, |
129 width, height); | 129 width, height); |
130 } | 130 } |
131 | 131 |
132 | 132 |
133 // Convert J444 to ARGB. | 133 // Convert J444 to ARGB. |
134 LIBYUV_API | 134 LIBYUV_API |
135 int J444ToARGB(const uint8* src_y, int src_stride_y, | 135 int J444ToARGB(const uint8* src_y, int src_stride_y, |
136 const uint8* src_u, int src_stride_u, | 136 const uint8* src_u, int src_stride_u, |
137 const uint8* src_v, int src_stride_v, | 137 const uint8* src_v, int src_stride_v, |
138 uint8* dst_argb, int dst_stride_argb, | 138 uint8* dst_argb, int dst_stride_argb, |
(...skipping 12 matching lines...) Expand all Loading... |
151 int I444ToABGR(const uint8* src_y, int src_stride_y, | 151 int I444ToABGR(const uint8* src_y, int src_stride_y, |
152 const uint8* src_u, int src_stride_u, | 152 const uint8* src_u, int src_stride_u, |
153 const uint8* src_v, int src_stride_v, | 153 const uint8* src_v, int src_stride_v, |
154 uint8* dst_abgr, int dst_stride_abgr, | 154 uint8* dst_abgr, int dst_stride_abgr, |
155 int width, int height) { | 155 int width, int height) { |
156 int y; | 156 int y; |
157 void (*I444ToABGRRow)(const uint8* y_buf, | 157 void (*I444ToABGRRow)(const uint8* y_buf, |
158 const uint8* u_buf, | 158 const uint8* u_buf, |
159 const uint8* v_buf, | 159 const uint8* v_buf, |
160 uint8* rgb_buf, | 160 uint8* rgb_buf, |
161 struct YuvConstants* yuvconstants, | 161 const struct YuvConstants* yuvconstants, |
162 int width) = I444ToABGRRow_C; | 162 int width) = I444ToABGRRow_C; |
163 if (!src_y || !src_u || !src_v || | 163 if (!src_y || !src_u || !src_v || |
164 !dst_abgr || | 164 !dst_abgr || |
165 width <= 0 || height == 0) { | 165 width <= 0 || height == 0) { |
166 return -1; | 166 return -1; |
167 } | 167 } |
168 // Negative height means invert the image. | 168 // Negative height means invert the image. |
169 if (height < 0) { | 169 if (height < 0) { |
170 height = -height; | 170 height = -height; |
171 dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr; | 171 dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr; |
(...skipping 27 matching lines...) Expand all Loading... |
199 #if defined(HAS_I444TOABGRROW_NEON) | 199 #if defined(HAS_I444TOABGRROW_NEON) |
200 if (TestCpuFlag(kCpuHasNEON)) { | 200 if (TestCpuFlag(kCpuHasNEON)) { |
201 I444ToABGRRow = I444ToABGRRow_Any_NEON; | 201 I444ToABGRRow = I444ToABGRRow_Any_NEON; |
202 if (IS_ALIGNED(width, 8)) { | 202 if (IS_ALIGNED(width, 8)) { |
203 I444ToABGRRow = I444ToABGRRow_NEON; | 203 I444ToABGRRow = I444ToABGRRow_NEON; |
204 } | 204 } |
205 } | 205 } |
206 #endif | 206 #endif |
207 | 207 |
208 for (y = 0; y < height; ++y) { | 208 for (y = 0; y < height; ++y) { |
209 I444ToABGRRow(src_y, src_u, src_v, dst_abgr, &kYuvConstants, width); | 209 I444ToABGRRow(src_y, src_u, src_v, dst_abgr, &kYuvIConstants, width); |
210 dst_abgr += dst_stride_abgr; | 210 dst_abgr += dst_stride_abgr; |
211 src_y += src_stride_y; | 211 src_y += src_stride_y; |
212 src_u += src_stride_u; | 212 src_u += src_stride_u; |
213 src_v += src_stride_v; | 213 src_v += src_stride_v; |
214 } | 214 } |
215 return 0; | 215 return 0; |
216 } | 216 } |
217 | 217 |
218 // Convert I422 to ARGB. | 218 // Convert I422 to ARGB. |
219 LIBYUV_API | 219 LIBYUV_API |
220 int I422ToARGB(const uint8* src_y, int src_stride_y, | 220 int I422ToARGB(const uint8* src_y, int src_stride_y, |
221 const uint8* src_u, int src_stride_u, | 221 const uint8* src_u, int src_stride_u, |
222 const uint8* src_v, int src_stride_v, | 222 const uint8* src_v, int src_stride_v, |
223 uint8* dst_argb, int dst_stride_argb, | 223 uint8* dst_argb, int dst_stride_argb, |
224 int width, int height) { | 224 int width, int height) { |
225 int y; | 225 int y; |
226 void (*I422ToARGBRow)(const uint8* y_buf, | 226 void (*I422ToARGBRow)(const uint8* y_buf, |
227 const uint8* u_buf, | 227 const uint8* u_buf, |
228 const uint8* v_buf, | 228 const uint8* v_buf, |
229 uint8* rgb_buf, | 229 uint8* rgb_buf, |
230 struct YuvConstants* yuvconstants, | 230 const struct YuvConstants* yuvconstants, |
231 int width) = I422ToARGBRow_C; | 231 int width) = I422ToARGBRow_C; |
232 if (!src_y || !src_u || !src_v || | 232 if (!src_y || !src_u || !src_v || |
233 !dst_argb || | 233 !dst_argb || |
234 width <= 0 || height == 0) { | 234 width <= 0 || height == 0) { |
235 return -1; | 235 return -1; |
236 } | 236 } |
237 // Negative height means invert the image. | 237 // Negative height means invert the image. |
238 if (height < 0) { | 238 if (height < 0) { |
239 height = -height; | 239 height = -height; |
240 dst_argb = dst_argb + (height - 1) * dst_stride_argb; | 240 dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(width, 4) && | 277 if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(width, 4) && |
278 IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) && | 278 IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) && |
279 IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) && | 279 IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) && |
280 IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2) && | 280 IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2) && |
281 IS_ALIGNED(dst_argb, 4) && IS_ALIGNED(dst_stride_argb, 4)) { | 281 IS_ALIGNED(dst_argb, 4) && IS_ALIGNED(dst_stride_argb, 4)) { |
282 I422ToARGBRow = I422ToARGBRow_MIPS_DSPR2; | 282 I422ToARGBRow = I422ToARGBRow_MIPS_DSPR2; |
283 } | 283 } |
284 #endif | 284 #endif |
285 | 285 |
286 for (y = 0; y < height; ++y) { | 286 for (y = 0; y < height; ++y) { |
287 I422ToARGBRow(src_y, src_u, src_v, dst_argb, &kYuvConstants, width); | 287 I422ToARGBRow(src_y, src_u, src_v, dst_argb, &kYuvIConstants, width); |
288 dst_argb += dst_stride_argb; | 288 dst_argb += dst_stride_argb; |
289 src_y += src_stride_y; | 289 src_y += src_stride_y; |
290 src_u += src_stride_u; | 290 src_u += src_stride_u; |
291 src_v += src_stride_v; | 291 src_v += src_stride_v; |
292 } | 292 } |
293 return 0; | 293 return 0; |
294 } | 294 } |
295 | 295 |
296 // Convert I411 to ARGB. | 296 // Convert I411 to ARGB. |
297 LIBYUV_API | 297 LIBYUV_API |
298 int I411ToARGB(const uint8* src_y, int src_stride_y, | 298 int I411ToARGB(const uint8* src_y, int src_stride_y, |
299 const uint8* src_u, int src_stride_u, | 299 const uint8* src_u, int src_stride_u, |
300 const uint8* src_v, int src_stride_v, | 300 const uint8* src_v, int src_stride_v, |
301 uint8* dst_argb, int dst_stride_argb, | 301 uint8* dst_argb, int dst_stride_argb, |
302 int width, int height) { | 302 int width, int height) { |
303 int y; | 303 int y; |
304 void (*I411ToARGBRow)(const uint8* y_buf, | 304 void (*I411ToARGBRow)(const uint8* y_buf, |
305 const uint8* u_buf, | 305 const uint8* u_buf, |
306 const uint8* v_buf, | 306 const uint8* v_buf, |
307 uint8* rgb_buf, | 307 uint8* rgb_buf, |
308 struct YuvConstants* yuvconstants, | 308 const struct YuvConstants* yuvconstants, |
309 int width) = I411ToARGBRow_C; | 309 int width) = I411ToARGBRow_C; |
310 if (!src_y || !src_u || !src_v || | 310 if (!src_y || !src_u || !src_v || |
311 !dst_argb || | 311 !dst_argb || |
312 width <= 0 || height == 0) { | 312 width <= 0 || height == 0) { |
313 return -1; | 313 return -1; |
314 } | 314 } |
315 // Negative height means invert the image. | 315 // Negative height means invert the image. |
316 if (height < 0) { | 316 if (height < 0) { |
317 height = -height; | 317 height = -height; |
318 dst_argb = dst_argb + (height - 1) * dst_stride_argb; | 318 dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
(...skipping 27 matching lines...) Expand all Loading... |
346 #if defined(HAS_I411TOARGBROW_NEON) | 346 #if defined(HAS_I411TOARGBROW_NEON) |
347 if (TestCpuFlag(kCpuHasNEON)) { | 347 if (TestCpuFlag(kCpuHasNEON)) { |
348 I411ToARGBRow = I411ToARGBRow_Any_NEON; | 348 I411ToARGBRow = I411ToARGBRow_Any_NEON; |
349 if (IS_ALIGNED(width, 8)) { | 349 if (IS_ALIGNED(width, 8)) { |
350 I411ToARGBRow = I411ToARGBRow_NEON; | 350 I411ToARGBRow = I411ToARGBRow_NEON; |
351 } | 351 } |
352 } | 352 } |
353 #endif | 353 #endif |
354 | 354 |
355 for (y = 0; y < height; ++y) { | 355 for (y = 0; y < height; ++y) { |
356 I411ToARGBRow(src_y, src_u, src_v, dst_argb, &kYuvConstants, width); | 356 I411ToARGBRow(src_y, src_u, src_v, dst_argb, &kYuvIConstants, width); |
357 dst_argb += dst_stride_argb; | 357 dst_argb += dst_stride_argb; |
358 src_y += src_stride_y; | 358 src_y += src_stride_y; |
359 src_u += src_stride_u; | 359 src_u += src_stride_u; |
360 src_v += src_stride_v; | 360 src_v += src_stride_v; |
361 } | 361 } |
362 return 0; | 362 return 0; |
363 } | 363 } |
364 | 364 |
365 // Convert I420 with Alpha to preattenuated ARGB. | 365 // Convert I420 with Alpha to preattenuated ARGB. |
366 LIBYUV_API | 366 LIBYUV_API |
367 int I420AlphaToARGB(const uint8* src_y, int src_stride_y, | 367 int I420AlphaToARGB(const uint8* src_y, int src_stride_y, |
368 const uint8* src_u, int src_stride_u, | 368 const uint8* src_u, int src_stride_u, |
369 const uint8* src_v, int src_stride_v, | 369 const uint8* src_v, int src_stride_v, |
370 const uint8* src_a, int src_stride_a, | 370 const uint8* src_a, int src_stride_a, |
371 uint8* dst_argb, int dst_stride_argb, | 371 uint8* dst_argb, int dst_stride_argb, |
372 int width, int height, int attenuate) { | 372 int width, int height, int attenuate) { |
373 int y; | 373 int y; |
374 void (*I422AlphaToARGBRow)(const uint8* y_buf, | 374 void (*I422AlphaToARGBRow)(const uint8* y_buf, |
375 const uint8* u_buf, | 375 const uint8* u_buf, |
376 const uint8* v_buf, | 376 const uint8* v_buf, |
377 const uint8* a_buf, | 377 const uint8* a_buf, |
378 uint8* dst_argb, | 378 uint8* dst_argb, |
379 struct YuvConstants* yuvconstants, | 379 const struct YuvConstants* yuvconstants, |
380 int width) = I422AlphaToARGBRow_C; | 380 int width) = I422AlphaToARGBRow_C; |
381 void (*ARGBAttenuateRow)(const uint8* src_argb, uint8* dst_argb, | 381 void (*ARGBAttenuateRow)(const uint8* src_argb, uint8* dst_argb, |
382 int width) = ARGBAttenuateRow_C; | 382 int width) = ARGBAttenuateRow_C; |
383 if (!src_y || !src_u || !src_v || !dst_argb || | 383 if (!src_y || !src_u || !src_v || !dst_argb || |
384 width <= 0 || height == 0) { | 384 width <= 0 || height == 0) { |
385 return -1; | 385 return -1; |
386 } | 386 } |
387 // Negative height means invert the image. | 387 // Negative height means invert the image. |
388 if (height < 0) { | 388 if (height < 0) { |
389 height = -height; | 389 height = -height; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 #if defined(HAS_ARGBATTENUATEROW_NEON) | 442 #if defined(HAS_ARGBATTENUATEROW_NEON) |
443 if (TestCpuFlag(kCpuHasNEON)) { | 443 if (TestCpuFlag(kCpuHasNEON)) { |
444 ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON; | 444 ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON; |
445 if (IS_ALIGNED(width, 8)) { | 445 if (IS_ALIGNED(width, 8)) { |
446 ARGBAttenuateRow = ARGBAttenuateRow_NEON; | 446 ARGBAttenuateRow = ARGBAttenuateRow_NEON; |
447 } | 447 } |
448 } | 448 } |
449 #endif | 449 #endif |
450 | 450 |
451 for (y = 0; y < height; ++y) { | 451 for (y = 0; y < height; ++y) { |
452 I422AlphaToARGBRow(src_y, src_u, src_v, src_a, dst_argb, &kYuvConstants, | 452 I422AlphaToARGBRow(src_y, src_u, src_v, src_a, dst_argb, &kYuvIConstants, |
453 width); | 453 width); |
454 if (attenuate) { | 454 if (attenuate) { |
455 ARGBAttenuateRow(dst_argb, dst_argb, width); | 455 ARGBAttenuateRow(dst_argb, dst_argb, width); |
456 } | 456 } |
457 dst_argb += dst_stride_argb; | 457 dst_argb += dst_stride_argb; |
458 src_a += src_stride_a; | 458 src_a += src_stride_a; |
459 src_y += src_stride_y; | 459 src_y += src_stride_y; |
460 if (y & 1) { | 460 if (y & 1) { |
461 src_u += src_stride_u; | 461 src_u += src_stride_u; |
462 src_v += src_stride_v; | 462 src_v += src_stride_v; |
463 } | 463 } |
464 } | 464 } |
465 return 0; | 465 return 0; |
466 } | 466 } |
467 | 467 |
468 // Convert I420 with Alpha to preattenuated ARGB. | 468 // Convert I420 with Alpha to preattenuated ARGB. |
469 LIBYUV_API | 469 LIBYUV_API |
470 int I420AlphaToABGR(const uint8* src_y, int src_stride_y, | 470 int I420AlphaToABGR(const uint8* src_y, int src_stride_y, |
471 const uint8* src_u, int src_stride_u, | 471 const uint8* src_u, int src_stride_u, |
472 const uint8* src_v, int src_stride_v, | 472 const uint8* src_v, int src_stride_v, |
473 const uint8* src_a, int src_stride_a, | 473 const uint8* src_a, int src_stride_a, |
474 uint8* dst_abgr, int dst_stride_abgr, | 474 uint8* dst_abgr, int dst_stride_abgr, |
475 int width, int height, int attenuate) { | 475 int width, int height, int attenuate) { |
476 int y; | 476 int y; |
477 void (*I422AlphaToABGRRow)(const uint8* y_buf, | 477 void (*I422AlphaToABGRRow)(const uint8* y_buf, |
478 const uint8* u_buf, | 478 const uint8* u_buf, |
479 const uint8* v_buf, | 479 const uint8* v_buf, |
480 const uint8* a_buf, | 480 const uint8* a_buf, |
481 uint8* dst_abgr, | 481 uint8* dst_abgr, |
482 struct YuvConstants* yuvconstants, | 482 const struct YuvConstants* yuvconstants, |
483 int width) = I422AlphaToABGRRow_C; | 483 int width) = I422AlphaToABGRRow_C; |
484 void (*ARGBAttenuateRow)(const uint8* src_abgr, uint8* dst_abgr, | 484 void (*ARGBAttenuateRow)(const uint8* src_abgr, uint8* dst_abgr, |
485 int width) = ARGBAttenuateRow_C; | 485 int width) = ARGBAttenuateRow_C; |
486 if (!src_y || !src_u || !src_v || !dst_abgr || | 486 if (!src_y || !src_u || !src_v || !dst_abgr || |
487 width <= 0 || height == 0) { | 487 width <= 0 || height == 0) { |
488 return -1; | 488 return -1; |
489 } | 489 } |
490 // Negative height means invert the image. | 490 // Negative height means invert the image. |
491 if (height < 0) { | 491 if (height < 0) { |
492 height = -height; | 492 height = -height; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 #if defined(HAS_ARGBATTENUATEROW_NEON) | 545 #if defined(HAS_ARGBATTENUATEROW_NEON) |
546 if (TestCpuFlag(kCpuHasNEON)) { | 546 if (TestCpuFlag(kCpuHasNEON)) { |
547 ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON; | 547 ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON; |
548 if (IS_ALIGNED(width, 8)) { | 548 if (IS_ALIGNED(width, 8)) { |
549 ARGBAttenuateRow = ARGBAttenuateRow_NEON; | 549 ARGBAttenuateRow = ARGBAttenuateRow_NEON; |
550 } | 550 } |
551 } | 551 } |
552 #endif | 552 #endif |
553 | 553 |
554 for (y = 0; y < height; ++y) { | 554 for (y = 0; y < height; ++y) { |
555 I422AlphaToABGRRow(src_y, src_u, src_v, src_a, dst_abgr, &kYuvConstants, | 555 I422AlphaToABGRRow(src_y, src_u, src_v, src_a, dst_abgr, &kYuvIConstants, |
556 width); | 556 width); |
557 if (attenuate) { | 557 if (attenuate) { |
558 ARGBAttenuateRow(dst_abgr, dst_abgr, width); | 558 ARGBAttenuateRow(dst_abgr, dst_abgr, width); |
559 } | 559 } |
560 dst_abgr += dst_stride_abgr; | 560 dst_abgr += dst_stride_abgr; |
561 src_a += src_stride_a; | 561 src_a += src_stride_a; |
562 src_y += src_stride_y; | 562 src_y += src_stride_y; |
563 if (y & 1) { | 563 if (y & 1) { |
564 src_u += src_stride_u; | 564 src_u += src_stride_u; |
565 src_v += src_stride_v; | 565 src_v += src_stride_v; |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 // Convert NV12 to ARGB. | 1031 // Convert NV12 to ARGB. |
1032 LIBYUV_API | 1032 LIBYUV_API |
1033 int NV12ToARGB(const uint8* src_y, int src_stride_y, | 1033 int NV12ToARGB(const uint8* src_y, int src_stride_y, |
1034 const uint8* src_uv, int src_stride_uv, | 1034 const uint8* src_uv, int src_stride_uv, |
1035 uint8* dst_argb, int dst_stride_argb, | 1035 uint8* dst_argb, int dst_stride_argb, |
1036 int width, int height) { | 1036 int width, int height) { |
1037 int y; | 1037 int y; |
1038 void (*NV12ToARGBRow)(const uint8* y_buf, | 1038 void (*NV12ToARGBRow)(const uint8* y_buf, |
1039 const uint8* uv_buf, | 1039 const uint8* uv_buf, |
1040 uint8* rgb_buf, | 1040 uint8* rgb_buf, |
1041 struct YuvConstants* yuvconstants, | 1041 const struct YuvConstants* yuvconstants, |
1042 int width) = NV12ToARGBRow_C; | 1042 int width) = NV12ToARGBRow_C; |
1043 if (!src_y || !src_uv || !dst_argb || | 1043 if (!src_y || !src_uv || !dst_argb || |
1044 width <= 0 || height == 0) { | 1044 width <= 0 || height == 0) { |
1045 return -1; | 1045 return -1; |
1046 } | 1046 } |
1047 // Negative height means invert the image. | 1047 // Negative height means invert the image. |
1048 if (height < 0) { | 1048 if (height < 0) { |
1049 height = -height; | 1049 height = -height; |
1050 dst_argb = dst_argb + (height - 1) * dst_stride_argb; | 1050 dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
1051 dst_stride_argb = -dst_stride_argb; | 1051 dst_stride_argb = -dst_stride_argb; |
(...skipping 17 matching lines...) Expand all Loading... |
1069 #if defined(HAS_NV12TOARGBROW_NEON) | 1069 #if defined(HAS_NV12TOARGBROW_NEON) |
1070 if (TestCpuFlag(kCpuHasNEON)) { | 1070 if (TestCpuFlag(kCpuHasNEON)) { |
1071 NV12ToARGBRow = NV12ToARGBRow_Any_NEON; | 1071 NV12ToARGBRow = NV12ToARGBRow_Any_NEON; |
1072 if (IS_ALIGNED(width, 8)) { | 1072 if (IS_ALIGNED(width, 8)) { |
1073 NV12ToARGBRow = NV12ToARGBRow_NEON; | 1073 NV12ToARGBRow = NV12ToARGBRow_NEON; |
1074 } | 1074 } |
1075 } | 1075 } |
1076 #endif | 1076 #endif |
1077 | 1077 |
1078 for (y = 0; y < height; ++y) { | 1078 for (y = 0; y < height; ++y) { |
1079 NV12ToARGBRow(src_y, src_uv, dst_argb, &kYuvConstants, width); | 1079 NV12ToARGBRow(src_y, src_uv, dst_argb, &kYuvIConstants, width); |
1080 dst_argb += dst_stride_argb; | 1080 dst_argb += dst_stride_argb; |
1081 src_y += src_stride_y; | 1081 src_y += src_stride_y; |
1082 if (y & 1) { | 1082 if (y & 1) { |
1083 src_uv += src_stride_uv; | 1083 src_uv += src_stride_uv; |
1084 } | 1084 } |
1085 } | 1085 } |
1086 return 0; | 1086 return 0; |
1087 } | 1087 } |
1088 | 1088 |
1089 // Convert NV21 to ARGB. | 1089 // Convert NV21 to ARGB. |
1090 LIBYUV_API | 1090 LIBYUV_API |
1091 int NV21ToARGB(const uint8* src_y, int src_stride_y, | 1091 int NV21ToARGB(const uint8* src_y, int src_stride_y, |
1092 const uint8* src_uv, int src_stride_uv, | 1092 const uint8* src_uv, int src_stride_uv, |
1093 uint8* dst_argb, int dst_stride_argb, | 1093 uint8* dst_argb, int dst_stride_argb, |
1094 int width, int height) { | 1094 int width, int height) { |
1095 int y; | 1095 int y; |
1096 void (*NV21ToARGBRow)(const uint8* y_buf, | 1096 void (*NV21ToARGBRow)(const uint8* y_buf, |
1097 const uint8* uv_buf, | 1097 const uint8* uv_buf, |
1098 uint8* rgb_buf, | 1098 uint8* rgb_buf, |
1099 struct YuvConstants* yuvconstants, | 1099 const struct YuvConstants* yuvconstants, |
1100 int width) = NV21ToARGBRow_C; | 1100 int width) = NV21ToARGBRow_C; |
1101 if (!src_y || !src_uv || !dst_argb || | 1101 if (!src_y || !src_uv || !dst_argb || |
1102 width <= 0 || height == 0) { | 1102 width <= 0 || height == 0) { |
1103 return -1; | 1103 return -1; |
1104 } | 1104 } |
1105 // Negative height means invert the image. | 1105 // Negative height means invert the image. |
1106 if (height < 0) { | 1106 if (height < 0) { |
1107 height = -height; | 1107 height = -height; |
1108 dst_argb = dst_argb + (height - 1) * dst_stride_argb; | 1108 dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
1109 dst_stride_argb = -dst_stride_argb; | 1109 dst_stride_argb = -dst_stride_argb; |
(...skipping 17 matching lines...) Expand all Loading... |
1127 #if defined(HAS_NV21TOARGBROW_NEON) | 1127 #if defined(HAS_NV21TOARGBROW_NEON) |
1128 if (TestCpuFlag(kCpuHasNEON)) { | 1128 if (TestCpuFlag(kCpuHasNEON)) { |
1129 NV21ToARGBRow = NV21ToARGBRow_Any_NEON; | 1129 NV21ToARGBRow = NV21ToARGBRow_Any_NEON; |
1130 if (IS_ALIGNED(width, 8)) { | 1130 if (IS_ALIGNED(width, 8)) { |
1131 NV21ToARGBRow = NV21ToARGBRow_NEON; | 1131 NV21ToARGBRow = NV21ToARGBRow_NEON; |
1132 } | 1132 } |
1133 } | 1133 } |
1134 #endif | 1134 #endif |
1135 | 1135 |
1136 for (y = 0; y < height; ++y) { | 1136 for (y = 0; y < height; ++y) { |
1137 NV21ToARGBRow(src_y, src_uv, dst_argb, &kYuvConstants, width); | 1137 NV21ToARGBRow(src_y, src_uv, dst_argb, &kYuvIConstants, width); |
1138 dst_argb += dst_stride_argb; | 1138 dst_argb += dst_stride_argb; |
1139 src_y += src_stride_y; | 1139 src_y += src_stride_y; |
1140 if (y & 1) { | 1140 if (y & 1) { |
1141 src_uv += src_stride_uv; | 1141 src_uv += src_stride_uv; |
1142 } | 1142 } |
1143 } | 1143 } |
1144 return 0; | 1144 return 0; |
1145 } | 1145 } |
1146 | 1146 |
1147 // Convert M420 to ARGB. | 1147 // Convert M420 to ARGB. |
1148 LIBYUV_API | 1148 LIBYUV_API |
1149 int M420ToARGB(const uint8* src_m420, int src_stride_m420, | 1149 int M420ToARGB(const uint8* src_m420, int src_stride_m420, |
1150 uint8* dst_argb, int dst_stride_argb, | 1150 uint8* dst_argb, int dst_stride_argb, |
1151 int width, int height) { | 1151 int width, int height) { |
1152 int y; | 1152 int y; |
1153 void (*NV12ToARGBRow)(const uint8* y_buf, | 1153 void (*NV12ToARGBRow)(const uint8* y_buf, |
1154 const uint8* uv_buf, | 1154 const uint8* uv_buf, |
1155 uint8* rgb_buf, | 1155 uint8* rgb_buf, |
1156 struct YuvConstants* yuvconstants, | 1156 const struct YuvConstants* yuvconstants, |
1157 int width) = NV12ToARGBRow_C; | 1157 int width) = NV12ToARGBRow_C; |
1158 if (!src_m420 || !dst_argb || | 1158 if (!src_m420 || !dst_argb || |
1159 width <= 0 || height == 0) { | 1159 width <= 0 || height == 0) { |
1160 return -1; | 1160 return -1; |
1161 } | 1161 } |
1162 // Negative height means invert the image. | 1162 // Negative height means invert the image. |
1163 if (height < 0) { | 1163 if (height < 0) { |
1164 height = -height; | 1164 height = -height; |
1165 dst_argb = dst_argb + (height - 1) * dst_stride_argb; | 1165 dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
1166 dst_stride_argb = -dst_stride_argb; | 1166 dst_stride_argb = -dst_stride_argb; |
(...skipping 18 matching lines...) Expand all Loading... |
1185 if (TestCpuFlag(kCpuHasNEON)) { | 1185 if (TestCpuFlag(kCpuHasNEON)) { |
1186 NV12ToARGBRow = NV12ToARGBRow_Any_NEON; | 1186 NV12ToARGBRow = NV12ToARGBRow_Any_NEON; |
1187 if (IS_ALIGNED(width, 8)) { | 1187 if (IS_ALIGNED(width, 8)) { |
1188 NV12ToARGBRow = NV12ToARGBRow_NEON; | 1188 NV12ToARGBRow = NV12ToARGBRow_NEON; |
1189 } | 1189 } |
1190 } | 1190 } |
1191 #endif | 1191 #endif |
1192 | 1192 |
1193 for (y = 0; y < height - 1; y += 2) { | 1193 for (y = 0; y < height - 1; y += 2) { |
1194 NV12ToARGBRow(src_m420, src_m420 + src_stride_m420 * 2, dst_argb, | 1194 NV12ToARGBRow(src_m420, src_m420 + src_stride_m420 * 2, dst_argb, |
1195 &kYuvConstants, width); | 1195 &kYuvIConstants, width); |
1196 NV12ToARGBRow(src_m420 + src_stride_m420, src_m420 + src_stride_m420 * 2, | 1196 NV12ToARGBRow(src_m420 + src_stride_m420, src_m420 + src_stride_m420 * 2, |
1197 dst_argb + dst_stride_argb, &kYuvConstants, width); | 1197 dst_argb + dst_stride_argb, &kYuvIConstants, width); |
1198 dst_argb += dst_stride_argb * 2; | 1198 dst_argb += dst_stride_argb * 2; |
1199 src_m420 += src_stride_m420 * 3; | 1199 src_m420 += src_stride_m420 * 3; |
1200 } | 1200 } |
1201 if (height & 1) { | 1201 if (height & 1) { |
1202 NV12ToARGBRow(src_m420, src_m420 + src_stride_m420 * 2, dst_argb, | 1202 NV12ToARGBRow(src_m420, src_m420 + src_stride_m420 * 2, dst_argb, |
1203 &kYuvConstants, width); | 1203 &kYuvIConstants, width); |
1204 } | 1204 } |
1205 return 0; | 1205 return 0; |
1206 } | 1206 } |
1207 | 1207 |
1208 // Convert YUY2 to ARGB. | 1208 // Convert YUY2 to ARGB. |
1209 LIBYUV_API | 1209 LIBYUV_API |
1210 int YUY2ToARGB(const uint8* src_yuy2, int src_stride_yuy2, | 1210 int YUY2ToARGB(const uint8* src_yuy2, int src_stride_yuy2, |
1211 uint8* dst_argb, int dst_stride_argb, | 1211 uint8* dst_argb, int dst_stride_argb, |
1212 int width, int height) { | 1212 int width, int height) { |
1213 int y; | 1213 int y; |
1214 void (*YUY2ToARGBRow)(const uint8* src_yuy2, | 1214 void (*YUY2ToARGBRow)(const uint8* src_yuy2, |
1215 uint8* dst_argb, | 1215 uint8* dst_argb, |
1216 struct YuvConstants* yuvconstants, | 1216 const struct YuvConstants* yuvconstants, |
1217 int width) = | 1217 int width) = |
1218 YUY2ToARGBRow_C; | 1218 YUY2ToARGBRow_C; |
1219 if (!src_yuy2 || !dst_argb || | 1219 if (!src_yuy2 || !dst_argb || |
1220 width <= 0 || height == 0) { | 1220 width <= 0 || height == 0) { |
1221 return -1; | 1221 return -1; |
1222 } | 1222 } |
1223 // Negative height means invert the image. | 1223 // Negative height means invert the image. |
1224 if (height < 0) { | 1224 if (height < 0) { |
1225 height = -height; | 1225 height = -height; |
1226 src_yuy2 = src_yuy2 + (height - 1) * src_stride_yuy2; | 1226 src_yuy2 = src_yuy2 + (height - 1) * src_stride_yuy2; |
(...skipping 24 matching lines...) Expand all Loading... |
1251 #endif | 1251 #endif |
1252 #if defined(HAS_YUY2TOARGBROW_NEON) | 1252 #if defined(HAS_YUY2TOARGBROW_NEON) |
1253 if (TestCpuFlag(kCpuHasNEON)) { | 1253 if (TestCpuFlag(kCpuHasNEON)) { |
1254 YUY2ToARGBRow = YUY2ToARGBRow_Any_NEON; | 1254 YUY2ToARGBRow = YUY2ToARGBRow_Any_NEON; |
1255 if (IS_ALIGNED(width, 8)) { | 1255 if (IS_ALIGNED(width, 8)) { |
1256 YUY2ToARGBRow = YUY2ToARGBRow_NEON; | 1256 YUY2ToARGBRow = YUY2ToARGBRow_NEON; |
1257 } | 1257 } |
1258 } | 1258 } |
1259 #endif | 1259 #endif |
1260 for (y = 0; y < height; ++y) { | 1260 for (y = 0; y < height; ++y) { |
1261 YUY2ToARGBRow(src_yuy2, dst_argb, &kYuvConstants, width); | 1261 YUY2ToARGBRow(src_yuy2, dst_argb, &kYuvIConstants, width); |
1262 src_yuy2 += src_stride_yuy2; | 1262 src_yuy2 += src_stride_yuy2; |
1263 dst_argb += dst_stride_argb; | 1263 dst_argb += dst_stride_argb; |
1264 } | 1264 } |
1265 return 0; | 1265 return 0; |
1266 } | 1266 } |
1267 | 1267 |
1268 // Convert UYVY to ARGB. | 1268 // Convert UYVY to ARGB. |
1269 LIBYUV_API | 1269 LIBYUV_API |
1270 int UYVYToARGB(const uint8* src_uyvy, int src_stride_uyvy, | 1270 int UYVYToARGB(const uint8* src_uyvy, int src_stride_uyvy, |
1271 uint8* dst_argb, int dst_stride_argb, | 1271 uint8* dst_argb, int dst_stride_argb, |
1272 int width, int height) { | 1272 int width, int height) { |
1273 int y; | 1273 int y; |
1274 void (*UYVYToARGBRow)(const uint8* src_uyvy, | 1274 void (*UYVYToARGBRow)(const uint8* src_uyvy, |
1275 uint8* dst_argb, | 1275 uint8* dst_argb, |
1276 struct YuvConstants* yuvconstants, | 1276 const struct YuvConstants* yuvconstants, |
1277 int width) = | 1277 int width) = |
1278 UYVYToARGBRow_C; | 1278 UYVYToARGBRow_C; |
1279 if (!src_uyvy || !dst_argb || | 1279 if (!src_uyvy || !dst_argb || |
1280 width <= 0 || height == 0) { | 1280 width <= 0 || height == 0) { |
1281 return -1; | 1281 return -1; |
1282 } | 1282 } |
1283 // Negative height means invert the image. | 1283 // Negative height means invert the image. |
1284 if (height < 0) { | 1284 if (height < 0) { |
1285 height = -height; | 1285 height = -height; |
1286 src_uyvy = src_uyvy + (height - 1) * src_stride_uyvy; | 1286 src_uyvy = src_uyvy + (height - 1) * src_stride_uyvy; |
(...skipping 24 matching lines...) Expand all Loading... |
1311 #endif | 1311 #endif |
1312 #if defined(HAS_UYVYTOARGBROW_NEON) | 1312 #if defined(HAS_UYVYTOARGBROW_NEON) |
1313 if (TestCpuFlag(kCpuHasNEON)) { | 1313 if (TestCpuFlag(kCpuHasNEON)) { |
1314 UYVYToARGBRow = UYVYToARGBRow_Any_NEON; | 1314 UYVYToARGBRow = UYVYToARGBRow_Any_NEON; |
1315 if (IS_ALIGNED(width, 8)) { | 1315 if (IS_ALIGNED(width, 8)) { |
1316 UYVYToARGBRow = UYVYToARGBRow_NEON; | 1316 UYVYToARGBRow = UYVYToARGBRow_NEON; |
1317 } | 1317 } |
1318 } | 1318 } |
1319 #endif | 1319 #endif |
1320 for (y = 0; y < height; ++y) { | 1320 for (y = 0; y < height; ++y) { |
1321 UYVYToARGBRow(src_uyvy, dst_argb, &kYuvConstants, width); | 1321 UYVYToARGBRow(src_uyvy, dst_argb, &kYuvIConstants, width); |
1322 src_uyvy += src_stride_uyvy; | 1322 src_uyvy += src_stride_uyvy; |
1323 dst_argb += dst_stride_argb; | 1323 dst_argb += dst_stride_argb; |
1324 } | 1324 } |
1325 return 0; | 1325 return 0; |
1326 } | 1326 } |
1327 | 1327 |
1328 // Convert J420 to ARGB. | 1328 // Convert J420 to ARGB. |
1329 LIBYUV_API | 1329 LIBYUV_API |
1330 int J420ToARGB(const uint8* src_y, int src_stride_y, | 1330 int J420ToARGB(const uint8* src_y, int src_stride_y, |
1331 const uint8* src_u, int src_stride_u, | 1331 const uint8* src_u, int src_stride_u, |
1332 const uint8* src_v, int src_stride_v, | 1332 const uint8* src_v, int src_stride_v, |
1333 uint8* dst_argb, int dst_stride_argb, | 1333 uint8* dst_argb, int dst_stride_argb, |
1334 int width, int height) { | 1334 int width, int height) { |
1335 int y; | 1335 int y; |
1336 void (*I422ToARGBRow)(const uint8* y_buf, | 1336 void (*I422ToARGBRow)(const uint8* y_buf, |
1337 const uint8* u_buf, | 1337 const uint8* u_buf, |
1338 const uint8* v_buf, | 1338 const uint8* v_buf, |
1339 uint8* rgb_buf, | 1339 uint8* rgb_buf, |
1340 struct YuvConstants* yuvconstants, | 1340 const struct YuvConstants* yuvconstants, |
1341 int width) = I422ToARGBRow_C; | 1341 int width) = I422ToARGBRow_C; |
1342 if (!src_y || !src_u || !src_v || !dst_argb || | 1342 if (!src_y || !src_u || !src_v || !dst_argb || |
1343 width <= 0 || height == 0) { | 1343 width <= 0 || height == 0) { |
1344 return -1; | 1344 return -1; |
1345 } | 1345 } |
1346 // Negative height means invert the image. | 1346 // Negative height means invert the image. |
1347 if (height < 0) { | 1347 if (height < 0) { |
1348 height = -height; | 1348 height = -height; |
1349 dst_argb = dst_argb + (height - 1) * dst_stride_argb; | 1349 dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
1350 dst_stride_argb = -dst_stride_argb; | 1350 dst_stride_argb = -dst_stride_argb; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 int J422ToARGB(const uint8* src_y, int src_stride_y, | 1400 int J422ToARGB(const uint8* src_y, int src_stride_y, |
1401 const uint8* src_u, int src_stride_u, | 1401 const uint8* src_u, int src_stride_u, |
1402 const uint8* src_v, int src_stride_v, | 1402 const uint8* src_v, int src_stride_v, |
1403 uint8* dst_argb, int dst_stride_argb, | 1403 uint8* dst_argb, int dst_stride_argb, |
1404 int width, int height) { | 1404 int width, int height) { |
1405 int y; | 1405 int y; |
1406 void (*I422ToARGBRow)(const uint8* y_buf, | 1406 void (*I422ToARGBRow)(const uint8* y_buf, |
1407 const uint8* u_buf, | 1407 const uint8* u_buf, |
1408 const uint8* v_buf, | 1408 const uint8* v_buf, |
1409 uint8* rgb_buf, | 1409 uint8* rgb_buf, |
1410 struct YuvConstants* yuvconstants, | 1410 const struct YuvConstants* yuvconstants, |
1411 int width) = I422ToARGBRow_C; | 1411 int width) = I422ToARGBRow_C; |
1412 if (!src_y || !src_u || !src_v || | 1412 if (!src_y || !src_u || !src_v || |
1413 !dst_argb || | 1413 !dst_argb || |
1414 width <= 0 || height == 0) { | 1414 width <= 0 || height == 0) { |
1415 return -1; | 1415 return -1; |
1416 } | 1416 } |
1417 // Negative height means invert the image. | 1417 // Negative height means invert the image. |
1418 if (height < 0) { | 1418 if (height < 0) { |
1419 height = -height; | 1419 height = -height; |
1420 dst_argb = dst_argb + (height - 1) * dst_stride_argb; | 1420 dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 int J420ToABGR(const uint8* src_y, int src_stride_y, | 1478 int J420ToABGR(const uint8* src_y, int src_stride_y, |
1479 const uint8* src_u, int src_stride_u, | 1479 const uint8* src_u, int src_stride_u, |
1480 const uint8* src_v, int src_stride_v, | 1480 const uint8* src_v, int src_stride_v, |
1481 uint8* dst_abgr, int dst_stride_abgr, | 1481 uint8* dst_abgr, int dst_stride_abgr, |
1482 int width, int height) { | 1482 int width, int height) { |
1483 int y; | 1483 int y; |
1484 void (*I422ToABGRRow)(const uint8* y_buf, | 1484 void (*I422ToABGRRow)(const uint8* y_buf, |
1485 const uint8* u_buf, | 1485 const uint8* u_buf, |
1486 const uint8* v_buf, | 1486 const uint8* v_buf, |
1487 uint8* rgb_buf, | 1487 uint8* rgb_buf, |
1488 struct YuvConstants* yuvconstants, | 1488 const struct YuvConstants* yuvconstants, |
1489 int width) = I422ToABGRRow_C; | 1489 int width) = I422ToABGRRow_C; |
1490 if (!src_y || !src_u || !src_v || !dst_abgr || | 1490 if (!src_y || !src_u || !src_v || !dst_abgr || |
1491 width <= 0 || height == 0) { | 1491 width <= 0 || height == 0) { |
1492 return -1; | 1492 return -1; |
1493 } | 1493 } |
1494 // Negative height means invert the image. | 1494 // Negative height means invert the image. |
1495 if (height < 0) { | 1495 if (height < 0) { |
1496 height = -height; | 1496 height = -height; |
1497 dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr; | 1497 dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr; |
1498 dst_stride_abgr = -dst_stride_abgr; | 1498 dst_stride_abgr = -dst_stride_abgr; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1548 int J422ToABGR(const uint8* src_y, int src_stride_y, | 1548 int J422ToABGR(const uint8* src_y, int src_stride_y, |
1549 const uint8* src_u, int src_stride_u, | 1549 const uint8* src_u, int src_stride_u, |
1550 const uint8* src_v, int src_stride_v, | 1550 const uint8* src_v, int src_stride_v, |
1551 uint8* dst_abgr, int dst_stride_abgr, | 1551 uint8* dst_abgr, int dst_stride_abgr, |
1552 int width, int height) { | 1552 int width, int height) { |
1553 int y; | 1553 int y; |
1554 void (*I422ToABGRRow)(const uint8* y_buf, | 1554 void (*I422ToABGRRow)(const uint8* y_buf, |
1555 const uint8* u_buf, | 1555 const uint8* u_buf, |
1556 const uint8* v_buf, | 1556 const uint8* v_buf, |
1557 uint8* rgb_buf, | 1557 uint8* rgb_buf, |
1558 struct YuvConstants* yuvconstants, | 1558 const struct YuvConstants* yuvconstants, |
1559 int width) = I422ToABGRRow_C; | 1559 int width) = I422ToABGRRow_C; |
1560 if (!src_y || !src_u || !src_v || | 1560 if (!src_y || !src_u || !src_v || |
1561 !dst_abgr || | 1561 !dst_abgr || |
1562 width <= 0 || height == 0) { | 1562 width <= 0 || height == 0) { |
1563 return -1; | 1563 return -1; |
1564 } | 1564 } |
1565 // Negative height means invert the image. | 1565 // Negative height means invert the image. |
1566 if (height < 0) { | 1566 if (height < 0) { |
1567 height = -height; | 1567 height = -height; |
1568 dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr; | 1568 dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1626 int H420ToARGB(const uint8* src_y, int src_stride_y, | 1626 int H420ToARGB(const uint8* src_y, int src_stride_y, |
1627 const uint8* src_u, int src_stride_u, | 1627 const uint8* src_u, int src_stride_u, |
1628 const uint8* src_v, int src_stride_v, | 1628 const uint8* src_v, int src_stride_v, |
1629 uint8* dst_argb, int dst_stride_argb, | 1629 uint8* dst_argb, int dst_stride_argb, |
1630 int width, int height) { | 1630 int width, int height) { |
1631 int y; | 1631 int y; |
1632 void (*I422ToARGBRow)(const uint8* y_buf, | 1632 void (*I422ToARGBRow)(const uint8* y_buf, |
1633 const uint8* u_buf, | 1633 const uint8* u_buf, |
1634 const uint8* v_buf, | 1634 const uint8* v_buf, |
1635 uint8* rgb_buf, | 1635 uint8* rgb_buf, |
1636 struct YuvConstants* yuvconstants, | 1636 const struct YuvConstants* yuvconstants, |
1637 int width) = I422ToARGBRow_C; | 1637 int width) = I422ToARGBRow_C; |
1638 if (!src_y || !src_u || !src_v || !dst_argb || | 1638 if (!src_y || !src_u || !src_v || !dst_argb || |
1639 width <= 0 || height == 0) { | 1639 width <= 0 || height == 0) { |
1640 return -1; | 1640 return -1; |
1641 } | 1641 } |
1642 // Negative height means invert the image. | 1642 // Negative height means invert the image. |
1643 if (height < 0) { | 1643 if (height < 0) { |
1644 height = -height; | 1644 height = -height; |
1645 dst_argb = dst_argb + (height - 1) * dst_stride_argb; | 1645 dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
1646 dst_stride_argb = -dst_stride_argb; | 1646 dst_stride_argb = -dst_stride_argb; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 int H422ToARGB(const uint8* src_y, int src_stride_y, | 1696 int H422ToARGB(const uint8* src_y, int src_stride_y, |
1697 const uint8* src_u, int src_stride_u, | 1697 const uint8* src_u, int src_stride_u, |
1698 const uint8* src_v, int src_stride_v, | 1698 const uint8* src_v, int src_stride_v, |
1699 uint8* dst_argb, int dst_stride_argb, | 1699 uint8* dst_argb, int dst_stride_argb, |
1700 int width, int height) { | 1700 int width, int height) { |
1701 int y; | 1701 int y; |
1702 void (*I422ToARGBRow)(const uint8* y_buf, | 1702 void (*I422ToARGBRow)(const uint8* y_buf, |
1703 const uint8* u_buf, | 1703 const uint8* u_buf, |
1704 const uint8* v_buf, | 1704 const uint8* v_buf, |
1705 uint8* rgb_buf, | 1705 uint8* rgb_buf, |
1706 struct YuvConstants* yuvconstants, | 1706 const struct YuvConstants* yuvconstants, |
1707 int width) = I422ToARGBRow_C; | 1707 int width) = I422ToARGBRow_C; |
1708 if (!src_y || !src_u || !src_v || | 1708 if (!src_y || !src_u || !src_v || |
1709 !dst_argb || | 1709 !dst_argb || |
1710 width <= 0 || height == 0) { | 1710 width <= 0 || height == 0) { |
1711 return -1; | 1711 return -1; |
1712 } | 1712 } |
1713 // Negative height means invert the image. | 1713 // Negative height means invert the image. |
1714 if (height < 0) { | 1714 if (height < 0) { |
1715 height = -height; | 1715 height = -height; |
1716 dst_argb = dst_argb + (height - 1) * dst_stride_argb; | 1716 dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1774 int H420ToABGR(const uint8* src_y, int src_stride_y, | 1774 int H420ToABGR(const uint8* src_y, int src_stride_y, |
1775 const uint8* src_u, int src_stride_u, | 1775 const uint8* src_u, int src_stride_u, |
1776 const uint8* src_v, int src_stride_v, | 1776 const uint8* src_v, int src_stride_v, |
1777 uint8* dst_abgr, int dst_stride_abgr, | 1777 uint8* dst_abgr, int dst_stride_abgr, |
1778 int width, int height) { | 1778 int width, int height) { |
1779 int y; | 1779 int y; |
1780 void (*I422ToABGRRow)(const uint8* y_buf, | 1780 void (*I422ToABGRRow)(const uint8* y_buf, |
1781 const uint8* u_buf, | 1781 const uint8* u_buf, |
1782 const uint8* v_buf, | 1782 const uint8* v_buf, |
1783 uint8* rgb_buf, | 1783 uint8* rgb_buf, |
1784 struct YuvConstants* yuvconstants, | 1784 const struct YuvConstants* yuvconstants, |
1785 int width) = I422ToABGRRow_C; | 1785 int width) = I422ToABGRRow_C; |
1786 if (!src_y || !src_u || !src_v || !dst_abgr || | 1786 if (!src_y || !src_u || !src_v || !dst_abgr || |
1787 width <= 0 || height == 0) { | 1787 width <= 0 || height == 0) { |
1788 return -1; | 1788 return -1; |
1789 } | 1789 } |
1790 // Negative height means invert the image. | 1790 // Negative height means invert the image. |
1791 if (height < 0) { | 1791 if (height < 0) { |
1792 height = -height; | 1792 height = -height; |
1793 dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr; | 1793 dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr; |
1794 dst_stride_abgr = -dst_stride_abgr; | 1794 dst_stride_abgr = -dst_stride_abgr; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 int H422ToABGR(const uint8* src_y, int src_stride_y, | 1844 int H422ToABGR(const uint8* src_y, int src_stride_y, |
1845 const uint8* src_u, int src_stride_u, | 1845 const uint8* src_u, int src_stride_u, |
1846 const uint8* src_v, int src_stride_v, | 1846 const uint8* src_v, int src_stride_v, |
1847 uint8* dst_abgr, int dst_stride_abgr, | 1847 uint8* dst_abgr, int dst_stride_abgr, |
1848 int width, int height) { | 1848 int width, int height) { |
1849 int y; | 1849 int y; |
1850 void (*I422ToABGRRow)(const uint8* y_buf, | 1850 void (*I422ToABGRRow)(const uint8* y_buf, |
1851 const uint8* u_buf, | 1851 const uint8* u_buf, |
1852 const uint8* v_buf, | 1852 const uint8* v_buf, |
1853 uint8* rgb_buf, | 1853 uint8* rgb_buf, |
1854 struct YuvConstants* yuvconstants, | 1854 const struct YuvConstants* yuvconstants, |
1855 int width) = I422ToABGRRow_C; | 1855 int width) = I422ToABGRRow_C; |
1856 if (!src_y || !src_u || !src_v || | 1856 if (!src_y || !src_u || !src_v || |
1857 !dst_abgr || | 1857 !dst_abgr || |
1858 width <= 0 || height == 0) { | 1858 width <= 0 || height == 0) { |
1859 return -1; | 1859 return -1; |
1860 } | 1860 } |
1861 // Negative height means invert the image. | 1861 // Negative height means invert the image. |
1862 if (height < 0) { | 1862 if (height < 0) { |
1863 height = -height; | 1863 height = -height; |
1864 dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr; | 1864 dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 src_u += src_stride_u; | 1914 src_u += src_stride_u; |
1915 src_v += src_stride_v; | 1915 src_v += src_stride_v; |
1916 } | 1916 } |
1917 return 0; | 1917 return 0; |
1918 } | 1918 } |
1919 | 1919 |
1920 #ifdef __cplusplus | 1920 #ifdef __cplusplus |
1921 } // extern "C" | 1921 } // extern "C" |
1922 } // namespace libyuv | 1922 } // namespace libyuv |
1923 #endif | 1923 #endif |
OLD | NEW |