From 8c05e59065f66d3fbd9d742eb63f5b78678e7e67 Mon Sep 17 00:00:00 2001
From: Dmitry Kovalev <dkovalev@google.com>
Date: Thu, 11 Jul 2013 14:14:47 -0700
Subject: [PATCH] Calling is_inter_mode() instead of custom code.

Change-Id: Iccd4ab95ea51a6d57ed43947f2fd7ad92e8979cf
---
 vp9/encoder/vp9_bitstream.c |  6 +++---
 vp9/encoder/vp9_rdopt.c     | 16 ++++++++--------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c
index 099b0b319e..adeff102fa 100644
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -348,11 +348,11 @@ static void pack_mb_tokens(vp9_writer* const bc,
   *tp = p;
 }
 
-static void write_sb_mv_ref(vp9_writer *w, MB_PREDICTION_MODE m,
+static void write_sb_mv_ref(vp9_writer *w, MB_PREDICTION_MODE mode,
                             const vp9_prob *p) {
-  assert(NEARESTMV <= m && m <= NEWMV);
+  assert(is_inter_mode(mode));
   write_token(w, vp9_sb_mv_ref_tree, p,
-              vp9_sb_mv_ref_encoding_array - NEARESTMV + m);
+              &vp9_sb_mv_ref_encoding_array[mode - NEARESTMV]);
 }
 
 
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 6bac9f5b87..3982cf3374 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1556,19 +1556,19 @@ static int64_t rd_pick_intra_sbuv_mode(VP9_COMP *cpi, MACROBLOCK *x,
   return best_rd;
 }
 
-static int cost_mv_ref(VP9_COMP *cpi,
-                       MB_PREDICTION_MODE m,
-                       const int mode_context) {
+static int cost_mv_ref(VP9_COMP *cpi, MB_PREDICTION_MODE mode,
+                       int mode_context) {
   MACROBLOCK *const x = &cpi->mb;
   MACROBLOCKD *const xd = &x->e_mbd;
-  int segment_id = xd->mode_info_context->mbmi.segment_id;
+  const int segment_id = xd->mode_info_context->mbmi.segment_id;
 
-  // Dont account for mode here if segment skip is enabled.
+  // Don't account for mode here if segment skip is enabled.
   if (!vp9_segfeature_active(&xd->seg, segment_id, SEG_LVL_SKIP)) {
-    assert(NEARESTMV <= m  &&  m <= NEWMV);
-    return x->inter_mode_cost[mode_context][m - NEARESTMV];
-  } else
+    assert(is_inter_mode(mode));
+    return x->inter_mode_cost[mode_context][mode - NEARESTMV];
+  } else {
     return 0;
+  }
 }
 
 void vp9_set_mbmode_and_mvs(MACROBLOCK *x, MB_PREDICTION_MODE mb, int_mv *mv) {
-- 
GitLab