diff options
Diffstat (limited to 'src/3rdparty/libwebp/src/utils/random.h')
-rw-r--r-- | src/3rdparty/libwebp/src/utils/random.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/3rdparty/libwebp/src/utils/random.h b/src/3rdparty/libwebp/src/utils/random.h index 08a83e9..c392a61 100644 --- a/src/3rdparty/libwebp/src/utils/random.h +++ b/src/3rdparty/libwebp/src/utils/random.h @@ -45,7 +45,8 @@ static WEBP_INLINE int VP8RandomBits2(VP8Random* const rg, int num_bits, rg->tab_[rg->index1_] = diff; if (++rg->index1_ == VP8_RANDOM_TABLE_SIZE) rg->index1_ = 0; if (++rg->index2_ == VP8_RANDOM_TABLE_SIZE) rg->index2_ = 0; - diff = (diff << 1) >> (32 - num_bits); // sign-extend, 0-center + // sign-extend, 0-center + diff = (int)((uint32_t)diff << 1) >> (32 - num_bits); diff = (diff * amp) >> VP8_RANDOM_DITHER_FIX; // restrict range diff += 1 << (num_bits - 1); // shift back to 0.5-center return diff; |