Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: source/convert_argb.cc

Issue 2626123003: Libyuv MIPS DSPR2 optimizations. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/convert.cc ('k') | source/convert_from.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } 478 }
479 #endif 479 #endif
480 #if defined(HAS_I444TOARGBROW_NEON) 480 #if defined(HAS_I444TOARGBROW_NEON)
481 if (TestCpuFlag(kCpuHasNEON)) { 481 if (TestCpuFlag(kCpuHasNEON)) {
482 I444ToARGBRow = I444ToARGBRow_Any_NEON; 482 I444ToARGBRow = I444ToARGBRow_Any_NEON;
483 if (IS_ALIGNED(width, 8)) { 483 if (IS_ALIGNED(width, 8)) {
484 I444ToARGBRow = I444ToARGBRow_NEON; 484 I444ToARGBRow = I444ToARGBRow_NEON;
485 } 485 }
486 } 486 }
487 #endif 487 #endif
488 #if defined(HAS_I444TOARGBROW_DSPR2)
489 if (TestCpuFlag(kCpuHasDSPR2)) {
490 I444ToARGBRow = I444ToARGBRow_Any_DSPR2;
491 if (IS_ALIGNED(width, 8)) {
492 I444ToARGBRow = I444ToARGBRow_DSPR2;
493 }
494 }
495 #endif
488 496
489 for (y = 0; y < height; ++y) { 497 for (y = 0; y < height; ++y) {
490 I444ToARGBRow(src_y, src_u, src_v, dst_argb, yuvconstants, width); 498 I444ToARGBRow(src_y, src_u, src_v, dst_argb, yuvconstants, width);
491 dst_argb += dst_stride_argb; 499 dst_argb += dst_stride_argb;
492 src_y += src_stride_y; 500 src_y += src_stride_y;
493 src_u += src_stride_u; 501 src_u += src_stride_u;
494 src_v += src_stride_v; 502 src_v += src_stride_v;
495 } 503 }
496 return 0; 504 return 0;
497 } 505 }
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 } 947 }
940 #endif 948 #endif
941 #if defined(HAS_RGB24TOARGBROW_NEON) 949 #if defined(HAS_RGB24TOARGBROW_NEON)
942 if (TestCpuFlag(kCpuHasNEON)) { 950 if (TestCpuFlag(kCpuHasNEON)) {
943 RGB24ToARGBRow = RGB24ToARGBRow_Any_NEON; 951 RGB24ToARGBRow = RGB24ToARGBRow_Any_NEON;
944 if (IS_ALIGNED(width, 8)) { 952 if (IS_ALIGNED(width, 8)) {
945 RGB24ToARGBRow = RGB24ToARGBRow_NEON; 953 RGB24ToARGBRow = RGB24ToARGBRow_NEON;
946 } 954 }
947 } 955 }
948 #endif 956 #endif
957 #if defined(HAS_RGB24TOARGBROW_DSPR2)
958 if (TestCpuFlag(kCpuHasDSPR2)) {
959 RGB24ToARGBRow = RGB24ToARGBRow_Any_DSPR2;
960 if (IS_ALIGNED(width, 8)) {
961 RGB24ToARGBRow = RGB24ToARGBRow_DSPR2;
962 }
963 }
964 #endif
949 965
950 for (y = 0; y < height; ++y) { 966 for (y = 0; y < height; ++y) {
951 RGB24ToARGBRow(src_rgb24, dst_argb, width); 967 RGB24ToARGBRow(src_rgb24, dst_argb, width);
952 src_rgb24 += src_stride_rgb24; 968 src_rgb24 += src_stride_rgb24;
953 dst_argb += dst_stride_argb; 969 dst_argb += dst_stride_argb;
954 } 970 }
955 return 0; 971 return 0;
956 } 972 }
957 973
958 // Convert RAW to ARGB. 974 // Convert RAW to ARGB.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 } 1006 }
991 #endif 1007 #endif
992 #if defined(HAS_RAWTOARGBROW_NEON) 1008 #if defined(HAS_RAWTOARGBROW_NEON)
993 if (TestCpuFlag(kCpuHasNEON)) { 1009 if (TestCpuFlag(kCpuHasNEON)) {
994 RAWToARGBRow = RAWToARGBRow_Any_NEON; 1010 RAWToARGBRow = RAWToARGBRow_Any_NEON;
995 if (IS_ALIGNED(width, 8)) { 1011 if (IS_ALIGNED(width, 8)) {
996 RAWToARGBRow = RAWToARGBRow_NEON; 1012 RAWToARGBRow = RAWToARGBRow_NEON;
997 } 1013 }
998 } 1014 }
999 #endif 1015 #endif
1016 #if defined(HAS_RAWTOARGBROW_DSPR2)
1017 if (TestCpuFlag(kCpuHasDSPR2)) {
1018 RAWToARGBRow = RAWToARGBRow_Any_DSPR2;
1019 if (IS_ALIGNED(width, 8)) {
1020 RAWToARGBRow = RAWToARGBRow_DSPR2;
1021 }
1022 }
1023 #endif
1000 1024
1001 for (y = 0; y < height; ++y) { 1025 for (y = 0; y < height; ++y) {
1002 RAWToARGBRow(src_raw, dst_argb, width); 1026 RAWToARGBRow(src_raw, dst_argb, width);
1003 src_raw += src_stride_raw; 1027 src_raw += src_stride_raw;
1004 dst_argb += dst_stride_argb; 1028 dst_argb += dst_stride_argb;
1005 } 1029 }
1006 return 0; 1030 return 0;
1007 } 1031 }
1008 1032
1009 // Convert RGB565 to ARGB. 1033 // Convert RGB565 to ARGB.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 } 1073 }
1050 #endif 1074 #endif
1051 #if defined(HAS_RGB565TOARGBROW_NEON) 1075 #if defined(HAS_RGB565TOARGBROW_NEON)
1052 if (TestCpuFlag(kCpuHasNEON)) { 1076 if (TestCpuFlag(kCpuHasNEON)) {
1053 RGB565ToARGBRow = RGB565ToARGBRow_Any_NEON; 1077 RGB565ToARGBRow = RGB565ToARGBRow_Any_NEON;
1054 if (IS_ALIGNED(width, 8)) { 1078 if (IS_ALIGNED(width, 8)) {
1055 RGB565ToARGBRow = RGB565ToARGBRow_NEON; 1079 RGB565ToARGBRow = RGB565ToARGBRow_NEON;
1056 } 1080 }
1057 } 1081 }
1058 #endif 1082 #endif
1083 #if defined(HAS_RGB565TOARGBROW_DSPR2)
1084 if (TestCpuFlag(kCpuHasDSPR2)) {
1085 RGB565ToARGBRow = RGB565ToARGBRow_Any_DSPR2;
1086 if (IS_ALIGNED(width, 8)) {
1087 RGB565ToARGBRow = RGB565ToARGBRow_DSPR2;
1088 }
1089 }
1090 #endif
1059 1091
1060 for (y = 0; y < height; ++y) { 1092 for (y = 0; y < height; ++y) {
1061 RGB565ToARGBRow(src_rgb565, dst_argb, width); 1093 RGB565ToARGBRow(src_rgb565, dst_argb, width);
1062 src_rgb565 += src_stride_rgb565; 1094 src_rgb565 += src_stride_rgb565;
1063 dst_argb += dst_stride_argb; 1095 dst_argb += dst_stride_argb;
1064 } 1096 }
1065 return 0; 1097 return 0;
1066 } 1098 }
1067 1099
1068 // Convert ARGB1555 to ARGB. 1100 // Convert ARGB1555 to ARGB.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 } 1140 }
1109 #endif 1141 #endif
1110 #if defined(HAS_ARGB1555TOARGBROW_NEON) 1142 #if defined(HAS_ARGB1555TOARGBROW_NEON)
1111 if (TestCpuFlag(kCpuHasNEON)) { 1143 if (TestCpuFlag(kCpuHasNEON)) {
1112 ARGB1555ToARGBRow = ARGB1555ToARGBRow_Any_NEON; 1144 ARGB1555ToARGBRow = ARGB1555ToARGBRow_Any_NEON;
1113 if (IS_ALIGNED(width, 8)) { 1145 if (IS_ALIGNED(width, 8)) {
1114 ARGB1555ToARGBRow = ARGB1555ToARGBRow_NEON; 1146 ARGB1555ToARGBRow = ARGB1555ToARGBRow_NEON;
1115 } 1147 }
1116 } 1148 }
1117 #endif 1149 #endif
1150 #if defined(HAS_ARGB1555TOARGBROW_DSPR2)
1151 if (TestCpuFlag(kCpuHasDSPR2)) {
1152 ARGB1555ToARGBRow = ARGB1555ToARGBRow_Any_DSPR2;
1153 if (IS_ALIGNED(width, 4)) {
1154 ARGB1555ToARGBRow = ARGB1555ToARGBRow_DSPR2;
1155 }
1156 }
1157 #endif
1118 1158
1119 for (y = 0; y < height; ++y) { 1159 for (y = 0; y < height; ++y) {
1120 ARGB1555ToARGBRow(src_argb1555, dst_argb, width); 1160 ARGB1555ToARGBRow(src_argb1555, dst_argb, width);
1121 src_argb1555 += src_stride_argb1555; 1161 src_argb1555 += src_stride_argb1555;
1122 dst_argb += dst_stride_argb; 1162 dst_argb += dst_stride_argb;
1123 } 1163 }
1124 return 0; 1164 return 0;
1125 } 1165 }
1126 1166
1127 // Convert ARGB4444 to ARGB. 1167 // Convert ARGB4444 to ARGB.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 } 1207 }
1168 #endif 1208 #endif
1169 #if defined(HAS_ARGB4444TOARGBROW_NEON) 1209 #if defined(HAS_ARGB4444TOARGBROW_NEON)
1170 if (TestCpuFlag(kCpuHasNEON)) { 1210 if (TestCpuFlag(kCpuHasNEON)) {
1171 ARGB4444ToARGBRow = ARGB4444ToARGBRow_Any_NEON; 1211 ARGB4444ToARGBRow = ARGB4444ToARGBRow_Any_NEON;
1172 if (IS_ALIGNED(width, 8)) { 1212 if (IS_ALIGNED(width, 8)) {
1173 ARGB4444ToARGBRow = ARGB4444ToARGBRow_NEON; 1213 ARGB4444ToARGBRow = ARGB4444ToARGBRow_NEON;
1174 } 1214 }
1175 } 1215 }
1176 #endif 1216 #endif
1217 #if defined(HAS_ARGB4444TOARGBROW_DSPR2)
1218 if (TestCpuFlag(kCpuHasDSPR2)) {
1219 ARGB4444ToARGBRow = ARGB4444ToARGBRow_Any_DSPR2;
1220 if (IS_ALIGNED(width, 4)) {
1221 ARGB4444ToARGBRow = ARGB4444ToARGBRow_DSPR2;
1222 }
1223 }
1224 #endif
1177 #if defined(HAS_ARGB4444TOARGBROW_MSA) 1225 #if defined(HAS_ARGB4444TOARGBROW_MSA)
1178 if (TestCpuFlag(kCpuHasMSA)) { 1226 if (TestCpuFlag(kCpuHasMSA)) {
1179 ARGB4444ToARGBRow = ARGB4444ToARGBRow_Any_MSA; 1227 ARGB4444ToARGBRow = ARGB4444ToARGBRow_Any_MSA;
1180 if (IS_ALIGNED(width, 16)) { 1228 if (IS_ALIGNED(width, 16)) {
1181 ARGB4444ToARGBRow = ARGB4444ToARGBRow_MSA; 1229 ARGB4444ToARGBRow = ARGB4444ToARGBRow_MSA;
1182 } 1230 }
1183 } 1231 }
1184 #endif 1232 #endif
1185 1233
1186 for (y = 0; y < height; ++y) { 1234 for (y = 0; y < height; ++y) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 } 1279 }
1232 #endif 1280 #endif
1233 #if defined(HAS_NV12TOARGBROW_NEON) 1281 #if defined(HAS_NV12TOARGBROW_NEON)
1234 if (TestCpuFlag(kCpuHasNEON)) { 1282 if (TestCpuFlag(kCpuHasNEON)) {
1235 NV12ToARGBRow = NV12ToARGBRow_Any_NEON; 1283 NV12ToARGBRow = NV12ToARGBRow_Any_NEON;
1236 if (IS_ALIGNED(width, 8)) { 1284 if (IS_ALIGNED(width, 8)) {
1237 NV12ToARGBRow = NV12ToARGBRow_NEON; 1285 NV12ToARGBRow = NV12ToARGBRow_NEON;
1238 } 1286 }
1239 } 1287 }
1240 #endif 1288 #endif
1289 #if defined(HAS_NV12TOARGBROW_DSPR2)
1290 if (TestCpuFlag(kCpuHasDSPR2)) {
1291 NV12ToARGBRow = NV12ToARGBRow_Any_DSPR2;
1292 if (IS_ALIGNED(width, 8)) {
1293 NV12ToARGBRow = NV12ToARGBRow_DSPR2;
1294 }
1295 }
1296 #endif
1241 1297
1242 for (y = 0; y < height; ++y) { 1298 for (y = 0; y < height; ++y) {
1243 NV12ToARGBRow(src_y, src_uv, dst_argb, &kYuvI601Constants, width); 1299 NV12ToARGBRow(src_y, src_uv, dst_argb, &kYuvI601Constants, width);
1244 dst_argb += dst_stride_argb; 1300 dst_argb += dst_stride_argb;
1245 src_y += src_stride_y; 1301 src_y += src_stride_y;
1246 if (y & 1) { 1302 if (y & 1) {
1247 src_uv += src_stride_uv; 1303 src_uv += src_stride_uv;
1248 } 1304 }
1249 } 1305 }
1250 return 0; 1306 return 0;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 } 1403 }
1348 #endif 1404 #endif
1349 #if defined(HAS_NV12TOARGBROW_NEON) 1405 #if defined(HAS_NV12TOARGBROW_NEON)
1350 if (TestCpuFlag(kCpuHasNEON)) { 1406 if (TestCpuFlag(kCpuHasNEON)) {
1351 NV12ToARGBRow = NV12ToARGBRow_Any_NEON; 1407 NV12ToARGBRow = NV12ToARGBRow_Any_NEON;
1352 if (IS_ALIGNED(width, 8)) { 1408 if (IS_ALIGNED(width, 8)) {
1353 NV12ToARGBRow = NV12ToARGBRow_NEON; 1409 NV12ToARGBRow = NV12ToARGBRow_NEON;
1354 } 1410 }
1355 } 1411 }
1356 #endif 1412 #endif
1413 #if defined(HAS_NV12TOARGBROW_DSPR2)
1414 if (TestCpuFlag(kCpuHasDSPR2)) {
1415 NV12ToARGBRow = NV12ToARGBRow_Any_DSPR2;
1416 if (IS_ALIGNED(width, 8)) {
1417 NV12ToARGBRow = NV12ToARGBRow_DSPR2;
1418 }
1419 }
1420 #endif
1357 1421
1358 for (y = 0; y < height - 1; y += 2) { 1422 for (y = 0; y < height - 1; y += 2) {
1359 NV12ToARGBRow(src_m420, src_m420 + src_stride_m420 * 2, dst_argb, 1423 NV12ToARGBRow(src_m420, src_m420 + src_stride_m420 * 2, dst_argb,
1360 &kYuvI601Constants, width); 1424 &kYuvI601Constants, width);
1361 NV12ToARGBRow(src_m420 + src_stride_m420, src_m420 + src_stride_m420 * 2, 1425 NV12ToARGBRow(src_m420 + src_stride_m420, src_m420 + src_stride_m420 * 2,
1362 dst_argb + dst_stride_argb, &kYuvI601Constants, width); 1426 dst_argb + dst_stride_argb, &kYuvI601Constants, width);
1363 dst_argb += dst_stride_argb * 2; 1427 dst_argb += dst_stride_argb * 2;
1364 src_m420 += src_stride_m420 * 3; 1428 src_m420 += src_stride_m420 * 3;
1365 } 1429 }
1366 if (height & 1) { 1430 if (height & 1) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 src_uyvy += src_stride_uyvy; 1549 src_uyvy += src_stride_uyvy;
1486 dst_argb += dst_stride_argb; 1550 dst_argb += dst_stride_argb;
1487 } 1551 }
1488 return 0; 1552 return 0;
1489 } 1553 }
1490 1554
1491 #ifdef __cplusplus 1555 #ifdef __cplusplus
1492 } // extern "C" 1556 } // extern "C"
1493 } // namespace libyuv 1557 } // namespace libyuv
1494 #endif 1558 #endif
OLDNEW
« no previous file with comments | « source/convert.cc ('k') | source/convert_from.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698