]> granicus.if.org Git - libvpx/commitdiff
Make some sb_type comparisons independent of literal enum values.
authorRonald S. Bultje <rbultje@google.com>
Tue, 23 Apr 2013 18:29:12 +0000 (11:29 -0700)
committerRonald S. Bultje <rbultje@google.com>
Tue, 23 Apr 2013 19:34:32 +0000 (12:34 -0700)
Change-Id: I54acef342b8e787e05af0febd7cf0d7d10288383

vp9/common/vp9_pred_common.c
vp9/decoder/vp9_decodemv.c
vp9/decoder/vp9_decodframe.c
vp9/encoder/vp9_bitstream.c
vp9/encoder/vp9_encodeframe.c

index e110cff44a15a7075958c30dd9528bbd554f985a..5810491695aec6aff660958e742af6d52ae8bddc 100644 (file)
@@ -230,7 +230,7 @@ void vp9_set_pred_flag(MACROBLOCKD *const xd,
 int vp9_get_pred_mb_segid(VP9_COMMON *cm, BLOCK_SIZE_TYPE sb_type,
                           int mb_row, int mb_col) {
   const int mb_index = mb_row * cm->mb_cols + mb_col;
-  if (sb_type) {
+  if (sb_type > BLOCK_SIZE_MB16X16) {
     const int bw = 1 << mb_width_log2(sb_type);
     const int bh = 1 << mb_height_log2(sb_type);
     const int ymbs = MIN(cm->mb_rows - mb_row, bh);
index b0fb908f7479ab246b9a092f12509a093e018868..c6b11d03cf837aef0b997eaba1e381dbf47df39c 100644 (file)
@@ -98,7 +98,7 @@ static void set_segment_id(VP9_COMMON *cm, MB_MODE_INFO *mbmi,
                            int mb_row, int mb_col, int segment_id) {
   const int mb_index = mb_row * cm->mb_cols + mb_col;
   const BLOCK_SIZE_TYPE sb_type = mbmi->sb_type;
-  if (sb_type) {
+  if (sb_type > BLOCK_SIZE_MB16X16) {
     const int bw = 1 << mb_width_log2(sb_type);
     const int bh = 1 << mb_height_log2(sb_type);
     const int ymbs = MIN(cm->mb_rows - mb_row, bh);
@@ -138,7 +138,7 @@ static void kfread_modes(VP9D_COMP *pbi, MODE_INFO *m,
     m->mbmi.mb_skip_coeff = vp9_read(r, vp9_get_pred_prob(cm, xd, PRED_MBSKIP));
 
   // luma mode
-  m->mbmi.mode = m->mbmi.sb_type ?
+  m->mbmi.mode = m->mbmi.sb_type > BLOCK_SIZE_MB16X16 ?
       read_kf_sb_ymode(r, cm->sb_kf_ymode_prob[cm->kf_ymode_probs_index]):
       read_kf_mb_ymode(r, cm->kf_ymode_prob[cm->kf_ymode_probs_index]);
 
@@ -669,7 +669,8 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
       if (vp9_segfeature_active(xd, mbmi->segment_id, SEG_LVL_SKIP)) {
         mbmi->mode = ZEROMV;
       } else {
-        mbmi->mode = mbmi->sb_type ? read_sb_mv_ref(r, mv_ref_p)
+        mbmi->mode = mbmi->sb_type > BLOCK_SIZE_MB16X16 ?
+                                     read_sb_mv_ref(r, mv_ref_p)
                                    : read_mv_ref(r, mv_ref_p);
         vp9_accum_mv_refs(cm, mbmi->mode, mbmi->mb_mode_context[ref_frame]);
       }
@@ -933,7 +934,7 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
     // required for left and above block mv
     mv0->as_int = 0;
 
-    if (mbmi->sb_type) {
+    if (mbmi->sb_type > BLOCK_SIZE_MB16X16) {
       mbmi->mode = read_sb_ymode(r, cm->fc.sb_ymode_prob);
       cm->fc.sb_ymode_counts[mbmi->mode]++;
     } else {
@@ -1036,7 +1037,7 @@ void vp9_decode_mb_mode_mv(VP9D_COMP* const pbi,
                       cm->active_ref_scale);
   }
 
-  if (mbmi->sb_type) {
+  if (mbmi->sb_type > BLOCK_SIZE_MB16X16) {
     const int bw = 1 << mb_width_log2(mbmi->sb_type);
     const int bh = 1 << mb_height_log2(mbmi->sb_type);
     const int y_mbs = MIN(bh, cm->mb_rows - mb_row);
index 3e4e5aa6b19af5d80d0c54dd9953b927d818e4ed..fab26f1113b2cfdb63b4efc93b64a04d8b43c012 100644 (file)
@@ -663,7 +663,7 @@ static void decode_mb(VP9D_COMP *pbi, MACROBLOCKD *xd,
   const MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode;
   const int tx_size = xd->mode_info_context->mbmi.txfm_size;
 
-  assert(!xd->mode_info_context->mbmi.sb_type);
+  assert(xd->mode_info_context->mbmi.sb_type == BLOCK_SIZE_MB16X16);
 
   //mode = xd->mode_info_context->mbmi.mode;
   if (pbi->common.frame_type != KEY_FRAME)
index e94f616c34092f0c8223532e60ea7be44bd9df34..22316217ce9b67826d86655acd8b61341f06c687 100644 (file)
@@ -748,7 +748,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
     active_section = 6;
 #endif
 
-    if (m->mbmi.sb_type)
+    if (m->mbmi.sb_type > BLOCK_SIZE_MB16X16)
       write_sb_ymode(bc, mode, pc->fc.sb_ymode_prob);
     else
       write_ymode(bc, mode, pc->fc.ymode_prob);
@@ -784,7 +784,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
 
     // If segment skip is not enabled code the mode.
     if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
-      if (mi->sb_type) {
+      if (mi->sb_type > BLOCK_SIZE_MB16X16) {
         write_sb_mv_ref(bc, mode, mv_ref_p);
       } else {
         write_mv_ref(bc, mode, mv_ref_p);
@@ -945,7 +945,7 @@ static void write_mb_modes_kf(const VP9_COMP *cpi,
               vp9_get_pred_prob(c, xd, PRED_MBSKIP));
   }
 
-  if (m->mbmi.sb_type) {
+  if (m->mbmi.sb_type > BLOCK_SIZE_MB16X16) {
     sb_kfwrite_ymode(bc, ym,
                      c->sb_kf_ymode_prob[c->kf_ymode_probs_index]);
   } else {
index 1f20d5e1c3861d87f4cf0e44fffd5e4659bb4da1..1978f19f67d4dfd4b28fa86094addd08069b1be0 100644 (file)
@@ -1828,7 +1828,7 @@ static void sum_intra_stats(VP9_COMP *cpi, MACROBLOCK *x) {
   }
 #endif
 
-  if (xd->mode_info_context->mbmi.sb_type) {
+  if (xd->mode_info_context->mbmi.sb_type > BLOCK_SIZE_MB16X16) {
     ++cpi->sb_ymode_count[m];
   } else {
     ++cpi->ymode_count[m];
@@ -1884,7 +1884,7 @@ static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t,
   MB_MODE_INFO *const mbmi = &mi->mbmi;
   const int mis = cm->mode_info_stride;
 
-  assert(!xd->mode_info_context->mbmi.sb_type);
+  assert(xd->mode_info_context->mbmi.sb_type == BLOCK_SIZE_MB16X16);
 
 #ifdef ENC_DEBUG
   enc_debug = (cpi->common.current_video_frame == 11 && cm->show_frame &&