1 /* 2 * Copyright 2012 The LibYuv Project Authors. All rights reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef INCLUDE_LIBYUV_CONVERT_ARGB_H_ 12 #define INCLUDE_LIBYUV_CONVERT_ARGB_H_ 13 14 #include "libyuv/basic_types.h" 15 16 #include "libyuv/rotate.h" // For enum RotationMode. 17 #include "libyuv/scale.h" // For enum FilterMode. 18 19 #ifdef __cplusplus 20 namespace libyuv { 21 extern "C" { 22 #endif 23 24 // Conversion matrix for YUV to RGB 25 LIBYUV_API extern const struct YuvConstants kYuvI601Constants; // BT.601 26 LIBYUV_API extern const struct YuvConstants kYuvJPEGConstants; // BT.601 full 27 LIBYUV_API extern const struct YuvConstants kYuvH709Constants; // BT.709 28 LIBYUV_API extern const struct YuvConstants kYuvF709Constants; // BT.709 full 29 LIBYUV_API extern const struct YuvConstants kYuv2020Constants; // BT.2020 30 LIBYUV_API extern const struct YuvConstants kYuvV2020Constants; // BT.2020 full 31 32 // Conversion matrix for YVU to BGR 33 LIBYUV_API extern const struct YuvConstants kYvuI601Constants; // BT.601 34 LIBYUV_API extern const struct YuvConstants kYvuJPEGConstants; // BT.601 full 35 LIBYUV_API extern const struct YuvConstants kYvuH709Constants; // BT.709 36 LIBYUV_API extern const struct YuvConstants kYvuF709Constants; // BT.709 full 37 LIBYUV_API extern const struct YuvConstants kYvu2020Constants; // BT.2020 38 LIBYUV_API extern const struct YuvConstants kYvuV2020Constants; // BT.2020 full 39 40 // Macros for end swapped destination Matrix conversions. 41 // Swap UV and pass mirrored kYvuJPEGConstants matrix. 42 // TODO(fbarchard): Add macro for each Matrix function. 43 #define kYuvI601ConstantsVU kYvuI601Constants 44 #define kYuvJPEGConstantsVU kYvuJPEGConstants 45 #define kYuvH709ConstantsVU kYvuH709Constants 46 #define kYuvF709ConstantsVU kYvuF709Constants 47 #define kYuv2020ConstantsVU kYvu2020Constants 48 #define kYuvV2020ConstantsVU kYvuV2020Constants 49 50 #define NV12ToABGRMatrix(a, b, c, d, e, f, g, h, i) \ 51 NV21ToARGBMatrix(a, b, c, d, e, f, g##VU, h, i) 52 #define NV21ToABGRMatrix(a, b, c, d, e, f, g, h, i) \ 53 NV12ToARGBMatrix(a, b, c, d, e, f, g##VU, h, i) 54 #define NV12ToRAWMatrix(a, b, c, d, e, f, g, h, i) \ 55 NV21ToRGB24Matrix(a, b, c, d, e, f, g##VU, h, i) 56 #define NV21ToRAWMatrix(a, b, c, d, e, f, g, h, i) \ 57 NV12ToRGB24Matrix(a, b, c, d, e, f, g##VU, h, i) 58 #define I010ToABGRMatrix(a, b, c, d, e, f, g, h, i, j, k) \ 59 I010ToARGBMatrix(a, b, e, f, c, d, g, h, i##VU, j, k) 60 #define I210ToABGRMatrix(a, b, c, d, e, f, g, h, i, j, k) \ 61 I210ToARGBMatrix(a, b, e, f, c, d, g, h, i##VU, j, k) 62 #define I410ToABGRMatrix(a, b, c, d, e, f, g, h, i, j, k) \ 63 I410ToARGBMatrix(a, b, e, f, c, d, g, h, i##VU, j, k) 64 #define I010ToAB30Matrix(a, b, c, d, e, f, g, h, i, j, k) \ 65 I010ToAR30Matrix(a, b, e, f, c, d, g, h, i##VU, j, k) 66 #define I210ToAB30Matrix(a, b, c, d, e, f, g, h, i, j, k) \ 67 I210ToAR30Matrix(a, b, e, f, c, d, g, h, i##VU, j, k) 68 #define I410ToAB30Matrix(a, b, c, d, e, f, g, h, i, j, k) \ 69 I410ToAR30Matrix(a, b, e, f, c, d, g, h, i##VU, j, k) 70 #define I420AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, k, l, m, n) \ 71 I420AlphaToARGBMatrix(a, b, e, f, c, d, g, h, i, j, k##VU, l, m, n) 72 #define I422AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, k, l, m, n) \ 73 I422AlphaToARGBMatrix(a, b, e, f, c, d, g, h, i, j, k##VU, l, m, n) 74 #define I444AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, k, l, m, n) \ 75 I444AlphaToARGBMatrix(a, b, e, f, c, d, g, h, i, j, k##VU, l, m, n) 76 #define I010AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, k, l, m, n) \ 77 I010AlphaToARGBMatrix(a, b, e, f, c, d, g, h, i, j, k##VU, l, m, n) 78 #define I210AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, k, l, m, n) \ 79 I210AlphaToARGBMatrix(a, b, e, f, c, d, g, h, i, j, k##VU, l, m, n) 80 #define I410AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, k, l, m, n) \ 81 I410AlphaToARGBMatrix(a, b, e, f, c, d, g, h, i, j, k##VU, l, m, n) 82 83 // Alias. 84 #define ARGBToARGB ARGBCopy 85 86 // Copy ARGB to ARGB. 87 LIBYUV_API 88 int ARGBCopy(const uint8_t* src_argb, 89 int src_stride_argb, 90 uint8_t* dst_argb, 91 int dst_stride_argb, 92 int width, 93 int height); 94 95 // Convert I420 to ARGB. 96 LIBYUV_API 97 int I420ToARGB(const uint8_t* src_y, 98 int src_stride_y, 99 const uint8_t* src_u, 100 int src_stride_u, 101 const uint8_t* src_v, 102 int src_stride_v, 103 uint8_t* dst_argb, 104 int dst_stride_argb, 105 int width, 106 int height); 107 108 // Convert I420 to ABGR. 109 LIBYUV_API 110 int I420ToABGR(const uint8_t* src_y, 111 int src_stride_y, 112 const uint8_t* src_u, 113 int src_stride_u, 114 const uint8_t* src_v, 115 int src_stride_v, 116 uint8_t* dst_abgr, 117 int dst_stride_abgr, 118 int width, 119 int height); 120 121 // Convert J420 to ARGB. 122 LIBYUV_API 123 int J420ToARGB(const uint8_t* src_y, 124 int src_stride_y, 125 const uint8_t* src_u, 126 int src_stride_u, 127 const uint8_t* src_v, 128 int src_stride_v, 129 uint8_t* dst_argb, 130 int dst_stride_argb, 131 int width, 132 int height); 133 134 // Convert J420 to ABGR. 135 LIBYUV_API 136 int J420ToABGR(const uint8_t* src_y, 137 int src_stride_y, 138 const uint8_t* src_u, 139 int src_stride_u, 140 const uint8_t* src_v, 141 int src_stride_v, 142 uint8_t* dst_abgr, 143 int dst_stride_abgr, 144 int width, 145 int height); 146 147 // Convert H420 to ARGB. 148 LIBYUV_API 149 int H420ToARGB(const uint8_t* src_y, 150 int src_stride_y, 151 const uint8_t* src_u, 152 int src_stride_u, 153 const uint8_t* src_v, 154 int src_stride_v, 155 uint8_t* dst_argb, 156 int dst_stride_argb, 157 int width, 158 int height); 159 160 // Convert H420 to ABGR. 161 LIBYUV_API 162 int H420ToABGR(const uint8_t* src_y, 163 int src_stride_y, 164 const uint8_t* src_u, 165 int src_stride_u, 166 const uint8_t* src_v, 167 int src_stride_v, 168 uint8_t* dst_abgr, 169 int dst_stride_abgr, 170 int width, 171 int height); 172 173 // Convert U420 to ARGB. 174 LIBYUV_API 175 int U420ToARGB(const uint8_t* src_y, 176 int src_stride_y, 177 const uint8_t* src_u, 178 int src_stride_u, 179 const uint8_t* src_v, 180 int src_stride_v, 181 uint8_t* dst_argb, 182 int dst_stride_argb, 183 int width, 184 int height); 185 186 // Convert U420 to ABGR. 187 LIBYUV_API 188 int U420ToABGR(const uint8_t* src_y, 189 int src_stride_y, 190 const uint8_t* src_u, 191 int src_stride_u, 192 const uint8_t* src_v, 193 int src_stride_v, 194 uint8_t* dst_abgr, 195 int dst_stride_abgr, 196 int width, 197 int height); 198 199 // Convert I422 to ARGB. 200 LIBYUV_API 201 int I422ToARGB(const uint8_t* src_y, 202 int src_stride_y, 203 const uint8_t* src_u, 204 int src_stride_u, 205 const uint8_t* src_v, 206 int src_stride_v, 207 uint8_t* dst_argb, 208 int dst_stride_argb, 209 int width, 210 int height); 211 212 // Convert I422 to ABGR. 213 LIBYUV_API 214 int I422ToABGR(const uint8_t* src_y, 215 int src_stride_y, 216 const uint8_t* src_u, 217 int src_stride_u, 218 const uint8_t* src_v, 219 int src_stride_v, 220 uint8_t* dst_abgr, 221 int dst_stride_abgr, 222 int width, 223 int height); 224 225 // Convert J422 to ARGB. 226 LIBYUV_API 227 int J422ToARGB(const uint8_t* src_y, 228 int src_stride_y, 229 const uint8_t* src_u, 230 int src_stride_u, 231 const uint8_t* src_v, 232 int src_stride_v, 233 uint8_t* dst_argb, 234 int dst_stride_argb, 235 int width, 236 int height); 237 238 // Convert J422 to ABGR. 239 LIBYUV_API 240 int J422ToABGR(const uint8_t* src_y, 241 int src_stride_y, 242 const uint8_t* src_u, 243 int src_stride_u, 244 const uint8_t* src_v, 245 int src_stride_v, 246 uint8_t* dst_abgr, 247 int dst_stride_abgr, 248 int width, 249 int height); 250 251 // Convert H422 to ARGB. 252 LIBYUV_API 253 int H422ToARGB(const uint8_t* src_y, 254 int src_stride_y, 255 const uint8_t* src_u, 256 int src_stride_u, 257 const uint8_t* src_v, 258 int src_stride_v, 259 uint8_t* dst_argb, 260 int dst_stride_argb, 261 int width, 262 int height); 263 264 // Convert H422 to ABGR. 265 LIBYUV_API 266 int H422ToABGR(const uint8_t* src_y, 267 int src_stride_y, 268 const uint8_t* src_u, 269 int src_stride_u, 270 const uint8_t* src_v, 271 int src_stride_v, 272 uint8_t* dst_abgr, 273 int dst_stride_abgr, 274 int width, 275 int height); 276 277 // Convert U422 to ARGB. 278 LIBYUV_API 279 int U422ToARGB(const uint8_t* src_y, 280 int src_stride_y, 281 const uint8_t* src_u, 282 int src_stride_u, 283 const uint8_t* src_v, 284 int src_stride_v, 285 uint8_t* dst_argb, 286 int dst_stride_argb, 287 int width, 288 int height); 289 290 // Convert U422 to ABGR. 291 LIBYUV_API 292 int U422ToABGR(const uint8_t* src_y, 293 int src_stride_y, 294 const uint8_t* src_u, 295 int src_stride_u, 296 const uint8_t* src_v, 297 int src_stride_v, 298 uint8_t* dst_abgr, 299 int dst_stride_abgr, 300 int width, 301 int height); 302 303 // Convert I444 to ARGB. 304 LIBYUV_API 305 int I444ToARGB(const uint8_t* src_y, 306 int src_stride_y, 307 const uint8_t* src_u, 308 int src_stride_u, 309 const uint8_t* src_v, 310 int src_stride_v, 311 uint8_t* dst_argb, 312 int dst_stride_argb, 313 int width, 314 int height); 315 316 // Convert I444 to ABGR. 317 LIBYUV_API 318 int I444ToABGR(const uint8_t* src_y, 319 int src_stride_y, 320 const uint8_t* src_u, 321 int src_stride_u, 322 const uint8_t* src_v, 323 int src_stride_v, 324 uint8_t* dst_abgr, 325 int dst_stride_abgr, 326 int width, 327 int height); 328 329 // Convert J444 to ARGB. 330 LIBYUV_API 331 int J444ToARGB(const uint8_t* src_y, 332 int src_stride_y, 333 const uint8_t* src_u, 334 int src_stride_u, 335 const uint8_t* src_v, 336 int src_stride_v, 337 uint8_t* dst_argb, 338 int dst_stride_argb, 339 int width, 340 int height); 341 342 // Convert J444 to ABGR. 343 LIBYUV_API 344 int J444ToABGR(const uint8_t* src_y, 345 int src_stride_y, 346 const uint8_t* src_u, 347 int src_stride_u, 348 const uint8_t* src_v, 349 int src_stride_v, 350 uint8_t* dst_abgr, 351 int dst_stride_abgr, 352 int width, 353 int height); 354 355 // Convert H444 to ARGB. 356 LIBYUV_API 357 int H444ToARGB(const uint8_t* src_y, 358 int src_stride_y, 359 const uint8_t* src_u, 360 int src_stride_u, 361 const uint8_t* src_v, 362 int src_stride_v, 363 uint8_t* dst_argb, 364 int dst_stride_argb, 365 int width, 366 int height); 367 368 // Convert H444 to ABGR. 369 LIBYUV_API 370 int H444ToABGR(const uint8_t* src_y, 371 int src_stride_y, 372 const uint8_t* src_u, 373 int src_stride_u, 374 const uint8_t* src_v, 375 int src_stride_v, 376 uint8_t* dst_abgr, 377 int dst_stride_abgr, 378 int width, 379 int height); 380 381 // Convert U444 to ARGB. 382 LIBYUV_API 383 int U444ToARGB(const uint8_t* src_y, 384 int src_stride_y, 385 const uint8_t* src_u, 386 int src_stride_u, 387 const uint8_t* src_v, 388 int src_stride_v, 389 uint8_t* dst_argb, 390 int dst_stride_argb, 391 int width, 392 int height); 393 394 // Convert U444 to ABGR. 395 LIBYUV_API 396 int U444ToABGR(const uint8_t* src_y, 397 int src_stride_y, 398 const uint8_t* src_u, 399 int src_stride_u, 400 const uint8_t* src_v, 401 int src_stride_v, 402 uint8_t* dst_abgr, 403 int dst_stride_abgr, 404 int width, 405 int height); 406 407 // Convert I010 to ARGB. 408 LIBYUV_API 409 int I010ToARGB(const uint16_t* src_y, 410 int src_stride_y, 411 const uint16_t* src_u, 412 int src_stride_u, 413 const uint16_t* src_v, 414 int src_stride_v, 415 uint8_t* dst_argb, 416 int dst_stride_argb, 417 int width, 418 int height); 419 420 // Convert I010 to ABGR. 421 LIBYUV_API 422 int I010ToABGR(const uint16_t* src_y, 423 int src_stride_y, 424 const uint16_t* src_u, 425 int src_stride_u, 426 const uint16_t* src_v, 427 int src_stride_v, 428 uint8_t* dst_abgr, 429 int dst_stride_abgr, 430 int width, 431 int height); 432 433 // Convert H010 to ARGB. 434 LIBYUV_API 435 int H010ToARGB(const uint16_t* src_y, 436 int src_stride_y, 437 const uint16_t* src_u, 438 int src_stride_u, 439 const uint16_t* src_v, 440 int src_stride_v, 441 uint8_t* dst_argb, 442 int dst_stride_argb, 443 int width, 444 int height); 445 446 // Convert H010 to ABGR. 447 LIBYUV_API 448 int H010ToABGR(const uint16_t* src_y, 449 int src_stride_y, 450 const uint16_t* src_u, 451 int src_stride_u, 452 const uint16_t* src_v, 453 int src_stride_v, 454 uint8_t* dst_abgr, 455 int dst_stride_abgr, 456 int width, 457 int height); 458 459 // Convert U010 to ARGB. 460 LIBYUV_API 461 int U010ToARGB(const uint16_t* src_y, 462 int src_stride_y, 463 const uint16_t* src_u, 464 int src_stride_u, 465 const uint16_t* src_v, 466 int src_stride_v, 467 uint8_t* dst_argb, 468 int dst_stride_argb, 469 int width, 470 int height); 471 472 // Convert U010 to ABGR. 473 LIBYUV_API 474 int U010ToABGR(const uint16_t* src_y, 475 int src_stride_y, 476 const uint16_t* src_u, 477 int src_stride_u, 478 const uint16_t* src_v, 479 int src_stride_v, 480 uint8_t* dst_abgr, 481 int dst_stride_abgr, 482 int width, 483 int height); 484 485 // Convert I210 to ARGB. 486 LIBYUV_API 487 int I210ToARGB(const uint16_t* src_y, 488 int src_stride_y, 489 const uint16_t* src_u, 490 int src_stride_u, 491 const uint16_t* src_v, 492 int src_stride_v, 493 uint8_t* dst_argb, 494 int dst_stride_argb, 495 int width, 496 int height); 497 498 // Convert I210 to ABGR. 499 LIBYUV_API 500 int I210ToABGR(const uint16_t* src_y, 501 int src_stride_y, 502 const uint16_t* src_u, 503 int src_stride_u, 504 const uint16_t* src_v, 505 int src_stride_v, 506 uint8_t* dst_abgr, 507 int dst_stride_abgr, 508 int width, 509 int height); 510 511 // Convert H210 to ARGB. 512 LIBYUV_API 513 int H210ToARGB(const uint16_t* src_y, 514 int src_stride_y, 515 const uint16_t* src_u, 516 int src_stride_u, 517 const uint16_t* src_v, 518 int src_stride_v, 519 uint8_t* dst_argb, 520 int dst_stride_argb, 521 int width, 522 int height); 523 524 // Convert H210 to ABGR. 525 LIBYUV_API 526 int H210ToABGR(const uint16_t* src_y, 527 int src_stride_y, 528 const uint16_t* src_u, 529 int src_stride_u, 530 const uint16_t* src_v, 531 int src_stride_v, 532 uint8_t* dst_abgr, 533 int dst_stride_abgr, 534 int width, 535 int height); 536 537 // Convert U210 to ARGB. 538 LIBYUV_API 539 int U210ToARGB(const uint16_t* src_y, 540 int src_stride_y, 541 const uint16_t* src_u, 542 int src_stride_u, 543 const uint16_t* src_v, 544 int src_stride_v, 545 uint8_t* dst_argb, 546 int dst_stride_argb, 547 int width, 548 int height); 549 550 // Convert U210 to ABGR. 551 LIBYUV_API 552 int U210ToABGR(const uint16_t* src_y, 553 int src_stride_y, 554 const uint16_t* src_u, 555 int src_stride_u, 556 const uint16_t* src_v, 557 int src_stride_v, 558 uint8_t* dst_abgr, 559 int dst_stride_abgr, 560 int width, 561 int height); 562 563 // Convert I420 with Alpha to preattenuated ARGB. 564 LIBYUV_API 565 int I420AlphaToARGB(const uint8_t* src_y, 566 int src_stride_y, 567 const uint8_t* src_u, 568 int src_stride_u, 569 const uint8_t* src_v, 570 int src_stride_v, 571 const uint8_t* src_a, 572 int src_stride_a, 573 uint8_t* dst_argb, 574 int dst_stride_argb, 575 int width, 576 int height, 577 int attenuate); 578 579 // Convert I420 with Alpha to preattenuated ABGR. 580 LIBYUV_API 581 int I420AlphaToABGR(const uint8_t* src_y, 582 int src_stride_y, 583 const uint8_t* src_u, 584 int src_stride_u, 585 const uint8_t* src_v, 586 int src_stride_v, 587 const uint8_t* src_a, 588 int src_stride_a, 589 uint8_t* dst_abgr, 590 int dst_stride_abgr, 591 int width, 592 int height, 593 int attenuate); 594 595 // Convert I422 with Alpha to preattenuated ARGB. 596 LIBYUV_API 597 int I422AlphaToARGB(const uint8_t* src_y, 598 int src_stride_y, 599 const uint8_t* src_u, 600 int src_stride_u, 601 const uint8_t* src_v, 602 int src_stride_v, 603 const uint8_t* src_a, 604 int src_stride_a, 605 uint8_t* dst_argb, 606 int dst_stride_argb, 607 int width, 608 int height, 609 int attenuate); 610 611 // Convert I422 with Alpha to preattenuated ABGR. 612 LIBYUV_API 613 int I422AlphaToABGR(const uint8_t* src_y, 614 int src_stride_y, 615 const uint8_t* src_u, 616 int src_stride_u, 617 const uint8_t* src_v, 618 int src_stride_v, 619 const uint8_t* src_a, 620 int src_stride_a, 621 uint8_t* dst_abgr, 622 int dst_stride_abgr, 623 int width, 624 int height, 625 int attenuate); 626 627 // Convert I444 with Alpha to preattenuated ARGB. 628 LIBYUV_API 629 int I444AlphaToARGB(const uint8_t* src_y, 630 int src_stride_y, 631 const uint8_t* src_u, 632 int src_stride_u, 633 const uint8_t* src_v, 634 int src_stride_v, 635 const uint8_t* src_a, 636 int src_stride_a, 637 uint8_t* dst_argb, 638 int dst_stride_argb, 639 int width, 640 int height, 641 int attenuate); 642 643 // Convert I444 with Alpha to preattenuated ABGR. 644 LIBYUV_API 645 int I444AlphaToABGR(const uint8_t* src_y, 646 int src_stride_y, 647 const uint8_t* src_u, 648 int src_stride_u, 649 const uint8_t* src_v, 650 int src_stride_v, 651 const uint8_t* src_a, 652 int src_stride_a, 653 uint8_t* dst_abgr, 654 int dst_stride_abgr, 655 int width, 656 int height, 657 int attenuate); 658 659 // Convert I400 (grey) to ARGB. Reverse of ARGBToI400. 660 LIBYUV_API 661 int I400ToARGB(const uint8_t* src_y, 662 int src_stride_y, 663 uint8_t* dst_argb, 664 int dst_stride_argb, 665 int width, 666 int height); 667 668 // Convert J400 (jpeg grey) to ARGB. 669 LIBYUV_API 670 int J400ToARGB(const uint8_t* src_y, 671 int src_stride_y, 672 uint8_t* dst_argb, 673 int dst_stride_argb, 674 int width, 675 int height); 676 677 // Alias. 678 #define YToARGB I400ToARGB 679 680 // Convert NV12 to ARGB. 681 LIBYUV_API 682 int NV12ToARGB(const uint8_t* src_y, 683 int src_stride_y, 684 const uint8_t* src_uv, 685 int src_stride_uv, 686 uint8_t* dst_argb, 687 int dst_stride_argb, 688 int width, 689 int height); 690 691 // Convert NV21 to ARGB. 692 LIBYUV_API 693 int NV21ToARGB(const uint8_t* src_y, 694 int src_stride_y, 695 const uint8_t* src_vu, 696 int src_stride_vu, 697 uint8_t* dst_argb, 698 int dst_stride_argb, 699 int width, 700 int height); 701 702 // Convert NV12 to ABGR. 703 LIBYUV_API 704 int NV12ToABGR(const uint8_t* src_y, 705 int src_stride_y, 706 const uint8_t* src_uv, 707 int src_stride_uv, 708 uint8_t* dst_abgr, 709 int dst_stride_abgr, 710 int width, 711 int height); 712 713 // Convert NV21 to ABGR. 714 LIBYUV_API 715 int NV21ToABGR(const uint8_t* src_y, 716 int src_stride_y, 717 const uint8_t* src_vu, 718 int src_stride_vu, 719 uint8_t* dst_abgr, 720 int dst_stride_abgr, 721 int width, 722 int height); 723 724 // Convert NV12 to RGB24. 725 LIBYUV_API 726 int NV12ToRGB24(const uint8_t* src_y, 727 int src_stride_y, 728 const uint8_t* src_uv, 729 int src_stride_uv, 730 uint8_t* dst_rgb24, 731 int dst_stride_rgb24, 732 int width, 733 int height); 734 735 // Convert NV21 to RGB24. 736 LIBYUV_API 737 int NV21ToRGB24(const uint8_t* src_y, 738 int src_stride_y, 739 const uint8_t* src_vu, 740 int src_stride_vu, 741 uint8_t* dst_rgb24, 742 int dst_stride_rgb24, 743 int width, 744 int height); 745 746 // Convert NV21 to YUV24. 747 LIBYUV_API 748 int NV21ToYUV24(const uint8_t* src_y, 749 int src_stride_y, 750 const uint8_t* src_vu, 751 int src_stride_vu, 752 uint8_t* dst_yuv24, 753 int dst_stride_yuv24, 754 int width, 755 int height); 756 757 // Convert NV12 to RAW. 758 LIBYUV_API 759 int NV12ToRAW(const uint8_t* src_y, 760 int src_stride_y, 761 const uint8_t* src_uv, 762 int src_stride_uv, 763 uint8_t* dst_raw, 764 int dst_stride_raw, 765 int width, 766 int height); 767 768 // Convert NV21 to RAW. 769 LIBYUV_API 770 int NV21ToRAW(const uint8_t* src_y, 771 int src_stride_y, 772 const uint8_t* src_vu, 773 int src_stride_vu, 774 uint8_t* dst_raw, 775 int dst_stride_raw, 776 int width, 777 int height); 778 779 // Convert YUY2 to ARGB. 780 LIBYUV_API 781 int YUY2ToARGB(const uint8_t* src_yuy2, 782 int src_stride_yuy2, 783 uint8_t* dst_argb, 784 int dst_stride_argb, 785 int width, 786 int height); 787 788 // Convert UYVY to ARGB. 789 LIBYUV_API 790 int UYVYToARGB(const uint8_t* src_uyvy, 791 int src_stride_uyvy, 792 uint8_t* dst_argb, 793 int dst_stride_argb, 794 int width, 795 int height); 796 797 // Convert I010 to AR30. 798 LIBYUV_API 799 int I010ToAR30(const uint16_t* src_y, 800 int src_stride_y, 801 const uint16_t* src_u, 802 int src_stride_u, 803 const uint16_t* src_v, 804 int src_stride_v, 805 uint8_t* dst_ar30, 806 int dst_stride_ar30, 807 int width, 808 int height); 809 810 // Convert H010 to AR30. 811 LIBYUV_API 812 int H010ToAR30(const uint16_t* src_y, 813 int src_stride_y, 814 const uint16_t* src_u, 815 int src_stride_u, 816 const uint16_t* src_v, 817 int src_stride_v, 818 uint8_t* dst_ar30, 819 int dst_stride_ar30, 820 int width, 821 int height); 822 823 // Convert I010 to AB30. 824 LIBYUV_API 825 int I010ToAB30(const uint16_t* src_y, 826 int src_stride_y, 827 const uint16_t* src_u, 828 int src_stride_u, 829 const uint16_t* src_v, 830 int src_stride_v, 831 uint8_t* dst_ab30, 832 int dst_stride_ab30, 833 int width, 834 int height); 835 836 // Convert H010 to AB30. 837 LIBYUV_API 838 int H010ToAB30(const uint16_t* src_y, 839 int src_stride_y, 840 const uint16_t* src_u, 841 int src_stride_u, 842 const uint16_t* src_v, 843 int src_stride_v, 844 uint8_t* dst_ab30, 845 int dst_stride_ab30, 846 int width, 847 int height); 848 849 // Convert U010 to AR30. 850 LIBYUV_API 851 int U010ToAR30(const uint16_t* src_y, 852 int src_stride_y, 853 const uint16_t* src_u, 854 int src_stride_u, 855 const uint16_t* src_v, 856 int src_stride_v, 857 uint8_t* dst_ar30, 858 int dst_stride_ar30, 859 int width, 860 int height); 861 862 // Convert U010 to AB30. 863 LIBYUV_API 864 int U010ToAB30(const uint16_t* src_y, 865 int src_stride_y, 866 const uint16_t* src_u, 867 int src_stride_u, 868 const uint16_t* src_v, 869 int src_stride_v, 870 uint8_t* dst_ab30, 871 int dst_stride_ab30, 872 int width, 873 int height); 874 875 // Convert I210 to AR30. 876 LIBYUV_API 877 int I210ToAR30(const uint16_t* src_y, 878 int src_stride_y, 879 const uint16_t* src_u, 880 int src_stride_u, 881 const uint16_t* src_v, 882 int src_stride_v, 883 uint8_t* dst_ar30, 884 int dst_stride_ar30, 885 int width, 886 int height); 887 888 // Convert I210 to AB30. 889 LIBYUV_API 890 int I210ToAB30(const uint16_t* src_y, 891 int src_stride_y, 892 const uint16_t* src_u, 893 int src_stride_u, 894 const uint16_t* src_v, 895 int src_stride_v, 896 uint8_t* dst_ab30, 897 int dst_stride_ab30, 898 int width, 899 int height); 900 901 // Convert H210 to AR30. 902 LIBYUV_API 903 int H210ToAR30(const uint16_t* src_y, 904 int src_stride_y, 905 const uint16_t* src_u, 906 int src_stride_u, 907 const uint16_t* src_v, 908 int src_stride_v, 909 uint8_t* dst_ar30, 910 int dst_stride_ar30, 911 int width, 912 int height); 913 914 // Convert H210 to AB30. 915 LIBYUV_API 916 int H210ToAB30(const uint16_t* src_y, 917 int src_stride_y, 918 const uint16_t* src_u, 919 int src_stride_u, 920 const uint16_t* src_v, 921 int src_stride_v, 922 uint8_t* dst_ab30, 923 int dst_stride_ab30, 924 int width, 925 int height); 926 927 // Convert U210 to AR30. 928 LIBYUV_API 929 int U210ToAR30(const uint16_t* src_y, 930 int src_stride_y, 931 const uint16_t* src_u, 932 int src_stride_u, 933 const uint16_t* src_v, 934 int src_stride_v, 935 uint8_t* dst_ar30, 936 int dst_stride_ar30, 937 int width, 938 int height); 939 940 // Convert U210 to AB30. 941 LIBYUV_API 942 int U210ToAB30(const uint16_t* src_y, 943 int src_stride_y, 944 const uint16_t* src_u, 945 int src_stride_u, 946 const uint16_t* src_v, 947 int src_stride_v, 948 uint8_t* dst_ab30, 949 int dst_stride_ab30, 950 int width, 951 int height); 952 953 // BGRA little endian (argb in memory) to ARGB. 954 LIBYUV_API 955 int BGRAToARGB(const uint8_t* src_bgra, 956 int src_stride_bgra, 957 uint8_t* dst_argb, 958 int dst_stride_argb, 959 int width, 960 int height); 961 962 // ABGR little endian (rgba in memory) to ARGB. 963 LIBYUV_API 964 int ABGRToARGB(const uint8_t* src_abgr, 965 int src_stride_abgr, 966 uint8_t* dst_argb, 967 int dst_stride_argb, 968 int width, 969 int height); 970 971 // RGBA little endian (abgr in memory) to ARGB. 972 LIBYUV_API 973 int RGBAToARGB(const uint8_t* src_rgba, 974 int src_stride_rgba, 975 uint8_t* dst_argb, 976 int dst_stride_argb, 977 int width, 978 int height); 979 980 // Deprecated function name. 981 #define BG24ToARGB RGB24ToARGB 982 983 // RGB little endian (bgr in memory) to ARGB. 984 LIBYUV_API 985 int RGB24ToARGB(const uint8_t* src_rgb24, 986 int src_stride_rgb24, 987 uint8_t* dst_argb, 988 int dst_stride_argb, 989 int width, 990 int height); 991 992 // RGB big endian (rgb in memory) to ARGB. 993 LIBYUV_API 994 int RAWToARGB(const uint8_t* src_raw, 995 int src_stride_raw, 996 uint8_t* dst_argb, 997 int dst_stride_argb, 998 int width, 999 int height); 1000 1001 // RGB big endian (rgb in memory) to RGBA. 1002 LIBYUV_API 1003 int RAWToRGBA(const uint8_t* src_raw, 1004 int src_stride_raw, 1005 uint8_t* dst_rgba, 1006 int dst_stride_rgba, 1007 int width, 1008 int height); 1009 1010 // RGB16 (RGBP fourcc) little endian to ARGB. 1011 LIBYUV_API 1012 int RGB565ToARGB(const uint8_t* src_rgb565, 1013 int src_stride_rgb565, 1014 uint8_t* dst_argb, 1015 int dst_stride_argb, 1016 int width, 1017 int height); 1018 1019 // RGB15 (RGBO fourcc) little endian to ARGB. 1020 LIBYUV_API 1021 int ARGB1555ToARGB(const uint8_t* src_argb1555, 1022 int src_stride_argb1555, 1023 uint8_t* dst_argb, 1024 int dst_stride_argb, 1025 int width, 1026 int height); 1027 1028 // RGB12 (R444 fourcc) little endian to ARGB. 1029 LIBYUV_API 1030 int ARGB4444ToARGB(const uint8_t* src_argb4444, 1031 int src_stride_argb4444, 1032 uint8_t* dst_argb, 1033 int dst_stride_argb, 1034 int width, 1035 int height); 1036 1037 // Aliases 1038 #define AB30ToARGB AR30ToABGR 1039 #define AB30ToABGR AR30ToARGB 1040 #define AB30ToAR30 AR30ToAB30 1041 1042 // Convert AR30 To ARGB. 1043 LIBYUV_API 1044 int AR30ToARGB(const uint8_t* src_ar30, 1045 int src_stride_ar30, 1046 uint8_t* dst_argb, 1047 int dst_stride_argb, 1048 int width, 1049 int height); 1050 1051 // Convert AR30 To ABGR. 1052 LIBYUV_API 1053 int AR30ToABGR(const uint8_t* src_ar30, 1054 int src_stride_ar30, 1055 uint8_t* dst_abgr, 1056 int dst_stride_abgr, 1057 int width, 1058 int height); 1059 1060 // Convert AR30 To AB30. 1061 LIBYUV_API 1062 int AR30ToAB30(const uint8_t* src_ar30, 1063 int src_stride_ar30, 1064 uint8_t* dst_ab30, 1065 int dst_stride_ab30, 1066 int width, 1067 int height); 1068 1069 // Convert AR64 to ARGB. 1070 LIBYUV_API 1071 int AR64ToARGB(const uint16_t* src_ar64, 1072 int src_stride_ar64, 1073 uint8_t* dst_argb, 1074 int dst_stride_argb, 1075 int width, 1076 int height); 1077 1078 // Convert AB64 to ABGR. 1079 #define AB64ToABGR AR64ToARGB 1080 1081 // Convert AB64 to ARGB. 1082 LIBYUV_API 1083 int AB64ToARGB(const uint16_t* src_ab64, 1084 int src_stride_ab64, 1085 uint8_t* dst_argb, 1086 int dst_stride_argb, 1087 int width, 1088 int height); 1089 1090 // Convert AR64 to ABGR. 1091 #define AR64ToABGR AB64ToARGB 1092 1093 // Convert AR64 To AB64. 1094 LIBYUV_API 1095 int AR64ToAB64(const uint16_t* src_ar64, 1096 int src_stride_ar64, 1097 uint16_t* dst_ab64, 1098 int dst_stride_ab64, 1099 int width, 1100 int height); 1101 1102 // Convert AB64 To AR64. 1103 #define AB64ToAR64 AR64ToAB64 1104 1105 // src_width/height provided by capture 1106 // dst_width/height for clipping determine final size. 1107 LIBYUV_API 1108 int MJPGToARGB(const uint8_t* sample, 1109 size_t sample_size, 1110 uint8_t* dst_argb, 1111 int dst_stride_argb, 1112 int src_width, 1113 int src_height, 1114 int dst_width, 1115 int dst_height); 1116 1117 // Convert Android420 to ARGB. 1118 LIBYUV_API 1119 int Android420ToARGB(const uint8_t* src_y, 1120 int src_stride_y, 1121 const uint8_t* src_u, 1122 int src_stride_u, 1123 const uint8_t* src_v, 1124 int src_stride_v, 1125 int src_pixel_stride_uv, 1126 uint8_t* dst_argb, 1127 int dst_stride_argb, 1128 int width, 1129 int height); 1130 1131 // Convert Android420 to ABGR. 1132 LIBYUV_API 1133 int Android420ToABGR(const uint8_t* src_y, 1134 int src_stride_y, 1135 const uint8_t* src_u, 1136 int src_stride_u, 1137 const uint8_t* src_v, 1138 int src_stride_v, 1139 int src_pixel_stride_uv, 1140 uint8_t* dst_abgr, 1141 int dst_stride_abgr, 1142 int width, 1143 int height); 1144 1145 // Convert NV12 to RGB565. 1146 LIBYUV_API 1147 int NV12ToRGB565(const uint8_t* src_y, 1148 int src_stride_y, 1149 const uint8_t* src_uv, 1150 int src_stride_uv, 1151 uint8_t* dst_rgb565, 1152 int dst_stride_rgb565, 1153 int width, 1154 int height); 1155 1156 // Convert I422 to BGRA. 1157 LIBYUV_API 1158 int I422ToBGRA(const uint8_t* src_y, 1159 int src_stride_y, 1160 const uint8_t* src_u, 1161 int src_stride_u, 1162 const uint8_t* src_v, 1163 int src_stride_v, 1164 uint8_t* dst_bgra, 1165 int dst_stride_bgra, 1166 int width, 1167 int height); 1168 1169 // Convert I422 to ABGR. 1170 LIBYUV_API 1171 int I422ToABGR(const uint8_t* src_y, 1172 int src_stride_y, 1173 const uint8_t* src_u, 1174 int src_stride_u, 1175 const uint8_t* src_v, 1176 int src_stride_v, 1177 uint8_t* dst_abgr, 1178 int dst_stride_abgr, 1179 int width, 1180 int height); 1181 1182 // Convert I422 to RGBA. 1183 LIBYUV_API 1184 int I422ToRGBA(const uint8_t* src_y, 1185 int src_stride_y, 1186 const uint8_t* src_u, 1187 int src_stride_u, 1188 const uint8_t* src_v, 1189 int src_stride_v, 1190 uint8_t* dst_rgba, 1191 int dst_stride_rgba, 1192 int width, 1193 int height); 1194 1195 LIBYUV_API 1196 int I420ToARGB(const uint8_t* src_y, 1197 int src_stride_y, 1198 const uint8_t* src_u, 1199 int src_stride_u, 1200 const uint8_t* src_v, 1201 int src_stride_v, 1202 uint8_t* dst_argb, 1203 int dst_stride_argb, 1204 int width, 1205 int height); 1206 1207 LIBYUV_API 1208 int I420ToBGRA(const uint8_t* src_y, 1209 int src_stride_y, 1210 const uint8_t* src_u, 1211 int src_stride_u, 1212 const uint8_t* src_v, 1213 int src_stride_v, 1214 uint8_t* dst_bgra, 1215 int dst_stride_bgra, 1216 int width, 1217 int height); 1218 1219 LIBYUV_API 1220 int I420ToABGR(const uint8_t* src_y, 1221 int src_stride_y, 1222 const uint8_t* src_u, 1223 int src_stride_u, 1224 const uint8_t* src_v, 1225 int src_stride_v, 1226 uint8_t* dst_abgr, 1227 int dst_stride_abgr, 1228 int width, 1229 int height); 1230 1231 LIBYUV_API 1232 int I420ToRGBA(const uint8_t* src_y, 1233 int src_stride_y, 1234 const uint8_t* src_u, 1235 int src_stride_u, 1236 const uint8_t* src_v, 1237 int src_stride_v, 1238 uint8_t* dst_rgba, 1239 int dst_stride_rgba, 1240 int width, 1241 int height); 1242 1243 LIBYUV_API 1244 int I420ToRGB24(const uint8_t* src_y, 1245 int src_stride_y, 1246 const uint8_t* src_u, 1247 int src_stride_u, 1248 const uint8_t* src_v, 1249 int src_stride_v, 1250 uint8_t* dst_rgb24, 1251 int dst_stride_rgb24, 1252 int width, 1253 int height); 1254 1255 LIBYUV_API 1256 int I420ToRAW(const uint8_t* src_y, 1257 int src_stride_y, 1258 const uint8_t* src_u, 1259 int src_stride_u, 1260 const uint8_t* src_v, 1261 int src_stride_v, 1262 uint8_t* dst_raw, 1263 int dst_stride_raw, 1264 int width, 1265 int height); 1266 1267 LIBYUV_API 1268 int H420ToRGB24(const uint8_t* src_y, 1269 int src_stride_y, 1270 const uint8_t* src_u, 1271 int src_stride_u, 1272 const uint8_t* src_v, 1273 int src_stride_v, 1274 uint8_t* dst_rgb24, 1275 int dst_stride_rgb24, 1276 int width, 1277 int height); 1278 1279 LIBYUV_API 1280 int H420ToRAW(const uint8_t* src_y, 1281 int src_stride_y, 1282 const uint8_t* src_u, 1283 int src_stride_u, 1284 const uint8_t* src_v, 1285 int src_stride_v, 1286 uint8_t* dst_raw, 1287 int dst_stride_raw, 1288 int width, 1289 int height); 1290 1291 LIBYUV_API 1292 int J420ToRGB24(const uint8_t* src_y, 1293 int src_stride_y, 1294 const uint8_t* src_u, 1295 int src_stride_u, 1296 const uint8_t* src_v, 1297 int src_stride_v, 1298 uint8_t* dst_rgb24, 1299 int dst_stride_rgb24, 1300 int width, 1301 int height); 1302 1303 LIBYUV_API 1304 int J420ToRAW(const uint8_t* src_y, 1305 int src_stride_y, 1306 const uint8_t* src_u, 1307 int src_stride_u, 1308 const uint8_t* src_v, 1309 int src_stride_v, 1310 uint8_t* dst_raw, 1311 int dst_stride_raw, 1312 int width, 1313 int height); 1314 1315 LIBYUV_API 1316 int I420ToRGB565(const uint8_t* src_y, 1317 int src_stride_y, 1318 const uint8_t* src_u, 1319 int src_stride_u, 1320 const uint8_t* src_v, 1321 int src_stride_v, 1322 uint8_t* dst_rgb565, 1323 int dst_stride_rgb565, 1324 int width, 1325 int height); 1326 1327 LIBYUV_API 1328 int J420ToRGB565(const uint8_t* src_y, 1329 int src_stride_y, 1330 const uint8_t* src_u, 1331 int src_stride_u, 1332 const uint8_t* src_v, 1333 int src_stride_v, 1334 uint8_t* dst_rgb565, 1335 int dst_stride_rgb565, 1336 int width, 1337 int height); 1338 1339 LIBYUV_API 1340 int H420ToRGB565(const uint8_t* src_y, 1341 int src_stride_y, 1342 const uint8_t* src_u, 1343 int src_stride_u, 1344 const uint8_t* src_v, 1345 int src_stride_v, 1346 uint8_t* dst_rgb565, 1347 int dst_stride_rgb565, 1348 int width, 1349 int height); 1350 1351 LIBYUV_API 1352 int I422ToRGB565(const uint8_t* src_y, 1353 int src_stride_y, 1354 const uint8_t* src_u, 1355 int src_stride_u, 1356 const uint8_t* src_v, 1357 int src_stride_v, 1358 uint8_t* dst_rgb565, 1359 int dst_stride_rgb565, 1360 int width, 1361 int height); 1362 1363 // Convert I420 To RGB565 with 4x4 dither matrix (16 bytes). 1364 // Values in dither matrix from 0 to 7 recommended. 1365 // The order of the dither matrix is first byte is upper left. 1366 1367 LIBYUV_API 1368 int I420ToRGB565Dither(const uint8_t* src_y, 1369 int src_stride_y, 1370 const uint8_t* src_u, 1371 int src_stride_u, 1372 const uint8_t* src_v, 1373 int src_stride_v, 1374 uint8_t* dst_rgb565, 1375 int dst_stride_rgb565, 1376 const uint8_t* dither4x4, 1377 int width, 1378 int height); 1379 1380 LIBYUV_API 1381 int I420ToARGB1555(const uint8_t* src_y, 1382 int src_stride_y, 1383 const uint8_t* src_u, 1384 int src_stride_u, 1385 const uint8_t* src_v, 1386 int src_stride_v, 1387 uint8_t* dst_argb1555, 1388 int dst_stride_argb1555, 1389 int width, 1390 int height); 1391 1392 LIBYUV_API 1393 int I420ToARGB4444(const uint8_t* src_y, 1394 int src_stride_y, 1395 const uint8_t* src_u, 1396 int src_stride_u, 1397 const uint8_t* src_v, 1398 int src_stride_v, 1399 uint8_t* dst_argb4444, 1400 int dst_stride_argb4444, 1401 int width, 1402 int height); 1403 1404 // Convert I420 to AR30. 1405 LIBYUV_API 1406 int I420ToAR30(const uint8_t* src_y, 1407 int src_stride_y, 1408 const uint8_t* src_u, 1409 int src_stride_u, 1410 const uint8_t* src_v, 1411 int src_stride_v, 1412 uint8_t* dst_ar30, 1413 int dst_stride_ar30, 1414 int width, 1415 int height); 1416 1417 // Convert I420 to AB30. 1418 LIBYUV_API 1419 int I420ToAB30(const uint8_t* src_y, 1420 int src_stride_y, 1421 const uint8_t* src_u, 1422 int src_stride_u, 1423 const uint8_t* src_v, 1424 int src_stride_v, 1425 uint8_t* dst_ab30, 1426 int dst_stride_ab30, 1427 int width, 1428 int height); 1429 1430 // Convert H420 to AR30. 1431 LIBYUV_API 1432 int H420ToAR30(const uint8_t* src_y, 1433 int src_stride_y, 1434 const uint8_t* src_u, 1435 int src_stride_u, 1436 const uint8_t* src_v, 1437 int src_stride_v, 1438 uint8_t* dst_ar30, 1439 int dst_stride_ar30, 1440 int width, 1441 int height); 1442 1443 // Convert H420 to AB30. 1444 LIBYUV_API 1445 int H420ToAB30(const uint8_t* src_y, 1446 int src_stride_y, 1447 const uint8_t* src_u, 1448 int src_stride_u, 1449 const uint8_t* src_v, 1450 int src_stride_v, 1451 uint8_t* dst_ab30, 1452 int dst_stride_ab30, 1453 int width, 1454 int height); 1455 1456 // Convert I420 to ARGB with matrix. 1457 LIBYUV_API 1458 int I420ToARGBMatrix(const uint8_t* src_y, 1459 int src_stride_y, 1460 const uint8_t* src_u, 1461 int src_stride_u, 1462 const uint8_t* src_v, 1463 int src_stride_v, 1464 uint8_t* dst_argb, 1465 int dst_stride_argb, 1466 const struct YuvConstants* yuvconstants, 1467 int width, 1468 int height); 1469 1470 // Convert I422 to ARGB with matrix. 1471 LIBYUV_API 1472 int I422ToARGBMatrix(const uint8_t* src_y, 1473 int src_stride_y, 1474 const uint8_t* src_u, 1475 int src_stride_u, 1476 const uint8_t* src_v, 1477 int src_stride_v, 1478 uint8_t* dst_argb, 1479 int dst_stride_argb, 1480 const struct YuvConstants* yuvconstants, 1481 int width, 1482 int height); 1483 1484 // Convert I444 to ARGB with matrix. 1485 LIBYUV_API 1486 int I444ToARGBMatrix(const uint8_t* src_y, 1487 int src_stride_y, 1488 const uint8_t* src_u, 1489 int src_stride_u, 1490 const uint8_t* src_v, 1491 int src_stride_v, 1492 uint8_t* dst_argb, 1493 int dst_stride_argb, 1494 const struct YuvConstants* yuvconstants, 1495 int width, 1496 int height); 1497 1498 // Convert 10 bit 420 YUV to ARGB with matrix. 1499 LIBYUV_API 1500 int I010ToAR30Matrix(const uint16_t* src_y, 1501 int src_stride_y, 1502 const uint16_t* src_u, 1503 int src_stride_u, 1504 const uint16_t* src_v, 1505 int src_stride_v, 1506 uint8_t* dst_ar30, 1507 int dst_stride_ar30, 1508 const struct YuvConstants* yuvconstants, 1509 int width, 1510 int height); 1511 1512 // Convert 10 bit 420 YUV to ARGB with matrix. 1513 LIBYUV_API 1514 int I210ToAR30Matrix(const uint16_t* src_y, 1515 int src_stride_y, 1516 const uint16_t* src_u, 1517 int src_stride_u, 1518 const uint16_t* src_v, 1519 int src_stride_v, 1520 uint8_t* dst_ar30, 1521 int dst_stride_ar30, 1522 const struct YuvConstants* yuvconstants, 1523 int width, 1524 int height); 1525 1526 // Convert 10 bit 444 YUV to ARGB with matrix. 1527 LIBYUV_API 1528 int I410ToAR30Matrix(const uint16_t* src_y, 1529 int src_stride_y, 1530 const uint16_t* src_u, 1531 int src_stride_u, 1532 const uint16_t* src_v, 1533 int src_stride_v, 1534 uint8_t* dst_ar30, 1535 int dst_stride_ar30, 1536 const struct YuvConstants* yuvconstants, 1537 int width, 1538 int height); 1539 1540 // Convert 10 bit YUV to ARGB with matrix. 1541 LIBYUV_API 1542 int I010ToARGBMatrix(const uint16_t* src_y, 1543 int src_stride_y, 1544 const uint16_t* src_u, 1545 int src_stride_u, 1546 const uint16_t* src_v, 1547 int src_stride_v, 1548 uint8_t* dst_argb, 1549 int dst_stride_argb, 1550 const struct YuvConstants* yuvconstants, 1551 int width, 1552 int height); 1553 1554 // multiply 12 bit yuv into high bits to allow any number of bits. 1555 LIBYUV_API 1556 int I012ToAR30Matrix(const uint16_t* src_y, 1557 int src_stride_y, 1558 const uint16_t* src_u, 1559 int src_stride_u, 1560 const uint16_t* src_v, 1561 int src_stride_v, 1562 uint8_t* dst_ar30, 1563 int dst_stride_ar30, 1564 const struct YuvConstants* yuvconstants, 1565 int width, 1566 int height); 1567 1568 // Convert 12 bit YUV to ARGB with matrix. 1569 LIBYUV_API 1570 int I012ToARGBMatrix(const uint16_t* src_y, 1571 int src_stride_y, 1572 const uint16_t* src_u, 1573 int src_stride_u, 1574 const uint16_t* src_v, 1575 int src_stride_v, 1576 uint8_t* dst_argb, 1577 int dst_stride_argb, 1578 const struct YuvConstants* yuvconstants, 1579 int width, 1580 int height); 1581 1582 // Convert 10 bit 422 YUV to ARGB with matrix. 1583 LIBYUV_API 1584 int I210ToARGBMatrix(const uint16_t* src_y, 1585 int src_stride_y, 1586 const uint16_t* src_u, 1587 int src_stride_u, 1588 const uint16_t* src_v, 1589 int src_stride_v, 1590 uint8_t* dst_argb, 1591 int dst_stride_argb, 1592 const struct YuvConstants* yuvconstants, 1593 int width, 1594 int height); 1595 1596 // Convert 10 bit 444 YUV to ARGB with matrix. 1597 LIBYUV_API 1598 int I410ToARGBMatrix(const uint16_t* src_y, 1599 int src_stride_y, 1600 const uint16_t* src_u, 1601 int src_stride_u, 1602 const uint16_t* src_v, 1603 int src_stride_v, 1604 uint8_t* dst_argb, 1605 int dst_stride_argb, 1606 const struct YuvConstants* yuvconstants, 1607 int width, 1608 int height); 1609 1610 // Convert P010 to ARGB with matrix. 1611 LIBYUV_API 1612 int P010ToARGBMatrix(const uint16_t* src_y, 1613 int src_stride_y, 1614 const uint16_t* src_uv, 1615 int src_stride_uv, 1616 uint8_t* dst_argb, 1617 int dst_stride_argb, 1618 const struct YuvConstants* yuvconstants, 1619 int width, 1620 int height); 1621 1622 // Convert P210 to ARGB with matrix. 1623 LIBYUV_API 1624 int P210ToARGBMatrix(const uint16_t* src_y, 1625 int src_stride_y, 1626 const uint16_t* src_uv, 1627 int src_stride_uv, 1628 uint8_t* dst_argb, 1629 int dst_stride_argb, 1630 const struct YuvConstants* yuvconstants, 1631 int width, 1632 int height); 1633 1634 // Convert P010 to AR30 with matrix. 1635 LIBYUV_API 1636 int P010ToAR30Matrix(const uint16_t* src_y, 1637 int src_stride_y, 1638 const uint16_t* src_uv, 1639 int src_stride_uv, 1640 uint8_t* dst_ar30, 1641 int dst_stride_ar30, 1642 const struct YuvConstants* yuvconstants, 1643 int width, 1644 int height); 1645 1646 // Convert P210 to AR30 with matrix. 1647 LIBYUV_API 1648 int P210ToAR30Matrix(const uint16_t* src_y, 1649 int src_stride_y, 1650 const uint16_t* src_uv, 1651 int src_stride_uv, 1652 uint8_t* dst_ar30, 1653 int dst_stride_ar30, 1654 const struct YuvConstants* yuvconstants, 1655 int width, 1656 int height); 1657 1658 // P012 and P010 use most significant bits so the conversion is the same. 1659 // Convert P012 to ARGB with matrix. 1660 #define P012ToARGBMatrix P010ToARGBMatrix 1661 // Convert P012 to AR30 with matrix. 1662 #define P012ToAR30Matrix P010ToAR30Matrix 1663 // Convert P212 to ARGB with matrix. 1664 #define P212ToARGBMatrix P210ToARGBMatrix 1665 // Convert P212 to AR30 with matrix. 1666 #define P212ToAR30Matrix P210ToAR30Matrix 1667 1668 // Convert P016 to ARGB with matrix. 1669 #define P016ToARGBMatrix P010ToARGBMatrix 1670 // Convert P016 to AR30 with matrix. 1671 #define P016ToAR30Matrix P010ToAR30Matrix 1672 // Convert P216 to ARGB with matrix. 1673 #define P216ToARGBMatrix P210ToARGBMatrix 1674 // Convert P216 to AR30 with matrix. 1675 #define P216ToAR30Matrix P210ToAR30Matrix 1676 1677 // Convert I420 with Alpha to preattenuated ARGB with matrix. 1678 LIBYUV_API 1679 int I420AlphaToARGBMatrix(const uint8_t* src_y, 1680 int src_stride_y, 1681 const uint8_t* src_u, 1682 int src_stride_u, 1683 const uint8_t* src_v, 1684 int src_stride_v, 1685 const uint8_t* src_a, 1686 int src_stride_a, 1687 uint8_t* dst_argb, 1688 int dst_stride_argb, 1689 const struct YuvConstants* yuvconstants, 1690 int width, 1691 int height, 1692 int attenuate); 1693 1694 // Convert I422 with Alpha to preattenuated ARGB with matrix. 1695 LIBYUV_API 1696 int I422AlphaToARGBMatrix(const uint8_t* src_y, 1697 int src_stride_y, 1698 const uint8_t* src_u, 1699 int src_stride_u, 1700 const uint8_t* src_v, 1701 int src_stride_v, 1702 const uint8_t* src_a, 1703 int src_stride_a, 1704 uint8_t* dst_argb, 1705 int dst_stride_argb, 1706 const struct YuvConstants* yuvconstants, 1707 int width, 1708 int height, 1709 int attenuate); 1710 1711 // Convert I444 with Alpha to preattenuated ARGB with matrix. 1712 LIBYUV_API 1713 int I444AlphaToARGBMatrix(const uint8_t* src_y, 1714 int src_stride_y, 1715 const uint8_t* src_u, 1716 int src_stride_u, 1717 const uint8_t* src_v, 1718 int src_stride_v, 1719 const uint8_t* src_a, 1720 int src_stride_a, 1721 uint8_t* dst_argb, 1722 int dst_stride_argb, 1723 const struct YuvConstants* yuvconstants, 1724 int width, 1725 int height, 1726 int attenuate); 1727 1728 // Convert I010 with Alpha to preattenuated ARGB with matrix. 1729 LIBYUV_API 1730 int I010AlphaToARGBMatrix(const uint16_t* src_y, 1731 int src_stride_y, 1732 const uint16_t* src_u, 1733 int src_stride_u, 1734 const uint16_t* src_v, 1735 int src_stride_v, 1736 const uint16_t* src_a, 1737 int src_stride_a, 1738 uint8_t* dst_argb, 1739 int dst_stride_argb, 1740 const struct YuvConstants* yuvconstants, 1741 int width, 1742 int height, 1743 int attenuate); 1744 1745 // Convert I210 with Alpha to preattenuated ARGB with matrix. 1746 LIBYUV_API 1747 int I210AlphaToARGBMatrix(const uint16_t* src_y, 1748 int src_stride_y, 1749 const uint16_t* src_u, 1750 int src_stride_u, 1751 const uint16_t* src_v, 1752 int src_stride_v, 1753 const uint16_t* src_a, 1754 int src_stride_a, 1755 uint8_t* dst_argb, 1756 int dst_stride_argb, 1757 const struct YuvConstants* yuvconstants, 1758 int width, 1759 int height, 1760 int attenuate); 1761 1762 // Convert I410 with Alpha to preattenuated ARGB with matrix. 1763 LIBYUV_API 1764 int I410AlphaToARGBMatrix(const uint16_t* src_y, 1765 int src_stride_y, 1766 const uint16_t* src_u, 1767 int src_stride_u, 1768 const uint16_t* src_v, 1769 int src_stride_v, 1770 const uint16_t* src_a, 1771 int src_stride_a, 1772 uint8_t* dst_argb, 1773 int dst_stride_argb, 1774 const struct YuvConstants* yuvconstants, 1775 int width, 1776 int height, 1777 int attenuate); 1778 1779 // Convert NV12 to ARGB with matrix. 1780 LIBYUV_API 1781 int NV12ToARGBMatrix(const uint8_t* src_y, 1782 int src_stride_y, 1783 const uint8_t* src_uv, 1784 int src_stride_uv, 1785 uint8_t* dst_argb, 1786 int dst_stride_argb, 1787 const struct YuvConstants* yuvconstants, 1788 int width, 1789 int height); 1790 1791 // Convert NV21 to ARGB with matrix. 1792 LIBYUV_API 1793 int NV21ToARGBMatrix(const uint8_t* src_y, 1794 int src_stride_y, 1795 const uint8_t* src_vu, 1796 int src_stride_vu, 1797 uint8_t* dst_argb, 1798 int dst_stride_argb, 1799 const struct YuvConstants* yuvconstants, 1800 int width, 1801 int height); 1802 1803 // Convert NV12 to RGB565 with matrix. 1804 LIBYUV_API 1805 int NV12ToRGB565Matrix(const uint8_t* src_y, 1806 int src_stride_y, 1807 const uint8_t* src_uv, 1808 int src_stride_uv, 1809 uint8_t* dst_rgb565, 1810 int dst_stride_rgb565, 1811 const struct YuvConstants* yuvconstants, 1812 int width, 1813 int height); 1814 1815 // Convert NV12 to RGB24 with matrix. 1816 LIBYUV_API 1817 int NV12ToRGB24Matrix(const uint8_t* src_y, 1818 int src_stride_y, 1819 const uint8_t* src_uv, 1820 int src_stride_uv, 1821 uint8_t* dst_rgb24, 1822 int dst_stride_rgb24, 1823 const struct YuvConstants* yuvconstants, 1824 int width, 1825 int height); 1826 1827 // Convert NV21 to RGB24 with matrix. 1828 LIBYUV_API 1829 int NV21ToRGB24Matrix(const uint8_t* src_y, 1830 int src_stride_y, 1831 const uint8_t* src_vu, 1832 int src_stride_vu, 1833 uint8_t* dst_rgb24, 1834 int dst_stride_rgb24, 1835 const struct YuvConstants* yuvconstants, 1836 int width, 1837 int height); 1838 1839 // Convert Android420 to ARGB with matrix. 1840 LIBYUV_API 1841 int Android420ToARGBMatrix(const uint8_t* src_y, 1842 int src_stride_y, 1843 const uint8_t* src_u, 1844 int src_stride_u, 1845 const uint8_t* src_v, 1846 int src_stride_v, 1847 int src_pixel_stride_uv, 1848 uint8_t* dst_argb, 1849 int dst_stride_argb, 1850 const struct YuvConstants* yuvconstants, 1851 int width, 1852 int height); 1853 1854 // Convert I422 to RGBA with matrix. 1855 LIBYUV_API 1856 int I422ToRGBAMatrix(const uint8_t* src_y, 1857 int src_stride_y, 1858 const uint8_t* src_u, 1859 int src_stride_u, 1860 const uint8_t* src_v, 1861 int src_stride_v, 1862 uint8_t* dst_rgba, 1863 int dst_stride_rgba, 1864 const struct YuvConstants* yuvconstants, 1865 int width, 1866 int height); 1867 1868 // Convert I420 to RGBA with matrix. 1869 LIBYUV_API 1870 int I420ToRGBAMatrix(const uint8_t* src_y, 1871 int src_stride_y, 1872 const uint8_t* src_u, 1873 int src_stride_u, 1874 const uint8_t* src_v, 1875 int src_stride_v, 1876 uint8_t* dst_rgba, 1877 int dst_stride_rgba, 1878 const struct YuvConstants* yuvconstants, 1879 int width, 1880 int height); 1881 1882 // Convert I420 to RGB24 with matrix. 1883 LIBYUV_API 1884 int I420ToRGB24Matrix(const uint8_t* src_y, 1885 int src_stride_y, 1886 const uint8_t* src_u, 1887 int src_stride_u, 1888 const uint8_t* src_v, 1889 int src_stride_v, 1890 uint8_t* dst_rgb24, 1891 int dst_stride_rgb24, 1892 const struct YuvConstants* yuvconstants, 1893 int width, 1894 int height); 1895 1896 // Convert I420 to RGB565 with specified color matrix. 1897 LIBYUV_API 1898 int I420ToRGB565Matrix(const uint8_t* src_y, 1899 int src_stride_y, 1900 const uint8_t* src_u, 1901 int src_stride_u, 1902 const uint8_t* src_v, 1903 int src_stride_v, 1904 uint8_t* dst_rgb565, 1905 int dst_stride_rgb565, 1906 const struct YuvConstants* yuvconstants, 1907 int width, 1908 int height); 1909 1910 // Convert I420 to AR30 with matrix. 1911 LIBYUV_API 1912 int I420ToAR30Matrix(const uint8_t* src_y, 1913 int src_stride_y, 1914 const uint8_t* src_u, 1915 int src_stride_u, 1916 const uint8_t* src_v, 1917 int src_stride_v, 1918 uint8_t* dst_ar30, 1919 int dst_stride_ar30, 1920 const struct YuvConstants* yuvconstants, 1921 int width, 1922 int height); 1923 1924 // Convert I400 (grey) to ARGB. Reverse of ARGBToI400. 1925 LIBYUV_API 1926 int I400ToARGBMatrix(const uint8_t* src_y, 1927 int src_stride_y, 1928 uint8_t* dst_argb, 1929 int dst_stride_argb, 1930 const struct YuvConstants* yuvconstants, 1931 int width, 1932 int height); 1933 1934 // Convert I420 to ARGB with matrix and UV filter mode. 1935 LIBYUV_API 1936 int I420ToARGBMatrixFilter(const uint8_t* src_y, 1937 int src_stride_y, 1938 const uint8_t* src_u, 1939 int src_stride_u, 1940 const uint8_t* src_v, 1941 int src_stride_v, 1942 uint8_t* dst_argb, 1943 int dst_stride_argb, 1944 const struct YuvConstants* yuvconstants, 1945 int width, 1946 int height, 1947 enum FilterMode filter); 1948 1949 // Convert I422 to ARGB with matrix and UV filter mode. 1950 LIBYUV_API 1951 int I422ToARGBMatrixFilter(const uint8_t* src_y, 1952 int src_stride_y, 1953 const uint8_t* src_u, 1954 int src_stride_u, 1955 const uint8_t* src_v, 1956 int src_stride_v, 1957 uint8_t* dst_argb, 1958 int dst_stride_argb, 1959 const struct YuvConstants* yuvconstants, 1960 int width, 1961 int height, 1962 enum FilterMode filter); 1963 1964 // Convert I010 to AR30 with matrix and UV filter mode. 1965 LIBYUV_API 1966 int I010ToAR30MatrixFilter(const uint16_t* src_y, 1967 int src_stride_y, 1968 const uint16_t* src_u, 1969 int src_stride_u, 1970 const uint16_t* src_v, 1971 int src_stride_v, 1972 uint8_t* dst_ar30, 1973 int dst_stride_ar30, 1974 const struct YuvConstants* yuvconstants, 1975 int width, 1976 int height, 1977 enum FilterMode filter); 1978 1979 // Convert I210 to AR30 with matrix and UV filter mode. 1980 LIBYUV_API 1981 int I210ToAR30MatrixFilter(const uint16_t* src_y, 1982 int src_stride_y, 1983 const uint16_t* src_u, 1984 int src_stride_u, 1985 const uint16_t* src_v, 1986 int src_stride_v, 1987 uint8_t* dst_ar30, 1988 int dst_stride_ar30, 1989 const struct YuvConstants* yuvconstants, 1990 int width, 1991 int height, 1992 enum FilterMode filter); 1993 1994 // Convert I010 to ARGB with matrix and UV filter mode. 1995 LIBYUV_API 1996 int I010ToARGBMatrixFilter(const uint16_t* src_y, 1997 int src_stride_y, 1998 const uint16_t* src_u, 1999 int src_stride_u, 2000 const uint16_t* src_v, 2001 int src_stride_v, 2002 uint8_t* dst_argb, 2003 int dst_stride_argb, 2004 const struct YuvConstants* yuvconstants, 2005 int width, 2006 int height, 2007 enum FilterMode filter); 2008 2009 // Convert I210 to ARGB with matrix and UV filter mode. 2010 LIBYUV_API 2011 int I210ToARGBMatrixFilter(const uint16_t* src_y, 2012 int src_stride_y, 2013 const uint16_t* src_u, 2014 int src_stride_u, 2015 const uint16_t* src_v, 2016 int src_stride_v, 2017 uint8_t* dst_argb, 2018 int dst_stride_argb, 2019 const struct YuvConstants* yuvconstants, 2020 int width, 2021 int height, 2022 enum FilterMode filter); 2023 2024 // Convert I420 with Alpha to attenuated ARGB with matrix and UV filter mode. 2025 LIBYUV_API 2026 int I420AlphaToARGBMatrixFilter(const uint8_t* src_y, 2027 int src_stride_y, 2028 const uint8_t* src_u, 2029 int src_stride_u, 2030 const uint8_t* src_v, 2031 int src_stride_v, 2032 const uint8_t* src_a, 2033 int src_stride_a, 2034 uint8_t* dst_argb, 2035 int dst_stride_argb, 2036 const struct YuvConstants* yuvconstants, 2037 int width, 2038 int height, 2039 int attenuate, 2040 enum FilterMode filter); 2041 2042 // Convert I422 with Alpha to attenuated ARGB with matrix and UV filter mode. 2043 LIBYUV_API 2044 int I422AlphaToARGBMatrixFilter(const uint8_t* src_y, 2045 int src_stride_y, 2046 const uint8_t* src_u, 2047 int src_stride_u, 2048 const uint8_t* src_v, 2049 int src_stride_v, 2050 const uint8_t* src_a, 2051 int src_stride_a, 2052 uint8_t* dst_argb, 2053 int dst_stride_argb, 2054 const struct YuvConstants* yuvconstants, 2055 int width, 2056 int height, 2057 int attenuate, 2058 enum FilterMode filter); 2059 2060 // Convert I010 with Alpha to attenuated ARGB with matrix and UV filter mode. 2061 LIBYUV_API 2062 int I010AlphaToARGBMatrixFilter(const uint16_t* src_y, 2063 int src_stride_y, 2064 const uint16_t* src_u, 2065 int src_stride_u, 2066 const uint16_t* src_v, 2067 int src_stride_v, 2068 const uint16_t* src_a, 2069 int src_stride_a, 2070 uint8_t* dst_argb, 2071 int dst_stride_argb, 2072 const struct YuvConstants* yuvconstants, 2073 int width, 2074 int height, 2075 int attenuate, 2076 enum FilterMode filter); 2077 2078 // Convert I210 with Alpha to attenuated ARGB with matrix and UV filter mode. 2079 LIBYUV_API 2080 int I210AlphaToARGBMatrixFilter(const uint16_t* src_y, 2081 int src_stride_y, 2082 const uint16_t* src_u, 2083 int src_stride_u, 2084 const uint16_t* src_v, 2085 int src_stride_v, 2086 const uint16_t* src_a, 2087 int src_stride_a, 2088 uint8_t* dst_argb, 2089 int dst_stride_argb, 2090 const struct YuvConstants* yuvconstants, 2091 int width, 2092 int height, 2093 int attenuate, 2094 enum FilterMode filter); 2095 2096 // Convert P010 to ARGB with matrix and UV filter mode. 2097 LIBYUV_API 2098 int P010ToARGBMatrixFilter(const uint16_t* src_y, 2099 int src_stride_y, 2100 const uint16_t* src_uv, 2101 int src_stride_uv, 2102 uint8_t* dst_argb, 2103 int dst_stride_argb, 2104 const struct YuvConstants* yuvconstants, 2105 int width, 2106 int height, 2107 enum FilterMode filter); 2108 2109 // Convert P210 to ARGB with matrix and UV filter mode. 2110 LIBYUV_API 2111 int P210ToARGBMatrixFilter(const uint16_t* src_y, 2112 int src_stride_y, 2113 const uint16_t* src_uv, 2114 int src_stride_uv, 2115 uint8_t* dst_argb, 2116 int dst_stride_argb, 2117 const struct YuvConstants* yuvconstants, 2118 int width, 2119 int height, 2120 enum FilterMode filter); 2121 2122 // Convert P010 to AR30 with matrix and UV filter mode. 2123 LIBYUV_API 2124 int P010ToAR30MatrixFilter(const uint16_t* src_y, 2125 int src_stride_y, 2126 const uint16_t* src_uv, 2127 int src_stride_uv, 2128 uint8_t* dst_ar30, 2129 int dst_stride_ar30, 2130 const struct YuvConstants* yuvconstants, 2131 int width, 2132 int height, 2133 enum FilterMode filter); 2134 2135 // Convert P210 to AR30 with matrix and UV filter mode. 2136 LIBYUV_API 2137 int P210ToAR30MatrixFilter(const uint16_t* src_y, 2138 int src_stride_y, 2139 const uint16_t* src_uv, 2140 int src_stride_uv, 2141 uint8_t* dst_ar30, 2142 int dst_stride_ar30, 2143 const struct YuvConstants* yuvconstants, 2144 int width, 2145 int height, 2146 enum FilterMode filter); 2147 2148 // Convert camera sample to ARGB with cropping, rotation and vertical flip. 2149 // "sample_size" is needed to parse MJPG. 2150 // "dst_stride_argb" number of bytes in a row of the dst_argb plane. 2151 // Normally this would be the same as dst_width, with recommended alignment 2152 // to 16 bytes for better efficiency. 2153 // If rotation of 90 or 270 is used, stride is affected. The caller should 2154 // allocate the I420 buffer according to rotation. 2155 // "dst_stride_u" number of bytes in a row of the dst_u plane. 2156 // Normally this would be the same as (dst_width + 1) / 2, with 2157 // recommended alignment to 16 bytes for better efficiency. 2158 // If rotation of 90 or 270 is used, stride is affected. 2159 // "crop_x" and "crop_y" are starting position for cropping. 2160 // To center, crop_x = (src_width - dst_width) / 2 2161 // crop_y = (src_height - dst_height) / 2 2162 // "src_width" / "src_height" is size of src_frame in pixels. 2163 // "src_height" can be negative indicating a vertically flipped image source. 2164 // "crop_width" / "crop_height" is the size to crop the src to. 2165 // Must be less than or equal to src_width/src_height 2166 // Cropping parameters are pre-rotation. 2167 // "rotation" can be 0, 90, 180 or 270. 2168 // "fourcc" is a fourcc. ie 'I420', 'YUY2' 2169 // Returns 0 for successful; -1 for invalid parameter. Non-zero for failure. 2170 LIBYUV_API 2171 int ConvertToARGB(const uint8_t* sample, 2172 size_t sample_size, 2173 uint8_t* dst_argb, 2174 int dst_stride_argb, 2175 int crop_x, 2176 int crop_y, 2177 int src_width, 2178 int src_height, 2179 int crop_width, 2180 int crop_height, 2181 enum RotationMode rotation, 2182 uint32_t fourcc); 2183 2184 #ifdef __cplusplus 2185 } // extern "C" 2186 } // namespace libyuv 2187 #endif 2188 2189 #endif // INCLUDE_LIBYUV_CONVERT_ARGB_H_ 2190