Commit 35bd8868 authored by Dmitry Kovalev's avatar Dmitry Kovalev Committed by Gerrit Code Review
Browse files

Merge "Cleaning up pack_inter_mode_mvs() function."

Showing with 18 additions and 20 deletions
...@@ -39,7 +39,7 @@ static INLINE int vp9_get_pred_context_seg_id(const MACROBLOCKD *xd) { ...@@ -39,7 +39,7 @@ static INLINE int vp9_get_pred_context_seg_id(const MACROBLOCKD *xd) {
return above_sip + left_sip; return above_sip + left_sip;
} }
static INLINE vp9_prob vp9_get_pred_prob_seg_id(struct segmentation *seg, static INLINE vp9_prob vp9_get_pred_prob_seg_id(const struct segmentation *seg,
const MACROBLOCKD *xd) { const MACROBLOCKD *xd) {
return seg->pred_probs[vp9_get_pred_context_seg_id(xd)]; return seg->pred_probs[vp9_get_pred_context_seg_id(xd)];
} }
......
...@@ -246,15 +246,15 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) { ...@@ -246,15 +246,15 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
const nmv_context *nmvc = &cm->fc.nmvc; const nmv_context *nmvc = &cm->fc.nmvc;
MACROBLOCK *const x = &cpi->mb; MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
struct segmentation *seg = &cm->seg; const struct segmentation *const seg = &cm->seg;
MB_MODE_INFO *const mi = &m->mbmi; MB_MODE_INFO *const mi = &m->mbmi;
const MV_REFERENCE_FRAME rf = mi->ref_frame[0]; const MV_REFERENCE_FRAME ref0 = mi->ref_frame[0];
const MV_REFERENCE_FRAME sec_rf = mi->ref_frame[1]; const MV_REFERENCE_FRAME ref1 = mi->ref_frame[1];
const MB_PREDICTION_MODE mode = mi->mode; const MB_PREDICTION_MODE mode = mi->mode;
const int segment_id = mi->segment_id; const int segment_id = mi->segment_id;
int skip;
const BLOCK_SIZE bsize = mi->sb_type; const BLOCK_SIZE bsize = mi->sb_type;
const int allow_hp = cm->allow_high_precision_mv; const int allow_hp = cm->allow_high_precision_mv;
int skip;
#ifdef ENTROPY_STATS #ifdef ENTROPY_STATS
active_section = 9; active_section = 9;
...@@ -275,15 +275,15 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) { ...@@ -275,15 +275,15 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
skip = write_skip(cpi, segment_id, m, bc); skip = write_skip(cpi, segment_id, m, bc);
if (!vp9_segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME)) if (!vp9_segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME))
vp9_write(bc, rf != INTRA_FRAME, vp9_get_intra_inter_prob(cm, xd)); vp9_write(bc, ref0 != INTRA_FRAME, vp9_get_intra_inter_prob(cm, xd));
if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT && if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT &&
!(rf != INTRA_FRAME && !(ref0 != INTRA_FRAME &&
(skip || vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP)))) { (skip || vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP)))) {
write_selected_tx_size(cpi, m, mi->tx_size, bsize, bc); write_selected_tx_size(cpi, m, mi->tx_size, bsize, bc);
} }
if (rf == INTRA_FRAME) { if (ref0 == INTRA_FRAME) {
#ifdef ENTROPY_STATS #ifdef ENTROPY_STATS
active_section = 6; active_section = 6;
#endif #endif
...@@ -305,7 +305,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) { ...@@ -305,7 +305,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
} else { } else {
vp9_prob *mv_ref_p; vp9_prob *mv_ref_p;
encode_ref_frame(cpi, bc); encode_ref_frame(cpi, bc);
mv_ref_p = cpi->common.fc.inter_mode_probs[mi->mode_context[rf]]; mv_ref_p = cm->fc.inter_mode_probs[mi->mode_context[ref0]];
#ifdef ENTROPY_STATS #ifdef ENTROPY_STATS
active_section = 3; active_section = 3;
...@@ -315,7 +315,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) { ...@@ -315,7 +315,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
if (!vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP)) { if (!vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP)) {
if (bsize >= BLOCK_8X8) { if (bsize >= BLOCK_8X8) {
write_inter_mode(bc, mode, mv_ref_p); write_inter_mode(bc, mode, mv_ref_p);
++cm->counts.inter_mode[mi->mode_context[rf]][INTER_OFFSET(mode)]; ++cm->counts.inter_mode[mi->mode_context[ref0]][INTER_OFFSET(mode)];
} }
} }
...@@ -335,21 +335,19 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) { ...@@ -335,21 +335,19 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
for (idy = 0; idy < 2; idy += num_4x4_blocks_high) { for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) { for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
const int j = idy * 2 + idx; const int j = idy * 2 + idx;
const MB_PREDICTION_MODE blockmode = m->bmi[j].as_mode; const MB_PREDICTION_MODE b_mode = m->bmi[j].as_mode;
write_inter_mode(bc, blockmode, mv_ref_p); write_inter_mode(bc, b_mode, mv_ref_p);
++cm->counts.inter_mode[mi->mode_context[rf]] ++cm->counts.inter_mode[mi->mode_context[ref0]][INTER_OFFSET(b_mode)];
[INTER_OFFSET(blockmode)]; if (b_mode == NEWMV) {
if (blockmode == NEWMV) {
#ifdef ENTROPY_STATS #ifdef ENTROPY_STATS
active_section = 11; active_section = 11;
#endif #endif
vp9_encode_mv(cpi, bc, &m->bmi[j].as_mv[0].as_mv, vp9_encode_mv(cpi, bc, &m->bmi[j].as_mv[0].as_mv,
&mi->ref_mvs[rf][0].as_mv, nmvc, allow_hp); &mi->ref_mvs[ref0][0].as_mv, nmvc, allow_hp);
if (has_second_ref(mi)) if (has_second_ref(mi))
vp9_encode_mv(cpi, bc, &m->bmi[j].as_mv[1].as_mv, vp9_encode_mv(cpi, bc, &m->bmi[j].as_mv[1].as_mv,
&mi->ref_mvs[sec_rf][0].as_mv, nmvc, allow_hp); &mi->ref_mvs[ref1][0].as_mv, nmvc, allow_hp);
} }
} }
} }
...@@ -358,11 +356,11 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) { ...@@ -358,11 +356,11 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
active_section = 5; active_section = 5;
#endif #endif
vp9_encode_mv(cpi, bc, &mi->mv[0].as_mv, vp9_encode_mv(cpi, bc, &mi->mv[0].as_mv,
&mi->ref_mvs[rf][0].as_mv, nmvc, allow_hp); &mi->ref_mvs[ref0][0].as_mv, nmvc, allow_hp);
if (has_second_ref(mi)) if (has_second_ref(mi))
vp9_encode_mv(cpi, bc, &mi->mv[1].as_mv, vp9_encode_mv(cpi, bc, &mi->mv[1].as_mv,
&mi->ref_mvs[sec_rf][0].as_mv, nmvc, allow_hp); &mi->ref_mvs[ref1][0].as_mv, nmvc, allow_hp);
} }
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment