Index: media/base/yuv_convert.cc |
=================================================================== |
--- media/base/yuv_convert.cc (revision 180095) |
+++ media/base/yuv_convert.cc (working copy) |
@@ -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 @@ |
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 @@ |
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 |