diff options
author | Błażej Szczygieł <spaz16@wp.pl> | 2016-09-14 22:10:55 +0200 |
---|---|---|
committer | Błażej Szczygieł <spaz16@wp.pl> | 2016-10-19 13:34:46 +0200 |
commit | 1556d0d377ec376dd02db80a1bee7fc81eb684d9 (patch) | |
tree | 551cff697c38c4ba5269a32db5e2f796666bff9c /thirdparty/libvpx/vpx_ports | |
parent | 5268443fdfd6f9f8172cede1140810ae21f7990a (diff) |
libvpx: Necessary modifications
- convert ARM assembly (NEON) files,
- add rtcd for run-time CPU features detection,
- modify "system_state.h",
- "arm_cpudetect.c" fixes.
Diffstat (limited to 'thirdparty/libvpx/vpx_ports')
-rw-r--r-- | thirdparty/libvpx/vpx_ports/arm_cpudetect.c | 61 | ||||
-rw-r--r-- | thirdparty/libvpx/vpx_ports/system_state.h | 8 |
2 files changed, 32 insertions, 37 deletions
diff --git a/thirdparty/libvpx/vpx_ports/arm_cpudetect.c b/thirdparty/libvpx/vpx_ports/arm_cpudetect.c index 8a4b8af964..7eb74a7dc9 100644 --- a/thirdparty/libvpx/vpx_ports/arm_cpudetect.c +++ b/thirdparty/libvpx/vpx_ports/arm_cpudetect.c @@ -38,26 +38,7 @@ static int arm_cpu_env_mask(void) { } #if !CONFIG_RUNTIME_CPU_DETECT - -int arm_cpu_caps(void) { - /* This function should actually be a no-op. There is no way to adjust any of - * these because the RTCD tables do not exist: the functions are called - * statically */ - int flags; - int mask; - if (!arm_cpu_env_flags(&flags)) { - return flags; - } - mask = arm_cpu_env_mask(); -#if HAVE_MEDIA - flags |= HAS_MEDIA; -#endif /* HAVE_MEDIA */ -#if HAVE_NEON || HAVE_NEON_ASM - flags |= HAS_NEON; -#endif /* HAVE_NEON || HAVE_NEON_ASM */ - return flags & mask; -} - + #error "CONFIG_RUNTIME_CPU_DETECT should be enabled!" #elif defined(_MSC_VER) /* end !CONFIG_RUNTIME_CPU_DETECT */ /*For GetExceptionCode() and EXCEPTION_ILLEGAL_INSTRUCTION.*/ #define WIN32_LEAN_AND_MEAN @@ -76,28 +57,28 @@ int arm_cpu_caps(void) { * All of these instructions should be essentially nops. */ #if HAVE_MEDIA - if (mask & HAS_MEDIA) + if (mask & HAS_MEDIA) { __try { /*SHADD8 r3,r3,r3*/ __emit(0xE6333F93); flags |= HAS_MEDIA; } __except (GetExceptionCode() == EXCEPTION_ILLEGAL_INSTRUCTION) { /*Ignore exception.*/ + } } -} #endif /* HAVE_MEDIA */ #if HAVE_NEON || HAVE_NEON_ASM -if (mask &HAS_NEON) { - __try { - /*VORR q0,q0,q0*/ - __emit(0xF2200150); - flags |= HAS_NEON; - } __except (GetExceptionCode() == EXCEPTION_ILLEGAL_INSTRUCTION) { - /*Ignore exception.*/ + if (mask &HAS_NEON) { + __try { + /*VORR q0,q0,q0*/ + __emit(0xF2200150); + flags |= HAS_NEON; + } __except (GetExceptionCode() == EXCEPTION_ILLEGAL_INSTRUCTION) { + /*Ignore exception.*/ + } } -} #endif /* HAVE_NEON || HAVE_NEON_ASM */ -return flags & mask; + return flags & mask; } #elif defined(__ANDROID__) /* end _MSC_VER */ @@ -170,6 +151,20 @@ int arm_cpu_caps(void) { return flags & mask; } #else /* end __linux__ */ -#error "--enable-runtime-cpu-detect selected, but no CPU detection method " \ -"available for your platform. Reconfigure with --disable-runtime-cpu-detect." +int arm_cpu_caps(void) { + int flags; + int mask; + if (!arm_cpu_env_flags(&flags)) { + return flags; + } + mask = arm_cpu_env_mask(); +#if HAVE_MEDIA + flags |= HAS_MEDIA; +#endif /* HAVE_MEDIA */ +#if HAVE_NEON || HAVE_NEON_ASM + flags |= HAS_NEON; +#endif /* HAVE_NEON || HAVE_NEON_ASM */ + return flags & mask; +} +#warning "ARM run-time CPU detection is disabled for this platform..." #endif diff --git a/thirdparty/libvpx/vpx_ports/system_state.h b/thirdparty/libvpx/vpx_ports/system_state.h index 086c64681f..01989dcafc 100644 --- a/thirdparty/libvpx/vpx_ports/system_state.h +++ b/thirdparty/libvpx/vpx_ports/system_state.h @@ -13,10 +13,10 @@ #include "./vpx_config.h" -#if ARCH_X86 || ARCH_X86_64 -void vpx_reset_mmx_state(void); -#define vpx_clear_system_state() vpx_reset_mmx_state() +#if defined(WEBM_X86ASM) && (ARCH_X86 || ARCH_X86_64) + void vpx_reset_mmx_state(void); + #define vpx_clear_system_state() vpx_reset_mmx_state() #else -#define vpx_clear_system_state() + #define vpx_clear_system_state() #endif // ARCH_X86 || ARCH_X86_64 #endif // VPX_PORTS_SYSTEM_STATE_H_ |