From de993a847f8080d3128420c8ef8495642013bdb1 Mon Sep 17 00:00:00 2001 From: Scott LaVarnway Date: Wed, 13 Jan 2016 08:02:05 -0800 Subject: [PATCH] VP9: inline vp9_use_mv_hp() Change-Id: Ib275bfc4c29c572d6c70e5ec6dbfc241590d3e3e --- vp9/common/vp9_entropymv.c | 8 -------- vp9/common/vp9_entropymv.h | 9 ++++++++- vp9/common/vp9_mvref_common.h | 2 +- vp9/decoder/vp9_decodemv.c | 7 ------- vp9/encoder/vp9_encodemv.c | 2 +- vp9/encoder/vp9_mcomp.c | 8 ++++---- 6 files changed, 14 insertions(+), 22 deletions(-) diff --git a/vp9/common/vp9_entropymv.c b/vp9/common/vp9_entropymv.c index 3acfe14..566ae91 100644 --- a/vp9/common/vp9_entropymv.c +++ b/vp9/common/vp9_entropymv.c @@ -11,9 +11,6 @@ #include "vp9/common/vp9_onyxc_int.h" #include "vp9/common/vp9_entropymv.h" -// Integer pel reference mv threshold for use of high-precision 1/8 mv -#define COMPANDED_MVREF_THRESH 8 - const vpx_tree_index vp9_mv_joint_tree[TREE_SIZE(MV_JOINTS)] = { -MV_JOINT_ZERO, 2, -MV_JOINT_HNZVZ, 4, @@ -127,11 +124,6 @@ MV_CLASS_TYPE vp9_get_mv_class(int z, int *offset) { return c; } -int vp9_use_mv_hp(const MV *ref) { - return (abs(ref->row) >> 3) < COMPANDED_MVREF_THRESH && - (abs(ref->col) >> 3) < COMPANDED_MVREF_THRESH; -} - static void inc_mv_component(int v, nmv_component_counts *comp_counts, int incr, int usehp) { int s, z, c, o, d, e, f; diff --git a/vp9/common/vp9_entropymv.h b/vp9/common/vp9_entropymv.h index 8c817bf..2f05ad4 100644 --- a/vp9/common/vp9_entropymv.h +++ b/vp9/common/vp9_entropymv.h @@ -27,7 +27,14 @@ struct VP9Common; void vp9_init_mv_probs(struct VP9Common *cm); void vp9_adapt_mv_probs(struct VP9Common *cm, int usehp); -int vp9_use_mv_hp(const MV *ref); + +// Integer pel reference mv threshold for use of high-precision 1/8 mv +#define COMPANDED_MVREF_THRESH 8 + +static INLINE int use_mv_hp(const MV *ref) { + return (abs(ref->row) >> 3) < COMPANDED_MVREF_THRESH && + (abs(ref->col) >> 3) < COMPANDED_MVREF_THRESH; +} #define MV_UPDATE_PROB 252 diff --git a/vp9/common/vp9_mvref_common.h b/vp9/common/vp9_mvref_common.h index 22fbaf8..28e3e29 100644 --- a/vp9/common/vp9_mvref_common.h +++ b/vp9/common/vp9_mvref_common.h @@ -208,7 +208,7 @@ static INLINE void clamp_mv2(MV *mv, const MACROBLOCKD *xd) { } static INLINE void lower_mv_precision(MV *mv, int allow_hp) { - const int use_hp = allow_hp && vp9_use_mv_hp(mv); + const int use_hp = allow_hp && use_mv_hp(mv); if (!use_hp) { if (mv->row & 1) mv->row += (mv->row > 0 ? -1 : 1); diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c index 42f5545..bf5d81d 100644 --- a/vp9/decoder/vp9_decodemv.c +++ b/vp9/decoder/vp9_decodemv.c @@ -284,13 +284,6 @@ static int read_mv_component(vpx_reader *r, return sign ? -mag : mag; } -// TODO(slavarnway): move to vp9_entropymv.h and replace vp9_use_mv_hp -#define COMPANDED_MVREF_THRESH 8 -static int use_mv_hp(const MV *ref) { - return (abs(ref->row) >> 3) < COMPANDED_MVREF_THRESH && - (abs(ref->col) >> 3) < COMPANDED_MVREF_THRESH; -} - static INLINE void read_mv(vpx_reader *r, MV *mv, const MV *ref, const nmv_context *ctx, nmv_context_counts *counts, int allow_hp) { diff --git a/vp9/encoder/vp9_encodemv.c b/vp9/encoder/vp9_encodemv.c index e719663..3bcd6a3 100644 --- a/vp9/encoder/vp9_encodemv.c +++ b/vp9/encoder/vp9_encodemv.c @@ -206,7 +206,7 @@ void vp9_encode_mv(VP9_COMP* cpi, vpx_writer* w, const MV diff = {mv->row - ref->row, mv->col - ref->col}; const MV_JOINT_TYPE j = vp9_get_mv_joint(&diff); - usehp = usehp && vp9_use_mv_hp(ref); + usehp = usehp && use_mv_hp(ref); vp9_write_token(w, vp9_mv_joint_tree, mvctx->joints, &mv_joint_encodings[j]); if (mv_joint_vertical(j)) diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c index a84202b..eab07bc 100644 --- a/vp9/encoder/vp9_mcomp.c +++ b/vp9/encoder/vp9_mcomp.c @@ -439,7 +439,7 @@ int vp9_find_best_sub_pixel_tree_pruned_evenmore( tr = br; tc = bc; - if (allow_hp && vp9_use_mv_hp(ref_mv) && forced_stop == 0) { + if (allow_hp && use_mv_hp(ref_mv) && forced_stop == 0) { hstep >>= 1; FIRST_LEVEL_CHECKS; if (eighthiters > 1) { @@ -507,7 +507,7 @@ int vp9_find_best_sub_pixel_tree_pruned_more(const MACROBLOCK *x, } } - if (allow_hp && vp9_use_mv_hp(ref_mv) && forced_stop == 0) { + if (allow_hp && use_mv_hp(ref_mv) && forced_stop == 0) { tr = br; tc = bc; hstep >>= 1; @@ -602,7 +602,7 @@ int vp9_find_best_sub_pixel_tree_pruned(const MACROBLOCK *x, tc = bc; } - if (allow_hp && vp9_use_mv_hp(ref_mv) && forced_stop == 0) { + if (allow_hp && use_mv_hp(ref_mv) && forced_stop == 0) { hstep >>= 1; FIRST_LEVEL_CHECKS; if (eighthiters > 1) { @@ -674,7 +674,7 @@ int vp9_find_best_sub_pixel_tree(const MACROBLOCK *x, unsigned int cost_array[5]; int kr, kc; - if (!(allow_hp && vp9_use_mv_hp(ref_mv))) + if (!(allow_hp && use_mv_hp(ref_mv))) if (round == 3) round = 2; -- 2.7.4