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 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 #define UB -128 /* max(-128, round(-2.018 * 64)) */ | 1007 #define UB -128 /* max(-128, round(-2.018 * 64)) */ |
1008 #define UG 25 /* round(0.391 * 64) */ | 1008 #define UG 25 /* round(0.391 * 64) */ |
1009 #define VG 52 /* round(0.813 * 64) */ | 1009 #define VG 52 /* round(0.813 * 64) */ |
1010 #define VR -102 /* round(-1.596 * 64) */ | 1010 #define VR -102 /* round(-1.596 * 64) */ |
1011 | 1011 |
1012 // Bias values to subtract 16 from Y and 128 from U and V. | 1012 // Bias values to subtract 16 from Y and 128 from U and V. |
1013 #define BB (UB * 128 + YGB) | 1013 #define BB (UB * 128 + YGB) |
1014 #define BG (UG * 128 + VG * 128 + YGB) | 1014 #define BG (UG * 128 + VG * 128 + YGB) |
1015 #define BR (VR * 128 + YGB) | 1015 #define BR (VR * 128 + YGB) |
1016 | 1016 |
| 1017 // BT.601 constants for YUV to RGB. |
| 1018 // TODO(fbarchard): Unify these structures to be platform independent. |
| 1019 // TODO(fbarchard): Generate SIMD structures from float matrix. |
1017 #if defined(__aarch64__) | 1020 #if defined(__aarch64__) |
1018 YuvConstants SIMD_ALIGNED(kYuvConstants) = { | 1021 const YuvConstants SIMD_ALIGNED(kYuvIConstants) = { |
1019 { -UB, 0, -UB, 0, -UB, 0, -UB, 0, -VR, 0, -VR, 0, -VR, 0, -VR, 0 }, | 1022 { -UB, 0, -UB, 0, -UB, 0, -UB, 0, -VR, 0, -VR, 0, -VR, 0, -VR, 0 }, |
1020 { UG, 0, UG, 0, UG, 0, UG, 0, VG, 0, VG, 0, VG, 0, VG, 0 }, | 1023 { UG, 0, UG, 0, UG, 0, UG, 0, VG, 0, VG, 0, VG, 0, VG, 0 }, |
1021 { BB, BG, BR, 0, 0, 0, 0, 0 }, | 1024 { BB, BG, BR, 0, 0, 0, 0, 0 }, |
1022 { 0x0101 * YG, 0, 0, 0 } | 1025 { 0x0101 * YG, 0, 0, 0 } |
1023 }; | 1026 }; |
1024 | 1027 |
1025 #elif defined(__arm__) | 1028 #elif defined(__arm__) |
1026 YuvConstants SIMD_ALIGNED(kYuvConstants) = { | 1029 const YuvConstants SIMD_ALIGNED(kYuvIConstants) = { |
1027 { -UB, -UB, -UB, -UB, -VR, -VR, -VR, -VR, 0, 0, 0, 0, 0, 0, 0, 0 }, | 1030 { -UB, -UB, -UB, -UB, -VR, -VR, -VR, -VR, 0, 0, 0, 0, 0, 0, 0, 0 }, |
1028 { UG, UG, UG, UG, VG, VG, VG, VG, 0, 0, 0, 0, 0, 0, 0, 0 }, | 1031 { UG, UG, UG, UG, VG, VG, VG, VG, 0, 0, 0, 0, 0, 0, 0, 0 }, |
1029 { BB, BG, BR, 0, 0, 0, 0, 0 }, | 1032 { BB, BG, BR, 0, 0, 0, 0, 0 }, |
1030 { 0x0101 * YG, 0, 0, 0 } | 1033 { 0x0101 * YG, 0, 0, 0 } |
1031 }; | 1034 }; |
1032 #else | 1035 #else |
1033 // BT601 constants for YUV to RGB. | 1036 const YuvConstants SIMD_ALIGNED(kYuvIConstants) = { |
1034 YuvConstants SIMD_ALIGNED(kYuvConstants) = { | |
1035 { UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, | 1037 { UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, |
1036 UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0 }, | 1038 UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0 }, |
1037 { UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, | 1039 { UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, |
1038 UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG }, | 1040 UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG }, |
1039 { 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, | 1041 { 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, |
1040 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR }, | 1042 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR }, |
1041 { BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB }, | 1043 { BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB }, |
1042 { BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG }, | 1044 { BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG }, |
1043 { BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR }, | 1045 { BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR }, |
1044 { YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG } | 1046 { YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG } |
1045 }; | 1047 }; |
1046 | |
1047 // BT601 constants for NV21 where chroma plane is VU instead of UV. | |
1048 YuvConstants SIMD_ALIGNED(kYvuConstants) = { | |
1049 { 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, | |
1050 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB }, | |
1051 { VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, | |
1052 VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG }, | |
1053 { VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, | |
1054 VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0 }, | |
1055 { BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB }, | |
1056 { BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG }, | |
1057 { BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR }, | |
1058 { YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG } | |
1059 }; | |
1060 #endif | 1048 #endif |
1061 | 1049 |
1062 // C reference code that mimics the YUV assembly. | 1050 // C reference code that mimics the YUV assembly. |
1063 static __inline void YPixel(uint8 y, uint8* b, uint8* g, uint8* r) { | 1051 static __inline void YPixel(uint8 y, uint8* b, uint8* g, uint8* r) { |
1064 uint32 y1 = (uint32)(y * 0x0101 * YG) >> 16; | 1052 uint32 y1 = (uint32)(y * 0x0101 * YG) >> 16; |
1065 *b = Clamp((int32)(y1 + YGB) >> 6); | 1053 *b = Clamp((int32)(y1 + YGB) >> 6); |
1066 *g = Clamp((int32)(y1 + YGB) >> 6); | 1054 *g = Clamp((int32)(y1 + YGB) >> 6); |
1067 *r = Clamp((int32)(y1 + YGB) >> 6); | 1055 *r = Clamp((int32)(y1 + YGB) >> 6); |
1068 } | 1056 } |
1069 | 1057 |
1070 #undef BB | 1058 #undef BB |
1071 #undef BG | 1059 #undef BG |
1072 #undef BR | 1060 #undef BR |
1073 #undef YGB | 1061 #undef YGB |
1074 #undef UB | 1062 #undef UB |
1075 #undef UG | 1063 #undef UG |
1076 #undef VG | 1064 #undef VG |
1077 #undef VR | 1065 #undef VR |
1078 #undef YG | 1066 #undef YG |
1079 | 1067 |
1080 // C reference code that mimics the YUV assembly. | 1068 // C reference code that mimics the YUV assembly. |
1081 static __inline void YuvPixel(uint8 y, uint8 u, uint8 v, | 1069 static __inline void YuvPixel(uint8 y, uint8 u, uint8 v, |
1082 uint8* b, uint8* g, uint8* r, | 1070 uint8* b, uint8* g, uint8* r, |
1083 struct YuvConstants* yuvconstants) { | 1071 const struct YuvConstants* yuvconstants) { |
1084 #if defined(__aarch64__) | 1072 #if defined(__aarch64__) |
1085 int UB = -yuvconstants->kUVToRB[0]; | 1073 int UB = -yuvconstants->kUVToRB[0]; |
1086 int UG = yuvconstants->kUVToG[0]; | 1074 int UG = yuvconstants->kUVToG[0]; |
1087 int VG = yuvconstants->kUVToG[8]; | 1075 int VG = yuvconstants->kUVToG[8]; |
1088 int VR = -yuvconstants->kUVToRB[8]; | 1076 int VR = -yuvconstants->kUVToRB[8]; |
1089 int BB = yuvconstants->kUVBiasBGR[0]; | 1077 int BB = yuvconstants->kUVBiasBGR[0]; |
1090 int BG = yuvconstants->kUVBiasBGR[1]; | 1078 int BG = yuvconstants->kUVBiasBGR[1]; |
1091 int BR = yuvconstants->kUVBiasBGR[2]; | 1079 int BR = yuvconstants->kUVBiasBGR[2]; |
1092 int YG = yuvconstants->kYToRgb[0]; | 1080 int YG = yuvconstants->kYToRgb[0]; |
1093 #elif defined(__arm__) | 1081 #elif defined(__arm__) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 #define UBJ -113 /* round(-1.77200 * 64) */ | 1116 #define UBJ -113 /* round(-1.77200 * 64) */ |
1129 #define UGJ 22 /* round(0.34414 * 64) */ | 1117 #define UGJ 22 /* round(0.34414 * 64) */ |
1130 #define VGJ 46 /* round(0.71414 * 64) */ | 1118 #define VGJ 46 /* round(0.71414 * 64) */ |
1131 #define VRJ -90 /* round(-1.40200 * 64) */ | 1119 #define VRJ -90 /* round(-1.40200 * 64) */ |
1132 | 1120 |
1133 // Bias values to round, and subtract 128 from U and V. | 1121 // Bias values to round, and subtract 128 from U and V. |
1134 #define BBJ (UBJ * 128 + YGBJ) | 1122 #define BBJ (UBJ * 128 + YGBJ) |
1135 #define BGJ (UGJ * 128 + VGJ * 128 + YGBJ) | 1123 #define BGJ (UGJ * 128 + VGJ * 128 + YGBJ) |
1136 #define BRJ (VRJ * 128 + YGBJ) | 1124 #define BRJ (VRJ * 128 + YGBJ) |
1137 | 1125 |
1138 #if defined(__arm__) || defined(__aarch64__) | |
1139 // JPEG constants for YUV to RGB. | 1126 // JPEG constants for YUV to RGB. |
1140 YuvConstants SIMD_ALIGNED(kYuvJConstants) = { | 1127 #if defined(__aarch64__) |
| 1128 const YuvConstants SIMD_ALIGNED(kYuvJConstants) = { |
| 1129 { -UBJ, 0, -UBJ, 0, -UBJ, 0, -UBJ, 0, -VRJ, 0, -VRJ, 0, -VRJ, 0, -VRJ, 0 }, |
| 1130 { UGJ, 0, UGJ, 0, UGJ, 0, UGJ, 0, VGJ, 0, VGJ, 0, VGJ, 0, VGJ, 0 }, |
| 1131 { BBJ, BGJ, BRJ, 0, 0, 0, 0, 0 }, |
| 1132 { 0x0101 * YGJ, 0, 0, 0 } |
| 1133 }; |
| 1134 |
| 1135 #elif defined(__arm__) |
| 1136 const YuvConstants SIMD_ALIGNED(kYuvJConstants) = { |
1141 { -UBJ, -UBJ, -UBJ, -UBJ, -VRJ, -VRJ, -VRJ, -VRJ, 0, 0, 0, 0, 0, 0, 0, 0 }, | 1137 { -UBJ, -UBJ, -UBJ, -UBJ, -VRJ, -VRJ, -VRJ, -VRJ, 0, 0, 0, 0, 0, 0, 0, 0 }, |
1142 { UGJ, UGJ, UGJ, UGJ, VGJ, VGJ, VGJ, VGJ, 0, 0, 0, 0, 0, 0, 0, 0 }, | 1138 { UGJ, UGJ, UGJ, UGJ, VGJ, VGJ, VGJ, VGJ, 0, 0, 0, 0, 0, 0, 0, 0 }, |
1143 { BBJ, BGJ, BRJ, 0, 0, 0, 0, 0 }, | 1139 { BBJ, BGJ, BRJ, 0, 0, 0, 0, 0 }, |
1144 { 0x0101 * YGJ, 0, 0, 0 } | 1140 { 0x0101 * YGJ, 0, 0, 0 } |
1145 }; | 1141 }; |
1146 #else | 1142 #else |
1147 // JPEG constants for YUV to RGB. | 1143 const YuvConstants SIMD_ALIGNED(kYuvJConstants) = { |
1148 YuvConstants SIMD_ALIGNED(kYuvJConstants) = { | |
1149 { UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, | 1144 { UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, |
1150 UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0 }, | 1145 UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0 }, |
1151 { UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, | 1146 { UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, |
1152 UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, | 1147 UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, |
1153 UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, | 1148 UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, |
1154 UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, UGJ, VGJ }, | 1149 UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, UGJ, VGJ }, |
1155 { 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, | 1150 { 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, |
1156 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ }, | 1151 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ }, |
1157 { BBJ, BBJ, BBJ, BBJ, BBJ, BBJ, BBJ, BBJ, | 1152 { BBJ, BBJ, BBJ, BBJ, BBJ, BBJ, BBJ, BBJ, |
1158 BBJ, BBJ, BBJ, BBJ, BBJ, BBJ, BBJ, BBJ }, | 1153 BBJ, BBJ, BBJ, BBJ, BBJ, BBJ, BBJ, BBJ }, |
(...skipping 18 matching lines...) Expand all Loading... |
1177 | 1172 |
1178 // BT.709 YUV to RGB reference | 1173 // BT.709 YUV to RGB reference |
1179 // * R = Y - V * -1.28033 | 1174 // * R = Y - V * -1.28033 |
1180 // * G = Y - U * 0.21482 - V * 0.38059 | 1175 // * G = Y - U * 0.21482 - V * 0.38059 |
1181 // * B = Y - U * -2.12798 | 1176 // * B = Y - U * -2.12798 |
1182 | 1177 |
1183 // Y contribution to R,G,B. Scale and bias. | 1178 // Y contribution to R,G,B. Scale and bias. |
1184 #define YGH 16320 /* round(1.000 * 64 * 256 * 256 / 257) */ | 1179 #define YGH 16320 /* round(1.000 * 64 * 256 * 256 / 257) */ |
1185 #define YGBH 32 /* 64 / 2 */ | 1180 #define YGBH 32 /* 64 / 2 */ |
1186 | 1181 |
| 1182 // TODO(fbarchard): Find way to express 2.12 instead of 2.0. |
1187 // U and V contributions to R,G,B. | 1183 // U and V contributions to R,G,B. |
1188 #define UBH -128 /* max(-128, round(-2.12798 * 64)) */ | 1184 #define UBH -128 /* max(-128, round(-2.12798 * 64)) */ |
1189 #define UGH 14 /* round(0.21482 * 64) */ | 1185 #define UGH 14 /* round(0.21482 * 64) */ |
1190 #define VGH 24 /* round(0.38059 * 64) */ | 1186 #define VGH 24 /* round(0.38059 * 64) */ |
1191 #define VRH -82 /* round(-1.28033 * 64) */ | 1187 #define VRH -82 /* round(-1.28033 * 64) */ |
1192 | 1188 |
1193 // Bias values to round, and subtract 128 from U and V. | 1189 // Bias values to round, and subtract 128 from U and V. |
1194 #define BBH (UBH * 128 + YGBH) | 1190 #define BBH (UBH * 128 + YGBH) |
1195 #define BGH (UGH * 128 + VGH * 128 + YGBH) | 1191 #define BGH (UGH * 128 + VGH * 128 + YGBH) |
1196 #define BRH (VRH * 128 + YGBH) | 1192 #define BRH (VRH * 128 + YGBH) |
1197 | 1193 |
1198 #if defined(__arm__) || defined(__aarch64__) | |
1199 // BT.709 constants for YUV to RGB. | 1194 // BT.709 constants for YUV to RGB. |
1200 YuvConstants SIMD_ALIGNED(kYuvHConstants) = { | 1195 #if defined(__aarch64__) |
| 1196 const YuvConstants SIMD_ALIGNED(kYuvHConstants) = { |
| 1197 { -UBH, 0, -UBH, 0, -UBH, 0, -UBH, 0, -VRH, 0, -VRH, 0, -VRH, 0, -VRH, 0 }, |
| 1198 { UGH, 0, UGH, 0, UGH, 0, UGH, 0, VGH, 0, VGH, 0, VGH, 0, VGH, 0 }, |
| 1199 { BBH, BGH, BRH, 0, 0, 0, 0, 0 }, |
| 1200 { 0x0101 * YGH, 0, 0, 0 } |
| 1201 }; |
| 1202 |
| 1203 #elif defined(__arm__) |
| 1204 const YuvConstants SIMD_ALIGNED(kYuvHConstants) = { |
1201 { -UBH, -UBH, -UBH, -UBH, -VRH, -VRH, -VRH, -VRH, 0, 0, 0, 0, 0, 0, 0, 0 }, | 1205 { -UBH, -UBH, -UBH, -UBH, -VRH, -VRH, -VRH, -VRH, 0, 0, 0, 0, 0, 0, 0, 0 }, |
1202 { UGH, UGH, UGH, UGH, VGH, VGH, VGH, VGH, 0, 0, 0, 0, 0, 0, 0, 0 }, | 1206 { UGH, UGH, UGH, UGH, VGH, VGH, VGH, VGH, 0, 0, 0, 0, 0, 0, 0, 0 }, |
1203 { BBH, BGH, BRH, 0, 0, 0, 0, 0 }, | 1207 { BBH, BGH, BRH, 0, 0, 0, 0, 0 }, |
1204 { 0x0101 * YGH, 0, 0, 0 } | 1208 { 0x0101 * YGH, 0, 0, 0 } |
1205 }; | 1209 }; |
1206 #else | 1210 #else |
1207 // BT.709 constants for YUV to RGB. | 1211 const YuvConstants SIMD_ALIGNED(kYuvHConstants) = { |
1208 YuvConstants SIMD_ALIGNED(kYuvHConstants) = { | |
1209 { UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, | 1212 { UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, |
1210 UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0 }, | 1213 UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0 }, |
1211 { UGH, VGH, UGH, VGH, UGH, VGH, UGH, VGH, | 1214 { UGH, VGH, UGH, VGH, UGH, VGH, UGH, VGH, |
1212 UGH, VGH, UGH, VGH, UGH, VGH, UGH, VGH, | 1215 UGH, VGH, UGH, VGH, UGH, VGH, UGH, VGH, |
1213 UGH, VGH, UGH, VGH, UGH, VGH, UGH, VGH, | 1216 UGH, VGH, UGH, VGH, UGH, VGH, UGH, VGH, |
1214 UGH, VGH, UGH, VGH, UGH, VGH, UGH, VGH }, | 1217 UGH, VGH, UGH, VGH, UGH, VGH, UGH, VGH }, |
1215 { 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, | 1218 { 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, |
1216 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH }, | 1219 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH }, |
1217 { BBH, BBH, BBH, BBH, BBH, BBH, BBH, BBH, | 1220 { BBH, BBH, BBH, BBH, BBH, BBH, BBH, BBH, |
1218 BBH, BBH, BBH, BBH, BBH, BBH, BBH, BBH }, | 1221 BBH, BBH, BBH, BBH, BBH, BBH, BBH, BBH }, |
(...skipping 17 matching lines...) Expand all Loading... |
1236 #undef BRH | 1239 #undef BRH |
1237 | 1240 |
1238 #if !defined(LIBYUV_DISABLE_NEON) && \ | 1241 #if !defined(LIBYUV_DISABLE_NEON) && \ |
1239 (defined(__ARM_NEON__) || defined(__aarch64__) || defined(LIBYUV_NEON)) | 1242 (defined(__ARM_NEON__) || defined(__aarch64__) || defined(LIBYUV_NEON)) |
1240 // C mimic assembly. | 1243 // C mimic assembly. |
1241 // TODO(fbarchard): Remove subsampling from Neon. | 1244 // TODO(fbarchard): Remove subsampling from Neon. |
1242 void I444ToARGBRow_C(const uint8* src_y, | 1245 void I444ToARGBRow_C(const uint8* src_y, |
1243 const uint8* src_u, | 1246 const uint8* src_u, |
1244 const uint8* src_v, | 1247 const uint8* src_v, |
1245 uint8* rgb_buf, | 1248 uint8* rgb_buf, |
1246 struct YuvConstants* yuvconstants, | 1249 const struct YuvConstants* yuvconstants, |
1247 int width) { | 1250 int width) { |
1248 int x; | 1251 int x; |
1249 for (x = 0; x < width - 1; x += 2) { | 1252 for (x = 0; x < width - 1; x += 2) { |
1250 uint8 u = (src_u[0] + src_u[1] + 1) >> 1; | 1253 uint8 u = (src_u[0] + src_u[1] + 1) >> 1; |
1251 uint8 v = (src_v[0] + src_v[1] + 1) >> 1; | 1254 uint8 v = (src_v[0] + src_v[1] + 1) >> 1; |
1252 YuvPixel(src_y[0], u, v, rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, | 1255 YuvPixel(src_y[0], u, v, rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, |
1253 yuvconstants); | 1256 yuvconstants); |
1254 rgb_buf[3] = 255; | 1257 rgb_buf[3] = 255; |
1255 YuvPixel(src_y[1], u, v, rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, | 1258 YuvPixel(src_y[1], u, v, rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, |
1256 yuvconstants); | 1259 yuvconstants); |
1257 rgb_buf[7] = 255; | 1260 rgb_buf[7] = 255; |
1258 src_y += 2; | 1261 src_y += 2; |
1259 src_u += 2; | 1262 src_u += 2; |
1260 src_v += 2; | 1263 src_v += 2; |
1261 rgb_buf += 8; // Advance 2 pixels. | 1264 rgb_buf += 8; // Advance 2 pixels. |
1262 } | 1265 } |
1263 if (width & 1) { | 1266 if (width & 1) { |
1264 YuvPixel(src_y[0], src_u[0], src_v[0], | 1267 YuvPixel(src_y[0], src_u[0], src_v[0], |
1265 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1268 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1266 } | 1269 } |
1267 } | 1270 } |
1268 | 1271 |
1269 void I444ToABGRRow_C(const uint8* src_y, | 1272 void I444ToABGRRow_C(const uint8* src_y, |
1270 const uint8* src_u, | 1273 const uint8* src_u, |
1271 const uint8* src_v, | 1274 const uint8* src_v, |
1272 uint8* rgb_buf, | 1275 uint8* rgb_buf, |
1273 struct YuvConstants* yuvconstants, | 1276 const struct YuvConstants* yuvconstants, |
1274 int width) { | 1277 int width) { |
1275 int x; | 1278 int x; |
1276 for (x = 0; x < width - 1; x += 2) { | 1279 for (x = 0; x < width - 1; x += 2) { |
1277 uint8 u = (src_u[0] + src_u[1] + 1) >> 1; | 1280 uint8 u = (src_u[0] + src_u[1] + 1) >> 1; |
1278 uint8 v = (src_v[0] + src_v[1] + 1) >> 1; | 1281 uint8 v = (src_v[0] + src_v[1] + 1) >> 1; |
1279 YuvPixel(src_y[0], u, v, rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, | 1282 YuvPixel(src_y[0], u, v, rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, |
1280 yuvconstants); | 1283 yuvconstants); |
1281 rgb_buf[3] = 255; | 1284 rgb_buf[3] = 255; |
1282 YuvPixel(src_y[1], u, v, rgb_buf + 6, rgb_buf + 5, rgb_buf + 4, | 1285 YuvPixel(src_y[1], u, v, rgb_buf + 6, rgb_buf + 5, rgb_buf + 4, |
1283 yuvconstants); | 1286 yuvconstants); |
1284 rgb_buf[7] = 255; | 1287 rgb_buf[7] = 255; |
1285 src_y += 2; | 1288 src_y += 2; |
1286 src_u += 2; | 1289 src_u += 2; |
1287 src_v += 2; | 1290 src_v += 2; |
1288 rgb_buf += 8; // Advance 2 pixels. | 1291 rgb_buf += 8; // Advance 2 pixels. |
1289 } | 1292 } |
1290 if (width & 1) { | 1293 if (width & 1) { |
1291 YuvPixel(src_y[0], src_u[0], src_v[0], | 1294 YuvPixel(src_y[0], src_u[0], src_v[0], |
1292 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); | 1295 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); |
1293 } | 1296 } |
1294 } | 1297 } |
1295 #else | 1298 #else |
1296 void I444ToARGBRow_C(const uint8* src_y, | 1299 void I444ToARGBRow_C(const uint8* src_y, |
1297 const uint8* src_u, | 1300 const uint8* src_u, |
1298 const uint8* src_v, | 1301 const uint8* src_v, |
1299 uint8* rgb_buf, | 1302 uint8* rgb_buf, |
1300 struct YuvConstants* yuvconstants, | 1303 const struct YuvConstants* yuvconstants, |
1301 int width) { | 1304 int width) { |
1302 int x; | 1305 int x; |
1303 for (x = 0; x < width; ++x) { | 1306 for (x = 0; x < width; ++x) { |
1304 YuvPixel(src_y[0], src_u[0], src_v[0], | 1307 YuvPixel(src_y[0], src_u[0], src_v[0], |
1305 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1308 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1306 rgb_buf[3] = 255; | 1309 rgb_buf[3] = 255; |
1307 src_y += 1; | 1310 src_y += 1; |
1308 src_u += 1; | 1311 src_u += 1; |
1309 src_v += 1; | 1312 src_v += 1; |
1310 rgb_buf += 4; // Advance 1 pixel. | 1313 rgb_buf += 4; // Advance 1 pixel. |
1311 } | 1314 } |
1312 } | 1315 } |
1313 | 1316 |
1314 void I444ToABGRRow_C(const uint8* src_y, | 1317 void I444ToABGRRow_C(const uint8* src_y, |
1315 const uint8* src_u, | 1318 const uint8* src_u, |
1316 const uint8* src_v, | 1319 const uint8* src_v, |
1317 uint8* rgb_buf, | 1320 uint8* rgb_buf, |
1318 struct YuvConstants* yuvconstants, | 1321 const struct YuvConstants* yuvconstants, |
1319 int width) { | 1322 int width) { |
1320 int x; | 1323 int x; |
1321 for (x = 0; x < width; ++x) { | 1324 for (x = 0; x < width; ++x) { |
1322 YuvPixel(src_y[0], src_u[0], src_v[0], | 1325 YuvPixel(src_y[0], src_u[0], src_v[0], |
1323 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); | 1326 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); |
1324 rgb_buf[3] = 255; | 1327 rgb_buf[3] = 255; |
1325 src_y += 1; | 1328 src_y += 1; |
1326 src_u += 1; | 1329 src_u += 1; |
1327 src_v += 1; | 1330 src_v += 1; |
1328 rgb_buf += 4; // Advance 1 pixel. | 1331 rgb_buf += 4; // Advance 1 pixel. |
1329 } | 1332 } |
1330 } | 1333 } |
1331 #endif | 1334 #endif |
1332 | 1335 |
1333 // Also used for 420 | 1336 // Also used for 420 |
1334 void I422ToARGBRow_C(const uint8* src_y, | 1337 void I422ToARGBRow_C(const uint8* src_y, |
1335 const uint8* src_u, | 1338 const uint8* src_u, |
1336 const uint8* src_v, | 1339 const uint8* src_v, |
1337 uint8* rgb_buf, | 1340 uint8* rgb_buf, |
1338 struct YuvConstants* yuvconstants, | 1341 const struct YuvConstants* yuvconstants, |
1339 int width) { | 1342 int width) { |
1340 int x; | 1343 int x; |
1341 for (x = 0; x < width - 1; x += 2) { | 1344 for (x = 0; x < width - 1; x += 2) { |
1342 YuvPixel(src_y[0], src_u[0], src_v[0], | 1345 YuvPixel(src_y[0], src_u[0], src_v[0], |
1343 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1346 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1344 rgb_buf[3] = 255; | 1347 rgb_buf[3] = 255; |
1345 YuvPixel(src_y[1], src_u[0], src_v[0], | 1348 YuvPixel(src_y[1], src_u[0], src_v[0], |
1346 rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, yuvconstants); | 1349 rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, yuvconstants); |
1347 rgb_buf[7] = 255; | 1350 rgb_buf[7] = 255; |
1348 src_y += 2; | 1351 src_y += 2; |
1349 src_u += 1; | 1352 src_u += 1; |
1350 src_v += 1; | 1353 src_v += 1; |
1351 rgb_buf += 8; // Advance 2 pixels. | 1354 rgb_buf += 8; // Advance 2 pixels. |
1352 } | 1355 } |
1353 if (width & 1) { | 1356 if (width & 1) { |
1354 YuvPixel(src_y[0], src_u[0], src_v[0], | 1357 YuvPixel(src_y[0], src_u[0], src_v[0], |
1355 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1358 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1356 rgb_buf[3] = 255; | 1359 rgb_buf[3] = 255; |
1357 } | 1360 } |
1358 } | 1361 } |
1359 | 1362 |
1360 void I422AlphaToARGBRow_C(const uint8* src_y, | 1363 void I422AlphaToARGBRow_C(const uint8* src_y, |
1361 const uint8* src_u, | 1364 const uint8* src_u, |
1362 const uint8* src_v, | 1365 const uint8* src_v, |
1363 const uint8* src_a, | 1366 const uint8* src_a, |
1364 uint8* rgb_buf, | 1367 uint8* rgb_buf, |
1365 struct YuvConstants* yuvconstants, | 1368 const struct YuvConstants* yuvconstants, |
1366 int width) { | 1369 int width) { |
1367 int x; | 1370 int x; |
1368 for (x = 0; x < width - 1; x += 2) { | 1371 for (x = 0; x < width - 1; x += 2) { |
1369 YuvPixel(src_y[0], src_u[0], src_v[0], | 1372 YuvPixel(src_y[0], src_u[0], src_v[0], |
1370 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1373 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1371 rgb_buf[3] = src_a[0]; | 1374 rgb_buf[3] = src_a[0]; |
1372 YuvPixel(src_y[1], src_u[0], src_v[0], | 1375 YuvPixel(src_y[1], src_u[0], src_v[0], |
1373 rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, yuvconstants); | 1376 rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, yuvconstants); |
1374 rgb_buf[7] = src_a[1]; | 1377 rgb_buf[7] = src_a[1]; |
1375 src_y += 2; | 1378 src_y += 2; |
1376 src_u += 1; | 1379 src_u += 1; |
1377 src_v += 1; | 1380 src_v += 1; |
1378 src_a += 2; | 1381 src_a += 2; |
1379 rgb_buf += 8; // Advance 2 pixels. | 1382 rgb_buf += 8; // Advance 2 pixels. |
1380 } | 1383 } |
1381 if (width & 1) { | 1384 if (width & 1) { |
1382 YuvPixel(src_y[0], src_u[0], src_v[0], | 1385 YuvPixel(src_y[0], src_u[0], src_v[0], |
1383 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1386 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1384 rgb_buf[3] = src_a[0]; | 1387 rgb_buf[3] = src_a[0]; |
1385 } | 1388 } |
1386 } | 1389 } |
1387 | 1390 |
1388 void I422ToABGRRow_C(const uint8* src_y, | 1391 void I422ToABGRRow_C(const uint8* src_y, |
1389 const uint8* src_u, | 1392 const uint8* src_u, |
1390 const uint8* src_v, | 1393 const uint8* src_v, |
1391 uint8* rgb_buf, | 1394 uint8* rgb_buf, |
1392 struct YuvConstants* yuvconstants, | 1395 const struct YuvConstants* yuvconstants, |
1393 int width) { | 1396 int width) { |
1394 int x; | 1397 int x; |
1395 for (x = 0; x < width - 1; x += 2) { | 1398 for (x = 0; x < width - 1; x += 2) { |
1396 YuvPixel(src_y[0], src_u[0], src_v[0], | 1399 YuvPixel(src_y[0], src_u[0], src_v[0], |
1397 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); | 1400 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); |
1398 rgb_buf[3] = 255; | 1401 rgb_buf[3] = 255; |
1399 YuvPixel(src_y[1], src_u[0], src_v[0], | 1402 YuvPixel(src_y[1], src_u[0], src_v[0], |
1400 rgb_buf + 6, rgb_buf + 5, rgb_buf + 4, yuvconstants); | 1403 rgb_buf + 6, rgb_buf + 5, rgb_buf + 4, yuvconstants); |
1401 rgb_buf[7] = 255; | 1404 rgb_buf[7] = 255; |
1402 src_y += 2; | 1405 src_y += 2; |
1403 src_u += 1; | 1406 src_u += 1; |
1404 src_v += 1; | 1407 src_v += 1; |
1405 rgb_buf += 8; // Advance 2 pixels. | 1408 rgb_buf += 8; // Advance 2 pixels. |
1406 } | 1409 } |
1407 if (width & 1) { | 1410 if (width & 1) { |
1408 YuvPixel(src_y[0], src_u[0], src_v[0], | 1411 YuvPixel(src_y[0], src_u[0], src_v[0], |
1409 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); | 1412 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); |
1410 rgb_buf[3] = 255; | 1413 rgb_buf[3] = 255; |
1411 } | 1414 } |
1412 } | 1415 } |
1413 | 1416 |
1414 void I422AlphaToABGRRow_C(const uint8* src_y, | 1417 void I422AlphaToABGRRow_C(const uint8* src_y, |
1415 const uint8* src_u, | 1418 const uint8* src_u, |
1416 const uint8* src_v, | 1419 const uint8* src_v, |
1417 const uint8* src_a, | 1420 const uint8* src_a, |
1418 uint8* rgb_buf, | 1421 uint8* rgb_buf, |
1419 struct YuvConstants* yuvconstants, | 1422 const struct YuvConstants* yuvconstants, |
1420 int width) { | 1423 int width) { |
1421 int x; | 1424 int x; |
1422 for (x = 0; x < width - 1; x += 2) { | 1425 for (x = 0; x < width - 1; x += 2) { |
1423 YuvPixel(src_y[0], src_u[0], src_v[0], | 1426 YuvPixel(src_y[0], src_u[0], src_v[0], |
1424 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); | 1427 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); |
1425 rgb_buf[3] = src_a[0]; | 1428 rgb_buf[3] = src_a[0]; |
1426 YuvPixel(src_y[1], src_u[0], src_v[0], | 1429 YuvPixel(src_y[1], src_u[0], src_v[0], |
1427 rgb_buf + 6, rgb_buf + 5, rgb_buf + 4, yuvconstants); | 1430 rgb_buf + 6, rgb_buf + 5, rgb_buf + 4, yuvconstants); |
1428 rgb_buf[7] = src_a[1]; | 1431 rgb_buf[7] = src_a[1]; |
1429 src_y += 2; | 1432 src_y += 2; |
1430 src_u += 1; | 1433 src_u += 1; |
1431 src_v += 1; | 1434 src_v += 1; |
1432 src_a += 2; | 1435 src_a += 2; |
1433 rgb_buf += 8; // Advance 2 pixels. | 1436 rgb_buf += 8; // Advance 2 pixels. |
1434 } | 1437 } |
1435 if (width & 1) { | 1438 if (width & 1) { |
1436 YuvPixel(src_y[0], src_u[0], src_v[0], | 1439 YuvPixel(src_y[0], src_u[0], src_v[0], |
1437 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); | 1440 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); |
1438 rgb_buf[3] = src_a[0]; | 1441 rgb_buf[3] = src_a[0]; |
1439 } | 1442 } |
1440 } | 1443 } |
1441 | 1444 |
1442 void I422ToRGB24Row_C(const uint8* src_y, | 1445 void I422ToRGB24Row_C(const uint8* src_y, |
1443 const uint8* src_u, | 1446 const uint8* src_u, |
1444 const uint8* src_v, | 1447 const uint8* src_v, |
1445 uint8* rgb_buf, | 1448 uint8* rgb_buf, |
1446 struct YuvConstants* yuvconstants, | 1449 const struct YuvConstants* yuvconstants, |
1447 int width) { | 1450 int width) { |
1448 int x; | 1451 int x; |
1449 for (x = 0; x < width - 1; x += 2) { | 1452 for (x = 0; x < width - 1; x += 2) { |
1450 YuvPixel(src_y[0], src_u[0], src_v[0], | 1453 YuvPixel(src_y[0], src_u[0], src_v[0], |
1451 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1454 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1452 YuvPixel(src_y[1], src_u[0], src_v[0], | 1455 YuvPixel(src_y[1], src_u[0], src_v[0], |
1453 rgb_buf + 3, rgb_buf + 4, rgb_buf + 5, yuvconstants); | 1456 rgb_buf + 3, rgb_buf + 4, rgb_buf + 5, yuvconstants); |
1454 src_y += 2; | 1457 src_y += 2; |
1455 src_u += 1; | 1458 src_u += 1; |
1456 src_v += 1; | 1459 src_v += 1; |
1457 rgb_buf += 6; // Advance 2 pixels. | 1460 rgb_buf += 6; // Advance 2 pixels. |
1458 } | 1461 } |
1459 if (width & 1) { | 1462 if (width & 1) { |
1460 YuvPixel(src_y[0], src_u[0], src_v[0], | 1463 YuvPixel(src_y[0], src_u[0], src_v[0], |
1461 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1464 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1462 } | 1465 } |
1463 } | 1466 } |
1464 | 1467 |
1465 void I422ToRAWRow_C(const uint8* src_y, | 1468 void I422ToRAWRow_C(const uint8* src_y, |
1466 const uint8* src_u, | 1469 const uint8* src_u, |
1467 const uint8* src_v, | 1470 const uint8* src_v, |
1468 uint8* rgb_buf, | 1471 uint8* rgb_buf, |
1469 struct YuvConstants* yuvconstants, | 1472 const struct YuvConstants* yuvconstants, |
1470 int width) { | 1473 int width) { |
1471 int x; | 1474 int x; |
1472 for (x = 0; x < width - 1; x += 2) { | 1475 for (x = 0; x < width - 1; x += 2) { |
1473 YuvPixel(src_y[0], src_u[0], src_v[0], | 1476 YuvPixel(src_y[0], src_u[0], src_v[0], |
1474 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); | 1477 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); |
1475 YuvPixel(src_y[1], src_u[0], src_v[0], | 1478 YuvPixel(src_y[1], src_u[0], src_v[0], |
1476 rgb_buf + 5, rgb_buf + 4, rgb_buf + 3, yuvconstants); | 1479 rgb_buf + 5, rgb_buf + 4, rgb_buf + 3, yuvconstants); |
1477 src_y += 2; | 1480 src_y += 2; |
1478 src_u += 1; | 1481 src_u += 1; |
1479 src_v += 1; | 1482 src_v += 1; |
1480 rgb_buf += 6; // Advance 2 pixels. | 1483 rgb_buf += 6; // Advance 2 pixels. |
1481 } | 1484 } |
1482 if (width & 1) { | 1485 if (width & 1) { |
1483 YuvPixel(src_y[0], src_u[0], src_v[0], | 1486 YuvPixel(src_y[0], src_u[0], src_v[0], |
1484 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); | 1487 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); |
1485 } | 1488 } |
1486 } | 1489 } |
1487 | 1490 |
1488 void I422ToARGB4444Row_C(const uint8* src_y, | 1491 void I422ToARGB4444Row_C(const uint8* src_y, |
1489 const uint8* src_u, | 1492 const uint8* src_u, |
1490 const uint8* src_v, | 1493 const uint8* src_v, |
1491 uint8* dst_argb4444, | 1494 uint8* dst_argb4444, |
1492 struct YuvConstants* yuvconstants, | 1495 const struct YuvConstants* yuvconstants, |
1493 int width) { | 1496 int width) { |
1494 uint8 b0; | 1497 uint8 b0; |
1495 uint8 g0; | 1498 uint8 g0; |
1496 uint8 r0; | 1499 uint8 r0; |
1497 uint8 b1; | 1500 uint8 b1; |
1498 uint8 g1; | 1501 uint8 g1; |
1499 uint8 r1; | 1502 uint8 r1; |
1500 int x; | 1503 int x; |
1501 for (x = 0; x < width - 1; x += 2) { | 1504 for (x = 0; x < width - 1; x += 2) { |
1502 YuvPixel(src_y[0], src_u[0], src_v[0], &b0, &g0, &r0, yuvconstants); | 1505 YuvPixel(src_y[0], src_u[0], src_v[0], &b0, &g0, &r0, yuvconstants); |
(...skipping 18 matching lines...) Expand all Loading... |
1521 r0 = r0 >> 4; | 1524 r0 = r0 >> 4; |
1522 *(uint16*)(dst_argb4444) = b0 | (g0 << 4) | (r0 << 8) | | 1525 *(uint16*)(dst_argb4444) = b0 | (g0 << 4) | (r0 << 8) | |
1523 0xf000; | 1526 0xf000; |
1524 } | 1527 } |
1525 } | 1528 } |
1526 | 1529 |
1527 void I422ToARGB1555Row_C(const uint8* src_y, | 1530 void I422ToARGB1555Row_C(const uint8* src_y, |
1528 const uint8* src_u, | 1531 const uint8* src_u, |
1529 const uint8* src_v, | 1532 const uint8* src_v, |
1530 uint8* dst_argb1555, | 1533 uint8* dst_argb1555, |
1531 struct YuvConstants* yuvconstants, | 1534 const struct YuvConstants* yuvconstants, |
1532 int width) { | 1535 int width) { |
1533 uint8 b0; | 1536 uint8 b0; |
1534 uint8 g0; | 1537 uint8 g0; |
1535 uint8 r0; | 1538 uint8 r0; |
1536 uint8 b1; | 1539 uint8 b1; |
1537 uint8 g1; | 1540 uint8 g1; |
1538 uint8 r1; | 1541 uint8 r1; |
1539 int x; | 1542 int x; |
1540 for (x = 0; x < width - 1; x += 2) { | 1543 for (x = 0; x < width - 1; x += 2) { |
1541 YuvPixel(src_y[0], src_u[0], src_v[0], &b0, &g0, &r0, yuvconstants); | 1544 YuvPixel(src_y[0], src_u[0], src_v[0], &b0, &g0, &r0, yuvconstants); |
(...skipping 18 matching lines...) Expand all Loading... |
1560 r0 = r0 >> 3; | 1563 r0 = r0 >> 3; |
1561 *(uint16*)(dst_argb1555) = b0 | (g0 << 5) | (r0 << 10) | | 1564 *(uint16*)(dst_argb1555) = b0 | (g0 << 5) | (r0 << 10) | |
1562 0x8000; | 1565 0x8000; |
1563 } | 1566 } |
1564 } | 1567 } |
1565 | 1568 |
1566 void I422ToRGB565Row_C(const uint8* src_y, | 1569 void I422ToRGB565Row_C(const uint8* src_y, |
1567 const uint8* src_u, | 1570 const uint8* src_u, |
1568 const uint8* src_v, | 1571 const uint8* src_v, |
1569 uint8* dst_rgb565, | 1572 uint8* dst_rgb565, |
1570 struct YuvConstants* yuvconstants, | 1573 const struct YuvConstants* yuvconstants, |
1571 int width) { | 1574 int width) { |
1572 uint8 b0; | 1575 uint8 b0; |
1573 uint8 g0; | 1576 uint8 g0; |
1574 uint8 r0; | 1577 uint8 r0; |
1575 uint8 b1; | 1578 uint8 b1; |
1576 uint8 g1; | 1579 uint8 g1; |
1577 uint8 r1; | 1580 uint8 r1; |
1578 int x; | 1581 int x; |
1579 for (x = 0; x < width - 1; x += 2) { | 1582 for (x = 0; x < width - 1; x += 2) { |
1580 YuvPixel(src_y[0], src_u[0], src_v[0], &b0, &g0, &r0, yuvconstants); | 1583 YuvPixel(src_y[0], src_u[0], src_v[0], &b0, &g0, &r0, yuvconstants); |
(...skipping 17 matching lines...) Expand all Loading... |
1598 g0 = g0 >> 2; | 1601 g0 = g0 >> 2; |
1599 r0 = r0 >> 3; | 1602 r0 = r0 >> 3; |
1600 *(uint16*)(dst_rgb565) = b0 | (g0 << 5) | (r0 << 11); | 1603 *(uint16*)(dst_rgb565) = b0 | (g0 << 5) | (r0 << 11); |
1601 } | 1604 } |
1602 } | 1605 } |
1603 | 1606 |
1604 void I411ToARGBRow_C(const uint8* src_y, | 1607 void I411ToARGBRow_C(const uint8* src_y, |
1605 const uint8* src_u, | 1608 const uint8* src_u, |
1606 const uint8* src_v, | 1609 const uint8* src_v, |
1607 uint8* rgb_buf, | 1610 uint8* rgb_buf, |
1608 struct YuvConstants* yuvconstants, | 1611 const struct YuvConstants* yuvconstants, |
1609 int width) { | 1612 int width) { |
1610 int x; | 1613 int x; |
1611 for (x = 0; x < width - 3; x += 4) { | 1614 for (x = 0; x < width - 3; x += 4) { |
1612 YuvPixel(src_y[0], src_u[0], src_v[0], | 1615 YuvPixel(src_y[0], src_u[0], src_v[0], |
1613 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1616 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1614 rgb_buf[3] = 255; | 1617 rgb_buf[3] = 255; |
1615 YuvPixel(src_y[1], src_u[0], src_v[0], | 1618 YuvPixel(src_y[1], src_u[0], src_v[0], |
1616 rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, yuvconstants); | 1619 rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, yuvconstants); |
1617 rgb_buf[7] = 255; | 1620 rgb_buf[7] = 255; |
1618 YuvPixel(src_y[2], src_u[0], src_v[0], | 1621 YuvPixel(src_y[2], src_u[0], src_v[0], |
(...skipping 20 matching lines...) Expand all Loading... |
1639 if (width & 1) { | 1642 if (width & 1) { |
1640 YuvPixel(src_y[0], src_u[0], src_v[0], | 1643 YuvPixel(src_y[0], src_u[0], src_v[0], |
1641 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1644 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1642 rgb_buf[3] = 255; | 1645 rgb_buf[3] = 255; |
1643 } | 1646 } |
1644 } | 1647 } |
1645 | 1648 |
1646 void NV12ToARGBRow_C(const uint8* src_y, | 1649 void NV12ToARGBRow_C(const uint8* src_y, |
1647 const uint8* src_uv, | 1650 const uint8* src_uv, |
1648 uint8* rgb_buf, | 1651 uint8* rgb_buf, |
1649 struct YuvConstants* yuvconstants, | 1652 const struct YuvConstants* yuvconstants, |
1650 int width) { | 1653 int width) { |
1651 int x; | 1654 int x; |
1652 for (x = 0; x < width - 1; x += 2) { | 1655 for (x = 0; x < width - 1; x += 2) { |
1653 YuvPixel(src_y[0], src_uv[0], src_uv[1], | 1656 YuvPixel(src_y[0], src_uv[0], src_uv[1], |
1654 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1657 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1655 rgb_buf[3] = 255; | 1658 rgb_buf[3] = 255; |
1656 YuvPixel(src_y[1], src_uv[0], src_uv[1], | 1659 YuvPixel(src_y[1], src_uv[0], src_uv[1], |
1657 rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, yuvconstants); | 1660 rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, yuvconstants); |
1658 rgb_buf[7] = 255; | 1661 rgb_buf[7] = 255; |
1659 src_y += 2; | 1662 src_y += 2; |
1660 src_uv += 2; | 1663 src_uv += 2; |
1661 rgb_buf += 8; // Advance 2 pixels. | 1664 rgb_buf += 8; // Advance 2 pixels. |
1662 } | 1665 } |
1663 if (width & 1) { | 1666 if (width & 1) { |
1664 YuvPixel(src_y[0], src_uv[0], src_uv[1], | 1667 YuvPixel(src_y[0], src_uv[0], src_uv[1], |
1665 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1668 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1666 rgb_buf[3] = 255; | 1669 rgb_buf[3] = 255; |
1667 } | 1670 } |
1668 } | 1671 } |
1669 | 1672 |
1670 void NV21ToARGBRow_C(const uint8* src_y, | 1673 void NV21ToARGBRow_C(const uint8* src_y, |
1671 const uint8* src_vu, | 1674 const uint8* src_vu, |
1672 uint8* rgb_buf, | 1675 uint8* rgb_buf, |
1673 struct YuvConstants* yuvconstants, | 1676 const struct YuvConstants* yuvconstants, |
1674 int width) { | 1677 int width) { |
1675 int x; | 1678 int x; |
1676 for (x = 0; x < width - 1; x += 2) { | 1679 for (x = 0; x < width - 1; x += 2) { |
1677 YuvPixel(src_y[0], src_vu[1], src_vu[0], | 1680 YuvPixel(src_y[0], src_vu[1], src_vu[0], |
1678 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1681 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1679 rgb_buf[3] = 255; | 1682 rgb_buf[3] = 255; |
1680 YuvPixel(src_y[1], src_vu[1], src_vu[0], | 1683 YuvPixel(src_y[1], src_vu[1], src_vu[0], |
1681 rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, yuvconstants); | 1684 rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, yuvconstants); |
1682 rgb_buf[7] = 255; | 1685 rgb_buf[7] = 255; |
1683 src_y += 2; | 1686 src_y += 2; |
1684 src_vu += 2; | 1687 src_vu += 2; |
1685 rgb_buf += 8; // Advance 2 pixels. | 1688 rgb_buf += 8; // Advance 2 pixels. |
1686 } | 1689 } |
1687 if (width & 1) { | 1690 if (width & 1) { |
1688 YuvPixel(src_y[0], src_vu[1], src_vu[0], | 1691 YuvPixel(src_y[0], src_vu[1], src_vu[0], |
1689 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1692 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1690 rgb_buf[3] = 255; | 1693 rgb_buf[3] = 255; |
1691 } | 1694 } |
1692 } | 1695 } |
1693 | 1696 |
1694 void NV12ToRGB565Row_C(const uint8* src_y, | 1697 void NV12ToRGB565Row_C(const uint8* src_y, |
1695 const uint8* src_uv, | 1698 const uint8* src_uv, |
1696 uint8* dst_rgb565, | 1699 uint8* dst_rgb565, |
1697 struct YuvConstants* yuvconstants, | 1700 const struct YuvConstants* yuvconstants, |
1698 int width) { | 1701 int width) { |
1699 uint8 b0; | 1702 uint8 b0; |
1700 uint8 g0; | 1703 uint8 g0; |
1701 uint8 r0; | 1704 uint8 r0; |
1702 uint8 b1; | 1705 uint8 b1; |
1703 uint8 g1; | 1706 uint8 g1; |
1704 uint8 r1; | 1707 uint8 r1; |
1705 int x; | 1708 int x; |
1706 for (x = 0; x < width - 1; x += 2) { | 1709 for (x = 0; x < width - 1; x += 2) { |
1707 YuvPixel(src_y[0], src_uv[0], src_uv[1], &b0, &g0, &r0, yuvconstants); | 1710 YuvPixel(src_y[0], src_uv[0], src_uv[1], &b0, &g0, &r0, yuvconstants); |
(...skipping 14 matching lines...) Expand all Loading... |
1722 YuvPixel(src_y[0], src_uv[0], src_uv[1], &b0, &g0, &r0, yuvconstants); | 1725 YuvPixel(src_y[0], src_uv[0], src_uv[1], &b0, &g0, &r0, yuvconstants); |
1723 b0 = b0 >> 3; | 1726 b0 = b0 >> 3; |
1724 g0 = g0 >> 2; | 1727 g0 = g0 >> 2; |
1725 r0 = r0 >> 3; | 1728 r0 = r0 >> 3; |
1726 *(uint16*)(dst_rgb565) = b0 | (g0 << 5) | (r0 << 11); | 1729 *(uint16*)(dst_rgb565) = b0 | (g0 << 5) | (r0 << 11); |
1727 } | 1730 } |
1728 } | 1731 } |
1729 | 1732 |
1730 void YUY2ToARGBRow_C(const uint8* src_yuy2, | 1733 void YUY2ToARGBRow_C(const uint8* src_yuy2, |
1731 uint8* rgb_buf, | 1734 uint8* rgb_buf, |
1732 struct YuvConstants* yuvconstants, | 1735 const struct YuvConstants* yuvconstants, |
1733 int width) { | 1736 int width) { |
1734 int x; | 1737 int x; |
1735 for (x = 0; x < width - 1; x += 2) { | 1738 for (x = 0; x < width - 1; x += 2) { |
1736 YuvPixel(src_yuy2[0], src_yuy2[1], src_yuy2[3], | 1739 YuvPixel(src_yuy2[0], src_yuy2[1], src_yuy2[3], |
1737 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1740 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1738 rgb_buf[3] = 255; | 1741 rgb_buf[3] = 255; |
1739 YuvPixel(src_yuy2[2], src_yuy2[1], src_yuy2[3], | 1742 YuvPixel(src_yuy2[2], src_yuy2[1], src_yuy2[3], |
1740 rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, yuvconstants); | 1743 rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, yuvconstants); |
1741 rgb_buf[7] = 255; | 1744 rgb_buf[7] = 255; |
1742 src_yuy2 += 4; | 1745 src_yuy2 += 4; |
1743 rgb_buf += 8; // Advance 2 pixels. | 1746 rgb_buf += 8; // Advance 2 pixels. |
1744 } | 1747 } |
1745 if (width & 1) { | 1748 if (width & 1) { |
1746 YuvPixel(src_yuy2[0], src_yuy2[1], src_yuy2[3], | 1749 YuvPixel(src_yuy2[0], src_yuy2[1], src_yuy2[3], |
1747 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1750 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1748 rgb_buf[3] = 255; | 1751 rgb_buf[3] = 255; |
1749 } | 1752 } |
1750 } | 1753 } |
1751 | 1754 |
1752 void UYVYToARGBRow_C(const uint8* src_uyvy, | 1755 void UYVYToARGBRow_C(const uint8* src_uyvy, |
1753 uint8* rgb_buf, | 1756 uint8* rgb_buf, |
1754 struct YuvConstants* yuvconstants, | 1757 const struct YuvConstants* yuvconstants, |
1755 int width) { | 1758 int width) { |
1756 int x; | 1759 int x; |
1757 for (x = 0; x < width - 1; x += 2) { | 1760 for (x = 0; x < width - 1; x += 2) { |
1758 YuvPixel(src_uyvy[1], src_uyvy[0], src_uyvy[2], | 1761 YuvPixel(src_uyvy[1], src_uyvy[0], src_uyvy[2], |
1759 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1762 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1760 rgb_buf[3] = 255; | 1763 rgb_buf[3] = 255; |
1761 YuvPixel(src_uyvy[3], src_uyvy[0], src_uyvy[2], | 1764 YuvPixel(src_uyvy[3], src_uyvy[0], src_uyvy[2], |
1762 rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, yuvconstants); | 1765 rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, yuvconstants); |
1763 rgb_buf[7] = 255; | 1766 rgb_buf[7] = 255; |
1764 src_uyvy += 4; | 1767 src_uyvy += 4; |
1765 rgb_buf += 8; // Advance 2 pixels. | 1768 rgb_buf += 8; // Advance 2 pixels. |
1766 } | 1769 } |
1767 if (width & 1) { | 1770 if (width & 1) { |
1768 YuvPixel(src_uyvy[1], src_uyvy[0], src_uyvy[2], | 1771 YuvPixel(src_uyvy[1], src_uyvy[0], src_uyvy[2], |
1769 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1772 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1770 rgb_buf[3] = 255; | 1773 rgb_buf[3] = 255; |
1771 } | 1774 } |
1772 } | 1775 } |
1773 | 1776 |
1774 void I422ToBGRARow_C(const uint8* src_y, | 1777 void I422ToBGRARow_C(const uint8* src_y, |
1775 const uint8* src_u, | 1778 const uint8* src_u, |
1776 const uint8* src_v, | 1779 const uint8* src_v, |
1777 uint8* rgb_buf, | 1780 uint8* rgb_buf, |
1778 struct YuvConstants* yuvconstants, | 1781 const struct YuvConstants* yuvconstants, |
1779 int width) { | 1782 int width) { |
1780 int x; | 1783 int x; |
1781 for (x = 0; x < width - 1; x += 2) { | 1784 for (x = 0; x < width - 1; x += 2) { |
1782 YuvPixel(src_y[0], src_u[0], src_v[0], | 1785 YuvPixel(src_y[0], src_u[0], src_v[0], |
1783 rgb_buf + 3, rgb_buf + 2, rgb_buf + 1, yuvconstants); | 1786 rgb_buf + 3, rgb_buf + 2, rgb_buf + 1, yuvconstants); |
1784 rgb_buf[0] = 255; | 1787 rgb_buf[0] = 255; |
1785 YuvPixel(src_y[1], src_u[0], src_v[0], | 1788 YuvPixel(src_y[1], src_u[0], src_v[0], |
1786 rgb_buf + 7, rgb_buf + 6, rgb_buf + 5, yuvconstants); | 1789 rgb_buf + 7, rgb_buf + 6, rgb_buf + 5, yuvconstants); |
1787 rgb_buf[4] = 255; | 1790 rgb_buf[4] = 255; |
1788 src_y += 2; | 1791 src_y += 2; |
1789 src_u += 1; | 1792 src_u += 1; |
1790 src_v += 1; | 1793 src_v += 1; |
1791 rgb_buf += 8; // Advance 2 pixels. | 1794 rgb_buf += 8; // Advance 2 pixels. |
1792 } | 1795 } |
1793 if (width & 1) { | 1796 if (width & 1) { |
1794 YuvPixel(src_y[0], src_u[0], src_v[0], | 1797 YuvPixel(src_y[0], src_u[0], src_v[0], |
1795 rgb_buf + 3, rgb_buf + 2, rgb_buf + 1, yuvconstants); | 1798 rgb_buf + 3, rgb_buf + 2, rgb_buf + 1, yuvconstants); |
1796 rgb_buf[0] = 255; | 1799 rgb_buf[0] = 255; |
1797 } | 1800 } |
1798 } | 1801 } |
1799 | 1802 |
1800 void I422ToRGBARow_C(const uint8* src_y, | 1803 void I422ToRGBARow_C(const uint8* src_y, |
1801 const uint8* src_u, | 1804 const uint8* src_u, |
1802 const uint8* src_v, | 1805 const uint8* src_v, |
1803 uint8* rgb_buf, | 1806 uint8* rgb_buf, |
1804 struct YuvConstants* yuvconstants, | 1807 const struct YuvConstants* yuvconstants, |
1805 int width) { | 1808 int width) { |
1806 int x; | 1809 int x; |
1807 for (x = 0; x < width - 1; x += 2) { | 1810 for (x = 0; x < width - 1; x += 2) { |
1808 YuvPixel(src_y[0], src_u[0], src_v[0], | 1811 YuvPixel(src_y[0], src_u[0], src_v[0], |
1809 rgb_buf + 1, rgb_buf + 2, rgb_buf + 3, yuvconstants); | 1812 rgb_buf + 1, rgb_buf + 2, rgb_buf + 3, yuvconstants); |
1810 rgb_buf[0] = 255; | 1813 rgb_buf[0] = 255; |
1811 YuvPixel(src_y[1], src_u[0], src_v[0], | 1814 YuvPixel(src_y[1], src_u[0], src_v[0], |
1812 rgb_buf + 5, rgb_buf + 6, rgb_buf + 7, yuvconstants); | 1815 rgb_buf + 5, rgb_buf + 6, rgb_buf + 7, yuvconstants); |
1813 rgb_buf[4] = 255; | 1816 rgb_buf[4] = 255; |
1814 src_y += 2; | 1817 src_y += 2; |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2473 // Maximum temporary width for wrappers to process at a time, in pixels. | 2476 // Maximum temporary width for wrappers to process at a time, in pixels. |
2474 #define MAXTWIDTH 2048 | 2477 #define MAXTWIDTH 2048 |
2475 | 2478 |
2476 #if !(defined(_MSC_VER) && defined(_M_IX86)) && \ | 2479 #if !(defined(_MSC_VER) && defined(_M_IX86)) && \ |
2477 defined(HAS_I422TORGB565ROW_SSSE3) | 2480 defined(HAS_I422TORGB565ROW_SSSE3) |
2478 // row_win.cc has asm version, but GCC uses 2 step wrapper. | 2481 // row_win.cc has asm version, but GCC uses 2 step wrapper. |
2479 void I422ToRGB565Row_SSSE3(const uint8* src_y, | 2482 void I422ToRGB565Row_SSSE3(const uint8* src_y, |
2480 const uint8* src_u, | 2483 const uint8* src_u, |
2481 const uint8* src_v, | 2484 const uint8* src_v, |
2482 uint8* dst_rgb565, | 2485 uint8* dst_rgb565, |
2483 struct YuvConstants* yuvconstants, | 2486 const struct YuvConstants* yuvconstants, |
2484 int width) { | 2487 int width) { |
2485 SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); | 2488 SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); |
2486 while (width > 0) { | 2489 while (width > 0) { |
2487 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; | 2490 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; |
2488 I422ToARGBRow_SSSE3(src_y, src_u, src_v, row, yuvconstants, twidth); | 2491 I422ToARGBRow_SSSE3(src_y, src_u, src_v, row, yuvconstants, twidth); |
2489 ARGBToRGB565Row_SSE2(row, dst_rgb565, twidth); | 2492 ARGBToRGB565Row_SSE2(row, dst_rgb565, twidth); |
2490 src_y += twidth; | 2493 src_y += twidth; |
2491 src_u += twidth / 2; | 2494 src_u += twidth / 2; |
2492 src_v += twidth / 2; | 2495 src_v += twidth / 2; |
2493 dst_rgb565 += twidth * 2; | 2496 dst_rgb565 += twidth * 2; |
2494 width -= twidth; | 2497 width -= twidth; |
2495 } | 2498 } |
2496 } | 2499 } |
2497 #endif | 2500 #endif |
2498 | 2501 |
2499 #if defined(HAS_I422TOARGB1555ROW_SSSE3) | 2502 #if defined(HAS_I422TOARGB1555ROW_SSSE3) |
2500 void I422ToARGB1555Row_SSSE3(const uint8* src_y, | 2503 void I422ToARGB1555Row_SSSE3(const uint8* src_y, |
2501 const uint8* src_u, | 2504 const uint8* src_u, |
2502 const uint8* src_v, | 2505 const uint8* src_v, |
2503 uint8* dst_argb1555, | 2506 uint8* dst_argb1555, |
2504 struct YuvConstants* yuvconstants, | 2507 const struct YuvConstants* yuvconstants, |
2505 int width) { | 2508 int width) { |
2506 // Row buffer for intermediate ARGB pixels. | 2509 // Row buffer for intermediate ARGB pixels. |
2507 SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); | 2510 SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); |
2508 while (width > 0) { | 2511 while (width > 0) { |
2509 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; | 2512 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; |
2510 I422ToARGBRow_SSSE3(src_y, src_u, src_v, row, yuvconstants, twidth); | 2513 I422ToARGBRow_SSSE3(src_y, src_u, src_v, row, yuvconstants, twidth); |
2511 ARGBToARGB1555Row_SSE2(row, dst_argb1555, twidth); | 2514 ARGBToARGB1555Row_SSE2(row, dst_argb1555, twidth); |
2512 src_y += twidth; | 2515 src_y += twidth; |
2513 src_u += twidth / 2; | 2516 src_u += twidth / 2; |
2514 src_v += twidth / 2; | 2517 src_v += twidth / 2; |
2515 dst_argb1555 += twidth * 2; | 2518 dst_argb1555 += twidth * 2; |
2516 width -= twidth; | 2519 width -= twidth; |
2517 } | 2520 } |
2518 } | 2521 } |
2519 #endif | 2522 #endif |
2520 | 2523 |
2521 #if defined(HAS_I422TOARGB4444ROW_SSSE3) | 2524 #if defined(HAS_I422TOARGB4444ROW_SSSE3) |
2522 void I422ToARGB4444Row_SSSE3(const uint8* src_y, | 2525 void I422ToARGB4444Row_SSSE3(const uint8* src_y, |
2523 const uint8* src_u, | 2526 const uint8* src_u, |
2524 const uint8* src_v, | 2527 const uint8* src_v, |
2525 uint8* dst_argb4444, | 2528 uint8* dst_argb4444, |
2526 struct YuvConstants* yuvconstants, | 2529 const struct YuvConstants* yuvconstants, |
2527 int width) { | 2530 int width) { |
2528 // Row buffer for intermediate ARGB pixels. | 2531 // Row buffer for intermediate ARGB pixels. |
2529 SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); | 2532 SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); |
2530 while (width > 0) { | 2533 while (width > 0) { |
2531 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; | 2534 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; |
2532 I422ToARGBRow_SSSE3(src_y, src_u, src_v, row, yuvconstants, twidth); | 2535 I422ToARGBRow_SSSE3(src_y, src_u, src_v, row, yuvconstants, twidth); |
2533 ARGBToARGB4444Row_SSE2(row, dst_argb4444, twidth); | 2536 ARGBToARGB4444Row_SSE2(row, dst_argb4444, twidth); |
2534 src_y += twidth; | 2537 src_y += twidth; |
2535 src_u += twidth / 2; | 2538 src_u += twidth / 2; |
2536 src_v += twidth / 2; | 2539 src_v += twidth / 2; |
2537 dst_argb4444 += twidth * 2; | 2540 dst_argb4444 += twidth * 2; |
2538 width -= twidth; | 2541 width -= twidth; |
2539 } | 2542 } |
2540 } | 2543 } |
2541 #endif | 2544 #endif |
2542 | 2545 |
2543 #if defined(HAS_NV12TORGB565ROW_SSSE3) | 2546 #if defined(HAS_NV12TORGB565ROW_SSSE3) |
2544 void NV12ToRGB565Row_SSSE3(const uint8* src_y, | 2547 void NV12ToRGB565Row_SSSE3(const uint8* src_y, |
2545 const uint8* src_uv, | 2548 const uint8* src_uv, |
2546 uint8* dst_rgb565, | 2549 uint8* dst_rgb565, |
2547 struct YuvConstants* yuvconstants, | 2550 const struct YuvConstants* yuvconstants, |
2548 int width) { | 2551 int width) { |
2549 // Row buffer for intermediate ARGB pixels. | 2552 // Row buffer for intermediate ARGB pixels. |
2550 SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); | 2553 SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); |
2551 while (width > 0) { | 2554 while (width > 0) { |
2552 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; | 2555 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; |
2553 NV12ToARGBRow_SSSE3(src_y, src_uv, row, yuvconstants, twidth); | 2556 NV12ToARGBRow_SSSE3(src_y, src_uv, row, yuvconstants, twidth); |
2554 ARGBToRGB565Row_SSE2(row, dst_rgb565, twidth); | 2557 ARGBToRGB565Row_SSE2(row, dst_rgb565, twidth); |
2555 src_y += twidth; | 2558 src_y += twidth; |
2556 src_uv += twidth; | 2559 src_uv += twidth; |
2557 dst_rgb565 += twidth * 2; | 2560 dst_rgb565 += twidth * 2; |
2558 width -= twidth; | 2561 width -= twidth; |
2559 } | 2562 } |
2560 } | 2563 } |
2561 #endif | 2564 #endif |
2562 | 2565 |
2563 #if defined(HAS_I422TORGB565ROW_AVX2) | 2566 #if defined(HAS_I422TORGB565ROW_AVX2) |
2564 void I422ToRGB565Row_AVX2(const uint8* src_y, | 2567 void I422ToRGB565Row_AVX2(const uint8* src_y, |
2565 const uint8* src_u, | 2568 const uint8* src_u, |
2566 const uint8* src_v, | 2569 const uint8* src_v, |
2567 uint8* dst_rgb565, | 2570 uint8* dst_rgb565, |
2568 struct YuvConstants* yuvconstants, | 2571 const struct YuvConstants* yuvconstants, |
2569 int width) { | 2572 int width) { |
2570 SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); | 2573 SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); |
2571 while (width > 0) { | 2574 while (width > 0) { |
2572 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; | 2575 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; |
2573 I422ToARGBRow_AVX2(src_y, src_u, src_v, row, yuvconstants, twidth); | 2576 I422ToARGBRow_AVX2(src_y, src_u, src_v, row, yuvconstants, twidth); |
2574 ARGBToRGB565Row_AVX2(row, dst_rgb565, twidth); | 2577 ARGBToRGB565Row_AVX2(row, dst_rgb565, twidth); |
2575 src_y += twidth; | 2578 src_y += twidth; |
2576 src_u += twidth / 2; | 2579 src_u += twidth / 2; |
2577 src_v += twidth / 2; | 2580 src_v += twidth / 2; |
2578 dst_rgb565 += twidth * 2; | 2581 dst_rgb565 += twidth * 2; |
2579 width -= twidth; | 2582 width -= twidth; |
2580 } | 2583 } |
2581 } | 2584 } |
2582 #endif | 2585 #endif |
2583 | 2586 |
2584 #if defined(HAS_I422TOARGB1555ROW_AVX2) | 2587 #if defined(HAS_I422TOARGB1555ROW_AVX2) |
2585 void I422ToARGB1555Row_AVX2(const uint8* src_y, | 2588 void I422ToARGB1555Row_AVX2(const uint8* src_y, |
2586 const uint8* src_u, | 2589 const uint8* src_u, |
2587 const uint8* src_v, | 2590 const uint8* src_v, |
2588 uint8* dst_argb1555, | 2591 uint8* dst_argb1555, |
2589 struct YuvConstants* yuvconstants, | 2592 const struct YuvConstants* yuvconstants, |
2590 int width) { | 2593 int width) { |
2591 // Row buffer for intermediate ARGB pixels. | 2594 // Row buffer for intermediate ARGB pixels. |
2592 SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); | 2595 SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); |
2593 while (width > 0) { | 2596 while (width > 0) { |
2594 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; | 2597 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; |
2595 I422ToARGBRow_AVX2(src_y, src_u, src_v, row, yuvconstants, twidth); | 2598 I422ToARGBRow_AVX2(src_y, src_u, src_v, row, yuvconstants, twidth); |
2596 ARGBToARGB1555Row_AVX2(row, dst_argb1555, twidth); | 2599 ARGBToARGB1555Row_AVX2(row, dst_argb1555, twidth); |
2597 src_y += twidth; | 2600 src_y += twidth; |
2598 src_u += twidth / 2; | 2601 src_u += twidth / 2; |
2599 src_v += twidth / 2; | 2602 src_v += twidth / 2; |
2600 dst_argb1555 += twidth * 2; | 2603 dst_argb1555 += twidth * 2; |
2601 width -= twidth; | 2604 width -= twidth; |
2602 } | 2605 } |
2603 } | 2606 } |
2604 #endif | 2607 #endif |
2605 | 2608 |
2606 #if defined(HAS_I422TOARGB4444ROW_AVX2) | 2609 #if defined(HAS_I422TOARGB4444ROW_AVX2) |
2607 void I422ToARGB4444Row_AVX2(const uint8* src_y, | 2610 void I422ToARGB4444Row_AVX2(const uint8* src_y, |
2608 const uint8* src_u, | 2611 const uint8* src_u, |
2609 const uint8* src_v, | 2612 const uint8* src_v, |
2610 uint8* dst_argb4444, | 2613 uint8* dst_argb4444, |
2611 struct YuvConstants* yuvconstants, | 2614 const struct YuvConstants* yuvconstants, |
2612 int width) { | 2615 int width) { |
2613 // Row buffer for intermediate ARGB pixels. | 2616 // Row buffer for intermediate ARGB pixels. |
2614 SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); | 2617 SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); |
2615 while (width > 0) { | 2618 while (width > 0) { |
2616 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; | 2619 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; |
2617 I422ToARGBRow_AVX2(src_y, src_u, src_v, row, yuvconstants, twidth); | 2620 I422ToARGBRow_AVX2(src_y, src_u, src_v, row, yuvconstants, twidth); |
2618 ARGBToARGB4444Row_AVX2(row, dst_argb4444, twidth); | 2621 ARGBToARGB4444Row_AVX2(row, dst_argb4444, twidth); |
2619 src_y += twidth; | 2622 src_y += twidth; |
2620 src_u += twidth / 2; | 2623 src_u += twidth / 2; |
2621 src_v += twidth / 2; | 2624 src_v += twidth / 2; |
2622 dst_argb4444 += twidth * 2; | 2625 dst_argb4444 += twidth * 2; |
2623 width -= twidth; | 2626 width -= twidth; |
2624 } | 2627 } |
2625 } | 2628 } |
2626 #endif | 2629 #endif |
2627 | 2630 |
2628 #if defined(HAS_I422TORGB24ROW_AVX2) | 2631 #if defined(HAS_I422TORGB24ROW_AVX2) |
2629 void I422ToRGB24Row_AVX2(const uint8* src_y, | 2632 void I422ToRGB24Row_AVX2(const uint8* src_y, |
2630 const uint8* src_u, | 2633 const uint8* src_u, |
2631 const uint8* src_v, | 2634 const uint8* src_v, |
2632 uint8* dst_rgb24, | 2635 uint8* dst_rgb24, |
2633 struct YuvConstants* yuvconstants, | 2636 const struct YuvConstants* yuvconstants, |
2634 int width) { | 2637 int width) { |
2635 // Row buffer for intermediate ARGB pixels. | 2638 // Row buffer for intermediate ARGB pixels. |
2636 SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); | 2639 SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); |
2637 while (width > 0) { | 2640 while (width > 0) { |
2638 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; | 2641 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; |
2639 I422ToARGBRow_AVX2(src_y, src_u, src_v, row, yuvconstants, twidth); | 2642 I422ToARGBRow_AVX2(src_y, src_u, src_v, row, yuvconstants, twidth); |
2640 // TODO(fbarchard): ARGBToRGB24Row_AVX2 | 2643 // TODO(fbarchard): ARGBToRGB24Row_AVX2 |
2641 ARGBToRGB24Row_SSSE3(row, dst_rgb24, twidth); | 2644 ARGBToRGB24Row_SSSE3(row, dst_rgb24, twidth); |
2642 src_y += twidth; | 2645 src_y += twidth; |
2643 src_u += twidth / 2; | 2646 src_u += twidth / 2; |
2644 src_v += twidth / 2; | 2647 src_v += twidth / 2; |
2645 dst_rgb24 += twidth * 3; | 2648 dst_rgb24 += twidth * 3; |
2646 width -= twidth; | 2649 width -= twidth; |
2647 } | 2650 } |
2648 } | 2651 } |
2649 #endif | 2652 #endif |
2650 | 2653 |
2651 #if defined(HAS_I422TORAWROW_AVX2) | 2654 #if defined(HAS_I422TORAWROW_AVX2) |
2652 void I422ToRAWRow_AVX2(const uint8* src_y, | 2655 void I422ToRAWRow_AVX2(const uint8* src_y, |
2653 const uint8* src_u, | 2656 const uint8* src_u, |
2654 const uint8* src_v, | 2657 const uint8* src_v, |
2655 uint8* dst_raw, | 2658 uint8* dst_raw, |
2656 struct YuvConstants* yuvconstants, | 2659 const struct YuvConstants* yuvconstants, |
2657 int width) { | 2660 int width) { |
2658 // Row buffer for intermediate ARGB pixels. | 2661 // Row buffer for intermediate ARGB pixels. |
2659 SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); | 2662 SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); |
2660 while (width > 0) { | 2663 while (width > 0) { |
2661 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; | 2664 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; |
2662 I422ToARGBRow_AVX2(src_y, src_u, src_v, row, yuvconstants, twidth); | 2665 I422ToARGBRow_AVX2(src_y, src_u, src_v, row, yuvconstants, twidth); |
2663 // TODO(fbarchard): ARGBToRAWRow_AVX2 | 2666 // TODO(fbarchard): ARGBToRAWRow_AVX2 |
2664 ARGBToRAWRow_SSSE3(row, dst_raw, twidth); | 2667 ARGBToRAWRow_SSSE3(row, dst_raw, twidth); |
2665 src_y += twidth; | 2668 src_y += twidth; |
2666 src_u += twidth / 2; | 2669 src_u += twidth / 2; |
2667 src_v += twidth / 2; | 2670 src_v += twidth / 2; |
2668 dst_raw += twidth * 3; | 2671 dst_raw += twidth * 3; |
2669 width -= twidth; | 2672 width -= twidth; |
2670 } | 2673 } |
2671 } | 2674 } |
2672 #endif | 2675 #endif |
2673 | 2676 |
2674 #if defined(HAS_NV12TORGB565ROW_AVX2) | 2677 #if defined(HAS_NV12TORGB565ROW_AVX2) |
2675 void NV12ToRGB565Row_AVX2(const uint8* src_y, | 2678 void NV12ToRGB565Row_AVX2(const uint8* src_y, |
2676 const uint8* src_uv, | 2679 const uint8* src_uv, |
2677 uint8* dst_rgb565, | 2680 uint8* dst_rgb565, |
2678 struct YuvConstants* yuvconstants, | 2681 const struct YuvConstants* yuvconstants, |
2679 int width) { | 2682 int width) { |
2680 // Row buffer for intermediate ARGB pixels. | 2683 // Row buffer for intermediate ARGB pixels. |
2681 SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); | 2684 SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); |
2682 while (width > 0) { | 2685 while (width > 0) { |
2683 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; | 2686 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; |
2684 NV12ToARGBRow_AVX2(src_y, src_uv, row, yuvconstants, twidth); | 2687 NV12ToARGBRow_AVX2(src_y, src_uv, row, yuvconstants, twidth); |
2685 ARGBToRGB565Row_AVX2(row, dst_rgb565, twidth); | 2688 ARGBToRGB565Row_AVX2(row, dst_rgb565, twidth); |
2686 src_y += twidth; | 2689 src_y += twidth; |
2687 src_uv += twidth; | 2690 src_uv += twidth; |
2688 dst_rgb565 += twidth * 2; | 2691 dst_rgb565 += twidth * 2; |
2689 width -= twidth; | 2692 width -= twidth; |
2690 } | 2693 } |
2691 } | 2694 } |
2692 #endif | 2695 #endif |
2693 | 2696 |
2694 #ifdef __cplusplus | 2697 #ifdef __cplusplus |
2695 } // extern "C" | 2698 } // extern "C" |
2696 } // namespace libyuv | 2699 } // namespace libyuv |
2697 #endif | 2700 #endif |
OLD | NEW |