Merge "Renaming 'nmv' to 'mv' for several functions."
This commit is contained in:
commit
8283d893eb
@ -114,7 +114,7 @@ MV_CLASS_TYPE vp9_get_mv_class(int z, int *offset) {
|
|||||||
return c;
|
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 &&
|
return (abs(ref->row) >> 3) < COMPANDED_MVREF_THRESH &&
|
||||||
(abs(ref->col) >> 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;
|
return mv_class_base(c) + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void increment_nmv_component_count(int v,
|
static void inc_mv_component_count(int v, nmv_component_counts *comp_counts,
|
||||||
nmv_component_counts *mvcomp,
|
int incr) {
|
||||||
int incr,
|
assert (v != 0);
|
||||||
int usehp) {
|
comp_counts->mvcount[MV_MAX + v] += incr;
|
||||||
assert (v != 0); /* should not be zero */
|
|
||||||
mvcomp->mvcount[MV_MAX + v] += incr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void increment_nmv_component(int v,
|
static void inc_mv_component(int v, nmv_component_counts *comp_counts,
|
||||||
nmv_component_counts *mvcomp,
|
int incr, int usehp) {
|
||||||
int incr,
|
|
||||||
int usehp) {
|
|
||||||
int s, z, c, o, d, e, f;
|
int s, z, c, o, d, e, f;
|
||||||
if (!incr)
|
if (!incr)
|
||||||
return;
|
return;
|
||||||
assert (v != 0); /* should not be zero */
|
assert (v != 0); /* should not be zero */
|
||||||
s = v < 0;
|
s = v < 0;
|
||||||
mvcomp->sign[s] += incr;
|
comp_counts->sign[s] += incr;
|
||||||
z = (s ? -v : v) - 1; /* magnitude - 1 */
|
z = (s ? -v : v) - 1; /* magnitude - 1 */
|
||||||
|
|
||||||
c = vp9_get_mv_class(z, &o);
|
c = vp9_get_mv_class(z, &o);
|
||||||
mvcomp->classes[c] += incr;
|
comp_counts->classes[c] += incr;
|
||||||
|
|
||||||
d = (o >> 3); /* int mv data */
|
d = (o >> 3); /* int mv data */
|
||||||
f = (o >> 1) & 3; /* fractional pel mv data */
|
f = (o >> 1) & 3; /* fractional pel mv data */
|
||||||
e = (o & 1); /* high precision mv data */
|
e = (o & 1); /* high precision mv data */
|
||||||
if (c == MV_CLASS_0) {
|
if (c == MV_CLASS_0) {
|
||||||
mvcomp->class0[d] += incr;
|
comp_counts->class0[d] += incr;
|
||||||
} else {
|
} else {
|
||||||
int i;
|
int i;
|
||||||
int b = c + CLASS0_BITS - 1; // number of bits
|
int b = c + CLASS0_BITS - 1; // number of bits
|
||||||
for (i = 0; i < b; ++i)
|
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 */
|
/* Code the fractional pel bits */
|
||||||
if (c == MV_CLASS_0) {
|
if (c == MV_CLASS_0) {
|
||||||
mvcomp->class0_fp[d][f] += incr;
|
comp_counts->class0_fp[d][f] += incr;
|
||||||
} else {
|
} else {
|
||||||
mvcomp->fp[f] += incr;
|
comp_counts->fp[f] += incr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Code the high precision bit */
|
/* Code the high precision bit */
|
||||||
if (usehp) {
|
if (usehp) {
|
||||||
if (c == MV_CLASS_0) {
|
if (c == MV_CLASS_0) {
|
||||||
mvcomp->class0_hp[e] += incr;
|
comp_counts->class0_hp[e] += incr;
|
||||||
} else {
|
} 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;
|
int v;
|
||||||
vpx_memset(mvcomp->sign, 0, sizeof(nmv_component_counts) - sizeof(mvcomp->mvcount));
|
vpx_memset(mvcomp->sign, 0, sizeof(nmv_component_counts) - sizeof(mvcomp->mvcount));
|
||||||
for (v = 1; v <= MV_MAX; v++) {
|
for (v = 1; v <= MV_MAX; v++) {
|
||||||
increment_nmv_component(-v, mvcomp, mvcomp->mvcount[MV_MAX - v], usehp);
|
inc_mv_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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,12 +202,12 @@ void vp9_increment_nmv(const MV *mv, const MV *ref, nmv_context_counts *mvctx,
|
|||||||
int usehp) {
|
int usehp) {
|
||||||
const MV_JOINT_TYPE j = vp9_get_mv_joint(mv);
|
const MV_JOINT_TYPE j = vp9_get_mv_joint(mv);
|
||||||
mvctx->joints[j]++;
|
mvctx->joints[j]++;
|
||||||
usehp = usehp && vp9_use_nmv_hp(ref);
|
usehp = usehp && vp9_use_mv_hp(ref);
|
||||||
if (mv_joint_vertical(j))
|
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))
|
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]) {
|
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;
|
int i, j;
|
||||||
#ifdef MV_COUNT_TESTING
|
#ifdef MV_COUNT_TESTING
|
||||||
printf("joints count: ");
|
printf("joints count: ");
|
||||||
|
@ -21,8 +21,8 @@ struct VP9Common;
|
|||||||
void vp9_entropy_mv_init();
|
void vp9_entropy_mv_init();
|
||||||
void vp9_init_mv_probs(struct VP9Common *cm);
|
void vp9_init_mv_probs(struct VP9Common *cm);
|
||||||
|
|
||||||
void vp9_adapt_nmv_probs(struct VP9Common *cm, int usehp);
|
void vp9_adapt_mv_probs(struct VP9Common *cm, int usehp);
|
||||||
int vp9_use_nmv_hp(const MV *ref);
|
int vp9_use_mv_hp(const MV *ref);
|
||||||
|
|
||||||
#define VP9_NMV_UPDATE_PROB 252
|
#define VP9_NMV_UPDATE_PROB 252
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include "vp9/common/vp9_sadmxn.h"
|
#include "vp9/common/vp9_sadmxn.h"
|
||||||
|
|
||||||
static void lower_mv_precision(int_mv *mv, int usehp) {
|
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)
|
if (mv->as_mv.row & 1)
|
||||||
mv->as_mv.row += (mv->as_mv.row > 0 ? -1 : 1);
|
mv->as_mv.row += (mv->as_mv.row > 0 ? -1 : 1);
|
||||||
if (mv->as_mv.col & 1)
|
if (mv->as_mv.col & 1)
|
||||||
|
@ -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);
|
const MV_JOINT_TYPE j = treed_read(r, vp9_mv_joint_tree, ctx->joints);
|
||||||
MV diff = {0, 0};
|
MV diff = {0, 0};
|
||||||
|
|
||||||
usehp = usehp && vp9_use_nmv_hp(ref);
|
usehp = usehp && vp9_use_mv_hp(ref);
|
||||||
if (mv_joint_vertical(j))
|
if (mv_joint_vertical(j))
|
||||||
diff.row = read_mv_component(r, &ctx->comps[0], usehp);
|
diff.row = read_mv_component(r, &ctx->comps[0], usehp);
|
||||||
|
|
||||||
|
@ -1183,7 +1183,7 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
|
|||||||
if ((!keyframe) && (!pc->intra_only)) {
|
if ((!keyframe) && (!pc->intra_only)) {
|
||||||
vp9_adapt_mode_probs(pc);
|
vp9_adapt_mode_probs(pc);
|
||||||
vp9_adapt_mode_context(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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,7 +541,7 @@ void vp9_encode_mv(vp9_writer* w, const MV* mv, const MV* ref,
|
|||||||
const MV diff = {mv->row - ref->row,
|
const MV diff = {mv->row - ref->row,
|
||||||
mv->col - ref->col};
|
mv->col - ref->col};
|
||||||
const MV_JOINT_TYPE j = vp9_get_mv_joint(&diff);
|
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]);
|
write_token(w, vp9_mv_joint_tree, mvctx->joints, &vp9_mv_joint_encodings[j]);
|
||||||
if (mv_joint_vertical(j))
|
if (mv_joint_vertical(j))
|
||||||
|
@ -366,7 +366,7 @@ int vp9_find_best_sub_pixel_step_iteratively(MACROBLOCK *x,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (xd->allow_high_precision_mv) {
|
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 {
|
} else {
|
||||||
usehp = 0;
|
usehp = 0;
|
||||||
}
|
}
|
||||||
@ -556,7 +556,7 @@ int vp9_find_best_sub_pixel_comp(MACROBLOCK *x,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (xd->allow_high_precision_mv) {
|
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 {
|
} else {
|
||||||
usehp = 0;
|
usehp = 0;
|
||||||
}
|
}
|
||||||
@ -930,7 +930,7 @@ int vp9_find_best_sub_pixel_step(MACROBLOCK *x,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (x->e_mbd.allow_high_precision_mv) {
|
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 {
|
} else {
|
||||||
usehp = 0;
|
usehp = 0;
|
||||||
}
|
}
|
||||||
|
@ -3040,7 +3040,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
|
|||||||
!cpi->common.frame_parallel_decoding_mode) {
|
!cpi->common.frame_parallel_decoding_mode) {
|
||||||
vp9_adapt_mode_probs(&cpi->common);
|
vp9_adapt_mode_probs(&cpi->common);
|
||||||
vp9_adapt_mode_context(&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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user