| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 for (y = 0; y < height; ++y) { | 836 for (y = 0; y < height; ++y) { |
| 837 I422ToBGRARow(src_y, src_u, src_v, dst_bgra, &kYuvIConstants, width); | 837 I422ToBGRARow(src_y, src_u, src_v, dst_bgra, &kYuvIConstants, width); |
| 838 dst_bgra += dst_stride_bgra; | 838 dst_bgra += dst_stride_bgra; |
| 839 src_y += src_stride_y; | 839 src_y += src_stride_y; |
| 840 src_u += src_stride_u; | 840 src_u += src_stride_u; |
| 841 src_v += src_stride_v; | 841 src_v += src_stride_v; |
| 842 } | 842 } |
| 843 return 0; | 843 return 0; |
| 844 } | 844 } |
| 845 | 845 |
| 846 // Convert I422 to ABGR. | |
| 847 LIBYUV_API | |
| 848 int I422ToABGR(const uint8* src_y, int src_stride_y, | |
| 849 const uint8* src_u, int src_stride_u, | |
| 850 const uint8* src_v, int src_stride_v, | |
| 851 uint8* dst_abgr, int dst_stride_abgr, | |
| 852 int width, int height) { | |
| 853 int y; | |
| 854 void (*I422ToABGRRow)(const uint8* y_buf, | |
| 855 const uint8* u_buf, | |
| 856 const uint8* v_buf, | |
| 857 uint8* rgb_buf, | |
| 858 const struct YuvConstants* yuvconstants, | |
| 859 int width) = I422ToABGRRow_C; | |
| 860 if (!src_y || !src_u || !src_v || | |
| 861 !dst_abgr || | |
| 862 width <= 0 || height == 0) { | |
| 863 return -1; | |
| 864 } | |
| 865 // Negative height means invert the image. | |
| 866 if (height < 0) { | |
| 867 height = -height; | |
| 868 dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr; | |
| 869 dst_stride_abgr = -dst_stride_abgr; | |
| 870 } | |
| 871 // Coalesce rows. | |
| 872 if (src_stride_y == width && | |
| 873 src_stride_u * 2 == width && | |
| 874 src_stride_v * 2 == width && | |
| 875 dst_stride_abgr == width * 4) { | |
| 876 width *= height; | |
| 877 height = 1; | |
| 878 src_stride_y = src_stride_u = src_stride_v = dst_stride_abgr = 0; | |
| 879 } | |
| 880 #if defined(HAS_I422TOABGRROW_NEON) | |
| 881 if (TestCpuFlag(kCpuHasNEON) && width >= 8) { | |
| 882 I422ToABGRRow = I422ToABGRRow_Any_NEON; | |
| 883 if (IS_ALIGNED(width, 8)) { | |
| 884 I422ToABGRRow = I422ToABGRRow_NEON; | |
| 885 } | |
| 886 } | |
| 887 #endif | |
| 888 #if defined(HAS_I422TOABGRROW_SSSE3) | |
| 889 if (TestCpuFlag(kCpuHasSSSE3)) { | |
| 890 I422ToABGRRow = I422ToABGRRow_Any_SSSE3; | |
| 891 if (IS_ALIGNED(width, 8)) { | |
| 892 I422ToABGRRow = I422ToABGRRow_SSSE3; | |
| 893 } | |
| 894 } | |
| 895 #endif | |
| 896 #if defined(HAS_I422TOABGRROW_AVX2) | |
| 897 if (TestCpuFlag(kCpuHasAVX2)) { | |
| 898 I422ToABGRRow = I422ToABGRRow_Any_AVX2; | |
| 899 if (IS_ALIGNED(width, 16)) { | |
| 900 I422ToABGRRow = I422ToABGRRow_AVX2; | |
| 901 } | |
| 902 } | |
| 903 #endif | |
| 904 | |
| 905 for (y = 0; y < height; ++y) { | |
| 906 I422ToABGRRow(src_y, src_u, src_v, dst_abgr, &kYuvIConstants, width); | |
| 907 dst_abgr += dst_stride_abgr; | |
| 908 src_y += src_stride_y; | |
| 909 src_u += src_stride_u; | |
| 910 src_v += src_stride_v; | |
| 911 } | |
| 912 return 0; | |
| 913 } | |
| 914 | |
| 915 // Convert I422 to RGBA. | 846 // Convert I422 to RGBA. |
| 916 LIBYUV_API | 847 LIBYUV_API |
| 917 int I422ToRGBA(const uint8* src_y, int src_stride_y, | 848 int I422ToRGBA(const uint8* src_y, int src_stride_y, |
| 918 const uint8* src_u, int src_stride_u, | 849 const uint8* src_u, int src_stride_u, |
| 919 const uint8* src_v, int src_stride_v, | 850 const uint8* src_v, int src_stride_v, |
| 920 uint8* dst_rgba, int dst_stride_rgba, | 851 uint8* dst_rgba, int dst_stride_rgba, |
| 921 int width, int height) { | 852 int width, int height) { |
| 922 int y; | 853 int y; |
| 923 void (*I422ToRGBARow)(const uint8* y_buf, | 854 void (*I422ToRGBARow)(const uint8* y_buf, |
| 924 const uint8* u_buf, | 855 const uint8* u_buf, |
| (...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2484 } | 2415 } |
| 2485 free_aligned_buffer_64(rows); | 2416 free_aligned_buffer_64(rows); |
| 2486 } | 2417 } |
| 2487 return 0; | 2418 return 0; |
| 2488 } | 2419 } |
| 2489 | 2420 |
| 2490 #ifdef __cplusplus | 2421 #ifdef __cplusplus |
| 2491 } // extern "C" | 2422 } // extern "C" |
| 2492 } // namespace libyuv | 2423 } // namespace libyuv |
| 2493 #endif | 2424 #endif |
| OLD | NEW |