Renaming "nmv" to "mv".

Change-Id: I8299f55c3b930221e52c2237f2ddea65b94fd33b
This commit is contained in:
Dmitry Kovalev 2013-06-25 15:19:18 -07:00
parent 0441e0a2fc
commit 6fb10f2de4
4 changed files with 62 additions and 82 deletions

View File

@ -198,7 +198,7 @@ static void counts_to_context(nmv_component_counts *mvcomp, int usehp) {
}
}
void vp9_increment_nmv(const MV *mv, const MV *ref, nmv_context_counts *mvctx,
void vp9_inc_mv(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]++;

View File

@ -121,8 +121,8 @@ typedef struct {
nmv_component_counts comps[2];
} nmv_context_counts;
void vp9_increment_nmv(const MV *mv, const MV *ref, nmv_context_counts *mvctx,
int usehp);
void vp9_inc_mv(const MV *mv, const MV *ref, nmv_context_counts *mvctx,
int usehp);
extern const nmv_context vp9_default_nmv_context;
void vp9_counts_to_nmv_context(
nmv_context_counts *NMVcount,

View File

@ -194,7 +194,7 @@ static int read_mv_component(vp9_reader *r,
return sign ? -mag : mag;
}
static void update_nmv(vp9_reader *r, vp9_prob *const p,
static void update_mv(vp9_reader *r, vp9_prob *const p,
const vp9_prob upd_p) {
if (vp9_read(r, upd_p)) {
#ifdef LOW_PRECISION_MV_UPDATE
@ -205,8 +205,7 @@ static void update_nmv(vp9_reader *r, vp9_prob *const p,
}
}
static void read_nmvprobs(vp9_reader *r, nmv_context *mvctx,
int usehp) {
static void read_mv_probs(vp9_reader *r, nmv_context *mvc, int usehp) {
int i, j, k;
#ifdef MV_GROUP_UPDATE
@ -214,33 +213,33 @@ static void read_nmvprobs(vp9_reader *r, nmv_context *mvctx,
return;
#endif
for (j = 0; j < MV_JOINTS - 1; ++j)
update_nmv(r, &mvctx->joints[j], VP9_NMV_UPDATE_PROB);
update_mv(r, &mvc->joints[j], VP9_NMV_UPDATE_PROB);
for (i = 0; i < 2; ++i) {
update_nmv(r, &mvctx->comps[i].sign, VP9_NMV_UPDATE_PROB);
update_mv(r, &mvc->comps[i].sign, VP9_NMV_UPDATE_PROB);
for (j = 0; j < MV_CLASSES - 1; ++j)
update_nmv(r, &mvctx->comps[i].classes[j], VP9_NMV_UPDATE_PROB);
update_mv(r, &mvc->comps[i].classes[j], VP9_NMV_UPDATE_PROB);
for (j = 0; j < CLASS0_SIZE - 1; ++j)
update_nmv(r, &mvctx->comps[i].class0[j], VP9_NMV_UPDATE_PROB);
update_mv(r, &mvc->comps[i].class0[j], VP9_NMV_UPDATE_PROB);
for (j = 0; j < MV_OFFSET_BITS; ++j)
update_nmv(r, &mvctx->comps[i].bits[j], VP9_NMV_UPDATE_PROB);
update_mv(r, &mvc->comps[i].bits[j], VP9_NMV_UPDATE_PROB);
}
for (i = 0; i < 2; ++i) {
for (j = 0; j < CLASS0_SIZE; ++j)
for (k = 0; k < 3; ++k)
update_nmv(r, &mvctx->comps[i].class0_fp[j][k], VP9_NMV_UPDATE_PROB);
update_mv(r, &mvc->comps[i].class0_fp[j][k], VP9_NMV_UPDATE_PROB);
for (j = 0; j < 3; ++j)
update_nmv(r, &mvctx->comps[i].fp[j], VP9_NMV_UPDATE_PROB);
update_mv(r, &mvc->comps[i].fp[j], VP9_NMV_UPDATE_PROB);
}
if (usehp) {
for (i = 0; i < 2; ++i) {
update_nmv(r, &mvctx->comps[i].class0_hp, VP9_NMV_UPDATE_PROB);
update_nmv(r, &mvctx->comps[i].hp, VP9_NMV_UPDATE_PROB);
update_mv(r, &mvc->comps[i].class0_hp, VP9_NMV_UPDATE_PROB);
update_mv(r, &mvc->comps[i].hp, VP9_NMV_UPDATE_PROB);
}
}
}
@ -397,7 +396,7 @@ static void mb_mode_mv_init(VP9D_COMP *pbi, vp9_reader *r) {
}
}
read_nmvprobs(r, nmvc, xd->allow_high_precision_mv);
read_mv_probs(r, nmvc, xd->allow_high_precision_mv);
}
}
@ -468,7 +467,7 @@ static INLINE void decode_mv(vp9_reader *r, MV *mv, const MV *ref,
if (mv_joint_horizontal(j))
diff.col = read_mv_component(r, &ctx->comps[1], usehp);
vp9_increment_nmv(&diff, ref, counts, usehp);
vp9_inc_mv(&diff, ref, counts, usehp);
mv->row = diff.row + ref->row;
mv->col = diff.col + ref->col;

View File

@ -152,12 +152,8 @@ static int update_nmv_savings(const unsigned int ct[2],
}
}
static int update_nmv(
vp9_writer *const bc,
const unsigned int ct[2],
vp9_prob *const cur_p,
const vp9_prob new_p,
const vp9_prob upd_p) {
static int update_mv(vp9_writer *bc, const unsigned int ct[2],
vp9_prob *cur_p, vp9_prob new_p, vp9_prob upd_p) {
#ifdef LOW_PRECISION_MV_UPDATE
vp9_prob mod_p = new_p | 1;
@ -394,6 +390,8 @@ void vp9_write_nmv_probs(VP9_COMP* const cpi, int usehp, vp9_writer* const bc) {
unsigned int branch_ct_fp[2][4 - 1][2];
unsigned int branch_ct_class0_hp[2][2];
unsigned int branch_ct_hp[2][2];
nmv_context *mvc = &cpi->common.fc.nmvc;
#ifdef MV_GROUP_UPDATE
int savings = 0;
#endif
@ -475,63 +473,46 @@ void vp9_write_nmv_probs(VP9_COMP* const cpi, int usehp, vp9_writer* const bc) {
vp9_write_bit(bc, 1);
#endif
for (j = 0; j < MV_JOINTS - 1; ++j) {
update_nmv(bc, branch_ct_joint[j],
&cpi->common.fc.nmvc.joints[j],
prob.joints[j],
VP9_NMV_UPDATE_PROB);
}
for (j = 0; j < MV_JOINTS - 1; ++j)
update_mv(bc, branch_ct_joint[j], &mvc->joints[j], prob.joints[j],
VP9_NMV_UPDATE_PROB);
for (i = 0; i < 2; ++i) {
update_nmv(bc, branch_ct_sign[i],
&cpi->common.fc.nmvc.comps[i].sign,
prob.comps[i].sign,
VP9_NMV_UPDATE_PROB);
for (j = 0; j < MV_CLASSES - 1; ++j) {
update_nmv(bc, branch_ct_classes[i][j],
&cpi->common.fc.nmvc.comps[i].classes[j],
prob.comps[i].classes[j],
VP9_NMV_UPDATE_PROB);
}
for (j = 0; j < CLASS0_SIZE - 1; ++j) {
update_nmv(bc, branch_ct_class0[i][j],
&cpi->common.fc.nmvc.comps[i].class0[j],
prob.comps[i].class0[j],
VP9_NMV_UPDATE_PROB);
}
for (j = 0; j < MV_OFFSET_BITS; ++j) {
update_nmv(bc, branch_ct_bits[i][j],
&cpi->common.fc.nmvc.comps[i].bits[j],
prob.comps[i].bits[j],
VP9_NMV_UPDATE_PROB);
}
update_mv(bc, branch_ct_sign[i], &mvc->comps[i].sign,
prob.comps[i].sign, VP9_NMV_UPDATE_PROB);
for (j = 0; j < MV_CLASSES - 1; ++j)
update_mv(bc, branch_ct_classes[i][j], &mvc->comps[i].classes[j],
prob.comps[i].classes[j], VP9_NMV_UPDATE_PROB);
for (j = 0; j < CLASS0_SIZE - 1; ++j)
update_mv(bc, branch_ct_class0[i][j], &mvc->comps[i].class0[j],
prob.comps[i].class0[j], VP9_NMV_UPDATE_PROB);
for (j = 0; j < MV_OFFSET_BITS; ++j)
update_mv(bc, branch_ct_bits[i][j], &mvc->comps[i].bits[j],
prob.comps[i].bits[j], VP9_NMV_UPDATE_PROB);
}
for (i = 0; i < 2; ++i) {
for (j = 0; j < CLASS0_SIZE; ++j) {
int k;
for (k = 0; k < 3; ++k) {
update_nmv(bc, branch_ct_class0_fp[i][j][k],
&cpi->common.fc.nmvc.comps[i].class0_fp[j][k],
prob.comps[i].class0_fp[j][k],
VP9_NMV_UPDATE_PROB);
}
}
for (j = 0; j < 3; ++j) {
update_nmv(bc, branch_ct_fp[i][j],
&cpi->common.fc.nmvc.comps[i].fp[j],
prob.comps[i].fp[j],
VP9_NMV_UPDATE_PROB);
for (k = 0; k < 3; ++k)
update_mv(bc, branch_ct_class0_fp[i][j][k],
&mvc->comps[i].class0_fp[j][k],
prob.comps[i].class0_fp[j][k], VP9_NMV_UPDATE_PROB);
}
for (j = 0; j < 3; ++j)
update_mv(bc, branch_ct_fp[i][j], &mvc->comps[i].fp[j],
prob.comps[i].fp[j], VP9_NMV_UPDATE_PROB);
}
if (usehp) {
for (i = 0; i < 2; ++i) {
update_nmv(bc, branch_ct_class0_hp[i],
&cpi->common.fc.nmvc.comps[i].class0_hp,
prob.comps[i].class0_hp,
VP9_NMV_UPDATE_PROB);
update_nmv(bc, branch_ct_hp[i],
&cpi->common.fc.nmvc.comps[i].hp,
prob.comps[i].hp,
VP9_NMV_UPDATE_PROB);
update_mv(bc, branch_ct_class0_hp[i], &mvc->comps[i].class0_hp,
prob.comps[i].class0_hp, VP9_NMV_UPDATE_PROB);
update_mv(bc, branch_ct_hp[i], &mvc->comps[i].hp,
prob.comps[i].hp, VP9_NMV_UPDATE_PROB);
}
}
}
@ -582,29 +563,29 @@ void vp9_update_nmv_count(VP9_COMP *cpi, MACROBLOCK *x,
if (pi->bmi[i].mode == NEWMV) {
mv.row = (pi->bmi[i].mv.as_mv.row - best_ref_mv->as_mv.row);
mv.col = (pi->bmi[i].mv.as_mv.col - best_ref_mv->as_mv.col);
vp9_increment_nmv(&mv, &best_ref_mv->as_mv, &cpi->NMVcount,
x->e_mbd.allow_high_precision_mv);
vp9_inc_mv(&mv, &best_ref_mv->as_mv, &cpi->NMVcount,
x->e_mbd.allow_high_precision_mv);
if (x->e_mbd.mode_info_context->mbmi.ref_frame[1] > INTRA_FRAME) {
mv.row = pi->bmi[i].second_mv.as_mv.row -
second_best_ref_mv->as_mv.row;
mv.col = pi->bmi[i].second_mv.as_mv.col -
second_best_ref_mv->as_mv.col;
vp9_increment_nmv(&mv, &second_best_ref_mv->as_mv, &cpi->NMVcount,
x->e_mbd.allow_high_precision_mv);
vp9_inc_mv(&mv, &second_best_ref_mv->as_mv, &cpi->NMVcount,
x->e_mbd.allow_high_precision_mv);
}
}
}
}
} else if (mbmi->mode == NEWMV) {
mv.row = (mbmi->mv[0].as_mv.row - best_ref_mv->as_mv.row);
mv.col = (mbmi->mv[0].as_mv.col - best_ref_mv->as_mv.col);
vp9_increment_nmv(&mv, &best_ref_mv->as_mv, &cpi->NMVcount,
mv.row = mbmi->mv[0].as_mv.row - best_ref_mv->as_mv.row;
mv.col = mbmi->mv[0].as_mv.col - best_ref_mv->as_mv.col;
vp9_inc_mv(&mv, &best_ref_mv->as_mv, &cpi->NMVcount,
x->e_mbd.allow_high_precision_mv);
if (mbmi->ref_frame[1] > INTRA_FRAME) {
mv.row = (mbmi->mv[1].as_mv.row - second_best_ref_mv->as_mv.row);
mv.col = (mbmi->mv[1].as_mv.col - second_best_ref_mv->as_mv.col);
vp9_increment_nmv(&mv, &second_best_ref_mv->as_mv, &cpi->NMVcount,
x->e_mbd.allow_high_precision_mv);
mv.row = mbmi->mv[1].as_mv.row - second_best_ref_mv->as_mv.row;
mv.col = mbmi->mv[1].as_mv.col - second_best_ref_mv->as_mv.col;
vp9_inc_mv(&mv, &second_best_ref_mv->as_mv, &cpi->NMVcount,
x->e_mbd.allow_high_precision_mv);
}
}
}