From 272adbbec48eb6e16eaa8ee5addb34733419a397 Mon Sep 17 00:00:00 2001 From: Dmitry Kovalev Date: Mon, 7 Oct 2013 13:18:46 -0700 Subject: [PATCH] Using inter_mode_offset_function instead of duplicated code. Change-Id: I8de865cd1deca07b5c92c225782f0867367e9a11 --- vp9/encoder/vp9_bitstream.c | 2 +- vp9/encoder/vp9_rdopt.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index f7778a453..70870ddc6 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -341,7 +341,7 @@ static void write_sb_mv_ref(vp9_writer *w, MB_PREDICTION_MODE mode, const vp9_prob *p) { assert(is_inter_mode(mode)); write_token(w, vp9_inter_mode_tree, p, - &vp9_inter_mode_encodings[mode - NEARESTMV]); + &vp9_inter_mode_encodings[inter_mode_offset(mode)]); } diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 26bbc825e..8c91594a8 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -249,10 +249,10 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi, int qindex) { MB_PREDICTION_MODE m; for (m = NEARESTMV; m < MB_MODE_COUNT; m++) - cpi->mb.inter_mode_cost[i][m - NEARESTMV] = + cpi->mb.inter_mode_cost[i][inter_mode_offset(m)] = cost_token(vp9_inter_mode_tree, cpi->common.fc.inter_mode_probs[i], - vp9_inter_mode_encodings + (m - NEARESTMV)); + vp9_inter_mode_encodings + inter_mode_offset(m)); } } } @@ -1416,7 +1416,7 @@ static int cost_mv_ref(VP9_COMP *cpi, MB_PREDICTION_MODE mode, // Don't account for mode here if segment skip is enabled. if (!vp9_segfeature_active(&cpi->common.seg, segment_id, SEG_LVL_SKIP)) { assert(is_inter_mode(mode)); - return x->inter_mode_cost[mode_context][mode - NEARESTMV]; + return x->inter_mode_cost[mode_context][inter_mode_offset(mode)]; } else { return 0; } -- 2.40.0