diff --git a/vp9/common/vp9_entropymv.c b/vp9/common/vp9_entropymv.c index c1b87e2812f6c4bc54f3d86b4b55564ce6cb0428..c4bdb6b7e1ec2cb503a94a43aaf7b79969222418 100644 --- a/vp9/common/vp9_entropymv.c +++ b/vp9/common/vp9_entropymv.c @@ -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); diff --git a/vp9/common/vp9_entropymv.h b/vp9/common/vp9_entropymv.h index 895df30eb629732e7b39461245d08faadf6a57df..d7d6576eae4887de4f4232098b9e92696ffb7f80 100644 --- a/vp9/common/vp9_entropymv.h +++ b/vp9/common/vp9_entropymv.h @@ -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); diff --git a/vp9/common/vp9_pred_common.c b/vp9/common/vp9_pred_common.c index 5c8e34630d04c2bd8eb38646ec4816a21b24b3f4..3d33dbdc2bee83020c6886912b27034023465b31 100644 --- a/vp9/common/vp9_pred_common.c +++ b/vp9/common/vp9_pred_common.c @@ -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; diff --git a/vp9/common/vp9_pred_common.h b/vp9/common/vp9_pred_common.h index 7fc9a1c4bf2a4c56b64ff92c75cbb35b53d2aa04..cb4c1d32aa1c5175b9396260ea2c26b9647608c6 100644 --- a/vp9/common/vp9_pred_common.h +++ b/vp9/common/vp9_pred_common.h @@ -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_ diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c index a193c9fbd4441724c39e91491171c4223713a265..88ede1aae0555014094c243de4b44330ae32bb3a 100644 --- a/vp9/decoder/vp9_decodemv.c +++ b/vp9/decoder/vp9_decodemv.c @@ -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; diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index 928fb70cf2484107c94d4091b3b62f4d0f82974c..bd2928e0814ff3f74182d94cabe64e4868b95d00 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -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]); diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 3dd235a1f9b1a7b41cc70944b731957aa3463077..985e50fb492b155d2d3bc0b10797a125f4c8939b 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -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) { diff --git a/vp9/encoder/vp9_encodemv.c b/vp9/encoder/vp9_encodemv.c index 8adad9d622a62432e3d4af439c1ad6e489648563..f309c1c2b52e8b87796ff655edb0bdb1457c4344 100644 --- a/vp9/encoder/vp9_encodemv.c +++ b/vp9/encoder/vp9_encodemv.c @@ -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); } } } diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 6df17018e6796292ce18dc7e0d269fdd2e81aae1..1b22e60cdd4f0ee9ed07375b1bd9d303a64bb761 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -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]);