speed up for ARM using 8bit for boolean decoder

SBITS=8 is reported 20-30% faster on ARM (where 64bit ops
are expensive).

Also use 32bits for i32.

Change-Id: Id6a7197d805061aeb8832f20432512d0d930ebfa
This commit is contained in:
skal 2012-09-10 13:13:51 +02:00
parent 5725cabac0
commit 2afee60a7c

View File

@ -24,7 +24,20 @@
extern "C" { extern "C" {
#endif #endif
#define BITS 32 // can be 32, 16 or 8 //------------------------------------------------------------------------------
// BITS can be either 32, 16 or 8. Pick values that fit natural register size.
#if defined(__i386__) || defined(_M_IX86) // x86 32bit
#define BITS 16
#elif defined(__arm__) || defined(_M_ARM) // ARM
#define BITS 8
#else // reasonable default
#define BITS 32
#endif
//------------------------------------------------------------------------------
// Derived types and constants
#define MASK ((((bit_t)1) << (BITS)) - 1) #define MASK ((((bit_t)1) << (BITS)) - 1)
#if (BITS == 32) #if (BITS == 32)
typedef uint64_t bit_t; // natural register type typedef uint64_t bit_t; // natural register type
@ -38,7 +51,7 @@ typedef uint8_t lbit_t;
#endif #endif
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Bitreader and code-tree reader // Bitreader
typedef struct VP8BitReader VP8BitReader; typedef struct VP8BitReader VP8BitReader;
struct VP8BitReader { struct VP8BitReader {
@ -151,7 +164,7 @@ static WEBP_INLINE int VP8GetSigned(VP8BitReader* const br, int v) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Bitreader // Bitreader for lossless format
typedef struct { typedef struct {
uint64_t val_; uint64_t val_;