Merge changes Ieffea49e,Idf610746

* changes:
  Removing two unused arguments from vp9_inc_mv signature.
  Changing signature of vp9_get_pred_probs_tx_size.
This commit is contained in:
Dmitry Kovalev 2013-07-17 14:44:20 -07:00 committed by Gerrit Code Review
commit a7a1e96136
9 changed files with 38 additions and 46 deletions

View File

@ -164,11 +164,9 @@ static void counts_to_context(nmv_component_counts *mvcomp, int usehp) {
}
}
void vp9_inc_mv(const MV *mv, const MV *ref, nmv_context_counts *mvctx,
int usehp) {
void vp9_inc_mv(const MV *mv, nmv_context_counts *mvctx) {
const MV_JOINT_TYPE j = vp9_get_mv_joint(mv);
mvctx->joints[j]++;
usehp = usehp && vp9_use_mv_hp(ref);
if (mv_joint_vertical(j))
inc_mv_component_count(mv->row, &mvctx->comps[0], 1);

View File

@ -125,8 +125,7 @@ typedef struct {
nmv_component_counts comps[2];
} nmv_context_counts;
void vp9_inc_mv(const MV *mv, const MV *ref, nmv_context_counts *mvctx,
int usehp);
void vp9_inc_mv(const MV *mv, nmv_context_counts *mvctx);
void vp9_counts_process(nmv_context_counts *NMVcount, int usehp);

View File

@ -367,10 +367,9 @@ unsigned char vp9_get_pred_context_single_ref_p2(const VP9_COMMON *cm,
return pred_context;
}
// Returns a context number for the given MB prediction signal
unsigned char vp9_get_pred_context_tx_size(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
unsigned char vp9_get_pred_context_tx_size(const MACROBLOCKD *xd) {
const MODE_INFO *const mi = xd->mode_info_context;
const MODE_INFO *const above_mi = mi - cm->mode_info_stride;
const MODE_INFO *const above_mi = mi - xd->mode_info_stride;
const MODE_INFO *const left_mi = mi - 1;
const int left_in_image = xd->left_available && left_mi->mbmi.mb_in_image;
const int above_in_image = xd->up_available && above_mi->mbmi.mb_in_image;

View File

@ -110,19 +110,18 @@ static INLINE vp9_prob vp9_get_pred_prob_single_ref_p2(const VP9_COMMON *cm,
return cm->fc.single_ref_prob[pred_context][1];
}
unsigned char vp9_get_pred_context_tx_size(const VP9_COMMON *cm,
const MACROBLOCKD *xd);
unsigned char vp9_get_pred_context_tx_size(const MACROBLOCKD *xd);
static INLINE const vp9_prob *vp9_get_pred_probs_tx_size(const VP9_COMMON *cm,
const MACROBLOCKD * xd) {
static const vp9_prob *vp9_get_pred_probs_tx_size(const MACROBLOCKD *xd,
const struct tx_probs *tx_probs) {
const MODE_INFO *const mi = xd->mode_info_context;
const int pred_context = vp9_get_pred_context_tx_size(cm, xd);
const int pred_context = vp9_get_pred_context_tx_size(xd);
if (mi->mbmi.sb_type < BLOCK_SIZE_MB16X16)
return cm->fc.tx_probs.p8x8[pred_context];
return tx_probs->p8x8[pred_context];
else if (mi->mbmi.sb_type < BLOCK_SIZE_SB32X32)
return cm->fc.tx_probs.p16x16[pred_context];
return tx_probs->p16x16[pred_context];
else
return cm->fc.tx_probs.p32x32[pred_context];
return tx_probs->p32x32[pred_context];
}
#endif // VP9_COMMON_VP9_PRED_COMMON_H_

View File

@ -40,8 +40,8 @@ static int read_segment_id(vp9_reader *r, const struct segmentation *seg) {
static TX_SIZE read_selected_txfm_size(VP9_COMMON *cm, MACROBLOCKD *xd,
BLOCK_SIZE_TYPE bsize, vp9_reader *r) {
const int context = vp9_get_pred_context_tx_size(cm, xd);
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(cm, xd);
const int context = vp9_get_pred_context_tx_size(xd);
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(xd, &cm->fc.tx_probs);
TX_SIZE txfm_size = vp9_read(r, tx_probs[0]);
if (txfm_size != TX_4X4 && bsize >= BLOCK_SIZE_MB16X16) {
txfm_size += vp9_read(r, tx_probs[1]);
@ -245,7 +245,7 @@ static INLINE void read_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_inc_mv(&diff, ref, counts, usehp);
vp9_inc_mv(&diff, counts);
mv->row = ref->row + diff.row;
mv->col = ref->col + diff.col;

View File

@ -202,9 +202,9 @@ static void update_mbintra_mode_probs(VP9_COMP* const cpi,
static void write_selected_txfm_size(const VP9_COMP *cpi, TX_SIZE tx_size,
BLOCK_SIZE_TYPE bsize, vp9_writer *w) {
const VP9_COMMON *const c = &cpi->common;
const VP9_COMMON *const cm = &cpi->common;
const MACROBLOCKD *const xd = &cpi->mb.e_mbd;
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(c, xd);
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(xd, &cm->fc.tx_probs);
vp9_write(w, tx_size != TX_4X4, tx_probs[0]);
if (bsize >= BLOCK_SIZE_MB16X16 && tx_size != TX_4X4) {
vp9_write(w, tx_size != TX_8X8, tx_probs[1]);

View File

@ -2518,7 +2518,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
!(mbmi->ref_frame[0] != INTRA_FRAME &&
(mbmi->mb_skip_coeff ||
vp9_segfeature_active(&xd->seg, segment_id, SEG_LVL_SKIP)))) {
const int context = vp9_get_pred_context_tx_size(cm, xd);
const int context = vp9_get_pred_context_tx_size(xd);
if (bsize >= BLOCK_SIZE_SB32X32) {
cm->fc.tx_counts.p32x32[context][mbmi->txfm_size]++;
} else if (bsize >= BLOCK_SIZE_MB16X16) {

View File

@ -510,44 +510,41 @@ void vp9_build_nmv_cost_table(int *mvjoint,
void vp9_update_nmv_count(VP9_COMP *cpi, MACROBLOCK *x,
int_mv *best_ref_mv, int_mv *second_best_ref_mv) {
MB_MODE_INFO * mbmi = &x->e_mbd.mode_info_context->mbmi;
MV mv;
int bwl = b_width_log2(mbmi->sb_type), bw = 1 << bwl;
int bhl = b_height_log2(mbmi->sb_type), bh = 1 << bhl;
MB_MODE_INFO *mbmi = &x->e_mbd.mode_info_context->mbmi;
MV diff;
const int bw = 1 << b_width_log2(mbmi->sb_type);
const int bh = 1 << b_height_log2(mbmi->sb_type);
int idx, idy;
if (mbmi->sb_type < BLOCK_SIZE_SB8X8) {
int i;
PARTITION_INFO *pi = x->partition_info;
for (idy = 0; idy < 2; idy += bh) {
for (idx = 0; idx < 2; idx += bw) {
i = idy * 2 + idx;
const int i = idy * 2 + idx;
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_inc_mv(&mv, &best_ref_mv->as_mv, &cpi->NMVcount,
x->e_mbd.allow_high_precision_mv);
diff.row = pi->bmi[i].mv.as_mv.row - best_ref_mv->as_mv.row;
diff.col = pi->bmi[i].mv.as_mv.col - best_ref_mv->as_mv.col;
vp9_inc_mv(&diff, &cpi->NMVcount);
if (x->e_mbd.mode_info_context->mbmi.ref_frame[1] > INTRA_FRAME) {
mv.row = pi->bmi[i].second_mv.as_mv.row -
diff.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 -
diff.col = pi->bmi[i].second_mv.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);
vp9_inc_mv(&diff, &cpi->NMVcount);
}
}
}
}
} 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_inc_mv(&mv, &best_ref_mv->as_mv, &cpi->NMVcount,
x->e_mbd.allow_high_precision_mv);
diff.row = mbmi->mv[0].as_mv.row - best_ref_mv->as_mv.row;
diff.col = mbmi->mv[0].as_mv.col - best_ref_mv->as_mv.col;
vp9_inc_mv(&diff, &cpi->NMVcount);
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_inc_mv(&mv, &second_best_ref_mv->as_mv, &cpi->NMVcount,
x->e_mbd.allow_high_precision_mv);
diff.row = mbmi->mv[1].as_mv.row - second_best_ref_mv->as_mv.row;
diff.col = mbmi->mv[1].as_mv.col - second_best_ref_mv->as_mv.col;
vp9_inc_mv(&diff, &cpi->NMVcount);
}
}
}

View File

@ -865,7 +865,7 @@ static void choose_txfm_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x,
int n, m;
int s0, s1;
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(cm, xd);
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(xd, &cm->fc.tx_probs);
for (n = TX_4X4; n <= max_txfm_size; n++) {
r[n][1] = r[n][0];
@ -972,7 +972,7 @@ static void choose_txfm_size_from_modelrd(VP9_COMP *cpi, MACROBLOCK *x,
double scale_rd[TX_SIZE_MAX_SB] = {1.73, 1.44, 1.20, 1.00};
// double scale_r[TX_SIZE_MAX_SB] = {2.82, 2.00, 1.41, 1.00};
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(cm, xd);
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(xd, &cm->fc.tx_probs);
// for (n = TX_4X4; n <= max_txfm_size; n++)
// r[n][0] = (r[n][0] * scale_r[n]);