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

Side by Side Diff: source/convert.cc

Issue 2421843002: Add MSA optimized ARGB4444ToI420 and ARGB4444ToARGB functions (Closed)
Patch Set: Created 4 years, 2 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
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 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 } 1222 }
1223 1223
1224 // Convert ARGB4444 to I420. 1224 // Convert ARGB4444 to I420.
1225 LIBYUV_API 1225 LIBYUV_API
1226 int ARGB4444ToI420(const uint8* src_argb4444, int src_stride_argb4444, 1226 int ARGB4444ToI420(const uint8* src_argb4444, int src_stride_argb4444,
1227 uint8* dst_y, int dst_stride_y, 1227 uint8* dst_y, int dst_stride_y,
1228 uint8* dst_u, int dst_stride_u, 1228 uint8* dst_u, int dst_stride_u,
1229 uint8* dst_v, int dst_stride_v, 1229 uint8* dst_v, int dst_stride_v,
1230 int width, int height) { 1230 int width, int height) {
1231 int y; 1231 int y;
1232 #if defined(HAS_ARGB4444TOYROW_NEON) 1232 #if (defined(HAS_ARGB4444TOYROW_NEON) || defined(HAS_ARGB4444TOYROW_MSA))
fbarchard1 2016/10/14 21:35:16 I'd have suggested taking the intel approach, whic
manojkumar.bhosale 2016/10/19 11:56:27 Done.
1233 void (*ARGB4444ToUVRow)(const uint8* src_argb4444, int src_stride_argb4444, 1233 void (*ARGB4444ToUVRow)(const uint8* src_argb4444, int src_stride_argb4444,
1234 uint8* dst_u, uint8* dst_v, int width) = ARGB4444ToUVRow_C; 1234 uint8* dst_u, uint8* dst_v, int width) = ARGB4444ToUVRow_C;
1235 void (*ARGB4444ToYRow)(const uint8* src_argb4444, uint8* dst_y, int width) = 1235 void (*ARGB4444ToYRow)(const uint8* src_argb4444, uint8* dst_y, int width) =
1236 ARGB4444ToYRow_C; 1236 ARGB4444ToYRow_C;
1237 #else 1237 #else
1238 void (*ARGB4444ToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int width) = 1238 void (*ARGB4444ToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int width) =
1239 ARGB4444ToARGBRow_C; 1239 ARGB4444ToARGBRow_C;
1240 void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb, 1240 void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb,
1241 uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C; 1241 uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
1242 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) = 1242 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) =
(...skipping 15 matching lines...) Expand all
1258 if (TestCpuFlag(kCpuHasNEON)) { 1258 if (TestCpuFlag(kCpuHasNEON)) {
1259 ARGB4444ToUVRow = ARGB4444ToUVRow_Any_NEON; 1259 ARGB4444ToUVRow = ARGB4444ToUVRow_Any_NEON;
1260 ARGB4444ToYRow = ARGB4444ToYRow_Any_NEON; 1260 ARGB4444ToYRow = ARGB4444ToYRow_Any_NEON;
1261 if (IS_ALIGNED(width, 8)) { 1261 if (IS_ALIGNED(width, 8)) {
1262 ARGB4444ToYRow = ARGB4444ToYRow_NEON; 1262 ARGB4444ToYRow = ARGB4444ToYRow_NEON;
1263 if (IS_ALIGNED(width, 16)) { 1263 if (IS_ALIGNED(width, 16)) {
1264 ARGB4444ToUVRow = ARGB4444ToUVRow_NEON; 1264 ARGB4444ToUVRow = ARGB4444ToUVRow_NEON;
1265 } 1265 }
1266 } 1266 }
1267 } 1267 }
1268 #elif defined(HAS_ARGB4444TOYROW_MSA)
1269 if (TestCpuFlag(kCpuHasMSA)) {
1270 ARGB4444ToUVRow = ARGB4444ToUVRow_Any_MSA;
1271 ARGB4444ToYRow = ARGB4444ToYRow_Any_MSA;
1272 if (IS_ALIGNED(width, 16)) {
1273 ARGB4444ToYRow = ARGB4444ToYRow_MSA;
1274 if (IS_ALIGNED(width, 32)) {
1275 ARGB4444ToUVRow = ARGB4444ToUVRow_MSA;
1276 }
1277 }
1278 }
1268 // Other platforms do intermediate conversion from ARGB4444 to ARGB. 1279 // Other platforms do intermediate conversion from ARGB4444 to ARGB.
1269 #else 1280 #else
1270 #if defined(HAS_ARGB4444TOARGBROW_SSE2) 1281 #if defined(HAS_ARGB4444TOARGBROW_SSE2)
1271 if (TestCpuFlag(kCpuHasSSE2)) { 1282 if (TestCpuFlag(kCpuHasSSE2)) {
1272 ARGB4444ToARGBRow = ARGB4444ToARGBRow_Any_SSE2; 1283 ARGB4444ToARGBRow = ARGB4444ToARGBRow_Any_SSE2;
1273 if (IS_ALIGNED(width, 8)) { 1284 if (IS_ALIGNED(width, 8)) {
1274 ARGB4444ToARGBRow = ARGB4444ToARGBRow_SSE2; 1285 ARGB4444ToARGBRow = ARGB4444ToARGBRow_SSE2;
1275 } 1286 }
1276 } 1287 }
1277 #endif 1288 #endif
(...skipping 25 matching lines...) Expand all
1303 } 1314 }
1304 } 1315 }
1305 #endif 1316 #endif
1306 { 1317 {
1307 // Allocate 2 rows of ARGB. 1318 // Allocate 2 rows of ARGB.
1308 const int kRowSize = (width * 4 + 31) & ~31; 1319 const int kRowSize = (width * 4 + 31) & ~31;
1309 align_buffer_64(row, kRowSize * 2); 1320 align_buffer_64(row, kRowSize * 2);
1310 #endif 1321 #endif
1311 1322
1312 for (y = 0; y < height - 1; y += 2) { 1323 for (y = 0; y < height - 1; y += 2) {
1313 #if defined(HAS_ARGB4444TOYROW_NEON) 1324 #if (defined(HAS_ARGB4444TOYROW_NEON) || defined(HAS_ARGB4444TOYROW_MSA))
1314 ARGB4444ToUVRow(src_argb4444, src_stride_argb4444, dst_u, dst_v, width); 1325 ARGB4444ToUVRow(src_argb4444, src_stride_argb4444, dst_u, dst_v, width);
1315 ARGB4444ToYRow(src_argb4444, dst_y, width); 1326 ARGB4444ToYRow(src_argb4444, dst_y, width);
1316 ARGB4444ToYRow(src_argb4444 + src_stride_argb4444, dst_y + dst_stride_y, 1327 ARGB4444ToYRow(src_argb4444 + src_stride_argb4444, dst_y + dst_stride_y,
1317 width); 1328 width);
1318 #else 1329 #else
1319 ARGB4444ToARGBRow(src_argb4444, row, width); 1330 ARGB4444ToARGBRow(src_argb4444, row, width);
1320 ARGB4444ToARGBRow(src_argb4444 + src_stride_argb4444, row + kRowSize, 1331 ARGB4444ToARGBRow(src_argb4444 + src_stride_argb4444, row + kRowSize,
1321 width); 1332 width);
1322 ARGBToUVRow(row, kRowSize, dst_u, dst_v, width); 1333 ARGBToUVRow(row, kRowSize, dst_u, dst_v, width);
1323 ARGBToYRow(row, dst_y, width); 1334 ARGBToYRow(row, dst_y, width);
1324 ARGBToYRow(row + kRowSize, dst_y + dst_stride_y, width); 1335 ARGBToYRow(row + kRowSize, dst_y + dst_stride_y, width);
1325 #endif 1336 #endif
1326 src_argb4444 += src_stride_argb4444 * 2; 1337 src_argb4444 += src_stride_argb4444 * 2;
1327 dst_y += dst_stride_y * 2; 1338 dst_y += dst_stride_y * 2;
1328 dst_u += dst_stride_u; 1339 dst_u += dst_stride_u;
1329 dst_v += dst_stride_v; 1340 dst_v += dst_stride_v;
1330 } 1341 }
1331 if (height & 1) { 1342 if (height & 1) {
1332 #if defined(HAS_ARGB4444TOYROW_NEON) 1343 #if (defined(HAS_ARGB4444TOYROW_NEON) || defined(HAS_ARGB4444TOYROW_MSA))
1333 ARGB4444ToUVRow(src_argb4444, 0, dst_u, dst_v, width); 1344 ARGB4444ToUVRow(src_argb4444, 0, dst_u, dst_v, width);
1334 ARGB4444ToYRow(src_argb4444, dst_y, width); 1345 ARGB4444ToYRow(src_argb4444, dst_y, width);
1335 #else 1346 #else
1336 ARGB4444ToARGBRow(src_argb4444, row, width); 1347 ARGB4444ToARGBRow(src_argb4444, row, width);
1337 ARGBToUVRow(row, 0, dst_u, dst_v, width); 1348 ARGBToUVRow(row, 0, dst_u, dst_v, width);
1338 ARGBToYRow(row, dst_y, width); 1349 ARGBToYRow(row, dst_y, width);
1339 #endif 1350 #endif
1340 } 1351 }
1341 #if !defined(HAS_ARGB4444TOYROW_NEON) 1352 #if !(defined(HAS_ARGB4444TOYROW_NEON) || defined(HAS_ARGB4444TOYROW_MSA))
1342 free_aligned_buffer_64(row); 1353 free_aligned_buffer_64(row);
1343 } 1354 }
1344 #endif 1355 #endif
1345 return 0; 1356 return 0;
1346 } 1357 }
1347 1358
1348 static void SplitPixels(const uint8* src_u, int src_pixel_stride_uv, 1359 static void SplitPixels(const uint8* src_u, int src_pixel_stride_uv,
1349 uint8* dst_u, int width) { 1360 uint8* dst_u, int width) {
1350 int i; 1361 int i;
1351 for (i = 0; i < width; ++i) { 1362 for (i = 0; i < width; ++i) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1417 dst_u += dst_stride_u; 1428 dst_u += dst_stride_u;
1418 dst_v += dst_stride_v; 1429 dst_v += dst_stride_v;
1419 } 1430 }
1420 return 0; 1431 return 0;
1421 } 1432 }
1422 1433
1423 #ifdef __cplusplus 1434 #ifdef __cplusplus
1424 } // extern "C" 1435 } // extern "C"
1425 } // namespace libyuv 1436 } // namespace libyuv
1426 #endif 1437 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698