diff --git a/vp9/common/vp9_entropymv.c b/vp9/common/vp9_entropymv.c index e07e43c8b..000e284ee 100644 --- a/vp9/common/vp9_entropymv.c +++ b/vp9/common/vp9_entropymv.c @@ -114,7 +114,7 @@ MV_CLASS_TYPE vp9_get_mv_class(int z, int *offset) { return c; } -int vp9_use_nmv_hp(const MV *ref) { +int vp9_use_mv_hp(const MV *ref) { return (abs(ref->row) >> 3) < COMPANDED_MVREF_THRESH && (abs(ref->col) >> 3) < COMPANDED_MVREF_THRESH; } @@ -123,54 +123,50 @@ int vp9_get_mv_mag(MV_CLASS_TYPE c, int offset) { return mv_class_base(c) + offset; } -static void increment_nmv_component_count(int v, - nmv_component_counts *mvcomp, - int incr, - int usehp) { - assert (v != 0); /* should not be zero */ - mvcomp->mvcount[MV_MAX + v] += incr; +static void inc_mv_component_count(int v, nmv_component_counts *comp_counts, + int incr) { + assert (v != 0); + comp_counts->mvcount[MV_MAX + v] += incr; } -static void increment_nmv_component(int v, - nmv_component_counts *mvcomp, - int incr, - int usehp) { +static void inc_mv_component(int v, nmv_component_counts *comp_counts, + int incr, int usehp) { int s, z, c, o, d, e, f; if (!incr) return; assert (v != 0); /* should not be zero */ s = v < 0; - mvcomp->sign[s] += incr; + comp_counts->sign[s] += incr; z = (s ? -v : v) - 1; /* magnitude - 1 */ c = vp9_get_mv_class(z, &o); - mvcomp->classes[c] += incr; + comp_counts->classes[c] += incr; d = (o >> 3); /* int mv data */ f = (o >> 1) & 3; /* fractional pel mv data */ e = (o & 1); /* high precision mv data */ if (c == MV_CLASS_0) { - mvcomp->class0[d] += incr; + comp_counts->class0[d] += incr; } else { int i; int b = c + CLASS0_BITS - 1; // number of bits for (i = 0; i < b; ++i) - mvcomp->bits[i][((d >> i) & 1)] += incr; + comp_counts->bits[i][((d >> i) & 1)] += incr; } /* Code the fractional pel bits */ if (c == MV_CLASS_0) { - mvcomp->class0_fp[d][f] += incr; + comp_counts->class0_fp[d][f] += incr; } else { - mvcomp->fp[f] += incr; + comp_counts->fp[f] += incr; } /* Code the high precision bit */ if (usehp) { if (c == MV_CLASS_0) { - mvcomp->class0_hp[e] += incr; + comp_counts->class0_hp[e] += incr; } else { - mvcomp->hp[e] += incr; + comp_counts->hp[e] += incr; } } } @@ -197,8 +193,8 @@ static void counts_to_context(nmv_component_counts *mvcomp, int usehp) { int v; vpx_memset(mvcomp->sign, 0, sizeof(nmv_component_counts) - sizeof(mvcomp->mvcount)); for (v = 1; v <= MV_MAX; v++) { - increment_nmv_component(-v, mvcomp, mvcomp->mvcount[MV_MAX - v], usehp); - increment_nmv_component( v, mvcomp, mvcomp->mvcount[MV_MAX + v], usehp); + inc_mv_component(-v, mvcomp, mvcomp->mvcount[MV_MAX - v], usehp); + inc_mv_component( v, mvcomp, mvcomp->mvcount[MV_MAX + v], usehp); } } @@ -206,12 +202,12 @@ void vp9_increment_nmv(const MV *mv, const MV *ref, nmv_context_counts *mvctx, int usehp) { const MV_JOINT_TYPE j = vp9_get_mv_joint(mv); mvctx->joints[j]++; - usehp = usehp && vp9_use_nmv_hp(ref); + usehp = usehp && vp9_use_mv_hp(ref); if (mv_joint_vertical(j)) - increment_nmv_component_count(mv->row, &mvctx->comps[0], 1, usehp); + inc_mv_component_count(mv->row, &mvctx->comps[0], 1); if (mv_joint_horizontal(j)) - increment_nmv_component_count(mv->col, &mvctx->comps[1], 1, usehp); + inc_mv_component_count(mv->col, &mvctx->comps[1], 1); } static void adapt_prob(vp9_prob *dest, vp9_prob prep, unsigned int ct[2]) { @@ -332,7 +328,7 @@ static unsigned int adapt_probs(unsigned int i, } -void vp9_adapt_nmv_probs(VP9_COMMON *cm, int usehp) { +void vp9_adapt_mv_probs(VP9_COMMON *cm, int usehp) { int i, j; #ifdef MV_COUNT_TESTING printf("joints count: "); diff --git a/vp9/common/vp9_entropymv.h b/vp9/common/vp9_entropymv.h index 15994a6ae..0fc20dbfc 100644 --- a/vp9/common/vp9_entropymv.h +++ b/vp9/common/vp9_entropymv.h @@ -21,8 +21,8 @@ struct VP9Common; void vp9_entropy_mv_init(); void vp9_init_mv_probs(struct VP9Common *cm); -void vp9_adapt_nmv_probs(struct VP9Common *cm, int usehp); -int vp9_use_nmv_hp(const MV *ref); +void vp9_adapt_mv_probs(struct VP9Common *cm, int usehp); +int vp9_use_mv_hp(const MV *ref); #define VP9_NMV_UPDATE_PROB 252 diff --git a/vp9/common/vp9_findnearmv.c b/vp9/common/vp9_findnearmv.c index a6922715e..643b229a6 100644 --- a/vp9/common/vp9_findnearmv.c +++ b/vp9/common/vp9_findnearmv.c @@ -15,7 +15,7 @@ #include "vp9/common/vp9_sadmxn.h" static void lower_mv_precision(int_mv *mv, int usehp) { - if (!usehp || !vp9_use_nmv_hp(&mv->as_mv)) { + if (!usehp || !vp9_use_mv_hp(&mv->as_mv)) { if (mv->as_mv.row & 1) mv->as_mv.row += (mv->as_mv.row > 0 ? -1 : 1); if (mv->as_mv.col & 1) diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c index d148bbb1e..d8836c962 100644 --- a/vp9/decoder/vp9_decodemv.c +++ b/vp9/decoder/vp9_decodemv.c @@ -459,7 +459,7 @@ static INLINE void decode_mv(vp9_reader *r, MV *mv, const MV *ref, const MV_JOINT_TYPE j = treed_read(r, vp9_mv_joint_tree, ctx->joints); MV diff = {0, 0}; - usehp = usehp && vp9_use_nmv_hp(ref); + usehp = usehp && vp9_use_mv_hp(ref); if (mv_joint_vertical(j)) diff.row = read_mv_component(r, &ctx->comps[0], usehp); diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index 193353272..078d09b0d 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -1183,7 +1183,7 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) { if ((!keyframe) && (!pc->intra_only)) { vp9_adapt_mode_probs(pc); vp9_adapt_mode_context(pc); - vp9_adapt_nmv_probs(pc, xd->allow_high_precision_mv); + vp9_adapt_mv_probs(pc, xd->allow_high_precision_mv); } } diff --git a/vp9/encoder/vp9_encodemv.c b/vp9/encoder/vp9_encodemv.c index a582d183d..ea6aa296a 100644 --- a/vp9/encoder/vp9_encodemv.c +++ b/vp9/encoder/vp9_encodemv.c @@ -541,7 +541,7 @@ void vp9_encode_mv(vp9_writer* w, const MV* mv, const MV* ref, 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_nmv_hp(ref); + usehp = usehp && vp9_use_mv_hp(ref); write_token(w, vp9_mv_joint_tree, mvctx->joints, &vp9_mv_joint_encodings[j]); if (mv_joint_vertical(j)) diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c index 2e99736ce..0f1062313 100644 --- a/vp9/encoder/vp9_mcomp.c +++ b/vp9/encoder/vp9_mcomp.c @@ -366,7 +366,7 @@ int vp9_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, } if (xd->allow_high_precision_mv) { - usehp = vp9_use_nmv_hp(&ref_mv->as_mv); + usehp = vp9_use_mv_hp(&ref_mv->as_mv); } else { usehp = 0; } @@ -556,7 +556,7 @@ int vp9_find_best_sub_pixel_comp(MACROBLOCK *x, } if (xd->allow_high_precision_mv) { - usehp = vp9_use_nmv_hp(&ref_mv->as_mv); + usehp = vp9_use_mv_hp(&ref_mv->as_mv); } else { usehp = 0; } @@ -930,7 +930,7 @@ int vp9_find_best_sub_pixel_step(MACROBLOCK *x, } if (x->e_mbd.allow_high_precision_mv) { - usehp = vp9_use_nmv_hp(&ref_mv->as_mv); + usehp = vp9_use_mv_hp(&ref_mv->as_mv); } else { usehp = 0; } diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index 61e2b4e10..420257f85 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -3040,7 +3040,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, !cpi->common.frame_parallel_decoding_mode) { vp9_adapt_mode_probs(&cpi->common); vp9_adapt_mode_context(&cpi->common); - vp9_adapt_nmv_probs(&cpi->common, cpi->mb.e_mbd.allow_high_precision_mv); + vp9_adapt_mv_probs(&cpi->common, cpi->mb.e_mbd.allow_high_precision_mv); } }