Revert "fix 'unsigned integer overflow' warnings in ubsan"

This reverts commit e44f5248ff.

contains unintentional changes in quant.c

Change-Id: I1928f072566788b0c9ea80f6fbc9e571061f9b3e
This commit is contained in:
James Zern
2016-08-16 16:54:42 -07:00
parent 9d4f209f80
commit 8a4ebc6ab0
7 changed files with 33 additions and 46 deletions

View File

@ -211,13 +211,13 @@ void VP8LHashChainClear(VP8LHashChain* const p) {
// -----------------------------------------------------------------------------
#define HASH_MULTIPLIER_HI (0xc6a4a793ULL)
#define HASH_MULTIPLIER_LO (0x5bd1e996ULL)
#define HASH_MULTIPLIER_HI (0xc6a4a793U)
#define HASH_MULTIPLIER_LO (0x5bd1e996U)
static WEBP_INLINE uint32_t GetPixPairHash64(const uint32_t* const argb) {
uint32_t key;
key = (argb[1] * HASH_MULTIPLIER_HI) & 0xffffffffu;
key += (argb[0] * HASH_MULTIPLIER_LO) & 0xffffffffu;
key = argb[1] * HASH_MULTIPLIER_HI;
key += argb[0] * HASH_MULTIPLIER_LO;
key = key >> (32 - HASH_BITS);
return key;
}

View File

@ -1004,7 +1004,7 @@ static int PickBestIntra4(VP8EncIterator* const it, VP8ModeScore* const rd) {
InitScore(&rd_i4);
VP8MakeIntra4Preds(it);
for (mode = 0; mode < 2 /*NUM_BMODES*/; ++mode) {
for (mode = 0; mode < NUM_BMODES; ++mode) {
VP8ModeScore rd_tmp;
int16_t tmp_levels[16];

View File

@ -163,25 +163,18 @@ typedef enum {
kHistoTotal // Must be last.
} HistoIx;
static void AddSingleSubGreen(int p, uint32_t* const r, uint32_t* const b) {
const int green = p >> 8; // The upper bits are masked away later.
static void AddSingleSubGreen(uint32_t p, uint32_t* r, uint32_t* b) {
const uint32_t green = p >> 8; // The upper bits are masked away later.
++r[((p >> 16) - green) & 0xff];
++b[((p >> 0) - green) & 0xff];
++b[(p - green) & 0xff];
}
static void AddSingle(uint32_t p,
uint32_t* const a, uint32_t* const r,
uint32_t* const g, uint32_t* const b) {
++a[(p >> 24) & 0xff];
uint32_t* a, uint32_t* r, uint32_t* g, uint32_t* b) {
++a[p >> 24];
++r[(p >> 16) & 0xff];
++g[(p >> 8) & 0xff];
++b[(p >> 0) & 0xff];
}
static WEBP_INLINE uint32_t HashPix(uint32_t pix) {
// Note that masking with 0xffffffffu is for preventing an
// 'unsigned int overflow' warning. Doesn't impact the compiled code.
return (((pix + (pix >> 19)) * 0x39c5fba7ull) & 0xffffffffu) >> 24;
++g[(p >> 8) & 0xff];
++b[(p & 0xff)];
}
static int AnalyzeEntropy(const uint32_t* argb,
@ -221,8 +214,8 @@ static int AnalyzeEntropy(const uint32_t* argb,
&histo[kHistoBluePredSubGreen * 256]);
{
// Approximate the palette by the entropy of the multiplicative hash.
const uint32_t hash = HashPix(pix);
++histo[kHistoPalette * 256 + hash];
const int hash = ((pix + (pix >> 19)) * 0x39c5fba7) >> 24;
++histo[kHistoPalette * 256 + (hash & 0xff)];
}
}
prev_row = curr_row;