From be77f6bbbfd0c573046a90528fcf20c1e3cd74f8 Mon Sep 17 00:00:00 2001 From: Dmitry Kovalev Date: Tue, 2 Jul 2013 16:51:57 -0700 Subject: [PATCH] Removing redundant struct from union b_mode_info. Change-Id: I08fc6e474ff2c12cfa065bae4989c724276e2c83 --- vp9/common/vp9_blockd.h | 6 ++---- vp9/common/vp9_findnearmv.h | 8 ++++---- vp9/common/vp9_postproc.c | 6 +++--- vp9/decoder/vp9_decodemv.c | 16 ++++++++-------- vp9/decoder/vp9_decodframe.c | 2 +- vp9/encoder/vp9_bitstream.c | 4 ++-- vp9/encoder/vp9_encodeframe.c | 2 +- vp9/encoder/vp9_encodemb.c | 2 +- vp9/encoder/vp9_rdopt.c | 12 ++++++------ 9 files changed, 28 insertions(+), 30 deletions(-) diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index fb5a58a..5507942 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -127,9 +127,7 @@ typedef enum { is a single probability table. */ union b_mode_info { - struct { - MB_PREDICTION_MODE first; - } as_mode; + MB_PREDICTION_MODE as_mode; int_mv as_mv[2]; // first, second inter predictor motion vectors }; @@ -491,7 +489,7 @@ static INLINE TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, int ib) { return DCT_DCT; return mode2txfm_map[mbmi->sb_type < BLOCK_SIZE_SB8X8 ? - mi->bmi[ib].as_mode.first : mbmi->mode]; + mi->bmi[ib].as_mode : mbmi->mode]; } static INLINE TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd) { diff --git a/vp9/common/vp9_findnearmv.h b/vp9/common/vp9_findnearmv.h index d4ae210..d68572b 100644 --- a/vp9/common/vp9_findnearmv.h +++ b/vp9/common/vp9_findnearmv.h @@ -86,13 +86,13 @@ static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b) { if (cur_mb->mbmi.ref_frame[0] != INTRA_FRAME) { return DC_PRED; } else if (cur_mb->mbmi.sb_type < BLOCK_SIZE_SB8X8) { - return ((cur_mb->bmi + 1 + b)->as_mode.first); + return ((cur_mb->bmi + 1 + b)->as_mode); } else { return cur_mb->mbmi.mode; } } assert(b == 1 || b == 3); - return (cur_mb->bmi + b - 1)->as_mode.first; + return (cur_mb->bmi + b - 1)->as_mode; } static MB_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb, @@ -104,13 +104,13 @@ static MB_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb, if (cur_mb->mbmi.ref_frame[0] != INTRA_FRAME) { return DC_PRED; } else if (cur_mb->mbmi.sb_type < BLOCK_SIZE_SB8X8) { - return ((cur_mb->bmi + 2 + b)->as_mode.first); + return ((cur_mb->bmi + 2 + b)->as_mode); } else { return cur_mb->mbmi.mode; } } - return (cur_mb->bmi + b - 2)->as_mode.first; + return (cur_mb->bmi + b - 2)->as_mode; } #endif // VP9_COMMON_VP9_FINDNEARMV_H_ diff --git a/vp9/common/vp9_postproc.c b/vp9/common/vp9_postproc.c index 4282ddd..728a641 100644 --- a/vp9/common/vp9_postproc.c +++ b/vp9/common/vp9_postproc.c @@ -936,9 +936,9 @@ int vp9_post_proc_frame(VP9_COMMON *oci, YV12_BUFFER_CONFIG *dest, for (bx = 0; bx < 16; bx += 4) { if ((ppflags->display_b_modes_flag & (1 << mi->mbmi.mode)) || (ppflags->display_mb_modes_flag & I4X4_PRED)) { - Y = B_PREDICTION_MODE_colors[bmi->as_mode.first][0]; - U = B_PREDICTION_MODE_colors[bmi->as_mode.first][1]; - V = B_PREDICTION_MODE_colors[bmi->as_mode.first][2]; + Y = B_PREDICTION_MODE_colors[bmi->as_mode][0]; + U = B_PREDICTION_MODE_colors[bmi->as_mode][1]; + V = B_PREDICTION_MODE_colors[bmi->as_mode][2]; vp9_blend_b(yl + bx, ul + (bx >> 1), vl + (bx >> 1), Y, U, V, 0xc000, y_stride); diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c index 1e21d7b..875561b 100644 --- a/vp9/decoder/vp9_decodemv.c +++ b/vp9/decoder/vp9_decodemv.c @@ -162,15 +162,15 @@ static void read_intra_mode_info(VP9D_COMP *pbi, MODE_INFO *m, left_block_mode(m, ib) : DC_PRED; const MB_PREDICTION_MODE b_mode = read_intra_mode(r, cm->kf_y_mode_prob[A][L]); - m->bmi[ib].as_mode.first = b_mode; + m->bmi[ib].as_mode = b_mode; if (bh == 2) - m->bmi[ib + 2].as_mode.first = b_mode; + m->bmi[ib + 2].as_mode = b_mode; if (bw == 2) - m->bmi[ib + 1].as_mode.first = b_mode; + m->bmi[ib + 1].as_mode = b_mode; } } - mbmi->mode = m->bmi[3].as_mode.first; + mbmi->mode = m->bmi[3].as_mode; } mbmi->uv_mode = read_intra_mode(r, cm->kf_uv_mode_prob[mbmi->mode]); @@ -432,16 +432,16 @@ static void read_intra_block_modes(VP9D_COMP *pbi, MODE_INFO *mi, for (idx = 0; idx < 2; idx += bw) { const int ib = idy * 2 + idx; const int b_mode = read_intra_mode(r, cm->fc.y_mode_prob[0]); - mi->bmi[ib].as_mode.first = b_mode; + mi->bmi[ib].as_mode = b_mode; cm->fc.y_mode_counts[0][b_mode]++; if (bh == 2) - mi->bmi[ib + 2].as_mode.first = b_mode; + mi->bmi[ib + 2].as_mode = b_mode; if (bw == 2) - mi->bmi[ib + 1].as_mode.first = b_mode; + mi->bmi[ib + 1].as_mode = b_mode; } } - mbmi->mode = mi->bmi[3].as_mode.first; + mbmi->mode = mi->bmi[3].as_mode; } mbmi->uv_mode = read_intra_mode(r, cm->fc.uv_mode_prob[mbmi->mode]); diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index 76180e7..87253a9 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -149,7 +149,7 @@ static void decode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize, if (plane == 0 && mi->mbmi.sb_type < BLOCK_SIZE_SB8X8) { assert(bsize == BLOCK_SIZE_SB8X8); - b_mode = mi->bmi[raster_block].as_mode.first; + b_mode = mi->bmi[raster_block].as_mode; } else { b_mode = mode; } diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index ec54dc5..fd8945f 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -457,7 +457,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, int bh = 1 << b_height_log2(mi->sb_type); for (idy = 0; idy < 2; idy += bh) for (idx = 0; idx < 2; idx += bw) { - MB_PREDICTION_MODE bm = m->bmi[idy * 2 + idx].as_mode.first; + const MB_PREDICTION_MODE bm = m->bmi[idy * 2 + idx].as_mode; write_intra_mode(bc, bm, pc->fc.y_mode_prob[0]); } } @@ -583,7 +583,7 @@ static void write_mb_modes_kf(const VP9_COMP *cpi, const MB_PREDICTION_MODE A = above_block_mode(m, i, mis); const MB_PREDICTION_MODE L = (xd->left_available || idx) ? left_block_mode(m, i) : DC_PRED; - const int bm = m->bmi[i].as_mode.first; + const int bm = m->bmi[i].as_mode; #ifdef ENTROPY_STATS ++intra_mode_stats[A][L][bm]; #endif diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 2c833ab..f86e4f2 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -2141,7 +2141,7 @@ static void sum_intra_stats(VP9_COMP *cpi, MACROBLOCK *x) { int bh = 1 << b_height_log2(xd->mode_info_context->mbmi.sb_type); for (idy = 0; idy < 2; idy += bh) { for (idx = 0; idx < 2; idx += bw) { - int m = xd->mode_info_context->bmi[idy * 2 + idx].as_mode.first; + int m = xd->mode_info_context->bmi[idy * 2 + idx].as_mode; ++cpi->y_mode_count[0][m]; } } diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index d424f47..16d2fe9 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -616,7 +616,7 @@ void encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize, if (plane == 0 && mbmi->sb_type < BLOCK_SIZE_SB8X8 && mbmi->ref_frame[0] == INTRA_FRAME) - b_mode = xd->mode_info_context->bmi[ib].as_mode.first; + b_mode = xd->mode_info_context->bmi[ib].as_mode; else b_mode = mode; diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 6251623..06f90d6 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -1198,7 +1198,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib, int64_t ssz; block = ib + idy * 2 + idx; - xd->mode_info_context->bmi[block].as_mode.first = mode; + xd->mode_info_context->bmi[block].as_mode = mode; src = raster_block_offset_uint8(xd, BLOCK_SIZE_SB8X8, 0, block, p->src.buf, src_stride); src_diff = raster_block_offset_int16(xd, BLOCK_SIZE_SB8X8, 0, block, @@ -1265,7 +1265,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib, for (idy = 0; idy < bh; ++idy) { for (idx = 0; idx < bw; ++idx) { block = ib + idy * 2 + idx; - xd->mode_info_context->bmi[block].as_mode.first = *best_mode; + xd->mode_info_context->bmi[block].as_mode = *best_mode; dst = raster_block_offset_uint8(xd, BLOCK_SIZE_SB8X8, 0, block, pd->dst.buf, pd->dst.stride); @@ -1331,11 +1331,11 @@ static int64_t rd_pick_intra4x4mby_modes(VP9_COMP *cpi, MACROBLOCK *mb, distortion += d; tot_rate_y += ry; - mic->bmi[i].as_mode.first = best_mode; + mic->bmi[i].as_mode = best_mode; for (j = 1; j < bh; ++j) - mic->bmi[i + j * 2].as_mode.first = best_mode; + mic->bmi[i + j * 2].as_mode = best_mode; for (j = 1; j < bw; ++j) - mic->bmi[i + j].as_mode.first = best_mode; + mic->bmi[i + j].as_mode = best_mode; if (total_rd >= best_rd) break; @@ -1348,7 +1348,7 @@ static int64_t rd_pick_intra4x4mby_modes(VP9_COMP *cpi, MACROBLOCK *mb, *Rate = cost; *rate_y = tot_rate_y; *Distortion = distortion; - xd->mode_info_context->mbmi.mode = mic->bmi[3].as_mode.first; + xd->mode_info_context->mbmi.mode = mic->bmi[3].as_mode; return RDCOST(mb->rdmult, mb->rddiv, cost, distortion); } -- 2.7.4