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

Unified Diff: media/base/yuv_convert.cc

Issue 15151002: Streamline SIMD targets in media.gyp (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add Win64 hack. Created 7 years, 7 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
« no previous file with comments | « media/base/yuv_convert.h ('k') | media/base/yuv_convert_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/yuv_convert.cc
diff --git a/media/base/yuv_convert.cc b/media/base/yuv_convert.cc
index 1d09a244010fca7540ab096f29805969680702ac..2183b1fa3b8d554adbe91ea3dca97191c4cde8cc 100644
--- a/media/base/yuv_convert.cc
+++ b/media/base/yuv_convert.cc
@@ -40,6 +40,52 @@ void EmptyRegisterState_MMX();
namespace media {
+typedef void (*FilterYUVRowsProc)(uint8*, const uint8*, const uint8*, int, int);
+
+typedef void (*ConvertYUVToRGB32Proc)(const uint8*,
+ const uint8*,
+ const uint8*,
+ uint8*,
+ int,
+ int,
+ int,
+ int,
+ int,
+ YUVType);
+
+typedef void (*ConvertYUVAToARGBProc)(const uint8*,
+ const uint8*,
+ const uint8*,
+ const uint8*,
+ uint8*,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int,
+ YUVType);
+
+typedef void (*ConvertYUVToRGB32RowProc)(const uint8*,
+ const uint8*,
+ const uint8*,
+ uint8*,
+ ptrdiff_t);
+
+typedef void (*ConvertYUVAToARGBRowProc)(const uint8*,
+ const uint8*,
+ const uint8*,
+ const uint8*,
+ uint8*,
+ ptrdiff_t);
+
+typedef void (*ScaleYUVToRGB32RowProc)(const uint8*,
+ const uint8*,
+ const uint8*,
+ uint8*,
+ ptrdiff_t,
+ ptrdiff_t);
+
static FilterYUVRowsProc ChooseFilterYUVRowsProc() {
#if defined(ARCH_CPU_X86_FAMILY)
base::CPU cpu;
@@ -66,32 +112,42 @@ static ConvertYUVToRGB32RowProc ChooseConvertYUVToRGB32RowProc() {
}
static ScaleYUVToRGB32RowProc ChooseScaleYUVToRGB32RowProc() {
+#if defined(ARCH_CPU_X86_FAMILY)
+ base::CPU cpu;
#if defined(ARCH_CPU_X86_64)
// Use 64-bits version if possible.
- return &ScaleYUVToRGB32Row_SSE2_X64;
-#elif defined(ARCH_CPU_X86_FAMILY)
- base::CPU cpu;
+ // TODO(dalecurtis): Fix this to directly return X64 version. All x64 procs
+ // have SSE2, this is a hack to prevent MSVC from optimizing exports out in
+ // the shared library build which are used by unittests.
+ if (cpu.has_sse2())
+ return &ScaleYUVToRGB32Row_SSE2_X64;
+#endif // defined(ARCH_CPU_X86_64)
// Choose the best one on 32-bits system.
if (cpu.has_sse())
return &ScaleYUVToRGB32Row_SSE;
if (cpu.has_mmx())
return &ScaleYUVToRGB32Row_MMX;
-#endif // defined(ARCH_CPU_X86_64)
+#endif // defined(ARCH_CPU_X86_FAMILY)
return &ScaleYUVToRGB32Row_C;
}
static ScaleYUVToRGB32RowProc ChooseLinearScaleYUVToRGB32RowProc() {
+#if defined(ARCH_CPU_X86_FAMILY)
+ base::CPU cpu;
#if defined(ARCH_CPU_X86_64)
// Use 64-bits version if possible.
- return &LinearScaleYUVToRGB32Row_MMX_X64;
-#elif defined(ARCH_CPU_X86_FAMILY)
- base::CPU cpu;
+ // TODO(dalecurtis): Fix this to directly return X64 version. All x64 procs
+ // have SSE2, this is a hack to prevent MSVC from optimizing exports out in
+ // the shared library build which are used by unittests.
+ if (cpu.has_sse2())
+ return &LinearScaleYUVToRGB32Row_MMX_X64;
+#endif // defined(ARCH_CPU_X86_64)
// 32-bits system.
if (cpu.has_sse())
return &LinearScaleYUVToRGB32Row_SSE;
if (cpu.has_mmx())
return &LinearScaleYUVToRGB32Row_MMX;
-#endif // defined(ARCH_CPU_X86_64)
+#endif // defined(ARCH_CPU_X86_FAMILY)
return &LinearScaleYUVToRGB32Row_C;
}
« no previous file with comments | « media/base/yuv_convert.h ('k') | media/base/yuv_convert_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698