Commit cb3344ae authored by fbarchard@google.com's avatar fbarchard@google.com

If libyuv built with Neon, assume Neon is present on CPU.

BUG=315
TESTED=untested
R=nfullagar@chromium.org

Review URL: https://webrtc-codereview.appspot.com/9589004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@980 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 4b3428e7
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 979
Version: 980
License: BSD
License File: LICENSE
......
......@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 979
#define LIBYUV_VERSION 980
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
......@@ -121,7 +121,9 @@ void CpuId(uint32 eax, uint32 ecx, uint32* cpu_info) {
LIBYUV_API SAFEBUFFERS
int ArmCpuCaps(const char* cpuinfo_name) {
FILE* f = fopen(cpuinfo_name, "r");
if (f) {
if (!f) {
return kCpuHasNEON; // Assume Neon if /proc/cpuinfo is unavailable.
}
char cpuinfo_line[512];
while (fgets(cpuinfo_line, sizeof(cpuinfo_line) - 1, f)) {
if (memcmp(cpuinfo_line, "Features", 8) == 0) {
......@@ -133,7 +135,6 @@ int ArmCpuCaps(const char* cpuinfo_name) {
}
}
fclose(f);
}
return 0;
}
......@@ -247,15 +248,14 @@ int InitCpuFlags(void) {
cpu_info_ &= ~kCpuHasMIPS_DSPR2;
}
#elif defined(__arm__)
#if defined(__linux__) && (defined(__ARM_NEON__) || defined(LIBYUV_NEON)) && \
!defined(__native_client__)
// Linux arm parse text file for neon detect.
cpu_info_ = ArmCpuCaps("/proc/cpuinfo");
#elif defined(__ARM_NEON__) || defined(__native_client__)
#if defined(__ARM_NEON__) || defined(__native_client__) || !defined(__linux__)
// gcc -mfpu=neon defines __ARM_NEON__
// Enable Neon if you want support for Neon and Arm, and use MaskCpuFlags
// to disable Neon on devices that do not have it.
cpu_info_ = kCpuHasNEON;
#else
// Linux arm parse text file for neon detect.
cpu_info_ = ArmCpuCaps("/proc/cpuinfo");
#endif
cpu_info_ |= kCpuHasARM;
if (TestEnv("LIBYUV_DISABLE_NEON")) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment