Commit 4145bf05 authored by Urvang Joshi's avatar Urvang Joshi Committed by Yaowu Xu

Fix warnings reported by -Wshadow: Part4: main directory

Now that all warnings are taken care of, add warning flag -Wshadow to
configure.

Note: Enabling this flag for C++ generates some useless warnings about
some function parameters shadowing class member function names. So, only
enabling this warning for C code.

Cherry-picked from aomedia/master: b96cbc44

Change-Id: I3922dea2e6976b16519c4aa4d1bd395c198134f1
parent 88a03bb6
......@@ -893,7 +893,7 @@ static int main_loop(int argc, const char **argv_) {
if (single_file) {
if (use_y4m) {
char buf[Y4M_BUFFER_SIZE] = { 0 };
char y4m_buf[Y4M_BUFFER_SIZE] = { 0 };
size_t len = 0;
if (img->fmt == AOM_IMG_FMT_I440 || img->fmt == AOM_IMG_FMT_I44016) {
fprintf(stderr, "Cannot produce y4m output for 440 sampling.\n");
......@@ -902,21 +902,22 @@ static int main_loop(int argc, const char **argv_) {
if (frame_out == 1) {
// Y4M file header
len = y4m_write_file_header(
buf, sizeof(buf), aom_input_ctx.width, aom_input_ctx.height,
&aom_input_ctx.framerate, img->fmt, img->bit_depth);
y4m_buf, sizeof(y4m_buf), aom_input_ctx.width,
aom_input_ctx.height, &aom_input_ctx.framerate, img->fmt,
img->bit_depth);
if (do_md5) {
MD5Update(&md5_ctx, (md5byte *)buf, (unsigned int)len);
MD5Update(&md5_ctx, (md5byte *)y4m_buf, (unsigned int)len);
} else {
fputs(buf, outfile);
fputs(y4m_buf, outfile);
}
}
// Y4M frame header
len = y4m_write_frame_header(buf, sizeof(buf));
len = y4m_write_frame_header(y4m_buf, sizeof(y4m_buf));
if (do_md5) {
MD5Update(&md5_ctx, (md5byte *)buf, (unsigned int)len);
MD5Update(&md5_ctx, (md5byte *)y4m_buf, (unsigned int)len);
} else {
fputs(buf, outfile);
fputs(y4m_buf, outfile);
}
} else {
if (frame_out == 1) {
......
......@@ -1753,13 +1753,11 @@ static void test_decode(struct stream_state *stream,
/* Get the internal reference frame */
if (strcmp(codec->name, "vp8") == 0) {
struct aom_ref_frame ref_enc, ref_dec;
int width, height;
width = (stream->config.cfg.g_w + 15) & ~15;
height = (stream->config.cfg.g_h + 15) & ~15;
aom_img_alloc(&ref_enc.img, AOM_IMG_FMT_I420, width, height, 1);
const unsigned int frame_width = (stream->config.cfg.g_w + 15) & ~15;
const unsigned int frame_height = (stream->config.cfg.g_h + 15) & ~15;
aom_img_alloc(&ref_enc.img, AOM_IMG_FMT_I420, frame_width, frame_height, 1);
enc_img = ref_enc.img;
aom_img_alloc(&ref_dec.img, AOM_IMG_FMT_I420, width, height, 1);
aom_img_alloc(&ref_dec.img, AOM_IMG_FMT_I420, frame_width, frame_height, 1);
dec_img = ref_dec.img;
ref_enc.frame_type = AOM_LAST_FRAME;
......@@ -2131,10 +2129,10 @@ int main(int argc, const char **argv_) {
} else {
const int64_t input_pos = ftello(input.file);
const int64_t input_pos_lagged = input_pos - lagged_count;
const int64_t limit = input.length;
const int64_t input_limit = input.length;
rate = cx_time ? input_pos_lagged * (int64_t)1000000 / cx_time : 0;
remaining = limit - input_pos + lagged_count;
remaining = input_limit - input_pos + lagged_count;
}
average_rate =
......
......@@ -9381,7 +9381,7 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
int best_rate_nocoef;
#endif
int64_t distortion2 = 0, distortion_y = 0, dummy_rd = best_rd, this_rd;
int skippable = 0, rate_overhead = 0;
int skippable = 0;
TX_SIZE best_tx_size, uv_tx;
TX_TYPE best_tx_type;
PALETTE_MODE_INFO palette_mode_info;
......@@ -9389,6 +9389,7 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
x->palette_buffer->best_palette_color_map;
uint8_t *const color_map = xd->plane[0].color_index_map;
rate_overhead = 0;
mbmi->mode = DC_PRED;
mbmi->uv_mode = DC_PRED;
mbmi->ref_frame[0] = INTRA_FRAME;
......@@ -9551,7 +9552,6 @@ PALETTE_EXIT:
nearmv[1] = frame_mv[NEARMV][refs[1]];
}
#else
int i;
int ref_set = (mbmi_ext->ref_mv_count[rf_type] >= 2)
? AOMMIN(2, mbmi_ext->ref_mv_count[rf_type] - 2)
: INT_MAX;
......
......@@ -611,6 +611,10 @@ process_toolchain() {
check_add_cflags -Wuninitialized
check_add_cflags -Wunused-variable
check_add_cflags -Wsign-compare
# Enabling the following warning for C++ generates some useless warnings
# about some function parameters shadowing class member function names.
# So, only enable this warning for C code.
check_cflags "-Wshadow" && add_cflags_only "-Wshadow"
case ${CC} in
*clang*) ;;
*) check_add_cflags -Wunused-but-set-variable ;;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment