| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2012 The LibYuv Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 LIBYUV_API | 524 LIBYUV_API |
| 525 int I420ToRGBA(const uint8* src_y, int src_stride_y, | 525 int I420ToRGBA(const uint8* src_y, int src_stride_y, |
| 526 const uint8* src_u, int src_stride_u, | 526 const uint8* src_u, int src_stride_u, |
| 527 const uint8* src_v, int src_stride_v, | 527 const uint8* src_v, int src_stride_v, |
| 528 uint8* dst_rgba, int dst_stride_rgba, | 528 uint8* dst_rgba, int dst_stride_rgba, |
| 529 int width, int height) { | 529 int width, int height) { |
| 530 return I420ToRGBAMatrix(src_y, src_stride_y, | 530 return I420ToRGBAMatrix(src_y, src_stride_y, |
| 531 src_u, src_stride_u, | 531 src_u, src_stride_u, |
| 532 src_v, src_stride_v, | 532 src_v, src_stride_v, |
| 533 dst_rgba, dst_stride_rgba, | 533 dst_rgba, dst_stride_rgba, |
| 534 &kYuvIConstants, | 534 &kYuvI601Constants, |
| 535 width, height); | 535 width, height); |
| 536 } | 536 } |
| 537 | 537 |
| 538 // Convert I420 to BGRA. | 538 // Convert I420 to BGRA. |
| 539 LIBYUV_API | 539 LIBYUV_API |
| 540 int I420ToBGRA(const uint8* src_y, int src_stride_y, | 540 int I420ToBGRA(const uint8* src_y, int src_stride_y, |
| 541 const uint8* src_u, int src_stride_u, | 541 const uint8* src_u, int src_stride_u, |
| 542 const uint8* src_v, int src_stride_v, | 542 const uint8* src_v, int src_stride_v, |
| 543 uint8* dst_bgra, int dst_stride_bgra, | 543 uint8* dst_bgra, int dst_stride_bgra, |
| 544 int width, int height) { | 544 int width, int height) { |
| 545 return I420ToRGBAMatrix(src_y, src_stride_y, | 545 return I420ToRGBAMatrix(src_y, src_stride_y, |
| 546 src_v, src_stride_v, // Swap U and V | 546 src_v, src_stride_v, // Swap U and V |
| 547 src_u, src_stride_u, | 547 src_u, src_stride_u, |
| 548 dst_bgra, dst_stride_bgra, | 548 dst_bgra, dst_stride_bgra, |
| 549 &kYvuIConstants, // Use Yvu matrix | 549 &kYvuI601Constants, // Use Yvu matrix |
| 550 width, height); | 550 width, height); |
| 551 } | 551 } |
| 552 | 552 |
| 553 // Convert I420 to RGB24 with matrix | 553 // Convert I420 to RGB24 with matrix |
| 554 static int I420ToRGB24Matrix(const uint8* src_y, int src_stride_y, | 554 static int I420ToRGB24Matrix(const uint8* src_y, int src_stride_y, |
| 555 const uint8* src_u, int src_stride_u, | 555 const uint8* src_u, int src_stride_u, |
| 556 const uint8* src_v, int src_stride_v, | 556 const uint8* src_v, int src_stride_v, |
| 557 uint8* dst_rgb24, int dst_stride_rgb24, | 557 uint8* dst_rgb24, int dst_stride_rgb24, |
| 558 const struct YuvConstants* yuvconstants, | 558 const struct YuvConstants* yuvconstants, |
| 559 int width, int height) { | 559 int width, int height) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 LIBYUV_API | 615 LIBYUV_API |
| 616 int I420ToRGB24(const uint8* src_y, int src_stride_y, | 616 int I420ToRGB24(const uint8* src_y, int src_stride_y, |
| 617 const uint8* src_u, int src_stride_u, | 617 const uint8* src_u, int src_stride_u, |
| 618 const uint8* src_v, int src_stride_v, | 618 const uint8* src_v, int src_stride_v, |
| 619 uint8* dst_rgb24, int dst_stride_rgb24, | 619 uint8* dst_rgb24, int dst_stride_rgb24, |
| 620 int width, int height) { | 620 int width, int height) { |
| 621 return I420ToRGB24Matrix(src_y, src_stride_y, | 621 return I420ToRGB24Matrix(src_y, src_stride_y, |
| 622 src_u, src_stride_u, | 622 src_u, src_stride_u, |
| 623 src_v, src_stride_v, | 623 src_v, src_stride_v, |
| 624 dst_rgb24, dst_stride_rgb24, | 624 dst_rgb24, dst_stride_rgb24, |
| 625 &kYuvIConstants, | 625 &kYuvI601Constants, |
| 626 width, height); | 626 width, height); |
| 627 } | 627 } |
| 628 | 628 |
| 629 // Convert I420 to RAW. | 629 // Convert I420 to RAW. |
| 630 LIBYUV_API | 630 LIBYUV_API |
| 631 int I420ToRAW(const uint8* src_y, int src_stride_y, | 631 int I420ToRAW(const uint8* src_y, int src_stride_y, |
| 632 const uint8* src_u, int src_stride_u, | 632 const uint8* src_u, int src_stride_u, |
| 633 const uint8* src_v, int src_stride_v, | 633 const uint8* src_v, int src_stride_v, |
| 634 uint8* dst_raw, int dst_stride_raw, | 634 uint8* dst_raw, int dst_stride_raw, |
| 635 int width, int height) { | 635 int width, int height) { |
| 636 return I420ToRGB24Matrix(src_y, src_stride_y, | 636 return I420ToRGB24Matrix(src_y, src_stride_y, |
| 637 src_v, src_stride_v, // Swap U and V | 637 src_v, src_stride_v, // Swap U and V |
| 638 src_u, src_stride_u, | 638 src_u, src_stride_u, |
| 639 dst_raw, dst_stride_raw, | 639 dst_raw, dst_stride_raw, |
| 640 &kYvuIConstants, // Use Yvu matrix | 640 &kYvuI601Constants, // Use Yvu matrix |
| 641 width, height); | 641 width, height); |
| 642 } | 642 } |
| 643 | 643 |
| 644 // Convert I420 to ARGB1555. | 644 // Convert I420 to ARGB1555. |
| 645 LIBYUV_API | 645 LIBYUV_API |
| 646 int I420ToARGB1555(const uint8* src_y, int src_stride_y, | 646 int I420ToARGB1555(const uint8* src_y, int src_stride_y, |
| 647 const uint8* src_u, int src_stride_u, | 647 const uint8* src_u, int src_stride_u, |
| 648 const uint8* src_v, int src_stride_v, | 648 const uint8* src_v, int src_stride_v, |
| 649 uint8* dst_argb1555, int dst_stride_argb1555, | 649 uint8* dst_argb1555, int dst_stride_argb1555, |
| 650 int width, int height) { | 650 int width, int height) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 #if defined(HAS_I422TOARGB1555ROW_NEON) | 684 #if defined(HAS_I422TOARGB1555ROW_NEON) |
| 685 if (TestCpuFlag(kCpuHasNEON)) { | 685 if (TestCpuFlag(kCpuHasNEON)) { |
| 686 I422ToARGB1555Row = I422ToARGB1555Row_Any_NEON; | 686 I422ToARGB1555Row = I422ToARGB1555Row_Any_NEON; |
| 687 if (IS_ALIGNED(width, 8)) { | 687 if (IS_ALIGNED(width, 8)) { |
| 688 I422ToARGB1555Row = I422ToARGB1555Row_NEON; | 688 I422ToARGB1555Row = I422ToARGB1555Row_NEON; |
| 689 } | 689 } |
| 690 } | 690 } |
| 691 #endif | 691 #endif |
| 692 | 692 |
| 693 for (y = 0; y < height; ++y) { | 693 for (y = 0; y < height; ++y) { |
| 694 I422ToARGB1555Row(src_y, src_u, src_v, dst_argb1555, &kYuvIConstants, | 694 I422ToARGB1555Row(src_y, src_u, src_v, dst_argb1555, &kYuvI601Constants, |
| 695 width); | 695 width); |
| 696 dst_argb1555 += dst_stride_argb1555; | 696 dst_argb1555 += dst_stride_argb1555; |
| 697 src_y += src_stride_y; | 697 src_y += src_stride_y; |
| 698 if (y & 1) { | 698 if (y & 1) { |
| 699 src_u += src_stride_u; | 699 src_u += src_stride_u; |
| 700 src_v += src_stride_v; | 700 src_v += src_stride_v; |
| 701 } | 701 } |
| 702 } | 702 } |
| 703 return 0; | 703 return 0; |
| 704 } | 704 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 #if defined(HAS_I422TOARGB4444ROW_NEON) | 747 #if defined(HAS_I422TOARGB4444ROW_NEON) |
| 748 if (TestCpuFlag(kCpuHasNEON)) { | 748 if (TestCpuFlag(kCpuHasNEON)) { |
| 749 I422ToARGB4444Row = I422ToARGB4444Row_Any_NEON; | 749 I422ToARGB4444Row = I422ToARGB4444Row_Any_NEON; |
| 750 if (IS_ALIGNED(width, 8)) { | 750 if (IS_ALIGNED(width, 8)) { |
| 751 I422ToARGB4444Row = I422ToARGB4444Row_NEON; | 751 I422ToARGB4444Row = I422ToARGB4444Row_NEON; |
| 752 } | 752 } |
| 753 } | 753 } |
| 754 #endif | 754 #endif |
| 755 | 755 |
| 756 for (y = 0; y < height; ++y) { | 756 for (y = 0; y < height; ++y) { |
| 757 I422ToARGB4444Row(src_y, src_u, src_v, dst_argb4444, &kYuvIConstants, | 757 I422ToARGB4444Row(src_y, src_u, src_v, dst_argb4444, &kYuvI601Constants, |
| 758 width); | 758 width); |
| 759 dst_argb4444 += dst_stride_argb4444; | 759 dst_argb4444 += dst_stride_argb4444; |
| 760 src_y += src_stride_y; | 760 src_y += src_stride_y; |
| 761 if (y & 1) { | 761 if (y & 1) { |
| 762 src_u += src_stride_u; | 762 src_u += src_stride_u; |
| 763 src_v += src_stride_v; | 763 src_v += src_stride_v; |
| 764 } | 764 } |
| 765 } | 765 } |
| 766 return 0; | 766 return 0; |
| 767 } | 767 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 #if defined(HAS_I422TORGB565ROW_NEON) | 809 #if defined(HAS_I422TORGB565ROW_NEON) |
| 810 if (TestCpuFlag(kCpuHasNEON)) { | 810 if (TestCpuFlag(kCpuHasNEON)) { |
| 811 I422ToRGB565Row = I422ToRGB565Row_Any_NEON; | 811 I422ToRGB565Row = I422ToRGB565Row_Any_NEON; |
| 812 if (IS_ALIGNED(width, 8)) { | 812 if (IS_ALIGNED(width, 8)) { |
| 813 I422ToRGB565Row = I422ToRGB565Row_NEON; | 813 I422ToRGB565Row = I422ToRGB565Row_NEON; |
| 814 } | 814 } |
| 815 } | 815 } |
| 816 #endif | 816 #endif |
| 817 | 817 |
| 818 for (y = 0; y < height; ++y) { | 818 for (y = 0; y < height; ++y) { |
| 819 I422ToRGB565Row(src_y, src_u, src_v, dst_rgb565, &kYuvIConstants, width); | 819 I422ToRGB565Row(src_y, src_u, src_v, dst_rgb565, &kYuvI601Constants, width); |
| 820 dst_rgb565 += dst_stride_rgb565; | 820 dst_rgb565 += dst_stride_rgb565; |
| 821 src_y += src_stride_y; | 821 src_y += src_stride_y; |
| 822 if (y & 1) { | 822 if (y & 1) { |
| 823 src_u += src_stride_u; | 823 src_u += src_stride_u; |
| 824 src_v += src_stride_v; | 824 src_v += src_stride_v; |
| 825 } | 825 } |
| 826 } | 826 } |
| 827 return 0; | 827 return 0; |
| 828 } | 828 } |
| 829 | 829 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 ARGBToRGB565DitherRow = ARGBToRGB565DitherRow_Any_NEON; | 917 ARGBToRGB565DitherRow = ARGBToRGB565DitherRow_Any_NEON; |
| 918 if (IS_ALIGNED(width, 8)) { | 918 if (IS_ALIGNED(width, 8)) { |
| 919 ARGBToRGB565DitherRow = ARGBToRGB565DitherRow_NEON; | 919 ARGBToRGB565DitherRow = ARGBToRGB565DitherRow_NEON; |
| 920 } | 920 } |
| 921 } | 921 } |
| 922 #endif | 922 #endif |
| 923 { | 923 { |
| 924 // Allocate a row of argb. | 924 // Allocate a row of argb. |
| 925 align_buffer_64(row_argb, width * 4); | 925 align_buffer_64(row_argb, width * 4); |
| 926 for (y = 0; y < height; ++y) { | 926 for (y = 0; y < height; ++y) { |
| 927 I422ToARGBRow(src_y, src_u, src_v, row_argb, &kYuvIConstants, width); | 927 I422ToARGBRow(src_y, src_u, src_v, row_argb, &kYuvI601Constants, width); |
| 928 ARGBToRGB565DitherRow(row_argb, dst_rgb565, | 928 ARGBToRGB565DitherRow(row_argb, dst_rgb565, |
| 929 *(uint32*)(dither4x4 + ((y & 3) << 2)), width); | 929 *(uint32*)(dither4x4 + ((y & 3) << 2)), width); |
| 930 dst_rgb565 += dst_stride_rgb565; | 930 dst_rgb565 += dst_stride_rgb565; |
| 931 src_y += src_stride_y; | 931 src_y += src_stride_y; |
| 932 if (y & 1) { | 932 if (y & 1) { |
| 933 src_u += src_stride_u; | 933 src_u += src_stride_u; |
| 934 src_v += src_stride_v; | 934 src_v += src_stride_v; |
| 935 } | 935 } |
| 936 } | 936 } |
| 937 free_aligned_buffer_64(row_argb); | 937 free_aligned_buffer_64(row_argb); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 default: | 1158 default: |
| 1159 return -1; // unknown fourcc - return failure code. | 1159 return -1; // unknown fourcc - return failure code. |
| 1160 } | 1160 } |
| 1161 return r; | 1161 return r; |
| 1162 } | 1162 } |
| 1163 | 1163 |
| 1164 #ifdef __cplusplus | 1164 #ifdef __cplusplus |
| 1165 } // extern "C" | 1165 } // extern "C" |
| 1166 } // namespace libyuv | 1166 } // namespace libyuv |
| 1167 #endif | 1167 #endif |
| OLD | NEW |