Adding is_inter_mode function.
authorDmitry Kovalev <dkovalev@google.com>
Wed, 24 Apr 2013 19:14:58 +0000 (12:14 -0700)
committerDmitry Kovalev <dkovalev@google.com>
Thu, 25 Apr 2013 17:23:00 +0000 (10:23 -0700)
Change-Id: I2d32d46002cb92c63050c2b8328865c406103621

vp9/common/vp9_blockd.h
vp9/common/vp9_pred_common.c
vp9/decoder/vp9_decodemv.c
vp9/encoder/vp9_bitstream.c
vp9/encoder/vp9_encodeframe.c
vp9/encoder/vp9_rdopt.c

index b03e354..693fa4b 100644 (file)
@@ -98,6 +98,11 @@ typedef enum {
   MB_MODE_COUNT
 } MB_PREDICTION_MODE;
 
+static INLINE int is_inter_mode(MB_PREDICTION_MODE mode) {
+  return mode >= NEARESTMV && mode <= SPLITMV;
+}
+
+
 // Segment level features.
 typedef enum {
   SEG_LVL_ALT_Q = 0,               // Use alternate Quantizer ....
index c12920c..882b56f 100644 (file)
@@ -59,16 +59,14 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
     case PRED_SWITCHABLE_INTERP: {
       // left
       const int left_in_image = xd->left_available && left_mi->mbmi.mb_in_image;
-      const int left_mv_pred = left_mi->mbmi.mode >= NEARESTMV &&
-                               left_mi->mbmi.mode <= SPLITMV;
+      const int left_mv_pred = is_inter_mode(left_mi->mbmi.mode);
       const int left_interp = left_in_image && left_mv_pred ?
                     vp9_switchable_interp_map[left_mi->mbmi.interp_filter] :
                     VP9_SWITCHABLE_FILTERS;
 
       // above
       const int above_in_image = xd->up_available && above_mi->mbmi.mb_in_image;
-      const int above_mv_pred = above_mi->mbmi.mode >= NEARESTMV &&
-                                above_mi->mbmi.mode <= SPLITMV;
+      const int above_mv_pred = is_inter_mode(above_mi->mbmi.mode);
       const int above_interp = above_in_image && above_mv_pred ?
                     vp9_switchable_interp_map[above_mi->mbmi.interp_filter] :
                     VP9_SWITCHABLE_FILTERS;
index 65e81b9..e00e951 100644 (file)
@@ -692,7 +692,7 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
 #endif
     }
 
-    if (mbmi->mode >= NEARESTMV && mbmi->mode <= SPLITMV) {
+    if (is_inter_mode(mbmi->mode)) {
       mbmi->interp_filter = cm->mcomp_filter_type == SWITCHABLE
                                 ? read_switchable_filter_type(pbi, r)
                                 : cm->mcomp_filter_type;
index 62ee0bb..870d9d4 100644 (file)
@@ -794,7 +794,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
       vp9_accum_mv_refs(&cpi->common, mode, mi->mb_mode_context[rf]);
     }
 
-    if (mode >= NEARESTMV && mode <= SPLITMV) {
+    if (is_inter_mode(mode)) {
       if (cpi->common.mcomp_filter_type == SWITCHABLE) {
         write_token(bc, vp9_switchable_interp_tree,
                     vp9_get_pred_probs(&cpi->common, xd,
index 65e6b18..0fd785f 100644 (file)
@@ -505,8 +505,7 @@ static void update_state(VP9_COMP *cpi,
     }
 #endif
     if (cpi->common.mcomp_filter_type == SWITCHABLE &&
-        mbmi->mode >= NEARESTMV &&
-        mbmi->mode <= SPLITMV) {
+        is_inter_mode(mbmi->mode)) {
       ++cpi->switchable_interp_count
           [vp9_get_pred_context(&cpi->common, xd, PRED_SWITCHABLE_INTERP)]
           [vp9_switchable_interp_map[mbmi->interp_filter]];
index c448ce5..df71ad3 100644 (file)
@@ -4042,7 +4042,7 @@ static void rd_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
 
   // Accumulate filter usage stats
   // TODO(agrange): Use RD criteria to select interpolation filter mode.
-  if ((best_mode >= NEARESTMV) && (best_mode <= SPLITMV))
+  if (is_inter_mode(best_mode))
     ++cpi->best_switchable_interp_count[vp9_switchable_interp_map[best_filter]];
 
   // Reduce the activation RD thresholds for the best choice mode
@@ -4852,7 +4852,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
 
   // Accumulate filter usage stats
   // TODO(agrange): Use RD criteria to select interpolation filter mode.
-  if ((best_mode >= NEARESTMV) && (best_mode <= SPLITMV))
+  if (is_inter_mode(best_mode))
     ++cpi->best_switchable_interp_count[vp9_switchable_interp_map[best_filter]];
 
   // TODO(rbultje) integrate with RD thresholding