Fix checking for Wasm SIMD support

The defined(WEBP_ENABLE_WASM_SIMD) in dsp.h meant that cpu.cmake will
never successfully compile with Wasm SIMD, since it doesn't set any
compile flags. We remove that requirement, and instead determine in
dec.c if we want to be using Wasm SIMD intrinsics.

Bug: v8:12371
Change-Id: I5d313f6d95301e6153254229a9ea234fec990cd6
This commit is contained in:
Zhi An Ng 2021-11-18 16:47:01 -08:00
parent ed665a15e8
commit c4422702d0
3 changed files with 4 additions and 3 deletions

View File

@ -83,7 +83,7 @@ if(WEBP_ENABLE_SWAP_16BIT_CSP)
add_definitions(-DWEBP_SWAP_16BIT_CSP=1)
endif()
if(WEBP_ENABLE_WASM_SIMD)
add_definitions(-DWEBP_ENABLE_WASM_SIMD)
add_definitions(-DWEBP_ENABLE_WASM_SIMD_INTRINSICS)
endif()
if(NOT WEBP_BITTRACE STREQUAL "0")

View File

@ -833,7 +833,8 @@ WEBP_DSP_INIT_FUNC(VP8DspInit) {
VP8DspInitMSA();
}
#endif
#if defined(WEBP_USE_WASM_SIMD)
#if defined(WEBP_USE_WASM_SIMD) && defined(WEBP_ENABLE_WASM_SIMD_INTRINSICS)
// Check that SIMD is supported and that we want to use Wasm intrinsics.
if (VP8GetCPUInfo(kWasmSIMD)) {
VP8DspInitWasmSIMD();
}

View File

@ -81,7 +81,7 @@ extern "C" {
#endif
#if (defined(EMSCRIPTEN) || defined(WEBP_HAVE_WASM_SIMD)) && \
defined(__wasm_simd128__) && defined(WEBP_ENABLE_WASM_SIMD)
defined(__wasm_simd128__)
#define WEBP_USE_WASM_SIMD
#endif