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

@ -919,15 +919,14 @@ void VP8LResidualImage(int width, int height, int bits, int low_effort,
used_subtract_green);
}
void VP8LSubtractGreenFromBlueAndRed_C(uint32_t* const argb_data,
int num_pixels) {
void VP8LSubtractGreenFromBlueAndRed_C(uint32_t* argb_data, int num_pixels) {
int i;
for (i = 0; i < num_pixels; ++i) {
const int argb = argb_data[i];
const int green = (argb >> 8) & 0xff;
const uint32_t argb = argb_data[i];
const uint32_t green = (argb >> 8) & 0xff;
const uint32_t new_r = (((argb >> 16) & 0xff) - green) & 0xff;
const uint32_t new_b = (((argb >> 0) & 0xff) - green) & 0xff;
argb_data[i] = (argb & 0xff00ff00u) | (new_r << 16) | new_b;
const uint32_t new_b = ((argb & 0xff) - green) & 0xff;
argb_data[i] = (argb & 0xff00ff00) | (new_r << 16) | new_b;
}
}
@ -937,9 +936,9 @@ static WEBP_INLINE void MultipliersClear(VP8LMultipliers* const m) {
m->red_to_blue_ = 0;
}
static WEBP_INLINE int ColorTransformDelta(int8_t color_pred,
int8_t color) {
return ((int)(color_pred) * color) >> 5;
static WEBP_INLINE uint32_t ColorTransformDelta(int8_t color_pred,
int8_t color) {
return (uint32_t)((int)(color_pred) * color) >> 5;
}
static WEBP_INLINE void ColorCodeToMultipliers(uint32_t color_code,
@ -964,8 +963,8 @@ void VP8LTransformColor_C(const VP8LMultipliers* const m, uint32_t* data,
const uint32_t argb = data[i];
const uint32_t green = argb >> 8;
const uint32_t red = argb >> 16;
int new_red = red;
int new_blue = argb;
uint32_t new_red = red;
uint32_t new_blue = argb;
new_red -= ColorTransformDelta(m->green_to_red_, green);
new_red &= 0xff;
new_blue -= ColorTransformDelta(m->green_to_blue_, green);
@ -978,7 +977,7 @@ void VP8LTransformColor_C(const VP8LMultipliers* const m, uint32_t* data,
static WEBP_INLINE uint8_t TransformColorRed(uint8_t green_to_red,
uint32_t argb) {
const uint32_t green = argb >> 8;
int new_red = argb >> 16;
uint32_t new_red = argb >> 16;
new_red -= ColorTransformDelta(green_to_red, green);
return (new_red & 0xff);
}