From 30abc082119d2c76aa8f009228c17e173e6bd85b Mon Sep 17 00:00:00 2001 From: Urvang Joshi <urvang@google.com> Date: Wed, 20 Jul 2016 15:17:19 -0700 Subject: [PATCH] Fix warnings reported by -Wshadow: Part1b: scan_order struct and variable - Change struct name to all caps SCAN_ORDER to be locally consistent. - Rename struct pointers to 'scan_order' instead of hard to read short names 'so' and 'sc'. Change-Id: Ia131f14320c1a18aa12654cdb87bf8008878950a --- av1/common/scan.c | 4 ++-- av1/common/scan.h | 8 +++---- av1/decoder/decodeframe.c | 12 +++++----- av1/decoder/detokenize.c | 2 +- av1/decoder/detokenize.h | 2 +- av1/encoder/encodemb.c | 12 +++++----- av1/encoder/rdopt.c | 46 +++++++++++++++++++++------------------ av1/encoder/tokenize.c | 6 ++--- test/quantize_test.cc | 8 +++---- 9 files changed, 52 insertions(+), 48 deletions(-) diff --git a/av1/common/scan.c b/av1/common/scan.c index 0d1eb0abc5..a77e03e550 100644 --- a/av1/common/scan.c +++ b/av1/common/scan.c @@ -690,14 +690,14 @@ DECLARE_ALIGNED(16, static const int16_t, av1_default_iscan_32x32[1024]) = { 967, 973, 988, 996, 1002, 1006, 1014, 1018, 1021, 1023, }; -const scan_order av1_default_scan_orders[TX_SIZES] = { +const SCAN_ORDER av1_default_scan_orders[TX_SIZES] = { { default_scan_4x4, av1_default_iscan_4x4, default_scan_4x4_neighbors }, { default_scan_8x8, av1_default_iscan_8x8, default_scan_8x8_neighbors }, { default_scan_16x16, av1_default_iscan_16x16, default_scan_16x16_neighbors }, { default_scan_32x32, av1_default_iscan_32x32, default_scan_32x32_neighbors }, }; -const scan_order av1_scan_orders[TX_SIZES][TX_TYPES] = { +const SCAN_ORDER av1_scan_orders[TX_SIZES][TX_TYPES] = { { // TX_4X4 { default_scan_4x4, av1_default_iscan_4x4, default_scan_4x4_neighbors }, { row_scan_4x4, av1_row_iscan_4x4, row_scan_4x4_neighbors }, diff --git a/av1/common/scan.h b/av1/common/scan.h index 27cb99da8c..b2531d5c26 100644 --- a/av1/common/scan.h +++ b/av1/common/scan.h @@ -28,10 +28,10 @@ typedef struct { const int16_t *scan; const int16_t *iscan; const int16_t *neighbors; -} scan_order; +} SCAN_ORDER; -extern const scan_order av1_default_scan_orders[TX_SIZES]; -extern const scan_order av1_scan_orders[TX_SIZES][TX_TYPES]; +extern const SCAN_ORDER av1_default_scan_orders[TX_SIZES]; +extern const SCAN_ORDER av1_scan_orders[TX_SIZES][TX_TYPES]; static INLINE int get_coef_context(const int16_t *neighbors, const uint8_t *token_cache, int c) { @@ -40,7 +40,7 @@ static INLINE int get_coef_context(const int16_t *neighbors, 1; } -static INLINE const scan_order *get_scan(TX_SIZE tx_size, TX_TYPE tx_type) { +static INLINE const SCAN_ORDER *get_scan(TX_SIZE tx_size, TX_TYPE tx_type) { return &av1_scan_orders[tx_size][tx_type]; } diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index c9e7188564..65e0cf8790 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c @@ -395,9 +395,9 @@ static void predict_and_reconstruct_intra_block(MACROBLOCKD *const xd, if (!mbmi->skip) { TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx); - const scan_order *sc = get_scan(tx_size, tx_type); - const int eob = av1_decode_block_tokens(xd, plane, sc, col, row, tx_size, r, - mbmi->segment_id); + const SCAN_ORDER *scan_order = get_scan(tx_size, tx_type); + const int eob = av1_decode_block_tokens(xd, plane, scan_order, col, row, + tx_size, r, mbmi->segment_id); inverse_transform_block_intra(xd, plane, tx_type, tx_size, dst, pd->dst.stride, eob); } @@ -410,9 +410,9 @@ static int reconstruct_inter_block(MACROBLOCKD *const xd, aom_reader *r, PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV; int block_idx = (row << 1) + col; TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx); - const scan_order *sc = get_scan(tx_size, tx_type); - const int eob = av1_decode_block_tokens(xd, plane, sc, col, row, tx_size, r, - mbmi->segment_id); + const SCAN_ORDER *scan_order = get_scan(tx_size, tx_type); + const int eob = av1_decode_block_tokens(xd, plane, scan_order, col, row, + tx_size, r, mbmi->segment_id); inverse_transform_block_inter( xd, plane, tx_size, &pd->dst.buf[4 * row * pd->dst.stride + 4 * col], diff --git a/av1/decoder/detokenize.c b/av1/decoder/detokenize.c index 1f85997f76..72752d93fe 100644 --- a/av1/decoder/detokenize.c +++ b/av1/decoder/detokenize.c @@ -276,7 +276,7 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type, return c; } -int av1_decode_block_tokens(MACROBLOCKD *xd, int plane, const scan_order *sc, +int av1_decode_block_tokens(MACROBLOCKD *xd, int plane, const SCAN_ORDER *sc, int x, int y, TX_SIZE tx_size, aom_reader *r, int seg_id) { struct macroblockd_plane *const pd = &xd->plane[plane]; diff --git a/av1/decoder/detokenize.h b/av1/decoder/detokenize.h index 807781119f..e88c21db48 100644 --- a/av1/decoder/detokenize.h +++ b/av1/decoder/detokenize.h @@ -20,7 +20,7 @@ extern "C" { #endif -int av1_decode_block_tokens(MACROBLOCKD *xd, int plane, const scan_order *sc, +int av1_decode_block_tokens(MACROBLOCKD *xd, int plane, const SCAN_ORDER *sc, int x, int y, TX_SIZE tx_size, aom_reader *r, int seg_id); diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c index 2eadaaa7c5..5e0025b58d 100644 --- a/av1/encoder/encodemb.c +++ b/av1/encoder/encodemb.c @@ -111,9 +111,9 @@ static int optimize_b(MACROBLOCK *mb, int plane, int block, TX_SIZE tx_size, const int16_t *dequant_ptr = pd->dequant; const uint8_t *const band_translate = get_band_translate(tx_size); TX_TYPE tx_type = get_tx_type(type, xd, block); - const scan_order *const so = get_scan(tx_size, tx_type); - const int16_t *const scan = so->scan; - const int16_t *const nb = so->neighbors; + const SCAN_ORDER *const scan_order = get_scan(tx_size, tx_type); + const int16_t *const scan = scan_order->scan; + const int16_t *const nb = scan_order->neighbors; int next = eob, sz = 0; int64_t rdmult = mb->rdmult * plane_rd_mult[type], rddiv = mb->rddiv; int64_t rd_cost0, rd_cost1; @@ -342,7 +342,7 @@ void av1_xform_quant_fp(MACROBLOCK *x, int plane, int block, int blk_row, const struct macroblockd_plane *const pd = &xd->plane[plane]; PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV; TX_TYPE tx_type = get_tx_type(plane_type, xd, block); - const scan_order *const scan_order = get_scan(tx_size, tx_type); + const SCAN_ORDER *const scan_order = get_scan(tx_size, tx_type); tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block); tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block); tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block); @@ -599,7 +599,7 @@ void av1_xform_quant(MACROBLOCK *x, int plane, int block, int blk_row, const struct macroblockd_plane *const pd = &xd->plane[plane]; PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV; TX_TYPE tx_type = get_tx_type(plane_type, xd, block); - const scan_order *const scan_order = get_scan(tx_size, tx_type); + const SCAN_ORDER *const scan_order = get_scan(tx_size, tx_type); tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block); tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block); tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block); @@ -919,7 +919,7 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col, tran_low_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block); PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV; TX_TYPE tx_type = get_tx_type(plane_type, xd, block); - const scan_order *const scan_order = get_scan(tx_size, tx_type); + const SCAN_ORDER *const scan_order = get_scan(tx_size, tx_type); PREDICTION_MODE mode; const int bwl = b_width_log2_lookup[plane_bsize]; const int bhl = b_height_log2_lookup[plane_bsize]; diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c index cb8eb2c398..3f4bba092e 100644 --- a/av1/encoder/rdopt.c +++ b/av1/encoder/rdopt.c @@ -105,7 +105,7 @@ struct rdcost_block_args { int64_t best_rd; int exit_early; int use_fast_coef_costing; - const scan_order *so; + const SCAN_ORDER *scan_order; uint8_t skippable; }; @@ -539,8 +539,8 @@ static void dist_block(MACROBLOCK *x, int plane, int block, TX_SIZE tx_size, static int rate_block(int plane, int block, int blk_row, int blk_col, TX_SIZE tx_size, struct rdcost_block_args *args) { return cost_coeffs(args->x, plane, block, args->t_above + blk_col, - args->t_left + blk_row, tx_size, args->so->scan, - args->so->neighbors, args->use_fast_coef_costing); + args->t_left + blk_row, tx_size, args->scan_order->scan, + args->scan_order->neighbors, args->use_fast_coef_costing); } static void block_rd_txfm(int plane, int block, int blk_row, int blk_col, @@ -649,7 +649,7 @@ static void txfm_rd_in_plane(MACROBLOCK *x, int *rate, int64_t *distortion, av1_get_entropy_contexts(bsize, tx_size, pd, args.t_above, args.t_left); tx_type = get_tx_type(pd->plane_type, xd, 0); - args.so = get_scan(tx_size, tx_type); + args.scan_order = get_scan(tx_size, tx_type); av1_foreach_transformed_block_in_plane(xd, bsize, plane, block_rd_txfm, &args); @@ -961,11 +961,12 @@ static int64_t rd_pick_intra4x4block(const AV1_COMP *const cpi, MACROBLOCK *x, dst_stride, xd->bd); if (xd->lossless[xd->mi[0]->mbmi.segment_id]) { TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block); - const scan_order *so = get_scan(TX_4X4, tx_type); + const SCAN_ORDER *scan_order = get_scan(TX_4X4, tx_type); av1_highbd_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, 1); - av1_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan); + av1_regular_quantize_b_4x4(x, 0, block, scan_order->scan, + scan_order->iscan); ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4, - so->scan, so->neighbors, + scan_order->scan, scan_order->neighbors, cpi->sf.use_fast_coef_costing); if (RDCOST(x->rdmult, x->rddiv, ratey, distortion) >= best_rd) goto next_highbd; @@ -975,11 +976,12 @@ static int64_t rd_pick_intra4x4block(const AV1_COMP *const cpi, MACROBLOCK *x, } else { int64_t unused; TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block); - const scan_order *so = get_scan(TX_4X4, tx_type); + const SCAN_ORDER *scan_order = get_scan(TX_4X4, tx_type); av1_highbd_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, 0); - av1_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan); + av1_regular_quantize_b_4x4(x, 0, block, scan_order->scan, + scan_order->iscan); ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4, - so->scan, so->neighbors, + scan_order->scan, scan_order->neighbors, cpi->sf.use_fast_coef_costing); distortion += av1_highbd_block_error(coeff, BLOCK_OFFSET(pd->dqcoeff, block), @@ -1056,11 +1058,12 @@ static int64_t rd_pick_intra4x4block(const AV1_COMP *const cpi, MACROBLOCK *x, if (xd->lossless[xd->mi[0]->mbmi.segment_id]) { TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block); - const scan_order *so = get_scan(TX_4X4, tx_type); + const SCAN_ORDER *scan_order = get_scan(TX_4X4, tx_type); av1_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, 1); - av1_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan); + av1_regular_quantize_b_4x4(x, 0, block, scan_order->scan, + scan_order->iscan); ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4, - so->scan, so->neighbors, + scan_order->scan, scan_order->neighbors, cpi->sf.use_fast_coef_costing); if (RDCOST(x->rdmult, x->rddiv, ratey, distortion) >= best_rd) goto next; @@ -1069,11 +1072,12 @@ static int64_t rd_pick_intra4x4block(const AV1_COMP *const cpi, MACROBLOCK *x, } else { int64_t unused; TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block); - const scan_order *so = get_scan(TX_4X4, tx_type); + const SCAN_ORDER *scan_order = get_scan(TX_4X4, tx_type); av1_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, 0); - av1_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan); + av1_regular_quantize_b_4x4(x, 0, block, scan_order->scan, + scan_order->iscan); ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4, - so->scan, so->neighbors, + scan_order->scan, scan_order->neighbors, cpi->sf.use_fast_coef_costing); distortion += av1_block_error(coeff, BLOCK_OFFSET(pd->dqcoeff, block), 16, &unused) >> @@ -1912,7 +1916,7 @@ static int64_t encode_inter_mb_segment(const AV1_COMP *const cpi, MACROBLOCK *x, int64_t thisdistortion = 0, thissse = 0; int thisrate = 0; TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, i); - const scan_order *so = get_scan(TX_4X4, tx_type); + const SCAN_ORDER *scan_order = get_scan(TX_4X4, tx_type); av1_build_inter_predictor_sub8x8(xd, 0, i, ir, ic, mi_row, mi_col); @@ -1953,7 +1957,7 @@ static int64_t encode_inter_mb_segment(const AV1_COMP *const cpi, MACROBLOCK *x, coeff = BLOCK_OFFSET(p->coeff, k); fwd_txm4x4(av1_raster_block_offset_int16(BLOCK_8X8, k, p->src_diff), coeff, 8); - av1_regular_quantize_b_4x4(x, 0, k, so->scan, so->iscan); + av1_regular_quantize_b_4x4(x, 0, k, scan_order->scan, scan_order->iscan); #if CONFIG_AOM_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { thisdistortion += av1_highbd_block_error( @@ -1967,9 +1971,9 @@ static int64_t encode_inter_mb_segment(const AV1_COMP *const cpi, MACROBLOCK *x, av1_block_error(coeff, BLOCK_OFFSET(pd->dqcoeff, k), 16, &ssz); #endif // CONFIG_AOM_HIGHBITDEPTH thissse += ssz; - thisrate += - cost_coeffs(x, 0, k, ta + (k & 1), tl + (k >> 1), TX_4X4, so->scan, - so->neighbors, cpi->sf.use_fast_coef_costing); + thisrate += cost_coeffs(x, 0, k, ta + (k & 1), tl + (k >> 1), TX_4X4, + scan_order->scan, scan_order->neighbors, + cpi->sf.use_fast_coef_costing); rd1 = RDCOST(x->rdmult, x->rddiv, thisrate, thisdistortion >> 2); rd2 = RDCOST(x->rdmult, x->rddiv, 0, thissse >> 2); rd = AOMMIN(rd1, rd2); diff --git a/av1/encoder/tokenize.c b/av1/encoder/tokenize.c index 50febaa656..75f4876c32 100644 --- a/av1/encoder/tokenize.c +++ b/av1/encoder/tokenize.c @@ -408,7 +408,7 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col, const int segment_id = mbmi->segment_id; const int16_t *scan, *nb; const TX_TYPE tx_type = get_tx_type(type, xd, block); - const scan_order *const so = get_scan(tx_size, tx_type); + const SCAN_ORDER *const scan_order = get_scan(tx_size, tx_type); const int ref = is_inter_block(mbmi); unsigned int (*const counts)[COEFF_CONTEXTS][ENTROPY_TOKENS] = td->rd_counts.coef_counts[tx_size][type][ref]; @@ -427,8 +427,8 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col, (void)plane_bsize; pt = get_entropy_context(tx_size, pd->above_context + blk_col, pd->left_context + blk_row); - scan = so->scan; - nb = so->neighbors; + scan = scan_order->scan; + nb = scan_order->neighbors; c = 0; while (c < eob) { diff --git a/test/quantize_test.cc b/test/quantize_test.cc index c72dd2d0c6..ec945ee183 100644 --- a/test/quantize_test.cc +++ b/test/quantize_test.cc @@ -101,7 +101,7 @@ TEST_P(AV1QuantizeTest, OperationCheck) { const int skip_block = i == 0; const TX_SIZE sz = (TX_SIZE)(i % 3); // TX_4X4, TX_8X8 TX_16X16 const TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3); - const scan_order *scan_order = &av1_scan_orders[sz][tx_type]; + const SCAN_ORDER *scan_order = &av1_scan_orders[sz][tx_type]; const int count = (4 << sz) * (4 << sz); // 16, 64, 256 int err_count = 0; *eob_ptr = rnd.Rand16(); @@ -159,7 +159,7 @@ TEST_P(AV1Quantize32Test, OperationCheck) { const int skip_block = i == 0; const TX_SIZE sz = TX_32X32; const TX_TYPE tx_type = (TX_TYPE)(i % 4); - const scan_order *scan_order = &av1_scan_orders[sz][tx_type]; + const SCAN_ORDER *scan_order = &av1_scan_orders[sz][tx_type]; const int count = (4 << sz) * (4 << sz); // 1024 int err_count = 0; *eob_ptr = rnd.Rand16(); @@ -217,7 +217,7 @@ TEST_P(AV1QuantizeTest, EOBCheck) { int skip_block = i == 0; TX_SIZE sz = (TX_SIZE)(i % 3); // TX_4X4, TX_8X8 TX_16X16 TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3); - const scan_order *scan_order = &av1_scan_orders[sz][tx_type]; + const SCAN_ORDER *scan_order = &av1_scan_orders[sz][tx_type]; int count = (4 << sz) * (4 << sz); // 16, 64, 256 int err_count = 0; *eob_ptr = rnd.Rand16(); @@ -280,7 +280,7 @@ TEST_P(AV1Quantize32Test, EOBCheck) { int skip_block = i == 0; TX_SIZE sz = TX_32X32; TX_TYPE tx_type = (TX_TYPE)(i % 4); - const scan_order *scan_order = &av1_scan_orders[sz][tx_type]; + const SCAN_ORDER *scan_order = &av1_scan_orders[sz][tx_type]; int count = (4 << sz) * (4 << sz); // 1024 int err_count = 0; *eob_ptr = rnd.Rand16(); -- GitLab