VP8LDoFillBitWindow: support big-endian in fast path

Change-Id: I577944fe0b85505766050dba5ab5aec48b30f541
This commit is contained in:
James Zern 2016-05-20 00:26:30 -07:00
parent ac49e4e4dc
commit 576362abd7

View File

@ -120,10 +120,9 @@ int32_t VP8GetSignedValue(VP8BitReader* const br, int bits) {
#define VP8L_LOG8_WBITS 4 // Number of bytes needed to store VP8L_WBITS bits. #define VP8L_LOG8_WBITS 4 // Number of bytes needed to store VP8L_WBITS bits.
#if !defined(WORDS_BIGENDIAN) && \ #if defined(__arm__) || defined(_M_ARM) || defined(__aarch64__) || \
(defined(__arm__) || defined(_M_ARM) || defined(__aarch64__) || \
defined(__i386__) || defined(_M_IX86) || \ defined(__i386__) || defined(_M_IX86) || \
defined(__x86_64__) || defined(_M_X64)) defined(__x86_64__) || defined(_M_X64)
#define VP8L_USE_FAST_LOAD #define VP8L_USE_FAST_LOAD
#endif #endif
@ -196,9 +195,7 @@ void VP8LDoFillBitWindow(VP8LBitReader* const br) {
if (br->pos_ + sizeof(br->val_) < br->len_) { if (br->pos_ + sizeof(br->val_) < br->len_) {
br->val_ >>= VP8L_WBITS; br->val_ >>= VP8L_WBITS;
br->bit_pos_ -= VP8L_WBITS; br->bit_pos_ -= VP8L_WBITS;
// The expression below needs a little-endian arch to work correctly. br->val_ |= (vp8l_val_t)HToLE32(WebPMemToUint32(br->buf_ + br->pos_)) <<
// This gives a large speedup for decoding speed.
br->val_ |= (vp8l_val_t)WebPMemToUint32(br->buf_ + br->pos_) <<
(VP8L_LBITS - VP8L_WBITS); (VP8L_LBITS - VP8L_WBITS);
br->pos_ += VP8L_LOG8_WBITS; br->pos_ += VP8L_LOG8_WBITS;
return; return;