Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: third_party/libwebp/utils/random.h

Issue 421003002: libwebp: update to 0.4.1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 0.4.1-final Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/libwebp/utils/quant_levels_dec.c ('k') | third_party/libwebp/utils/rescaler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libwebp/utils/random.h
diff --git a/third_party/libwebp/utils/random.h b/third_party/libwebp/utils/random.h
index 08a83e9674ceab7802136d9d1ad2dd75bf11600a..c392a615caf947cdc9913bd92175e6b4ec38b118 100644
--- a/third_party/libwebp/utils/random.h
+++ b/third_party/libwebp/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;
« no previous file with comments | « third_party/libwebp/utils/quant_levels_dec.c ('k') | third_party/libwebp/utils/rescaler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698