From 2c8108e6c2c6fa0c62670a70be7ef6f59cf03848 Mon Sep 17 00:00:00 2001 From: "fbarchard@google.com" Date: Tue, 14 Jan 2014 00:36:31 +0000 Subject: [PATCH] Detect pnacl and disable x86 specific code. BUG=none TESTED=untested R=ryanpetrie@google.com Review URL: https://webrtc-codereview.appspot.com/7099004 git-svn-id: http://libyuv.googlecode.com/svn/trunk@968 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- README.chromium | 2 +- include/libyuv/planar_functions.h | 3 ++- include/libyuv/row.h | 2 +- include/libyuv/scale_row.h | 5 +++++ include/libyuv/version.h | 2 +- source/cpu_id.cc | 9 ++++++--- source/mjpeg_decoder.cc | 4 +++- 7 files changed, 19 insertions(+), 8 deletions(-) diff --git a/README.chromium b/README.chromium index a8e43ffde..3e2a65eb7 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 967 +Version: 968 License: BSD License File: LICENSE diff --git a/include/libyuv/planar_functions.h b/include/libyuv/planar_functions.h index f642cc66a..ac516c5ba 100644 --- a/include/libyuv/planar_functions.h +++ b/include/libyuv/planar_functions.h @@ -382,10 +382,11 @@ int ARGBInterpolate(const uint8* src_argb0, int src_stride_argb0, uint8* dst_argb, int dst_stride_argb, int width, int height, int interpolation); -#if defined(__CLR_VER) || defined(COVERAGE_ENABLED) || \ +#if defined(__pnacl__) || defined(__CLR_VER) || defined(COVERAGE_ENABLED) || \ defined(TARGET_IPHONE_SIMULATOR) #define LIBYUV_DISABLE_X86 #endif + // Row functions for copying a pixels from a source with a slope to a row // of destination. Useful for scaling, rotation, mirror, texture mapping. LIBYUV_API diff --git a/include/libyuv/row.h b/include/libyuv/row.h index 7bc841f78..757020da8 100644 --- a/include/libyuv/row.h +++ b/include/libyuv/row.h @@ -37,7 +37,7 @@ extern "C" { free(var##_mem); \ var = 0 -#if defined(__CLR_VER) || defined(COVERAGE_ENABLED) || \ +#if defined(__pnacl__) || defined(__CLR_VER) || defined(COVERAGE_ENABLED) || \ defined(TARGET_IPHONE_SIMULATOR) #define LIBYUV_DISABLE_X86 #endif diff --git a/include/libyuv/scale_row.h b/include/libyuv/scale_row.h index 2bb06cf3a..13eccc4d7 100644 --- a/include/libyuv/scale_row.h +++ b/include/libyuv/scale_row.h @@ -18,6 +18,11 @@ namespace libyuv { extern "C" { #endif +#if defined(__pnacl__) || defined(__CLR_VER) || defined(COVERAGE_ENABLED) || \ + defined(TARGET_IPHONE_SIMULATOR) +#define LIBYUV_DISABLE_X86 +#endif + // The following are available on all x86 platforms: #if !defined(LIBYUV_DISABLE_X86) && \ (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 99e45fe65..5d33ed671 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 967 +#define LIBYUV_VERSION 968 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/source/cpu_id.cc b/source/cpu_id.cc index 0c26aa23a..e38e68890 100644 --- a/source/cpu_id.cc +++ b/source/cpu_id.cc @@ -13,7 +13,8 @@ #ifdef _MSC_VER #include // For __cpuidex() #endif -#if !defined(__CLR_VER) && !defined(__native_client__) && defined(_M_X64) && \ +#if !defined(__pnacl__) && !defined(__CLR_VER) && \ + !defined(__native_client__) && defined(_M_X64) && \ defined(_MSC_VER) && (_MSC_FULL_VER >= 160040219) #include // For _xgetbv() #endif @@ -42,7 +43,8 @@ extern "C" { #endif // Low level cpuid for X86. Returns zeros on other CPUs. -#if !defined(__CLR_VER) && (defined(_M_IX86) || defined(_M_X64) || \ +#if !defined(__pnacl__) && !defined(__CLR_VER) && \ + (defined(_M_IX86) || defined(_M_X64) || \ defined(__i386__) || defined(__x86_64__)) LIBYUV_API void CpuId(uint32 info_eax, uint32 info_ecx, uint32* cpu_info) { @@ -179,7 +181,8 @@ static LIBYUV_BOOL TestEnv(const char*) { LIBYUV_API SAFEBUFFERS int InitCpuFlags(void) { -#if !defined(__CLR_VER) && defined(CPU_X86) +#if !defined(__pnacl__) && !defined(__CLR_VER) && defined(CPU_X86) + uint32 cpu_info1[4] = { 0, 0, 0, 0 }; uint32 cpu_info7[4] = { 0, 0, 0, 0 }; CpuId(1, 0, cpu_info1); diff --git a/source/mjpeg_decoder.cc b/source/mjpeg_decoder.cc index 63e0ecafd..193b829ba 100644 --- a/source/mjpeg_decoder.cc +++ b/source/mjpeg_decoder.cc @@ -12,7 +12,9 @@ #ifdef HAVE_JPEG #include -#ifndef __CLR_VER + +#if !defined(__pnacl__) && !defined(__CLR_VER) && !defined(COVERAGE_ENABLED) &&\ + !defined(TARGET_IPHONE_SIMULATOR) // Must be included before jpeglib. #include #define HAVE_SETJMP