diff --git a/src/dec/tree_dec.c b/src/dec/tree_dec.c index 24346059..8093e78b 100644 --- a/src/dec/tree_dec.c +++ b/src/dec/tree_dec.c @@ -16,7 +16,8 @@ #include "src/utils/bit_reader_inl_utils.h" #if !defined(USE_GENERIC_TREE) -#if !defined(__arm__) && !defined(_M_ARM) && !WEBP_AARCH64 +#if !defined(__arm__) && !defined(_M_ARM) && !WEBP_AARCH64 && \ + !defined(__wasm__) // using a table is ~1-2% slower on ARM. Prefer the coded-tree approach then. #define USE_GENERIC_TREE 1 // ALTERNATE_CODE #else diff --git a/src/utils/bit_reader_utils.c b/src/utils/bit_reader_utils.c index a26557aa..2707420f 100644 --- a/src/utils/bit_reader_utils.c +++ b/src/utils/bit_reader_utils.c @@ -124,7 +124,8 @@ int32_t VP8GetSignedValue(VP8BitReader* const br, int bits, #if defined(__arm__) || defined(_M_ARM) || WEBP_AARCH64 || \ defined(__i386__) || defined(_M_IX86) || \ - defined(__x86_64__) || defined(_M_X64) + defined(__x86_64__) || defined(_M_X64) || \ + defined(__wasm__) #define VP8L_USE_FAST_LOAD #endif diff --git a/src/utils/bit_reader_utils.h b/src/utils/bit_reader_utils.h index 25ff31e5..b41a7881 100644 --- a/src/utils/bit_reader_utils.h +++ b/src/utils/bit_reader_utils.h @@ -69,6 +69,8 @@ extern "C" { #define BITS 56 #elif defined(__mips__) // MIPS #define BITS 24 +#elif defined(__wasm__) // WASM +#define BITS 56 #else // reasonable default #define BITS 24 #endif