Index: media/base/yuv_convert.cc |
diff --git a/media/base/yuv_convert.cc b/media/base/yuv_convert.cc |
index 7aa16cc063a630833378c557bf0b05bdf8130b97..f32c1d2ff9c292219b029bbaf20e7490f91ead65 100644 |
--- a/media/base/yuv_convert.cc |
+++ b/media/base/yuv_convert.cc |
@@ -33,6 +33,21 @@ |
#endif |
#endif |
+// Visual Studio 2010 does not support MMX intrinsics on x64. |
+// Some win64 yuv_convert code paths use SSE+MMX yasm, so without rewriting |
+// them, we use yasm EmptyRegisterState_MMX in place of _mm_empty() or |
+// hide the versions implemented with heavy use of MMX intrinsics. |
+// TODO(wolenetz): Use MMX intrinsics when compiling win64 with Visual |
+// Studio 2012? http://crbug.com/173450 |
+#if !(defined(ARCH_CPU_X86_64) && defined(COMPILER_MSVC)) |
+#define MEDIA_MMX_INTRINSICS_AVAILABLE |
+#endif |
+ |
+// Assembly functions are declared without namespace. |
+extern "C" { |
+void EmptyRegisterState_MMX(); |
+} // extern "C" |
+ |
namespace media { |
static FilterYUVRowsProc ChooseFilterYUVRowsProc() { |
@@ -40,9 +55,12 @@ static FilterYUVRowsProc ChooseFilterYUVRowsProc() { |
base::CPU cpu; |
if (cpu.has_sse2()) |
return &FilterYUVRows_SSE2; |
+ |
+#if defined(MEDIA_MMX_INTRINSICS_AVAILABLE) |
if (cpu.has_mmx()) |
return &FilterYUVRows_MMX; |
-#endif |
+#endif // defined(MEDIA_MMX_INTRINSICS_AVAILABLE) |
+#endif // defined(ARCH_CPU_X86_FAMILY) |
return &FilterYUVRows_C; |
} |
@@ -97,9 +115,16 @@ void EmptyRegisterState() { |
has_mmx = cpu.has_mmx(); |
checked = true; |
} |
- if (has_mmx) |
+ |
+ if (has_mmx) { |
+#if defined(MEDIA_MMX_INTRINSICS_AVAILABLE) |
_mm_empty(); |
-#endif |
+#else |
+ EmptyRegisterState_MMX(); |
+#endif // defined(MEDIA_MMX_INTRINSICS_AVAILABLE) |
+ } |
+ |
+#endif // defined(ARCH_CPU_X86_FAMILY) |
} |
// 16.16 fixed point arithmetic |