mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-16 22:09:57 +02:00
remove some -Wshadow warnings
these are quite noisy, but it's not a big deal to remove them. Change-Id: I5deb08f10263feb77e2cc8a70be44ad4f725febd
This commit is contained in:
@ -88,9 +88,9 @@ static int EncodeLossless(const uint8_t* const data, int width, int height,
|
||||
ok = ok && (VP8LEncodeStream(&config, &picture, &tmp_bw) == VP8_ENC_OK);
|
||||
WebPPictureFree(&picture);
|
||||
if (ok) {
|
||||
const uint8_t* const data = VP8LBitWriterFinish(&tmp_bw);
|
||||
const size_t data_size = VP8LBitWriterNumBytes(&tmp_bw);
|
||||
VP8BitWriterAppend(bw, data, data_size);
|
||||
const uint8_t* const buffer = VP8LBitWriterFinish(&tmp_bw);
|
||||
const size_t buffer_size = VP8LBitWriterNumBytes(&tmp_bw);
|
||||
VP8BitWriterAppend(bw, buffer, buffer_size);
|
||||
}
|
||||
VP8LBitWriterDestroy(&tmp_bw);
|
||||
return ok && !bw->error_;
|
||||
|
@ -157,18 +157,19 @@ static void GetParamsForHashChainFindCopy(int quality, int xsize,
|
||||
}
|
||||
|
||||
static int HashChainFindCopy(const HashChain* const p,
|
||||
int index, int xsize,
|
||||
int base_position, int xsize,
|
||||
const uint32_t* const argb, int maxlen,
|
||||
int window_size, int iter_pos, int iter_limit,
|
||||
int* const distance_ptr,
|
||||
int* const length_ptr) {
|
||||
const uint64_t hash_code = GetPixPairHash64(&argb[index]);
|
||||
const uint64_t hash_code = GetPixPairHash64(&argb[base_position]);
|
||||
int prev_length = 0;
|
||||
int64_t best_val = 0;
|
||||
int best_length = 0;
|
||||
int best_distance = 0;
|
||||
const uint32_t* const argb_start = argb + index;
|
||||
const int min_pos = (index > window_size) ? index - window_size : 0;
|
||||
const uint32_t* const argb_start = argb + base_position;
|
||||
const int min_pos =
|
||||
(base_position > window_size) ? base_position - window_size : 0;
|
||||
int pos;
|
||||
|
||||
assert(xsize > 0);
|
||||
@ -193,9 +194,9 @@ static int HashChainFindCopy(const HashChain* const p,
|
||||
}
|
||||
val = 65536 * curr_length;
|
||||
// Favoring 2d locality here gives savings for certain images.
|
||||
if (index - pos < 9 * xsize) {
|
||||
const int y = (index - pos) / xsize;
|
||||
int x = (index - pos) % xsize;
|
||||
if (base_position - pos < 9 * xsize) {
|
||||
const int y = (base_position - pos) / xsize;
|
||||
int x = (base_position - pos) % xsize;
|
||||
if (x > xsize / 2) {
|
||||
x = xsize - x;
|
||||
}
|
||||
@ -211,7 +212,7 @@ static int HashChainFindCopy(const HashChain* const p,
|
||||
prev_length = curr_length;
|
||||
best_val = val;
|
||||
best_length = curr_length;
|
||||
best_distance = index - pos;
|
||||
best_distance = base_position - pos;
|
||||
if (curr_length >= MAX_LENGTH) {
|
||||
break;
|
||||
}
|
||||
|
@ -65,11 +65,11 @@ static WEBP_INLINE int BitsLog2Floor(uint32_t n) {
|
||||
#endif
|
||||
|
||||
static WEBP_INLINE int VP8LBitsLog2Ceiling(uint32_t n) {
|
||||
const int floor = BitsLog2Floor(n);
|
||||
const int log_floor = BitsLog2Floor(n);
|
||||
if (n == (n & ~(n - 1))) // zero or a power of two.
|
||||
return floor;
|
||||
return log_floor;
|
||||
else
|
||||
return floor + 1;
|
||||
return log_floor + 1;
|
||||
}
|
||||
|
||||
// Splitting of distance and length codes into prefixes and
|
||||
|
@ -281,11 +281,11 @@ static void SetResidualCoeffs(const int16_t* const coeffs,
|
||||
//------------------------------------------------------------------------------
|
||||
// Mode costs
|
||||
|
||||
static int GetResidualCost(int ctx, const VP8Residual* const res) {
|
||||
static int GetResidualCost(int ctx0, const VP8Residual* const res) {
|
||||
int n = res->first;
|
||||
// should be prob[VP8EncBands[n]], but it's equivalent for n=0 or 1
|
||||
int p0 = res->prob[n][ctx][0];
|
||||
const uint16_t* t = res->cost[n][ctx];
|
||||
int p0 = res->prob[n][ctx0][0];
|
||||
const uint16_t* t = res->cost[n][ctx0];
|
||||
int cost;
|
||||
|
||||
if (res->last < 0) {
|
||||
@ -320,8 +320,8 @@ static int GetResidualCost(int ctx, const VP8Residual* const res) {
|
||||
if (n < 15) {
|
||||
const int b = VP8EncBands[n + 1];
|
||||
const int ctx = (v == 1) ? 1 : 2;
|
||||
const int p0 = res->prob[b][ctx][0];
|
||||
cost += VP8BitCost(0, p0);
|
||||
const int last_p0 = res->prob[b][ctx][0];
|
||||
cost += VP8BitCost(0, last_p0);
|
||||
}
|
||||
}
|
||||
return cost;
|
||||
|
@ -806,11 +806,11 @@ int WebPPictureYUVAToARGB(WebPPicture* picture) {
|
||||
// Insert alpha values if needed, in replacement for the default 0xff ones.
|
||||
if (picture->colorspace & WEBP_CSP_ALPHA_BIT) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
uint32_t* const dst = picture->argb + y * picture->argb_stride;
|
||||
uint32_t* const argb_dst = picture->argb + y * picture->argb_stride;
|
||||
const uint8_t* const src = picture->a + y * picture->a_stride;
|
||||
int x;
|
||||
for (x = 0; x < width; ++x) {
|
||||
dst[x] = (dst[x] & 0x00ffffffu) | (src[x] << 24);
|
||||
argb_dst[x] = (argb_dst[x] & 0x00ffffffu) | (src[x] << 24);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -926,17 +926,17 @@ static float AccumulateLSIM(const uint8_t* src, int src_stride,
|
||||
int x, y;
|
||||
double total_sse = 0.;
|
||||
for (y = 0; y < h; ++y) {
|
||||
const int y0 = (y - RADIUS < 0) ? 0 : y - RADIUS;
|
||||
const int y1 = (y + RADIUS + 1 >= h) ? h : y + RADIUS + 1;
|
||||
const int y_0 = (y - RADIUS < 0) ? 0 : y - RADIUS;
|
||||
const int y_1 = (y + RADIUS + 1 >= h) ? h : y + RADIUS + 1;
|
||||
for (x = 0; x < w; ++x) {
|
||||
const int x0 = (x - RADIUS < 0) ? 0 : x - RADIUS;
|
||||
const int x1 = (x + RADIUS + 1 >= w) ? w : x + RADIUS + 1;
|
||||
const int x_0 = (x - RADIUS < 0) ? 0 : x - RADIUS;
|
||||
const int x_1 = (x + RADIUS + 1 >= w) ? w : x + RADIUS + 1;
|
||||
double best_sse = 255. * 255.;
|
||||
const double value = (double)ref[y * ref_stride + x];
|
||||
int i, j;
|
||||
for (j = y0; j < y1; ++j) {
|
||||
for (j = y_0; j < y_1; ++j) {
|
||||
const uint8_t* s = src + j * src_stride;
|
||||
for (i = x0; i < x1; ++i) {
|
||||
for (i = x_0; i < x_1; ++i) {
|
||||
const double sse = (double)(s[i] - value) * (s[i] - value);
|
||||
if (sse < best_sse) best_sse = sse;
|
||||
}
|
||||
|
@ -407,9 +407,10 @@ static int StoreHuffmanCode(VP8LBitWriter* const bw,
|
||||
}
|
||||
|
||||
static void WriteHuffmanCode(VP8LBitWriter* const bw,
|
||||
const HuffmanTreeCode* const code, int index) {
|
||||
const int depth = code->code_lengths[index];
|
||||
const int symbol = code->codes[index];
|
||||
const HuffmanTreeCode* const code,
|
||||
int code_index) {
|
||||
const int depth = code->code_lengths[code_index];
|
||||
const int symbol = code->codes[code_index];
|
||||
VP8LWriteBits(bw, depth, symbol);
|
||||
}
|
||||
|
||||
@ -577,10 +578,10 @@ static int EncodeImageInternal(VP8LBitWriter* const bw,
|
||||
uint32_t i;
|
||||
if (histogram_argb == NULL) goto Error;
|
||||
for (i = 0; i < histogram_image_xysize; ++i) {
|
||||
const int index = histogram_symbols[i] & 0xffff;
|
||||
histogram_argb[i] = 0xff000000 | (index << 8);
|
||||
if (index >= max_index) {
|
||||
max_index = index + 1;
|
||||
const int symbol_index = histogram_symbols[i] & 0xffff;
|
||||
histogram_argb[i] = 0xff000000 | (symbol_index << 8);
|
||||
if (symbol_index >= max_index) {
|
||||
max_index = symbol_index + 1;
|
||||
}
|
||||
}
|
||||
histogram_image_size = max_index;
|
||||
|
Reference in New Issue
Block a user