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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: source/convert.cc
diff --git a/source/convert.cc b/source/convert.cc
index ba07b3959c71d8e7b46abbd43d08f4aebf14db1b..f2eafe216d45acc36ef0b11b164defcbf8729d52 100644
--- a/source/convert.cc
+++ b/source/convert.cc
@@ -1229,7 +1229,7 @@ int ARGB4444ToI420(const uint8* src_argb4444, int src_stride_argb4444,
uint8* dst_v, int dst_stride_v,
int width, int height) {
int y;
-#if defined(HAS_ARGB4444TOYROW_NEON)
+#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.
void (*ARGB4444ToUVRow)(const uint8* src_argb4444, int src_stride_argb4444,
uint8* dst_u, uint8* dst_v, int width) = ARGB4444ToUVRow_C;
void (*ARGB4444ToYRow)(const uint8* src_argb4444, uint8* dst_y, int width) =
@@ -1265,6 +1265,17 @@ int ARGB4444ToI420(const uint8* src_argb4444, int src_stride_argb4444,
}
}
}
+#elif defined(HAS_ARGB4444TOYROW_MSA)
+ if (TestCpuFlag(kCpuHasMSA)) {
+ ARGB4444ToUVRow = ARGB4444ToUVRow_Any_MSA;
+ ARGB4444ToYRow = ARGB4444ToYRow_Any_MSA;
+ if (IS_ALIGNED(width, 16)) {
+ ARGB4444ToYRow = ARGB4444ToYRow_MSA;
+ if (IS_ALIGNED(width, 32)) {
+ ARGB4444ToUVRow = ARGB4444ToUVRow_MSA;
+ }
+ }
+ }
// Other platforms do intermediate conversion from ARGB4444 to ARGB.
#else
#if defined(HAS_ARGB4444TOARGBROW_SSE2)
@@ -1310,7 +1321,7 @@ int ARGB4444ToI420(const uint8* src_argb4444, int src_stride_argb4444,
#endif
for (y = 0; y < height - 1; y += 2) {
-#if defined(HAS_ARGB4444TOYROW_NEON)
+#if (defined(HAS_ARGB4444TOYROW_NEON) || defined(HAS_ARGB4444TOYROW_MSA))
ARGB4444ToUVRow(src_argb4444, src_stride_argb4444, dst_u, dst_v, width);
ARGB4444ToYRow(src_argb4444, dst_y, width);
ARGB4444ToYRow(src_argb4444 + src_stride_argb4444, dst_y + dst_stride_y,
@@ -1329,7 +1340,7 @@ int ARGB4444ToI420(const uint8* src_argb4444, int src_stride_argb4444,
dst_v += dst_stride_v;
}
if (height & 1) {
-#if defined(HAS_ARGB4444TOYROW_NEON)
+#if (defined(HAS_ARGB4444TOYROW_NEON) || defined(HAS_ARGB4444TOYROW_MSA))
ARGB4444ToUVRow(src_argb4444, 0, dst_u, dst_v, width);
ARGB4444ToYRow(src_argb4444, dst_y, width);
#else
@@ -1338,7 +1349,7 @@ int ARGB4444ToI420(const uint8* src_argb4444, int src_stride_argb4444,
ARGBToYRow(row, dst_y, width);
#endif
}
-#if !defined(HAS_ARGB4444TOYROW_NEON)
+#if !(defined(HAS_ARGB4444TOYROW_NEON) || defined(HAS_ARGB4444TOYROW_MSA))
free_aligned_buffer_64(row);
}
#endif

Powered by Google App Engine
This is Rietveld 408576698