cpu.cpp (1304B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 /* This file replaces the CPU info methods originally implemented in 7 * src/dsp/cpu.c, due to missing dependencies for Andriod builds. It 8 * controls if NEON/SSE/etc is used. */ 9 10 #include "../dsp/dsp.h" 11 #include "mozilla/arm.h" 12 #include "mozilla/SSE.h" 13 14 extern "C" { 15 extern VP8CPUInfo VP8GetCPUInfo; 16 extern VP8CPUInfo SharpYuvGetCPUInfo; 17 } 18 19 static int MozCPUInfo(CPUFeature feature) 20 { 21 switch (feature) { 22 case kSSE2: 23 return mozilla::supports_sse2(); 24 case kSSE3: 25 return mozilla::supports_sse3(); 26 case kSSE4_1: 27 return mozilla::supports_sse4_1(); 28 case kAVX: 29 return mozilla::supports_avx(); 30 case kAVX2: 31 return mozilla::supports_avx2(); 32 case kNEON: 33 return mozilla::supports_neon(); 34 #if defined(WEBP_USE_MIPS32) || defined(WEBP_USE_MIPS_DSP_R2) || defined(WEBP_USE_MSA) 35 case kMIPS32: 36 case kMIPSdspR2: 37 case kMSA: 38 return 1; 39 #endif 40 default: 41 return 0; 42 } 43 } 44 45 VP8CPUInfo VP8GetCPUInfo = MozCPUInfo; 46 VP8CPUInfo SharpYuvGetCPUInfo = MozCPUInfo;