shithub: libvpx

Download patch

ref: be77f6bbbfd0c573046a90528fcf20c1e3cd74f8
parent: b0520b61ed90062fd284caa800289503002cd59e
author: Dmitry Kovalev <[email protected]>
date: Tue Jul 2 12:51:57 EDT 2013

Removing redundant struct from union b_mode_info.

Change-Id: I08fc6e474ff2c12cfa065bae4989c724276e2c83

--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -127,9 +127,7 @@
    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 @@
     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) {
--- a/vp9/common/vp9_findnearmv.h
+++ b/vp9/common/vp9_findnearmv.h
@@ -86,13 +86,13 @@
     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 @@
     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_
--- a/vp9/common/vp9_postproc.c
+++ b/vp9/common/vp9_postproc.c
@@ -936,9 +936,9 @@
             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);
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -162,15 +162,15 @@
                                       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 @@
        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]);
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -149,7 +149,7 @@
 
   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;
   }
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -457,7 +457,7 @@
       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 @@
         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
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -2141,7 +2141,7 @@
     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];
       }
     }
--- a/vp9/encoder/vp9_encodemb.c
+++ b/vp9/encoder/vp9_encodemb.c
@@ -616,7 +616,7 @@
   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;
 
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1198,7 +1198,7 @@
         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 @@
   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 @@
       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 @@
   *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);
 }