| 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 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 return 0; | 1086 return 0; |
| 1087 } | 1087 } |
| 1088 | 1088 |
| 1089 // Convert NV21 to ARGB. | 1089 // Convert NV21 to ARGB. |
| 1090 LIBYUV_API | 1090 LIBYUV_API |
| 1091 int NV21ToARGB(const uint8* src_y, int src_stride_y, | 1091 int NV21ToARGB(const uint8* src_y, int src_stride_y, |
| 1092 const uint8* src_uv, int src_stride_uv, | 1092 const uint8* src_uv, int src_stride_uv, |
| 1093 uint8* dst_argb, int dst_stride_argb, | 1093 uint8* dst_argb, int dst_stride_argb, |
| 1094 int width, int height) { | 1094 int width, int height) { |
| 1095 int y; | 1095 int y; |
| 1096 void (*NV12ToARGBRow)(const uint8* y_buf, | 1096 void (*NV21ToARGBRow)(const uint8* y_buf, |
| 1097 const uint8* uv_buf, | 1097 const uint8* uv_buf, |
| 1098 uint8* rgb_buf, | 1098 uint8* rgb_buf, |
| 1099 struct YuvConstants* yuvconstants, | 1099 struct YuvConstants* yuvconstants, |
| 1100 int width) = NV12ToARGBRow_C; | 1100 int width) = NV21ToARGBRow_C; |
| 1101 if (!src_y || !src_uv || !dst_argb || | 1101 if (!src_y || !src_uv || !dst_argb || |
| 1102 width <= 0 || height == 0) { | 1102 width <= 0 || height == 0) { |
| 1103 return -1; | 1103 return -1; |
| 1104 } | 1104 } |
| 1105 // Negative height means invert the image. | 1105 // Negative height means invert the image. |
| 1106 if (height < 0) { | 1106 if (height < 0) { |
| 1107 height = -height; | 1107 height = -height; |
| 1108 dst_argb = dst_argb + (height - 1) * dst_stride_argb; | 1108 dst_argb = dst_argb + (height - 1) * dst_stride_argb; |
| 1109 dst_stride_argb = -dst_stride_argb; | 1109 dst_stride_argb = -dst_stride_argb; |
| 1110 } | 1110 } |
| 1111 #if defined(HAS_NV12TOARGBROW_SSSE3) | 1111 #if defined(HAS_NV21TOARGBROW_SSSE3) |
| 1112 if (TestCpuFlag(kCpuHasSSSE3)) { | 1112 if (TestCpuFlag(kCpuHasSSSE3)) { |
| 1113 NV12ToARGBRow = NV12ToARGBRow_Any_SSSE3; | 1113 NV21ToARGBRow = NV21ToARGBRow_Any_SSSE3; |
| 1114 if (IS_ALIGNED(width, 8)) { | 1114 if (IS_ALIGNED(width, 8)) { |
| 1115 NV12ToARGBRow = NV12ToARGBRow_SSSE3; | 1115 NV21ToARGBRow = NV21ToARGBRow_SSSE3; |
| 1116 } | 1116 } |
| 1117 } | 1117 } |
| 1118 #endif | 1118 #endif |
| 1119 #if defined(HAS_NV12TOARGBROW_AVX2) | 1119 #if defined(HAS_NV21TOARGBROW_AVX2) |
| 1120 if (TestCpuFlag(kCpuHasAVX2)) { | 1120 if (TestCpuFlag(kCpuHasAVX2)) { |
| 1121 NV12ToARGBRow = NV12ToARGBRow_Any_AVX2; | 1121 NV21ToARGBRow = NV21ToARGBRow_Any_AVX2; |
| 1122 if (IS_ALIGNED(width, 16)) { | 1122 if (IS_ALIGNED(width, 16)) { |
| 1123 NV12ToARGBRow = NV12ToARGBRow_AVX2; | 1123 NV21ToARGBRow = NV21ToARGBRow_AVX2; |
| 1124 } | 1124 } |
| 1125 } | 1125 } |
| 1126 #endif | 1126 #endif |
| 1127 #if defined(HAS_NV12TOARGBROW_NEON) | 1127 #if defined(HAS_NV21TOARGBROW_NEON) |
| 1128 if (TestCpuFlag(kCpuHasNEON)) { | 1128 if (TestCpuFlag(kCpuHasNEON)) { |
| 1129 NV12ToARGBRow = NV12ToARGBRow_Any_NEON; | 1129 NV21ToARGBRow = NV21ToARGBRow_Any_NEON; |
| 1130 if (IS_ALIGNED(width, 8)) { | 1130 if (IS_ALIGNED(width, 8)) { |
| 1131 NV12ToARGBRow = NV12ToARGBRow_NEON; | 1131 NV21ToARGBRow = NV21ToARGBRow_NEON; |
| 1132 } | 1132 } |
| 1133 } | 1133 } |
| 1134 #endif | 1134 #endif |
| 1135 | 1135 |
| 1136 for (y = 0; y < height; ++y) { | 1136 for (y = 0; y < height; ++y) { |
| 1137 NV12ToARGBRow(src_y, src_uv, dst_argb, &kYvuConstants, width); | 1137 NV21ToARGBRow(src_y, src_uv, dst_argb, &kYuvConstants, width); |
| 1138 dst_argb += dst_stride_argb; | 1138 dst_argb += dst_stride_argb; |
| 1139 src_y += src_stride_y; | 1139 src_y += src_stride_y; |
| 1140 if (y & 1) { | 1140 if (y & 1) { |
| 1141 src_uv += src_stride_uv; | 1141 src_uv += src_stride_uv; |
| 1142 } | 1142 } |
| 1143 } | 1143 } |
| 1144 return 0; | 1144 return 0; |
| 1145 } | 1145 } |
| 1146 | 1146 |
| 1147 // Convert M420 to ARGB. | 1147 // Convert M420 to ARGB. |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1914 src_u += src_stride_u; | 1914 src_u += src_stride_u; |
| 1915 src_v += src_stride_v; | 1915 src_v += src_stride_v; |
| 1916 } | 1916 } |
| 1917 return 0; | 1917 return 0; |
| 1918 } | 1918 } |
| 1919 | 1919 |
| 1920 #ifdef __cplusplus | 1920 #ifdef __cplusplus |
| 1921 } // extern "C" | 1921 } // extern "C" |
| 1922 } // namespace libyuv | 1922 } // namespace libyuv |
| 1923 #endif | 1923 #endif |
| OLD | NEW |