Commit ba93f0a2 authored by Deb Mukherjee's avatar Deb Mukherjee Committed by Gerrit Code Review
Browse files

Merge "Moves inter mode count updates to update_stats"

parents 7ba6a676 e7570493
...@@ -297,7 +297,6 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi, ...@@ -297,7 +297,6 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi,
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(w, mode, inter_probs); write_inter_mode(w, mode, inter_probs);
++cpi->td.counts->inter_mode[mode_ctx][INTER_OFFSET(mode)];
} }
} }
...@@ -320,7 +319,6 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi, ...@@ -320,7 +319,6 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi,
const int j = idy * 2 + idx; const int j = idy * 2 + idx;
const PREDICTION_MODE b_mode = mi->bmi[j].as_mode; const PREDICTION_MODE b_mode = mi->bmi[j].as_mode;
write_inter_mode(w, b_mode, inter_probs); write_inter_mode(w, b_mode, inter_probs);
++cpi->td.counts->inter_mode[mode_ctx][INTER_OFFSET(b_mode)];
if (b_mode == NEWMV) { if (b_mode == NEWMV) {
for (ref = 0; ref < 1 + is_compound; ++ref) for (ref = 0; ref < 1 + is_compound; ++ref)
vp9_encode_mv(cpi, w, &mi->bmi[j].as_mv[ref].as_mv, vp9_encode_mv(cpi, w, &mi->bmi[j].as_mv[ref].as_mv,
...@@ -1172,8 +1170,6 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) { ...@@ -1172,8 +1170,6 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
prob_diff_update(vp9_inter_mode_tree, cm->fc->inter_mode_probs[i], prob_diff_update(vp9_inter_mode_tree, cm->fc->inter_mode_probs[i],
counts->inter_mode[i], INTER_MODES, &header_bc); counts->inter_mode[i], INTER_MODES, &header_bc);
vp9_zero(counts->inter_mode);
if (cm->interp_filter == SWITCHABLE) if (cm->interp_filter == SWITCHABLE)
update_switchable_interp_probs(cm, &header_bc, counts); update_switchable_interp_probs(cm, &header_bc, counts);
......
...@@ -1007,22 +1007,20 @@ static void update_stats(VP9_COMMON *cm, ThreadData *td) { ...@@ -1007,22 +1007,20 @@ static void update_stats(VP9_COMMON *cm, ThreadData *td) {
const MACROBLOCKD *const xd = &x->e_mbd; const MACROBLOCKD *const xd = &x->e_mbd;
const MODE_INFO *const mi = xd->mi[0].src_mi; const MODE_INFO *const mi = xd->mi[0].src_mi;
const MB_MODE_INFO *const mbmi = &mi->mbmi; const MB_MODE_INFO *const mbmi = &mi->mbmi;
const BLOCK_SIZE bsize = mbmi->sb_type;
if (!frame_is_intra_only(cm)) { if (!frame_is_intra_only(cm)) {
FRAME_COUNTS *const counts = td->counts;
const int inter_block = is_inter_block(mbmi);
const int seg_ref_active = vp9_segfeature_active(&cm->seg, mbmi->segment_id, const int seg_ref_active = vp9_segfeature_active(&cm->seg, mbmi->segment_id,
SEG_LVL_REF_FRAME); SEG_LVL_REF_FRAME);
if (!seg_ref_active) { if (!seg_ref_active) {
FRAME_COUNTS *const counts = td->counts;
const int inter_block = is_inter_block(mbmi);
counts->intra_inter[vp9_get_intra_inter_context(xd)][inter_block]++; counts->intra_inter[vp9_get_intra_inter_context(xd)][inter_block]++;
// If the segment reference feature is enabled we have only a single // If the segment reference feature is enabled we have only a single
// reference frame allowed for the segment so exclude it from // reference frame allowed for the segment so exclude it from
// the reference frame counts used to work out probabilities. // the reference frame counts used to work out probabilities.
if (inter_block) { if (inter_block) {
const MV_REFERENCE_FRAME ref0 = mbmi->ref_frame[0]; const MV_REFERENCE_FRAME ref0 = mbmi->ref_frame[0];
if (cm->reference_mode == REFERENCE_MODE_SELECT) if (cm->reference_mode == REFERENCE_MODE_SELECT)
counts->comp_inter[vp9_get_reference_mode_context(cm, xd)] counts->comp_inter[vp9_get_reference_mode_context(cm, xd)]
[has_second_ref(mbmi)]++; [has_second_ref(mbmi)]++;
...@@ -1039,6 +1037,25 @@ static void update_stats(VP9_COMMON *cm, ThreadData *td) { ...@@ -1039,6 +1037,25 @@ static void update_stats(VP9_COMMON *cm, ThreadData *td) {
} }
} }
} }
if (inter_block &&
!vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
const int mode_ctx = mbmi->mode_context[mbmi->ref_frame[0]];
if (bsize >= BLOCK_8X8) {
const PREDICTION_MODE mode = mbmi->mode;
++counts->inter_mode[mode_ctx][INTER_OFFSET(mode)];
} else {
const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize];
const int num_4x4_h = num_4x4_blocks_high_lookup[bsize];
int idx, idy;
for (idy = 0; idy < 2; idy += num_4x4_h) {
for (idx = 0; idx < 2; idx += num_4x4_w) {
const int j = idy * 2 + idx;
const PREDICTION_MODE b_mode = mi->bmi[j].as_mode;
++counts->inter_mode[mode_ctx][INTER_OFFSET(b_mode)];
}
}
}
}
} }
} }
......
Markdown is supported
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