| 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 | #include "libyuv/convert_argb.h" |
| 12 |
| 13 | #include "libyuv/cpu_id.h" |
| 14 | #ifdef HAVE_JPEG |
| 15 | #include "libyuv/mjpeg_decoder.h" |
| 16 | #endif |
| 17 | #include "libyuv/rotate_argb.h" |
| 18 | #include "libyuv/row.h" |
| 19 | #include "libyuv/video_common.h" |
| 20 |
| 21 | #ifdef __cplusplus |
| 22 | namespace libyuv { |
| 23 | extern "C" { |
| 24 | #endif |
| 25 |
| 26 | // Copy ARGB with optional flipping |
| 27 | LIBYUV_API |
| 28 | int ARGBCopy(const uint8* src_argb, int src_stride_argb, |
| 29 | uint8* dst_argb, int dst_stride_argb, |
| 30 | int width, int height) { |
| 31 | if (!src_argb || !dst_argb || |
| 32 | width <= 0 || height == 0) { |
| 33 | return -1; |
| 34 | } |
| 35 | // Negative height means invert the image. |
| 36 | if (height < 0) { |
| 37 | height = -height; |
| 38 | src_argb = src_argb + (height - 1) * src_stride_argb; |
| 39 | src_stride_argb = -src_stride_argb; |
| 40 | } |
| 41 |
| 42 | CopyPlane(src_argb, src_stride_argb, dst_argb, dst_stride_argb, |
| 43 | width * 4, height); |
| 44 | return 0; |
| 45 | } |
| 46 |
| 47 | // Convert I422 to ARGB with matrix |
| 48 | static int I420ToARGBMatrix(const uint8* src_y, int src_stride_y, |
| 49 | const uint8* src_u, int src_stride_u, |
| 50 | const uint8* src_v, int src_stride_v, |
| 51 | uint8* dst_argb, int dst_stride_argb, |
| 52 | const struct YuvConstants* yuvconstants, |
| 53 | int width, int height) { |
| 54 | int y; |
| 55 | void (*I422ToARGBRow)(const uint8* y_buf, |
| 56 | const uint8* u_buf, |
| 57 | const uint8* v_buf, |
| 58 | uint8* rgb_buf, |
| 59 | const struct YuvConstants* yuvconstants, |
| 60 | int width) = I422ToARGBRow_C; |
| 61 | if (!src_y || !src_u || !src_v || !dst_argb || |
| 62 | width <= 0 || height == 0) { |
| 63 | return -1; |
| 64 | } |
| 65 | // Negative height means invert the image. |
| 66 | if (height < 0) { |
| 67 | height = -height; |
| 68 | dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
| 69 | dst_stride_argb = -dst_stride_argb; |
| 70 | } |
| 71 | #if defined(HAS_I422TOARGBROW_SSSE3) |
| 72 | if (TestCpuFlag(kCpuHasSSSE3)) { |
| 73 | I422ToARGBRow = I422ToARGBRow_Any_SSSE3; |
| 74 | if (IS_ALIGNED(width, 8)) { |
| 75 | I422ToARGBRow = I422ToARGBRow_SSSE3; |
| 76 | } |
| 77 | } |
| 78 | #endif |
| 79 | #if defined(HAS_I422TOARGBROW_AVX2) |
| 80 | if (TestCpuFlag(kCpuHasAVX2)) { |
| 81 | I422ToARGBRow = I422ToARGBRow_Any_AVX2; |
| 82 | if (IS_ALIGNED(width, 16)) { |
| 83 | I422ToARGBRow = I422ToARGBRow_AVX2; |
| 84 | } |
| 85 | } |
| 86 | #endif |
| 87 | #if defined(HAS_I422TOARGBROW_NEON) |
| 88 | if (TestCpuFlag(kCpuHasNEON)) { |
| 89 | I422ToARGBRow = I422ToARGBRow_Any_NEON; |
| 90 | if (IS_ALIGNED(width, 8)) { |
| 91 | I422ToARGBRow = I422ToARGBRow_NEON; |
| 92 | } |
| 93 | } |
| 94 | #endif |
| 95 | #if defined(HAS_I422TOARGBROW_MIPS_DSPR2) |
| 96 | if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(width, 4) && |
| 97 | IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) && |
| 98 | IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) && |
| 99 | IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2) && |
| 100 | IS_ALIGNED(dst_argb, 4) && IS_ALIGNED(dst_stride_argb, 4)) { |
| 101 | I422ToARGBRow = I422ToARGBRow_MIPS_DSPR2; |
| 102 | } |
| 103 | #endif |
| 104 |
| 105 | for (y = 0; y < height; ++y) { |
| 106 | I422ToARGBRow(src_y, src_u, src_v, dst_argb, yuvconstants, width); |
| 107 | dst_argb += dst_stride_argb; |
| 108 | src_y += src_stride_y; |
| 109 | if (y & 1) { |
| 110 | src_u += src_stride_u; |
| 111 | src_v += src_stride_v; |
| 112 | } |
| 113 | } |
| 114 | return 0; |
| 115 | } |
| 116 |
| 117 | // Convert I420 to ARGB. |
| 118 | LIBYUV_API |
| 119 | int I420ToARGB(const uint8* src_y, int src_stride_y, |
| 120 | const uint8* src_u, int src_stride_u, |
| 121 | const uint8* src_v, int src_stride_v, |
| 122 | uint8* dst_argb, int dst_stride_argb, |
| 123 | int width, int height) { |
| 124 | return I420ToARGBMatrix(src_y, src_stride_y, |
| 125 | src_u, src_stride_u, |
| 126 | src_v, src_stride_v, |
| 127 | dst_argb, dst_stride_argb, |
| 128 | &kYuvI601Constants, |
| 129 | width, height); |
| 130 | } |
| 131 |
| 132 | // Convert I420 to ABGR. |
| 133 | LIBYUV_API |
| 134 | int I420ToABGR(const uint8* src_y, int src_stride_y, |
| 135 | const uint8* src_u, int src_stride_u, |
| 136 | const uint8* src_v, int src_stride_v, |
| 137 | uint8* dst_abgr, int dst_stride_abgr, |
| 138 | int width, int height) { |
| 139 | return I420ToARGBMatrix(src_y, src_stride_y, |
| 140 | src_v, src_stride_v, // Swap U and V |
| 141 | src_u, src_stride_u, |
| 142 | dst_abgr, dst_stride_abgr, |
| 143 | &kYvuI601Constants, // Use Yvu matrix |
| 144 | width, height); |
| 145 | } |
| 146 |
| 147 | // Convert J420 to ARGB. |
| 148 | LIBYUV_API |
| 149 | int J420ToARGB(const uint8* src_y, int src_stride_y, |
| 150 | const uint8* src_u, int src_stride_u, |
| 151 | const uint8* src_v, int src_stride_v, |
| 152 | uint8* dst_argb, int dst_stride_argb, |
| 153 | int width, int height) { |
| 154 | return I420ToARGBMatrix(src_y, src_stride_y, |
| 155 | src_u, src_stride_u, |
| 156 | src_v, src_stride_v, |
| 157 | dst_argb, dst_stride_argb, |
| 158 | &kYuvJPEGConstants, |
| 159 | width, height); |
| 160 | } |
| 161 |
| 162 | // Convert J420 to ABGR. |
| 163 | LIBYUV_API |
| 164 | int J420ToABGR(const uint8* src_y, int src_stride_y, |
| 165 | const uint8* src_u, int src_stride_u, |
| 166 | const uint8* src_v, int src_stride_v, |
| 167 | uint8* dst_abgr, int dst_stride_abgr, |
| 168 | int width, int height) { |
| 169 | return I420ToARGBMatrix(src_y, src_stride_y, |
| 170 | src_v, src_stride_v, // Swap U and V |
| 171 | src_u, src_stride_u, |
| 172 | dst_abgr, dst_stride_abgr, |
| 173 | &kYvuJPEGConstants, // Use Yvu matrix |
| 174 | width, height); |
| 175 | } |
| 176 |
| 177 | // Convert H420 to ARGB. |
| 178 | LIBYUV_API |
| 179 | int H420ToARGB(const uint8* src_y, int src_stride_y, |
| 180 | const uint8* src_u, int src_stride_u, |
| 181 | const uint8* src_v, int src_stride_v, |
| 182 | uint8* dst_argb, int dst_stride_argb, |
| 183 | int width, int height) { |
| 184 | return I420ToARGBMatrix(src_y, src_stride_y, |
| 185 | src_u, src_stride_u, |
| 186 | src_v, src_stride_v, |
| 187 | dst_argb, dst_stride_argb, |
| 188 | &kYuvH709Constants, |
| 189 | width, height); |
| 190 | } |
| 191 |
| 192 | // Convert H420 to ABGR. |
| 193 | LIBYUV_API |
| 194 | int H420ToABGR(const uint8* src_y, int src_stride_y, |
| 195 | const uint8* src_u, int src_stride_u, |
| 196 | const uint8* src_v, int src_stride_v, |
| 197 | uint8* dst_abgr, int dst_stride_abgr, |
| 198 | int width, int height) { |
| 199 | return I420ToARGBMatrix(src_y, src_stride_y, |
| 200 | src_v, src_stride_v, // Swap U and V |
| 201 | src_u, src_stride_u, |
| 202 | dst_abgr, dst_stride_abgr, |
| 203 | &kYvuH709Constants, // Use Yvu matrix |
| 204 | width, height); |
| 205 | } |
| 206 |
| 207 | // Convert I422 to ARGB with matrix |
| 208 | static int I422ToARGBMatrix(const uint8* src_y, int src_stride_y, |
| 209 | const uint8* src_u, int src_stride_u, |
| 210 | const uint8* src_v, int src_stride_v, |
| 211 | uint8* dst_argb, int dst_stride_argb, |
| 212 | const struct YuvConstants* yuvconstants, |
| 213 | int width, int height) { |
| 214 | int y; |
| 215 | void (*I422ToARGBRow)(const uint8* y_buf, |
| 216 | const uint8* u_buf, |
| 217 | const uint8* v_buf, |
| 218 | uint8* rgb_buf, |
| 219 | const struct YuvConstants* yuvconstants, |
| 220 | int width) = I422ToARGBRow_C; |
| 221 | if (!src_y || !src_u || !src_v || |
| 222 | !dst_argb || |
| 223 | width <= 0 || height == 0) { |
| 224 | return -1; |
| 225 | } |
| 226 | // Negative height means invert the image. |
| 227 | if (height < 0) { |
| 228 | height = -height; |
| 229 | dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
| 230 | dst_stride_argb = -dst_stride_argb; |
| 231 | } |
| 232 | // Coalesce rows. |
| 233 | if (src_stride_y == width && |
| 234 | src_stride_u * 2 == width && |
| 235 | src_stride_v * 2 == width && |
| 236 | dst_stride_argb == width * 4) { |
| 237 | width *= height; |
| 238 | height = 1; |
| 239 | src_stride_y = src_stride_u = src_stride_v = dst_stride_argb = 0; |
| 240 | } |
| 241 | #if defined(HAS_I422TOARGBROW_SSSE3) |
| 242 | if (TestCpuFlag(kCpuHasSSSE3)) { |
| 243 | I422ToARGBRow = I422ToARGBRow_Any_SSSE3; |
| 244 | if (IS_ALIGNED(width, 8)) { |
| 245 | I422ToARGBRow = I422ToARGBRow_SSSE3; |
| 246 | } |
| 247 | } |
| 248 | #endif |
| 249 | #if defined(HAS_I422TOARGBROW_AVX2) |
| 250 | if (TestCpuFlag(kCpuHasAVX2)) { |
| 251 | I422ToARGBRow = I422ToARGBRow_Any_AVX2; |
| 252 | if (IS_ALIGNED(width, 16)) { |
| 253 | I422ToARGBRow = I422ToARGBRow_AVX2; |
| 254 | } |
| 255 | } |
| 256 | #endif |
| 257 | #if defined(HAS_I422TOARGBROW_NEON) |
| 258 | if (TestCpuFlag(kCpuHasNEON)) { |
| 259 | I422ToARGBRow = I422ToARGBRow_Any_NEON; |
| 260 | if (IS_ALIGNED(width, 8)) { |
| 261 | I422ToARGBRow = I422ToARGBRow_NEON; |
| 262 | } |
| 263 | } |
| 264 | #endif |
| 265 | #if defined(HAS_I422TOARGBROW_MIPS_DSPR2) |
| 266 | if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(width, 4) && |
| 267 | IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) && |
| 268 | IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) && |
| 269 | IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2) && |
| 270 | IS_ALIGNED(dst_argb, 4) && IS_ALIGNED(dst_stride_argb, 4)) { |
| 271 | I422ToARGBRow = I422ToARGBRow_MIPS_DSPR2; |
| 272 | } |
| 273 | #endif |
| 274 |
| 275 | for (y = 0; y < height; ++y) { |
| 276 | I422ToARGBRow(src_y, src_u, src_v, dst_argb, yuvconstants, width); |
| 277 | dst_argb += dst_stride_argb; |
| 278 | src_y += src_stride_y; |
| 279 | src_u += src_stride_u; |
| 280 | src_v += src_stride_v; |
| 281 | } |
| 282 | return 0; |
| 283 | } |
| 284 |
| 285 | // Convert I422 to ARGB. |
| 286 | LIBYUV_API |
| 287 | int I422ToARGB(const uint8* src_y, int src_stride_y, |
| 288 | const uint8* src_u, int src_stride_u, |
| 289 | const uint8* src_v, int src_stride_v, |
| 290 | uint8* dst_argb, int dst_stride_argb, |
| 291 | int width, int height) { |
| 292 | return I422ToARGBMatrix(src_y, src_stride_y, |
| 293 | src_u, src_stride_u, |
| 294 | src_v, src_stride_v, |
| 295 | dst_argb, dst_stride_argb, |
| 296 | &kYuvI601Constants, |
| 297 | width, height); |
| 298 | } |
| 299 |
| 300 | // Convert I422 to ABGR. |
| 301 | LIBYUV_API |
| 302 | int I422ToABGR(const uint8* src_y, int src_stride_y, |
| 303 | const uint8* src_u, int src_stride_u, |
| 304 | const uint8* src_v, int src_stride_v, |
| 305 | uint8* dst_abgr, int dst_stride_abgr, |
| 306 | int width, int height) { |
| 307 | return I422ToARGBMatrix(src_y, src_stride_y, |
| 308 | src_v, src_stride_v, // Swap U and V |
| 309 | src_u, src_stride_u, |
| 310 | dst_abgr, dst_stride_abgr, |
| 311 | &kYvuI601Constants, // Use Yvu matrix |
| 312 | width, height); |
| 313 | } |
| 314 |
| 315 | // Convert J422 to ARGB. |
| 316 | LIBYUV_API |
| 317 | int J422ToARGB(const uint8* src_y, int src_stride_y, |
| 318 | const uint8* src_u, int src_stride_u, |
| 319 | const uint8* src_v, int src_stride_v, |
| 320 | uint8* dst_argb, int dst_stride_argb, |
| 321 | int width, int height) { |
| 322 | return I422ToARGBMatrix(src_y, src_stride_y, |
| 323 | src_u, src_stride_u, |
| 324 | src_v, src_stride_v, |
| 325 | dst_argb, dst_stride_argb, |
| 326 | &kYuvJPEGConstants, |
| 327 | width, height); |
| 328 | } |
| 329 |
| 330 | // Convert J422 to ABGR. |
| 331 | LIBYUV_API |
| 332 | int J422ToABGR(const uint8* src_y, int src_stride_y, |
| 333 | const uint8* src_u, int src_stride_u, |
| 334 | const uint8* src_v, int src_stride_v, |
| 335 | uint8* dst_abgr, int dst_stride_abgr, |
| 336 | int width, int height) { |
| 337 | return I422ToARGBMatrix(src_y, src_stride_y, |
| 338 | src_v, src_stride_v, // Swap U and V |
| 339 | src_u, src_stride_u, |
| 340 | dst_abgr, dst_stride_abgr, |
| 341 | &kYvuJPEGConstants, // Use Yvu matrix |
| 342 | width, height); |
| 343 | } |
| 344 |
| 345 | // Convert H422 to ARGB. |
| 346 | LIBYUV_API |
| 347 | int H422ToARGB(const uint8* src_y, int src_stride_y, |
| 348 | const uint8* src_u, int src_stride_u, |
| 349 | const uint8* src_v, int src_stride_v, |
| 350 | uint8* dst_argb, int dst_stride_argb, |
| 351 | int width, int height) { |
| 352 | return I422ToARGBMatrix(src_y, src_stride_y, |
| 353 | src_u, src_stride_u, |
| 354 | src_v, src_stride_v, |
| 355 | dst_argb, dst_stride_argb, |
| 356 | &kYuvH709Constants, |
| 357 | width, height); |
| 358 | } |
| 359 |
| 360 | // Convert H422 to ABGR. |
| 361 | LIBYUV_API |
| 362 | int H422ToABGR(const uint8* src_y, int src_stride_y, |
| 363 | const uint8* src_u, int src_stride_u, |
| 364 | const uint8* src_v, int src_stride_v, |
| 365 | uint8* dst_abgr, int dst_stride_abgr, |
| 366 | int width, int height) { |
| 367 | return I422ToARGBMatrix(src_y, src_stride_y, |
| 368 | src_v, src_stride_v, // Swap U and V |
| 369 | src_u, src_stride_u, |
| 370 | dst_abgr, dst_stride_abgr, |
| 371 | &kYvuH709Constants, // Use Yvu matrix |
| 372 | width, height); |
| 373 | } |
| 374 |
| 375 | // Convert I444 to ARGB with matrix |
| 376 | static int I444ToARGBMatrix(const uint8* src_y, int src_stride_y, |
| 377 | const uint8* src_u, int src_stride_u, |
| 378 | const uint8* src_v, int src_stride_v, |
| 379 | uint8* dst_argb, int dst_stride_argb, |
| 380 | const struct YuvConstants* yuvconstants, |
| 381 | int width, int height) { |
| 382 | int y; |
| 383 | void (*I444ToARGBRow)(const uint8* y_buf, |
| 384 | const uint8* u_buf, |
| 385 | const uint8* v_buf, |
| 386 | uint8* rgb_buf, |
| 387 | const struct YuvConstants* yuvconstants, |
| 388 | int width) = I444ToARGBRow_C; |
| 389 | if (!src_y || !src_u || !src_v || |
| 390 | !dst_argb || |
| 391 | width <= 0 || height == 0) { |
| 392 | return -1; |
| 393 | } |
| 394 | // Negative height means invert the image. |
| 395 | if (height < 0) { |
| 396 | height = -height; |
| 397 | dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
| 398 | dst_stride_argb = -dst_stride_argb; |
| 399 | } |
| 400 | // Coalesce rows. |
| 401 | if (src_stride_y == width && |
| 402 | src_stride_u == width && |
| 403 | src_stride_v == width && |
| 404 | dst_stride_argb == width * 4) { |
| 405 | width *= height; |
| 406 | height = 1; |
| 407 | src_stride_y = src_stride_u = src_stride_v = dst_stride_argb = 0; |
| 408 | } |
| 409 | #if defined(HAS_I444TOARGBROW_SSSE3) |
| 410 | if (TestCpuFlag(kCpuHasSSSE3)) { |
| 411 | I444ToARGBRow = I444ToARGBRow_Any_SSSE3; |
| 412 | if (IS_ALIGNED(width, 8)) { |
| 413 | I444ToARGBRow = I444ToARGBRow_SSSE3; |
| 414 | } |
| 415 | } |
| 416 | #endif |
| 417 | #if defined(HAS_I444TOARGBROW_AVX2) |
| 418 | if (TestCpuFlag(kCpuHasAVX2)) { |
| 419 | I444ToARGBRow = I444ToARGBRow_Any_AVX2; |
| 420 | if (IS_ALIGNED(width, 16)) { |
| 421 | I444ToARGBRow = I444ToARGBRow_AVX2; |
| 422 | } |
| 423 | } |
| 424 | #endif |
| 425 | #if defined(HAS_I444TOARGBROW_NEON) |
| 426 | if (TestCpuFlag(kCpuHasNEON)) { |
| 427 | I444ToARGBRow = I444ToARGBRow_Any_NEON; |
| 428 | if (IS_ALIGNED(width, 8)) { |
| 429 | I444ToARGBRow = I444ToARGBRow_NEON; |
| 430 | } |
| 431 | } |
| 432 | #endif |
| 433 |
| 434 | for (y = 0; y < height; ++y) { |
| 435 | I444ToARGBRow(src_y, src_u, src_v, dst_argb, yuvconstants, width); |
| 436 | dst_argb += dst_stride_argb; |
| 437 | src_y += src_stride_y; |
| 438 | src_u += src_stride_u; |
| 439 | src_v += src_stride_v; |
| 440 | } |
| 441 | return 0; |
| 442 | } |
| 443 |
| 444 | // Convert I444 to ARGB. |
| 445 | LIBYUV_API |
| 446 | int I444ToARGB(const uint8* src_y, int src_stride_y, |
| 447 | const uint8* src_u, int src_stride_u, |
| 448 | const uint8* src_v, int src_stride_v, |
| 449 | uint8* dst_argb, int dst_stride_argb, |
| 450 | int width, int height) { |
| 451 | return I444ToARGBMatrix(src_y, src_stride_y, |
| 452 | src_u, src_stride_u, |
| 453 | src_v, src_stride_v, |
| 454 | dst_argb, dst_stride_argb, |
| 455 | &kYuvI601Constants, |
| 456 | width, height); |
| 457 | } |
| 458 |
| 459 | // Convert I444 to ABGR. |
| 460 | LIBYUV_API |
| 461 | int I444ToABGR(const uint8* src_y, int src_stride_y, |
| 462 | const uint8* src_u, int src_stride_u, |
| 463 | const uint8* src_v, int src_stride_v, |
| 464 | uint8* dst_abgr, int dst_stride_abgr, |
| 465 | int width, int height) { |
| 466 | return I444ToARGBMatrix(src_y, src_stride_y, |
| 467 | src_v, src_stride_v, // Swap U and V |
| 468 | src_u, src_stride_u, |
| 469 | dst_abgr, dst_stride_abgr, |
| 470 | &kYvuI601Constants, // Use Yvu matrix |
| 471 | width, height); |
| 472 | } |
| 473 |
| 474 | // Convert J444 to ARGB. |
| 475 | LIBYUV_API |
| 476 | int J444ToARGB(const uint8* src_y, int src_stride_y, |
| 477 | const uint8* src_u, int src_stride_u, |
| 478 | const uint8* src_v, int src_stride_v, |
| 479 | uint8* dst_argb, int dst_stride_argb, |
| 480 | int width, int height) { |
| 481 | return I444ToARGBMatrix(src_y, src_stride_y, |
| 482 | src_u, src_stride_u, |
| 483 | src_v, src_stride_v, |
| 484 | dst_argb, dst_stride_argb, |
| 485 | &kYuvJPEGConstants, |
| 486 | width, height); |
| 487 | } |
| 488 |
| 489 | // Convert I411 to ARGB. |
| 490 | LIBYUV_API |
| 491 | int I411ToARGB(const uint8* src_y, int src_stride_y, |
| 492 | const uint8* src_u, int src_stride_u, |
| 493 | const uint8* src_v, int src_stride_v, |
| 494 | uint8* dst_argb, int dst_stride_argb, |
| 495 | int width, int height) { |
| 496 | int y; |
| 497 | void (*I411ToARGBRow)(const uint8* y_buf, |
| 498 | const uint8* u_buf, |
| 499 | const uint8* v_buf, |
| 500 | uint8* rgb_buf, |
| 501 | const struct YuvConstants* yuvconstants, |
| 502 | int width) = I411ToARGBRow_C; |
| 503 | if (!src_y || !src_u || !src_v || |
| 504 | !dst_argb || |
| 505 | width <= 0 || height == 0) { |
| 506 | return -1; |
| 507 | } |
| 508 | // Negative height means invert the image. |
| 509 | if (height < 0) { |
| 510 | height = -height; |
| 511 | dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
| 512 | dst_stride_argb = -dst_stride_argb; |
| 513 | } |
| 514 | // Coalesce rows. |
| 515 | if (src_stride_y == width && |
| 516 | src_stride_u * 4 == width && |
| 517 | src_stride_v * 4 == width && |
| 518 | dst_stride_argb == width * 4) { |
| 519 | width *= height; |
| 520 | height = 1; |
| 521 | src_stride_y = src_stride_u = src_stride_v = dst_stride_argb = 0; |
| 522 | } |
| 523 | #if defined(HAS_I411TOARGBROW_SSSE3) |
| 524 | if (TestCpuFlag(kCpuHasSSSE3)) { |
| 525 | I411ToARGBRow = I411ToARGBRow_Any_SSSE3; |
| 526 | if (IS_ALIGNED(width, 8)) { |
| 527 | I411ToARGBRow = I411ToARGBRow_SSSE3; |
| 528 | } |
| 529 | } |
| 530 | #endif |
| 531 | #if defined(HAS_I411TOARGBROW_AVX2) |
| 532 | if (TestCpuFlag(kCpuHasAVX2)) { |
| 533 | I411ToARGBRow = I411ToARGBRow_Any_AVX2; |
| 534 | if (IS_ALIGNED(width, 16)) { |
| 535 | I411ToARGBRow = I411ToARGBRow_AVX2; |
| 536 | } |
| 537 | } |
| 538 | #endif |
| 539 | #if defined(HAS_I411TOARGBROW_NEON) |
| 540 | if (TestCpuFlag(kCpuHasNEON)) { |
| 541 | I411ToARGBRow = I411ToARGBRow_Any_NEON; |
| 542 | if (IS_ALIGNED(width, 8)) { |
| 543 | I411ToARGBRow = I411ToARGBRow_NEON; |
| 544 | } |
| 545 | } |
| 546 | #endif |
| 547 |
| 548 | for (y = 0; y < height; ++y) { |
| 549 | I411ToARGBRow(src_y, src_u, src_v, dst_argb, &kYuvI601Constants, width); |
| 550 | dst_argb += dst_stride_argb; |
| 551 | src_y += src_stride_y; |
| 552 | src_u += src_stride_u; |
| 553 | src_v += src_stride_v; |
| 554 | } |
| 555 | return 0; |
| 556 | } |
| 557 |
| 558 | // Convert I420 with Alpha to preattenuated ARGB. |
| 559 | static int I420AlphaToARGBMatrix(const uint8* src_y, int src_stride_y, |
| 560 | const uint8* src_u, int src_stride_u, |
| 561 | const uint8* src_v, int src_stride_v, |
| 562 | const uint8* src_a, int src_stride_a, |
| 563 | uint8* dst_argb, int dst_stride_argb, |
| 564 | const struct YuvConstants* yuvconstants, |
| 565 | int width, int height, int attenuate) { |
| 566 | int y; |
| 567 | void (*I422AlphaToARGBRow)(const uint8* y_buf, |
| 568 | const uint8* u_buf, |
| 569 | const uint8* v_buf, |
| 570 | const uint8* a_buf, |
| 571 | uint8* dst_argb, |
| 572 | const struct YuvConstants* yuvconstants, |
| 573 | int width) = I422AlphaToARGBRow_C; |
| 574 | void (*ARGBAttenuateRow)(const uint8* src_argb, uint8* dst_argb, |
| 575 | int width) = ARGBAttenuateRow_C; |
| 576 | if (!src_y || !src_u || !src_v || !dst_argb || |
| 577 | width <= 0 || height == 0) { |
| 578 | return -1; |
| 579 | } |
| 580 | // Negative height means invert the image. |
| 581 | if (height < 0) { |
| 582 | height = -height; |
| 583 | dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
| 584 | dst_stride_argb = -dst_stride_argb; |
| 585 | } |
| 586 | #if defined(HAS_I422ALPHATOARGBROW_SSSE3) |
| 587 | if (TestCpuFlag(kCpuHasSSSE3)) { |
| 588 | I422AlphaToARGBRow = I422AlphaToARGBRow_Any_SSSE3; |
| 589 | if (IS_ALIGNED(width, 8)) { |
| 590 | I422AlphaToARGBRow = I422AlphaToARGBRow_SSSE3; |
| 591 | } |
| 592 | } |
| 593 | #endif |
| 594 | #if defined(HAS_I422ALPHATOARGBROW_AVX2) |
| 595 | if (TestCpuFlag(kCpuHasAVX2)) { |
| 596 | I422AlphaToARGBRow = I422AlphaToARGBRow_Any_AVX2; |
| 597 | if (IS_ALIGNED(width, 16)) { |
| 598 | I422AlphaToARGBRow = I422AlphaToARGBRow_AVX2; |
| 599 | } |
| 600 | } |
| 601 | #endif |
| 602 | #if defined(HAS_I422ALPHATOARGBROW_NEON) |
| 603 | if (TestCpuFlag(kCpuHasNEON)) { |
| 604 | I422AlphaToARGBRow = I422AlphaToARGBRow_Any_NEON; |
| 605 | if (IS_ALIGNED(width, 8)) { |
| 606 | I422AlphaToARGBRow = I422AlphaToARGBRow_NEON; |
| 607 | } |
| 608 | } |
| 609 | #endif |
| 610 | #if defined(HAS_I422ALPHATOARGBROW_MIPS_DSPR2) |
| 611 | if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(width, 4) && |
| 612 | IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) && |
| 613 | IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) && |
| 614 | IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2) && |
| 615 | IS_ALIGNED(dst_argb, 4) && IS_ALIGNED(dst_stride_argb, 4)) { |
| 616 | I422AlphaToARGBRow = I422AlphaToARGBRow_MIPS_DSPR2; |
| 617 | } |
| 618 | #endif |
| 619 | #if defined(HAS_ARGBATTENUATEROW_SSSE3) |
| 620 | if (TestCpuFlag(kCpuHasSSSE3)) { |
| 621 | ARGBAttenuateRow = ARGBAttenuateRow_Any_SSSE3; |
| 622 | if (IS_ALIGNED(width, 4)) { |
| 623 | ARGBAttenuateRow = ARGBAttenuateRow_SSSE3; |
| 624 | } |
| 625 | } |
| 626 | #endif |
| 627 | #if defined(HAS_ARGBATTENUATEROW_AVX2) |
| 628 | if (TestCpuFlag(kCpuHasAVX2)) { |
| 629 | ARGBAttenuateRow = ARGBAttenuateRow_Any_AVX2; |
| 630 | if (IS_ALIGNED(width, 8)) { |
| 631 | ARGBAttenuateRow = ARGBAttenuateRow_AVX2; |
| 632 | } |
| 633 | } |
| 634 | #endif |
| 635 | #if defined(HAS_ARGBATTENUATEROW_NEON) |
| 636 | if (TestCpuFlag(kCpuHasNEON)) { |
| 637 | ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON; |
| 638 | if (IS_ALIGNED(width, 8)) { |
| 639 | ARGBAttenuateRow = ARGBAttenuateRow_NEON; |
| 640 | } |
| 641 | } |
| 642 | #endif |
| 643 |
| 644 | for (y = 0; y < height; ++y) { |
| 645 | I422AlphaToARGBRow(src_y, src_u, src_v, src_a, dst_argb, yuvconstants, |
| 646 | width); |
| 647 | if (attenuate) { |
| 648 | ARGBAttenuateRow(dst_argb, dst_argb, width); |
| 649 | } |
| 650 | dst_argb += dst_stride_argb; |
| 651 | src_a += src_stride_a; |
| 652 | src_y += src_stride_y; |
| 653 | if (y & 1) { |
| 654 | src_u += src_stride_u; |
| 655 | src_v += src_stride_v; |
| 656 | } |
| 657 | } |
| 658 | return 0; |
| 659 | } |
| 660 |
| 661 | // Convert I420 with Alpha to ARGB. |
| 662 | LIBYUV_API |
| 663 | int I420AlphaToARGB(const uint8* src_y, int src_stride_y, |
| 664 | const uint8* src_u, int src_stride_u, |
| 665 | const uint8* src_v, int src_stride_v, |
| 666 | const uint8* src_a, int src_stride_a, |
| 667 | uint8* dst_argb, int dst_stride_argb, |
| 668 | int width, int height, int attenuate) { |
| 669 | return I420AlphaToARGBMatrix(src_y, src_stride_y, |
| 670 | src_u, src_stride_u, |
| 671 | src_v, src_stride_v, |
| 672 | src_a, src_stride_a, |
| 673 | dst_argb, dst_stride_argb, |
| 674 | &kYuvI601Constants, |
| 675 | width, height, attenuate); |
| 676 | } |
| 677 |
| 678 | // Convert I420 with Alpha to ABGR. |
| 679 | LIBYUV_API |
| 680 | int I420AlphaToABGR(const uint8* src_y, int src_stride_y, |
| 681 | const uint8* src_u, int src_stride_u, |
| 682 | const uint8* src_v, int src_stride_v, |
| 683 | const uint8* src_a, int src_stride_a, |
| 684 | uint8* dst_abgr, int dst_stride_abgr, |
| 685 | int width, int height, int attenuate) { |
| 686 | return I420AlphaToARGBMatrix(src_y, src_stride_y, |
| 687 | src_v, src_stride_v, // Swap U and V |
| 688 | src_u, src_stride_u, |
| 689 | src_a, src_stride_a, |
| 690 | dst_abgr, dst_stride_abgr, |
| 691 | &kYvuI601Constants, // Use Yvu matrix |
| 692 | width, height, attenuate); |
| 693 | } |
| 694 |
| 695 | // Convert I400 to ARGB. |
| 696 | LIBYUV_API |
| 697 | int I400ToARGB(const uint8* src_y, int src_stride_y, |
| 698 | uint8* dst_argb, int dst_stride_argb, |
| 699 | int width, int height) { |
| 700 | int y; |
| 701 | void (*I400ToARGBRow)(const uint8* y_buf, |
| 702 | uint8* rgb_buf, |
| 703 | int width) = I400ToARGBRow_C; |
| 704 | if (!src_y || !dst_argb || |
| 705 | width <= 0 || height == 0) { |
| 706 | return -1; |
| 707 | } |
| 708 | // Negative height means invert the image. |
| 709 | if (height < 0) { |
| 710 | height = -height; |
| 711 | dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
| 712 | dst_stride_argb = -dst_stride_argb; |
| 713 | } |
| 714 | // Coalesce rows. |
| 715 | if (src_stride_y == width && |
| 716 | dst_stride_argb == width * 4) { |
| 717 | width *= height; |
| 718 | height = 1; |
| 719 | src_stride_y = dst_stride_argb = 0; |
| 720 | } |
| 721 | #if defined(HAS_I400TOARGBROW_SSE2) |
| 722 | if (TestCpuFlag(kCpuHasSSE2)) { |
| 723 | I400ToARGBRow = I400ToARGBRow_Any_SSE2; |
| 724 | if (IS_ALIGNED(width, 8)) { |
| 725 | I400ToARGBRow = I400ToARGBRow_SSE2; |
| 726 | } |
| 727 | } |
| 728 | #endif |
| 729 | #if defined(HAS_I400TOARGBROW_AVX2) |
| 730 | if (TestCpuFlag(kCpuHasAVX2)) { |
| 731 | I400ToARGBRow = I400ToARGBRow_Any_AVX2; |
| 732 | if (IS_ALIGNED(width, 16)) { |
| 733 | I400ToARGBRow = I400ToARGBRow_AVX2; |
| 734 | } |
| 735 | } |
| 736 | #endif |
| 737 | #if defined(HAS_I400TOARGBROW_NEON) |
| 738 | if (TestCpuFlag(kCpuHasNEON)) { |
| 739 | I400ToARGBRow = I400ToARGBRow_Any_NEON; |
| 740 | if (IS_ALIGNED(width, 8)) { |
| 741 | I400ToARGBRow = I400ToARGBRow_NEON; |
| 742 | } |
| 743 | } |
| 744 | #endif |
| 745 |
| 746 | for (y = 0; y < height; ++y) { |
| 747 | I400ToARGBRow(src_y, dst_argb, width); |
| 748 | dst_argb += dst_stride_argb; |
| 749 | src_y += src_stride_y; |
| 750 | } |
| 751 | return 0; |
| 752 | } |
| 753 |
| 754 | // Convert J400 to ARGB. |
| 755 | LIBYUV_API |
| 756 | int J400ToARGB(const uint8* src_y, int src_stride_y, |
| 757 | uint8* dst_argb, int dst_stride_argb, |
| 758 | int width, int height) { |
| 759 | int y; |
| 760 | void (*J400ToARGBRow)(const uint8* src_y, uint8* dst_argb, int width) = |
| 761 | J400ToARGBRow_C; |
| 762 | if (!src_y || !dst_argb || |
| 763 | width <= 0 || height == 0) { |
| 764 | return -1; |
| 765 | } |
| 766 | // Negative height means invert the image. |
| 767 | if (height < 0) { |
| 768 | height = -height; |
| 769 | src_y = src_y + (height - 1) * src_stride_y; |
| 770 | src_stride_y = -src_stride_y; |
| 771 | } |
| 772 | // Coalesce rows. |
| 773 | if (src_stride_y == width && |
| 774 | dst_stride_argb == width * 4) { |
| 775 | width *= height; |
| 776 | height = 1; |
| 777 | src_stride_y = dst_stride_argb = 0; |
| 778 | } |
| 779 | #if defined(HAS_J400TOARGBROW_SSE2) |
| 780 | if (TestCpuFlag(kCpuHasSSE2)) { |
| 781 | J400ToARGBRow = J400ToARGBRow_Any_SSE2; |
| 782 | if (IS_ALIGNED(width, 8)) { |
| 783 | J400ToARGBRow = J400ToARGBRow_SSE2; |
| 784 | } |
| 785 | } |
| 786 | #endif |
| 787 | #if defined(HAS_J400TOARGBROW_AVX2) |
| 788 | if (TestCpuFlag(kCpuHasAVX2)) { |
| 789 | J400ToARGBRow = J400ToARGBRow_Any_AVX2; |
| 790 | if (IS_ALIGNED(width, 16)) { |
| 791 | J400ToARGBRow = J400ToARGBRow_AVX2; |
| 792 | } |
| 793 | } |
| 794 | #endif |
| 795 | #if defined(HAS_J400TOARGBROW_NEON) |
| 796 | if (TestCpuFlag(kCpuHasNEON)) { |
| 797 | J400ToARGBRow = J400ToARGBRow_Any_NEON; |
| 798 | if (IS_ALIGNED(width, 8)) { |
| 799 | J400ToARGBRow = J400ToARGBRow_NEON; |
| 800 | } |
| 801 | } |
| 802 | #endif |
| 803 | for (y = 0; y < height; ++y) { |
| 804 | J400ToARGBRow(src_y, dst_argb, width); |
| 805 | src_y += src_stride_y; |
| 806 | dst_argb += dst_stride_argb; |
| 807 | } |
| 808 | return 0; |
| 809 | } |
| 810 |
| 811 | // Shuffle table for converting BGRA to ARGB. |
| 812 | static uvec8 kShuffleMaskBGRAToARGB = { |
| 813 | 3u, 2u, 1u, 0u, 7u, 6u, 5u, 4u, 11u, 10u, 9u, 8u, 15u, 14u, 13u, 12u |
| 814 | }; |
| 815 |
| 816 | // Shuffle table for converting ABGR to ARGB. |
| 817 | static uvec8 kShuffleMaskABGRToARGB = { |
| 818 | 2u, 1u, 0u, 3u, 6u, 5u, 4u, 7u, 10u, 9u, 8u, 11u, 14u, 13u, 12u, 15u |
| 819 | }; |
| 820 |
| 821 | // Shuffle table for converting RGBA to ARGB. |
| 822 | static uvec8 kShuffleMaskRGBAToARGB = { |
| 823 | 1u, 2u, 3u, 0u, 5u, 6u, 7u, 4u, 9u, 10u, 11u, 8u, 13u, 14u, 15u, 12u |
| 824 | }; |
| 825 |
| 826 | // Convert BGRA to ARGB. |
| 827 | LIBYUV_API |
| 828 | int BGRAToARGB(const uint8* src_bgra, int src_stride_bgra, |
| 829 | uint8* dst_argb, int dst_stride_argb, |
| 830 | int width, int height) { |
| 831 | return ARGBShuffle(src_bgra, src_stride_bgra, |
| 832 | dst_argb, dst_stride_argb, |
| 833 | (const uint8*)(&kShuffleMaskBGRAToARGB), |
| 834 | width, height); |
| 835 | } |
| 836 |
| 837 | // Convert ARGB to BGRA (same as BGRAToARGB). |
| 838 | LIBYUV_API |
| 839 | int ARGBToBGRA(const uint8* src_bgra, int src_stride_bgra, |
| 840 | uint8* dst_argb, int dst_stride_argb, |
| 841 | int width, int height) { |
| 842 | return ARGBShuffle(src_bgra, src_stride_bgra, |
| 843 | dst_argb, dst_stride_argb, |
| 844 | (const uint8*)(&kShuffleMaskBGRAToARGB), |
| 845 | width, height); |
| 846 | } |
| 847 |
| 848 | // Convert ABGR to ARGB. |
| 849 | LIBYUV_API |
| 850 | int ABGRToARGB(const uint8* src_abgr, int src_stride_abgr, |
| 851 | uint8* dst_argb, int dst_stride_argb, |
| 852 | int width, int height) { |
| 853 | return ARGBShuffle(src_abgr, src_stride_abgr, |
| 854 | dst_argb, dst_stride_argb, |
| 855 | (const uint8*)(&kShuffleMaskABGRToARGB), |
| 856 | width, height); |
| 857 | } |
| 858 |
| 859 | // Convert ARGB to ABGR to (same as ABGRToARGB). |
| 860 | LIBYUV_API |
| 861 | int ARGBToABGR(const uint8* src_abgr, int src_stride_abgr, |
| 862 | uint8* dst_argb, int dst_stride_argb, |
| 863 | int width, int height) { |
| 864 | return ARGBShuffle(src_abgr, src_stride_abgr, |
| 865 | dst_argb, dst_stride_argb, |
| 866 | (const uint8*)(&kShuffleMaskABGRToARGB), |
| 867 | width, height); |
| 868 | } |
| 869 |
| 870 | // Convert RGBA to ARGB. |
| 871 | LIBYUV_API |
| 872 | int RGBAToARGB(const uint8* src_rgba, int src_stride_rgba, |
| 873 | uint8* dst_argb, int dst_stride_argb, |
| 874 | int width, int height) { |
| 875 | return ARGBShuffle(src_rgba, src_stride_rgba, |
| 876 | dst_argb, dst_stride_argb, |
| 877 | (const uint8*)(&kShuffleMaskRGBAToARGB), |
| 878 | width, height); |
| 879 | } |
| 880 |
| 881 | // Convert RGB24 to ARGB. |
| 882 | LIBYUV_API |
| 883 | int RGB24ToARGB(const uint8* src_rgb24, int src_stride_rgb24, |
| 884 | uint8* dst_argb, int dst_stride_argb, |
| 885 | int width, int height) { |
| 886 | int y; |
| 887 | void (*RGB24ToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int width) = |
| 888 | RGB24ToARGBRow_C; |
| 889 | if (!src_rgb24 || !dst_argb || |
| 890 | width <= 0 || height == 0) { |
| 891 | return -1; |
| 892 | } |
| 893 | // Negative height means invert the image. |
| 894 | if (height < 0) { |
| 895 | height = -height; |
| 896 | src_rgb24 = src_rgb24 + (height - 1) * src_stride_rgb24; |
| 897 | src_stride_rgb24 = -src_stride_rgb24; |
| 898 | } |
| 899 | // Coalesce rows. |
| 900 | if (src_stride_rgb24 == width * 3 && |
| 901 | dst_stride_argb == width * 4) { |
| 902 | width *= height; |
| 903 | height = 1; |
| 904 | src_stride_rgb24 = dst_stride_argb = 0; |
| 905 | } |
| 906 | #if defined(HAS_RGB24TOARGBROW_SSSE3) |
| 907 | if (TestCpuFlag(kCpuHasSSSE3)) { |
| 908 | RGB24ToARGBRow = RGB24ToARGBRow_Any_SSSE3; |
| 909 | if (IS_ALIGNED(width, 16)) { |
| 910 | RGB24ToARGBRow = RGB24ToARGBRow_SSSE3; |
| 911 | } |
| 912 | } |
| 913 | #endif |
| 914 | #if defined(HAS_RGB24TOARGBROW_NEON) |
| 915 | if (TestCpuFlag(kCpuHasNEON)) { |
| 916 | RGB24ToARGBRow = RGB24ToARGBRow_Any_NEON; |
| 917 | if (IS_ALIGNED(width, 8)) { |
| 918 | RGB24ToARGBRow = RGB24ToARGBRow_NEON; |
| 919 | } |
| 920 | } |
| 921 | #endif |
| 922 |
| 923 | for (y = 0; y < height; ++y) { |
| 924 | RGB24ToARGBRow(src_rgb24, dst_argb, width); |
| 925 | src_rgb24 += src_stride_rgb24; |
| 926 | dst_argb += dst_stride_argb; |
| 927 | } |
| 928 | return 0; |
| 929 | } |
| 930 |
| 931 | // Convert RAW to ARGB. |
| 932 | LIBYUV_API |
| 933 | int RAWToARGB(const uint8* src_raw, int src_stride_raw, |
| 934 | uint8* dst_argb, int dst_stride_argb, |
| 935 | int width, int height) { |
| 936 | int y; |
| 937 | void (*RAWToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int width) = |
| 938 | RAWToARGBRow_C; |
| 939 | if (!src_raw || !dst_argb || |
| 940 | width <= 0 || height == 0) { |
| 941 | return -1; |
| 942 | } |
| 943 | // Negative height means invert the image. |
| 944 | if (height < 0) { |
| 945 | height = -height; |
| 946 | src_raw = src_raw + (height - 1) * src_stride_raw; |
| 947 | src_stride_raw = -src_stride_raw; |
| 948 | } |
| 949 | // Coalesce rows. |
| 950 | if (src_stride_raw == width * 3 && |
| 951 | dst_stride_argb == width * 4) { |
| 952 | width *= height; |
| 953 | height = 1; |
| 954 | src_stride_raw = dst_stride_argb = 0; |
| 955 | } |
| 956 | #if defined(HAS_RAWTOARGBROW_SSSE3) |
| 957 | if (TestCpuFlag(kCpuHasSSSE3)) { |
| 958 | RAWToARGBRow = RAWToARGBRow_Any_SSSE3; |
| 959 | if (IS_ALIGNED(width, 16)) { |
| 960 | RAWToARGBRow = RAWToARGBRow_SSSE3; |
| 961 | } |
| 962 | } |
| 963 | #endif |
| 964 | #if defined(HAS_RAWTOARGBROW_NEON) |
| 965 | if (TestCpuFlag(kCpuHasNEON)) { |
| 966 | RAWToARGBRow = RAWToARGBRow_Any_NEON; |
| 967 | if (IS_ALIGNED(width, 8)) { |
| 968 | RAWToARGBRow = RAWToARGBRow_NEON; |
| 969 | } |
| 970 | } |
| 971 | #endif |
| 972 |
| 973 | for (y = 0; y < height; ++y) { |
| 974 | RAWToARGBRow(src_raw, dst_argb, width); |
| 975 | src_raw += src_stride_raw; |
| 976 | dst_argb += dst_stride_argb; |
| 977 | } |
| 978 | return 0; |
| 979 | } |
| 980 |
| 981 | // Convert RGB565 to ARGB. |
| 982 | LIBYUV_API |
| 983 | int RGB565ToARGB(const uint8* src_rgb565, int src_stride_rgb565, |
| 984 | uint8* dst_argb, int dst_stride_argb, |
| 985 | int width, int height) { |
| 986 | int y; |
| 987 | void (*RGB565ToARGBRow)(const uint8* src_rgb565, uint8* dst_argb, int width) = |
| 988 | RGB565ToARGBRow_C; |
| 989 | if (!src_rgb565 || !dst_argb || |
| 990 | width <= 0 || height == 0) { |
| 991 | return -1; |
| 992 | } |
| 993 | // Negative height means invert the image. |
| 994 | if (height < 0) { |
| 995 | height = -height; |
| 996 | src_rgb565 = src_rgb565 + (height - 1) * src_stride_rgb565; |
| 997 | src_stride_rgb565 = -src_stride_rgb565; |
| 998 | } |
| 999 | // Coalesce rows. |
| 1000 | if (src_stride_rgb565 == width * 2 && |
| 1001 | dst_stride_argb == width * 4) { |
| 1002 | width *= height; |
| 1003 | height = 1; |
| 1004 | src_stride_rgb565 = dst_stride_argb = 0; |
| 1005 | } |
| 1006 | #if defined(HAS_RGB565TOARGBROW_SSE2) |
| 1007 | if (TestCpuFlag(kCpuHasSSE2)) { |
| 1008 | RGB565ToARGBRow = RGB565ToARGBRow_Any_SSE2; |
| 1009 | if (IS_ALIGNED(width, 8)) { |
| 1010 | RGB565ToARGBRow = RGB565ToARGBRow_SSE2; |
| 1011 | } |
| 1012 | } |
| 1013 | #endif |
| 1014 | #if defined(HAS_RGB565TOARGBROW_AVX2) |
| 1015 | if (TestCpuFlag(kCpuHasAVX2)) { |
| 1016 | RGB565ToARGBRow = RGB565ToARGBRow_Any_AVX2; |
| 1017 | if (IS_ALIGNED(width, 16)) { |
| 1018 | RGB565ToARGBRow = RGB565ToARGBRow_AVX2; |
| 1019 | } |
| 1020 | } |
| 1021 | #endif |
| 1022 | #if defined(HAS_RGB565TOARGBROW_NEON) |
| 1023 | if (TestCpuFlag(kCpuHasNEON)) { |
| 1024 | RGB565ToARGBRow = RGB565ToARGBRow_Any_NEON; |
| 1025 | if (IS_ALIGNED(width, 8)) { |
| 1026 | RGB565ToARGBRow = RGB565ToARGBRow_NEON; |
| 1027 | } |
| 1028 | } |
| 1029 | #endif |
| 1030 |
| 1031 | for (y = 0; y < height; ++y) { |
| 1032 | RGB565ToARGBRow(src_rgb565, dst_argb, width); |
| 1033 | src_rgb565 += src_stride_rgb565; |
| 1034 | dst_argb += dst_stride_argb; |
| 1035 | } |
| 1036 | return 0; |
| 1037 | } |
| 1038 |
| 1039 | // Convert ARGB1555 to ARGB. |
| 1040 | LIBYUV_API |
| 1041 | int ARGB1555ToARGB(const uint8* src_argb1555, int src_stride_argb1555, |
| 1042 | uint8* dst_argb, int dst_stride_argb, |
| 1043 | int width, int height) { |
| 1044 | int y; |
| 1045 | void (*ARGB1555ToARGBRow)(const uint8* src_argb1555, uint8* dst_argb, |
| 1046 | int width) = ARGB1555ToARGBRow_C; |
| 1047 | if (!src_argb1555 || !dst_argb || |
| 1048 | width <= 0 || height == 0) { |
| 1049 | return -1; |
| 1050 | } |
| 1051 | // Negative height means invert the image. |
| 1052 | if (height < 0) { |
| 1053 | height = -height; |
| 1054 | src_argb1555 = src_argb1555 + (height - 1) * src_stride_argb1555; |
| 1055 | src_stride_argb1555 = -src_stride_argb1555; |
| 1056 | } |
| 1057 | // Coalesce rows. |
| 1058 | if (src_stride_argb1555 == width * 2 && |
| 1059 | dst_stride_argb == width * 4) { |
| 1060 | width *= height; |
| 1061 | height = 1; |
| 1062 | src_stride_argb1555 = dst_stride_argb = 0; |
| 1063 | } |
| 1064 | #if defined(HAS_ARGB1555TOARGBROW_SSE2) |
| 1065 | if (TestCpuFlag(kCpuHasSSE2)) { |
| 1066 | ARGB1555ToARGBRow = ARGB1555ToARGBRow_Any_SSE2; |
| 1067 | if (IS_ALIGNED(width, 8)) { |
| 1068 | ARGB1555ToARGBRow = ARGB1555ToARGBRow_SSE2; |
| 1069 | } |
| 1070 | } |
| 1071 | #endif |
| 1072 | #if defined(HAS_ARGB1555TOARGBROW_AVX2) |
| 1073 | if (TestCpuFlag(kCpuHasAVX2)) { |
| 1074 | ARGB1555ToARGBRow = ARGB1555ToARGBRow_Any_AVX2; |
| 1075 | if (IS_ALIGNED(width, 16)) { |
| 1076 | ARGB1555ToARGBRow = ARGB1555ToARGBRow_AVX2; |
| 1077 | } |
| 1078 | } |
| 1079 | #endif |
| 1080 | #if defined(HAS_ARGB1555TOARGBROW_NEON) |
| 1081 | if (TestCpuFlag(kCpuHasNEON)) { |
| 1082 | ARGB1555ToARGBRow = ARGB1555ToARGBRow_Any_NEON; |
| 1083 | if (IS_ALIGNED(width, 8)) { |
| 1084 | ARGB1555ToARGBRow = ARGB1555ToARGBRow_NEON; |
| 1085 | } |
| 1086 | } |
| 1087 | #endif |
| 1088 |
| 1089 | for (y = 0; y < height; ++y) { |
| 1090 | ARGB1555ToARGBRow(src_argb1555, dst_argb, width); |
| 1091 | src_argb1555 += src_stride_argb1555; |
| 1092 | dst_argb += dst_stride_argb; |
| 1093 | } |
| 1094 | return 0; |
| 1095 | } |
| 1096 |
| 1097 | // Convert ARGB4444 to ARGB. |
| 1098 | LIBYUV_API |
| 1099 | int ARGB4444ToARGB(const uint8* src_argb4444, int src_stride_argb4444, |
| 1100 | uint8* dst_argb, int dst_stride_argb, |
| 1101 | int width, int height) { |
| 1102 | int y; |
| 1103 | void (*ARGB4444ToARGBRow)(const uint8* src_argb4444, uint8* dst_argb, |
| 1104 | int width) = ARGB4444ToARGBRow_C; |
| 1105 | if (!src_argb4444 || !dst_argb || |
| 1106 | width <= 0 || height == 0) { |
| 1107 | return -1; |
| 1108 | } |
| 1109 | // Negative height means invert the image. |
| 1110 | if (height < 0) { |
| 1111 | height = -height; |
| 1112 | src_argb4444 = src_argb4444 + (height - 1) * src_stride_argb4444; |
| 1113 | src_stride_argb4444 = -src_stride_argb4444; |
| 1114 | } |
| 1115 | // Coalesce rows. |
| 1116 | if (src_stride_argb4444 == width * 2 && |
| 1117 | dst_stride_argb == width * 4) { |
| 1118 | width *= height; |
| 1119 | height = 1; |
| 1120 | src_stride_argb4444 = dst_stride_argb = 0; |
| 1121 | } |
| 1122 | #if defined(HAS_ARGB4444TOARGBROW_SSE2) |
| 1123 | if (TestCpuFlag(kCpuHasSSE2)) { |
| 1124 | ARGB4444ToARGBRow = ARGB4444ToARGBRow_Any_SSE2; |
| 1125 | if (IS_ALIGNED(width, 8)) { |
| 1126 | ARGB4444ToARGBRow = ARGB4444ToARGBRow_SSE2; |
| 1127 | } |
| 1128 | } |
| 1129 | #endif |
| 1130 | #if defined(HAS_ARGB4444TOARGBROW_AVX2) |
| 1131 | if (TestCpuFlag(kCpuHasAVX2)) { |
| 1132 | ARGB4444ToARGBRow = ARGB4444ToARGBRow_Any_AVX2; |
| 1133 | if (IS_ALIGNED(width, 16)) { |
| 1134 | ARGB4444ToARGBRow = ARGB4444ToARGBRow_AVX2; |
| 1135 | } |
| 1136 | } |
| 1137 | #endif |
| 1138 | #if defined(HAS_ARGB4444TOARGBROW_NEON) |
| 1139 | if (TestCpuFlag(kCpuHasNEON)) { |
| 1140 | ARGB4444ToARGBRow = ARGB4444ToARGBRow_Any_NEON; |
| 1141 | if (IS_ALIGNED(width, 8)) { |
| 1142 | ARGB4444ToARGBRow = ARGB4444ToARGBRow_NEON; |
| 1143 | } |
| 1144 | } |
| 1145 | #endif |
| 1146 |
| 1147 | for (y = 0; y < height; ++y) { |
| 1148 | ARGB4444ToARGBRow(src_argb4444, dst_argb, width); |
| 1149 | src_argb4444 += src_stride_argb4444; |
| 1150 | dst_argb += dst_stride_argb; |
| 1151 | } |
| 1152 | return 0; |
| 1153 | } |
| 1154 |
| 1155 | // Convert NV12 to ARGB. |
| 1156 | LIBYUV_API |
| 1157 | int NV12ToARGB(const uint8* src_y, int src_stride_y, |
| 1158 | const uint8* src_uv, int src_stride_uv, |
| 1159 | uint8* dst_argb, int dst_stride_argb, |
| 1160 | int width, int height) { |
| 1161 | int y; |
| 1162 | void (*NV12ToARGBRow)(const uint8* y_buf, |
| 1163 | const uint8* uv_buf, |
| 1164 | uint8* rgb_buf, |
| 1165 | const struct YuvConstants* yuvconstants, |
| 1166 | int width) = NV12ToARGBRow_C; |
| 1167 | if (!src_y || !src_uv || !dst_argb || |
| 1168 | width <= 0 || height == 0) { |
| 1169 | return -1; |
| 1170 | } |
| 1171 | // Negative height means invert the image. |
| 1172 | if (height < 0) { |
| 1173 | height = -height; |
| 1174 | dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
| 1175 | dst_stride_argb = -dst_stride_argb; |
| 1176 | } |
| 1177 | #if defined(HAS_NV12TOARGBROW_SSSE3) |
| 1178 | if (TestCpuFlag(kCpuHasSSSE3)) { |
| 1179 | NV12ToARGBRow = NV12ToARGBRow_Any_SSSE3; |
| 1180 | if (IS_ALIGNED(width, 8)) { |
| 1181 | NV12ToARGBRow = NV12ToARGBRow_SSSE3; |
| 1182 | } |
| 1183 | } |
| 1184 | #endif |
| 1185 | #if defined(HAS_NV12TOARGBROW_AVX2) |
| 1186 | if (TestCpuFlag(kCpuHasAVX2)) { |
| 1187 | NV12ToARGBRow = NV12ToARGBRow_Any_AVX2; |
| 1188 | if (IS_ALIGNED(width, 16)) { |
| 1189 | NV12ToARGBRow = NV12ToARGBRow_AVX2; |
| 1190 | } |
| 1191 | } |
| 1192 | #endif |
| 1193 | #if defined(HAS_NV12TOARGBROW_NEON) |
| 1194 | if (TestCpuFlag(kCpuHasNEON)) { |
| 1195 | NV12ToARGBRow = NV12ToARGBRow_Any_NEON; |
| 1196 | if (IS_ALIGNED(width, 8)) { |
| 1197 | NV12ToARGBRow = NV12ToARGBRow_NEON; |
| 1198 | } |
| 1199 | } |
| 1200 | #endif |
| 1201 |
| 1202 | for (y = 0; y < height; ++y) { |
| 1203 | NV12ToARGBRow(src_y, src_uv, dst_argb, &kYuvI601Constants, width); |
| 1204 | dst_argb += dst_stride_argb; |
| 1205 | src_y += src_stride_y; |
| 1206 | if (y & 1) { |
| 1207 | src_uv += src_stride_uv; |
| 1208 | } |
| 1209 | } |
| 1210 | return 0; |
| 1211 | } |
| 1212 |
| 1213 | // Convert NV21 to ARGB. |
| 1214 | LIBYUV_API |
| 1215 | int NV21ToARGB(const uint8* src_y, int src_stride_y, |
| 1216 | const uint8* src_uv, int src_stride_uv, |
| 1217 | uint8* dst_argb, int dst_stride_argb, |
| 1218 | int width, int height) { |
| 1219 | int y; |
| 1220 | void (*NV21ToARGBRow)(const uint8* y_buf, |
| 1221 | const uint8* uv_buf, |
| 1222 | uint8* rgb_buf, |
| 1223 | const struct YuvConstants* yuvconstants, |
| 1224 | int width) = NV21ToARGBRow_C; |
| 1225 | if (!src_y || !src_uv || !dst_argb || |
| 1226 | width <= 0 || height == 0) { |
| 1227 | return -1; |
| 1228 | } |
| 1229 | // Negative height means invert the image. |
| 1230 | if (height < 0) { |
| 1231 | height = -height; |
| 1232 | dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
| 1233 | dst_stride_argb = -dst_stride_argb; |
| 1234 | } |
| 1235 | #if defined(HAS_NV21TOARGBROW_SSSE3) |
| 1236 | if (TestCpuFlag(kCpuHasSSSE3)) { |
| 1237 | NV21ToARGBRow = NV21ToARGBRow_Any_SSSE3; |
| 1238 | if (IS_ALIGNED(width, 8)) { |
| 1239 | NV21ToARGBRow = NV21ToARGBRow_SSSE3; |
| 1240 | } |
| 1241 | } |
| 1242 | #endif |
| 1243 | #if defined(HAS_NV21TOARGBROW_AVX2) |
| 1244 | if (TestCpuFlag(kCpuHasAVX2)) { |
| 1245 | NV21ToARGBRow = NV21ToARGBRow_Any_AVX2; |
| 1246 | if (IS_ALIGNED(width, 16)) { |
| 1247 | NV21ToARGBRow = NV21ToARGBRow_AVX2; |
| 1248 | } |
| 1249 | } |
| 1250 | #endif |
| 1251 | #if defined(HAS_NV21TOARGBROW_NEON) |
| 1252 | if (TestCpuFlag(kCpuHasNEON)) { |
| 1253 | NV21ToARGBRow = NV21ToARGBRow_Any_NEON; |
| 1254 | if (IS_ALIGNED(width, 8)) { |
| 1255 | NV21ToARGBRow = NV21ToARGBRow_NEON; |
| 1256 | } |
| 1257 | } |
| 1258 | #endif |
| 1259 |
| 1260 | for (y = 0; y < height; ++y) { |
| 1261 | NV21ToARGBRow(src_y, src_uv, dst_argb, &kYuvI601Constants, width); |
| 1262 | dst_argb += dst_stride_argb; |
| 1263 | src_y += src_stride_y; |
| 1264 | if (y & 1) { |
| 1265 | src_uv += src_stride_uv; |
| 1266 | } |
| 1267 | } |
| 1268 | return 0; |
| 1269 | } |
| 1270 |
| 1271 | // Convert M420 to ARGB. |
| 1272 | LIBYUV_API |
| 1273 | int M420ToARGB(const uint8* src_m420, int src_stride_m420, |
| 1274 | uint8* dst_argb, int dst_stride_argb, |
| 1275 | int width, int height) { |
| 1276 | int y; |
| 1277 | void (*NV12ToARGBRow)(const uint8* y_buf, |
| 1278 | const uint8* uv_buf, |
| 1279 | uint8* rgb_buf, |
| 1280 | const struct YuvConstants* yuvconstants, |
| 1281 | int width) = NV12ToARGBRow_C; |
| 1282 | if (!src_m420 || !dst_argb || |
| 1283 | width <= 0 || height == 0) { |
| 1284 | return -1; |
| 1285 | } |
| 1286 | // Negative height means invert the image. |
| 1287 | if (height < 0) { |
| 1288 | height = -height; |
| 1289 | dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
| 1290 | dst_stride_argb = -dst_stride_argb; |
| 1291 | } |
| 1292 | #if defined(HAS_NV12TOARGBROW_SSSE3) |
| 1293 | if (TestCpuFlag(kCpuHasSSSE3)) { |
| 1294 | NV12ToARGBRow = NV12ToARGBRow_Any_SSSE3; |
| 1295 | if (IS_ALIGNED(width, 8)) { |
| 1296 | NV12ToARGBRow = NV12ToARGBRow_SSSE3; |
| 1297 | } |
| 1298 | } |
| 1299 | #endif |
| 1300 | #if defined(HAS_NV12TOARGBROW_AVX2) |
| 1301 | if (TestCpuFlag(kCpuHasAVX2)) { |
| 1302 | NV12ToARGBRow = NV12ToARGBRow_Any_AVX2; |
| 1303 | if (IS_ALIGNED(width, 16)) { |
| 1304 | NV12ToARGBRow = NV12ToARGBRow_AVX2; |
| 1305 | } |
| 1306 | } |
| 1307 | #endif |
| 1308 | #if defined(HAS_NV12TOARGBROW_NEON) |
| 1309 | if (TestCpuFlag(kCpuHasNEON)) { |
| 1310 | NV12ToARGBRow = NV12ToARGBRow_Any_NEON; |
| 1311 | if (IS_ALIGNED(width, 8)) { |
| 1312 | NV12ToARGBRow = NV12ToARGBRow_NEON; |
| 1313 | } |
| 1314 | } |
| 1315 | #endif |
| 1316 |
| 1317 | for (y = 0; y < height - 1; y += 2) { |
| 1318 | NV12ToARGBRow(src_m420, src_m420 + src_stride_m420 * 2, dst_argb, |
| 1319 | &kYuvI601Constants, width); |
| 1320 | NV12ToARGBRow(src_m420 + src_stride_m420, src_m420 + src_stride_m420 * 2, |
| 1321 | dst_argb + dst_stride_argb, &kYuvI601Constants, width); |
| 1322 | dst_argb += dst_stride_argb * 2; |
| 1323 | src_m420 += src_stride_m420 * 3; |
| 1324 | } |
| 1325 | if (height & 1) { |
| 1326 | NV12ToARGBRow(src_m420, src_m420 + src_stride_m420 * 2, dst_argb, |
| 1327 | &kYuvI601Constants, width); |
| 1328 | } |
| 1329 | return 0; |
| 1330 | } |
| 1331 |
| 1332 | // Convert YUY2 to ARGB. |
| 1333 | LIBYUV_API |
| 1334 | int YUY2ToARGB(const uint8* src_yuy2, int src_stride_yuy2, |
| 1335 | uint8* dst_argb, int dst_stride_argb, |
| 1336 | int width, int height) { |
| 1337 | int y; |
| 1338 | void (*YUY2ToARGBRow)(const uint8* src_yuy2, |
| 1339 | uint8* dst_argb, |
| 1340 | const struct YuvConstants* yuvconstants, |
| 1341 | int width) = |
| 1342 | YUY2ToARGBRow_C; |
| 1343 | if (!src_yuy2 || !dst_argb || |
| 1344 | width <= 0 || height == 0) { |
| 1345 | return -1; |
| 1346 | } |
| 1347 | // Negative height means invert the image. |
| 1348 | if (height < 0) { |
| 1349 | height = -height; |
| 1350 | src_yuy2 = src_yuy2 + (height - 1) * src_stride_yuy2; |
| 1351 | src_stride_yuy2 = -src_stride_yuy2; |
| 1352 | } |
| 1353 | // Coalesce rows. |
| 1354 | if (src_stride_yuy2 == width * 2 && |
| 1355 | dst_stride_argb == width * 4) { |
| 1356 | width *= height; |
| 1357 | height = 1; |
| 1358 | src_stride_yuy2 = dst_stride_argb = 0; |
| 1359 | } |
| 1360 | #if defined(HAS_YUY2TOARGBROW_SSSE3) |
| 1361 | if (TestCpuFlag(kCpuHasSSSE3)) { |
| 1362 | YUY2ToARGBRow = YUY2ToARGBRow_Any_SSSE3; |
| 1363 | if (IS_ALIGNED(width, 16)) { |
| 1364 | YUY2ToARGBRow = YUY2ToARGBRow_SSSE3; |
| 1365 | } |
| 1366 | } |
| 1367 | #endif |
| 1368 | #if defined(HAS_YUY2TOARGBROW_AVX2) |
| 1369 | if (TestCpuFlag(kCpuHasAVX2)) { |
| 1370 | YUY2ToARGBRow = YUY2ToARGBRow_Any_AVX2; |
| 1371 | if (IS_ALIGNED(width, 32)) { |
| 1372 | YUY2ToARGBRow = YUY2ToARGBRow_AVX2; |
| 1373 | } |
| 1374 | } |
| 1375 | #endif |
| 1376 | #if defined(HAS_YUY2TOARGBROW_NEON) |
| 1377 | if (TestCpuFlag(kCpuHasNEON)) { |
| 1378 | YUY2ToARGBRow = YUY2ToARGBRow_Any_NEON; |
| 1379 | if (IS_ALIGNED(width, 8)) { |
| 1380 | YUY2ToARGBRow = YUY2ToARGBRow_NEON; |
| 1381 | } |
| 1382 | } |
| 1383 | #endif |
| 1384 | for (y = 0; y < height; ++y) { |
| 1385 | YUY2ToARGBRow(src_yuy2, dst_argb, &kYuvI601Constants, width); |
| 1386 | src_yuy2 += src_stride_yuy2; |
| 1387 | dst_argb += dst_stride_argb; |
| 1388 | } |
| 1389 | return 0; |
| 1390 | } |
| 1391 |
| 1392 | // Convert UYVY to ARGB. |
| 1393 | LIBYUV_API |
| 1394 | int UYVYToARGB(const uint8* src_uyvy, int src_stride_uyvy, |
| 1395 | uint8* dst_argb, int dst_stride_argb, |
| 1396 | int width, int height) { |
| 1397 | int y; |
| 1398 | void (*UYVYToARGBRow)(const uint8* src_uyvy, |
| 1399 | uint8* dst_argb, |
| 1400 | const struct YuvConstants* yuvconstants, |
| 1401 | int width) = |
| 1402 | UYVYToARGBRow_C; |
| 1403 | if (!src_uyvy || !dst_argb || |
| 1404 | width <= 0 || height == 0) { |
| 1405 | return -1; |
| 1406 | } |
| 1407 | // Negative height means invert the image. |
| 1408 | if (height < 0) { |
| 1409 | height = -height; |
| 1410 | src_uyvy = src_uyvy + (height - 1) * src_stride_uyvy; |
| 1411 | src_stride_uyvy = -src_stride_uyvy; |
| 1412 | } |
| 1413 | // Coalesce rows. |
| 1414 | if (src_stride_uyvy == width * 2 && |
| 1415 | dst_stride_argb == width * 4) { |
| 1416 | width *= height; |
| 1417 | height = 1; |
| 1418 | src_stride_uyvy = dst_stride_argb = 0; |
| 1419 | } |
| 1420 | #if defined(HAS_UYVYTOARGBROW_SSSE3) |
| 1421 | if (TestCpuFlag(kCpuHasSSSE3)) { |
| 1422 | UYVYToARGBRow = UYVYToARGBRow_Any_SSSE3; |
| 1423 | if (IS_ALIGNED(width, 16)) { |
| 1424 | UYVYToARGBRow = UYVYToARGBRow_SSSE3; |
| 1425 | } |
| 1426 | } |
| 1427 | #endif |
| 1428 | #if defined(HAS_UYVYTOARGBROW_AVX2) |
| 1429 | if (TestCpuFlag(kCpuHasAVX2)) { |
| 1430 | UYVYToARGBRow = UYVYToARGBRow_Any_AVX2; |
| 1431 | if (IS_ALIGNED(width, 32)) { |
| 1432 | UYVYToARGBRow = UYVYToARGBRow_AVX2; |
| 1433 | } |
| 1434 | } |
| 1435 | #endif |
| 1436 | #if defined(HAS_UYVYTOARGBROW_NEON) |
| 1437 | if (TestCpuFlag(kCpuHasNEON)) { |
| 1438 | UYVYToARGBRow = UYVYToARGBRow_Any_NEON; |
| 1439 | if (IS_ALIGNED(width, 8)) { |
| 1440 | UYVYToARGBRow = UYVYToARGBRow_NEON; |
| 1441 | } |
| 1442 | } |
| 1443 | #endif |
| 1444 | for (y = 0; y < height; ++y) { |
| 1445 | UYVYToARGBRow(src_uyvy, dst_argb, &kYuvI601Constants, width); |
| 1446 | src_uyvy += src_stride_uyvy; |
| 1447 | dst_argb += dst_stride_argb; |
| 1448 | } |
| 1449 | return 0; |
| 1450 | } |
| 1451 |
| 1452 | #ifdef __cplusplus |
| 1453 | } // extern "C" |
| 1454 | } // namespace libyuv |
| 1455 | #endif |
| 1456 |